packages feed

eigen 3.3.4.2 → 3.3.7.0

raw patch · 1204 files changed

+124650/−4220 lines, 1204 filesbinary-addedPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

+ Eigen.SparseMatrix: fromListSized :: (Elem a, KnownNat n, KnownNat m) => Int -> Int -> [(Int, Int, a)] -> SparseMatrix n m a
+ Eigen.SparseMatrix: fromVectorSized :: forall n m a. (Elem a, KnownNat n, KnownNat m) => Int -> Int -> Vector (CTriplet a) -> SparseMatrix n m a
+ Eigen.SparseMatrix: getCols :: forall n m a. (Elem a, KnownNat n, KnownNat m) => SparseMatrix n m a -> [SparseMatrix n 1 a]
+ Eigen.SparseMatrix: getRows :: forall n m a. (Elem a, KnownNat n, KnownNat m) => SparseMatrix n m a -> [SparseMatrix 1 m a]
+ Eigen.SparseMatrix: unsafeBlock :: (Elem a) => Int -> Int -> Int -> Int -> SparseMatrix n m a -> SparseMatrix n1 m1 a
+ Eigen.SparseMatrix: unsafeFromCols :: forall n m a. (Elem a, KnownNat n, KnownNat m) => [SparseMatrix n 1 a] -> SparseMatrix n m a
+ Eigen.SparseMatrix: unsafeFromRows :: forall n m a. (Elem a, KnownNat n, KnownNat m) => [SparseMatrix 1 m a] -> SparseMatrix n m a
+ Eigen.SparseMatrix: unsafeGetCol :: forall n m a. (Elem a, KnownNat n, KnownNat m) => Int -> SparseMatrix n m a -> SparseMatrix n 1 a
+ Eigen.SparseMatrix: unsafeGetRow :: forall n m a. (Elem a, KnownNat n, KnownNat m) => Int -> SparseMatrix n m a -> SparseMatrix 1 m a

Files

eigen.cabal view
@@ -1,6 +1,6 @@ cabal-version:  >= 1.10 name:           eigen-version:        3.3.4.2+version:        3.3.7.0 homepage:       https://github.com/chessai/eigen synopsis:       Eigen C++ library (linear algebra: matrices, sparse matrices, vectors, numerical solvers). description:    __NOTE__: This library does not follow PVP. Instead, it follows Eigen's versioning. Version@@ -66,11 +66,577 @@     cbits/eigen-sparse.h     cbits/eigen-sparse-la.h     eigen3/COPYING.MPL2+    eigen3/demos/mandelbrot/mandelbrot.h+    eigen3/demos/mandelbrot/README+    eigen3/demos/mandelbrot/CMakeLists.txt+    eigen3/demos/mandelbrot/mandelbrot.cpp+    eigen3/demos/mix_eigen_and_c/binary_library.h+    eigen3/demos/mix_eigen_and_c/binary_library.cpp+    eigen3/demos/mix_eigen_and_c/example.c+    eigen3/demos/mix_eigen_and_c/README+    eigen3/demos/opengl/trackball.h+    eigen3/demos/opengl/camera.cpp+    eigen3/demos/opengl/camera.h+    eigen3/demos/opengl/trackball.cpp+    eigen3/demos/opengl/icosphere.h+    eigen3/demos/opengl/README+    eigen3/demos/opengl/quaternion_demo.cpp+    eigen3/demos/opengl/icosphere.cpp+    eigen3/demos/opengl/quaternion_demo.h+    eigen3/demos/opengl/gpuhelper.h+    eigen3/demos/opengl/CMakeLists.txt+    eigen3/demos/opengl/gpuhelper.cpp+    eigen3/demos/CMakeLists.txt     eigen3/README.md     eigen3/COPYING.LGPL+    eigen3/failtest/ldlt_int.cpp+    eigen3/failtest/ref_3.cpp+    eigen3/failtest/cwiseunaryview_nonconst_ctor_on_const_xpr.cpp+    eigen3/failtest/partialpivlu_int.cpp+    eigen3/failtest/block_nonconst_ctor_on_const_xpr_2.cpp+    eigen3/failtest/ref_4.cpp+    eigen3/failtest/llt_int.cpp+    eigen3/failtest/const_qualified_transpose_method_retval.cpp+    eigen3/failtest/fullpivqr_int.cpp+    eigen3/failtest/sparse_ref_5.cpp+    eigen3/failtest/swap_1.cpp+    eigen3/failtest/bdcsvd_int.cpp+    eigen3/failtest/eigensolver_cplx.cpp+    eigen3/failtest/map_nonconst_ctor_on_const_ptr_1.cpp+    eigen3/failtest/ref_1.cpp+    eigen3/failtest/sparse_ref_4.cpp+    eigen3/failtest/map_nonconst_ctor_on_const_ptr_4.cpp+    eigen3/failtest/triangularview_nonconst_ctor_on_const_xpr.cpp+    eigen3/failtest/swap_2.cpp+    eigen3/failtest/map_on_const_type_actually_const_1.cpp+    eigen3/failtest/cwiseunaryview_on_const_type_actually_const.cpp+    eigen3/failtest/ref_2.cpp+    eigen3/failtest/transpose_nonconst_ctor_on_const_xpr.cpp+    eigen3/failtest/selfadjointview_on_const_type_actually_const.cpp+    eigen3/failtest/eigensolver_int.cpp+    eigen3/failtest/map_on_const_type_actually_const_0.cpp+    eigen3/failtest/ternary_2.cpp+    eigen3/failtest/sparse_ref_3.cpp+    eigen3/failtest/const_qualified_block_method_retval_1.cpp+    eigen3/failtest/const_qualified_block_method_retval_0.cpp+    eigen3/failtest/ternary_1.cpp+    eigen3/failtest/failtest_sanity_check.cpp+    eigen3/failtest/qr_int.cpp+    eigen3/failtest/block_on_const_type_actually_const_0.cpp+    eigen3/failtest/jacobisvd_int.cpp+    eigen3/failtest/sparse_ref_2.cpp+    eigen3/failtest/sparse_storage_mismatch.cpp+    eigen3/failtest/const_qualified_diagonal_method_retval.cpp+    eigen3/failtest/selfadjointview_nonconst_ctor_on_const_xpr.cpp+    eigen3/failtest/map_nonconst_ctor_on_const_ptr_0.cpp+    eigen3/failtest/diagonal_on_const_type_actually_const.cpp+    eigen3/failtest/CMakeLists.txt+    eigen3/failtest/transpose_on_const_type_actually_const.cpp+    eigen3/failtest/block_nonconst_ctor_on_const_xpr_0.cpp+    eigen3/failtest/block_on_const_type_actually_const_1.cpp+    eigen3/failtest/map_nonconst_ctor_on_const_ptr_3.cpp+    eigen3/failtest/diagonal_nonconst_ctor_on_const_xpr.cpp+    eigen3/failtest/triangularview_on_const_type_actually_const.cpp+    eigen3/failtest/map_nonconst_ctor_on_const_ptr_2.cpp+    eigen3/failtest/fullpivlu_int.cpp+    eigen3/failtest/ref_5.cpp+    eigen3/failtest/sparse_ref_1.cpp+    eigen3/failtest/colpivqr_int.cpp+    eigen3/failtest/block_nonconst_ctor_on_const_xpr_1.cpp     eigen3/COPYING.MINPACK     eigen3/COPYING.README+    eigen3/lapack/ilaslc.f+    eigen3/lapack/dlamch.f+    eigen3/lapack/cladiv.f+    eigen3/lapack/double.cpp+    eigen3/lapack/slarfb.f+    eigen3/lapack/zlarfg.f+    eigen3/lapack/dlarft.f+    eigen3/lapack/lapack_common.h+    eigen3/lapack/zladiv.f+    eigen3/lapack/iladlr.f+    eigen3/lapack/dsecnd_NONE.f+    eigen3/lapack/slarft.f+    eigen3/lapack/svd.cpp+    eigen3/lapack/slapy3.f+    eigen3/lapack/dlapy2.f+    eigen3/lapack/clarfb.f+    eigen3/lapack/complex_double.cpp+    eigen3/lapack/ilazlr.f+    eigen3/lapack/dlarfg.f+    eigen3/lapack/zlacgv.f+    eigen3/lapack/eigenvalues.cpp+    eigen3/lapack/clarfg.f+    eigen3/lapack/zlarfb.f+    eigen3/lapack/dlapy3.f+    eigen3/lapack/ilazlc.f+    eigen3/lapack/complex_single.cpp+    eigen3/lapack/ilaclc.f+    eigen3/lapack/dladiv.f+    eigen3/lapack/clarf.f+    eigen3/lapack/lu.cpp+    eigen3/lapack/slamch.f+    eigen3/lapack/dlarfb.f+    eigen3/lapack/clarft.f+    eigen3/lapack/ilaclr.f+    eigen3/lapack/single.cpp+    eigen3/lapack/zlarf.f+    eigen3/lapack/slapy2.f+    eigen3/lapack/slarf.f+    eigen3/lapack/cholesky.cpp+    eigen3/lapack/CMakeLists.txt+    eigen3/lapack/zlarft.f+    eigen3/lapack/clacgv.f+    eigen3/lapack/slarfg.f+    eigen3/lapack/iladlc.f+    eigen3/lapack/sladiv.f+    eigen3/lapack/second_NONE.f+    eigen3/lapack/ilaslr.f+    eigen3/lapack/dlarf.f     eigen3/COPYING.BSD+    eigen3/bench/benchFFT.cpp+    eigen3/bench/sparse_cholesky.cpp+    eigen3/bench/perf_monitoring/gemm/gemm.cpp+    eigen3/bench/perf_monitoring/gemm/gemm_settings.txt+    eigen3/bench/perf_monitoring/gemm/lazy_gemm.cpp+    eigen3/bench/perf_monitoring/gemm/lazy_gemm_settings.txt+    eigen3/bench/perf_monitoring/gemm/changesets.txt+    eigen3/bench/perf_monitoring/gemm/run.sh+    eigen3/bench/perf_monitoring/gemm/make_plot.sh+    eigen3/bench/btl/COPYING+    eigen3/bench/btl/libs/mtl4/mtl4_LU_solve_interface.hh+    eigen3/bench/btl/libs/mtl4/.kdbgrc.main+    eigen3/bench/btl/libs/mtl4/main.cpp+    eigen3/bench/btl/libs/mtl4/CMakeLists.txt+    eigen3/bench/btl/libs/mtl4/mtl4_interface.hh+    eigen3/bench/btl/libs/eigen3/btl_tiny_eigen3.cpp+    eigen3/bench/btl/libs/eigen3/eigen3_interface.hh+    eigen3/bench/btl/libs/eigen3/main_vecmat.cpp+    eigen3/bench/btl/libs/eigen3/main_adv.cpp+    eigen3/bench/btl/libs/eigen3/main_linear.cpp+    eigen3/bench/btl/libs/eigen3/main_matmat.cpp+    eigen3/bench/btl/libs/eigen3/CMakeLists.txt+    eigen3/bench/btl/libs/gmm/gmm_LU_solve_interface.hh+    eigen3/bench/btl/libs/gmm/main.cpp+    eigen3/bench/btl/libs/gmm/CMakeLists.txt+    eigen3/bench/btl/libs/gmm/gmm_interface.hh+    eigen3/bench/btl/libs/blitz/blitz_interface.hh+    eigen3/bench/btl/libs/blitz/blitz_LU_solve_interface.hh+    eigen3/bench/btl/libs/blitz/tiny_blitz_interface.hh+    eigen3/bench/btl/libs/blitz/btl_blitz.cpp+    eigen3/bench/btl/libs/blitz/btl_tiny_blitz.cpp+    eigen3/bench/btl/libs/blitz/CMakeLists.txt+    eigen3/bench/btl/libs/ublas/ublas_interface.hh+    eigen3/bench/btl/libs/ublas/main.cpp+    eigen3/bench/btl/libs/ublas/CMakeLists.txt+    eigen3/bench/btl/libs/BLAS/blas_interface_impl.hh+    eigen3/bench/btl/libs/BLAS/blas_interface.hh+    eigen3/bench/btl/libs/BLAS/blas.h+    eigen3/bench/btl/libs/BLAS/c_interface_base.h+    eigen3/bench/btl/libs/BLAS/main.cpp+    eigen3/bench/btl/libs/BLAS/CMakeLists.txt+    eigen3/bench/btl/libs/STL/STL_interface.hh+    eigen3/bench/btl/libs/STL/main.cpp+    eigen3/bench/btl/libs/STL/CMakeLists.txt+    eigen3/bench/btl/libs/tensors/main_vecmat.cpp+    eigen3/bench/btl/libs/tensors/tensor_interface.hh+    eigen3/bench/btl/libs/tensors/main_linear.cpp+    eigen3/bench/btl/libs/tensors/main_matmat.cpp+    eigen3/bench/btl/libs/tensors/CMakeLists.txt+    eigen3/bench/btl/libs/eigen2/btl_tiny_eigen2.cpp+    eigen3/bench/btl/libs/eigen2/main_vecmat.cpp+    eigen3/bench/btl/libs/eigen2/main_adv.cpp+    eigen3/bench/btl/libs/eigen2/eigen2_interface.hh+    eigen3/bench/btl/libs/eigen2/main_linear.cpp+    eigen3/bench/btl/libs/eigen2/main_matmat.cpp+    eigen3/bench/btl/libs/eigen2/CMakeLists.txt+    eigen3/bench/btl/libs/tvmet/tvmet_interface.hh+    eigen3/bench/btl/libs/tvmet/main.cpp+    eigen3/bench/btl/libs/tvmet/CMakeLists.txt+    eigen3/bench/btl/libs/blaze/blaze_interface.hh+    eigen3/bench/btl/libs/blaze/main.cpp+    eigen3/bench/btl/libs/blaze/CMakeLists.txt+    eigen3/bench/btl/data/mk_gnuplot_script.sh+    eigen3/bench/btl/data/smooth.cxx+    eigen3/bench/btl/data/mk_mean_script.sh+    eigen3/bench/btl/data/mean.cxx+    eigen3/bench/btl/data/gnuplot_common_settings.hh+    eigen3/bench/btl/data/mk_new_gnuplot.sh+    eigen3/bench/btl/data/perlib_plot_settings.txt+    eigen3/bench/btl/data/action_settings.txt+    eigen3/bench/btl/data/CMakeLists.txt+    eigen3/bench/btl/data/regularize.cxx+    eigen3/bench/btl/data/go_mean+    eigen3/bench/btl/data/smooth_all.sh+    eigen3/bench/btl/README+    eigen3/bench/btl/cmake/FindMKL.cmake+    eigen3/bench/btl/cmake/FindMTL4.cmake+    eigen3/bench/btl/cmake/FindACML.cmake+    eigen3/bench/btl/cmake/FindOPENBLAS.cmake+    eigen3/bench/btl/cmake/FindCBLAS.cmake+    eigen3/bench/btl/cmake/FindPackageHandleStandardArgs.cmake+    eigen3/bench/btl/cmake/FindTvmet.cmake+    eigen3/bench/btl/cmake/FindATLAS.cmake+    eigen3/bench/btl/cmake/FindBLAZE.cmake+    eigen3/bench/btl/cmake/MacroOptionalAddSubdirectory.cmake+    eigen3/bench/btl/cmake/FindGMM.cmake+    eigen3/bench/btl/cmake/FindBlitz.cmake+    eigen3/bench/btl/CMakeLists.txt+    eigen3/bench/btl/actions/action_ger.hh+    eigen3/bench/btl/actions/action_lu_solve.hh+    eigen3/bench/btl/actions/action_trisolve.hh+    eigen3/bench/btl/actions/action_rot.hh+    eigen3/bench/btl/actions/action_syr2.hh+    eigen3/bench/btl/actions/action_matrix_vector_product.hh+    eigen3/bench/btl/actions/action_aat_product.hh+    eigen3/bench/btl/actions/basic_actions.hh+    eigen3/bench/btl/actions/action_trisolve_matrix.hh+    eigen3/bench/btl/actions/action_symv.hh+    eigen3/bench/btl/actions/action_lu_decomp.hh+    eigen3/bench/btl/actions/action_atv_product.hh+    eigen3/bench/btl/actions/action_axpby.hh+    eigen3/bench/btl/actions/action_ata_product.hh+    eigen3/bench/btl/actions/action_partial_lu.hh+    eigen3/bench/btl/actions/action_hessenberg.hh+    eigen3/bench/btl/actions/action_matrix_matrix_product.hh+    eigen3/bench/btl/actions/action_matrix_matrix_product_bis.hh+    eigen3/bench/btl/actions/action_cholesky.hh+    eigen3/bench/btl/actions/action_axpy.hh+    eigen3/bench/btl/actions/action_trmm.hh+    eigen3/bench/btl/generic_bench/static/bench_static.hh+    eigen3/bench/btl/generic_bench/static/intel_bench_fixed_size.hh+    eigen3/bench/btl/generic_bench/static/static_size_generator.hh+    eigen3/bench/btl/generic_bench/utils/size_log.hh+    eigen3/bench/btl/generic_bench/utils/xy_file.hh+    eigen3/bench/btl/generic_bench/utils/size_lin_log.hh+    eigen3/bench/btl/generic_bench/utils/utilities.h+    eigen3/bench/btl/generic_bench/bench_parameter.hh+    eigen3/bench/btl/generic_bench/bench.hh+    eigen3/bench/btl/generic_bench/timers/STL_perf_analyzer.hh+    eigen3/bench/btl/generic_bench/timers/portable_timer.hh+    eigen3/bench/btl/generic_bench/timers/x86_timer.hh+    eigen3/bench/btl/generic_bench/timers/portable_perf_analyzer.hh+    eigen3/bench/btl/generic_bench/timers/STL_timer.hh+    eigen3/bench/btl/generic_bench/timers/x86_perf_analyzer.hh+    eigen3/bench/btl/generic_bench/timers/mixed_perf_analyzer.hh+    eigen3/bench/btl/generic_bench/timers/portable_perf_analyzer_old.hh+    eigen3/bench/btl/generic_bench/btl.hh+    eigen3/bench/btl/generic_bench/init/init_vector.hh+    eigen3/bench/btl/generic_bench/init/init_function.hh+    eigen3/bench/btl/generic_bench/init/init_matrix.hh+    eigen3/bench/benchmark_suite+    eigen3/bench/basicbenchmark.h+    eigen3/bench/basicbenchmark.cpp+    eigen3/bench/sparse_randomsetter.cpp+    eigen3/bench/benchmarkX.cpp+    eigen3/bench/bench_unrolling+    eigen3/bench/sparse_setter.cpp+    eigen3/bench/dense_solvers.cpp+    eigen3/bench/check_cache_queries.cpp+    eigen3/bench/bench_sum.cpp+    eigen3/bench/BenchUtil.h+    eigen3/bench/bench_reverse.cpp+    eigen3/bench/benchBlasGemm.cpp+    eigen3/bench/basicbench.cxxlist+    eigen3/bench/sparse_product.cpp+    eigen3/bench/benchEigenSolver.cpp+    eigen3/bench/analyze-blocking-sizes.cpp+    eigen3/bench/benchGeometry.cpp+    eigen3/bench/README.txt+    eigen3/bench/bench_gemm.cpp+    eigen3/bench/vdw_new.cpp+    eigen3/bench/spbench/spbench.dtd+    eigen3/bench/spbench/spbenchsolver.h+    eigen3/bench/spbench/spbenchsolver.cpp+    eigen3/bench/spbench/CMakeLists.txt+    eigen3/bench/spbench/test_sparseLU.cpp+    eigen3/bench/spbench/sp_solver.cpp+    eigen3/bench/spbench/spbenchstyle.h+    eigen3/bench/product_threshold.cpp+    eigen3/bench/sparse_transpose.cpp+    eigen3/bench/sparse_lu.cpp+    eigen3/bench/quat_slerp.cpp+    eigen3/bench/spmv.cpp+    eigen3/bench/benchmarkXcwise.cpp+    eigen3/bench/eig33.cpp+    eigen3/bench/BenchSparseUtil.h+    eigen3/bench/tensors/tensor_benchmarks.h+    eigen3/bench/tensors/tensor_benchmarks_cpu.cc+    eigen3/bench/tensors/benchmark_main.cc+    eigen3/bench/tensors/tensor_benchmarks_gpu.cu+    eigen3/bench/tensors/contraction_benchmarks_cpu.cc+    eigen3/bench/tensors/tensor_benchmarks_sycl.cc+    eigen3/bench/tensors/benchmark.h+    eigen3/bench/tensors/README+    eigen3/bench/tensors/tensor_benchmarks_fp16_gpu.cu+    eigen3/bench/sparse_trisolver.cpp+    eigen3/bench/bench_norm.cpp+    eigen3/bench/sparse_dense_product.cpp+    eigen3/bench/benchmark.cpp+    eigen3/bench/benchmark-blocking-sizes.cpp+    eigen3/bench/benchVecAdd.cpp+    eigen3/bench/quatmul.cpp+    eigen3/bench/bench_multi_compilers.sh+    eigen3/bench/benchmarkSlice.cpp+    eigen3/bench/BenchTimer.h+    eigen3/bench/geometry.cpp+    eigen3/bench/benchCholesky.cpp+    eigen3/eigen3.pc.in+    eigen3/CTestCustom.cmake.in+    eigen3/INSTALL+    eigen3/cmake/FindPastix.cmake+    eigen3/cmake/FindGoogleHash.cmake+    eigen3/cmake/EigenTesting.cmake+    eigen3/cmake/FindPTSCOTCH.cmake+    eigen3/cmake/RegexUtils.cmake+    eigen3/cmake/EigenConfigureTesting.cmake+    eigen3/cmake/FindGLEW.cmake+    eigen3/cmake/FindSuperLU.cmake+    eigen3/cmake/Eigen3ConfigLegacy.cmake.in+    eigen3/cmake/FindHWLOC.cmake+    eigen3/cmake/FindLAPACK.cmake+    eigen3/cmake/FindComputeCpp.cmake+    eigen3/cmake/FindUmfpack.cmake+    eigen3/cmake/EigenUninstall.cmake+    eigen3/cmake/FindGMP.cmake+    eigen3/cmake/EigenDetermineOSVersion.cmake+    eigen3/cmake/FindStandardMathLibrary.cmake+    eigen3/cmake/FindFFTW.cmake+    eigen3/cmake/Eigen3Config.cmake.in+    eigen3/cmake/FindEigen2.cmake+    eigen3/cmake/FindBLASEXT.cmake+    eigen3/cmake/EigenDetermineVSServicePack.cmake+    eigen3/cmake/FindCholmod.cmake+    eigen3/cmake/FindBLAS.cmake+    eigen3/cmake/UseEigen3.cmake+    eigen3/cmake/FindMPFR.cmake+    eigen3/cmake/FindScotch.cmake+    eigen3/cmake/language_support.cmake+    eigen3/cmake/FindAdolc.cmake+    eigen3/cmake/FindMetis.cmake+    eigen3/cmake/FindGSL.cmake+    eigen3/cmake/FindSPQR.cmake+    eigen3/cmake/FindEigen3.cmake+    eigen3/blas/f2c/chbmv.c+    eigen3/blas/f2c/complexdots.c+    eigen3/blas/f2c/lsame.c+    eigen3/blas/f2c/ztbmv.c+    eigen3/blas/f2c/srotmg.c+    eigen3/blas/f2c/dtbmv.c+    eigen3/blas/f2c/d_cnjg.c+    eigen3/blas/f2c/ctbmv.c+    eigen3/blas/f2c/zhbmv.c+    eigen3/blas/f2c/srotm.c+    eigen3/blas/f2c/dsbmv.c+    eigen3/blas/f2c/stbmv.c+    eigen3/blas/f2c/dspmv.c+    eigen3/blas/f2c/drotm.c+    eigen3/blas/f2c/r_cnjg.c+    eigen3/blas/f2c/datatypes.h+    eigen3/blas/f2c/chpmv.c+    eigen3/blas/f2c/sspmv.c+    eigen3/blas/f2c/ssbmv.c+    eigen3/blas/f2c/drotmg.c+    eigen3/blas/f2c/zhpmv.c+    eigen3/blas/fortran/complexdots.f+    eigen3/blas/level1_impl.h+    eigen3/blas/double.cpp+    eigen3/blas/common.h+    eigen3/blas/PackedTriangularSolverVector.h+    eigen3/blas/GeneralRank1Update.h+    eigen3/blas/level2_real_impl.h+    eigen3/blas/README.txt+    eigen3/blas/complex_double.cpp+    eigen3/blas/BandTriangularSolver.h+    eigen3/blas/PackedTriangularMatrixVector.h+    eigen3/blas/level2_cplx_impl.h+    eigen3/blas/complex_single.cpp+    eigen3/blas/level1_real_impl.h+    eigen3/blas/level1_cplx_impl.h+    eigen3/blas/single.cpp+    eigen3/blas/testing/dblat2.dat+    eigen3/blas/testing/dblat3.f+    eigen3/blas/testing/zblat3.dat+    eigen3/blas/testing/cblat2.f+    eigen3/blas/testing/cblat2.dat+    eigen3/blas/testing/sblat1.f+    eigen3/blas/testing/cblat3.dat+    eigen3/blas/testing/sblat3.dat+    eigen3/blas/testing/dblat1.f+    eigen3/blas/testing/cblat1.f+    eigen3/blas/testing/zblat2.dat+    eigen3/blas/testing/sblat2.f+    eigen3/blas/testing/runblastest.sh+    eigen3/blas/testing/dblat2.f+    eigen3/blas/testing/sblat2.dat+    eigen3/blas/testing/zblat1.f+    eigen3/blas/testing/dblat3.dat+    eigen3/blas/testing/cblat3.f+    eigen3/blas/testing/CMakeLists.txt+    eigen3/blas/testing/zblat3.f+    eigen3/blas/testing/sblat3.f+    eigen3/blas/testing/zblat2.f+    eigen3/blas/CMakeLists.txt+    eigen3/blas/Rank2Update.h+    eigen3/blas/level2_impl.h+    eigen3/blas/xerbla.cpp+    eigen3/blas/level3_impl.h+    eigen3/blas/PackedSelfadjointProduct.h+    eigen3/scripts/cdashtesting.cmake.in+    eigen3/scripts/check.in+    eigen3/scripts/buildtests.in+    eigen3/scripts/debug.in+    eigen3/scripts/release.in+    eigen3/scripts/eigen_gen_credits.cpp+    eigen3/scripts/eigen_gen_docs+    eigen3/scripts/CMakeLists.txt+    eigen3/scripts/relicense.py+    eigen3/test/vectorwiseop.cpp+    eigen3/test/fastmath.cpp+    eigen3/test/eigensolver_selfadjoint.cpp+    eigen3/test/product_notemporary.cpp+    eigen3/test/upperbidiagonalization.cpp+    eigen3/test/evaluator_common.h+    eigen3/test/inplace_decomposition.cpp+    eigen3/test/array_for_matrix.cpp+    eigen3/test/block.cpp+    eigen3/test/product_symm.cpp+    eigen3/test/spqr_support.cpp+    eigen3/test/sizeoverflow.cpp+    eigen3/test/bicgstab.cpp+    eigen3/test/geo_hyperplane.cpp+    eigen3/test/hessenberg.cpp+    eigen3/test/geo_eulerangles.cpp+    eigen3/test/svd_common.h+    eigen3/test/conjugate_gradient.cpp+    eigen3/test/diagonalmatrices.cpp+    eigen3/test/array_replicate.cpp+    eigen3/test/eigen2support.cpp+    eigen3/test/vectorization_logic.cpp+    eigen3/test/pastix_support.cpp+    eigen3/test/cuda_common.h+    eigen3/test/metis_support.cpp+    eigen3/test/pardiso_support.cpp+    eigen3/test/sizeof.cpp+    eigen3/test/numext.cpp+    eigen3/test/incomplete_cholesky.cpp+    eigen3/test/diagonal.cpp+    eigen3/test/schur_real.cpp+    eigen3/test/qr.cpp+    eigen3/test/mapstride.cpp+    eigen3/test/sparse_solvers.cpp+    eigen3/test/bug1213_main.cpp+    eigen3/test/miscmatrices.cpp+    eigen3/test/dontalign.cpp+    eigen3/test/sparse_block.cpp+    eigen3/test/denseLM.cpp+    eigen3/test/qr_colpivoting.cpp+    eigen3/test/product.h+    eigen3/test/dynalloc.cpp+    eigen3/test/eigensolver_complex.cpp+    eigen3/test/stdvector.cpp+    eigen3/test/real_qz.cpp+    eigen3/test/householder.cpp+    eigen3/test/adjoint.cpp+    eigen3/test/main.h+    eigen3/test/boostmultiprec.cpp+    eigen3/test/swap.cpp+    eigen3/test/smallvectors.cpp+    eigen3/test/stddeque_overload.cpp+    eigen3/test/rand.cpp+    eigen3/test/jacobi.cpp+    eigen3/test/sparse.h+    eigen3/test/prec_inverse_4x4.cpp+    eigen3/test/product_syrk.cpp+    eigen3/test/product_large.cpp+    eigen3/test/triangular.cpp+    eigen3/test/product_trmv.cpp+    eigen3/test/mixingtypes.cpp+    eigen3/test/sparse_product.cpp+    eigen3/test/nullary.cpp+    eigen3/test/rvalue_types.cpp+    eigen3/test/is_same_dense.cpp+    eigen3/test/array_of_string.cpp+    eigen3/test/geo_quaternion.cpp+    eigen3/test/superlu_support.cpp+    eigen3/test/corners.cpp+    eigen3/test/mpl2only.cpp+    eigen3/test/conservative_resize.cpp+    eigen3/test/geo_alignedbox.cpp+    eigen3/test/nesting_ops.cpp+    eigen3/test/product_trsolve.cpp+    eigen3/test/stdvector_overload.cpp+    eigen3/test/inverse.cpp+    eigen3/test/geo_parametrizedline.cpp+    eigen3/test/qtvector.cpp+    eigen3/test/constructor.cpp+    eigen3/test/unalignedcount.cpp+    eigen3/test/sparse_solver.h+    eigen3/test/ref.cpp+    eigen3/test/mapstaticmethods.cpp+    eigen3/test/eigensolver_generic.cpp+    eigen3/test/product_mmtr.cpp+    eigen3/test/schur_complex.cpp+    eigen3/test/stddeque.cpp+    eigen3/test/qr_fullpivoting.cpp+    eigen3/test/bandmatrix.cpp+    eigen3/test/determinant.cpp+    eigen3/test/stdlist.cpp+    eigen3/test/commainitializer.cpp+    eigen3/test/dense_storage.cpp+    eigen3/test/redux.cpp+    eigen3/test/sparse_basic.cpp+    eigen3/test/exceptions.cpp+    eigen3/test/stdlist_overload.cpp+    eigen3/test/unalignedassert.cpp+    eigen3/test/sparse_vector.cpp+    eigen3/test/bug1213.cpp+    eigen3/test/array.cpp+    eigen3/test/sparse_ref.cpp+    eigen3/test/geo_transformations.cpp+    eigen3/test/packetmath.cpp+    eigen3/test/ctorleak.cpp+    eigen3/test/array_reverse.cpp+    eigen3/test/special_numbers.cpp+    eigen3/test/product_small.cpp+    eigen3/test/nomalloc.cpp+    eigen3/test/lscg.cpp+    eigen3/test/sparselu.cpp+    eigen3/test/bdcsvd.cpp+    eigen3/test/lu.cpp+    eigen3/test/simplicial_cholesky.cpp+    eigen3/test/geo_orthomethods.cpp+    eigen3/test/umfpack_support.cpp+    eigen3/test/cholmod_support.cpp+    eigen3/test/stable_norm.cpp+    eigen3/test/product_extra.cpp+    eigen3/test/eigensolver_generalized_real.cpp+    eigen3/test/bug1213.h+    eigen3/test/jacobisvd.cpp+    eigen3/test/cholesky.cpp+    eigen3/test/umeyama.cpp+    eigen3/test/geo_homogeneous.cpp+    eigen3/test/CMakeLists.txt+    eigen3/test/resize.cpp+    eigen3/test/mapped_matrix.cpp+    eigen3/test/selfadjoint.cpp+    eigen3/test/linearstructure.cpp+    eigen3/test/zerosized.cpp+    eigen3/test/cuda_basic.cu+    eigen3/test/first_aligned.cpp+    eigen3/test/evaluators.cpp+    eigen3/test/basicstuff.cpp+    eigen3/test/meta.cpp+    eigen3/test/product_trmm.cpp+    eigen3/test/svd_fill.h+    eigen3/test/sparse_permutations.cpp+    eigen3/test/sparseqr.cpp+    eigen3/test/half_float.cpp+    eigen3/test/visitor.cpp+    eigen3/test/integer_types.cpp+    eigen3/test/product_selfadjoint.cpp+    eigen3/test/permutationmatrices.cpp+    eigen3/test/sparseLM.cpp     eigen3/Eigen/PaStiXSupport     eigen3/Eigen/Geometry     eigen3/Eigen/QR@@ -382,6 +948,437 @@     eigen3/Eigen/SparseCore     eigen3/Eigen/Sparse     eigen3/Eigen/inverse.txt+    eigen3/CMakeLists.txt+    eigen3/signature_of_eigen3_matrix_library+    eigen3/debug/msvc/eigen.natvis+    eigen3/debug/msvc/eigen_autoexp_part.dat+    eigen3/debug/gdb/__init__.py+    eigen3/debug/gdb/printers.py+    eigen3/doc/TutorialReductionsVisitorsBroadcasting.dox+    eigen3/doc/TutorialArrayClass.dox+    eigen3/doc/QuickReference.dox+    eigen3/doc/TopicAliasing.dox+    eigen3/doc/InsideEigenExample.dox+    eigen3/doc/TutorialSparse_example_details.dox+    eigen3/doc/tutorial.cpp+    eigen3/doc/eigendoxy_header.html.in+    eigen3/doc/StructHavingEigenMembers.dox+    eigen3/doc/TopicScalarTypes.dox+    eigen3/doc/WrongStackAlignment.dox+    eigen3/doc/CustomizingEigen_InheritingMatrix.dox+    eigen3/doc/B01_Experimental.dox+    eigen3/doc/TopicEigenExpressionTemplates.dox+    eigen3/doc/Manual.dox+    eigen3/doc/QuickStartGuide.dox+    eigen3/doc/TopicLinearAlgebraDecompositions.dox+    eigen3/doc/UsingIntelMKL.dox+    eigen3/doc/UnalignedArrayAssert.dox+    eigen3/doc/SparseLinearSystems.dox+    eigen3/doc/UsingBlasLapackBackends.dox+    eigen3/doc/TopicAssertions.dox+    eigen3/doc/CustomizingEigen_NullaryExpr.dox+    eigen3/doc/UsingNVCC.dox+    eigen3/doc/CustomizingEigen_Plugins.dox+    eigen3/doc/Eigen_Silly_Professor_64x64.png+    eigen3/doc/eigendoxy_tabs.css+    eigen3/doc/StorageOrders.dox+    eigen3/doc/CustomizingEigen_CustomScalar.dox+    eigen3/doc/DenseDecompositionBenchmark.dox+    eigen3/doc/LeastSquares.dox+    eigen3/doc/TemplateKeyword.dox+    eigen3/doc/TutorialMatrixArithmetic.dox+    eigen3/doc/A05_PortingFrom2To3.dox+    eigen3/doc/CoeffwiseMathFunctionsTable.dox+    eigen3/doc/TutorialAdvancedInitialization.dox+    eigen3/doc/Doxyfile.in+    eigen3/doc/TopicMultithreading.dox+    eigen3/doc/TutorialMatrixClass.dox+    eigen3/doc/snippets/Cwise_pow.cpp+    eigen3/doc/snippets/Cwise_minus.cpp+    eigen3/doc/snippets/Cwise_tan.cpp+    eigen3/doc/snippets/Matrix_resize_int_int.cpp+    eigen3/doc/snippets/MatrixBase_operatorNorm.cpp+    eigen3/doc/snippets/Matrix_resize_int.cpp+    eigen3/doc/snippets/MatrixBase_array.cpp+    eigen3/doc/snippets/Tutorial_solve_matrix_inverse.cpp+    eigen3/doc/snippets/Matrix_setConstant_int_int.cpp+    eigen3/doc/snippets/Cwise_not_equal.cpp+    eigen3/doc/snippets/MatrixBase_segment_int_int.cpp+    eigen3/doc/snippets/MatrixBase_bottomLeftCorner_int_int.cpp+    eigen3/doc/snippets/PartialRedux_norm.cpp+    eigen3/doc/snippets/Matrix_setZero_int.cpp+    eigen3/doc/snippets/MatrixBase_setOnes.cpp+    eigen3/doc/snippets/Cwise_sqrt.cpp+    eigen3/doc/snippets/MatrixBase_colwise.cpp+    eigen3/doc/snippets/MatrixBase_transpose.cpp+    eigen3/doc/snippets/SelfAdjointEigenSolver_SelfAdjointEigenSolver.cpp+    eigen3/doc/snippets/Cwise_cos.cpp+    eigen3/doc/snippets/TopicAliasing_mult3.cpp+    eigen3/doc/snippets/MatrixBase_cwiseProduct.cpp+    eigen3/doc/snippets/Tutorial_solve_triangular_inplace.cpp+    eigen3/doc/snippets/MatrixBase_prod.cpp+    eigen3/doc/snippets/Tutorial_AdvancedInitialization_Zero.cpp+    eigen3/doc/snippets/MatrixBase_template_int_int_bottomLeftCorner_int_int.cpp+    eigen3/doc/snippets/MatrixBase_cwiseQuotient.cpp+    eigen3/doc/snippets/MatrixBase_fixedBlock_int_int.cpp+    eigen3/doc/snippets/Jacobi_makeGivens.cpp+    eigen3/doc/snippets/Cwise_plus.cpp+    eigen3/doc/snippets/MatrixBase_isOrthogonal.cpp+    eigen3/doc/snippets/FullPivHouseholderQR_solve.cpp+    eigen3/doc/snippets/MatrixBase_cwiseNotEqual.cpp+    eigen3/doc/snippets/Cwise_less.cpp+    eigen3/doc/snippets/SelfAdjointEigenSolver_operatorSqrt.cpp+    eigen3/doc/snippets/MatrixBase_selfadjointView.cpp+    eigen3/doc/snippets/Cwise_inverse.cpp+    eigen3/doc/snippets/MatrixBase_template_int_leftCols.cpp+    eigen3/doc/snippets/MatrixBase_template_int_topRows.cpp+    eigen3/doc/snippets/MatrixBase_leftCols_int.cpp+    eigen3/doc/snippets/TopicAliasing_cwise.cpp+    eigen3/doc/snippets/Tridiagonalization_decomposeInPlace.cpp+    eigen3/doc/snippets/MatrixBase_zero_int.cpp+    eigen3/doc/snippets/MatrixBase_cwiseMax.cpp+    eigen3/doc/snippets/RealQZ_compute.cpp+    eigen3/doc/snippets/MatrixBase_adjoint.cpp+    eigen3/doc/snippets/Matrix_setConstant_int.cpp+    eigen3/doc/snippets/MatrixBase_eval.cpp+    eigen3/doc/snippets/GeneralizedEigenSolver.cpp+    eigen3/doc/snippets/DenseBase_LinSpaced.cpp+    eigen3/doc/snippets/HessenbergDecomposition_packedMatrix.cpp+    eigen3/doc/snippets/Cwise_max.cpp+    eigen3/doc/snippets/MatrixBase_topRightCorner_int_int.cpp+    eigen3/doc/snippets/SelfAdjointEigenSolver_SelfAdjointEigenSolver_MatrixType2.cpp+    eigen3/doc/snippets/Tridiagonalization_Tridiagonalization_MatrixType.cpp+    eigen3/doc/snippets/PartialRedux_sum.cpp+    eigen3/doc/snippets/MatrixBase_zero_int_int.cpp+    eigen3/doc/snippets/MatrixBase_cwiseEqual.cpp+    eigen3/doc/snippets/Map_inner_stride.cpp+    eigen3/doc/snippets/MatrixBase_cwiseAbs2.cpp+    eigen3/doc/snippets/HessenbergDecomposition_matrixH.cpp+    eigen3/doc/snippets/ComplexEigenSolver_compute.cpp+    eigen3/doc/snippets/SelfAdjointEigenSolver_compute_MatrixType2.cpp+    eigen3/doc/snippets/Tutorial_AdvancedInitialization_LinSpaced.cpp+    eigen3/doc/snippets/Matrix_resize_int_NoChange.cpp+    eigen3/doc/snippets/HouseholderSequence_HouseholderSequence.cpp+    eigen3/doc/snippets/MatrixBase_replicate.cpp+    eigen3/doc/snippets/MatrixBase_bottomRightCorner_int_int.cpp+    eigen3/doc/snippets/PartialRedux_minCoeff.cpp+    eigen3/doc/snippets/ComplexSchur_compute.cpp+    eigen3/doc/snippets/MatrixBase_template_int_int_bottomRightCorner.cpp+    eigen3/doc/snippets/MatrixBase_isIdentity.cpp+    eigen3/doc/snippets/MatrixBase_topLeftCorner_int_int.cpp+    eigen3/doc/snippets/MatrixBase_applyOnTheRight.cpp+    eigen3/doc/snippets/Cwise_isNaN.cpp+    eigen3/doc/snippets/FullPivLU_kernel.cpp+    eigen3/doc/snippets/ColPivHouseholderQR_solve.cpp+    eigen3/doc/snippets/tut_arithmetic_transpose_aliasing.cpp+    eigen3/doc/snippets/MatrixBase_isZero.cpp+    eigen3/doc/snippets/Cwise_arg.cpp+    eigen3/doc/snippets/Tutorial_ReshapeMat2Vec.cpp+    eigen3/doc/snippets/Triangular_solve.cpp+    eigen3/doc/snippets/DenseBase_setLinSpaced.cpp+    eigen3/doc/snippets/MatrixBase_inverse.cpp+    eigen3/doc/snippets/MatrixBase_template_int_segment.cpp+    eigen3/doc/snippets/Matrix_resize_NoChange_int.cpp+    eigen3/doc/snippets/Cwise_isFinite.cpp+    eigen3/doc/snippets/JacobiSVD_basic.cpp+    eigen3/doc/snippets/Cwise_asin.cpp+    eigen3/doc/snippets/BiCGSTAB_step_by_step.cpp+    eigen3/doc/snippets/LLT_example.cpp+    eigen3/doc/snippets/VectorwiseOp_homogeneous.cpp+    eigen3/doc/snippets/MatrixBase_set.cpp+    eigen3/doc/snippets/SelfAdjointView_eigenvalues.cpp+    eigen3/doc/snippets/Tutorial_commainit_02.cpp+    eigen3/doc/snippets/MatrixBase_eigenvalues.cpp+    eigen3/doc/snippets/Tutorial_AdvancedInitialization_CommaTemporary.cpp+    eigen3/doc/snippets/MatrixBase_setZero.cpp+    eigen3/doc/snippets/FullPivLU_image.cpp+    eigen3/doc/snippets/Cwise_scalar_power_array.cpp+    eigen3/doc/snippets/HessenbergDecomposition_compute.cpp+    eigen3/doc/snippets/Matrix_setOnes_int_int.cpp+    eigen3/doc/snippets/FullPivLU_solve.cpp+    eigen3/doc/snippets/MatrixBase_homogeneous.cpp+    eigen3/doc/snippets/Tutorial_solve_reuse_decomposition.cpp+    eigen3/doc/snippets/Matrix_setIdentity_int_int.cpp+    eigen3/doc/snippets/LeastSquaresQR.cpp+    eigen3/doc/snippets/Tutorial_ReshapeMat2Mat.cpp+    eigen3/doc/snippets/Cwise_acos.cpp+    eigen3/doc/snippets/MatrixBase_reverse.cpp+    eigen3/doc/snippets/Cwise_log10.cpp+    eigen3/doc/snippets/Cwise_isInf.cpp+    eigen3/doc/snippets/MatrixBase_cwiseAbs.cpp+    eigen3/doc/snippets/PartialRedux_squaredNorm.cpp+    eigen3/doc/snippets/DirectionWise_replicate_int.cpp+    eigen3/doc/snippets/Tridiagonalization_householderCoefficients.cpp+    eigen3/doc/snippets/MatrixBase_template_int_int_bottomLeftCorner.cpp+    eigen3/doc/snippets/RealSchur_RealSchur_MatrixType.cpp+    eigen3/doc/snippets/SelfAdjointView_operatorNorm.cpp+    eigen3/doc/snippets/Cwise_boolean_and.cpp+    eigen3/doc/snippets/MatrixBase_computeInverseAndDetWithCheck.cpp+    eigen3/doc/snippets/Cwise_sinh.cpp+    eigen3/doc/snippets/MatrixBase_isUnitary.cpp+    eigen3/doc/snippets/Cwise_boolean_or.cpp+    eigen3/doc/snippets/Cwise_abs2.cpp+    eigen3/doc/snippets/Cwise_ceil.cpp+    eigen3/doc/snippets/Tridiagonalization_packedMatrix.cpp+    eigen3/doc/snippets/Tutorial_commainit_01b.cpp+    eigen3/doc/snippets/DirectionWise_replicate.cpp+    eigen3/doc/snippets/MatrixBase_topRows_int.cpp+    eigen3/doc/snippets/SelfAdjointEigenSolver_eigenvectors.cpp+    eigen3/doc/snippets/Cwise_array_power_array.cpp+    eigen3/doc/snippets/Tutorial_Map_using.cpp+    eigen3/doc/snippets/Cwise_tanh.cpp+    eigen3/doc/snippets/Cwise_square.cpp+    eigen3/doc/snippets/TopicAliasing_mult2.cpp+    eigen3/doc/snippets/MatrixBase_col.cpp+    eigen3/doc/snippets/MatrixBase_template_int_bottomRows.cpp+    eigen3/doc/snippets/MatrixBase_rightCols_int.cpp+    eigen3/doc/snippets/Matrix_Map_stride.cpp+    eigen3/doc/snippets/TopicAliasing_mult4.cpp+    eigen3/doc/snippets/RealSchur_compute.cpp+    eigen3/doc/snippets/MatrixBase_end_int.cpp+    eigen3/doc/snippets/MatrixBase_ones_int_int.cpp+    eigen3/doc/snippets/Tutorial_SlicingCol.cpp+    eigen3/doc/snippets/MatrixBase_all.cpp+    eigen3/doc/snippets/MatrixBase_bottomRows_int.cpp+    eigen3/doc/snippets/MatrixBase_array_const.cpp+    eigen3/doc/snippets/MatrixBase_block_int_int.cpp+    eigen3/doc/snippets/EigenSolver_eigenvectors.cpp+    eigen3/doc/snippets/Cwise_min.cpp+    eigen3/doc/snippets/SelfAdjointEigenSolver_SelfAdjointEigenSolver_MatrixType.cpp+    eigen3/doc/snippets/Cwise_abs.cpp+    eigen3/doc/snippets/Tutorial_solve_triangular.cpp+    eigen3/doc/snippets/MatrixBase_random_int_int.cpp+    eigen3/doc/snippets/PartialRedux_prod.cpp+    eigen3/doc/snippets/EigenSolver_compute.cpp+    eigen3/doc/snippets/MatrixBase_random.cpp+    eigen3/doc/snippets/Tutorial_AdvancedInitialization_ThreeWays.cpp+    eigen3/doc/snippets/Map_general_stride.cpp+    eigen3/doc/snippets/Cwise_round.cpp+    eigen3/doc/snippets/MatrixBase_cwiseMin.cpp+    eigen3/doc/snippets/SelfAdjointEigenSolver_operatorInverseSqrt.cpp+    eigen3/doc/snippets/Cwise_quotient.cpp+    eigen3/doc/snippets/Matrix_setOnes_int.cpp+    eigen3/doc/snippets/SelfAdjointEigenSolver_compute_MatrixType.cpp+    eigen3/doc/snippets/Tutorial_AdvancedInitialization_Join.cpp+    eigen3/doc/snippets/PartialPivLU_solve.cpp+    eigen3/doc/snippets/Cwise_sign.cpp+    eigen3/doc/snippets/MatrixBase_cwiseInverse.cpp+    eigen3/doc/snippets/Cwise_cosh.cpp+    eigen3/doc/snippets/Tutorial_Map_rowmajor.cpp+    eigen3/doc/snippets/TopicStorageOrders_example.cpp+    eigen3/doc/snippets/MatrixBase_isOnes.cpp+    eigen3/doc/snippets/HouseholderQR_householderQ.cpp+    eigen3/doc/snippets/Cwise_plus_equal.cpp+    eigen3/doc/snippets/MatrixBase_template_int_int_topLeftCorner_int_int.cpp+    eigen3/doc/snippets/EigenSolver_EigenSolver_MatrixType.cpp+    eigen3/doc/snippets/MatrixBase_noalias.cpp+    eigen3/doc/snippets/MatrixBase_row.cpp+    eigen3/doc/snippets/Cwise_product.cpp+    eigen3/doc/snippets/MatrixBase_setRandom.cpp+    eigen3/doc/snippets/MatrixBase_random_int.cpp+    eigen3/doc/snippets/.krazy+    eigen3/doc/snippets/Map_simple.cpp+    eigen3/doc/snippets/tut_arithmetic_transpose_inplace.cpp+    eigen3/doc/snippets/MatrixBase_template_int_end.cpp+    eigen3/doc/snippets/Jacobi_makeJacobi.cpp+    eigen3/doc/snippets/HouseholderQR_solve.cpp+    eigen3/doc/snippets/Map_outer_stride.cpp+    eigen3/doc/snippets/MatrixBase_diagonal.cpp+    eigen3/doc/snippets/Cwise_floor.cpp+    eigen3/doc/snippets/IOFormat.cpp+    eigen3/doc/snippets/class_FullPivLU.cpp+    eigen3/doc/snippets/Cwise_sin.cpp+    eigen3/doc/snippets/Cwise_minus_equal.cpp+    eigen3/doc/snippets/MatrixBase_template_int_int_topLeftCorner.cpp+    eigen3/doc/snippets/ComplexSchur_matrixU.cpp+    eigen3/doc/snippets/MatrixBase_cast.cpp+    eigen3/doc/snippets/MatrixBase_template_int_start.cpp+    eigen3/doc/snippets/MatrixBase_template_int_int_topRightCorner_int_int.cpp+    eigen3/doc/snippets/MatrixBase_template_int_rightCols.cpp+    eigen3/doc/snippets/MatrixBase_block_int_int_int_int.cpp+    eigen3/doc/snippets/AngleAxis_mimic_euler.cpp+    eigen3/doc/snippets/DirectionWise_hnormalized.cpp+    eigen3/doc/snippets/EigenSolver_eigenvalues.cpp+    eigen3/doc/snippets/SelfAdjointEigenSolver_eigenvalues.cpp+    eigen3/doc/snippets/MatrixBase_triangularView.cpp+    eigen3/doc/snippets/BiCGSTAB_simple.cpp+    eigen3/doc/snippets/MatrixBase_isDiagonal.cpp+    eigen3/doc/snippets/Tutorial_solve_singular.cpp+    eigen3/doc/snippets/MatrixBase_diagonal_template_int.cpp+    eigen3/doc/snippets/CMakeLists.txt+    eigen3/doc/snippets/Tutorial_AdvancedInitialization_Block.cpp+    eigen3/doc/snippets/Cwise_boolean_xor.cpp+    eigen3/doc/snippets/MatrixBase_diagonal_int.cpp+    eigen3/doc/snippets/MatrixBase_setIdentity.cpp+    eigen3/doc/snippets/DenseBase_LinSpaced_seq.cpp+    eigen3/doc/snippets/MatrixBase_rowwise.cpp+    eigen3/doc/snippets/Tutorial_SlicingVec.cpp+    eigen3/doc/snippets/Cwise_less_equal.cpp+    eigen3/doc/snippets/Cwise_greater.cpp+    eigen3/doc/snippets/SparseMatrix_coeffs.cpp+    eigen3/doc/snippets/MatrixBase_identity.cpp+    eigen3/doc/snippets/MatrixBase_template_int_int_block_int_int_int_int.cpp+    eigen3/doc/snippets/PartialRedux_maxCoeff.cpp+    eigen3/doc/snippets/tut_arithmetic_redux_minmax.cpp+    eigen3/doc/snippets/Map_placement_new.cpp+    eigen3/doc/snippets/Cwise_times_equal.cpp+    eigen3/doc/snippets/Tridiagonalization_diagonal.cpp+    eigen3/doc/snippets/tut_arithmetic_transpose_conjugate.cpp+    eigen3/doc/snippets/TopicAliasing_block.cpp+    eigen3/doc/snippets/ComplexEigenSolver_eigenvalues.cpp+    eigen3/doc/snippets/Cwise_equal_equal.cpp+    eigen3/doc/snippets/Tutorial_commainit_01.cpp+    eigen3/doc/snippets/MatrixBase_template_int_int_bottomRightCorner_int_int.cpp+    eigen3/doc/snippets/MatrixBase_cwiseSign.cpp+    eigen3/doc/snippets/LeastSquaresNormalEquations.cpp+    eigen3/doc/snippets/Cwise_greater_equal.cpp+    eigen3/doc/snippets/Cwise_exp.cpp+    eigen3/doc/snippets/Matrix_setRandom_int_int.cpp+    eigen3/doc/snippets/Vectorwise_reverse.cpp+    eigen3/doc/snippets/MatrixBase_select.cpp+    eigen3/doc/snippets/Cwise_atan.cpp+    eigen3/doc/snippets/PartialRedux_count.cpp+    eigen3/doc/snippets/MatrixBase_replicate_int_int.cpp+    eigen3/doc/snippets/Cwise_log.cpp+    eigen3/doc/snippets/MatrixBase_template_int_int_topRightCorner.cpp+    eigen3/doc/snippets/Matrix_setZero_int_int.cpp+    eigen3/doc/snippets/MatrixBase_hnormalized.cpp+    eigen3/doc/snippets/Cwise_slash_equal.cpp+    eigen3/doc/snippets/compile_snippet.cpp.in+    eigen3/doc/snippets/TopicAliasing_block_correct.cpp+    eigen3/doc/snippets/Cwise_boolean_not.cpp+    eigen3/doc/snippets/MatrixBase_asDiagonal.cpp+    eigen3/doc/snippets/TopicAliasing_mult5.cpp+    eigen3/doc/snippets/Matrix_setRandom_int.cpp+    eigen3/doc/snippets/MatrixBase_start_int.cpp+    eigen3/doc/snippets/TopicAliasing_mult1.cpp+    eigen3/doc/snippets/Tridiagonalization_compute.cpp+    eigen3/doc/snippets/Cwise_cube.cpp+    eigen3/doc/snippets/MatrixBase_cwiseSqrt.cpp+    eigen3/doc/snippets/MatrixBase_zero.cpp+    eigen3/doc/snippets/MatrixBase_identity_int_int.cpp+    eigen3/doc/snippets/MatrixBase_applyOnTheLeft.cpp+    eigen3/doc/snippets/MatrixBase_ones.cpp+    eigen3/doc/snippets/LLT_solve.cpp+    eigen3/doc/snippets/ComplexSchur_matrixT.cpp+    eigen3/doc/snippets/tut_matrix_assignment_resizing.cpp+    eigen3/doc/snippets/DenseBase_LinSpacedInt.cpp+    eigen3/doc/snippets/Tutorial_solve_multiple_rhs.cpp+    eigen3/doc/snippets/MatrixBase_ones_int.cpp+    eigen3/doc/snippets/EigenSolver_pseudoEigenvectors.cpp+    eigen3/doc/snippets/MatrixBase_computeInverseWithCheck.cpp+    eigen3/doc/snippets/ComplexEigenSolver_eigenvectors.cpp+    eigen3/doc/TopicVectorization.dox+    eigen3/doc/eigendoxy.css+    eigen3/doc/TopicResizing.dox+    eigen3/doc/TutorialMapClass.dox+    eigen3/doc/FixedSizeVectorizable.dox+    eigen3/doc/ClassHierarchy.dox+    eigen3/doc/special_examples/Tutorial_sparse_example.cpp+    eigen3/doc/special_examples/Tutorial_sparse_example_details.cpp+    eigen3/doc/special_examples/random_cpp11.cpp+    eigen3/doc/special_examples/CMakeLists.txt+    eigen3/doc/MatrixfreeSolverExample.dox+    eigen3/doc/eigendoxy_layout.xml.in+    eigen3/doc/HiPerformance.dox+    eigen3/doc/ftv2pnode.png+    eigen3/doc/Pitfalls.dox+    eigen3/doc/TutorialLinearAlgebra.dox+    eigen3/doc/examples/TutorialLinAlgExSolveColPivHouseholderQR.cpp+    eigen3/doc/examples/Tutorial_BlockOperations_corner.cpp+    eigen3/doc/examples/Tutorial_ReductionsVisitorsBroadcasting_colwise.cpp+    eigen3/doc/examples/Tutorial_ReductionsVisitorsBroadcasting_broadcast_simple_rowwise.cpp+    eigen3/doc/examples/Cwise_erf.cpp+    eigen3/doc/examples/TutorialLinAlgSetThreshold.cpp+    eigen3/doc/examples/TutorialLinAlgExComputeSolveError.cpp+    eigen3/doc/examples/QuickStart_example2_dynamic.cpp+    eigen3/doc/examples/Cwise_lgamma.cpp+    eigen3/doc/examples/tut_arithmetic_dot_cross.cpp+    eigen3/doc/examples/TutorialLinAlgRankRevealing.cpp+    eigen3/doc/examples/tut_matrix_resize_fixed_size.cpp+    eigen3/doc/examples/Tutorial_ReductionsVisitorsBroadcasting_reductions_operatornorm.cpp+    eigen3/doc/examples/DenseBase_middleRows_int.cpp+    eigen3/doc/examples/tut_matrix_coefficient_accessors.cpp+    eigen3/doc/examples/Tutorial_BlockOperations_colrow.cpp+    eigen3/doc/examples/tut_arithmetic_matrix_mul.cpp+    eigen3/doc/examples/make_circulant.cpp.entry+    eigen3/doc/examples/Tutorial_ArrayClass_mult.cpp+    eigen3/doc/examples/tut_matrix_resize.cpp+    eigen3/doc/examples/tut_arithmetic_add_sub.cpp+    eigen3/doc/examples/class_FixedVectorBlock.cpp+    eigen3/doc/examples/make_circulant.cpp+    eigen3/doc/examples/Tutorial_ArrayClass_addition.cpp+    eigen3/doc/examples/Tutorial_ReductionsVisitorsBroadcasting_rowwise.cpp+    eigen3/doc/examples/make_circulant2.cpp+    eigen3/doc/examples/QuickStart_example2_fixed.cpp+    eigen3/doc/examples/make_circulant.cpp.expression+    eigen3/doc/examples/make_circulant.cpp.preamble+    eigen3/doc/examples/nullary_indexing.cpp+    eigen3/doc/examples/Tutorial_ReductionsVisitorsBroadcasting_broadcast_1nn.cpp+    eigen3/doc/examples/TemplateKeyword_simple.cpp+    eigen3/doc/examples/class_Block.cpp+    eigen3/doc/examples/DenseBase_template_int_middleCols.cpp+    eigen3/doc/examples/TutorialLinAlgSVDSolve.cpp+    eigen3/doc/examples/class_CwiseUnaryOp_ptrfun.cpp+    eigen3/doc/examples/TutorialLinAlgExSolveLDLT.cpp+    eigen3/doc/examples/Tutorial_PartialLU_solve.cpp+    eigen3/doc/examples/Tutorial_ArrayClass_interop.cpp+    eigen3/doc/examples/Cwise_erfc.cpp+    eigen3/doc/examples/class_FixedBlock.cpp+    eigen3/doc/examples/Tutorial_BlockOperations_vector.cpp+    eigen3/doc/examples/Tutorial_ReductionsVisitorsBroadcasting_maxnorm.cpp+    eigen3/doc/examples/Tutorial_ReductionsVisitorsBroadcasting_visitors.cpp+    eigen3/doc/examples/function_taking_eigenbase.cpp+    eigen3/doc/examples/class_CwiseBinaryOp.cpp+    eigen3/doc/examples/TutorialLinAlgInverseDeterminant.cpp+    eigen3/doc/examples/tut_arithmetic_scalar_mul_div.cpp+    eigen3/doc/examples/TutorialLinAlgSelfAdjointEigenSolver.cpp+    eigen3/doc/examples/Tutorial_ReductionsVisitorsBroadcasting_broadcast_simple.cpp+    eigen3/doc/examples/.krazy+    eigen3/doc/examples/TemplateKeyword_flexible.cpp+    eigen3/doc/examples/make_circulant.cpp.traits+    eigen3/doc/examples/class_CwiseUnaryOp.cpp+    eigen3/doc/examples/Tutorial_ReductionsVisitorsBroadcasting_reductions_bool.cpp+    eigen3/doc/examples/function_taking_ref.cpp+    eigen3/doc/examples/CMakeLists.txt+    eigen3/doc/examples/make_circulant.cpp.evaluator+    eigen3/doc/examples/CustomizingEigen_Inheritance.cpp+    eigen3/doc/examples/Tutorial_simple_example_fixed_size.cpp+    eigen3/doc/examples/matrixfree_cg.cpp+    eigen3/doc/examples/TutorialInplaceLU.cpp+    eigen3/doc/examples/Tutorial_BlockOperations_print_block.cpp+    eigen3/doc/examples/Tutorial_ArrayClass_cwise_other.cpp+    eigen3/doc/examples/DenseBase_template_int_middleRows.cpp+    eigen3/doc/examples/QuickStart_example.cpp+    eigen3/doc/examples/Tutorial_BlockOperations_block_assignment.cpp+    eigen3/doc/examples/class_VectorBlock.cpp+    eigen3/doc/examples/tut_arithmetic_redux_basic.cpp+    eigen3/doc/examples/DenseBase_middleCols_int.cpp+    eigen3/doc/examples/TutorialLinAlgComputeTwice.cpp+    eigen3/doc/examples/Tutorial_ArrayClass_interop_matrix.cpp+    eigen3/doc/examples/Tutorial_ArrayClass_accessors.cpp+    eigen3/doc/examples/Tutorial_ReductionsVisitorsBroadcasting_reductions_norm.cpp+    eigen3/doc/examples/make_circulant.cpp.main+    eigen3/doc/examples/Tutorial_simple_example_dynamic_size.cpp+    eigen3/doc/TutorialSparse.dox+    eigen3/doc/TopicCMakeGuide.dox+    eigen3/doc/StlContainers.dox+    eigen3/doc/InplaceDecomposition.dox+    eigen3/doc/eigendoxy_footer.html.in+    eigen3/doc/AsciiQuickReference.txt+    eigen3/doc/PreprocessorDirectives.dox+    eigen3/doc/eigen_navtree_hacks.js+    eigen3/doc/CMakeLists.txt+    eigen3/doc/TopicLazyEvaluation.dox+    eigen3/doc/SparseQuickReference.dox+    eigen3/doc/TutorialReshapeSlicing.dox+    eigen3/doc/NewExpressionType.dox+    eigen3/doc/PassingByValue.dox+    eigen3/doc/TutorialGeometry.dox+    eigen3/doc/TutorialBlockOperations.dox+    eigen3/doc/Overview.dox+    eigen3/doc/FunctionsTakingEigenTypes.dox+    eigen3/doc/ftv2node.png     eigen3/COPYING.GPL     eigen3/unsupported/README.txt     eigen3/unsupported/bench/bench_svd.cpp@@ -685,6 +1682,7 @@     eigen3/unsupported/doc/examples/MatrixSinh.cpp     eigen3/unsupported/doc/CMakeLists.txt     eigen3/unsupported/doc/Overview.dox+    eigen3/CTestConfig.cmake   source-repository head
+ eigen3/CMakeLists.txt view
@@ -0,0 +1,616 @@+project(Eigen3)++cmake_minimum_required(VERSION 2.8.5)++# 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()++string(TOLOWER "${CMAKE_BUILD_TYPE}" cmake_build_type_tolower)+if(    NOT cmake_build_type_tolower STREQUAL "debug"+   AND NOT cmake_build_type_tolower STREQUAL "release"+   AND NOT cmake_build_type_tolower STREQUAL "relwithdebinfo")+  message(FATAL_ERROR "Unknown build type \"${CMAKE_BUILD_TYPE}\". Allowed values are Debug, Release, RelWithDebInfo (case-insensitive).")+endif()+++#############################################################################+# retrieve version infomation                                               #+#############################################################################++# automatically parse the version number+file(READ "${PROJECT_SOURCE_DIR}/Eigen/src/Core/util/Macros.h" _eigen_version_header)+string(REGEX MATCH "define[ \t]+EIGEN_WORLD_VERSION[ \t]+([0-9]+)" _eigen_world_version_match "${_eigen_version_header}")+set(EIGEN_WORLD_VERSION "${CMAKE_MATCH_1}")+string(REGEX MATCH "define[ \t]+EIGEN_MAJOR_VERSION[ \t]+([0-9]+)" _eigen_major_version_match "${_eigen_version_header}")+set(EIGEN_MAJOR_VERSION "${CMAKE_MATCH_1}")+string(REGEX MATCH "define[ \t]+EIGEN_MINOR_VERSION[ \t]+([0-9]+)" _eigen_minor_version_match "${_eigen_version_header}")+set(EIGEN_MINOR_VERSION "${CMAKE_MATCH_1}")+set(EIGEN_VERSION_NUMBER ${EIGEN_WORLD_VERSION}.${EIGEN_MAJOR_VERSION}.${EIGEN_MINOR_VERSION})++# if we are not in a mercurial clone+if(IS_DIRECTORY ${CMAKE_SOURCE_DIR}/.hg)+  # if the mercurial program is absent or this will leave the EIGEN_HG_CHANGESET string empty,+  # but won't stop CMake.+  execute_process(COMMAND hg tip -R ${CMAKE_SOURCE_DIR} OUTPUT_VARIABLE EIGEN_HGTIP_OUTPUT)+  execute_process(COMMAND hg branch -R ${CMAKE_SOURCE_DIR} OUTPUT_VARIABLE EIGEN_BRANCH_OUTPUT)+endif()++# if this is the default (aka development) branch, extract the mercurial changeset number from the hg tip output...+if(EIGEN_BRANCH_OUTPUT MATCHES "default")+string(REGEX MATCH "^changeset: *[0-9]*:([0-9;a-f]+).*" EIGEN_HG_CHANGESET_MATCH "${EIGEN_HGTIP_OUTPUT}")+set(EIGEN_HG_CHANGESET "${CMAKE_MATCH_1}")+endif(EIGEN_BRANCH_OUTPUT MATCHES "default")+#...and show it next to the version number+if(EIGEN_HG_CHANGESET)+  set(EIGEN_VERSION "${EIGEN_VERSION_NUMBER} (mercurial changeset ${EIGEN_HG_CHANGESET})")+else(EIGEN_HG_CHANGESET)+  set(EIGEN_VERSION "${EIGEN_VERSION_NUMBER}")+endif(EIGEN_HG_CHANGESET)+++include(CheckCXXCompilerFlag)+include(GNUInstallDirs)++set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)+++option(EIGEN_TEST_CXX11 "Enable testing with C++11 and C++11 features (e.g. Tensor module)." OFF)+++macro(ei_add_cxx_compiler_flag FLAG)+  string(REGEX REPLACE "-" "" SFLAG1 ${FLAG})+  string(REGEX REPLACE "\\+" "p" SFLAG ${SFLAG1})+  check_cxx_compiler_flag(${FLAG} COMPILER_SUPPORT_${SFLAG})+  if(COMPILER_SUPPORT_${SFLAG})+    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${FLAG}")+  endif()+endmacro(ei_add_cxx_compiler_flag)++check_cxx_compiler_flag("-std=c++11" EIGEN_COMPILER_SUPPORT_CPP11)++if(EIGEN_TEST_CXX11)+  set(CMAKE_CXX_STANDARD 11)+  set(CMAKE_CXX_EXTENSIONS OFF)+  if(EIGEN_COMPILER_SUPPORT_CPP11)+    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")+  endif()+else()+  #set(CMAKE_CXX_STANDARD 03)+  #set(CMAKE_CXX_EXTENSIONS OFF)+  ei_add_cxx_compiler_flag("-std=c++03")+endif()++#############################################################################+# find how to link to the standard libraries                                #+#############################################################################++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 ON)++option(EIGEN_SPLIT_LARGE_TESTS "Split large tests into smaller executables" ON)++option(EIGEN_DEFAULT_TO_ROW_MAJOR "Use row-major as default matrix storage order" OFF)+if(EIGEN_DEFAULT_TO_ROW_MAJOR)+  add_definitions("-DEIGEN_DEFAULT_TO_ROW_MAJOR")+endif()++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")+  +  # -Wshadow is insanely too strict with gcc, hopefully it will become usable with gcc 6+  # if(NOT CMAKE_COMPILER_IS_GNUCXX OR (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER "5.0.0"))+  if(NOT CMAKE_COMPILER_IS_GNUCXX)+    ei_add_cxx_compiler_flag("-Wshadow")+  endif()+  +  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+  +  +  # The -ansi flag must be added last, otherwise it is also used as a linker flag by check_cxx_compiler_flag making it fails+  # Moreover we should not set both -strict-ansi and -ansi+  check_cxx_compiler_flag("-strict-ansi" COMPILER_SUPPORT_STRICTANSI)+  ei_add_cxx_compiler_flag("-Qunused-arguments")        # disable clang warning: argument unused during compilation: '-ansi'+  +  if(COMPILER_SUPPORT_STRICTANSI)+    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -strict-ansi")+  else()+    ei_add_cxx_compiler_flag("-ansi")+  endif()++  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_AVX512 "Enable/Disable AVX512 in tests/examples" OFF)+  if(EIGEN_TEST_AVX512)+    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mavx512f -fabi-version=6 -DEIGEN_ENABLE_AVX512")+    message(STATUS "Enabling AVX512 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_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_ZVECTOR "Enable/Disable S390X(zEC13) ZVECTOR in tests/examples" OFF)+  if(EIGEN_TEST_ZVECTOR)+    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=z13 -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(NOT MSVC)++  # C4127 - conditional expression is constant+  # C4714 - marked as __forceinline not inlined (I failed to deactivate it selectively)+  #         We can disable this warning in the unit tests since it is clear that it occurs+  #         because we are oftentimes returning objects that have a destructor or may+  #         throw exceptions - in particular in the unit tests we are throwing extra many+  #         exceptions to cover indexing errors.+  # C4505 - unreferenced local function has been removed (impossible to deactive selectively)+  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /EHsc /wd4127 /wd4505 /wd4714")++  # replace all /Wx by /W4+  string(REGEX REPLACE "/W[0-9]" "/W4" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")++  check_cxx_compiler_flag("/openmp" COMPILER_SUPPORT_OPENMP)+  if(COMPILER_SUPPORT_OPENMP)+    option(EIGEN_TEST_OPENMP "Enable/Disable OpenMP in tests/examples" OFF)+    if(EIGEN_TEST_OPENMP)+      set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /openmp")+      message(STATUS "Enabling OpenMP in tests/examples")+    endif()+  endif()++  option(EIGEN_TEST_SSE2 "Enable/Disable SSE2 in tests/examples" OFF)+  if(EIGEN_TEST_SSE2)+    if(NOT CMAKE_CL_64)+      # arch is not supported on 64 bit systems, SSE is enabled automatically.+      set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /arch:SSE2")+    endif(NOT CMAKE_CL_64)+    message(STATUS "Enabling SSE2 in tests/examples")+  endif(EIGEN_TEST_SSE2)+endif(NOT MSVC)++option(EIGEN_TEST_NO_EXPLICIT_VECTORIZATION "Disable explicit vectorization in tests/examples" OFF)+option(EIGEN_TEST_X87 "Force using X87 instructions. Implies no vectorization." OFF)+option(EIGEN_TEST_32BIT "Force generating 32bit code." OFF)++if(EIGEN_TEST_X87)+  set(EIGEN_TEST_NO_EXPLICIT_VECTORIZATION ON)+  if(CMAKE_COMPILER_IS_GNUCXX)+    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mfpmath=387")+    message(STATUS "Forcing use of x87 instructions in tests/examples")+  else()+    message(STATUS "EIGEN_TEST_X87 ignored on your compiler")+  endif()+endif()++if(EIGEN_TEST_32BIT)+  if(CMAKE_COMPILER_IS_GNUCXX)+    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m32")+    message(STATUS "Forcing generation of 32-bit code in tests/examples")+  else()+    message(STATUS "EIGEN_TEST_32BIT ignored on your compiler")+  endif()+endif()++if(EIGEN_TEST_NO_EXPLICIT_VECTORIZATION)+  add_definitions(-DEIGEN_DONT_VECTORIZE=1)+  message(STATUS "Disabling vectorization in tests/examples")+endif()++option(EIGEN_TEST_NO_EXPLICIT_ALIGNMENT "Disable explicit alignment (hence vectorization) in tests/examples" OFF)+if(EIGEN_TEST_NO_EXPLICIT_ALIGNMENT)+  add_definitions(-DEIGEN_DONT_ALIGN=1)+  message(STATUS "Disabling alignment in tests/examples")+endif()++option(EIGEN_TEST_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} ${CMAKE_CURRENT_BINARY_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_PREFIX_PATH where Eigen header files are installed")+else()+  set(INCLUDE_INSTALL_DIR+      "${CMAKE_INSTALL_INCLUDEDIR}/eigen3"+      CACHE PATH "The directory relative to CMAKE_PREFIX_PATH where Eigen header files are installed"+      )+endif()+set(CMAKEPACKAGE_INSTALL_DIR+    "${CMAKE_INSTALL_DATADIR}/eigen3/cmake"+    CACHE PATH "The directory relative to CMAKE_PREFIX_PATH where Eigen3Config.cmake is installed"+    )+set(PKGCONFIG_INSTALL_DIR+    "${CMAKE_INSTALL_DATADIR}/pkgconfig"+    CACHE PATH "The directory relative to CMAKE_PREFIX_PATH where eigen3.pc is installed"+    )+++# similar to set_target_properties but append the property instead of overwriting it+macro(ei_add_target_property target prop value)++  get_target_property(previous ${target} ${prop})+  # if the property wasn't previously set, ${previous} is now "previous-NOTFOUND" which cmake allows catching with plain if()+  if(NOT previous)+    set(previous "")+  endif(NOT previous)+  set_target_properties(${target} PROPERTIES ${prop} "${previous} ${value}")+endmacro(ei_add_target_property)++install(FILES+  signature_of_eigen3_matrix_library+  DESTINATION ${INCLUDE_INSTALL_DIR} COMPONENT Devel+  )++if(EIGEN_BUILD_PKGCONFIG)+    configure_file(eigen3.pc.in eigen3.pc @ONLY)+    install(FILES ${CMAKE_CURRENT_BINARY_DIR}/eigen3.pc+        DESTINATION ${PKGCONFIG_INSTALL_DIR}+        )+endif()++add_subdirectory(Eigen)++add_subdirectory(doc EXCLUDE_FROM_ALL)++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()+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)+if(EIGEN_TEST_SYCL)+  set (CMAKE_MODULE_PATH "${CMAKE_ROOT}/Modules" "cmake/Modules/" "${CMAKE_MODULE_PATH}")+  include(FindComputeCpp)+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(EIGEN_BUILD_BTL)++if(NOT WIN32)+  add_subdirectory(bench/spbench EXCLUDE_FROM_ALL)+endif(NOT WIN32)++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 "")++option(EIGEN_FAILTEST "Enable failtests." OFF)+if(EIGEN_FAILTEST)+  add_subdirectory(failtest)+endif()++string(TOLOWER "${CMAKE_GENERATOR}" cmake_generator_tolower)+if(cmake_generator_tolower MATCHES "makefile")+  message(STATUS "Some things you can do now:")+  message(STATUS "--------------+--------------------------------------------------------------")+  message(STATUS "Command       |   Description")+  message(STATUS "--------------+--------------------------------------------------------------")+  message(STATUS "make install  | Install Eigen. Headers will be installed to:")+  message(STATUS "              |     <CMAKE_INSTALL_PREFIX>/<INCLUDE_INSTALL_DIR>")+  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 "make doc      | Generate the API documentation, requires Doxygen & LaTeX")+  message(STATUS "make check    | Build and run the unit-tests. Read this page:")+  message(STATUS "              |   http://eigen.tuxfamily.org/index.php?title=Tests")+  message(STATUS "make blas     | Build BLAS library (not the same thing as Eigen)")+  message(STATUS "make uninstall| Removes files installed by make install")+  message(STATUS "--------------+--------------------------------------------------------------")+else()+  message(STATUS "To build/run the unit tests, read this page:")+  message(STATUS "  http://eigen.tuxfamily.org/index.php?title=Tests")+endif()++message(STATUS "")+++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} )+set ( EIGEN_DEFINITIONS "")+set ( EIGEN_INCLUDE_DIR "${CMAKE_INSTALL_PREFIX}/${INCLUDE_INSTALL_DIR}" )+set ( EIGEN_ROOT_DIR ${CMAKE_INSTALL_PREFIX} )++# Interface libraries require at least CMake 3.0+if (NOT CMAKE_VERSION VERSION_LESS 3.0)+  include (CMakePackageConfigHelpers)++  # Imported target support+  add_library (eigen INTERFACE)++  target_compile_definitions (eigen INTERFACE ${EIGEN_DEFINITIONS})+  target_include_directories (eigen INTERFACE+    $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>+    $<INSTALL_INTERFACE:${INCLUDE_INSTALL_DIR}>+  )++  # 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+    PATH_VARS EIGEN_INCLUDE_DIR EIGEN_ROOT_DIR+    INSTALL_DESTINATION ${CMAKEPACKAGE_INSTALL_DIR}+    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})++else (NOT CMAKE_VERSION VERSION_LESS 3.0)+  # Fallback to legacy Eigen3Config.cmake without the imported target+  +  # If CMakePackageConfigHelpers module is available (CMake >= 2.8.8)+  # create a relocatable Config file, otherwise leave the hardcoded paths       +  include(CMakePackageConfigHelpers OPTIONAL RESULT_VARIABLE CPCH_PATH)+  +  if(CPCH_PATH)+    configure_package_config_file (+      ${CMAKE_CURRENT_SOURCE_DIR}/cmake/Eigen3ConfigLegacy.cmake.in+      ${CMAKE_CURRENT_BINARY_DIR}/Eigen3Config.cmake+      PATH_VARS EIGEN_INCLUDE_DIR EIGEN_ROOT_DIR+      INSTALL_DESTINATION ${CMAKEPACKAGE_INSTALL_DIR}+      NO_CHECK_REQUIRED_COMPONENTS_MACRO # Eigen does not provide components+    )+  else() +    # The PACKAGE_* variables are defined by the configure_package_config_file+    # but without it we define them manually to the hardcoded paths+    set(PACKAGE_INIT "")+    set(PACKAGE_EIGEN_INCLUDE_DIR ${EIGEN_INCLUDE_DIR})+    set(PACKAGE_EIGEN_ROOT_DIR ${EIGEN_ROOT_DIR})+    configure_file ( ${CMAKE_CURRENT_SOURCE_DIR}/cmake/Eigen3ConfigLegacy.cmake.in+                     ${CMAKE_CURRENT_BINARY_DIR}/Eigen3Config.cmake+                     @ONLY ESCAPE_QUOTES )+  endif()++  write_basic_package_version_file( Eigen3ConfigVersion.cmake+                                    VERSION ${EIGEN_VERSION_NUMBER}+                                    COMPATIBILITY SameMajorVersion )++endif (NOT CMAKE_VERSION VERSION_LESS 3.0)++install ( FILES ${CMAKE_CURRENT_SOURCE_DIR}/cmake/UseEigen3.cmake+                ${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)
+ eigen3/CTestConfig.cmake view
@@ -0,0 +1,13 @@+## This file should be placed in the root directory of your project.+## Then modify the CMakeLists.txt file in the root directory of your+## project to incorporate the testing dashboard.+## # The following are required to uses Dart and the Cdash dashboard+##   ENABLE_TESTING()+##   INCLUDE(CTest)+set(CTEST_PROJECT_NAME "Eigen 3.3")+set(CTEST_NIGHTLY_START_TIME "00:00:00 UTC")++set(CTEST_DROP_METHOD "http")+set(CTEST_DROP_SITE "manao.inria.fr")+set(CTEST_DROP_LOCATION "/CDash/submit.php?project=Eigen+3.3")+set(CTEST_DROP_SITE_CDASH TRUE)
+ eigen3/CTestCustom.cmake.in view
@@ -0,0 +1,4 @@++set(CTEST_CUSTOM_MAXIMUM_NUMBER_OF_WARNINGS "2000")+set(CTEST_CUSTOM_MAXIMUM_NUMBER_OF_ERRORS   "2000")+list(APPEND CTEST_CUSTOM_ERROR_EXCEPTION    @EIGEN_CTEST_ERROR_EXCEPTION@)
eigen3/Eigen/Core view
@@ -22,7 +22,6 @@   #define EIGEN_CUDA_ARCH __CUDA_ARCH__ #endif -// Starting with CUDA 9 the composite __CUDACC_VER__ is not available. #if defined(__CUDACC_VER_MAJOR__) && (__CUDACC_VER_MAJOR__ >= 9) #define EIGEN_CUDACC_VER  ((__CUDACC_VER_MAJOR__ * 10000) + (__CUDACC_VER_MINOR__ * 100)) #elif defined(__CUDACC_VER__)@@ -32,7 +31,7 @@ #endif  // Handle NVCC/CUDA/SYCL-#if defined(EIGEN_CUDACC) || defined(__SYCL_DEVICE_ONLY__)+#if defined(__CUDACC__) || defined(__SYCL_DEVICE_ONLY__)   // Do not try asserts on CUDA and SYCL!   #ifndef EIGEN_NO_DEBUG   #define EIGEN_NO_DEBUG@@ -47,7 +46,7 @@   #endif    // All functions callable from CUDA code must be qualified with __device__-  #ifdef EIGEN_CUDACC+  #ifdef __CUDACC__     // Do not try to vectorize on CUDA and SYCL!     #ifndef EIGEN_DONT_VECTORIZE     #define EIGEN_DONT_VECTORIZE@@ -60,24 +59,22 @@   #else     #define EIGEN_DEVICE_FUNC   #endif+ #else   #define EIGEN_DEVICE_FUNC-#endif -#ifdef __NVCC__-#define EIGEN_DONT_VECTORIZE #endif  // When compiling CUDA device code with NVCC, pull in math functions from the // global namespace.  In host mode, and when device doee with clang, use the // std versions.-#if defined(EIGEN_CUDA_ARCH) && defined(__NVCC__)+#if defined(__CUDA_ARCH__) && defined(__NVCC__)   #define EIGEN_USING_STD_MATH(FUNC) using ::FUNC; #else   #define EIGEN_USING_STD_MATH(FUNC) using std::FUNC; #endif -#if (defined(_CPPUNWIND) || defined(__EXCEPTIONS)) && !defined(EIGEN_CUDA_ARCH) && !defined(EIGEN_EXCEPTIONS) && !defined(EIGEN_USE_SYCL)+#if (defined(_CPPUNWIND) || defined(__EXCEPTIONS)) && !defined(__CUDA_ARCH__) && !defined(EIGEN_EXCEPTIONS) && !defined(EIGEN_USE_SYCL)   #define EIGEN_EXCEPTIONS #endif @@ -162,24 +159,15 @@     #endif     #ifdef __AVX2__       #define EIGEN_VECTORIZE_AVX2-      #define EIGEN_VECTORIZE_AVX-      #define EIGEN_VECTORIZE_SSE3-      #define EIGEN_VECTORIZE_SSSE3-      #define EIGEN_VECTORIZE_SSE4_1-      #define EIGEN_VECTORIZE_SSE4_2     #endif     #ifdef __FMA__       #define EIGEN_VECTORIZE_FMA     #endif-    #if defined(__AVX512F__)+    #if defined(__AVX512F__) && defined(EIGEN_ENABLE_AVX512)       #define EIGEN_VECTORIZE_AVX512       #define EIGEN_VECTORIZE_AVX2       #define EIGEN_VECTORIZE_AVX       #define EIGEN_VECTORIZE_FMA-      #define EIGEN_VECTORIZE_SSE3-      #define EIGEN_VECTORIZE_SSSE3-      #define EIGEN_VECTORIZE_SSE4_1-      #define EIGEN_VECTORIZE_SSE4_2       #ifdef __AVX512DQ__         #define EIGEN_VECTORIZE_AVX512DQ       #endif@@ -257,7 +245,7 @@   #define EIGEN_HAS_FP16_C #endif -#if defined EIGEN_CUDACC+#if defined __CUDACC__   #define EIGEN_VECTORIZE_CUDA   #include <vector_types.h>   #if EIGEN_CUDACC_VER >= 70500@@ -314,15 +302,6 @@   #include <intrin.h> #endif -#if defined(__SYCL_DEVICE_ONLY__)-  #undef min-  #undef max-  #undef isnan-  #undef isinf-  #undef isfinite-  #include <SYCL/sycl.hpp>-#endif- /** \brief Namespace containing all symbols from the %Eigen library. */ namespace Eigen { @@ -363,7 +342,7 @@  namespace Eigen { -// we use size_t frequently and we'll never remember to prepend it with std:: every time just to+// we use size_t frequently and we'll never remember to prepend it with std:: everytime just to // ensure QNX/QCC support using std::size_t; // gcc 4.6.0 wants std:: for ptrdiff_t@@ -387,10 +366,7 @@ #include "src/Core/util/StaticAssert.h" #include "src/Core/util/XprHelper.h" #include "src/Core/util/Memory.h"-#include "src/Core/util/IntegralConstant.h"-#include "src/Core/util/SymbolicIndex.h" - #include "src/Core/NumTraits.h" #include "src/Core/MathFunctions.h" #include "src/Core/GenericPacketMath.h"@@ -401,8 +377,6 @@   #include "src/Core/arch/SSE/PacketMath.h"   #include "src/Core/arch/AVX/PacketMath.h"   #include "src/Core/arch/AVX512/PacketMath.h"-  #include "src/Core/arch/SSE/MathFunctions.h"-  #include "src/Core/arch/AVX/MathFunctions.h"   #include "src/Core/arch/AVX512/MathFunctions.h" #elif defined EIGEN_VECTORIZE_AVX   // Use AVX for floats and doubles, SSE for integers@@ -456,8 +430,6 @@ // on CUDA devices #include "src/Core/arch/CUDA/Complex.h" -#include "src/Core/util/IndexedViewHelper.h"-#include "src/Core/ArithmeticSequence.h" #include "src/Core/IO.h" #include "src/Core/DenseCoeffsBase.h" #include "src/Core/DenseBase.h"@@ -499,7 +471,6 @@ #include "src/Core/Ref.h" #include "src/Core/Block.h" #include "src/Core/VectorBlock.h"-#include "src/Core/IndexedView.h" #include "src/Core/Transpose.h" #include "src/Core/DiagonalMatrix.h" #include "src/Core/Diagonal.h"
eigen3/Eigen/Geometry view
@@ -59,3 +59,4 @@  #endif // EIGEN_GEOMETRY_MODULE_H /* vim: set filetype=cpp et sw=2 ts=2 ai: */+
eigen3/Eigen/PaStiXSupport view
@@ -36,7 +36,6 @@   * \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.   *
eigen3/Eigen/src/Cholesky/LDLT.h view
@@ -247,7 +247,7 @@      /** \brief Reports whether previous computation was successful.       *-      * \returns \c Success if computation was successful,+      * \returns \c Success if computation was succesful,       *          \c NumericalIssue if the factorization failed because of a zero pivot.       */     ComputationInfo info() const@@ -258,6 +258,7 @@      #ifndef EIGEN_PARSED_BY_DOXYGEN     template<typename RhsType, typename DstType>+    EIGEN_DEVICE_FUNC     void _solve_impl(const RhsType &rhs, DstType &dst) const;     #endif @@ -304,7 +305,8 @@     if (size <= 1)     {       transpositions.setIdentity();-      if (numext::real(mat.coeff(0,0)) > static_cast<RealScalar>(0) ) sign = PositiveSemiDef;+      if(size==0) sign = ZeroSign;+      else if (numext::real(mat.coeff(0,0)) > static_cast<RealScalar>(0) ) sign = PositiveSemiDef;       else if (numext::real(mat.coeff(0,0)) < static_cast<RealScalar>(0)) sign = NegativeSemiDef;       else sign = ZeroSign;       return true;
eigen3/Eigen/src/Cholesky/LLT.h view
@@ -180,7 +180,7 @@      /** \brief Reports whether previous computation was successful.       *-      * \returns \c Success if computation was successful,+      * \returns \c Success if computation was succesful,       *          \c NumericalIssue if the matrix.appears not to be positive definite.       */     ComputationInfo info() const@@ -204,6 +204,7 @@      #ifndef EIGEN_PARSED_BY_DOXYGEN     template<typename RhsType, typename DstType>+    EIGEN_DEVICE_FUNC     void _solve_impl(const RhsType &rhs, DstType &dst) const;     #endif 
eigen3/Eigen/src/CholmodSupport/CholmodSupport.h view
@@ -32,7 +32,7 @@   } }; -// Other scalar types are not yet supported by Cholmod+// Other scalar types are not yet suppotred by Cholmod // template<> struct cholmod_configure_matrix<float> { //   template<typename CholmodType> //   static void run(CholmodType& mat) {@@ -124,9 +124,6 @@      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<_Scalar>::IsComplex == 0, THIS_METHOD_IS_ONLY_FOR_COLUMN_MAJOR_MATRICES);-  if(_Options & RowMajorBit) res.stype *=-1;    return res; }@@ -162,44 +159,6 @@           static_cast<StorageIndex*>(cm.p), static_cast<StorageIndex*>(cm.i),static_cast<Scalar*>(cm.x) ); } -namespace internal {--// template specializations for int and long that call the correct cholmod method--#define EIGEN_CHOLMOD_SPECIALIZE0(ret, name) \-    template<typename _StorageIndex> inline ret cm_ ## name       (cholmod_common &Common) { return cholmod_ ## name   (&Common); } \-    template<>                       inline ret cm_ ## name<long> (cholmod_common &Common) { return cholmod_l_ ## name (&Common); }--#define EIGEN_CHOLMOD_SPECIALIZE1(ret, name, t1, a1) \-    template<typename _StorageIndex> inline ret cm_ ## name       (t1& a1, cholmod_common &Common) { return cholmod_ ## name   (&a1, &Common); } \-    template<>                       inline ret cm_ ## name<long> (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<typename _StorageIndex> 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<long>   (int sys, cholmod_factor& L, cholmod_dense&  B, cholmod_common &Common) { return cholmod_l_solve   (sys, &L, &B, &Common); }--template<typename _StorageIndex> 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<long> (int sys, cholmod_factor& L, cholmod_sparse& B, cholmod_common &Common) { return cholmod_l_spsolve (sys, &L, &B, &Common); }--template<typename _StorageIndex>-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<long> (cholmod_sparse*  A, double beta[2], 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 };@@ -236,7 +195,7 @@     {       EIGEN_STATIC_ASSERT((internal::is_same<double,RealScalar>::value), CHOLMOD_SUPPORTS_DOUBLE_PRECISION_ONLY);       m_shiftOffset[0] = m_shiftOffset[1] = 0.0;-      internal::cm_start<StorageIndex>(m_cholmod);+      cholmod_start(&m_cholmod);     }      explicit CholmodBase(const MatrixType& matrix)@@ -244,15 +203,15 @@     {       EIGEN_STATIC_ASSERT((internal::is_same<double,RealScalar>::value), CHOLMOD_SUPPORTS_DOUBLE_PRECISION_ONLY);       m_shiftOffset[0] = m_shiftOffset[1] = 0.0;-      internal::cm_start<StorageIndex>(m_cholmod);+      cholmod_start(&m_cholmod);       compute(matrix);     }      ~CholmodBase()     {       if(m_cholmodFactor)-        internal::cm_free_factor<StorageIndex>(m_cholmodFactor, m_cholmod);-      internal::cm_finish<StorageIndex>(m_cholmod);+        cholmod_free_factor(&m_cholmodFactor, &m_cholmod);+      cholmod_finish(&m_cholmod);     }          inline StorageIndex cols() const { return internal::convert_index<StorageIndex, Index>(m_cholmodFactor->n); }@@ -260,7 +219,7 @@          /** \brief Reports whether previous computation was successful.       *-      * \returns \c Success if computation was successful,+      * \returns \c Success if computation was succesful,       *          \c NumericalIssue if the matrix.appears to be negative.       */     ComputationInfo info() const@@ -287,11 +246,11 @@     {       if(m_cholmodFactor)       {-        internal::cm_free_factor<StorageIndex>(m_cholmodFactor, m_cholmod);+        cholmod_free_factor(&m_cholmodFactor, &m_cholmod);         m_cholmodFactor = 0;       }       cholmod_sparse A = viewAsCholmod(matrix.template selfadjointView<UpLo>());-      m_cholmodFactor = internal::cm_analyze<StorageIndex>(A, m_cholmod);+      m_cholmodFactor = cholmod_analyze(&A, &m_cholmod);              this->m_isInitialized = true;       this->m_info = Success;@@ -309,7 +268,7 @@     {       eigen_assert(m_analysisIsOk && "You must first call analyzePattern()");       cholmod_sparse A = viewAsCholmod(matrix.template selfadjointView<UpLo>());-      internal::cm_factorize_p<StorageIndex>(&A, m_shiftOffset, 0, 0, m_cholmodFactor, m_cholmod);+      cholmod_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);@@ -330,20 +289,19 @@       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.+      // Cholmod needs column-major stoarge without inner-stride, which corresponds to the default behavior of Ref.       Ref<const Matrix<typename Rhs::Scalar,Dynamic,Dynamic,ColMajor> > b_ref(b.derived());        cholmod_dense b_cd = viewAsCholmod(b_ref);-      cholmod_dense* x_cd = internal::cm_solve<StorageIndex>(CHOLMOD_A, *m_cholmodFactor, b_cd, m_cholmod);+      cholmod_dense* x_cd = cholmod_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<Scalar,Dest::RowsAtCompileTime,Dest::ColsAtCompileTime>::Map(reinterpret_cast<Scalar*>(x_cd->x),b.rows(),b.cols());-      internal::cm_free_dense<StorageIndex>(x_cd, m_cholmod);+      cholmod_free_dense(&x_cd, &m_cholmod);     }          /** \internal */@@ -358,16 +316,15 @@       // note: cs stands for Cholmod Sparse       Ref<SparseMatrix<typename RhsDerived::Scalar,ColMajor,typename RhsDerived::StorageIndex> > b_ref(b.const_cast_derived());       cholmod_sparse b_cs = viewAsCholmod(b_ref);-      cholmod_sparse* x_cs = internal::cm_spsolve<StorageIndex>(CHOLMOD_A, *m_cholmodFactor, b_cs, m_cholmod);+      cholmod_sparse* x_cs = cholmod_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<typename DestDerived::Scalar,ColMajor,typename DestDerived::StorageIndex>(*x_cs);-      internal::cm_free_sparse<StorageIndex>(x_cs, m_cholmod);+      cholmod_free_sparse(&x_cs, &m_cholmod);     }     #endif // EIGEN_PARSED_BY_DOXYGEN     
eigen3/Eigen/src/Core/Array.h view
@@ -153,8 +153,6 @@       : Base(std::move(other))     {       Base::_check_template_params();-      if (RowsAtCompileTime!=Dynamic && ColsAtCompileTime!=Dynamic)-        Base::_set_noalias(other);     }     EIGEN_DEVICE_FUNC     Array& operator=(Array&& other) EIGEN_NOEXCEPT_IF(std::is_nothrow_move_assignable<Scalar>::value)
eigen3/Eigen/src/Core/ArrayBase.h view
@@ -69,7 +69,6 @@     using Base::coeff;     using Base::coeffRef;     using Base::lazyAssign;-    using Base::operator-;     using Base::operator=;     using Base::operator+=;     using Base::operator-=;@@ -89,6 +88,7 @@  #define EIGEN_CURRENT_STORAGE_BASE_CLASS Eigen::ArrayBase #define EIGEN_DOC_UNARY_ADDONS(X,Y)+#   include "../plugins/CommonCwiseUnaryOps.h" #   include "../plugins/MatrixCwiseUnaryOps.h" #   include "../plugins/ArrayCwiseUnaryOps.h" #   include "../plugins/CommonCwiseBinaryOps.h"
eigen3/Eigen/src/Core/Assign.h view
@@ -16,7 +16,7 @@  template<typename Derived> template<typename OtherDerived>-EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& DenseBase<Derived>+EIGEN_STRONG_INLINE Derived& DenseBase<Derived>   ::lazyAssign(const DenseBase<OtherDerived>& other) {   enum{
eigen3/Eigen/src/Core/AssignEvaluator.h view
@@ -97,7 +97,7 @@  public:   enum {-    Traversal = (int(MayLinearVectorize) && (LinearPacketSize>InnerPacketSize)) ? int(LinearVectorizedTraversal)+    Traversal = int(MayLinearVectorize) && (LinearPacketSize>InnerPacketSize) ? int(LinearVectorizedTraversal)               : int(MayInnerVectorize)   ? int(InnerVectorizedTraversal)               : int(MayLinearVectorize)  ? int(LinearVectorizedTraversal)               : int(MaySliceVectorize)   ? int(SliceVectorizedTraversal)@@ -756,7 +756,7 @@ // AssignmentKind must define a Kind typedef. template<typename DstShape, typename SrcShape> struct AssignmentKind; -// Assignment kind defined in this file:+// Assignement kind defined in this file: struct Dense2Dense {}; struct EigenBase2EigenBase {}; @@ -899,7 +899,7 @@     src.evalTo(dst);   } -  // NOTE The following two functions are templated to avoid their instantiation if not needed+  // NOTE The following two functions are templated to avoid their instanciation if not needed   //      This is needed because some expressions supports evalTo only and/or have 'void' as scalar type.   template<typename SrcScalarType>   EIGEN_DEVICE_FUNC
eigen3/Eigen/src/Core/BooleanRedux.h view
@@ -14,54 +14,56 @@  namespace internal { -template<typename Derived, int UnrollCount, int Rows>+template<typename Derived, int UnrollCount> struct all_unroller {+  typedef typename Derived::ExpressionTraits Traits;   enum {-    col = (UnrollCount-1) / Rows,-    row = (UnrollCount-1) % Rows+    col = (UnrollCount-1) / Traits::RowsAtCompileTime,+    row = (UnrollCount-1) % Traits::RowsAtCompileTime   };    static inline bool run(const Derived &mat)   {-    return all_unroller<Derived, UnrollCount-1, Rows>::run(mat) && mat.coeff(row, col);+    return all_unroller<Derived, UnrollCount-1>::run(mat) && mat.coeff(row, col);   } }; -template<typename Derived, int Rows>-struct all_unroller<Derived, 0, Rows>+template<typename Derived>+struct all_unroller<Derived, 0> {   static inline bool run(const Derived &/*mat*/) { return true; } }; -template<typename Derived, int Rows>-struct all_unroller<Derived, Dynamic, Rows>+template<typename Derived>+struct all_unroller<Derived, Dynamic> {   static inline bool run(const Derived &) { return false; } }; -template<typename Derived, int UnrollCount, int Rows>+template<typename Derived, int UnrollCount> struct any_unroller {+  typedef typename Derived::ExpressionTraits Traits;   enum {-    col = (UnrollCount-1) / Rows,-    row = (UnrollCount-1) % Rows+    col = (UnrollCount-1) / Traits::RowsAtCompileTime,+    row = (UnrollCount-1) % Traits::RowsAtCompileTime   };      static inline bool run(const Derived &mat)   {-    return any_unroller<Derived, UnrollCount-1, Rows>::run(mat) || mat.coeff(row, col);+    return any_unroller<Derived, UnrollCount-1>::run(mat) || mat.coeff(row, col);   } }; -template<typename Derived, int Rows>-struct any_unroller<Derived, 0, Rows>+template<typename Derived>+struct any_unroller<Derived, 0> {   static inline bool run(const Derived & /*mat*/) { return false; } }; -template<typename Derived, int Rows>-struct any_unroller<Derived, Dynamic, Rows>+template<typename Derived>+struct any_unroller<Derived, Dynamic> {   static inline bool run(const Derived &) { return false; } };@@ -76,7 +78,7 @@   * \sa any(), Cwise::operator<()   */ template<typename Derived>-EIGEN_DEVICE_FUNC inline bool DenseBase<Derived>::all() const+inline bool DenseBase<Derived>::all() const {   typedef internal::evaluator<Derived> Evaluator;   enum {@@ -85,7 +87,7 @@   };   Evaluator evaluator(derived());   if(unroll)-    return internal::all_unroller<Evaluator, unroll ? int(SizeAtCompileTime) : Dynamic, internal::traits<Derived>::RowsAtCompileTime>::run(evaluator);+    return internal::all_unroller<Evaluator, unroll ? int(SizeAtCompileTime) : Dynamic>::run(evaluator);   else   {     for(Index j = 0; j < cols(); ++j)@@ -100,7 +102,7 @@   * \sa all()   */ template<typename Derived>-EIGEN_DEVICE_FUNC inline bool DenseBase<Derived>::any() const+inline bool DenseBase<Derived>::any() const {   typedef internal::evaluator<Derived> Evaluator;   enum {@@ -109,7 +111,7 @@   };   Evaluator evaluator(derived());   if(unroll)-    return internal::any_unroller<Evaluator, unroll ? int(SizeAtCompileTime) : Dynamic, internal::traits<Derived>::RowsAtCompileTime>::run(evaluator);+    return internal::any_unroller<Evaluator, unroll ? int(SizeAtCompileTime) : Dynamic>::run(evaluator);   else   {     for(Index j = 0; j < cols(); ++j)@@ -124,7 +126,7 @@   * \sa all(), any()   */ template<typename Derived>-EIGEN_DEVICE_FUNC inline Eigen::Index DenseBase<Derived>::count() const+inline Eigen::Index DenseBase<Derived>::count() const {   return derived().template cast<bool>().template cast<Index>().sum(); }
eigen3/Eigen/src/Core/CommaInitializer.h view
@@ -141,7 +141,7 @@   * \sa CommaInitializer::finished(), class CommaInitializer   */ template<typename Derived>-EIGEN_DEVICE_FUNC inline CommaInitializer<Derived> DenseBase<Derived>::operator<< (const Scalar& s)+inline CommaInitializer<Derived> DenseBase<Derived>::operator<< (const Scalar& s) {   return CommaInitializer<Derived>(*static_cast<Derived*>(this), s); }@@ -149,7 +149,7 @@ /** \sa operator<<(const Scalar&) */ template<typename Derived> template<typename OtherDerived>-EIGEN_DEVICE_FUNC inline CommaInitializer<Derived>+inline CommaInitializer<Derived> DenseBase<Derived>::operator<<(const DenseBase<OtherDerived>& other) {   return CommaInitializer<Derived>(*static_cast<Derived *>(this), other);
eigen3/Eigen/src/Core/ConditionEstimator.h view
@@ -160,7 +160,7 @@ {   typedef typename Decomposition::RealScalar RealScalar;   eigen_assert(dec.rows() == dec.cols());-  if (dec.rows() == 0)              return RealScalar(1);+  if (dec.rows() == 0)              return NumTraits<RealScalar>::infinity();   if (matrix_norm == RealScalar(0)) return RealScalar(0);   if (dec.rows() == 1)              return RealScalar(1);   const RealScalar inverse_matrix_norm = rcond_invmatrix_L1_norm_estimate(dec);
eigen3/Eigen/src/Core/CoreEvaluators.h view
@@ -106,7 +106,7 @@ // ---------- base class for all evaluators ----------  template<typename ExpressionType>-struct evaluator_base+struct evaluator_base : public noncopyable {   // TODO that's not very nice to have to propagate all these traits. They are currently only needed to handle outer,inner indices.   typedef traits<ExpressionType> ExpressionTraits;@@ -114,14 +114,6 @@   enum {     Alignment = 0   };-  // noncopyable:-  // Don't make this class inherit noncopyable as this kills EBO (Empty Base Optimization)-  // and make complex evaluator much larger than then should do.-  EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE evaluator_base() {}-  EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE ~evaluator_base() {}-private:-  EIGEN_DEVICE_FUNC evaluator_base(const evaluator_base&);-  EIGEN_DEVICE_FUNC const evaluator_base& operator=(const evaluator_base&); };  // -------------------- Matrix and Array --------------------@@ -131,29 +123,6 @@ // Here we directly specialize evaluator. This is not really a unary expression, and it is, by definition, dense, // so no need for more sophisticated dispatching. -// this helper permits to completely eliminate m_outerStride if it is known at compiletime.-template<typename Scalar,int OuterStride> class plainobjectbase_evaluator_data {-public:-  EIGEN_DEVICE_FUNC plainobjectbase_evaluator_data(const Scalar* ptr, Index outerStride) : data(ptr)-  {-#ifndef EIGEN_INTERNAL_DEBUGGING-    EIGEN_UNUSED_VARIABLE(outerStride);-#endif-    eigen_internal_assert(outerStride==OuterStride);-  }-  EIGEN_DEVICE_FUNC Index outerStride() const { return OuterStride; }-  const Scalar *data;-};--template<typename Scalar> class plainobjectbase_evaluator_data<Scalar,Dynamic> {-public:-  EIGEN_DEVICE_FUNC plainobjectbase_evaluator_data(const Scalar* ptr, Index outerStride) : data(ptr), m_outerStride(outerStride) {}-  EIGEN_DEVICE_FUNC Index outerStride() const { return m_outerStride; }-  const Scalar *data;-protected:-  Index m_outerStride;-};- template<typename Derived> struct evaluator<PlainObjectBase<Derived> >   : evaluator_base<Derived>@@ -172,21 +141,18 @@     Flags = traits<Derived>::EvaluatorFlags,     Alignment = traits<Derived>::Alignment   };-  enum {-    // We do not need to know the outer stride for vectors-    OuterStrideAtCompileTime = IsVectorAtCompileTime  ? 0-                                                      : int(IsRowMajor) ? ColsAtCompileTime-                                                                        : RowsAtCompileTime-  };-+     EIGEN_DEVICE_FUNC evaluator()-    : m_d(0,OuterStrideAtCompileTime)+    : m_data(0),+      m_outerStride(IsVectorAtCompileTime  ? 0 +                                           : int(IsRowMajor) ? ColsAtCompileTime +                                           : RowsAtCompileTime)   {     EIGEN_INTERNAL_CHECK_COST_VALUE(CoeffReadCost);   }-+     EIGEN_DEVICE_FUNC explicit evaluator(const PlainObjectType& m)-    : m_d(m.data(),IsVectorAtCompileTime ? 0 : m.outerStride())+    : m_data(m.data()), m_outerStride(IsVectorAtCompileTime ? 0 : m.outerStride())    {     EIGEN_INTERNAL_CHECK_COST_VALUE(CoeffReadCost);   }@@ -195,30 +161,30 @@   CoeffReturnType coeff(Index row, Index col) const   {     if (IsRowMajor)-      return m_d.data[row * m_d.outerStride() + col];+      return m_data[row * m_outerStride.value() + col];     else-      return m_d.data[row + col * m_d.outerStride()];+      return m_data[row + col * m_outerStride.value()];   }    EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE   CoeffReturnType coeff(Index index) const   {-    return m_d.data[index];+    return m_data[index];   }    EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE   Scalar& coeffRef(Index row, Index col)   {     if (IsRowMajor)-      return const_cast<Scalar*>(m_d.data)[row * m_d.outerStride() + col];+      return const_cast<Scalar*>(m_data)[row * m_outerStride.value() + col];     else-      return const_cast<Scalar*>(m_d.data)[row + col * m_d.outerStride()];+      return const_cast<Scalar*>(m_data)[row + col * m_outerStride.value()];   }    EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE   Scalar& coeffRef(Index index)   {-    return const_cast<Scalar*>(m_d.data)[index];+    return const_cast<Scalar*>(m_data)[index];   }    template<int LoadMode, typename PacketType>@@ -226,16 +192,16 @@   PacketType packet(Index row, Index col) const   {     if (IsRowMajor)-      return ploadt<PacketType, LoadMode>(m_d.data + row * m_d.outerStride() + col);+      return ploadt<PacketType, LoadMode>(m_data + row * m_outerStride.value() + col);     else-      return ploadt<PacketType, LoadMode>(m_d.data + row + col * m_d.outerStride());+      return ploadt<PacketType, LoadMode>(m_data + row + col * m_outerStride.value());   }    template<int LoadMode, typename PacketType>   EIGEN_STRONG_INLINE   PacketType packet(Index index) const   {-    return ploadt<PacketType, LoadMode>(m_d.data + index);+    return ploadt<PacketType, LoadMode>(m_data + index);   }    template<int StoreMode,typename PacketType>@@ -244,22 +210,26 @@   {     if (IsRowMajor)       return pstoret<Scalar, PacketType, StoreMode>-	            (const_cast<Scalar*>(m_d.data) + row * m_d.outerStride() + col, x);+	            (const_cast<Scalar*>(m_data) + row * m_outerStride.value() + col, x);     else       return pstoret<Scalar, PacketType, StoreMode>-                    (const_cast<Scalar*>(m_d.data) + row + col * m_d.outerStride(), x);+                    (const_cast<Scalar*>(m_data) + row + col * m_outerStride.value(), x);   }    template<int StoreMode, typename PacketType>   EIGEN_STRONG_INLINE   void writePacket(Index index, const PacketType& x)   {-    return pstoret<Scalar, PacketType, StoreMode>(const_cast<Scalar*>(m_d.data) + index, x);+    return pstoret<Scalar, PacketType, StoreMode>(const_cast<Scalar*>(m_data) + index, x);   }  protected:+  const Scalar *m_data; -  plainobjectbase_evaluator_data<Scalar,OuterStrideAtCompileTime> m_d;+  // We do not need to know the outer stride for vectors+  variable_if_dynamic<Index, IsVectorAtCompileTime  ? 0 +                                                    : int(IsRowMajor) ? ColsAtCompileTime +                                                    : RowsAtCompileTime> m_outerStride; };  template<typename Scalar, int Rows, int Cols, int Options, int MaxRows, int MaxCols>@@ -557,7 +527,9 @@   };    EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE-  explicit unary_evaluator(const XprType& op) : m_d(op)+  explicit unary_evaluator(const XprType& op)+    : m_functor(op.functor()), +      m_argImpl(op.nestedExpression())    {     EIGEN_INTERNAL_CHECK_COST_VALUE(functor_traits<UnaryOp>::Cost);     EIGEN_INTERNAL_CHECK_COST_VALUE(CoeffReadCost);@@ -568,43 +540,32 @@   EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE   CoeffReturnType coeff(Index row, Index col) const   {-    return m_d.func()(m_d.argImpl.coeff(row, col));+    return m_functor(m_argImpl.coeff(row, col));   }    EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE   CoeffReturnType coeff(Index index) const   {-    return m_d.func()(m_d.argImpl.coeff(index));+    return m_functor(m_argImpl.coeff(index));   }    template<int LoadMode, typename PacketType>   EIGEN_STRONG_INLINE   PacketType packet(Index row, Index col) const   {-    return m_d.func().packetOp(m_d.argImpl.template packet<LoadMode, PacketType>(row, col));+    return m_functor.packetOp(m_argImpl.template packet<LoadMode, PacketType>(row, col));   }    template<int LoadMode, typename PacketType>   EIGEN_STRONG_INLINE   PacketType packet(Index index) const   {-    return m_d.func().packetOp(m_d.argImpl.template packet<LoadMode, PacketType>(index));+    return m_functor.packetOp(m_argImpl.template packet<LoadMode, PacketType>(index));   }  protected:--  // this helper permits to completely eliminate the functor if it is empty-  class Data : private UnaryOp-  {-  public:-    EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE-    Data(const XprType& xpr) : UnaryOp(xpr.functor()), argImpl(xpr.nestedExpression()) {}-    EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE-    const UnaryOp& func() const { return static_cast<const UnaryOp&>(*this); }-    evaluator<ArgType> argImpl;-  };--  Data m_d;+  const UnaryOp m_functor;+  evaluator<ArgType> m_argImpl; };  // -------------------- CwiseTernaryOp --------------------@@ -648,7 +609,11 @@         evaluator<Arg3>::Alignment)   }; -  EIGEN_DEVICE_FUNC explicit ternary_evaluator(const XprType& xpr) : m_d(xpr)+  EIGEN_DEVICE_FUNC explicit ternary_evaluator(const XprType& xpr)+    : m_functor(xpr.functor()),+      m_arg1Impl(xpr.arg1()), +      m_arg2Impl(xpr.arg2()), +      m_arg3Impl(xpr.arg3())     {     EIGEN_INTERNAL_CHECK_COST_VALUE(functor_traits<TernaryOp>::Cost);     EIGEN_INTERNAL_CHECK_COST_VALUE(CoeffReadCost);@@ -659,47 +624,38 @@   EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE   CoeffReturnType coeff(Index row, Index col) const   {-    return m_d.func()(m_d.arg1Impl.coeff(row, col), m_d.arg2Impl.coeff(row, col), m_d.arg3Impl.coeff(row, col));+    return m_functor(m_arg1Impl.coeff(row, col), m_arg2Impl.coeff(row, col), m_arg3Impl.coeff(row, col));   }    EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE   CoeffReturnType coeff(Index index) const   {-    return m_d.func()(m_d.arg1Impl.coeff(index), m_d.arg2Impl.coeff(index), m_d.arg3Impl.coeff(index));+    return m_functor(m_arg1Impl.coeff(index), m_arg2Impl.coeff(index), m_arg3Impl.coeff(index));   }    template<int LoadMode, typename PacketType>   EIGEN_STRONG_INLINE   PacketType packet(Index row, Index col) const   {-    return m_d.func().packetOp(m_d.arg1Impl.template packet<LoadMode,PacketType>(row, col),-                               m_d.arg2Impl.template packet<LoadMode,PacketType>(row, col),-                               m_d.arg3Impl.template packet<LoadMode,PacketType>(row, col));+    return m_functor.packetOp(m_arg1Impl.template packet<LoadMode,PacketType>(row, col),+                              m_arg2Impl.template packet<LoadMode,PacketType>(row, col),+                              m_arg3Impl.template packet<LoadMode,PacketType>(row, col));   }    template<int LoadMode, typename PacketType>   EIGEN_STRONG_INLINE   PacketType packet(Index index) const   {-    return m_d.func().packetOp(m_d.arg1Impl.template packet<LoadMode,PacketType>(index),-                               m_d.arg2Impl.template packet<LoadMode,PacketType>(index),-                               m_d.arg3Impl.template packet<LoadMode,PacketType>(index));+    return m_functor.packetOp(m_arg1Impl.template packet<LoadMode,PacketType>(index),+                              m_arg2Impl.template packet<LoadMode,PacketType>(index),+                              m_arg3Impl.template packet<LoadMode,PacketType>(index));   }  protected:-  // this helper permits to completely eliminate the functor if it is empty-  struct Data : private TernaryOp-  {-    EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE-    Data(const XprType& xpr) : TernaryOp(xpr.functor()), arg1Impl(xpr.arg1()), arg2Impl(xpr.arg2()), arg3Impl(xpr.arg3()) {}-    EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE-    const TernaryOp& func() const { return static_cast<const TernaryOp&>(*this); }-    evaluator<Arg1> arg1Impl;-    evaluator<Arg2> arg2Impl;-    evaluator<Arg3> arg3Impl;-  };--  Data m_d;+  const TernaryOp m_functor;+  evaluator<Arg1> m_arg1Impl;+  evaluator<Arg2> m_arg2Impl;+  evaluator<Arg3> m_arg3Impl; };  // -------------------- CwiseBinaryOp --------------------@@ -740,7 +696,10 @@     Alignment = EIGEN_PLAIN_ENUM_MIN(evaluator<Lhs>::Alignment,evaluator<Rhs>::Alignment)   }; -  EIGEN_DEVICE_FUNC explicit binary_evaluator(const XprType& xpr) : m_d(xpr)+  EIGEN_DEVICE_FUNC 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<BinaryOp>::Cost);     EIGEN_INTERNAL_CHECK_COST_VALUE(CoeffReadCost);@@ -751,45 +710,35 @@   EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE   CoeffReturnType coeff(Index row, Index col) const   {-    return m_d.func()(m_d.lhsImpl.coeff(row, col), m_d.rhsImpl.coeff(row, col));+    return m_functor(m_lhsImpl.coeff(row, col), m_rhsImpl.coeff(row, col));   }    EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE   CoeffReturnType coeff(Index index) const   {-    return m_d.func()(m_d.lhsImpl.coeff(index), m_d.rhsImpl.coeff(index));+    return m_functor(m_lhsImpl.coeff(index), m_rhsImpl.coeff(index));   }    template<int LoadMode, typename PacketType>   EIGEN_STRONG_INLINE   PacketType packet(Index row, Index col) const   {-    return m_d.func().packetOp(m_d.lhsImpl.template packet<LoadMode,PacketType>(row, col),-                               m_d.rhsImpl.template packet<LoadMode,PacketType>(row, col));+    return m_functor.packetOp(m_lhsImpl.template packet<LoadMode,PacketType>(row, col),+                              m_rhsImpl.template packet<LoadMode,PacketType>(row, col));   }    template<int LoadMode, typename PacketType>   EIGEN_STRONG_INLINE   PacketType packet(Index index) const   {-    return m_d.func().packetOp(m_d.lhsImpl.template packet<LoadMode,PacketType>(index),-                               m_d.rhsImpl.template packet<LoadMode,PacketType>(index));+    return m_functor.packetOp(m_lhsImpl.template packet<LoadMode,PacketType>(index),+                              m_rhsImpl.template packet<LoadMode,PacketType>(index));   }  protected:--  // this helper permits to completely eliminate the functor if it is empty-  struct Data : private BinaryOp-  {-    EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE-    Data(const XprType& xpr) : BinaryOp(xpr.functor()), lhsImpl(xpr.lhs()), rhsImpl(xpr.rhs()) {}-    EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE-    const BinaryOp& func() const { return static_cast<const BinaryOp&>(*this); }-    evaluator<Lhs> lhsImpl;-    evaluator<Rhs> rhsImpl;-  };--  Data m_d;+  const BinaryOp m_functor;+  evaluator<Lhs> m_lhsImpl;+  evaluator<Rhs> m_rhsImpl; };  // -------------------- CwiseUnaryView --------------------@@ -808,7 +757,9 @@     Alignment = 0 // FIXME it is not very clear why alignment is necessarily lost...   }; -  EIGEN_DEVICE_FUNC explicit unary_evaluator(const XprType& op) : m_d(op)+  EIGEN_DEVICE_FUNC explicit unary_evaluator(const XprType& op)+    : m_unaryOp(op.functor()), +      m_argImpl(op.nestedExpression())    {     EIGEN_INTERNAL_CHECK_COST_VALUE(functor_traits<UnaryOp>::Cost);     EIGEN_INTERNAL_CHECK_COST_VALUE(CoeffReadCost);@@ -820,40 +771,30 @@   EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE   CoeffReturnType coeff(Index row, Index col) const   {-    return m_d.func()(m_d.argImpl.coeff(row, col));+    return m_unaryOp(m_argImpl.coeff(row, col));   }    EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE   CoeffReturnType coeff(Index index) const   {-    return m_d.func()(m_d.argImpl.coeff(index));+    return m_unaryOp(m_argImpl.coeff(index));   }    EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE   Scalar& coeffRef(Index row, Index col)   {-    return m_d.func()(m_d.argImpl.coeffRef(row, col));+    return m_unaryOp(m_argImpl.coeffRef(row, col));   }    EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE   Scalar& coeffRef(Index index)   {-    return m_d.func()(m_d.argImpl.coeffRef(index));+    return m_unaryOp(m_argImpl.coeffRef(index));   }  protected:--  // this helper permits to completely eliminate the functor if it is empty-  struct Data : private UnaryOp-  {-    EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE-    Data(const XprType& xpr) : UnaryOp(xpr.functor()), argImpl(xpr.nestedExpression()) {}-    EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE-    const UnaryOp& func() const { return static_cast<const UnaryOp&>(*this); }-    evaluator<ArgType> argImpl;-  };--  Data m_d;+  const UnaryOp m_unaryOp;+  evaluator<ArgType> m_argImpl; };  // -------------------- Map --------------------
eigen3/Eigen/src/Core/CoreIterators.h view
@@ -48,11 +48,6 @@     * Explicit zeros are not skipped over. To skip explicit zeros, see class SparseView     */   EIGEN_STRONG_INLINE InnerIterator& operator++()   { m_iter.operator++(); return *this; }-  EIGEN_STRONG_INLINE InnerIterator& operator+=(Index i) { m_iter.operator+=(i); return *this; }-  EIGEN_STRONG_INLINE InnerIterator operator+(Index i) -  { InnerIterator result(*this); result+=i; return result; }-    -   /// \returns the column or row index of the current coefficient.   EIGEN_STRONG_INLINE Index index() const           { return m_iter.index(); }   /// \returns the row index of the current coefficient.
eigen3/Eigen/src/Core/CwiseBinaryOp.h view
@@ -158,7 +158,7 @@   */ template<typename Derived> template<typename OtherDerived>-EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived &+EIGEN_STRONG_INLINE Derived & MatrixBase<Derived>::operator-=(const MatrixBase<OtherDerived> &other) {   call_assignment(derived(), other.derived(), internal::sub_assign_op<Scalar,typename OtherDerived::Scalar>());@@ -171,7 +171,7 @@   */ template<typename Derived> template<typename OtherDerived>-EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived &+EIGEN_STRONG_INLINE Derived & MatrixBase<Derived>::operator+=(const MatrixBase<OtherDerived>& other) {   call_assignment(derived(), other.derived(), internal::add_assign_op<Scalar,typename OtherDerived::Scalar>());@@ -181,3 +181,4 @@ } // end namespace Eigen  #endif // EIGEN_CWISE_BINARY_OP_H+
eigen3/Eigen/src/Core/CwiseNullaryOp.h view
@@ -131,7 +131,7 @@   */ template<typename Derived> template<typename CustomNullaryOp>-EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const CwiseNullaryOp<CustomNullaryOp, typename DenseBase<Derived>::PlainObject>+EIGEN_STRONG_INLINE const CwiseNullaryOp<CustomNullaryOp, typename DenseBase<Derived>::PlainObject> DenseBase<Derived>::NullaryExpr(Index size, const CustomNullaryOp& func) {   EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)@@ -170,7 +170,7 @@   * \sa class CwiseNullaryOp   */ template<typename Derived>-EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename DenseBase<Derived>::ConstantReturnType+EIGEN_STRONG_INLINE const typename DenseBase<Derived>::ConstantReturnType DenseBase<Derived>::Constant(Index rows, Index cols, const Scalar& value) {   return DenseBase<Derived>::NullaryExpr(rows, cols, internal::scalar_constant_op<Scalar>(value));@@ -860,42 +860,6 @@ template<typename Derived> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename MatrixBase<Derived>::BasisReturnType MatrixBase<Derived>::UnitW() { return Derived::Unit(3); }--/** \brief Set the coefficients of \c *this to the i-th unit (basis) vector-  *-  * \param i index of the unique coefficient to be set to 1-  *-  * \only_for_vectors-  *-  * \sa MatrixBase::setIdentity(), class CwiseNullaryOp, MatrixBase::Unit(Index,Index)-  */-template<typename Derived>-EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& MatrixBase<Derived>::setUnit(Index i)-{-  EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived);-  eigen_assert(i<size());-  derived().setZero();-  derived().coeffRef(i) = Scalar(1);-  return derived();-}--/** \brief Resizes to the given \a newSize, and writes the i-th unit (basis) vector into *this.-  *-  * \param newSize the new size of the vector-  * \param i index of the unique coefficient to be set to 1-  *-  * \only_for_vectors-  *-  * \sa MatrixBase::setIdentity(), class CwiseNullaryOp, MatrixBase::Unit(Index,Index)-  */-template<typename Derived>-EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& MatrixBase<Derived>::setUnit(Index newSize, Index i)-{-  EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived);-  eigen_assert(i<newSize);-  derived().resize(newSize);-  return setUnit(i);-}  } // end namespace Eigen 
eigen3/Eigen/src/Core/DenseBase.h view
@@ -395,7 +395,7 @@       * 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.       * -      * \warning Be careful with eval() and the auto C++ keyword, as detailed in this \link TopicPitfalls_auto_keyword page \endlink.+      * \warning Be carefull with eval() and the auto C++ keyword, as detailed in this \link TopicPitfalls_auto_keyword page \endlink.       */     EIGEN_DEVICE_FUNC     EIGEN_STRONG_INLINE EvalReturnType eval() const@@ -570,17 +570,13 @@ #define EIGEN_CURRENT_STORAGE_BASE_CLASS Eigen::DenseBase #define EIGEN_DOC_BLOCK_ADDONS_NOT_INNER_PANEL #define EIGEN_DOC_BLOCK_ADDONS_INNER_PANEL_IF(COND)-#define EIGEN_DOC_UNARY_ADDONS(X,Y)-#   include "../plugins/CommonCwiseUnaryOps.h" #   include "../plugins/BlockMethods.h"-#   include "../plugins/IndexedViewMethods.h" #   ifdef EIGEN_DENSEBASE_PLUGIN #     include EIGEN_DENSEBASE_PLUGIN #   endif #undef EIGEN_CURRENT_STORAGE_BASE_CLASS #undef EIGEN_DOC_BLOCK_ADDONS_NOT_INNER_PANEL #undef EIGEN_DOC_BLOCK_ADDONS_INNER_PANEL_IF-#undef EIGEN_DOC_UNARY_ADDONS      // disable the use of evalTo for dense objects with a nice compilation error     template<typename Dest>
eigen3/Eigen/src/Core/DenseStorage.h view
@@ -61,7 +61,7 @@ #if defined(EIGEN_DISABLE_UNALIGNED_ARRAY_ASSERT)   #define EIGEN_MAKE_UNALIGNED_ARRAY_ASSERT(sizemask) #elif EIGEN_GNUC_AT_LEAST(4,7) -  // GCC 4.7 is too aggressive in its optimizations and remove the alignment test based on the fact the array is declared to be aligned.+  // GCC 4.7 is too aggressive in its optimizations and remove the alignement test based on the fact the array is declared to be aligned.   // See this bug report: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53900   // Hiding the origin of the array pointer behind a function argument seems to do the trick even if the function is inlined:   template<typename PtrType>
eigen3/Eigen/src/Core/Diagonal.h view
@@ -187,7 +187,7 @@   *   * \sa class Diagonal */ template<typename Derived>-EIGEN_DEVICE_FUNC inline typename MatrixBase<Derived>::DiagonalReturnType+inline typename MatrixBase<Derived>::DiagonalReturnType MatrixBase<Derived>::diagonal() {   return DiagonalReturnType(derived());@@ -195,7 +195,7 @@  /** This is the const version of diagonal(). */ template<typename Derived>-EIGEN_DEVICE_FUNC inline typename MatrixBase<Derived>::ConstDiagonalReturnType+inline typename MatrixBase<Derived>::ConstDiagonalReturnType MatrixBase<Derived>::diagonal() const {   return ConstDiagonalReturnType(derived());@@ -213,7 +213,7 @@   *   * \sa MatrixBase::diagonal(), class Diagonal */ template<typename Derived>-EIGEN_DEVICE_FUNC inline typename MatrixBase<Derived>::DiagonalDynamicIndexReturnType+inline typename MatrixBase<Derived>::DiagonalDynamicIndexReturnType MatrixBase<Derived>::diagonal(Index index) {   return DiagonalDynamicIndexReturnType(derived(), index);@@ -221,7 +221,7 @@  /** This is the const version of diagonal(Index). */ template<typename Derived>-EIGEN_DEVICE_FUNC inline typename MatrixBase<Derived>::ConstDiagonalDynamicIndexReturnType+inline typename MatrixBase<Derived>::ConstDiagonalDynamicIndexReturnType MatrixBase<Derived>::diagonal(Index index) const {   return ConstDiagonalDynamicIndexReturnType(derived(), index);@@ -240,7 +240,6 @@   * \sa MatrixBase::diagonal(), class Diagonal */ template<typename Derived> template<int Index_>-EIGEN_DEVICE_FUNC inline typename MatrixBase<Derived>::template DiagonalIndexReturnType<Index_>::Type MatrixBase<Derived>::diagonal() {@@ -250,7 +249,6 @@ /** This is the const version of diagonal<int>(). */ template<typename Derived> template<int Index_>-EIGEN_DEVICE_FUNC inline typename MatrixBase<Derived>::template ConstDiagonalIndexReturnType<Index_>::Type MatrixBase<Derived>::diagonal() const {
eigen3/Eigen/src/Core/DiagonalMatrix.h view
@@ -44,7 +44,7 @@      EIGEN_DEVICE_FUNC     DenseMatrixType toDenseMatrix() const { return derived(); }-+         EIGEN_DEVICE_FUNC     inline const DiagonalVectorType& diagonal() const { return derived().diagonal(); }     EIGEN_DEVICE_FUNC@@ -273,7 +273,7 @@   * \sa class DiagonalWrapper, class DiagonalMatrix, diagonal(), isDiagonal()   **/ template<typename Derived>-EIGEN_DEVICE_FUNC inline const DiagonalWrapper<const Derived>+inline const DiagonalWrapper<const Derived> MatrixBase<Derived>::asDiagonal() const {   return DiagonalWrapper<const Derived>(derived());
eigen3/Eigen/src/Core/DiagonalProduct.h view
@@ -17,7 +17,7 @@   */ template<typename Derived> template<typename DiagonalDerived>-EIGEN_DEVICE_FUNC inline const Product<Derived, DiagonalDerived, LazyProduct>+inline const Product<Derived, DiagonalDerived, LazyProduct> MatrixBase<Derived>::operator*(const DiagonalBase<DiagonalDerived> &a_diagonal) const {   return Product<Derived, DiagonalDerived, LazyProduct>(derived(),a_diagonal.derived());
eigen3/Eigen/src/Core/Dot.h view
@@ -93,7 +93,7 @@   * \sa dot(), norm(), lpNorm()   */ template<typename Derived>-EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE typename NumTraits<typename internal::traits<Derived>::Scalar>::Real MatrixBase<Derived>::squaredNorm() const+EIGEN_STRONG_INLINE typename NumTraits<typename internal::traits<Derived>::Scalar>::Real MatrixBase<Derived>::squaredNorm() const {   return numext::real((*this).cwiseAbs2().sum()); }@@ -105,7 +105,7 @@   * \sa lpNorm(), dot(), squaredNorm()   */ template<typename Derived>-EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE typename NumTraits<typename internal::traits<Derived>::Scalar>::Real MatrixBase<Derived>::norm() const+EIGEN_STRONG_INLINE typename NumTraits<typename internal::traits<Derived>::Scalar>::Real MatrixBase<Derived>::norm() const {   return numext::sqrt(squaredNorm()); }@@ -120,7 +120,7 @@   * \sa norm(), normalize()   */ template<typename Derived>-EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename MatrixBase<Derived>::PlainObject+EIGEN_STRONG_INLINE const typename MatrixBase<Derived>::PlainObject MatrixBase<Derived>::normalized() const {   typedef typename internal::nested_eval<Derived,2>::type _Nested;@@ -142,7 +142,7 @@   * \sa norm(), normalized()   */ template<typename Derived>-EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void MatrixBase<Derived>::normalize()+EIGEN_STRONG_INLINE void MatrixBase<Derived>::normalize() {   RealScalar z = squaredNorm();   // NOTE: after extensive benchmarking, this conditional does not impact performance, at least on recent x86 CPU@@ -163,7 +163,7 @@   * \sa stableNorm(), stableNormalize(), normalized()   */ template<typename Derived>-EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename MatrixBase<Derived>::PlainObject+EIGEN_STRONG_INLINE const typename MatrixBase<Derived>::PlainObject MatrixBase<Derived>::stableNormalized() const {   typedef typename internal::nested_eval<Derived,3>::type _Nested;@@ -188,7 +188,7 @@   * \sa stableNorm(), stableNormalized(), normalize()   */ template<typename Derived>-EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void MatrixBase<Derived>::stableNormalize()+EIGEN_STRONG_INLINE void MatrixBase<Derived>::stableNormalize() {   RealScalar w = cwiseAbs().maxCoeff();   RealScalar z = (derived()/w).squaredNorm();@@ -260,9 +260,9 @@ template<typename Derived> template<int p> #ifndef EIGEN_PARSED_BY_DOXYGEN-EIGEN_DEVICE_FUNC inline typename NumTraits<typename internal::traits<Derived>::Scalar>::Real+inline typename NumTraits<typename internal::traits<Derived>::Scalar>::Real #else-EIGEN_DEVICE_FUNC MatrixBase<Derived>::RealScalar+MatrixBase<Derived>::RealScalar #endif MatrixBase<Derived>::lpNorm() const {
eigen3/Eigen/src/Core/Fuzzy.h view
@@ -100,7 +100,7 @@   */ template<typename Derived> template<typename OtherDerived>-EIGEN_DEVICE_FUNC bool DenseBase<Derived>::isApprox(+bool DenseBase<Derived>::isApprox(   const DenseBase<OtherDerived>& other,   const RealScalar& prec ) const@@ -122,7 +122,7 @@   * \sa isApprox(), isMuchSmallerThan(const DenseBase<OtherDerived>&, RealScalar) const   */ template<typename Derived>-EIGEN_DEVICE_FUNC bool DenseBase<Derived>::isMuchSmallerThan(+bool DenseBase<Derived>::isMuchSmallerThan(   const typename NumTraits<Scalar>::Real& other,   const RealScalar& prec ) const@@ -142,7 +142,7 @@   */ template<typename Derived> template<typename OtherDerived>-EIGEN_DEVICE_FUNC bool DenseBase<Derived>::isMuchSmallerThan(+bool DenseBase<Derived>::isMuchSmallerThan(   const DenseBase<OtherDerived>& other,   const RealScalar& prec ) const
eigen3/Eigen/src/Core/GeneralProduct.h view
@@ -18,16 +18,6 @@   Small = 3 }; -// Define the threshold value to fallback from the generic matrix-matrix product-// implementation (heavy) to the lightweight coeff-based product one.-// See generic_product_impl<Lhs,Rhs,DenseShape,DenseShape,GemmProduct>-// in products/GeneralMatrixMatrix.h for more details.-// TODO This threshold should also be used in the compile-time selector below.-#ifndef EIGEN_GEMM_TO_COEFFBASED_THRESHOLD-// This default value has been obtained on a Haswell architecture.-#define EIGEN_GEMM_TO_COEFFBASED_THRESHOLD 20-#endif- namespace internal {  template<int Rows, int Cols, int Depth> struct product_type_selector;@@ -396,7 +386,6 @@   */ template<typename Derived> template<typename OtherDerived>-EIGEN_DEVICE_FUNC inline const Product<Derived, OtherDerived> MatrixBase<Derived>::operator*(const MatrixBase<OtherDerived> &other) const {@@ -440,7 +429,7 @@ template<typename Derived> template<typename OtherDerived> const Product<Derived,OtherDerived,LazyProduct>-EIGEN_DEVICE_FUNC MatrixBase<Derived>::lazyProduct(const MatrixBase<OtherDerived> &other) const+MatrixBase<Derived>::lazyProduct(const MatrixBase<OtherDerived> &other) const {   enum {     ProductIsValid =  Derived::ColsAtCompileTime==Dynamic
eigen3/Eigen/src/Core/GenericPacketMath.h view
@@ -61,7 +61,6 @@     HasSqrt   = 0,     HasRsqrt  = 0,     HasExp    = 0,-    HasExpm1  = 0,     HasLog    = 0,     HasLog1p  = 0,     HasLog10  = 0,@@ -299,7 +298,7 @@ /** \internal tries to do cache prefetching of \a addr */ template<typename Scalar> EIGEN_DEVICE_FUNC inline void prefetch(const Scalar* addr) {-#ifdef EIGEN_CUDA_ARCH+#ifdef __CUDA_ARCH__ #if defined(__LP64__)   // 64-bit pointer operand constraint for inlined asm   asm(" prefetch.L1 [ %1 ];" : "=l"(addr) : "l"(addr));@@ -324,13 +323,13 @@ template<typename Packet> EIGEN_DEVICE_FUNC inline typename unpacket_traits<Packet>::type predux(const Packet& a) { return a; } -/** \internal \returns the sum of the elements of upper and lower half of \a a if \a a is larger than 4.+/** \internal \returns the sum of the elements of \a a by block of 4 elements.   * For a packet {a0, a1, a2, a3, a4, a5, a6, a7}, it returns a half packet {a0+a4, a1+a5, a2+a6, a3+a7}   * For packet-size smaller or equal to 4, this boils down to a noop.   */ template<typename Packet> EIGEN_DEVICE_FUNC inline typename conditional<(unpacket_traits<Packet>::size%8)==0,typename unpacket_traits<Packet>::half,Packet>::type-predux_half_dowto4(const Packet& a)+predux_downto4(const Packet& a) { return a; }  /** \internal \returns the product of the elements of \a a*/@@ -402,10 +401,6 @@ template<typename Packet> EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet pexp(const Packet& a) { using std::exp; return exp(a); } -/** \internal \returns the expm1 of \a a (coeff-wise) */-template<typename Packet> EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS-Packet pexpm1(const Packet& a) { return numext::expm1(a); }- /** \internal \returns the log of \a a (coeff-wise) */ template<typename Packet> EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet plog(const Packet& a) { using std::log; return log(a); }@@ -526,7 +521,7 @@ ***************************************************************************/  // Eigen+CUDA does not support complexes.-#ifndef EIGEN_CUDACC+#ifndef __CUDACC__  template<> inline std::complex<float> pmul(const std::complex<float>& a, const std::complex<float>& b) { return std::complex<float>(real(a)*real(b) - imag(a)*imag(b), imag(a)*real(b) + real(a)*imag(b)); }
eigen3/Eigen/src/Core/GlobalFunctions.h view
@@ -71,7 +71,6 @@   EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(erf,scalar_erf_op,error function,\sa ArrayBase::erf)   EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(erfc,scalar_erfc_op,complement error function,\sa ArrayBase::erfc)   EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(exp,scalar_exp_op,exponential,\sa ArrayBase::exp)-  EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(expm1,scalar_expm1_op,exponential of a value minus 1,\sa ArrayBase::expm1)   EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(log,scalar_log_op,natural logarithm,\sa Eigen::log10 DOXCOMMA ArrayBase::log)   EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(log1p,scalar_log1p_op,natural logarithm of 1 plus the value,\sa ArrayBase::log1p)   EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(log10,scalar_log10_op,base 10 logarithm,\sa Eigen::log DOXCOMMA ArrayBase::log)@@ -103,19 +102,18 @@   inline const CwiseBinaryOp<internal::scalar_pow_op<Derived::Scalar,ScalarExponent>,Derived,Constant<ScalarExponent> >   pow(const Eigen::ArrayBase<Derived>& x, const ScalarExponent& exponent); #else-  template <typename Derived,typename ScalarExponent>-  EIGEN_DEVICE_FUNC inline-  EIGEN_MSVC10_WORKAROUND_BINARYOP_RETURN_TYPE(-    const EIGEN_EXPR_BINARYOP_SCALAR_RETURN_TYPE(Derived,typename internal::promote_scalar_arg<typename Derived::Scalar-                                                 EIGEN_COMMA ScalarExponent EIGEN_COMMA-                                                 EIGEN_SCALAR_BINARY_SUPPORTED(pow,typename Derived::Scalar,ScalarExponent)>::type,pow))-  pow(const Eigen::ArrayBase<Derived>& x, const ScalarExponent& exponent)-  {-    typedef typename internal::promote_scalar_arg<typename Derived::Scalar,ScalarExponent,-                                                  EIGEN_SCALAR_BINARY_SUPPORTED(pow,typename Derived::Scalar,ScalarExponent)>::type PromotedExponent;-    return EIGEN_EXPR_BINARYOP_SCALAR_RETURN_TYPE(Derived,PromotedExponent,pow)(x.derived(),-           typename internal::plain_constant_type<Derived,PromotedExponent>::type(x.derived().rows(), x.derived().cols(), internal::scalar_constant_op<PromotedExponent>(exponent)));+  template<typename Derived,typename ScalarExponent>+  inline typename internal::enable_if<   !(internal::is_same<typename Derived::Scalar,ScalarExponent>::value) && EIGEN_SCALAR_BINARY_SUPPORTED(pow,typename Derived::Scalar,ScalarExponent),+          const EIGEN_EXPR_BINARYOP_SCALAR_RETURN_TYPE(Derived,ScalarExponent,pow) >::type+  pow(const Eigen::ArrayBase<Derived>& x, const ScalarExponent& exponent) {+    return x.derived().pow(exponent);   }++  template<typename Derived>+  inline const EIGEN_EXPR_BINARYOP_SCALAR_RETURN_TYPE(Derived,typename Derived::Scalar,pow)+  pow(const Eigen::ArrayBase<Derived>& x, const typename Derived::Scalar& exponent) {+    return x.derived().pow(exponent);+  } #endif    /** \returns an expression of the coefficient-wise power of \a x to the given array of \a exponents.@@ -157,17 +155,21 @@   inline const CwiseBinaryOp<internal::scalar_pow_op<Scalar,Derived::Scalar>,Constant<Scalar>,Derived>   pow(const Scalar& x,const Eigen::ArrayBase<Derived>& x); #else-  template <typename Scalar, typename Derived>-  EIGEN_DEVICE_FUNC inline-  EIGEN_MSVC10_WORKAROUND_BINARYOP_RETURN_TYPE(-    const EIGEN_SCALAR_BINARYOP_EXPR_RETURN_TYPE(typename internal::promote_scalar_arg<typename Derived::Scalar-                                                 EIGEN_COMMA Scalar EIGEN_COMMA-                                                 EIGEN_SCALAR_BINARY_SUPPORTED(pow,Scalar,typename Derived::Scalar)>::type,Derived,pow))-  pow(const Scalar& x, const Eigen::ArrayBase<Derived>& exponents) {-    typedef typename internal::promote_scalar_arg<typename Derived::Scalar,Scalar,-                                                  EIGEN_SCALAR_BINARY_SUPPORTED(pow,Scalar,typename Derived::Scalar)>::type PromotedScalar;-    return EIGEN_SCALAR_BINARYOP_EXPR_RETURN_TYPE(PromotedScalar,Derived,pow)(-           typename internal::plain_constant_type<Derived,PromotedScalar>::type(exponents.derived().rows(), exponents.derived().cols(), internal::scalar_constant_op<PromotedScalar>(x)), exponents.derived());+  template<typename Scalar, typename Derived>+  inline typename internal::enable_if<   !(internal::is_same<typename Derived::Scalar,Scalar>::value) && EIGEN_SCALAR_BINARY_SUPPORTED(pow,Scalar,typename Derived::Scalar),+          const EIGEN_SCALAR_BINARYOP_EXPR_RETURN_TYPE(Scalar,Derived,pow) >::type+  pow(const Scalar& x, const Eigen::ArrayBase<Derived>& exponents)+  {+    return EIGEN_SCALAR_BINARYOP_EXPR_RETURN_TYPE(Scalar,Derived,pow)(+            typename internal::plain_constant_type<Derived,Scalar>::type(exponents.rows(), exponents.cols(), x), exponents.derived() );+  }++  template<typename Derived>+  inline const EIGEN_SCALAR_BINARYOP_EXPR_RETURN_TYPE(typename Derived::Scalar,Derived,pow)+  pow(const typename Derived::Scalar& x, const Eigen::ArrayBase<Derived>& exponents)+  {+    return EIGEN_SCALAR_BINARYOP_EXPR_RETURN_TYPE(typename Derived::Scalar,Derived,pow)(+      typename internal::plain_constant_type<Derived,typename Derived::Scalar>::type(exponents.rows(), exponents.cols(), x), exponents.derived() );   } #endif 
eigen3/Eigen/src/Core/Map.h view
@@ -113,10 +113,10 @@     EIGEN_DEVICE_FUNC     inline Index outerStride() const     {-      return StrideType::OuterStrideAtCompileTime != 0 ? m_stride.outer()-           : internal::traits<Map>::OuterStrideAtCompileTime != Dynamic ? Index(internal::traits<Map>::OuterStrideAtCompileTime)+      return int(StrideType::OuterStrideAtCompileTime) != 0 ? m_stride.outer()+           : int(internal::traits<Map>::OuterStrideAtCompileTime) != Dynamic ? Index(internal::traits<Map>::OuterStrideAtCompileTime)            : IsVectorAtCompileTime ? (this->size() * innerStride())-           : int(Flags)&RowMajorBit ? (this->cols() * innerStride())+           : (int(Flags)&RowMajorBit) ? (this->cols() * innerStride())            : (this->rows() * innerStride());     } 
eigen3/Eigen/src/Core/MapBase.h view
@@ -43,6 +43,7 @@     enum {       RowsAtCompileTime = internal::traits<Derived>::RowsAtCompileTime,       ColsAtCompileTime = internal::traits<Derived>::ColsAtCompileTime,+      InnerStrideAtCompileTime = internal::traits<Derived>::InnerStrideAtCompileTime,       SizeAtCompileTime = Base::SizeAtCompileTime     }; @@ -187,8 +188,11 @@     void checkSanity(typename internal::enable_if<(internal::traits<T>::Alignment>0),void*>::type = 0) const     { #if EIGEN_MAX_ALIGN_BYTES>0+      // innerStride() is not set yet when this function is called, so we optimistically assume the lowest plausible value:+      const Index minInnerStride = InnerStrideAtCompileTime == Dynamic ? 1 : Index(InnerStrideAtCompileTime);+      EIGEN_ONLY_USED_FOR_DEBUG(minInnerStride);       eigen_assert((   ((internal::UIntPtr(m_data) % internal::traits<Derived>::Alignment) == 0)-                    || (cols() * rows() * innerStride() * sizeof(Scalar)) < internal::traits<Derived>::Alignment ) && "data is not aligned");+                    || (cols() * rows() * minInnerStride * sizeof(Scalar)) < internal::traits<Derived>::Alignment ) && "data is not aligned"); #endif     } 
eigen3/Eigen/src/Core/MathFunctions.h view
@@ -14,6 +14,7 @@ // TODO this should better be moved to NumTraits #define EIGEN_PI 3.141592653589793238462643383279502884197169399375105820974944592307816406L + namespace Eigen {  // On WINCE, std::abs is defined for int only, so let's defined our own overloads:@@ -96,7 +97,7 @@  template<typename Scalar> struct real_impl : real_default_impl<Scalar> {}; -#ifdef EIGEN_CUDA_ARCH+#ifdef __CUDA_ARCH__ template<typename T> struct real_impl<std::complex<T> > {@@ -144,7 +145,7 @@  template<typename Scalar> struct imag_impl : imag_default_impl<Scalar> {}; -#ifdef EIGEN_CUDA_ARCH+#ifdef __CUDA_ARCH__ template<typename T> struct imag_impl<std::complex<T> > {@@ -238,7 +239,7 @@ ****************************************************************************/  template<typename Scalar, bool IsComplex = NumTraits<Scalar>::IsComplex>-struct conj_default_impl+struct conj_impl {   EIGEN_DEVICE_FUNC   static inline Scalar run(const Scalar& x)@@ -248,7 +249,7 @@ };  template<typename Scalar>-struct conj_default_impl<Scalar,true>+struct conj_impl<Scalar,true> {   EIGEN_DEVICE_FUNC   static inline Scalar run(const Scalar& x)@@ -258,20 +259,6 @@   } }; -template<typename Scalar> struct conj_impl : conj_default_impl<Scalar> {};--#ifdef EIGEN_CUDA_ARCH-template<typename T>-struct conj_impl<std::complex<T> >-{-  EIGEN_DEVICE_FUNC-  static inline std::complex<T> run(const std::complex<T>& x)-  {-    return std::complex<T>(x.real(), -x.imag());-  }-};-#endif- template<typename Scalar> struct conj_retval {@@ -402,7 +389,7 @@     static inline Scalar run(const Scalar& x)     {       EIGEN_STATIC_ASSERT((!NumTraits<Scalar>::IsComplex), NUMERIC_TYPE_MUST_BE_REAL)-      EIGEN_USING_STD_MATH(round);+      using std::round;       return round(x);     }   };@@ -472,55 +459,6 @@ };  /****************************************************************************-* Implementation of expm1                                                   *-****************************************************************************/--// This implementation is based on GSL Math's expm1.-namespace std_fallback {-  // fallback expm1 implementation in case there is no expm1(Scalar) function in namespace of Scalar,-  // or that there is no suitable std::expm1 function available. Implementation-  // attributed to Kahan. See: http://www.plunk.org/~hatch/rightway.php.-  template<typename Scalar>-  EIGEN_DEVICE_FUNC inline Scalar expm1(const Scalar& x) {-    EIGEN_STATIC_ASSERT_NON_INTEGER(Scalar)-    typedef typename NumTraits<Scalar>::Real RealScalar;--    EIGEN_USING_STD_MATH(exp);-    Scalar u = exp(x);-    if (numext::equal_strict(u, Scalar(1))) {-      return x;-    }-    Scalar um1 = u - RealScalar(1);-    if (numext::equal_strict(um1, Scalar(-1))) {-      return RealScalar(-1);-    }--    EIGEN_USING_STD_MATH(log);-    return (u - RealScalar(1)) * x / log(u);-  }-}--template<typename Scalar>-struct expm1_impl {-  EIGEN_DEVICE_FUNC static inline Scalar run(const Scalar& x)-  {-    EIGEN_STATIC_ASSERT_NON_INTEGER(Scalar)-    #if EIGEN_HAS_CXX11_MATH-    using std::expm1;-    #endif-    using std_fallback::expm1;-    return expm1(x);-  }-};---template<typename Scalar>-struct expm1_retval-{-  typedef Scalar type;-};--/**************************************************************************** * Implementation of log1p                                                   * ****************************************************************************/ @@ -539,7 +477,7 @@  template<typename Scalar> struct log1p_impl {-  EIGEN_DEVICE_FUNC static inline Scalar run(const Scalar& x)+  static inline Scalar run(const Scalar& x)   {     EIGEN_STATIC_ASSERT_NON_INTEGER(Scalar)     #if EIGEN_HAS_CXX11_MATH@@ -679,20 +617,27 @@ {   static inline Scalar run(const Scalar& x, const Scalar& y)   {-    typedef typename conditional<NumTraits<Scalar>::IsSigned,std::ptrdiff_t,std::size_t>::type ScalarX;-    if(y<x)+    if (y <= x)       return x;-    // the following difference might overflow on a 32 bits system,-    // but since y>=x the result converted to an unsigned long is still correct.-    std::size_t range = ScalarX(y)-ScalarX(x);-    std::size_t offset = 0;-    // rejection sampling-    std::size_t divisor = 1;-    std::size_t multiplier = 1;-    if(range<RAND_MAX) divisor = (std::size_t(RAND_MAX)+1)/(range+1);-    else               multiplier = 1 + range/(std::size_t(RAND_MAX)+1);+    // ScalarU is the unsigned counterpart of Scalar, possibly Scalar itself.+    typedef typename make_unsigned<Scalar>::type ScalarU;+    // ScalarX is the widest of ScalarU and unsigned int.+    // We'll deal only with ScalarX and unsigned int below thus avoiding signed+    // types and arithmetic and signed overflows (which are undefined behavior).+    typedef typename conditional<(ScalarU(-1) > unsigned(-1)), ScalarU, unsigned>::type ScalarX;+    // The following difference doesn't overflow, provided our integer types are two's+    // complement and have the same number of padding bits in signed and unsigned variants.+    // This is the case in most modern implementations of C++.+    ScalarX range = ScalarX(y) - ScalarX(x);+    ScalarX offset = 0;+    ScalarX divisor = 1;+    ScalarX multiplier = 1;+    const unsigned rand_max = RAND_MAX;+    if (range <= rand_max) divisor = (rand_max + 1) / (range + 1);+    else                   multiplier = 1 + range / (rand_max + 1);+    // Rejection sampling.     do {-      offset = (std::size_t(std::rand()) * multiplier) / divisor;+      offset = (unsigned(std::rand()) * multiplier) / divisor;     } while (offset > range);     return Scalar(ScalarX(x) + offset);   }@@ -739,7 +684,7 @@   return EIGEN_MATHFUNC_IMPL(random, Scalar)::run(); } -// Implementation of is* functions+// Implementatin of is* functions  // std::is* do not work with fast-math and gcc, std::is* are available on MSVC 2013 and newer, as well as in clang. #if (EIGEN_HAS_CXX11_MATH && !(EIGEN_COMP_GNUC_STRICT && __FINITE_MATH_ONLY__)) || (EIGEN_COMP_MSVC>=1800) || (EIGEN_COMP_CLANG)@@ -768,7 +713,7 @@ typename internal::enable_if<(!internal::is_integral<T>::value)&&(!NumTraits<T>::IsComplex),bool>::type isfinite_impl(const T& x) {-  #ifdef EIGEN_CUDA_ARCH+  #ifdef __CUDA_ARCH__     return (::isfinite)(x);   #elif EIGEN_USE_STD_FPCLASSIFY     using std::isfinite;@@ -783,7 +728,7 @@ typename internal::enable_if<(!internal::is_integral<T>::value)&&(!NumTraits<T>::IsComplex),bool>::type isinf_impl(const T& x) {-  #ifdef EIGEN_CUDA_ARCH+  #ifdef __CUDA_ARCH__     return (::isinf)(x);   #elif EIGEN_USE_STD_FPCLASSIFY     using std::isinf;@@ -798,7 +743,7 @@ typename internal::enable_if<(!internal::is_integral<T>::value)&&(!NumTraits<T>::IsComplex),bool>::type isnan_impl(const T& x) {-  #ifdef EIGEN_CUDA_ARCH+  #ifdef __CUDA_ARCH__     return (::isnan)(x);   #elif EIGEN_USE_STD_FPCLASSIFY     using std::isnan;@@ -864,7 +809,7 @@  namespace numext { -#if !defined(EIGEN_CUDA_ARCH) && !defined(__SYCL_DEVICE_ONLY__)+#ifndef __CUDA_ARCH__ template<typename T> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE T mini(const T& x, const T& y)@@ -880,84 +825,6 @@   EIGEN_USING_STD_MATH(max);   return max EIGEN_NOT_A_MACRO (x,y); }---#elif defined(__SYCL_DEVICE_ONLY__)-template<typename T>-EIGEN_ALWAYS_INLINE T mini(const T& x, const T& y)-{--  return y < x ? y : x;-}--template<typename T>-EIGEN_ALWAYS_INLINE T maxi(const T& x, const T& y)-{--  return x < y ? y : x;-}--EIGEN_ALWAYS_INLINE int mini(const int& x, const int& y)-{-  return cl::sycl::min(x,y);-}--EIGEN_ALWAYS_INLINE int maxi(const int& x, const int& y)-{-  return cl::sycl::max(x,y);-}--EIGEN_ALWAYS_INLINE unsigned int mini(const unsigned int& x, const unsigned int& y)-{-  return cl::sycl::min(x,y);-}--EIGEN_ALWAYS_INLINE unsigned int maxi(const unsigned int& x, const unsigned int& y)-{-  return cl::sycl::max(x,y);-}--EIGEN_ALWAYS_INLINE  long mini(const long & x, const long & y)-{-  return cl::sycl::min(x,y);-}--EIGEN_ALWAYS_INLINE  long maxi(const long & x, const long & y)-{-  return cl::sycl::max(x,y);-}--EIGEN_ALWAYS_INLINE unsigned long mini(const unsigned long& x, const unsigned long& y)-{-  return cl::sycl::min(x,y);-}--EIGEN_ALWAYS_INLINE unsigned long maxi(const unsigned long& x, const unsigned long& y)-{-  return cl::sycl::max(x,y);-}---EIGEN_ALWAYS_INLINE float mini(const float& x, const float& y)-{-  return cl::sycl::fmin(x,y);-}--EIGEN_ALWAYS_INLINE float maxi(const float& x, const float& y)-{-  return cl::sycl::fmax(x,y);-}--EIGEN_ALWAYS_INLINE double mini(const double& x, const double& y)-{-  return cl::sycl::fmin(x,y);-}--EIGEN_ALWAYS_INLINE double maxi(const double& x, const double& y)-{-  return cl::sycl::fmax(x,y);-}- #else template<typename T> EIGEN_DEVICE_FUNC@@ -1049,9 +916,6 @@   return EIGEN_MATHFUNC_IMPL(abs2, Scalar)::run(x); } -EIGEN_DEVICE_FUNC-inline bool abs2(bool x) { return x; }- template<typename Scalar> EIGEN_DEVICE_FUNC inline EIGEN_MATHFUNC_RETVAL(norm1, Scalar) norm1(const Scalar& x)@@ -1073,12 +937,7 @@   return EIGEN_MATHFUNC_IMPL(log1p, Scalar)::run(x); } -#if defined(__SYCL_DEVICE_ONLY__)-EIGEN_ALWAYS_INLINE float   log1p(float x) { return cl::sycl::log1p(x); }-EIGEN_ALWAYS_INLINE double  log1p(double x) { return cl::sycl::log1p(x); }-#endif // defined(__SYCL_DEVICE_ONLY__)--#ifdef EIGEN_CUDACC+#ifdef __CUDACC__ template<> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE float log1p(const float &x) { return ::log1pf(x); } @@ -1093,24 +952,10 @@   return internal::pow_impl<ScalarX,ScalarY>::run(x, y); } -#if defined(__SYCL_DEVICE_ONLY__)-EIGEN_ALWAYS_INLINE float   pow(float x, float y) { return cl::sycl::pow(x, y); }-EIGEN_ALWAYS_INLINE double  pow(double x, double y) { return cl::sycl::pow(x, y); }-#endif // defined(__SYCL_DEVICE_ONLY__)- template<typename T> EIGEN_DEVICE_FUNC bool (isnan)   (const T &x) { return internal::isnan_impl(x); } template<typename T> EIGEN_DEVICE_FUNC bool (isinf)   (const T &x) { return internal::isinf_impl(x); } template<typename T> EIGEN_DEVICE_FUNC bool (isfinite)(const T &x) { return internal::isfinite_impl(x); } -#if defined(__SYCL_DEVICE_ONLY__)-EIGEN_ALWAYS_INLINE float   isnan(float x) { return cl::sycl::isnan(x); }-EIGEN_ALWAYS_INLINE double  isnan(double x) { return cl::sycl::isnan(x); }-EIGEN_ALWAYS_INLINE float   isinf(float x) { return cl::sycl::isinf(x); }-EIGEN_ALWAYS_INLINE double  isinf(double x) { return cl::sycl::isinf(x); }-EIGEN_ALWAYS_INLINE float   isfinite(float x) { return cl::sycl::isfinite(x); }-EIGEN_ALWAYS_INLINE double  isfinite(double x) { return cl::sycl::isfinite(x); }-#endif // defined(__SYCL_DEVICE_ONLY__)- template<typename Scalar> EIGEN_DEVICE_FUNC inline EIGEN_MATHFUNC_RETVAL(round, Scalar) round(const Scalar& x)@@ -1118,11 +963,6 @@   return EIGEN_MATHFUNC_IMPL(round, Scalar)::run(x); } -#if defined(__SYCL_DEVICE_ONLY__)-EIGEN_ALWAYS_INLINE float   round(float x) { return cl::sycl::round(x); }-EIGEN_ALWAYS_INLINE double  round(double x) { return cl::sycl::round(x); }-#endif // defined(__SYCL_DEVICE_ONLY__)- template<typename T> EIGEN_DEVICE_FUNC T (floor)(const T& x)@@ -1131,12 +971,7 @@   return floor(x); } -#if defined(__SYCL_DEVICE_ONLY__)-EIGEN_ALWAYS_INLINE float   floor(float x) { return cl::sycl::floor(x); }-EIGEN_ALWAYS_INLINE double  floor(double x) { return cl::sycl::floor(x); }-#endif // defined(__SYCL_DEVICE_ONLY__)--#ifdef EIGEN_CUDACC+#ifdef __CUDACC__ template<> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE float floor(const float &x) { return ::floorf(x); } @@ -1152,12 +987,7 @@   return ceil(x); } -#if defined(__SYCL_DEVICE_ONLY__)-EIGEN_ALWAYS_INLINE float   ceil(float x) { return cl::sycl::ceil(x); }-EIGEN_ALWAYS_INLINE double  ceil(double x) { return cl::sycl::ceil(x); }-#endif // defined(__SYCL_DEVICE_ONLY__)--#ifdef EIGEN_CUDACC+#ifdef __CUDACC__ template<> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE float ceil(const float &x) { return ::ceilf(x); } @@ -1183,7 +1013,8 @@  /** \returns the square root of \a x.   *-  * It is essentially equivalent to \code using std::sqrt; return sqrt(x); \endcode,+  * It is essentially equivalent to+  * \code using std::sqrt; return sqrt(x); \endcode   * but slightly faster for float/double and some compilers (e.g., gcc), thanks to   * specializations when SSE is enabled.   *@@ -1197,11 +1028,6 @@   return sqrt(x); } -#if defined(__SYCL_DEVICE_ONLY__)-EIGEN_ALWAYS_INLINE float   sqrt(float x) { return cl::sycl::sqrt(x); }-EIGEN_ALWAYS_INLINE double  sqrt(double x) { return cl::sycl::sqrt(x); }-#endif // defined(__SYCL_DEVICE_ONLY__)- template<typename T> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE T log(const T &x) {@@ -1209,13 +1035,7 @@   return log(x); } -#if defined(__SYCL_DEVICE_ONLY__)-EIGEN_ALWAYS_INLINE float   log(float x) { return cl::sycl::log(x); }-EIGEN_ALWAYS_INLINE double  log(double x) { return cl::sycl::log(x); }-#endif // defined(__SYCL_DEVICE_ONLY__)---#ifdef EIGEN_CUDACC+#ifdef __CUDACC__ template<> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE float log(const float &x) { return ::logf(x); } @@ -1243,7 +1063,7 @@ EIGEN_ALWAYS_INLINE double  abs(double x) { return cl::sycl::fabs(x); } #endif // defined(__SYCL_DEVICE_ONLY__) -#ifdef EIGEN_CUDACC+#ifdef __CUDACC__ template<> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE float abs(const float &x) { return ::fabsf(x); } @@ -1268,55 +1088,14 @@   return exp(x); } -#if defined(__SYCL_DEVICE_ONLY__)-EIGEN_ALWAYS_INLINE float   exp(float x) { return cl::sycl::exp(x); }-EIGEN_ALWAYS_INLINE double  exp(double x) { return cl::sycl::exp(x); }-#endif // defined(__SYCL_DEVICE_ONLY__)--#ifdef EIGEN_CUDACC+#ifdef __CUDACC__ template<> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE float exp(const float &x) { return ::expf(x); }  template<> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE double exp(const double &x) { return ::exp(x); }--template<> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE-std::complex<float> exp(const std::complex<float>& x) {-  auto com = ::expf(x.real());-  auto res_real = com * ::cosf(x.imag());-  auto res_imag = com * ::sinf(x.imag());-  return std::complex<float>(res_real, res_imag);-}--template<> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE-std::complex<double> exp(const std::complex<double>& x) {-  auto com = ::exp(x.real());-  auto res_real = com * ::cos(x.imag());-  auto res_imag = com * ::sin(x.imag());-  return std::complex<double>(res_real, res_imag);-} #endif -template<typename Scalar>-EIGEN_DEVICE_FUNC-inline EIGEN_MATHFUNC_RETVAL(expm1, Scalar) expm1(const Scalar& x)-{-  return EIGEN_MATHFUNC_IMPL(expm1, Scalar)::run(x);-}--#if defined(__SYCL_DEVICE_ONLY__)-EIGEN_ALWAYS_INLINE float   expm1(float x) { return cl::sycl::expm1(x); }-EIGEN_ALWAYS_INLINE double  expm1(double x) { return cl::sycl::expm1(x); }-#endif // defined(__SYCL_DEVICE_ONLY__)--#ifdef EIGEN_CUDACC-template<> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE-float expm1(const float &x) { return ::expm1f(x); }--template<> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE-double expm1(const double &x) { return ::expm1(x); }-#endif- template<typename T> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE T cos(const T &x) {@@ -1324,12 +1103,7 @@   return cos(x); } -#if defined(__SYCL_DEVICE_ONLY__)-EIGEN_ALWAYS_INLINE float   cos(float x) { return cl::sycl::cos(x); }-EIGEN_ALWAYS_INLINE double  cos(double x) { return cl::sycl::cos(x); }-#endif // defined(__SYCL_DEVICE_ONLY__)--#ifdef EIGEN_CUDACC+#ifdef __CUDACC__ template<> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE float cos(const float &x) { return ::cosf(x); } @@ -1344,12 +1118,7 @@   return sin(x); } -#if defined(__SYCL_DEVICE_ONLY__)-EIGEN_ALWAYS_INLINE float   sin(float x) { return cl::sycl::sin(x); }-EIGEN_ALWAYS_INLINE double  sin(double x) { return cl::sycl::sin(x); }-#endif // defined(__SYCL_DEVICE_ONLY__)--#ifdef EIGEN_CUDACC+#ifdef __CUDACC__ template<> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE float sin(const float &x) { return ::sinf(x); } @@ -1364,12 +1133,7 @@   return tan(x); } -#if defined(__SYCL_DEVICE_ONLY__)-EIGEN_ALWAYS_INLINE float   tan(float x) { return cl::sycl::tan(x); }-EIGEN_ALWAYS_INLINE double  tan(double x) { return cl::sycl::tan(x); }-#endif // defined(__SYCL_DEVICE_ONLY__)--#ifdef EIGEN_CUDACC+#ifdef __CUDACC__ template<> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE float tan(const float &x) { return ::tanf(x); } @@ -1384,23 +1148,7 @@   return acos(x); } -#if EIGEN_HAS_CXX11_MATH-template<typename T>-EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE-T acosh(const T &x) {-  EIGEN_USING_STD_MATH(acosh);-  return acosh(x);-}-#endif--#if defined(__SYCL_DEVICE_ONLY__)-EIGEN_ALWAYS_INLINE float   acos(float x) { return cl::sycl::acos(x); }-EIGEN_ALWAYS_INLINE double  acos(double x) { return cl::sycl::acos(x); }-EIGEN_ALWAYS_INLINE float   acosh(float x) { return cl::sycl::acosh(x); }-EIGEN_ALWAYS_INLINE double  acosh(double x) { return cl::sycl::acosh(x); }-#endif // defined(__SYCL_DEVICE_ONLY__)--#ifdef EIGEN_CUDACC+#ifdef __CUDACC__ template<> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE float acos(const float &x) { return ::acosf(x); } @@ -1415,23 +1163,7 @@   return asin(x); } -#if EIGEN_HAS_CXX11_MATH-template<typename T>-EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE-T asinh(const T &x) {-  EIGEN_USING_STD_MATH(asinh);-  return asinh(x);-}-#endif--#if defined(__SYCL_DEVICE_ONLY__)-EIGEN_ALWAYS_INLINE float   asin(float x) { return cl::sycl::asin(x); }-EIGEN_ALWAYS_INLINE double  asin(double x) { return cl::sycl::asin(x); }-EIGEN_ALWAYS_INLINE float   asinh(float x) { return cl::sycl::asinh(x); }-EIGEN_ALWAYS_INLINE double  asinh(double x) { return cl::sycl::asinh(x); }-#endif // defined(__SYCL_DEVICE_ONLY__)--#ifdef EIGEN_CUDACC+#ifdef __CUDACC__ template<> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE float asin(const float &x) { return ::asinf(x); } @@ -1446,23 +1178,7 @@   return atan(x); } -#if EIGEN_HAS_CXX11_MATH-template<typename T>-EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE-T atanh(const T &x) {-  EIGEN_USING_STD_MATH(atanh);-  return atanh(x);-}-#endif--#if defined(__SYCL_DEVICE_ONLY__)-EIGEN_ALWAYS_INLINE float   atan(float x) { return cl::sycl::atan(x); }-EIGEN_ALWAYS_INLINE double  atan(double x) { return cl::sycl::atan(x); }-EIGEN_ALWAYS_INLINE float   atanh(float x) { return cl::sycl::atanh(x); }-EIGEN_ALWAYS_INLINE double  atanh(double x) { return cl::sycl::atanh(x); }-#endif // defined(__SYCL_DEVICE_ONLY__)--#ifdef EIGEN_CUDACC+#ifdef __CUDACC__ template<> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE float atan(const float &x) { return ::atanf(x); } @@ -1478,12 +1194,7 @@   return cosh(x); } -#if defined(__SYCL_DEVICE_ONLY__)-EIGEN_ALWAYS_INLINE float   cosh(float x) { return cl::sycl::cosh(x); }-EIGEN_ALWAYS_INLINE double  cosh(double x) { return cl::sycl::cosh(x); }-#endif // defined(__SYCL_DEVICE_ONLY__)--#ifdef EIGEN_CUDACC+#ifdef __CUDACC__ template<> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE float cosh(const float &x) { return ::coshf(x); } @@ -1498,12 +1209,7 @@   return sinh(x); } -#if defined(__SYCL_DEVICE_ONLY__)-EIGEN_ALWAYS_INLINE float   sinh(float x) { return cl::sycl::sinh(x); }-EIGEN_ALWAYS_INLINE double  sinh(double x) { return cl::sycl::sinh(x); }-#endif // defined(__SYCL_DEVICE_ONLY__)--#ifdef EIGEN_CUDACC+#ifdef __CUDACC__ template<> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE float sinh(const float &x) { return ::sinhf(x); } @@ -1518,15 +1224,12 @@   return tanh(x); } -#if defined(__SYCL_DEVICE_ONLY__)-EIGEN_ALWAYS_INLINE float   tanh(float x) { return cl::sycl::tanh(x); }-EIGEN_ALWAYS_INLINE double  tanh(double x) { return cl::sycl::tanh(x); }-#elif (!defined(EIGEN_CUDACC)) && EIGEN_FAST_MATH+#if (!defined(__CUDACC__)) && EIGEN_FAST_MATH EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE float tanh(float x) { return internal::generic_fast_tanh_float(x); } #endif -#ifdef EIGEN_CUDACC+#ifdef __CUDACC__ template<> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE float tanh(const float &x) { return ::tanhf(x); } @@ -1541,12 +1244,7 @@   return fmod(a, b); } -#if defined(__SYCL_DEVICE_ONLY__)-EIGEN_ALWAYS_INLINE float   fmod(float x, float y) { return cl::sycl::fmod(x, y); }-EIGEN_ALWAYS_INLINE double  fmod(double x, double y) { return cl::sycl::fmod(x, y); }-#endif // defined(__SYCL_DEVICE_ONLY__)--#ifdef EIGEN_CUDACC+#ifdef __CUDACC__ template <> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE float fmod(const float& a, const float& b) {@@ -1688,13 +1386,13 @@ template<> struct scalar_fuzzy_impl<bool> {   typedef bool RealScalar;-+     template<typename OtherScalar> EIGEN_DEVICE_FUNC   static inline bool isMuchSmallerThan(const bool& x, const bool&, const bool&)   {     return !x;   }-+     EIGEN_DEVICE_FUNC   static inline bool isApprox(bool x, bool y, bool)   {@@ -1706,10 +1404,10 @@   {     return (!x) || y;   }-+   }; -+   } // end namespace internal  } // end namespace Eigen
eigen3/Eigen/src/Core/MathFunctionsImpl.h view
@@ -29,7 +29,12 @@   // this range is +/-1.0f in single-precision.   const T plus_9 = pset1<T>(9.f);   const T minus_9 = pset1<T>(-9.f);-  const T x = pmax(pmin(a_x, plus_9), minus_9);+  // NOTE GCC prior to 6.3 might improperly optimize this max/min+  //      step such that if a_x is nan, x will be either 9 or -9,+  //      and tanh will return 1 or -1 instead of nan.+  //      This is supposed to be fixed in gcc6.3,+  //      see: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=72867+  const T x = pmax(minus_9,pmin(plus_9,a_x));   // The monomial coefficients of the numerator polynomial (odd).   const T alpha_1 = pset1<T>(4.89352455891786e-03f);   const T alpha_3 = pset1<T>(6.37261928875436e-04f);
eigen3/Eigen/src/Core/Matrix.h view
@@ -274,8 +274,6 @@       : Base(std::move(other))     {       Base::_check_template_params();-      if (RowsAtCompileTime!=Dynamic && ColsAtCompileTime!=Dynamic)-        Base::_set_noalias(other);     }     EIGEN_DEVICE_FUNC     Matrix& operator=(Matrix&& other) EIGEN_NOEXCEPT_IF(std::is_nothrow_move_assignable<Scalar>::value)
eigen3/Eigen/src/Core/MatrixBase.h view
@@ -76,7 +76,6 @@     using Base::coeffRef;     using Base::lazyAssign;     using Base::eval;-    using Base::operator-;     using Base::operator+=;     using Base::operator-=;     using Base::operator*=;@@ -123,6 +122,7 @@  #define EIGEN_CURRENT_STORAGE_BASE_CLASS Eigen::MatrixBase #define EIGEN_DOC_UNARY_ADDONS(X,Y)+#   include "../plugins/CommonCwiseUnaryOps.h" #   include "../plugins/CommonCwiseBinaryOps.h" #   include "../plugins/MatrixCwiseUnaryOps.h" #   include "../plugins/MatrixCwiseBinaryOps.h"@@ -268,8 +268,6 @@     Derived& setIdentity();     EIGEN_DEVICE_FUNC     Derived& setIdentity(Index rows, Index cols);-    EIGEN_DEVICE_FUNC Derived& setUnit(Index i);-    EIGEN_DEVICE_FUNC Derived& setUnit(Index newSize, Index i);      bool isIdentity(const RealScalar& prec = NumTraits<Scalar>::dummy_precision()) const;     bool isDiagonal(const RealScalar& prec = NumTraits<Scalar>::dummy_precision()) const;@@ -298,7 +296,7 @@     EIGEN_DEVICE_FUNC inline bool operator!=(const MatrixBase<OtherDerived>& other) const     { return cwiseNotEqual(other).any(); } -    NoAlias<Derived,Eigen::MatrixBase > EIGEN_DEVICE_FUNC noalias();+    NoAlias<Derived,Eigen::MatrixBase > noalias();      // TODO forceAlignedAccess is temporarily disabled     // Need to find a nicer workaround.@@ -328,9 +326,7 @@      inline const PartialPivLU<PlainObject> lu() const; -    //chessai: removed because of ghc -    //inline const Inverse<Derived> inverse() const;-    const Inverse<Derived> inverse() const;+    inline const Inverse<Derived> inverse() const;      template<typename ResultType>     inline void computeInverseAndDetWithCheck(@@ -432,10 +428,8 @@ ///////// Jacobi module /////////      template<typename OtherScalar>-    EIGEN_DEVICE_FUNC     void applyOnTheLeft(Index p, Index q, const JacobiRotation<OtherScalar>& j);     template<typename OtherScalar>-    EIGEN_DEVICE_FUNC     void applyOnTheRight(Index p, Index q, const JacobiRotation<OtherScalar>& j);  ///////// SparseCore module /////////@@ -450,16 +444,24 @@ ///////// MatrixFunctions module /////////      typedef typename internal::stem_function<Scalar>::type StemFunction;-    const MatrixExponentialReturnValue<Derived> exp() const;+#define EIGEN_MATRIX_FUNCTION(ReturnType, Name, Description) \+    /** \returns an expression of the matrix Description of \c *this. \brief This function requires the <a href="unsupported/group__MatrixFunctions__Module.html"> unsupported MatrixFunctions module</a>. To compute the coefficient-wise Description use ArrayBase::##Name . */ \+    const ReturnType<Derived> Name() const;+#define EIGEN_MATRIX_FUNCTION_1(ReturnType, Name, Description, Argument) \+    /** \returns an expression of the matrix Description of \c *this. \brief This function requires the <a href="unsupported/group__MatrixFunctions__Module.html"> unsupported MatrixFunctions module</a>. To compute the coefficient-wise Description use ArrayBase::##Name . */ \+    const ReturnType<Derived> Name(Argument) const;++    EIGEN_MATRIX_FUNCTION(MatrixExponentialReturnValue, exp, exponential)+    /** \brief Helper function for the <a href="unsupported/group__MatrixFunctions__Module.html"> unsupported MatrixFunctions module</a>.*/     const MatrixFunctionReturnValue<Derived> matrixFunction(StemFunction f) const;-    const MatrixFunctionReturnValue<Derived> cosh() const;-    const MatrixFunctionReturnValue<Derived> sinh() const;-    const MatrixFunctionReturnValue<Derived> cos() const;-    const MatrixFunctionReturnValue<Derived> sin() const;-    const MatrixSquareRootReturnValue<Derived> sqrt() const;-    const MatrixLogarithmReturnValue<Derived> log() const;-    const MatrixPowerReturnValue<Derived> pow(const RealScalar& p) const;-    const MatrixComplexPowerReturnValue<Derived> pow(const std::complex<RealScalar>& p) const;+    EIGEN_MATRIX_FUNCTION(MatrixFunctionReturnValue, cosh, hyperbolic cosine)+    EIGEN_MATRIX_FUNCTION(MatrixFunctionReturnValue, sinh, hyperbolic sine)+    EIGEN_MATRIX_FUNCTION(MatrixFunctionReturnValue, cos, cosine)+    EIGEN_MATRIX_FUNCTION(MatrixFunctionReturnValue, sin, sine)+    EIGEN_MATRIX_FUNCTION(MatrixSquareRootReturnValue, sqrt, square root)+    EIGEN_MATRIX_FUNCTION(MatrixLogarithmReturnValue, log, logarithm)+    EIGEN_MATRIX_FUNCTION_1(MatrixPowerReturnValue,        pow, power to \c p, const RealScalar& p)+    EIGEN_MATRIX_FUNCTION_1(MatrixComplexPowerReturnValue, pow, power to \c p, const std::complex<RealScalar>& p)    protected:     EIGEN_DEVICE_FUNC MatrixBase() : Base() {}
eigen3/Eigen/src/Core/NestByValue.h view
@@ -67,25 +67,25 @@     }      template<int LoadMode>-    EIGEN_DEVICE_FUNC inline const PacketScalar packet(Index row, Index col) const+    inline const PacketScalar packet(Index row, Index col) const     {       return m_expression.template packet<LoadMode>(row, col);     }      template<int LoadMode>-    EIGEN_DEVICE_FUNC inline void writePacket(Index row, Index col, const PacketScalar& x)+    inline void writePacket(Index row, Index col, const PacketScalar& x)     {       m_expression.const_cast_derived().template writePacket<LoadMode>(row, col, x);     }      template<int LoadMode>-    EIGEN_DEVICE_FUNC inline const PacketScalar packet(Index index) const+    inline const PacketScalar packet(Index index) const     {       return m_expression.template packet<LoadMode>(index);     }      template<int LoadMode>-    EIGEN_DEVICE_FUNC inline void writePacket(Index index, const PacketScalar& x)+    inline void writePacket(Index index, const PacketScalar& x)     {       m_expression.const_cast_derived().template writePacket<LoadMode>(index, x);     }@@ -99,7 +99,7 @@ /** \returns an expression of the temporary version of *this.   */ template<typename Derived>-EIGEN_DEVICE_FUNC inline const NestByValue<Derived>+inline const NestByValue<Derived> DenseBase<Derived>::nestByValue() const {   return NestByValue<Derived>(derived());
eigen3/Eigen/src/Core/NoAlias.h view
@@ -33,7 +33,6 @@   public:     typedef typename ExpressionType::Scalar Scalar;     -    EIGEN_DEVICE_FUNC     explicit NoAlias(ExpressionType& expression) : m_expression(expression) {}          template<typename OtherDerived>@@ -75,10 +74,10 @@   *   * More precisely, noalias() allows to bypass the EvalBeforeAssignBit flag.   * Currently, even though several expressions may alias, only product-  * expressions have this flag. Therefore, noalias() is only useful when+  * expressions have this flag. Therefore, noalias() is only usefull when   * the source expression contains a matrix product.   *-  * Here are some examples where noalias is useful:+  * Here are some examples where noalias is usefull:   * \code   * D.noalias()  = A * B;   * D.noalias() += A.transpose() * B;@@ -99,7 +98,7 @@   * \sa class NoAlias   */ template<typename Derived>-NoAlias<Derived,MatrixBase> EIGEN_DEVICE_FUNC MatrixBase<Derived>::noalias()+NoAlias<Derived,MatrixBase> MatrixBase<Derived>::noalias() {   return NoAlias<Derived, Eigen::MatrixBase >(derived()); }
eigen3/Eigen/src/Core/NumTraits.h view
@@ -41,34 +41,6 @@   static int run() { return 0; } }; --// default implementation of digits(), based on numeric_limits if specialized,-// 0 for integer types, and log2(epsilon()) otherwise.-template< typename T,-          bool use_numeric_limits = std::numeric_limits<T>::is_specialized,-          bool is_integer = NumTraits<T>::IsInteger>-struct default_digits_impl-{-  static int run() { return std::numeric_limits<T>::digits; }-};--template<typename T>-struct default_digits_impl<T,false,false> // Floating point-{-  static int run() {-    using std::log;-    using std::ceil;-    typedef typename NumTraits<T>::Real Real;-    return int(ceil(-log(NumTraits<Real>::epsilon())/log(static_cast<Real>(2))));-  }-};--template<typename T>-struct default_digits_impl<T,false,true> // Integer-{-  static int run() { return 0; }-};- } // end namespace internal  /** \class NumTraits@@ -99,7 +71,7 @@   *     and to \c 0 otherwise.   * \li Enum values ReadCost, AddCost and MulCost representing a rough estimate of the number of CPU cycles needed   *     to by move / add / mul instructions respectively, assuming the data is already stored in CPU registers.-  *     Stay vague here. No need to do architecture-specific stuff. If you don't know what this means, just use \c Eigen::HugeCost.+  *     Stay vague here. No need to do architecture-specific stuff.   * \li An enum value \a IsSigned. It is equal to \c 1 if \a T is a signed type and to 0 if \a T is unsigned.   * \li An enum value \a RequireInitialization. It is equal to \c 1 if the constructor of the numeric type \a T must   *     be called, and to 0 if it is safe not to call it. Default is 0 if \a T is an arithmetic type, and 1 otherwise.@@ -144,12 +116,6 @@   static inline int digits10()   {     return internal::default_digits10_impl<T>::run();-  }--  EIGEN_DEVICE_FUNC-  static inline int digits()-  {-    return internal::default_digits_impl<T>::run();   }    EIGEN_DEVICE_FUNC
eigen3/Eigen/src/Core/PlainObjectBase.h view
@@ -780,7 +780,7 @@       resize(size);     }     -    // We have a 1x1 matrix/array => the argument is interpreted as the value of the unique coefficient (case where scalar type can be implicitly converted)+    // We have a 1x1 matrix/array => the argument is interpreted as the value of the unique coefficient (case where scalar type can be implicitely converted)     template<typename T>     EIGEN_DEVICE_FUNC     EIGEN_STRONG_INLINE void _init1(const Scalar& val0, typename internal::enable_if<Base::SizeAtCompileTime==1 && internal::is_convertible<T, Scalar>::value,T>::type* = 0)
eigen3/Eigen/src/Core/Product.h view
@@ -116,7 +116,7 @@  : public internal::dense_xpr_base<Product<Lhs,Rhs,Option> >::type {}; -/** Conversion to scalar for inner-products */+/** Convertion to scalar for inner-products */ template<typename Lhs, typename Rhs, int Option> class dense_product_base<Lhs, Rhs, Option, InnerProduct>  : public internal::dense_xpr_base<Product<Lhs,Rhs,Option> >::type
eigen3/Eigen/src/Core/ProductEvaluators.h view
@@ -785,7 +785,11 @@     _Vectorizable = bool(int(MatrixFlags)&PacketAccessBit) && _SameTypes && (_ScalarAccessOnDiag || (bool(int(DiagFlags)&PacketAccessBit))),     _LinearAccessMask = (MatrixType::RowsAtCompileTime==1 || MatrixType::ColsAtCompileTime==1) ? LinearAccessBit : 0,     Flags = ((HereditaryBits|_LinearAccessMask) & (unsigned int)(MatrixFlags)) | (_Vectorizable ? PacketAccessBit : 0),-    Alignment = evaluator<MatrixType>::Alignment+    Alignment = evaluator<MatrixType>::Alignment,++    AsScalarProduct =     (DiagonalType::SizeAtCompileTime==1)+                      ||  (DiagonalType::SizeAtCompileTime==Dynamic && MatrixType::RowsAtCompileTime==1 && ProductOrder==OnTheLeft)+                      ||  (DiagonalType::SizeAtCompileTime==Dynamic && MatrixType::ColsAtCompileTime==1 && ProductOrder==OnTheRight)   };      diagonal_product_evaluator_base(const MatrixType &mat, const DiagonalType &diag)@@ -797,7 +801,10 @@      EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Scalar coeff(Index idx) const   {-    return m_diagImpl.coeff(idx) * m_matImpl.coeff(idx);+    if(AsScalarProduct)+      return m_diagImpl.coeff(0) * m_matImpl.coeff(idx);+    else+      return m_diagImpl.coeff(idx) * m_matImpl.coeff(idx);   }    protected:@@ -851,7 +858,7 @@     return m_diagImpl.coeff(row) * m_matImpl.coeff(row, col);   }   -#ifndef EIGEN_CUDACC+#ifndef __CUDACC__   template<int LoadMode,typename PacketType>   EIGEN_STRONG_INLINE PacketType packet(Index row, Index col) const   {@@ -895,7 +902,7 @@     return m_matImpl.coeff(row, col) * m_diagImpl.coeff(col);   }   -#ifndef EIGEN_CUDACC+#ifndef __CUDACC__   template<int LoadMode,typename PacketType>   EIGEN_STRONG_INLINE PacketType packet(Index row, Index col) const   {
eigen3/Eigen/src/Core/Random.h view
@@ -128,7 +128,7 @@   * \sa class CwiseNullaryOp, setRandom(Index), setRandom(Index,Index)   */ template<typename Derived>-EIGEN_DEVICE_FUNC inline Derived& DenseBase<Derived>::setRandom()+inline Derived& DenseBase<Derived>::setRandom() {   return *this = Random(rows(), cols()); }
eigen3/Eigen/src/Core/Redux.h view
@@ -407,7 +407,7 @@   */ template<typename Derived> template<typename Func>-EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE typename internal::traits<Derived>::Scalar+EIGEN_STRONG_INLINE typename internal::traits<Derived>::Scalar DenseBase<Derived>::redux(const Func& func) const {   eigen_assert(this->rows()>0 && this->cols()>0 && "you are using an empty matrix");@@ -422,7 +422,7 @@   * \warning the result is undefined if \c *this contains NaN.   */ template<typename Derived>-EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE typename internal::traits<Derived>::Scalar+EIGEN_STRONG_INLINE typename internal::traits<Derived>::Scalar DenseBase<Derived>::minCoeff() const {   return derived().redux(Eigen::internal::scalar_min_op<Scalar,Scalar>());@@ -432,7 +432,7 @@   * \warning the result is undefined if \c *this contains NaN.   */ template<typename Derived>-EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE typename internal::traits<Derived>::Scalar+EIGEN_STRONG_INLINE typename internal::traits<Derived>::Scalar DenseBase<Derived>::maxCoeff() const {   return derived().redux(Eigen::internal::scalar_max_op<Scalar,Scalar>());@@ -445,7 +445,7 @@   * \sa trace(), prod(), mean()   */ template<typename Derived>-EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE typename internal::traits<Derived>::Scalar+EIGEN_STRONG_INLINE typename internal::traits<Derived>::Scalar DenseBase<Derived>::sum() const {   if(SizeAtCompileTime==0 || (SizeAtCompileTime==Dynamic && size()==0))@@ -458,7 +458,7 @@ * \sa trace(), prod(), sum() */ template<typename Derived>-EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE typename internal::traits<Derived>::Scalar+EIGEN_STRONG_INLINE typename internal::traits<Derived>::Scalar DenseBase<Derived>::mean() const { #ifdef __INTEL_COMPILER@@ -479,7 +479,7 @@   * \sa sum(), mean(), trace()   */ template<typename Derived>-EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE typename internal::traits<Derived>::Scalar+EIGEN_STRONG_INLINE typename internal::traits<Derived>::Scalar DenseBase<Derived>::prod() const {   if(SizeAtCompileTime==0 || (SizeAtCompileTime==Dynamic && size()==0))@@ -494,7 +494,7 @@   * \sa diagonal(), sum()   */ template<typename Derived>-EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE typename internal::traits<Derived>::Scalar+EIGEN_STRONG_INLINE typename internal::traits<Derived>::Scalar MatrixBase<Derived>::trace() const {   return derived().diagonal().sum();
eigen3/Eigen/src/Core/Ref.h view
@@ -186,8 +186,6 @@   * void foo(const Ref<MatrixXf,0,Stride<> >& A) { foo_impl(A); }   * \endcode   *-  * See also the following stackoverflow questions for further references:-  *  - <a href="http://stackoverflow.com/questions/21132538/correct-usage-of-the-eigenref-class">Correct usage of the Eigen::Ref<> class</a>   *   * \sa PlainObjectBase::Map(), \ref TopicStorageOrders   */
eigen3/Eigen/src/Core/Replicate.h view
@@ -115,7 +115,7 @@   */ template<typename Derived> template<int RowFactor, int ColFactor>-EIGEN_DEVICE_FUNC const Replicate<Derived,RowFactor,ColFactor>+const Replicate<Derived,RowFactor,ColFactor> DenseBase<Derived>::replicate() const {   return Replicate<Derived,RowFactor,ColFactor>(derived());@@ -130,7 +130,7 @@   * \sa VectorwiseOp::replicate(), DenseBase::replicate(), class Replicate   */ template<typename ExpressionType, int Direction>-EIGEN_DEVICE_FUNC const typename VectorwiseOp<ExpressionType,Direction>::ReplicateReturnType+const typename VectorwiseOp<ExpressionType,Direction>::ReplicateReturnType VectorwiseOp<ExpressionType,Direction>::replicate(Index factor) const {   return typename VectorwiseOp<ExpressionType,Direction>::ReplicateReturnType
eigen3/Eigen/src/Core/ReturnByValue.h view
@@ -79,7 +79,7 @@  template<typename Derived> template<typename OtherDerived>-EIGEN_DEVICE_FUNC Derived& DenseBase<Derived>::operator=(const ReturnByValue<OtherDerived>& other)+Derived& DenseBase<Derived>::operator=(const ReturnByValue<OtherDerived>& other) {   other.evalTo(derived());   return derived();
eigen3/Eigen/src/Core/Reverse.h view
@@ -114,7 +114,7 @@   *   */ template<typename Derived>-EIGEN_DEVICE_FUNC inline typename DenseBase<Derived>::ReverseReturnType+inline typename DenseBase<Derived>::ReverseReturnType DenseBase<Derived>::reverse() {   return ReverseReturnType(derived());@@ -136,7 +136,7 @@   *   * \sa VectorwiseOp::reverseInPlace(), reverse() */ template<typename Derived>-EIGEN_DEVICE_FUNC inline void DenseBase<Derived>::reverseInPlace()+inline void DenseBase<Derived>::reverseInPlace() {   if(cols()>rows())   {@@ -201,7 +201,7 @@   *   * \sa DenseBase::reverseInPlace(), reverse() */ template<typename ExpressionType, int Direction>-EIGEN_DEVICE_FUNC void VectorwiseOp<ExpressionType,Direction>::reverseInPlace()+void VectorwiseOp<ExpressionType,Direction>::reverseInPlace() {   internal::vectorwise_reverse_inplace_impl<Direction>::run(_expression().const_cast_derived()); }
eigen3/Eigen/src/Core/SelfAdjointView.h view
@@ -324,7 +324,7 @@ /** This is the const version of MatrixBase::selfadjointView() */ template<typename Derived> template<unsigned int UpLo>-EIGEN_DEVICE_FUNC typename MatrixBase<Derived>::template ConstSelfAdjointViewReturnType<UpLo>::Type+typename MatrixBase<Derived>::template ConstSelfAdjointViewReturnType<UpLo>::Type MatrixBase<Derived>::selfadjointView() const {   return typename ConstSelfAdjointViewReturnType<UpLo>::Type(derived());@@ -341,7 +341,7 @@   */ template<typename Derived> template<unsigned int UpLo>-EIGEN_DEVICE_FUNC typename MatrixBase<Derived>::template SelfAdjointViewReturnType<UpLo>::Type+typename MatrixBase<Derived>::template SelfAdjointViewReturnType<UpLo>::Type MatrixBase<Derived>::selfadjointView() {   return typename SelfAdjointViewReturnType<UpLo>::Type(derived());
eigen3/Eigen/src/Core/SelfCwiseBinaryOp.h view
@@ -17,7 +17,6 @@ template<typename Derived> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& DenseBase<Derived>::operator*=(const Scalar& other) {-  typedef typename Derived::PlainObject PlainObject;   internal::call_assignment(this->derived(), PlainObject::Constant(rows(),cols(),other), internal::mul_assign_op<Scalar,Scalar>());   return derived(); }@@ -25,7 +24,6 @@ template<typename Derived> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& ArrayBase<Derived>::operator+=(const Scalar& other) {-  typedef typename Derived::PlainObject PlainObject;   internal::call_assignment(this->derived(), PlainObject::Constant(rows(),cols(),other), internal::add_assign_op<Scalar,Scalar>());   return derived(); }@@ -33,7 +31,6 @@ template<typename Derived> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& ArrayBase<Derived>::operator-=(const Scalar& other) {-  typedef typename Derived::PlainObject PlainObject;   internal::call_assignment(this->derived(), PlainObject::Constant(rows(),cols(),other), internal::sub_assign_op<Scalar,Scalar>());   return derived(); }@@ -41,7 +38,6 @@ template<typename Derived> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& DenseBase<Derived>::operator/=(const Scalar& other) {-  typedef typename Derived::PlainObject PlainObject;   internal::call_assignment(this->derived(), PlainObject::Constant(rows(),cols(),other), internal::div_assign_op<Scalar,Scalar>());   return derived(); }
eigen3/Eigen/src/Core/SolveTriangular.h view
@@ -164,11 +164,14 @@ #ifndef EIGEN_PARSED_BY_DOXYGEN template<typename MatrixType, unsigned int Mode> template<int Side, typename OtherDerived>-EIGEN_DEVICE_FUNC void TriangularViewImpl<MatrixType,Mode,Dense>::solveInPlace(const MatrixBase<OtherDerived>& _other) const+void TriangularViewImpl<MatrixType,Mode,Dense>::solveInPlace(const MatrixBase<OtherDerived>& _other) const {   OtherDerived& other = _other.const_cast_derived();   eigen_assert( derived().cols() == derived().rows() && ((Side==OnTheLeft && derived().cols() == other.rows()) || (Side==OnTheRight && derived().cols() == other.cols())) );   eigen_assert((!(Mode & ZeroDiag)) && bool(Mode & (Upper|Lower)));+  // If solving for a 0x0 matrix, nothing to do, simply return.+  if (derived().cols() == 0)+    return;    enum { copy = (internal::traits<OtherDerived>::Flags & RowMajorBit)  && OtherDerived::IsVectorAtCompileTime && OtherDerived::SizeAtCompileTime!=1};   typedef typename internal::conditional<copy,
eigen3/Eigen/src/Core/StableNorm.h view
@@ -50,71 +50,6 @@     ssq += (bl*invScale).squaredNorm(); } -template<typename VectorType, typename RealScalar>-void stable_norm_impl_inner_step(const VectorType &vec, RealScalar& ssq, RealScalar& scale, RealScalar& invScale)-{-  typedef typename VectorType::Scalar Scalar;-  const Index blockSize = 4096;-  -  typedef typename internal::nested_eval<VectorType,2>::type VectorTypeCopy;-  typedef typename internal::remove_all<VectorTypeCopy>::type VectorTypeCopyClean;-  const VectorTypeCopy copy(vec);-  -  enum {-    CanAlign = (   (int(VectorTypeCopyClean::Flags)&DirectAccessBit)-                || (int(internal::evaluator<VectorTypeCopyClean>::Alignment)>0) // FIXME Alignment)>0 might not be enough-               ) && (blockSize*sizeof(Scalar)*2<EIGEN_STACK_ALLOCATION_LIMIT)-                 && (EIGEN_MAX_STATIC_ALIGN_BYTES>0) // if we cannot allocate on the stack, then let's not bother about this optimization-  };-  typedef typename internal::conditional<CanAlign, Ref<const Matrix<Scalar,Dynamic,1,0,blockSize,1>, internal::evaluator<VectorTypeCopyClean>::Alignment>,-                                                   typename VectorTypeCopyClean::ConstSegmentReturnType>::type SegmentWrapper;-  Index n = vec.size();-  -  Index bi = internal::first_default_aligned(copy);-  if (bi>0)-    internal::stable_norm_kernel(copy.head(bi), ssq, scale, invScale);-  for (; bi<n; bi+=blockSize)-    internal::stable_norm_kernel(SegmentWrapper(copy.segment(bi,numext::mini(blockSize, n - bi))), ssq, scale, invScale);-}--template<typename VectorType>-typename VectorType::RealScalar-stable_norm_impl(const VectorType &vec, typename enable_if<VectorType::IsVectorAtCompileTime>::type* = 0 )-{-  using std::sqrt;-  using std::abs;--  Index n = vec.size();--  if(n==1)-    return abs(vec.coeff(0));--  typedef typename VectorType::RealScalar RealScalar;-  RealScalar scale(0);-  RealScalar invScale(1);-  RealScalar ssq(0); // sum of squares--  stable_norm_impl_inner_step(vec, ssq, scale, invScale);-  -  return scale * sqrt(ssq);-}--template<typename MatrixType>-typename MatrixType::RealScalar-stable_norm_impl(const MatrixType &mat, typename enable_if<!MatrixType::IsVectorAtCompileTime>::type* = 0 )-{-  using std::sqrt;--  typedef typename MatrixType::RealScalar RealScalar;-  RealScalar scale(0);-  RealScalar invScale(1);-  RealScalar ssq(0); // sum of squares--  for(Index j=0; j<mat.outerSize(); ++j)-    stable_norm_impl_inner_step(mat.innerVector(j), ssq, scale, invScale);-  return scale * sqrt(ssq);-}- template<typename Derived> inline typename NumTraits<typename traits<Derived>::Scalar>::Real blueNorm_impl(const EigenBase<Derived>& _vec)@@ -139,7 +74,7 @@     // are used. For any specific computer, each of the assignment     // statements can be replaced     ibeta = std::numeric_limits<RealScalar>::radix;                 // base for floating-point numbers-    it    = NumTraits<RealScalar>::digits();                        // number of base-beta digits in mantissa+    it    = std::numeric_limits<RealScalar>::digits;                // number of base-beta digits in mantissa     iemin = std::numeric_limits<RealScalar>::min_exponent;          // minimum exponent     iemax = std::numeric_limits<RealScalar>::max_exponent;          // maximum exponent     rbig  = (std::numeric_limits<RealScalar>::max)();               // largest floating-point number@@ -163,16 +98,12 @@   RealScalar asml = RealScalar(0);   RealScalar amed = RealScalar(0);   RealScalar abig = RealScalar(0);--  for(Index j=0; j<vec.outerSize(); ++j)+  for(typename Derived::InnerIterator it(vec, 0); it; ++it)   {-    for(typename Derived::InnerIterator it(vec, j); it; ++it)-    {-      RealScalar ax = abs(it.value());-      if(ax > ab2)     abig += numext::abs2(ax*s2m);-      else if(ax < b1) asml += numext::abs2(ax*s1m);-      else             amed += numext::abs2(ax);-    }+    RealScalar ax = abs(it.value());+    if(ax > ab2)     abig += numext::abs2(ax*s2m);+    else if(ax < b1) asml += numext::abs2(ax*s1m);+    else             amed += numext::abs2(ax);   }   if(amed!=amed)     return amed;  // we got a NaN@@ -225,7 +156,36 @@ inline typename NumTraits<typename internal::traits<Derived>::Scalar>::Real MatrixBase<Derived>::stableNorm() const {-  return internal::stable_norm_impl(derived());+  using std::sqrt;+  using std::abs;+  const Index blockSize = 4096;+  RealScalar scale(0);+  RealScalar invScale(1);+  RealScalar ssq(0); // sum of square+  +  typedef typename internal::nested_eval<Derived,2>::type DerivedCopy;+  typedef typename internal::remove_all<DerivedCopy>::type DerivedCopyClean;+  const DerivedCopy copy(derived());+  +  enum {+    CanAlign = (   (int(DerivedCopyClean::Flags)&DirectAccessBit)+                || (int(internal::evaluator<DerivedCopyClean>::Alignment)>0) // FIXME Alignment)>0 might not be enough+               ) && (blockSize*sizeof(Scalar)*2<EIGEN_STACK_ALLOCATION_LIMIT)+                 && (EIGEN_MAX_STATIC_ALIGN_BYTES>0) // if we cannot allocate on the stack, then let's not bother about this optimization+  };+  typedef typename internal::conditional<CanAlign, Ref<const Matrix<Scalar,Dynamic,1,0,blockSize,1>, internal::evaluator<DerivedCopyClean>::Alignment>,+                                                   typename DerivedCopyClean::ConstSegmentReturnType>::type SegmentWrapper;+  Index n = size();+  +  if(n==1)+    return abs(this->coeff(0));+  +  Index bi = internal::first_default_aligned(copy);+  if (bi>0)+    internal::stable_norm_kernel(copy.head(bi), ssq, scale, invScale);+  for (; bi<n; bi+=blockSize)+    internal::stable_norm_kernel(SegmentWrapper(copy.segment(bi,numext::mini(blockSize, n - bi))), ssq, scale, invScale);+  return scale * sqrt(ssq); }  /** \returns the \em l2 norm of \c *this using the Blue's algorithm.@@ -253,10 +213,7 @@ inline typename NumTraits<typename internal::traits<Derived>::Scalar>::Real MatrixBase<Derived>::hypotNorm() const {-  if(size()==1)-    return numext::abs(coeff(0,0));-  else-    return this->cwiseAbs().redux(internal::scalar_hypot_op<RealScalar>());+  return this->cwiseAbs().redux(internal::scalar_hypot_op<RealScalar>()); }  } // end namespace Eigen
eigen3/Eigen/src/Core/Transpose.h view
@@ -168,7 +168,7 @@   *   * \sa transposeInPlace(), adjoint() */ template<typename Derived>-EIGEN_DEVICE_FUNC inline Transpose<Derived>+inline Transpose<Derived> DenseBase<Derived>::transpose() {   return TransposeReturnType(derived());@@ -180,7 +180,7 @@   *   * \sa transposeInPlace(), adjoint() */ template<typename Derived>-EIGEN_DEVICE_FUNC inline typename DenseBase<Derived>::ConstTransposeReturnType+inline typename DenseBase<Derived>::ConstTransposeReturnType DenseBase<Derived>::transpose() const {   return ConstTransposeReturnType(derived());@@ -206,7 +206,7 @@   *   * \sa adjointInPlace(), transpose(), conjugate(), class Transpose, class internal::scalar_conjugate_op */ template<typename Derived>-EIGEN_DEVICE_FUNC inline const typename MatrixBase<Derived>::AdjointReturnType+inline const typename MatrixBase<Derived>::AdjointReturnType MatrixBase<Derived>::adjoint() const {   return AdjointReturnType(this->transpose());@@ -281,7 +281,7 @@   *   * \sa transpose(), adjoint(), adjointInPlace() */ template<typename Derived>-EIGEN_DEVICE_FUNC inline void DenseBase<Derived>::transposeInPlace()+inline void DenseBase<Derived>::transposeInPlace() {   eigen_assert((rows() == cols() || (RowsAtCompileTime == Dynamic && ColsAtCompileTime == Dynamic))                && "transposeInPlace() called on a non-square non-resizable matrix");@@ -312,7 +312,7 @@   *   * \sa transpose(), adjoint(), transposeInPlace() */ template<typename Derived>-EIGEN_DEVICE_FUNC inline void MatrixBase<Derived>::adjointInPlace()+inline void MatrixBase<Derived>::adjointInPlace() {   derived() = adjoint().eval(); }
eigen3/Eigen/src/Core/Transpositions.h view
@@ -84,7 +84,7 @@     }      // FIXME: do we want such methods ?-    // might be useful when the target matrix expression is complex, e.g.:+    // might be usefull when the target matrix expression is complex, e.g.:     // object.matrix().block(..,..,..,..) = trans * object.matrix().block(..,..,..,..);     /*     template<typename MatrixType>
eigen3/Eigen/src/Core/TriangularMatrix.h view
@@ -470,7 +470,7 @@       * \a Side==OnTheLeft (the default), or the right-inverse-multiply  \a other * inverse(\c *this) if       * \a Side==OnTheRight.       *-      * Note that the template parameter \c Side can be omitted, in which case \c Side==OnTheLeft+      * Note that the template parameter \c Side can be ommitted, in which case \c Side==OnTheLeft       *       * The matrix \c *this must be triangular and invertible (i.e., all the coefficients of the       * diagonal must be non zero). It works as a forward (resp. backward) substitution if \c *this@@ -488,6 +488,7 @@       * \sa TriangularView::solveInPlace()       */     template<int Side, typename Other>+    EIGEN_DEVICE_FUNC     inline const internal::triangular_solve_retval<Side,TriangularViewType, Other>     solve(const MatrixBase<Other>& other) const; @@ -496,7 +497,7 @@       * \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.       *-      * Note that the template parameter \c Side can be omitted, in which case \c Side==OnTheLeft+      * Note that the template parameter \c Side can be ommitted, in which case \c Side==OnTheLeft       *       * See TriangularView:solve() for the details.       */@@ -553,7 +554,7 @@ // FIXME should we keep that possibility template<typename MatrixType, unsigned int Mode> template<typename OtherDerived>-EIGEN_DEVICE_FUNC inline TriangularView<MatrixType, Mode>&+inline TriangularView<MatrixType, Mode>& TriangularViewImpl<MatrixType, Mode, Dense>::operator=(const MatrixBase<OtherDerived>& other) {   internal::call_assignment_no_alias(derived(), other.derived(), internal::assign_op<Scalar,typename OtherDerived::Scalar>());@@ -563,7 +564,7 @@ // FIXME should we keep that possibility template<typename MatrixType, unsigned int Mode> template<typename OtherDerived>-EIGEN_DEVICE_FUNC void TriangularViewImpl<MatrixType, Mode, Dense>::lazyAssign(const MatrixBase<OtherDerived>& other)+void TriangularViewImpl<MatrixType, Mode, Dense>::lazyAssign(const MatrixBase<OtherDerived>& other) {   internal::call_assignment_no_alias(derived(), other.template triangularView<Mode>()); }@@ -572,7 +573,7 @@  template<typename MatrixType, unsigned int Mode> template<typename OtherDerived>-EIGEN_DEVICE_FUNC inline TriangularView<MatrixType, Mode>&+inline TriangularView<MatrixType, Mode>& TriangularViewImpl<MatrixType, Mode, Dense>::operator=(const TriangularBase<OtherDerived>& other) {   eigen_assert(Mode == int(OtherDerived::Mode));@@ -582,7 +583,7 @@  template<typename MatrixType, unsigned int Mode> template<typename OtherDerived>-EIGEN_DEVICE_FUNC void TriangularViewImpl<MatrixType, Mode, Dense>::lazyAssign(const TriangularBase<OtherDerived>& other)+void TriangularViewImpl<MatrixType, Mode, Dense>::lazyAssign(const TriangularBase<OtherDerived>& other) {   eigen_assert(Mode == int(OtherDerived::Mode));   internal::call_assignment_no_alias(derived(), other.derived());@@ -597,7 +598,7 @@   * If the matrix is triangular, the opposite part is set to zero. */ template<typename Derived> template<typename DenseDerived>-EIGEN_DEVICE_FUNC void TriangularBase<Derived>::evalTo(MatrixBase<DenseDerived> &other) const+void TriangularBase<Derived>::evalTo(MatrixBase<DenseDerived> &other) const {   evalToLazy(other.derived()); }@@ -623,7 +624,6 @@   */ template<typename Derived> template<unsigned int Mode>-EIGEN_DEVICE_FUNC typename MatrixBase<Derived>::template TriangularViewReturnType<Mode>::Type MatrixBase<Derived>::triangularView() {@@ -633,7 +633,6 @@ /** This is the const version of MatrixBase::triangularView() */ template<typename Derived> template<unsigned int Mode>-EIGEN_DEVICE_FUNC typename MatrixBase<Derived>::template ConstTriangularViewReturnType<Mode>::Type MatrixBase<Derived>::triangularView() const {@@ -931,7 +930,7 @@   * If the matrix is triangular, the opposite part is set to zero. */ template<typename Derived> template<typename DenseDerived>-EIGEN_DEVICE_FUNC void TriangularBase<Derived>::evalToLazy(MatrixBase<DenseDerived> &other) const+void TriangularBase<Derived>::evalToLazy(MatrixBase<DenseDerived> &other) const {   other.derived().resize(this->rows(), this->cols());   internal::call_triangular_assignment_loop<Derived::Mode,(Derived::Mode&SelfAdjoint)==0 /* SetOpposite */>(other.derived(), derived().nestedExpression());
eigen3/Eigen/src/Core/VectorBlock.h view
@@ -35,7 +35,7 @@   * It is the return type of DenseBase::segment(Index,Index) and DenseBase::segment<int>(Index) and   * most of the time this is the only way it is used.   *-  * However, if you want to directly manipulate sub-vector expressions,+  * However, if you want to directly maniputate sub-vector expressions,   * for instance if you want to write a function returning such an expression, you   * will need to use this class.   *
eigen3/Eigen/src/Core/VectorwiseOp.h view
@@ -670,7 +670,7 @@   * \sa rowwise(), class VectorwiseOp, \ref TutorialReductionsVisitorsBroadcasting   */ template<typename Derived>-EIGEN_DEVICE_FUNC inline typename DenseBase<Derived>::ColwiseReturnType+inline typename DenseBase<Derived>::ColwiseReturnType DenseBase<Derived>::colwise() {   return ColwiseReturnType(derived());@@ -684,7 +684,7 @@   * \sa colwise(), class VectorwiseOp, \ref TutorialReductionsVisitorsBroadcasting   */ template<typename Derived>-EIGEN_DEVICE_FUNC inline typename DenseBase<Derived>::RowwiseReturnType+inline typename DenseBase<Derived>::RowwiseReturnType DenseBase<Derived>::rowwise() {   return RowwiseReturnType(derived());
eigen3/Eigen/src/Core/arch/AVX/PacketMath.h view
@@ -159,11 +159,12 @@  #ifdef __FMA__ template<> EIGEN_STRONG_INLINE Packet8f pmadd(const Packet8f& a, const Packet8f& b, const Packet8f& c) {-#if ( EIGEN_COMP_GNUC_STRICT || (EIGEN_COMP_CLANG && (EIGEN_COMP_CLANG<308)) )-  // clang stupidly generates a vfmadd213ps instruction plus some vmovaps on registers,-  // and gcc stupidly generates a vfmadd132ps instruction,-  // so let's enforce it to generate a vfmadd231ps instruction since the most common use case is to accumulate-  // the result of the product.+#if ( (EIGEN_COMP_GNUC_STRICT && EIGEN_COMP_GNUC<80) || (EIGEN_COMP_CLANG) )+  // Clang stupidly generates a vfmadd213ps instruction plus some vmovaps on registers,+  //  and even register spilling with clang>=6.0 (bug 1637).+  // Gcc stupidly generates a vfmadd132ps instruction.+  // So let's enforce it to generate a vfmadd231ps instruction since the most common use+  //  case is to accumulate the result of the product.   Packet8f res = c;   __asm__("vfmadd231ps %[a], %[b], %[c]" : [c] "+x" (res) : [a] "x" (a), [b] "x" (b));   return res;@@ -172,7 +173,7 @@ #endif } template<> EIGEN_STRONG_INLINE Packet4d pmadd(const Packet4d& a, const Packet4d& b, const Packet4d& c) {-#if ( EIGEN_COMP_GNUC_STRICT || (EIGEN_COMP_CLANG && (EIGEN_COMP_CLANG<308)) )+#if ( (EIGEN_COMP_GNUC_STRICT && EIGEN_COMP_GNUC<80) || (EIGEN_COMP_CLANG) )   // see above   Packet4d res = c;   __asm__("vfmadd231pd %[a], %[b], %[c]" : [c] "+x" (res) : [a] "x" (a), [b] "x" (b));@@ -183,22 +184,12 @@ } #endif -template<> EIGEN_STRONG_INLINE Packet8f pmin<Packet8f>(const Packet8f& a, const Packet8f& b) {-  // Arguments are swapped to match NaN propagation behavior of std::min.-  return _mm256_min_ps(b,a);-}-template<> EIGEN_STRONG_INLINE Packet4d pmin<Packet4d>(const Packet4d& a, const Packet4d& b) {-  // Arguments are swapped to match NaN propagation behavior of std::min.-  return _mm256_min_pd(b,a);-}-template<> EIGEN_STRONG_INLINE Packet8f pmax<Packet8f>(const Packet8f& a, const Packet8f& b) {-  // Arguments are swapped to match NaN propagation behavior of std::max.-  return _mm256_max_ps(b,a);-}-template<> EIGEN_STRONG_INLINE Packet4d pmax<Packet4d>(const Packet4d& a, const Packet4d& b) {-  // Arguments are swapped to match NaN propagation behavior of std::max.-  return _mm256_max_pd(b,a);-}+template<> EIGEN_STRONG_INLINE Packet8f pmin<Packet8f>(const Packet8f& a, const Packet8f& b) { return _mm256_min_ps(a,b); }+template<> EIGEN_STRONG_INLINE Packet4d pmin<Packet4d>(const Packet4d& a, const Packet4d& b) { return _mm256_min_pd(a,b); }++template<> EIGEN_STRONG_INLINE Packet8f pmax<Packet8f>(const Packet8f& a, const Packet8f& b) { return _mm256_max_ps(a,b); }+template<> EIGEN_STRONG_INLINE Packet4d pmax<Packet4d>(const Packet4d& a, const Packet4d& b) { return _mm256_max_pd(a,b); }+ template<> EIGEN_STRONG_INLINE Packet8f pround<Packet8f>(const Packet8f& a) { return _mm256_round_ps(a, _MM_FROUND_CUR_DIRECTION); } template<> EIGEN_STRONG_INLINE Packet4d pround<Packet4d>(const Packet4d& a) { return _mm256_round_pd(a, _MM_FROUND_CUR_DIRECTION); } @@ -235,7 +226,7 @@ //   Packet8f tmp  = _mm256_castps128_ps256(_mm_loadu_ps(from)); //   tmp = _mm256_insertf128_ps(tmp, _mm_movehl_ps(_mm256_castps256_ps128(tmp),_mm256_castps256_ps128(tmp)), 1); //   return _mm256_unpacklo_ps(tmp,tmp);-+     // _mm256_insertf128_ps is very slow on Haswell, thus:   Packet8f tmp = _mm256_broadcast_ps((const __m128*)(const void*)from);   // mimic an "inplace" permutation of the lower 128bits using a blend@@ -318,9 +309,9 @@ }  #ifndef EIGEN_VECTORIZE_AVX512-template<> EIGEN_STRONG_INLINE void prefetch<float>(const float*   addr) { _mm_prefetch((const void*)(addr), _MM_HINT_T0); }-template<> EIGEN_STRONG_INLINE void prefetch<double>(const double* addr) { _mm_prefetch((const void*)(addr), _MM_HINT_T0); }-template<> EIGEN_STRONG_INLINE void prefetch<int>(const int*       addr) { _mm_prefetch((const void*)(addr), _MM_HINT_T0); }+template<> EIGEN_STRONG_INLINE void prefetch<float>(const float*   addr) { _mm_prefetch((SsePrefetchPtrType)(addr), _MM_HINT_T0); }+template<> EIGEN_STRONG_INLINE void prefetch<double>(const double* addr) { _mm_prefetch((SsePrefetchPtrType)(addr), _MM_HINT_T0); }+template<> EIGEN_STRONG_INLINE void prefetch<int>(const int*       addr) { _mm_prefetch((SsePrefetchPtrType)(addr), _MM_HINT_T0); } #endif  template<> EIGEN_STRONG_INLINE float  pfirst<Packet8f>(const Packet8f& a) {@@ -415,7 +406,7 @@   return predux(Packet2d(_mm_add_pd(_mm256_castpd256_pd128(a),_mm256_extractf128_pd(a,1)))); } -template<> EIGEN_STRONG_INLINE Packet4f predux_half_dowto4<Packet8f>(const Packet8f& a)+template<> EIGEN_STRONG_INLINE Packet4f predux_downto4<Packet8f>(const Packet8f& a) {   return _mm_add_ps(_mm256_castps256_ps128(a),_mm256_extractf128_ps(a,1)); }
eigen3/Eigen/src/Core/arch/AVX512/PacketMath.h view
@@ -54,14 +54,13 @@     AlignedOnScalar = 1,     size = 16,     HasHalfPacket = 1,-    HasBlend = 0, #if EIGEN_GNUC_AT_LEAST(5, 3) #ifdef EIGEN_VECTORIZE_AVX512DQ     HasLog = 1, #endif     HasExp = 1,-    HasSqrt = EIGEN_FAST_MATH,-    HasRsqrt = EIGEN_FAST_MATH,+    HasSqrt = 1,+    HasRsqrt = 1, #endif     HasDiv = 1   };@@ -76,7 +75,7 @@     size = 8,     HasHalfPacket = 1, #if EIGEN_GNUC_AT_LEAST(5, 3)-    HasSqrt = EIGEN_FAST_MATH,+    HasSqrt = 1,     HasRsqrt = EIGEN_FAST_MATH, #endif     HasDiv = 1@@ -231,27 +230,23 @@ template <> EIGEN_STRONG_INLINE Packet16f pmin<Packet16f>(const Packet16f& a,                                               const Packet16f& b) {-  // Arguments are reversed to match NaN propagation behavior of std::min.-  return _mm512_min_ps(b, a);+  return _mm512_min_ps(a, b); } template <> EIGEN_STRONG_INLINE Packet8d pmin<Packet8d>(const Packet8d& a,                                             const Packet8d& b) {-  // Arguments are reversed to match NaN propagation behavior of std::min.-  return _mm512_min_pd(b, a);+  return _mm512_min_pd(a, b); }  template <> EIGEN_STRONG_INLINE Packet16f pmax<Packet16f>(const Packet16f& a,                                               const Packet16f& b) {-  // Arguments are reversed to match NaN propagation behavior of std::max.-  return _mm512_max_ps(b, a);+  return _mm512_max_ps(a, b); } template <> EIGEN_STRONG_INLINE Packet8d pmax<Packet8d>(const Packet8d& a,                                             const Packet8d& b) {-  // Arguments are reversed to match NaN propagation behavior of std::max.-  return _mm512_max_pd(b, a);+  return _mm512_max_pd(a, b); }  template <>@@ -466,35 +461,54 @@ // {a0, a0  a1, a1, a2, a2, a3, a3, a4, a4, a5, a5, a6, a6, a7, a7} template <> EIGEN_STRONG_INLINE Packet16f ploaddup<Packet16f>(const float* from) {-  __m256i low_half = _mm256_load_si256(reinterpret_cast<const __m256i*>(from));-  __m512 even_elements = _mm512_castsi512_ps(_mm512_cvtepu32_epi64(low_half));-  __m512 pairs = _mm512_permute_ps(even_elements, _MM_SHUFFLE(2, 2, 0, 0));-  return pairs;-}+  Packet8f lane0 = _mm256_broadcast_ps((const __m128*)(const void*)from);+  // mimic an "inplace" permutation of the lower 128bits using a blend+  lane0 = _mm256_blend_ps(+      lane0, _mm256_castps128_ps256(_mm_permute_ps(+                 _mm256_castps256_ps128(lane0), _MM_SHUFFLE(1, 0, 1, 0))),+      15);+  // then we can perform a consistent permutation on the global register to get+  // everything in shape:+  lane0 = _mm256_permute_ps(lane0, _MM_SHUFFLE(3, 3, 2, 2)); +  Packet8f lane1 = _mm256_broadcast_ps((const __m128*)(const void*)(from + 4));+  // mimic an "inplace" permutation of the lower 128bits using a blend+  lane1 = _mm256_blend_ps(+      lane1, _mm256_castps128_ps256(_mm_permute_ps(+                 _mm256_castps256_ps128(lane1), _MM_SHUFFLE(1, 0, 1, 0))),+      15);+  // then we can perform a consistent permutation on the global register to get+  // everything in shape:+  lane1 = _mm256_permute_ps(lane1, _MM_SHUFFLE(3, 3, 2, 2));+ #ifdef EIGEN_VECTORIZE_AVX512DQ+  Packet16f res = _mm512_undefined_ps();+  return _mm512_insertf32x8(res, lane0, 0);+  return _mm512_insertf32x8(res, lane1, 1);+  return res;+#else+  Packet16f res = _mm512_undefined_ps();+  res = _mm512_insertf32x4(res, _mm256_extractf128_ps(lane0, 0), 0);+  res = _mm512_insertf32x4(res, _mm256_extractf128_ps(lane0, 1), 1);+  res = _mm512_insertf32x4(res, _mm256_extractf128_ps(lane1, 0), 2);+  res = _mm512_insertf32x4(res, _mm256_extractf128_ps(lane1, 1), 3);+  return res;+#endif+} // Loads 4 doubles from memory a returns the packet {a0, a0  a1, a1, a2, a2, a3, // a3} template <> EIGEN_STRONG_INLINE Packet8d ploaddup<Packet8d>(const double* from) {- __m512d x = _mm512_setzero_pd();-  x = _mm512_insertf64x2(x, _mm_loaddup_pd(&from[0]), 0);-  x = _mm512_insertf64x2(x, _mm_loaddup_pd(&from[1]), 1);-  x = _mm512_insertf64x2(x, _mm_loaddup_pd(&from[2]), 2);-  x = _mm512_insertf64x2(x, _mm_loaddup_pd(&from[3]), 3);-  return x;-}-#else-template <>-EIGEN_STRONG_INLINE Packet8d ploaddup<Packet8d>(const double* from) {-  __m512d x = _mm512_setzero_pd();-  x = _mm512_mask_broadcastsd_pd(x, 0x3<<0, _mm_load_sd(from+0));-  x = _mm512_mask_broadcastsd_pd(x, 0x3<<2, _mm_load_sd(from+1));-  x = _mm512_mask_broadcastsd_pd(x, 0x3<<4, _mm_load_sd(from+2));-  x = _mm512_mask_broadcastsd_pd(x, 0x3<<6, _mm_load_sd(from+3));-  return x;+  Packet4d lane0 = _mm256_broadcast_pd((const __m128d*)(const void*)from);+  lane0 = _mm256_permute_pd(lane0, 3 << 2);++  Packet4d lane1 = _mm256_broadcast_pd((const __m128d*)(const void*)(from + 2));+  lane1 = _mm256_permute_pd(lane1, 3 << 2);++  Packet8d res = _mm512_undefined_pd();+  res = _mm512_insertf64x4(res, lane0, 0);+  return _mm512_insertf64x4(res, lane1, 1); }-#endif  // Loads 4 floats from memory a returns the packet // {a0, a0  a0, a0, a1, a1, a1, a1, a2, a2, a2, a2, a3, a3, a3, a3}@@ -511,11 +525,11 @@ // {a0, a0  a0, a0, a1, a1, a1, a1} template <> EIGEN_STRONG_INLINE Packet8d ploadquad<Packet8d>(const double* from) {-  __m128d tmp0 = _mm_load_pd1(from);-  __m256d lane0 = _mm256_broadcastsd_pd(tmp0);-  __m128d tmp1 = _mm_load_pd1(from + 1);-  __m256d lane1 = _mm256_broadcastsd_pd(tmp1);-  __m512d tmp = _mm512_undefined_pd();+  Packet8d tmp = _mm512_undefined_pd();+  Packet2d tmp0 = _mm_load_pd1(from);+  Packet2d tmp1 = _mm_load_pd1(from + 1);+  Packet4d lane0 = _mm256_broadcastsd_pd(tmp0);+  Packet4d lane1 = _mm256_broadcastsd_pd(tmp1);   tmp = _mm512_insertf64x4(tmp, lane0, 0);   return _mm512_insertf64x4(tmp, lane1, 1); }@@ -604,9 +618,9 @@   pstore(to, pa); } -template<> EIGEN_STRONG_INLINE void prefetch<float>(const float*   addr) { _mm_prefetch((const char*)(addr), _MM_HINT_T0); }-template<> EIGEN_STRONG_INLINE void prefetch<double>(const double* addr) { _mm_prefetch((const char*)(addr), _MM_HINT_T0); }-template<> EIGEN_STRONG_INLINE void prefetch<int>(const int*       addr) { _mm_prefetch((const char*)(addr), _MM_HINT_T0); }+template<> EIGEN_STRONG_INLINE void prefetch<float>(const float*   addr) { _mm_prefetch((SsePrefetchPtrType)(addr), _MM_HINT_T0); }+template<> EIGEN_STRONG_INLINE void prefetch<double>(const double* addr) { _mm_prefetch((SsePrefetchPtrType)(addr), _MM_HINT_T0); }+template<> EIGEN_STRONG_INLINE void prefetch<int>(const int*       addr) { _mm_prefetch((SsePrefetchPtrType)(addr), _MM_HINT_T0); }  template <> EIGEN_STRONG_INLINE float pfirst<Packet16f>(const Packet16f& a) {@@ -634,20 +648,20 @@ template<> EIGEN_STRONG_INLINE Packet16f pabs(const Packet16f& a) {   // _mm512_abs_ps intrinsic not found, so hack around it-  return (__m512)_mm512_and_si512((__m512i)a, _mm512_set1_epi32(0x7fffffff));+  return _mm512_castsi512_ps(_mm512_and_si512(_mm512_castps_si512(a), _mm512_set1_epi32(0x7fffffff))); } template <> EIGEN_STRONG_INLINE Packet8d pabs(const Packet8d& a) {   // _mm512_abs_ps intrinsic not found, so hack around it-  return (__m512d)_mm512_and_si512((__m512i)a,-                                   _mm512_set1_epi64(0x7fffffffffffffff));+  return _mm512_castsi512_pd(_mm512_and_si512(_mm512_castpd_si512(a),+                                   _mm512_set1_epi64(0x7fffffffffffffff))); }  #ifdef EIGEN_VECTORIZE_AVX512DQ // AVX512F does not define _mm512_extractf32x8_ps to extract _m256 from _m512 #define EIGEN_EXTRACT_8f_FROM_16f(INPUT, OUTPUT)                           \-  __m256 OUTPUT##_0 = _mm512_extractf32x8_ps(INPUT, 0);                    \-  __m256 OUTPUT##_1 = _mm512_extractf32x8_ps(INPUT, 1)+  __m256 OUTPUT##_0 = _mm512_extractf32x8_ps(INPUT, 0) __m256 OUTPUT##_1 = \+      _mm512_extractf32x8_ps(INPUT, 1) #else #define EIGEN_EXTRACT_8f_FROM_16f(INPUT, OUTPUT)                \   __m256 OUTPUT##_0 = _mm256_insertf128_ps(                     \@@ -737,7 +751,7 @@   blend1 = _mm256_blend_ps(sum1, sum2, 0xcc);   blend2 = _mm256_blend_ps(sum3, sum4, 0xcc); -  final = _mm256_add_ps(final, _mm256_blend_ps(blend1, blend2, 0xf0));+  final = padd(final, _mm256_blend_ps(blend1, blend2, 0xf0));    hsum1 = _mm256_hadd_ps(vecs8_0, vecs9_0);   hsum2 = _mm256_hadd_ps(vecs10_0, vecs11_0);@@ -787,7 +801,7 @@   blend1 = _mm256_blend_ps(sum1, sum2, 0xcc);   blend2 = _mm256_blend_ps(sum3, sum4, 0xcc); -  final_1 = _mm256_add_ps(final_1, _mm256_blend_ps(blend1, blend2, 0xf0));+  final_1 = padd(final_1, _mm256_blend_ps(blend1, blend2, 0xf0));    __m512 final_output; @@ -837,7 +851,7 @@   tmp1 = _mm256_hadd_pd(vecs2_1, vecs3_1);   tmp1 = _mm256_add_pd(tmp1, _mm256_permute2f128_pd(tmp1, tmp1, 1)); -  final_0 = _mm256_add_pd(final_0, _mm256_blend_pd(tmp0, tmp1, 0xC));+  final_0 = padd(final_0, _mm256_blend_pd(tmp0, tmp1, 0xC));    tmp0 = _mm256_hadd_pd(vecs4_0, vecs5_0);   tmp0 = _mm256_add_pd(tmp0, _mm256_permute2f128_pd(tmp0, tmp0, 1));@@ -853,7 +867,7 @@   tmp1 = _mm256_hadd_pd(vecs6_1, vecs7_1);   tmp1 = _mm256_add_pd(tmp1, _mm256_permute2f128_pd(tmp1, tmp1, 1)); -  final_1 = _mm256_add_pd(final_1, _mm256_blend_pd(tmp0, tmp1, 0xC));+  final_1 = padd(final_1, _mm256_blend_pd(tmp0, tmp1, 0xC));    __m512d final_output = _mm512_insertf64x4(final_output, final_0, 0); @@ -862,52 +876,55 @@  template <> EIGEN_STRONG_INLINE float predux<Packet16f>(const Packet16f& a) {-#ifdef EIGEN_VECTORIZE_AVX512DQ-  __m256 lane0 = _mm512_extractf32x8_ps(a, 0);-  __m256 lane1 = _mm512_extractf32x8_ps(a, 1);-  Packet8f x = _mm256_add_ps(lane0, lane1);-  return predux<Packet8f>(x);+  //#ifdef EIGEN_VECTORIZE_AVX512DQ+#if 0+  Packet8f lane0 = _mm512_extractf32x8_ps(a, 0);+  Packet8f lane1 = _mm512_extractf32x8_ps(a, 1);+  Packet8f sum = padd(lane0, lane1);+  Packet8f tmp0 = _mm256_hadd_ps(sum, _mm256_permute2f128_ps(a, a, 1));+  tmp0 = _mm256_hadd_ps(tmp0, tmp0);+  return pfirst(_mm256_hadd_ps(tmp0, tmp0)); #else-  __m128 lane0 = _mm512_extractf32x4_ps(a, 0);-  __m128 lane1 = _mm512_extractf32x4_ps(a, 1);-  __m128 lane2 = _mm512_extractf32x4_ps(a, 2);-  __m128 lane3 = _mm512_extractf32x4_ps(a, 3);-  __m128 sum = _mm_add_ps(_mm_add_ps(lane0, lane1), _mm_add_ps(lane2, lane3));+  Packet4f lane0 = _mm512_extractf32x4_ps(a, 0);+  Packet4f lane1 = _mm512_extractf32x4_ps(a, 1);+  Packet4f lane2 = _mm512_extractf32x4_ps(a, 2);+  Packet4f lane3 = _mm512_extractf32x4_ps(a, 3);+  Packet4f sum = padd(padd(lane0, lane1), padd(lane2, lane3));   sum = _mm_hadd_ps(sum, sum);   sum = _mm_hadd_ps(sum, _mm_permute_ps(sum, 1));-  return _mm_cvtss_f32(sum);+  return pfirst(sum); #endif } template <> EIGEN_STRONG_INLINE double predux<Packet8d>(const Packet8d& a) {-  __m256d lane0 = _mm512_extractf64x4_pd(a, 0);-  __m256d lane1 = _mm512_extractf64x4_pd(a, 1);-  __m256d sum = _mm256_add_pd(lane0, lane1);-  __m256d tmp0 = _mm256_hadd_pd(sum, _mm256_permute2f128_pd(sum, sum, 1));-  return _mm_cvtsd_f64(_mm256_castpd256_pd128(_mm256_hadd_pd(tmp0, tmp0)));+  Packet4d lane0 = _mm512_extractf64x4_pd(a, 0);+  Packet4d lane1 = _mm512_extractf64x4_pd(a, 1);+  Packet4d sum = padd(lane0, lane1);+  Packet4d tmp0 = _mm256_hadd_pd(sum, _mm256_permute2f128_pd(sum, sum, 1));+  return pfirst(_mm256_hadd_pd(tmp0, tmp0)); }  template <>-EIGEN_STRONG_INLINE Packet8f predux_half_dowto4<Packet16f>(const Packet16f& a) {+EIGEN_STRONG_INLINE Packet8f predux_downto4<Packet16f>(const Packet16f& a) { #ifdef EIGEN_VECTORIZE_AVX512DQ-  __m256 lane0 = _mm512_extractf32x8_ps(a, 0);-  __m256 lane1 = _mm512_extractf32x8_ps(a, 1);-  return _mm256_add_ps(lane0, lane1);+  Packet8f lane0 = _mm512_extractf32x8_ps(a, 0);+  Packet8f lane1 = _mm512_extractf32x8_ps(a, 1);+  return padd(lane0, lane1); #else-  __m128 lane0 = _mm512_extractf32x4_ps(a, 0);-  __m128 lane1 = _mm512_extractf32x4_ps(a, 1);-  __m128 lane2 = _mm512_extractf32x4_ps(a, 2);-  __m128 lane3 = _mm512_extractf32x4_ps(a, 3);-  __m128 sum0 = _mm_add_ps(lane0, lane2);-  __m128 sum1 = _mm_add_ps(lane1, lane3);+  Packet4f lane0 = _mm512_extractf32x4_ps(a, 0);+  Packet4f lane1 = _mm512_extractf32x4_ps(a, 1);+  Packet4f lane2 = _mm512_extractf32x4_ps(a, 2);+  Packet4f lane3 = _mm512_extractf32x4_ps(a, 3);+  Packet4f sum0 = padd(lane0, lane2);+  Packet4f sum1 = padd(lane1, lane3);   return _mm256_insertf128_ps(_mm256_castps128_ps256(sum0), sum1, 1); #endif } template <>-EIGEN_STRONG_INLINE Packet4d predux_half_dowto4<Packet8d>(const Packet8d& a) {-  __m256d lane0 = _mm512_extractf64x4_pd(a, 0);-  __m256d lane1 = _mm512_extractf64x4_pd(a, 1);-  __m256d res = _mm256_add_pd(lane0, lane1);+EIGEN_STRONG_INLINE Packet4d predux_downto4<Packet8d>(const Packet8d& a) {+  Packet4d lane0 = _mm512_extractf64x4_pd(a, 0);+  Packet4d lane1 = _mm512_extractf64x4_pd(a, 1);+  Packet4d res = padd(lane0, lane1);   return res; } @@ -922,59 +939,58 @@   res = pmul(res, _mm_permute_ps(res, _MM_SHUFFLE(0, 0, 3, 2)));   return pfirst(pmul(res, _mm_permute_ps(res, _MM_SHUFFLE(0, 0, 0, 1)))); #else-  __m128 lane0 = _mm512_extractf32x4_ps(a, 0);-  __m128 lane1 = _mm512_extractf32x4_ps(a, 1);-  __m128 lane2 = _mm512_extractf32x4_ps(a, 2);-  __m128 lane3 = _mm512_extractf32x4_ps(a, 3);-  __m128 res = pmul(pmul(lane0, lane1), pmul(lane2, lane3));+  Packet4f lane0 = _mm512_extractf32x4_ps(a, 0);+  Packet4f lane1 = _mm512_extractf32x4_ps(a, 1);+  Packet4f lane2 = _mm512_extractf32x4_ps(a, 2);+  Packet4f lane3 = _mm512_extractf32x4_ps(a, 3);+  Packet4f res = pmul(pmul(lane0, lane1), pmul(lane2, lane3));   res = pmul(res, _mm_permute_ps(res, _MM_SHUFFLE(0, 0, 3, 2)));   return pfirst(pmul(res, _mm_permute_ps(res, _MM_SHUFFLE(0, 0, 0, 1)))); #endif } template <> EIGEN_STRONG_INLINE double predux_mul<Packet8d>(const Packet8d& a) {-  __m256d lane0 = _mm512_extractf64x4_pd(a, 0);-  __m256d lane1 = _mm512_extractf64x4_pd(a, 1);-  __m256d res = pmul(lane0, lane1);+  Packet4d lane0 = _mm512_extractf64x4_pd(a, 0);+  Packet4d lane1 = _mm512_extractf64x4_pd(a, 1);+  Packet4d res = pmul(lane0, lane1);   res = pmul(res, _mm256_permute2f128_pd(res, res, 1));   return pfirst(pmul(res, _mm256_shuffle_pd(res, res, 1))); }  template <> EIGEN_STRONG_INLINE float predux_min<Packet16f>(const Packet16f& a) {-  __m128 lane0 = _mm512_extractf32x4_ps(a, 0);-  __m128 lane1 = _mm512_extractf32x4_ps(a, 1);-  __m128 lane2 = _mm512_extractf32x4_ps(a, 2);-  __m128 lane3 = _mm512_extractf32x4_ps(a, 3);-  __m128 res = _mm_min_ps(_mm_min_ps(lane0, lane1), _mm_min_ps(lane2, lane3));+  Packet4f lane0 = _mm512_extractf32x4_ps(a, 0);+  Packet4f lane1 = _mm512_extractf32x4_ps(a, 1);+  Packet4f lane2 = _mm512_extractf32x4_ps(a, 2);+  Packet4f lane3 = _mm512_extractf32x4_ps(a, 3);+  Packet4f res = _mm_min_ps(_mm_min_ps(lane0, lane1), _mm_min_ps(lane2, lane3));   res = _mm_min_ps(res, _mm_permute_ps(res, _MM_SHUFFLE(0, 0, 3, 2)));   return pfirst(_mm_min_ps(res, _mm_permute_ps(res, _MM_SHUFFLE(0, 0, 0, 1)))); } template <> EIGEN_STRONG_INLINE double predux_min<Packet8d>(const Packet8d& a) {-  __m256d lane0 = _mm512_extractf64x4_pd(a, 0);-  __m256d lane1 = _mm512_extractf64x4_pd(a, 1);-  __m256d res = _mm256_min_pd(lane0, lane1);+  Packet4d lane0 = _mm512_extractf64x4_pd(a, 0);+  Packet4d lane1 = _mm512_extractf64x4_pd(a, 1);+  Packet4d res = _mm256_min_pd(lane0, lane1);   res = _mm256_min_pd(res, _mm256_permute2f128_pd(res, res, 1));   return pfirst(_mm256_min_pd(res, _mm256_shuffle_pd(res, res, 1))); }  template <> EIGEN_STRONG_INLINE float predux_max<Packet16f>(const Packet16f& a) {-  __m128 lane0 = _mm512_extractf32x4_ps(a, 0);-  __m128 lane1 = _mm512_extractf32x4_ps(a, 1);-  __m128 lane2 = _mm512_extractf32x4_ps(a, 2);-  __m128 lane3 = _mm512_extractf32x4_ps(a, 3);-  __m128 res = _mm_max_ps(_mm_max_ps(lane0, lane1), _mm_max_ps(lane2, lane3));+  Packet4f lane0 = _mm512_extractf32x4_ps(a, 0);+  Packet4f lane1 = _mm512_extractf32x4_ps(a, 1);+  Packet4f lane2 = _mm512_extractf32x4_ps(a, 2);+  Packet4f lane3 = _mm512_extractf32x4_ps(a, 3);+  Packet4f res = _mm_max_ps(_mm_max_ps(lane0, lane1), _mm_max_ps(lane2, lane3));   res = _mm_max_ps(res, _mm_permute_ps(res, _MM_SHUFFLE(0, 0, 3, 2)));   return pfirst(_mm_max_ps(res, _mm_permute_ps(res, _MM_SHUFFLE(0, 0, 0, 1)))); }- template <> EIGEN_STRONG_INLINE double predux_max<Packet8d>(const Packet8d& a) {-  __m256d lane0 = _mm512_extractf64x4_pd(a, 0);-  __m256d lane1 = _mm512_extractf64x4_pd(a, 1);-  __m256d res = _mm256_max_pd(lane0, lane1);+  Packet4d lane0 = _mm512_extractf64x4_pd(a, 0);+  Packet4d lane1 = _mm512_extractf64x4_pd(a, 1);+  Packet4d res = _mm256_max_pd(lane0, lane1);   res = _mm256_max_pd(res, _mm256_permute2f128_pd(res, res, 1));   return pfirst(_mm256_max_pd(res, _mm256_shuffle_pd(res, res, 1))); }@@ -1286,38 +1302,11 @@   return Packet16f(); } template <>-EIGEN_STRONG_INLINE Packet8d pblend(const Selector<8>& ifPacket,-                                    const Packet8d& thenPacket,-                                    const Packet8d& elsePacket) {-  __mmask8 m = (ifPacket.select[0]   )-             | (ifPacket.select[1]<<1)-             | (ifPacket.select[2]<<2)-             | (ifPacket.select[3]<<3)-             | (ifPacket.select[4]<<4)-             | (ifPacket.select[5]<<5)-             | (ifPacket.select[6]<<6)-             | (ifPacket.select[7]<<7);-  return _mm512_mask_blend_pd(m, elsePacket, thenPacket);-}--template<> EIGEN_STRONG_INLINE Packet16f pinsertfirst(const Packet16f& a, float b)-{-  return _mm512_mask_broadcastss_ps(a, (1), _mm_load_ss(&b));-}--template<> EIGEN_STRONG_INLINE Packet8d pinsertfirst(const Packet8d& a, double b)-{-  return _mm512_mask_broadcastsd_pd(a, (1), _mm_load_sd(&b));-}--template<> EIGEN_STRONG_INLINE Packet16f pinsertlast(const Packet16f& a, float b)-{-  return _mm512_mask_broadcastss_ps(a, (1<<15), _mm_load_ss(&b));-}--template<> EIGEN_STRONG_INLINE Packet8d pinsertlast(const Packet8d& a, double b)-{-  return _mm512_mask_broadcastsd_pd(a, (1<<7), _mm_load_sd(&b));+EIGEN_STRONG_INLINE Packet8d pblend(const Selector<8>& /*ifPacket*/,+                                    const Packet8d& /*thenPacket*/,+                                    const Packet8d& /*elsePacket*/) {+  assert(false && "To be implemented");+  return Packet8d(); }  } // end namespace internal
eigen3/Eigen/src/Core/arch/AltiVec/PacketMath.h view
@@ -103,7 +103,7 @@ static Packet16uc p16uc_PSET32_WEVEN  = vec_sld(p16uc_DUPLICATE32_HI, (Packet16uc) vec_splat((Packet4ui)p16uc_FORWARD, 3), 8);//{ 4,5,6,7, 4,5,6,7, 12,13,14,15, 12,13,14,15 }; static Packet16uc p16uc_HALF64_0_16 = vec_sld((Packet16uc)p4i_ZERO, vec_splat((Packet16uc) vec_abs(p4i_MINUS16), 3), 8);      //{ 0,0,0,0, 0,0,0,0, 16,16,16,16, 16,16,16,16}; #else-static Packet16uc p16uc_FORWARD = p16uc_REVERSE32; +static Packet16uc p16uc_FORWARD = p16uc_REVERSE32; static Packet16uc p16uc_REVERSE64 = { 8,9,10,11, 12,13,14,15, 0,1,2,3, 4,5,6,7 }; static Packet16uc p16uc_PSET32_WODD = vec_sld((Packet16uc) vec_splat((Packet4ui)p16uc_FORWARD, 1), (Packet16uc) vec_splat((Packet4ui)p16uc_FORWARD, 3), 8);//{ 0,1,2,3, 0,1,2,3, 8,9,10,11, 8,9,10,11 }; static Packet16uc p16uc_PSET32_WEVEN = vec_sld((Packet16uc) vec_splat((Packet4ui)p16uc_FORWARD, 0), (Packet16uc) vec_splat((Packet4ui)p16uc_FORWARD, 2), 8);//{ 4,5,6,7, 4,5,6,7, 12,13,14,15, 12,13,14,15 };@@ -391,7 +391,6 @@ template<> EIGEN_STRONG_INLINE Packet4f pmin<Packet4f>(const Packet4f& a, const Packet4f& b) {   #ifdef __VSX__-  // NOTE: about 10% slower than vec_min, but consistent with std::min and SSE regarding NaN   Packet4f ret;   __asm__ ("xvcmpgesp %x0,%x1,%x2\n\txxsel %x0,%x1,%x2,%x0" : "=&wa" (ret) : "wa" (a), "wa" (b));   return ret;@@ -404,7 +403,6 @@ template<> EIGEN_STRONG_INLINE Packet4f pmax<Packet4f>(const Packet4f& a, const Packet4f& b) {   #ifdef __VSX__-  // NOTE: about 10% slower than vec_max, but consistent with std::max and SSE regarding NaN   Packet4f ret;   __asm__ ("xvcmpgtsp %x0,%x2,%x1\n\txxsel %x0,%x1,%x2,%x0" : "=&wa" (ret) : "wa" (a), "wa" (b));   return ret;@@ -454,7 +452,7 @@   return (Packet4i) vec_perm(MSQ, LSQ, mask);    // align the data } #else-// We also need to redefine little endian loading of Packet4i/Packet4f using VSX+// We also need ot redefine little endian loading of Packet4i/Packet4f using VSX template<> EIGEN_STRONG_INLINE Packet4i ploadu<Packet4i>(const int* from) {   EIGEN_DEBUG_UNALIGNED_LOAD@@ -520,7 +518,7 @@   vec_st( MSQ, 0, (unsigned char *)to );                    // Store the MSQ part } #else-// We also need to redefine little endian loading of Packet4i/Packet4f using VSX+// We also need ot redefine little endian loading of Packet4i/Packet4f using VSX template<> EIGEN_STRONG_INLINE void pstoreu<int>(int*       to, const Packet4i& from) {   EIGEN_DEBUG_ALIGNED_STORE@@ -784,7 +782,7 @@  static Packet2l  p2l_ONE  = { 1, 1 }; static Packet2l  p2l_ZERO = reinterpret_cast<Packet2l>(p4i_ZERO);-static Packet2d  p2d_ONE  = { 1.0, 1.0 }; +static Packet2d  p2d_ONE  = { 1.0, 1.0 }; static Packet2d  p2d_ZERO = reinterpret_cast<Packet2d>(p4f_ZERO); static Packet2d  p2d_MZERO = { -0.0, -0.0 }; @@ -932,7 +930,6 @@  template<> EIGEN_STRONG_INLINE Packet2d pmin<Packet2d>(const Packet2d& a, const Packet2d& b) {-  // NOTE: about 10% slower than vec_min, but consistent with std::min and SSE regarding NaN   Packet2d ret;   __asm__ ("xvcmpgedp %x0,%x1,%x2\n\txxsel %x0,%x1,%x2,%x0" : "=&wa" (ret) : "wa" (a), "wa" (b));   return ret;@@ -940,7 +937,6 @@  template<> EIGEN_STRONG_INLINE Packet2d pmax<Packet2d>(const Packet2d& a, const Packet2d& b) {-  // NOTE: about 10% slower than vec_max, but consistent with std::max and SSE regarding NaN   Packet2d ret;   __asm__ ("xvcmpgtdp %x0,%x2,%x1\n\txxsel %x0,%x1,%x2,%x0" : "=&wa" (ret) : "wa" (a), "wa" (b));   return ret;@@ -1001,7 +997,7 @@   Packet2d v[2], sum;   v[0] = vecs[0] + reinterpret_cast<Packet2d>(vec_sld(reinterpret_cast<Packet4f>(vecs[0]), reinterpret_cast<Packet4f>(vecs[0]), 8));   v[1] = vecs[1] + reinterpret_cast<Packet2d>(vec_sld(reinterpret_cast<Packet4f>(vecs[1]), reinterpret_cast<Packet4f>(vecs[1]), 8));- + #ifdef _BIG_ENDIAN   sum = reinterpret_cast<Packet2d>(vec_sld(reinterpret_cast<Packet4f>(v[0]), reinterpret_cast<Packet4f>(v[1]), 8)); #else@@ -1054,7 +1050,7 @@  template<> EIGEN_STRONG_INLINE Packet2d pblend(const Selector<2>& ifPacket, const Packet2d& thenPacket, const Packet2d& elsePacket) {   Packet2l select = { ifPacket.select[0], ifPacket.select[1] };-  Packet2bl mask = vec_cmpeq(reinterpret_cast<Packet2d>(select), reinterpret_cast<Packet2d>(p2l_ONE));+  Packet2bl mask = reinterpret_cast<Packet2bl>( vec_cmpeq(reinterpret_cast<Packet2d>(select), reinterpret_cast<Packet2d>(p2l_ONE)) );   return vec_sel(elsePacket, thenPacket, mask); } #endif // __VSX__
eigen3/Eigen/src/Core/arch/CUDA/Complex.h view
@@ -16,7 +16,7 @@  namespace internal { -#if defined(EIGEN_CUDACC) && defined(EIGEN_USE_GPU)+#if defined(__CUDACC__) && defined(EIGEN_USE_GPU)  // Many std::complex methods such as operator+, operator-, operator* and // operator/ are not constexpr. Due to this, clang does not treat them as device@@ -55,7 +55,7 @@ // Product template<typename T> struct scalar_product_op<const std::complex<T>, const std::complex<T> >  : binary_op_base<const std::complex<T>, const std::complex<T> > {   enum {-    Vectorizable = packet_traits<std::complex<T> >::HasMul+    Vectorizable = packet_traits<std::complex<T>>::HasMul   };   typedef typename std::complex<T> result_type; @@ -76,7 +76,7 @@ // Quotient template<typename T> struct scalar_quotient_op<const std::complex<T>, const std::complex<T> > : binary_op_base<const std::complex<T>, const std::complex<T> > {   enum {-    Vectorizable = packet_traits<std::complex<T> >::HasDiv+    Vectorizable = packet_traits<std::complex<T>>::HasDiv   };   typedef typename std::complex<T> result_type; 
eigen3/Eigen/src/Core/arch/CUDA/Half.h view
@@ -29,7 +29,7 @@ // type Eigen::half (inheriting from CUDA's __half struct) with // operator overloads such that it behaves basically as an arithmetic // type. It will be quite slow on CPUs (so it is recommended to stay-// in fp32 for CPUs, except for simple parameter conversions, I/O+// in float32_bits for CPUs, except for simple parameter conversions, I/O // to disk and the likes), but fast on GPUs.  @@ -204,7 +204,7 @@ #if defined(EIGEN_HAS_CUDA_FP16) && defined(EIGEN_CUDA_ARCH) && EIGEN_CUDA_ARCH >= 530  // Intrinsics for native fp16 support. Note that on current hardware,-// these are no faster than fp32 arithmetic (you need to use the half2+// these are no faster than float32_bits arithmetic (you need to use the half2 // versions to get the ALU speed increased), but you do save the // conversion steps back and forth. @@ -263,7 +263,7 @@ #else  // Emulate support for half floats  // Definitions for CPUs and older CUDA, mostly working through conversion-// to/from fp32.+// to/from float32_bits.  EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC half operator + (const half& a, const half& b) {   return half(float(a) + float(b));@@ -336,7 +336,7 @@   return h; } -union FP32 {+union float32_bits {   unsigned int u;   float f; };@@ -352,11 +352,11 @@   return h;  #else-  FP32 f; f.f = ff;+  float32_bits f; f.f = ff; -  const FP32 f32infty = { 255 << 23 };-  const FP32 f16max = { (127 + 16) << 23 };-  const FP32 denorm_magic = { ((127 - 15) + (23 - 10) + 1) << 23 };+  const float32_bits f32infty = { 255 << 23 };+  const float32_bits f16max = { (127 + 16) << 23 };+  const float32_bits denorm_magic = { ((127 - 15) + (23 - 10) + 1) << 23 };   unsigned int sign_mask = 0x80000000u;   __half_raw o;   o.x = static_cast<unsigned short>(0x0u);@@ -405,9 +405,9 @@   return _cvtsh_ss(h.x);  #else-  const FP32 magic = { 113 << 23 };+  const float32_bits magic = { 113 << 23 };   const unsigned int shifted_exp = 0x7c00 << 13; // exponent mask after shift-  FP32 o;+  float32_bits o;    o.u = (h.x & 0x7fff) << 13;             // exponent/mantissa bits   unsigned int exp = shifted_exp & o.u;   // just the exponent@@ -453,9 +453,6 @@ #else    return half(::expf(float(a))); #endif-}-EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC half expm1(const half& a) {-  return half(numext::expm1(float(a))); } EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC half log(const half& a) { #if defined(EIGEN_HAS_CUDA_FP16) && EIGEN_CUDACC_VER >= 80000 && defined(EIGEN_CUDA_ARCH) && EIGEN_CUDA_ARCH >= 530
eigen3/Eigen/src/Core/arch/CUDA/MathFunctions.h view
@@ -17,7 +17,7 @@ // Make sure this is only available when targeting a GPU: we don't want to // introduce conflicts between these packet_traits definitions and the ones // we'll use on the host side (SSE, AVX, ...)-#if defined(EIGEN_CUDACC) && defined(EIGEN_USE_GPU)+#if defined(__CUDACC__) && defined(EIGEN_USE_GPU) template<> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE float4 plog<float4>(const float4& a) {@@ -54,18 +54,6 @@ {   using ::exp;   return make_double2(exp(a.x), exp(a.y));-}--template<> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE-float4 pexpm1<float4>(const float4& a)-{-  return make_float4(expm1f(a.x), expm1f(a.y), expm1f(a.z), expm1f(a.w));-}--template<> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE-double2 pexpm1<double2>(const double2& a)-{-  return make_double2(expm1(a.x), expm1(a.y)); }  template<> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
eigen3/Eigen/src/Core/arch/CUDA/PacketMath.h view
@@ -17,7 +17,7 @@ // Make sure this is only available when targeting a GPU: we don't want to // introduce conflicts between these packet_traits definitions and the ones // we'll use on the host side (SSE, AVX, ...)-#if defined(EIGEN_CUDACC) && defined(EIGEN_USE_GPU)+#if defined(__CUDACC__) && defined(EIGEN_USE_GPU) template<> struct is_arithmetic<float4>  { enum { value = true }; }; template<> struct is_arithmetic<double2> { enum { value = true }; }; @@ -167,10 +167,10 @@   return make_double2(from[0], from[1]); } -template<> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE float4 ploaddup<float4>(const float*   from) {+template<> EIGEN_STRONG_INLINE float4 ploaddup<float4>(const float*   from) {   return make_float4(from[0], from[0], from[1], from[1]); }-template<> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE double2 ploaddup<double2>(const double*  from) {+template<> EIGEN_STRONG_INLINE double2 ploaddup<double2>(const double*  from) {   return make_double2(from[0], from[0]); } @@ -196,7 +196,7 @@  template<> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE float4 ploadt_ro<float4, Aligned>(const float* from) {-#if defined(EIGEN_CUDA_ARCH) && EIGEN_CUDA_ARCH >= 350+#if defined(__CUDA_ARCH__) && __CUDA_ARCH__ >= 350   return __ldg((const float4*)from); #else   return make_float4(from[0], from[1], from[2], from[3]);@@ -204,7 +204,7 @@ } template<> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE double2 ploadt_ro<double2, Aligned>(const double* from) {-#if defined(EIGEN_CUDA_ARCH) && EIGEN_CUDA_ARCH >= 350+#if defined(__CUDA_ARCH__) && __CUDA_ARCH__ >= 350   return __ldg((const double2*)from); #else   return make_double2(from[0], from[1]);@@ -213,7 +213,7 @@  template<> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE float4 ploadt_ro<float4, Unaligned>(const float* from) {-#if defined(EIGEN_CUDA_ARCH) && EIGEN_CUDA_ARCH >= 350+#if defined(__CUDA_ARCH__) && __CUDA_ARCH__ >= 350   return make_float4(__ldg(from+0), __ldg(from+1), __ldg(from+2), __ldg(from+3)); #else   return make_float4(from[0], from[1], from[2], from[3]);@@ -221,7 +221,7 @@ } template<> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE double2 ploadt_ro<double2, Unaligned>(const double* from) {-#if defined(EIGEN_CUDA_ARCH) && EIGEN_CUDA_ARCH >= 350+#if defined(__CUDA_ARCH__) && __CUDA_ARCH__ >= 350   return make_double2(__ldg(from+0), __ldg(from+1)); #else   return make_double2(from[0], from[1]);
eigen3/Eigen/src/Core/arch/CUDA/PacketMathHalf.h view
@@ -15,7 +15,7 @@ namespace internal {  // Most of the following operations require arch >= 3.0-#if defined(EIGEN_HAS_CUDA_FP16) && defined(EIGEN_CUDACC) && defined(EIGEN_CUDA_ARCH) && EIGEN_CUDA_ARCH >= 300+#if defined(EIGEN_HAS_CUDA_FP16) && defined(__CUDACC__) && defined(__CUDA_ARCH__) && __CUDA_ARCH__ >= 300  template<> struct is_arithmetic<half2> { enum { value = true }; }; @@ -34,7 +34,6 @@     HasSqrt   = 1,     HasRsqrt  = 1,     HasExp    = 1,-    HasExpm1  = 1,     HasLog    = 1,     HasLog1p  = 1   };@@ -54,7 +53,7 @@   return __halves2half2(from[0], from[1]); } -template<> __device__ EIGEN_STRONG_INLINE half2 ploaddup<half2>(const Eigen::half*  from) {+template<> EIGEN_STRONG_INLINE half2 ploaddup<half2>(const Eigen::half*  from) {   return __halves2half2(from[0], from[0]); } @@ -69,7 +68,7 @@  template<>  __device__ EIGEN_ALWAYS_INLINE half2 ploadt_ro<half2, Aligned>(const Eigen::half* from) {-#if EIGEN_CUDA_ARCH >= 350+#if __CUDA_ARCH__ >= 350    return __ldg((const half2*)from); #else   return __halves2half2(*(from+0), *(from+1));@@ -78,7 +77,7 @@  template<> __device__ EIGEN_ALWAYS_INLINE half2 ploadt_ro<half2, Unaligned>(const Eigen::half* from) {-#if EIGEN_CUDA_ARCH >= 350+#if __CUDA_ARCH__ >= 350    return __halves2half2(__ldg(from+0), __ldg(from+1)); #else   return __halves2half2(*(from+0), *(from+1));@@ -117,7 +116,7 @@ }  template<> __device__ EIGEN_STRONG_INLINE half2 plset<half2>(const Eigen::half& a) {-#if EIGEN_CUDA_ARCH >= 530+#if __CUDA_ARCH__ >= 530   return __halves2half2(a, __hadd(a, __float2half(1.0f))); #else   float f = __half2float(a) + 1.0f;@@ -126,7 +125,7 @@ }  template<> __device__ EIGEN_STRONG_INLINE half2 padd<half2>(const half2& a, const half2& b) {-#if EIGEN_CUDA_ARCH >= 530+#if __CUDA_ARCH__ >= 530   return __hadd2(a, b); #else   float a1 = __low2float(a);@@ -140,7 +139,7 @@ }  template<> __device__ EIGEN_STRONG_INLINE half2 psub<half2>(const half2& a, const half2& b) {-#if EIGEN_CUDA_ARCH >= 530+#if __CUDA_ARCH__ >= 530   return __hsub2(a, b); #else   float a1 = __low2float(a);@@ -154,7 +153,7 @@ }  template<> __device__ EIGEN_STRONG_INLINE half2 pnegate(const half2& a) {-#if EIGEN_CUDA_ARCH >= 530+#if __CUDA_ARCH__ >= 530   return __hneg2(a); #else   float a1 = __low2float(a);@@ -166,7 +165,7 @@ template<> __device__ EIGEN_STRONG_INLINE half2 pconj(const half2& a) { return a; }  template<> __device__ EIGEN_STRONG_INLINE half2 pmul<half2>(const half2& a, const half2& b) {-#if EIGEN_CUDA_ARCH >= 530+#if __CUDA_ARCH__ >= 530   return __hmul2(a, b); #else   float a1 = __low2float(a);@@ -180,7 +179,7 @@ }  template<> __device__ EIGEN_STRONG_INLINE half2 pmadd<half2>(const half2& a, const half2& b, const half2& c) {-#if EIGEN_CUDA_ARCH >= 530+#if __CUDA_ARCH__ >= 530    return __hfma2(a, b, c); #else   float a1 = __low2float(a);@@ -226,17 +225,17 @@ }  template<> __device__ EIGEN_STRONG_INLINE Eigen::half predux<half2>(const half2& a) {-#if EIGEN_CUDA_ARCH >= 530+#if __CUDA_ARCH__ >= 530   return __hadd(__low2half(a), __high2half(a)); #else   float a1 = __low2float(a);   float a2 = __high2float(a);-  return Eigen::half(__float2half(a1 + a2));+  return Eigen::half(half_impl::raw_uint16_to_half(__float2half_rn(a1 + a2))); #endif }  template<> __device__ EIGEN_STRONG_INLINE Eigen::half predux_max<half2>(const half2& a) {-#if EIGEN_CUDA_ARCH >= 530+#if __CUDA_ARCH__ >= 530   __half first = __low2half(a);   __half second = __high2half(a);   return __hgt(first, second) ? first : second;@@ -248,7 +247,7 @@ }  template<> __device__ EIGEN_STRONG_INLINE Eigen::half predux_min<half2>(const half2& a) {-#if EIGEN_CUDA_ARCH >= 530+#if __CUDA_ARCH__ >= 530   __half first = __low2half(a);   __half second = __high2half(a);   return __hlt(first, second) ? first : second;@@ -260,12 +259,12 @@ }  template<> __device__ EIGEN_STRONG_INLINE Eigen::half predux_mul<half2>(const half2& a) {-#if EIGEN_CUDA_ARCH >= 530+#if __CUDA_ARCH__ >= 530   return __hmul(__low2half(a), __high2half(a)); #else   float a1 = __low2float(a);   float a2 = __high2float(a);-  return Eigen::half(__float2half(a1 * a2));+  return Eigen::half(half_impl::raw_uint16_to_half(__float2half_rn(a1 * a2))); #endif } @@ -274,14 +273,6 @@   float a2 = __high2float(a);   float r1 = log1pf(a1);   float r2 = log1pf(a2);-  return __floats2half2_rn(r1, r2);-}--template<> __device__ EIGEN_STRONG_INLINE half2 pexpm1<half2>(const half2& a) {-  float a1 = __low2float(a);-  float a2 = __high2float(a);-  float r1 = expm1f(a1);-  float r2 = expm1f(a2);   return __floats2half2_rn(r1, r2); } 
eigen3/Eigen/src/Core/arch/CUDA/TypeCasting.h view
@@ -19,7 +19,7 @@   EIGEN_EMPTY_STRUCT_CTOR(scalar_cast_op)   typedef Eigen::half result_type;   EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Eigen::half operator() (const float& a) const {-    #if defined(EIGEN_HAS_CUDA_FP16) && defined(EIGEN_CUDA_ARCH) && EIGEN_CUDA_ARCH >= 300+    #if defined(EIGEN_HAS_CUDA_FP16) && defined(__CUDA_ARCH__) && __CUDA_ARCH__ >= 300       return __float2half(a);     #else       return Eigen::half(a);@@ -37,7 +37,7 @@   EIGEN_EMPTY_STRUCT_CTOR(scalar_cast_op)   typedef Eigen::half result_type;   EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Eigen::half operator() (const int& a) const {-    #if defined(EIGEN_HAS_CUDA_FP16) && defined(EIGEN_CUDA_ARCH) && EIGEN_CUDA_ARCH >= 300+    #if defined(EIGEN_HAS_CUDA_FP16) && defined(__CUDA_ARCH__) && __CUDA_ARCH__ >= 300       return __float2half(static_cast<float>(a));     #else       return Eigen::half(static_cast<float>(a));@@ -55,7 +55,7 @@   EIGEN_EMPTY_STRUCT_CTOR(scalar_cast_op)   typedef float result_type;   EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE float operator() (const Eigen::half& a) const {-    #if defined(EIGEN_HAS_CUDA_FP16) && defined(EIGEN_CUDA_ARCH) && EIGEN_CUDA_ARCH >= 300+    #if defined(EIGEN_HAS_CUDA_FP16) && defined(__CUDA_ARCH__) && __CUDA_ARCH__ >= 300       return __half2float(a);     #else       return static_cast<float>(a);@@ -69,7 +69,7 @@   -#if defined(EIGEN_HAS_CUDA_FP16) && defined(EIGEN_CUDA_ARCH) && EIGEN_CUDA_ARCH >= 300+#if defined(EIGEN_HAS_CUDA_FP16) && defined(__CUDA_ARCH__) && __CUDA_ARCH__ >= 300  template <> struct type_casting_traits<Eigen::half, float> {
eigen3/Eigen/src/Core/arch/NEON/MathFunctions.h view
@@ -84,98 +84,6 @@   return y; } -template<> EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS EIGEN_UNUSED-Packet4f plog<Packet4f>(const Packet4f& _x)-{-  Packet4f x = _x;-  _EIGEN_DECLARE_CONST_Packet4f(1 , 1.0f);-  _EIGEN_DECLARE_CONST_Packet4f(half, 0.5f);-  _EIGEN_DECLARE_CONST_Packet4i(0x7f, 0x7f);--  _EIGEN_DECLARE_CONST_Packet4i(inv_mant_mask, ~0x7f800000);--  /* natural logarithm computed for 4 simultaneous float-    return NaN for x <= 0-  */-  _EIGEN_DECLARE_CONST_Packet4f(cephes_SQRTHF, 0.707106781186547524f);-  _EIGEN_DECLARE_CONST_Packet4f(cephes_log_p0, 7.0376836292E-2f);-  _EIGEN_DECLARE_CONST_Packet4f(cephes_log_p1, - 1.1514610310E-1f);-  _EIGEN_DECLARE_CONST_Packet4f(cephes_log_p2, 1.1676998740E-1f);-  _EIGEN_DECLARE_CONST_Packet4f(cephes_log_p3, - 1.2420140846E-1f);-  _EIGEN_DECLARE_CONST_Packet4f(cephes_log_p4, + 1.4249322787E-1f);-  _EIGEN_DECLARE_CONST_Packet4f(cephes_log_p5, - 1.6668057665E-1f);-  _EIGEN_DECLARE_CONST_Packet4f(cephes_log_p6, + 2.0000714765E-1f);-  _EIGEN_DECLARE_CONST_Packet4f(cephes_log_p7, - 2.4999993993E-1f);-  _EIGEN_DECLARE_CONST_Packet4f(cephes_log_p8, + 3.3333331174E-1f);-  _EIGEN_DECLARE_CONST_Packet4f(cephes_log_q1, -2.12194440e-4f);-  _EIGEN_DECLARE_CONST_Packet4f(cephes_log_q2, 0.693359375f);--  x = vmaxq_f32(x, vdupq_n_f32(0)); /* force flush to zero on denormal values */-  Packet4ui invalid_mask = vcleq_f32(x, vdupq_n_f32(0));--  Packet4i ux = vreinterpretq_s32_f32(x);--  Packet4i emm0 = vshrq_n_s32(ux, 23);--  /* keep only the fractional part */-  ux = vandq_s32(ux, p4i_inv_mant_mask);-  ux = vorrq_s32(ux, vreinterpretq_s32_f32(p4f_half));-  x = vreinterpretq_f32_s32(ux);--  emm0 = vsubq_s32(emm0, p4i_0x7f);-  Packet4f e = vcvtq_f32_s32(emm0);--  e = vaddq_f32(e, p4f_1);--  /* part2:-     if( x < SQRTHF ) {-       e -= 1;-       x = x + x - 1.0;-     } else { x = x - 1.0; }-  */-  Packet4ui mask = vcltq_f32(x, p4f_cephes_SQRTHF);-  Packet4f tmp = vreinterpretq_f32_u32(vandq_u32(vreinterpretq_u32_f32(x), mask));-  x = vsubq_f32(x, p4f_1);-  e = vsubq_f32(e, vreinterpretq_f32_u32(vandq_u32(vreinterpretq_u32_f32(p4f_1), mask)));-  x = vaddq_f32(x, tmp);--  Packet4f z = vmulq_f32(x,x);--  Packet4f y = p4f_cephes_log_p0;-  y = vmulq_f32(y, x);-  y = vaddq_f32(y, p4f_cephes_log_p1);-  y = vmulq_f32(y, x);-  y = vaddq_f32(y, p4f_cephes_log_p2);-  y = vmulq_f32(y, x);-  y = vaddq_f32(y, p4f_cephes_log_p3);-  y = vmulq_f32(y, x);-  y = vaddq_f32(y, p4f_cephes_log_p4);-  y = vmulq_f32(y, x);-  y = vaddq_f32(y, p4f_cephes_log_p5);-  y = vmulq_f32(y, x);-  y = vaddq_f32(y, p4f_cephes_log_p6);-  y = vmulq_f32(y, x);-  y = vaddq_f32(y, p4f_cephes_log_p7);-  y = vmulq_f32(y, x);-  y = vaddq_f32(y, p4f_cephes_log_p8);-  y = vmulq_f32(y, x);--  y = vmulq_f32(y, z);--  tmp = vmulq_f32(e, p4f_cephes_log_q1);-  y = vaddq_f32(y, tmp);---  tmp = vmulq_f32(z, p4f_half);-  y = vsubq_f32(y, tmp);--  tmp = vmulq_f32(e, p4f_cephes_log_q2);-  x = vaddq_f32(x, y);-  x = vaddq_f32(x, tmp);-  x = vreinterpretq_f32_u32(vorrq_u32(vreinterpretq_u32_f32(x), invalid_mask)); // negative arg will be NAN-  return x;-}- } // end namespace internal  } // end namespace Eigen
eigen3/Eigen/src/Core/arch/NEON/PacketMath.h view
@@ -112,7 +112,7 @@     // FIXME check the Has*     HasSin  = 0,     HasCos  = 0,-    HasLog  = 1,+    HasLog  = 0,     HasExp  = 1,     HasSqrt = 0   };
eigen3/Eigen/src/Core/arch/SSE/Complex.h view
@@ -128,7 +128,7 @@                                      _mm_cvtss_f32(_mm_shuffle_ps(from.v, from.v, 3))); } -template<> EIGEN_STRONG_INLINE void prefetch<std::complex<float> >(const std::complex<float> *   addr) { _mm_prefetch((const void*)(addr), _MM_HINT_T0); }+template<> EIGEN_STRONG_INLINE void prefetch<std::complex<float> >(const std::complex<float> *   addr) { _mm_prefetch((SsePrefetchPtrType)(addr), _MM_HINT_T0); }  template<> EIGEN_STRONG_INLINE std::complex<float>  pfirst<Packet2cf>(const Packet2cf& a) {@@ -324,7 +324,7 @@ template<> EIGEN_STRONG_INLINE void pstore <std::complex<double> >(std::complex<double> *   to, const Packet1cd& from) { EIGEN_DEBUG_ALIGNED_STORE pstore((double*)to, Packet2d(from.v)); } template<> EIGEN_STRONG_INLINE void pstoreu<std::complex<double> >(std::complex<double> *   to, const Packet1cd& from) { EIGEN_DEBUG_UNALIGNED_STORE pstoreu((double*)to, Packet2d(from.v)); } -template<> EIGEN_STRONG_INLINE void prefetch<std::complex<double> >(const std::complex<double> *   addr) { _mm_prefetch((const void*)(addr), _MM_HINT_T0); }+template<> EIGEN_STRONG_INLINE void prefetch<std::complex<double> >(const std::complex<double> *   addr) { _mm_prefetch((SsePrefetchPtrType)(addr), _MM_HINT_T0); }  template<> EIGEN_STRONG_INLINE std::complex<double>  pfirst<Packet1cd>(const Packet1cd& a) {
eigen3/Eigen/src/Core/arch/SSE/MathFunctions.h view
@@ -242,7 +242,7 @@   return pmax(pmul(x, Packet2d(_mm_castsi128_pd(emm0))), _x); } -/* evaluation of 4 sines at once, using SSE2 intrinsics.+/* evaluation of 4 sines at onces, using SSE2 intrinsics.     The code is the exact rewriting of the cephes sinf function.    Precision is excellent as long as x < 8192 (I did not bother to
eigen3/Eigen/src/Core/arch/SSE/PacketMath.h view
@@ -28,7 +28,7 @@ #endif #endif -#if (defined EIGEN_VECTORIZE_AVX) && (EIGEN_COMP_GNUC_STRICT || EIGEN_COMP_MINGW) && (__GXX_ABI_VERSION < 1004)+#if ((defined EIGEN_VECTORIZE_AVX) && (EIGEN_COMP_GNUC_STRICT || EIGEN_COMP_MINGW) && (__GXX_ABI_VERSION < 1004)) || EIGEN_OS_QNX // With GCC's default ABI version, a __m128 or __m256 are the same types and therefore we cannot // have overloads for both types without linking error. // One solution is to increase ABI version using -fabi-version=4 (or greater).@@ -45,7 +45,7 @@     m_val = v;     return *this;   }-+     T m_val; }; typedef eigen_packet_wrapper<__m128>  Packet4f;@@ -69,7 +69,7 @@  #define vec2d_swizzle1(v,p,q) \   (_mm_castsi128_pd(_mm_shuffle_epi32( _mm_castpd_si128(v), ((q*2+1)<<6|(q*2)<<4|(p*2+1)<<2|(p*2)))))-+   #define vec4f_swizzle2(a,b,p,q,r,s) \   (_mm_shuffle_ps( (a), (b), ((s)<<6|(r)<<4|(q)<<2|(p)))) @@ -190,7 +190,7 @@   return vec4f_swizzle1(_mm_load_ss(from),0,0,0,0); } #endif-+   template<> EIGEN_STRONG_INLINE Packet4f plset<Packet4f>(const float& a) { return _mm_add_ps(pset1<Packet4f>(a), _mm_set_ps(3,2,1,0)); } template<> EIGEN_STRONG_INLINE Packet2d plset<Packet2d>(const double& a) { return _mm_add_pd(pset1<Packet2d>(a),_mm_set_pd(1,0)); } template<> EIGEN_STRONG_INLINE Packet4i plset<Packet4i>(const int& a) { return _mm_add_epi32(pset1<Packet4i>(a),_mm_set_epi32(3,2,1,0)); }@@ -250,34 +250,8 @@ template<> EIGEN_STRONG_INLINE Packet2d pmadd(const Packet2d& a, const Packet2d& b, const Packet2d& c) { return _mm_fmadd_pd(a,b,c); } #endif -template<> EIGEN_STRONG_INLINE Packet4f pmin<Packet4f>(const Packet4f& a, const Packet4f& b) {-#if EIGEN_COMP_GNUC-  // There appears to be a bug in GCC, by which the optimizer may-  // flip the argument order in calls to _mm_min_ps, so we have to-  // resort to inline ASM here. This is supposed to be fixed in gcc6.3,-  // see also: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=72867-  Packet4f res = b;-  asm("minps %[a], %[res]" : [res] "+x" (res) : [a] "x" (a));-  return res;-#else-  // Arguments are reversed to match NaN propagation behavior of std::min.-  return _mm_min_ps(b, a);-#endif-}-template<> EIGEN_STRONG_INLINE Packet2d pmin<Packet2d>(const Packet2d& a, const Packet2d& b) {-#if EIGEN_COMP_GNUC-  // There appears to be a bug in GCC, by which the optimizer may-  // flip the argument order in calls to _mm_min_pd, so we have to-  // resort to inline ASM here. This is supposed to be fixed in gcc6.3,-  // see also: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=72867-  Packet2d res = b;-  asm("minpd %[a], %[res]" : [res] "+x" (res) : [a] "x" (a));-  return res;-#else-  // Arguments are reversed to match NaN propagation behavior of std::min.-  return _mm_min_pd(b, a);-#endif-}+template<> EIGEN_STRONG_INLINE Packet4f pmin<Packet4f>(const Packet4f& a, const Packet4f& b) { return _mm_min_ps(a,b); }+template<> EIGEN_STRONG_INLINE Packet2d pmin<Packet2d>(const Packet2d& a, const Packet2d& b) { return _mm_min_pd(a,b); } template<> EIGEN_STRONG_INLINE Packet4i pmin<Packet4i>(const Packet4i& a, const Packet4i& b) { #ifdef EIGEN_VECTORIZE_SSE4_1@@ -289,34 +263,8 @@ #endif } -template<> EIGEN_STRONG_INLINE Packet4f pmax<Packet4f>(const Packet4f& a, const Packet4f& b) {-#if EIGEN_COMP_GNUC-  // There appears to be a bug in GCC, by which the optimizer may-  // flip the argument order in calls to _mm_max_ps, so we have to-  // resort to inline ASM here. This is supposed to be fixed in gcc6.3,-  // see also: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=72867-  Packet4f res = b;-  asm("maxps %[a], %[res]" : [res] "+x" (res) : [a] "x" (a));-  return res;-#else-  // Arguments are reversed to match NaN propagation behavior of std::max.-  return _mm_max_ps(b, a);-#endif-}-template<> EIGEN_STRONG_INLINE Packet2d pmax<Packet2d>(const Packet2d& a, const Packet2d& b) {-#if EIGEN_COMP_GNUC-  // There appears to be a bug in GCC, by which the optimizer may-  // flip the argument order in calls to _mm_max_pd, so we have to-  // resort to inline ASM here. This is supposed to be fixed in gcc6.3,-  // see also: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=72867-  Packet2d res = b;-  asm("maxpd %[a], %[res]" : [res] "+x" (res) : [a] "x" (a));-  return res;-#else-  // Arguments are reversed to match NaN propagation behavior of std::max.-  return _mm_max_pd(b, a);-#endif-}+template<> EIGEN_STRONG_INLINE Packet4f pmax<Packet4f>(const Packet4f& a, const Packet4f& b) { return _mm_max_ps(a,b); }+template<> EIGEN_STRONG_INLINE Packet2d pmax<Packet2d>(const Packet2d& a, const Packet2d& b) { return _mm_max_pd(a,b); } template<> EIGEN_STRONG_INLINE Packet4i pmax<Packet4i>(const Packet4i& a, const Packet4i& b) { #ifdef EIGEN_VECTORIZE_SSE4_1@@ -461,10 +409,16 @@   pstore(to, Packet2d(vec2d_swizzle1(pa,0,0))); } +#if EIGEN_COMP_PGI+typedef const void * SsePrefetchPtrType;+#else+typedef const char * SsePrefetchPtrType;+#endif+ #ifndef EIGEN_VECTORIZE_AVX-template<> EIGEN_STRONG_INLINE void prefetch<float>(const float*   addr) { _mm_prefetch((const void*)(addr), _MM_HINT_T0); }-template<> EIGEN_STRONG_INLINE void prefetch<double>(const double* addr) { _mm_prefetch((const void*)(addr), _MM_HINT_T0); }-template<> EIGEN_STRONG_INLINE void prefetch<int>(const int*       addr) { _mm_prefetch((const void*)(addr), _MM_HINT_T0); }+template<> EIGEN_STRONG_INLINE void prefetch<float>(const float*   addr) { _mm_prefetch((SsePrefetchPtrType)(addr), _MM_HINT_T0); }+template<> EIGEN_STRONG_INLINE void prefetch<double>(const double* addr) { _mm_prefetch((SsePrefetchPtrType)(addr), _MM_HINT_T0); }+template<> EIGEN_STRONG_INLINE void prefetch<int>(const int*       addr) { _mm_prefetch((SsePrefetchPtrType)(addr), _MM_HINT_T0); } #endif  #if EIGEN_COMP_MSVC_STRICT && EIGEN_OS_WIN64
eigen3/Eigen/src/Core/arch/ZVector/Complex.h view
@@ -15,10 +15,6 @@  namespace internal { -#if !defined(__ARCH__) || (defined(__ARCH__) && __ARCH__ >= 12)-static Packet4ui  p4ui_CONJ_XOR = { 0x00000000, 0x80000000, 0x00000000, 0x80000000 }; //vec_mergeh((Packet4ui)p4i_ZERO, (Packet4ui)p4f_MZERO);-#endif- static Packet2ul  p2ul_CONJ_XOR1 = (Packet2ul) vec_sld((Packet4ui) p2d_ZERO_, (Packet4ui) p2l_ZERO, 8);//{ 0x8000000000000000, 0x0000000000000000 }; static Packet2ul  p2ul_CONJ_XOR2 = (Packet2ul) vec_sld((Packet4ui) p2l_ZERO,  (Packet4ui) p2d_ZERO_, 8);//{ 0x8000000000000000, 0x0000000000000000 }; @@ -33,14 +29,10 @@ {   EIGEN_STRONG_INLINE Packet2cf() {}   EIGEN_STRONG_INLINE explicit Packet2cf(const Packet4f& a) : v(a) {}-#if !defined(__ARCH__) || (defined(__ARCH__) && __ARCH__ < 12)   union {     Packet4f v;     Packet1cd cd[2];   };-#else-  Packet4f v;-#endif };  template<> struct packet_traits<std::complex<float> >  : default_packet_traits@@ -97,27 +89,63 @@ /* Forward declaration */ EIGEN_STRONG_INLINE void ptranspose(PacketBlock<Packet2cf,2>& kernel); -/* complex<double> first */+template<> EIGEN_STRONG_INLINE Packet2cf pload <Packet2cf>(const std::complex<float>* from)  { EIGEN_DEBUG_ALIGNED_LOAD return Packet2cf(pload<Packet4f>((const float*)from)); } template<> EIGEN_STRONG_INLINE Packet1cd pload <Packet1cd>(const std::complex<double>* from) { EIGEN_DEBUG_ALIGNED_LOAD return Packet1cd(pload<Packet2d>((const double*)from)); }+template<> EIGEN_STRONG_INLINE Packet2cf ploadu<Packet2cf>(const std::complex<float>* from)  { EIGEN_DEBUG_UNALIGNED_LOAD return Packet2cf(ploadu<Packet4f>((const float*)from)); } template<> EIGEN_STRONG_INLINE Packet1cd ploadu<Packet1cd>(const std::complex<double>* from) { EIGEN_DEBUG_UNALIGNED_LOAD return Packet1cd(ploadu<Packet2d>((const double*)from)); }+template<> EIGEN_STRONG_INLINE void pstore <std::complex<float> >(std::complex<float> *     to, const Packet2cf& from) { EIGEN_DEBUG_ALIGNED_STORE pstore((float*)to, from.v); } template<> EIGEN_STRONG_INLINE void pstore <std::complex<double> >(std::complex<double> *   to, const Packet1cd& from) { EIGEN_DEBUG_ALIGNED_STORE pstore((double*)to, from.v); }+template<> EIGEN_STRONG_INLINE void pstoreu<std::complex<float> >(std::complex<float> *     to, const Packet2cf& from) { EIGEN_DEBUG_UNALIGNED_STORE pstoreu((float*)to, from.v); } template<> EIGEN_STRONG_INLINE void pstoreu<std::complex<double> >(std::complex<double> *   to, const Packet1cd& from) { EIGEN_DEBUG_UNALIGNED_STORE pstoreu((double*)to, from.v); }  template<> EIGEN_STRONG_INLINE Packet1cd pset1<Packet1cd>(const std::complex<double>&  from) { /* here we really have to use unaligned loads :( */ return ploadu<Packet1cd>(&from); } +template<> EIGEN_STRONG_INLINE Packet2cf pset1<Packet2cf>(const std::complex<float>&  from)+{+  Packet2cf res;+  res.cd[0] = Packet1cd(vec_ld2f((const float *)&from));+  res.cd[1] = res.cd[0];+  return res;+}+template<> EIGEN_DEVICE_FUNC inline Packet2cf pgather<std::complex<float>, Packet2cf>(const std::complex<float>* from, Index stride)+{+  std::complex<float> EIGEN_ALIGN16 af[2];+  af[0] = from[0*stride];+  af[1] = from[1*stride];+  return pload<Packet2cf>(af);+} template<> EIGEN_DEVICE_FUNC inline Packet1cd pgather<std::complex<double>, Packet1cd>(const std::complex<double>* from, Index stride EIGEN_UNUSED) {   return pload<Packet1cd>(from); }+template<> EIGEN_DEVICE_FUNC inline void pscatter<std::complex<float>, Packet2cf>(std::complex<float>* to, const Packet2cf& from, Index stride)+{+  std::complex<float> EIGEN_ALIGN16 af[2];+  pstore<std::complex<float> >((std::complex<float> *) af, from);+  to[0*stride] = af[0];+  to[1*stride] = af[1];+} template<> EIGEN_DEVICE_FUNC inline void pscatter<std::complex<double>, Packet1cd>(std::complex<double>* to, const Packet1cd& from, Index stride EIGEN_UNUSED) {   pstore<std::complex<double> >(to, from); }++template<> EIGEN_STRONG_INLINE Packet2cf padd<Packet2cf>(const Packet2cf& a, const Packet2cf& b) { return Packet2cf(padd<Packet4f>(a.v, b.v)); } template<> EIGEN_STRONG_INLINE Packet1cd padd<Packet1cd>(const Packet1cd& a, const Packet1cd& b) { return Packet1cd(a.v + b.v); }+template<> EIGEN_STRONG_INLINE Packet2cf psub<Packet2cf>(const Packet2cf& a, const Packet2cf& b) { return Packet2cf(psub<Packet4f>(a.v, b.v)); } template<> EIGEN_STRONG_INLINE Packet1cd psub<Packet1cd>(const Packet1cd& a, const Packet1cd& b) { return Packet1cd(a.v - b.v); } template<> EIGEN_STRONG_INLINE Packet1cd pnegate(const Packet1cd& a) { return Packet1cd(pnegate(Packet2d(a.v))); }+template<> EIGEN_STRONG_INLINE Packet2cf pnegate(const Packet2cf& a) { return Packet2cf(pnegate(Packet4f(a.v))); } template<> EIGEN_STRONG_INLINE Packet1cd pconj(const Packet1cd& a) { return Packet1cd((Packet2d)vec_xor((Packet2d)a.v, (Packet2d)p2ul_CONJ_XOR2)); }+template<> EIGEN_STRONG_INLINE Packet2cf pconj(const Packet2cf& a)+{+  Packet2cf res;+  res.v.v4f[0] = pconj(Packet1cd(reinterpret_cast<Packet2d>(a.v.v4f[0]))).v;+  res.v.v4f[1] = pconj(Packet1cd(reinterpret_cast<Packet2d>(a.v.v4f[1]))).v;+  return res;+}+ template<> EIGEN_STRONG_INLINE Packet1cd pmul<Packet1cd>(const Packet1cd& a, const Packet1cd& b) {   Packet2d a_re, a_im, v1, v2;@@ -135,182 +163,45 @@    return Packet1cd(v1 + v2); }-template<> EIGEN_STRONG_INLINE Packet1cd pand    <Packet1cd>(const Packet1cd& a, const Packet1cd& b) { return Packet1cd(vec_and(a.v,b.v)); }-template<> EIGEN_STRONG_INLINE Packet1cd por     <Packet1cd>(const Packet1cd& a, const Packet1cd& b) { return Packet1cd(vec_or(a.v,b.v)); }-template<> EIGEN_STRONG_INLINE Packet1cd pxor    <Packet1cd>(const Packet1cd& a, const Packet1cd& b) { return Packet1cd(vec_xor(a.v,b.v)); }-template<> EIGEN_STRONG_INLINE Packet1cd pandnot <Packet1cd>(const Packet1cd& a, const Packet1cd& b) { return Packet1cd(vec_and(a.v, vec_nor(b.v,b.v))); }-template<> EIGEN_STRONG_INLINE Packet1cd ploaddup<Packet1cd>(const std::complex<double>*     from) {  return pset1<Packet1cd>(*from); }--template<> EIGEN_STRONG_INLINE void prefetch<std::complex<double> >(const std::complex<double> *   addr) { EIGEN_ZVECTOR_PREFETCH(addr); }--template<> EIGEN_STRONG_INLINE std::complex<double>  pfirst<Packet1cd>(const Packet1cd& a)-{-  std::complex<double> EIGEN_ALIGN16 res;-  pstore<std::complex<double> >(&res, a);--  return res;-}--template<> EIGEN_STRONG_INLINE Packet1cd preverse(const Packet1cd& a) { return a; }-template<> EIGEN_STRONG_INLINE std::complex<double> predux<Packet1cd>(const Packet1cd& a)-{-  return pfirst(a);-}-template<> EIGEN_STRONG_INLINE Packet1cd preduxp<Packet1cd>(const Packet1cd* vecs)-{-  return vecs[0];-}-template<> EIGEN_STRONG_INLINE std::complex<double> predux_mul<Packet1cd>(const Packet1cd& a)-{-  return pfirst(a);-}-template<int Offset>-struct palign_impl<Offset,Packet1cd>-{-  static EIGEN_STRONG_INLINE void run(Packet1cd& /*first*/, const Packet1cd& /*second*/)-  {-    // FIXME is it sure we never have to align a Packet1cd?-    // Even though a std::complex<double> has 16 bytes, it is not necessarily aligned on a 16 bytes boundary...-  }-};--template<> struct conj_helper<Packet1cd, Packet1cd, false,true>-{-  EIGEN_STRONG_INLINE Packet1cd pmadd(const Packet1cd& x, const Packet1cd& y, const Packet1cd& c) const-  { return padd(pmul(x,y),c); }--  EIGEN_STRONG_INLINE Packet1cd pmul(const Packet1cd& a, const Packet1cd& b) const-  {-    return internal::pmul(a, pconj(b));-  }-};--template<> struct conj_helper<Packet1cd, Packet1cd, true,false>-{-  EIGEN_STRONG_INLINE Packet1cd pmadd(const Packet1cd& x, const Packet1cd& y, const Packet1cd& c) const-  { return padd(pmul(x,y),c); }--  EIGEN_STRONG_INLINE Packet1cd pmul(const Packet1cd& a, const Packet1cd& b) const-  {-    return internal::pmul(pconj(a), b);-  }-};--template<> struct conj_helper<Packet1cd, Packet1cd, true,true>-{-  EIGEN_STRONG_INLINE Packet1cd pmadd(const Packet1cd& x, const Packet1cd& y, const Packet1cd& c) const-  { return padd(pmul(x,y),c); }--  EIGEN_STRONG_INLINE Packet1cd pmul(const Packet1cd& a, const Packet1cd& b) const-  {-    return pconj(internal::pmul(a, b));-  }-};--EIGEN_MAKE_CONJ_HELPER_CPLX_REAL(Packet1cd,Packet2d)--template<> EIGEN_STRONG_INLINE Packet1cd pdiv<Packet1cd>(const Packet1cd& a, const Packet1cd& b)-{-  // TODO optimize it for AltiVec-  Packet1cd res = conj_helper<Packet1cd,Packet1cd,false,true>().pmul(a,b);-  Packet2d s = vec_madd(b.v, b.v, p2d_ZERO_);-  return Packet1cd(pdiv(res.v, s + vec_perm(s, s, p16uc_REVERSE64)));-}--EIGEN_STRONG_INLINE Packet1cd pcplxflip/*<Packet1cd>*/(const Packet1cd& x)-{-  return Packet1cd(preverse(Packet2d(x.v)));-}--EIGEN_STRONG_INLINE void ptranspose(PacketBlock<Packet1cd,2>& kernel)-{-  Packet2d tmp = vec_perm(kernel.packet[0].v, kernel.packet[1].v, p16uc_TRANSPOSE64_HI);-  kernel.packet[1].v = vec_perm(kernel.packet[0].v, kernel.packet[1].v, p16uc_TRANSPOSE64_LO);-  kernel.packet[0].v = tmp;-}--/* complex<float> follows */-template<> EIGEN_STRONG_INLINE Packet2cf pload <Packet2cf>(const std::complex<float>* from)  { EIGEN_DEBUG_ALIGNED_LOAD return Packet2cf(pload<Packet4f>((const float*)from)); }-template<> EIGEN_STRONG_INLINE Packet2cf ploadu<Packet2cf>(const std::complex<float>* from)  { EIGEN_DEBUG_UNALIGNED_LOAD return Packet2cf(ploadu<Packet4f>((const float*)from)); }-template<> EIGEN_STRONG_INLINE void pstore <std::complex<float> >(std::complex<float> *     to, const Packet2cf& from) { EIGEN_DEBUG_ALIGNED_STORE pstore((float*)to, from.v); }-template<> EIGEN_STRONG_INLINE void pstoreu<std::complex<float> >(std::complex<float> *     to, const Packet2cf& from) { EIGEN_DEBUG_UNALIGNED_STORE pstoreu((float*)to, from.v); }--template<> EIGEN_STRONG_INLINE std::complex<float>  pfirst<Packet2cf>(const Packet2cf& a)-{-  std::complex<float> EIGEN_ALIGN16 res[2];-  pstore<std::complex<float> >(res, a);--  return res[0];-}---#if !defined(__ARCH__) || (defined(__ARCH__) && __ARCH__ < 12)-template<> EIGEN_STRONG_INLINE Packet2cf pset1<Packet2cf>(const std::complex<float>&  from)-{-  Packet2cf res;-  res.cd[0] = Packet1cd(vec_ld2f((const float *)&from));-  res.cd[1] = res.cd[0];-  return res;-}-#else-template<> EIGEN_STRONG_INLINE Packet2cf pset1<Packet2cf>(const std::complex<float>&  from)+template<> EIGEN_STRONG_INLINE Packet2cf pmul<Packet2cf>(const Packet2cf& a, const Packet2cf& b) {   Packet2cf res;-  if((std::ptrdiff_t(&from) % 16) == 0)-    res.v = pload<Packet4f>((const float *)&from);-  else-    res.v = ploadu<Packet4f>((const float *)&from);-  res.v = vec_perm(res.v, res.v, p16uc_PSET64_HI);+  res.v.v4f[0] = pmul(Packet1cd(reinterpret_cast<Packet2d>(a.v.v4f[0])), Packet1cd(reinterpret_cast<Packet2d>(b.v.v4f[0]))).v;+  res.v.v4f[1] = pmul(Packet1cd(reinterpret_cast<Packet2d>(a.v.v4f[1])), Packet1cd(reinterpret_cast<Packet2d>(b.v.v4f[1]))).v;   return res; }-#endif -template<> EIGEN_DEVICE_FUNC inline Packet2cf pgather<std::complex<float>, Packet2cf>(const std::complex<float>* from, Index stride)-{-  std::complex<float> EIGEN_ALIGN16 af[2];-  af[0] = from[0*stride];-  af[1] = from[1*stride];-  return pload<Packet2cf>(af);-}-template<> EIGEN_DEVICE_FUNC inline void pscatter<std::complex<float>, Packet2cf>(std::complex<float>* to, const Packet2cf& from, Index stride)-{-  std::complex<float> EIGEN_ALIGN16 af[2];-  pstore<std::complex<float> >((std::complex<float> *) af, from);-  to[0*stride] = af[0];-  to[1*stride] = af[1];-}--template<> EIGEN_STRONG_INLINE Packet2cf padd<Packet2cf>(const Packet2cf& a, const Packet2cf& b) { return Packet2cf(padd<Packet4f>(a.v, b.v)); }-template<> EIGEN_STRONG_INLINE Packet2cf psub<Packet2cf>(const Packet2cf& a, const Packet2cf& b) { return Packet2cf(psub<Packet4f>(a.v, b.v)); }-template<> EIGEN_STRONG_INLINE Packet2cf pnegate(const Packet2cf& a) { return Packet2cf(pnegate(Packet4f(a.v))); }-+template<> EIGEN_STRONG_INLINE Packet1cd pand   <Packet1cd>(const Packet1cd& a, const Packet1cd& b) { return Packet1cd(vec_and(a.v,b.v)); } template<> EIGEN_STRONG_INLINE Packet2cf pand   <Packet2cf>(const Packet2cf& a, const Packet2cf& b) { return Packet2cf(pand<Packet4f>(a.v,b.v)); }+template<> EIGEN_STRONG_INLINE Packet1cd por    <Packet1cd>(const Packet1cd& a, const Packet1cd& b) { return Packet1cd(vec_or(a.v,b.v)); } template<> EIGEN_STRONG_INLINE Packet2cf por    <Packet2cf>(const Packet2cf& a, const Packet2cf& b) { return Packet2cf(por<Packet4f>(a.v,b.v)); }+template<> EIGEN_STRONG_INLINE Packet1cd pxor   <Packet1cd>(const Packet1cd& a, const Packet1cd& b) { return Packet1cd(vec_xor(a.v,b.v)); } template<> EIGEN_STRONG_INLINE Packet2cf pxor   <Packet2cf>(const Packet2cf& a, const Packet2cf& b) { return Packet2cf(pxor<Packet4f>(a.v,b.v)); }+template<> EIGEN_STRONG_INLINE Packet1cd pandnot<Packet1cd>(const Packet1cd& a, const Packet1cd& b) { return Packet1cd(vec_and(a.v, vec_nor(b.v,b.v))); } template<> EIGEN_STRONG_INLINE Packet2cf pandnot<Packet2cf>(const Packet2cf& a, const Packet2cf& b) { return Packet2cf(pandnot<Packet4f>(a.v,b.v)); } +template<> EIGEN_STRONG_INLINE Packet1cd ploaddup<Packet1cd>(const std::complex<double>*     from) {  return pset1<Packet1cd>(*from); } template<> EIGEN_STRONG_INLINE Packet2cf ploaddup<Packet2cf>(const std::complex<float>*      from) {  return pset1<Packet2cf>(*from); }  template<> EIGEN_STRONG_INLINE void prefetch<std::complex<float> >(const std::complex<float> *     addr) { EIGEN_ZVECTOR_PREFETCH(addr); }-+template<> EIGEN_STRONG_INLINE void prefetch<std::complex<double> >(const std::complex<double> *   addr) { EIGEN_ZVECTOR_PREFETCH(addr); } -#if !defined(__ARCH__) || (defined(__ARCH__) && __ARCH__ < 12)-template<> EIGEN_STRONG_INLINE Packet2cf pconj(const Packet2cf& a)+template<> EIGEN_STRONG_INLINE std::complex<double>  pfirst<Packet1cd>(const Packet1cd& a) {-  Packet2cf res;-  res.v.v4f[0] = pconj(Packet1cd(reinterpret_cast<Packet2d>(a.v.v4f[0]))).v;-  res.v.v4f[1] = pconj(Packet1cd(reinterpret_cast<Packet2d>(a.v.v4f[1]))).v;+  std::complex<double> EIGEN_ALIGN16 res;+  pstore<std::complex<double> >(&res, a);+   return res; }--template<> EIGEN_STRONG_INLINE Packet2cf pmul<Packet2cf>(const Packet2cf& a, const Packet2cf& b)+template<> EIGEN_STRONG_INLINE std::complex<float>  pfirst<Packet2cf>(const Packet2cf& a) {-  Packet2cf res;-  res.v.v4f[0] = pmul(Packet1cd(reinterpret_cast<Packet2d>(a.v.v4f[0])), Packet1cd(reinterpret_cast<Packet2d>(b.v.v4f[0]))).v;-  res.v.v4f[1] = pmul(Packet1cd(reinterpret_cast<Packet2d>(a.v.v4f[1])), Packet1cd(reinterpret_cast<Packet2d>(b.v.v4f[1]))).v;-  return res;+  std::complex<float> EIGEN_ALIGN16 res[2];+  pstore<std::complex<float> >(res, a);++  return res[0]; } +template<> EIGEN_STRONG_INLINE Packet1cd preverse(const Packet1cd& a) { return a; } template<> EIGEN_STRONG_INLINE Packet2cf preverse(const Packet2cf& a) {   Packet2cf res;@@ -319,6 +210,10 @@   return res; } +template<> EIGEN_STRONG_INLINE std::complex<double> predux<Packet1cd>(const Packet1cd& a)+{+  return pfirst(a);+} template<> EIGEN_STRONG_INLINE std::complex<float> predux<Packet2cf>(const Packet2cf& a) {   std::complex<float> res;@@ -327,6 +222,10 @@   return res; } +template<> EIGEN_STRONG_INLINE Packet1cd preduxp<Packet1cd>(const Packet1cd* vecs)+{+  return vecs[0];+} template<> EIGEN_STRONG_INLINE Packet2cf preduxp<Packet2cf>(const Packet2cf* vecs) {   PacketBlock<Packet2cf,2> transpose;@@ -337,6 +236,10 @@   return padd<Packet2cf>(transpose.packet[0], transpose.packet[1]); }  +template<> EIGEN_STRONG_INLINE std::complex<double> predux_mul<Packet1cd>(const Packet1cd& a)+{+  return pfirst(a);+} template<> EIGEN_STRONG_INLINE std::complex<float> predux_mul<Packet2cf>(const Packet2cf& a) {   std::complex<float> res;@@ -346,6 +249,16 @@ }  template<int Offset>+struct palign_impl<Offset,Packet1cd>+{+  static EIGEN_STRONG_INLINE void run(Packet1cd& /*first*/, const Packet1cd& /*second*/)+  {+    // FIXME is it sure we never have to align a Packet1cd?+    // Even though a std::complex<double> has 16 bytes, it is not necessarily aligned on a 16 bytes boundary...+  }+};++template<int Offset> struct palign_impl<Offset,Packet2cf> {   static EIGEN_STRONG_INLINE void run(Packet2cf& first, const Packet2cf& second)@@ -357,143 +270,39 @@   } }; -template<> struct conj_helper<Packet2cf, Packet2cf, false,true>+template<> struct conj_helper<Packet1cd, Packet1cd, false,true> {-  EIGEN_STRONG_INLINE Packet2cf pmadd(const Packet2cf& x, const Packet2cf& y, const Packet2cf& c) const+  EIGEN_STRONG_INLINE Packet1cd pmadd(const Packet1cd& x, const Packet1cd& y, const Packet1cd& c) const   { return padd(pmul(x,y),c); } -  EIGEN_STRONG_INLINE Packet2cf pmul(const Packet2cf& a, const Packet2cf& b) const+  EIGEN_STRONG_INLINE Packet1cd pmul(const Packet1cd& a, const Packet1cd& b) const   {     return internal::pmul(a, pconj(b));   } }; -template<> struct conj_helper<Packet2cf, Packet2cf, true,false>+template<> struct conj_helper<Packet1cd, Packet1cd, true,false> {-  EIGEN_STRONG_INLINE Packet2cf pmadd(const Packet2cf& x, const Packet2cf& y, const Packet2cf& c) const+  EIGEN_STRONG_INLINE Packet1cd pmadd(const Packet1cd& x, const Packet1cd& y, const Packet1cd& c) const   { return padd(pmul(x,y),c); } -  EIGEN_STRONG_INLINE Packet2cf pmul(const Packet2cf& a, const Packet2cf& b) const+  EIGEN_STRONG_INLINE Packet1cd pmul(const Packet1cd& a, const Packet1cd& b) const   {     return internal::pmul(pconj(a), b);   } }; -template<> struct conj_helper<Packet2cf, Packet2cf, true,true>+template<> struct conj_helper<Packet1cd, Packet1cd, true,true> {-  EIGEN_STRONG_INLINE Packet2cf pmadd(const Packet2cf& x, const Packet2cf& y, const Packet2cf& c) const+  EIGEN_STRONG_INLINE Packet1cd pmadd(const Packet1cd& x, const Packet1cd& y, const Packet1cd& c) const   { return padd(pmul(x,y),c); } -  EIGEN_STRONG_INLINE Packet2cf pmul(const Packet2cf& a, const Packet2cf& b) const+  EIGEN_STRONG_INLINE Packet1cd pmul(const Packet1cd& a, const Packet1cd& b) const   {     return pconj(internal::pmul(a, b));   } }; -EIGEN_MAKE_CONJ_HELPER_CPLX_REAL(Packet2cf,Packet4f)--template<> EIGEN_STRONG_INLINE Packet2cf pdiv<Packet2cf>(const Packet2cf& a, const Packet2cf& b)-{-  // TODO optimize it for AltiVec-  Packet2cf res;-  res.cd[0] = pdiv<Packet1cd>(a.cd[0], b.cd[0]);-  res.cd[1] = pdiv<Packet1cd>(a.cd[1], b.cd[1]);-  return res;-}--EIGEN_STRONG_INLINE Packet2cf pcplxflip/*<Packet2cf>*/(const Packet2cf& x)-{-  Packet2cf res;-  res.cd[0] = pcplxflip(x.cd[0]);-  res.cd[1] = pcplxflip(x.cd[1]);-  return res;-}--EIGEN_STRONG_INLINE void ptranspose(PacketBlock<Packet2cf,2>& kernel)-{-  Packet1cd tmp = kernel.packet[0].cd[1];-  kernel.packet[0].cd[1] = kernel.packet[1].cd[0];-  kernel.packet[1].cd[0] = tmp;-}--template<> EIGEN_STRONG_INLINE Packet2cf pblend(const Selector<2>& ifPacket, const Packet2cf& thenPacket, const Packet2cf& elsePacket) {-  Packet2cf result;-  const Selector<4> ifPacket4 = { ifPacket.select[0], ifPacket.select[0], ifPacket.select[1], ifPacket.select[1] };-  result.v = pblend<Packet4f>(ifPacket4, thenPacket.v, elsePacket.v);-  return result;-}-#else-template<> EIGEN_STRONG_INLINE Packet2cf pconj(const Packet2cf& a) { return Packet2cf(pxor<Packet4f>(a.v, reinterpret_cast<Packet4f>(p4ui_CONJ_XOR))); }-template<> EIGEN_STRONG_INLINE Packet2cf pmul<Packet2cf>(const Packet2cf& a, const Packet2cf& b)-{-  Packet4f a_re, a_im, prod, prod_im;--  // Permute and multiply the real parts of a and b-  a_re = vec_perm(a.v, a.v, p16uc_PSET32_WODD);-  -  // Get the imaginary parts of a-  a_im = vec_perm(a.v, a.v, p16uc_PSET32_WEVEN);--  // multiply a_im * b and get the conjugate result-  prod_im = a_im * b.v;-  prod_im = pxor<Packet4f>(prod_im, reinterpret_cast<Packet4f>(p4ui_CONJ_XOR));-  // permute back to a proper order-  prod_im = vec_perm(prod_im, prod_im, p16uc_COMPLEX32_REV);--  // multiply a_re * b, add prod_im-  prod = pmadd<Packet4f>(a_re, b.v, prod_im);- -  return Packet2cf(prod);-}--template<> EIGEN_STRONG_INLINE Packet2cf preverse(const Packet2cf& a)-{-  Packet4f rev_a;-  rev_a = vec_perm(a.v, a.v, p16uc_COMPLEX32_REV2);-  return Packet2cf(rev_a);-}--template<> EIGEN_STRONG_INLINE std::complex<float> predux<Packet2cf>(const Packet2cf& a)-{-  Packet4f b;-  b = vec_sld(a.v, a.v, 8);-  b = padd<Packet4f>(a.v, b);-  return pfirst<Packet2cf>(Packet2cf(b));-}--template<> EIGEN_STRONG_INLINE Packet2cf preduxp<Packet2cf>(const Packet2cf* vecs)-{-  Packet4f b1, b2;-  b1 = vec_sld(vecs[0].v, vecs[1].v, 8);-  b2 = vec_sld(vecs[1].v, vecs[0].v, 8);-  b2 = vec_sld(b2, b2, 8);-  b2 = padd<Packet4f>(b1, b2);--  return Packet2cf(b2);-}--template<> EIGEN_STRONG_INLINE std::complex<float> predux_mul<Packet2cf>(const Packet2cf& a)-{-  Packet4f b;-  Packet2cf prod;-  b = vec_sld(a.v, a.v, 8);-  prod = pmul<Packet2cf>(a, Packet2cf(b));--  return pfirst<Packet2cf>(prod);-}--template<int Offset>-struct palign_impl<Offset,Packet2cf>-{-  static EIGEN_STRONG_INLINE void run(Packet2cf& first, const Packet2cf& second)-  {-    if (Offset==1)-    {-      first.v = vec_sld(first.v, second.v, 8);-    }-  }-};- template<> struct conj_helper<Packet2cf, Packet2cf, false,true> {   EIGEN_STRONG_INLINE Packet2cf pmadd(const Packet2cf& x, const Packet2cf& y, const Packet2cf& c) const@@ -528,33 +337,58 @@ };  EIGEN_MAKE_CONJ_HELPER_CPLX_REAL(Packet2cf,Packet4f)+EIGEN_MAKE_CONJ_HELPER_CPLX_REAL(Packet1cd,Packet2d) +template<> EIGEN_STRONG_INLINE Packet1cd pdiv<Packet1cd>(const Packet1cd& a, const Packet1cd& b)+{+  // TODO optimize it for AltiVec+  Packet1cd res = conj_helper<Packet1cd,Packet1cd,false,true>().pmul(a,b);+  Packet2d s = vec_madd(b.v, b.v, p2d_ZERO_);+  return Packet1cd(pdiv(res.v, s + vec_perm(s, s, p16uc_REVERSE64)));+}+ template<> EIGEN_STRONG_INLINE Packet2cf pdiv<Packet2cf>(const Packet2cf& a, const Packet2cf& b) {   // TODO optimize it for AltiVec-  Packet2cf res = conj_helper<Packet2cf,Packet2cf,false,true>().pmul(a, b);-  Packet4f s = pmul<Packet4f>(b.v, b.v);-  return Packet2cf(pdiv(res.v, padd<Packet4f>(s, vec_perm(s, s, p16uc_COMPLEX32_REV))));+  Packet2cf res;+  res.cd[0] = pdiv<Packet1cd>(a.cd[0], b.cd[0]);+  res.cd[1] = pdiv<Packet1cd>(a.cd[1], b.cd[1]);+  return res; } -template<> EIGEN_STRONG_INLINE Packet2cf pcplxflip<Packet2cf>(const Packet2cf& x)+EIGEN_STRONG_INLINE Packet1cd pcplxflip/*<Packet1cd>*/(const Packet1cd& x) {-  return Packet2cf(vec_perm(x.v, x.v, p16uc_COMPLEX32_REV));+  return Packet1cd(preverse(Packet2d(x.v))); } -EIGEN_STRONG_INLINE void ptranspose(PacketBlock<Packet2cf,2>& kernel)+EIGEN_STRONG_INLINE Packet2cf pcplxflip/*<Packet2cf>*/(const Packet2cf& x) {-  Packet4f tmp = vec_perm(kernel.packet[0].v, kernel.packet[1].v, p16uc_TRANSPOSE64_HI);+  Packet2cf res;+  res.cd[0] = pcplxflip(x.cd[0]);+  res.cd[1] = pcplxflip(x.cd[1]);+  return res;+}++EIGEN_STRONG_INLINE void ptranspose(PacketBlock<Packet1cd,2>& kernel)+{+  Packet2d tmp = vec_perm(kernel.packet[0].v, kernel.packet[1].v, p16uc_TRANSPOSE64_HI);   kernel.packet[1].v = vec_perm(kernel.packet[0].v, kernel.packet[1].v, p16uc_TRANSPOSE64_LO);   kernel.packet[0].v = tmp; } +EIGEN_STRONG_INLINE void ptranspose(PacketBlock<Packet2cf,2>& kernel)+{+  Packet1cd tmp = kernel.packet[0].cd[1];+  kernel.packet[0].cd[1] = kernel.packet[1].cd[0];+  kernel.packet[1].cd[0] = tmp;+}+ template<> EIGEN_STRONG_INLINE Packet2cf pblend(const Selector<2>& ifPacket, const Packet2cf& thenPacket, const Packet2cf& elsePacket) {   Packet2cf result;-  result.v = reinterpret_cast<Packet4f>(pblend<Packet2d>(ifPacket, reinterpret_cast<Packet2d>(thenPacket.v), reinterpret_cast<Packet2d>(elsePacket.v)));+  const Selector<4> ifPacket4 = { ifPacket.select[0], ifPacket.select[0], ifPacket.select[1], ifPacket.select[1] };+  result.v = pblend<Packet4f>(ifPacket4, thenPacket.v, elsePacket.v);   return result; }-#endif  } // end namespace internal 
eigen3/Eigen/src/Core/arch/ZVector/MathFunctions.h view
@@ -20,50 +20,6 @@  namespace internal { -#if !defined(__ARCH__) || (defined(__ARCH__) && __ARCH__ >= 12)-static _EIGEN_DECLARE_CONST_Packet4f(1 , 1.0f);-static _EIGEN_DECLARE_CONST_Packet4f(half, 0.5f);-static _EIGEN_DECLARE_CONST_Packet4i(0x7f, 0x7f);-static _EIGEN_DECLARE_CONST_Packet4i(23, 23);--static _EIGEN_DECLARE_CONST_Packet4f_FROM_INT(inv_mant_mask, ~0x7f800000);--/* the smallest non denormalized float number */-static _EIGEN_DECLARE_CONST_Packet4f_FROM_INT(min_norm_pos,  0x00800000);-static _EIGEN_DECLARE_CONST_Packet4f_FROM_INT(minus_inf,     0xff800000); // -1.f/0.f-static _EIGEN_DECLARE_CONST_Packet4f_FROM_INT(minus_nan,     0xffffffff);-  -/* natural logarithm computed for 4 simultaneous float-  return NaN for x <= 0-*/-static _EIGEN_DECLARE_CONST_Packet4f(cephes_SQRTHF, 0.707106781186547524f);-static _EIGEN_DECLARE_CONST_Packet4f(cephes_log_p0, 7.0376836292E-2f);-static _EIGEN_DECLARE_CONST_Packet4f(cephes_log_p1, - 1.1514610310E-1f);-static _EIGEN_DECLARE_CONST_Packet4f(cephes_log_p2, 1.1676998740E-1f);-static _EIGEN_DECLARE_CONST_Packet4f(cephes_log_p3, - 1.2420140846E-1f);-static _EIGEN_DECLARE_CONST_Packet4f(cephes_log_p4, + 1.4249322787E-1f);-static _EIGEN_DECLARE_CONST_Packet4f(cephes_log_p5, - 1.6668057665E-1f);-static _EIGEN_DECLARE_CONST_Packet4f(cephes_log_p6, + 2.0000714765E-1f);-static _EIGEN_DECLARE_CONST_Packet4f(cephes_log_p7, - 2.4999993993E-1f);-static _EIGEN_DECLARE_CONST_Packet4f(cephes_log_p8, + 3.3333331174E-1f);-static _EIGEN_DECLARE_CONST_Packet4f(cephes_log_q1, -2.12194440e-4f);-static _EIGEN_DECLARE_CONST_Packet4f(cephes_log_q2, 0.693359375f);--static _EIGEN_DECLARE_CONST_Packet4f(exp_hi,  88.3762626647950f);-static _EIGEN_DECLARE_CONST_Packet4f(exp_lo, -88.3762626647949f);--static _EIGEN_DECLARE_CONST_Packet4f(cephes_LOG2EF, 1.44269504088896341f);-static _EIGEN_DECLARE_CONST_Packet4f(cephes_exp_C1, 0.693359375f);-static _EIGEN_DECLARE_CONST_Packet4f(cephes_exp_C2, -2.12194440e-4f);--static _EIGEN_DECLARE_CONST_Packet4f(cephes_exp_p0, 1.9875691500E-4f);-static _EIGEN_DECLARE_CONST_Packet4f(cephes_exp_p1, 1.3981999507E-3f);-static _EIGEN_DECLARE_CONST_Packet4f(cephes_exp_p2, 8.3334519073E-3f);-static _EIGEN_DECLARE_CONST_Packet4f(cephes_exp_p3, 4.1665795894E-2f);-static _EIGEN_DECLARE_CONST_Packet4f(cephes_exp_p4, 1.6666665459E-1f);-static _EIGEN_DECLARE_CONST_Packet4f(cephes_exp_p5, 5.0000001201E-1f);-#endif- static _EIGEN_DECLARE_CONST_Packet2d(1 , 1.0); static _EIGEN_DECLARE_CONST_Packet2d(2 , 2.0); static _EIGEN_DECLARE_CONST_Packet2d(half, 0.5);@@ -137,91 +93,40 @@ }  template<> EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS EIGEN_UNUSED-Packet4f pexp<Packet4f>(const Packet4f& _x)+Packet4f pexp<Packet4f>(const Packet4f& x) {-#if !defined(__ARCH__) || (defined(__ARCH__) && __ARCH__ >= 12)-/*-  Packet4f x = _x;--  Packet4f tmp, fx;-  Packet4i emm0;--  // clamp x-  x = pmax(pmin(x, p4f_exp_hi), p4f_exp_lo);--  // express exp(x) as exp(g + n*log(2))-  fx = pmadd(x, p4f_cephes_LOG2EF, p4f_half);--  fx = pfloor(fx);--  tmp = pmul(fx, p4f_cephes_exp_C1);-  Packet4f z = pmul(fx, p4f_cephes_exp_C2);-  x = psub(x, tmp);-  x = psub(x, z);--  z = pmul(x,x);--  Packet4f y = p4f_cephes_exp_p0;-  y = pmadd(y, x, p4f_cephes_exp_p1);-  y = pmadd(y, x, p4f_cephes_exp_p2);-  y = pmadd(y, x, p4f_cephes_exp_p3);-  y = pmadd(y, x, p4f_cephes_exp_p4);-  y = pmadd(y, x, p4f_cephes_exp_p5);-  y = pmadd(y, z, x);-  y = padd(y, p4f_1);--  // build 2^n-  emm0 = vec_cts(fx, 0);-  emm0 = emm0 + p4i_0x7f;-  emm0 = emm0 << reinterpret_cast<Packet4i>(p4i_23);--  // Altivec's max & min operators just drop silent NaNs. Check NaNs in -  // inputs and return them unmodified.-  Packet4ui isnumber_mask = reinterpret_cast<Packet4ui>(vec_cmpeq(_x, _x));-  return vec_sel(_x, pmax(pmul(y, reinterpret_cast<Packet4f>(emm0)), _x),-                 isnumber_mask);*/-  return _x;-#else   Packet4f res;-  res.v4f[0] = pexp<Packet2d>(_x.v4f[0]);-  res.v4f[1] = pexp<Packet2d>(_x.v4f[1]);+  res.v4f[0] = pexp<Packet2d>(x.v4f[0]);+  res.v4f[1] = pexp<Packet2d>(x.v4f[1]);   return res;-#endif }  template<> EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS EIGEN_UNUSED Packet2d psqrt<Packet2d>(const Packet2d& x) {-  return vec_sqrt(x);+  return  __builtin_s390_vfsqdb(x); }  template<> EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS EIGEN_UNUSED Packet4f psqrt<Packet4f>(const Packet4f& x) {   Packet4f res;-#if !defined(__ARCH__) || (defined(__ARCH__) && __ARCH__ >= 12)-  res = vec_sqrt(x);-#else   res.v4f[0] = psqrt<Packet2d>(x.v4f[0]);   res.v4f[1] = psqrt<Packet2d>(x.v4f[1]);-#endif   return res; }  template<> EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS EIGEN_UNUSED Packet2d prsqrt<Packet2d>(const Packet2d& x) {+  // Unfortunately we can't use the much faster mm_rqsrt_pd since it only provides an approximation.   return pset1<Packet2d>(1.0) / psqrt<Packet2d>(x); }  template<> EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS EIGEN_UNUSED Packet4f prsqrt<Packet4f>(const Packet4f& x) {   Packet4f res;-#if !defined(__ARCH__) || (defined(__ARCH__) && __ARCH__ >= 12)-  res = pset1<Packet4f>(1.0) / psqrt<Packet4f>(x);-#else   res.v4f[0] = prsqrt<Packet2d>(x.v4f[0]);   res.v4f[1] = prsqrt<Packet2d>(x.v4f[1]);-#endif   return res; } 
eigen3/Eigen/src/Core/arch/ZVector/PacketMath.h view
@@ -17,7 +17,7 @@ namespace internal {  #ifndef EIGEN_CACHEFRIENDLY_PRODUCT_THRESHOLD-#define EIGEN_CACHEFRIENDLY_PRODUCT_THRESHOLD 16+#define EIGEN_CACHEFRIENDLY_PRODUCT_THRESHOLD 4 #endif  #ifndef EIGEN_HAS_SINGLE_INSTRUCTION_MADD@@ -29,7 +29,7 @@ #endif  #ifndef EIGEN_ARCH_DEFAULT_NUMBER_OF_REGISTERS-#define EIGEN_ARCH_DEFAULT_NUMBER_OF_REGISTERS  32+#define EIGEN_ARCH_DEFAULT_NUMBER_OF_REGISTERS  16 #endif  typedef __vector int                 Packet4i;@@ -41,14 +41,9 @@ typedef __vector unsigned long long  Packet2ul; typedef __vector long long           Packet2l; -// Z14 has builtin support for float vectors-#if !defined(__ARCH__) || (defined(__ARCH__) && __ARCH__ >= 12)-typedef __vector float               Packet4f;-#else typedef struct { 	Packet2d  v4f[2]; } Packet4f;-#endif  typedef union {   int32_t   i[4];@@ -56,15 +51,11 @@   int64_t   l[2];   uint64_t ul[2];   double    d[2];-  float     f[4];   Packet4i  v4i;   Packet4ui v4ui;   Packet2l  v2l;   Packet2ul v2ul;   Packet2d  v2d;-#if !defined(__ARCH__) || (defined(__ARCH__) && __ARCH__ >= 12)-  Packet4f  v4f;-#endif } Packet;  // We don't want to write the same code all the time, but we need to reuse the constants@@ -89,7 +80,7 @@   Packet2l p2l_##NAME = pset1<Packet2l>(X)  // These constants are endian-agnostic-static _EIGEN_DECLARE_CONST_FAST_Packet4i(ZERO, 0); //{ 0, 0, 0, 0,}+//static _EIGEN_DECLARE_CONST_FAST_Packet4i(ZERO, 0); //{ 0, 0, 0, 0,} static _EIGEN_DECLARE_CONST_FAST_Packet4i(ONE, 1); //{ 1, 1, 1, 1}  static _EIGEN_DECLARE_CONST_FAST_Packet2d(ZERO, 0);@@ -99,21 +90,6 @@ static Packet2d p2d_ONE = { 1.0, 1.0 };  static Packet2d p2d_ZERO_ = { -0.0, -0.0 }; -#if !defined(__ARCH__) || (defined(__ARCH__) && __ARCH__ >= 12)-#define _EIGEN_DECLARE_CONST_FAST_Packet4f(NAME,X) \-  Packet4f p4f_##NAME = reinterpret_cast<Packet4f>(vec_splat_s32(X))--#define _EIGEN_DECLARE_CONST_Packet4f(NAME,X) \-  Packet4f p4f_##NAME = pset1<Packet4f>(X)--#define _EIGEN_DECLARE_CONST_Packet4f_FROM_INT(NAME,X) \-  const Packet4f p4f_##NAME = reinterpret_cast<Packet4f>(pset1<Packet4i>(X))--static _EIGEN_DECLARE_CONST_FAST_Packet4f(ZERO, 0); //{ 0.0, 0.0, 0.0, 0.0}-static _EIGEN_DECLARE_CONST_FAST_Packet4i(MINUS1,-1); //{ -1, -1, -1, -1}-static Packet4f p4f_MZERO = { 0x80000000, 0x80000000, 0x80000000, 0x80000000};-#endif- static Packet4i p4i_COUNTDOWN = { 0, 1, 2, 3 }; static Packet4f p4f_COUNTDOWN = { 0.0, 1.0, 2.0, 3.0 }; static Packet2d p2d_COUNTDOWN = reinterpret_cast<Packet2d>(vec_sld(reinterpret_cast<Packet16uc>(p2d_ZERO), reinterpret_cast<Packet16uc>(p2d_ONE), 8));@@ -144,9 +120,9 @@ static Packet16uc p16uc_TRANSPOSE64_HI = { 0,1,2,3, 4,5,6,7, 16,17,18,19, 20,21,22,23}; static Packet16uc p16uc_TRANSPOSE64_LO = { 8,9,10,11, 12,13,14,15, 24,25,26,27, 28,29,30,31}; -static Packet16uc p16uc_COMPLEX32_REV = vec_sld(p16uc_REVERSE32, p16uc_REVERSE32, 8);                                         //{ 4,5,6,7, 0,1,2,3, 12,13,14,15, 8,9,10,11 };+//static Packet16uc p16uc_COMPLEX32_REV = vec_sld(p16uc_REVERSE32, p16uc_REVERSE32, 8);                                         //{ 4,5,6,7, 0,1,2,3, 12,13,14,15, 8,9,10,11 }; -static Packet16uc p16uc_COMPLEX32_REV2 = vec_sld(p16uc_FORWARD, p16uc_FORWARD, 8);                                            //{ 8,9,10,11, 12,13,14,15, 0,1,2,3, 4,5,6,7 };+//static Packet16uc p16uc_COMPLEX32_REV2 = vec_sld(p16uc_FORWARD, p16uc_FORWARD, 8);                                            //{ 8,9,10,11, 12,13,14,15, 0,1,2,3, 4,5,6,7 };   #if EIGEN_HAS_BUILTIN(__builtin_prefetch) || EIGEN_COMP_GNUC@@ -193,11 +169,7 @@     HasSin  = 0,     HasCos  = 0,     HasLog  = 0,-#if !defined(__ARCH__) || (defined(__ARCH__) && __ARCH__ >= 12)-    HasExp  = 0,-#else     HasExp  = 1,-#endif     HasSqrt = 1,     HasRsqrt = 1,     HasRound = 1,@@ -286,17 +258,32 @@   return s; } -#if !defined(__ARCH__) || (defined(__ARCH__) && __ARCH__ >= 12)-inline std::ostream & operator <<(std::ostream & s, const Packet4f & v)+/* Helper function to simulate a vec_splat_packet4f+ */+template<int element> EIGEN_STRONG_INLINE Packet4f vec_splat_packet4f(const Packet4f&   from) {-  Packet vt;-  vt.v4f = v;-  s << vt.f[0] << ", " << vt.f[1] << ", " << vt.f[2] << ", " << vt.f[3];-  return s;+  Packet4f splat;+  switch (element) {+  case 0:+    splat.v4f[0] = vec_splat(from.v4f[0], 0);+    splat.v4f[1] = splat.v4f[0];+    break;+  case 1:+    splat.v4f[0] = vec_splat(from.v4f[0], 1);+    splat.v4f[1] = splat.v4f[0];+    break;+  case 2:+    splat.v4f[0] = vec_splat(from.v4f[1], 0);+    splat.v4f[1] = splat.v4f[0];+    break;+  case 3:+    splat.v4f[0] = vec_splat(from.v4f[1], 1);+    splat.v4f[1] = splat.v4f[0];+    break;+  }+  return splat; }-#endif - template<int Offset> struct palign_impl<Offset,Packet4i> {@@ -313,7 +300,32 @@   } }; +/* This is a tricky one, we have to translate float alignment to vector elements of sizeof double+ */ template<int Offset>+struct palign_impl<Offset,Packet4f>+{+  static EIGEN_STRONG_INLINE void run(Packet4f& first, const Packet4f& second)+  {+    switch (Offset % 4) {+    case 1:+      first.v4f[0] = vec_sld(first.v4f[0], first.v4f[1], 8);+      first.v4f[1] = vec_sld(first.v4f[1], second.v4f[0], 8);+      break;+    case 2:+      first.v4f[0] = first.v4f[1];+      first.v4f[1] = second.v4f[0];+      break;+    case 3:+      first.v4f[0] = vec_sld(first.v4f[1],  second.v4f[0], 8);+      first.v4f[1] = vec_sld(second.v4f[0], second.v4f[1], 8);+      break;+    }+  }+};+++template<int Offset> struct palign_impl<Offset,Packet2d> {   static EIGEN_STRONG_INLINE void run(Packet2d& first, const Packet2d& second)@@ -332,6 +344,16 @@   return vfrom->v4i; } +template<> EIGEN_STRONG_INLINE Packet4f pload<Packet4f>(const float*   from)+{+  // FIXME: No intrinsic yet+  EIGEN_DEBUG_ALIGNED_LOAD+  Packet4f vfrom;+  vfrom.v4f[0] = vec_ld2f(&from[0]);+  vfrom.v4f[1] = vec_ld2f(&from[2]);+  return vfrom;+}+ template<> EIGEN_STRONG_INLINE Packet2d pload<Packet2d>(const double* from) {   // FIXME: No intrinsic yet@@ -350,6 +372,15 @@   vto->v4i = from; } +template<> EIGEN_STRONG_INLINE void pstore<float>(float*   to, const Packet4f& from)+{+  // FIXME: No intrinsic yet+  EIGEN_DEBUG_ALIGNED_STORE+  vec_st2f(from.v4f[0], &to[0]);+  vec_st2f(from.v4f[1], &to[2]);+}++ template<> EIGEN_STRONG_INLINE void pstore<double>(double*   to, const Packet2d& from) {   // FIXME: No intrinsic yet@@ -366,6 +397,13 @@ template<> EIGEN_STRONG_INLINE Packet2d pset1<Packet2d>(const double& from) {   return vec_splats(from); }+template<> EIGEN_STRONG_INLINE Packet4f pset1<Packet4f>(const float&    from)+{+  Packet4f to;+  to.v4f[0] = pset1<Packet2d>(static_cast<const double&>(from));+  to.v4f[1] = to.v4f[0];+  return to;+}  template<> EIGEN_STRONG_INLINE void pbroadcast4<Packet4i>(const int *a,@@ -379,6 +417,17 @@ }  template<> EIGEN_STRONG_INLINE void+pbroadcast4<Packet4f>(const float *a,+                      Packet4f& a0, Packet4f& a1, Packet4f& a2, Packet4f& a3)+{+  a3 = pload<Packet4f>(a);+  a0 = vec_splat_packet4f<0>(a3);+  a1 = vec_splat_packet4f<1>(a3);+  a2 = vec_splat_packet4f<2>(a3);+  a3 = vec_splat_packet4f<3>(a3);+}++template<> EIGEN_STRONG_INLINE void pbroadcast4<Packet2d>(const double *a,                       Packet2d& a0, Packet2d& a1, Packet2d& a2, Packet2d& a3) {@@ -400,6 +449,16 @@  return pload<Packet4i>(ai); } +template<> EIGEN_DEVICE_FUNC inline Packet4f pgather<float, Packet4f>(const float* from, Index stride)+{+  float EIGEN_ALIGN16 ai[4];+  ai[0] = from[0*stride];+  ai[1] = from[1*stride];+  ai[2] = from[2*stride];+  ai[3] = from[3*stride];+ return pload<Packet4f>(ai);+}+ template<> EIGEN_DEVICE_FUNC inline Packet2d pgather<double, Packet2d>(const double* from, Index stride) {   double EIGEN_ALIGN16 af[2];@@ -418,6 +477,16 @@   to[3*stride] = ai[3]; } +template<> EIGEN_DEVICE_FUNC inline void pscatter<float, Packet4f>(float* to, const Packet4f& from, Index stride)+{+  float EIGEN_ALIGN16 ai[4];+  pstore<float>((float *)ai, from);+  to[0*stride] = ai[0];+  to[1*stride] = ai[1];+  to[2*stride] = ai[2];+  to[3*stride] = ai[3];+}+ template<> EIGEN_DEVICE_FUNC inline void pscatter<double, Packet2d>(double* to, const Packet2d& from, Index stride) {   double EIGEN_ALIGN16 af[2];@@ -427,52 +496,160 @@ }  template<> EIGEN_STRONG_INLINE Packet4i padd<Packet4i>(const Packet4i& a, const Packet4i& b) { return (a + b); }+template<> EIGEN_STRONG_INLINE Packet4f padd<Packet4f>(const Packet4f& a, const Packet4f& b)+{+  Packet4f c;+  c.v4f[0] = a.v4f[0] + b.v4f[0];+  c.v4f[1] = a.v4f[1] + b.v4f[1];+  return c;+} template<> EIGEN_STRONG_INLINE Packet2d padd<Packet2d>(const Packet2d& a, const Packet2d& b) { return (a + b); }  template<> EIGEN_STRONG_INLINE Packet4i psub<Packet4i>(const Packet4i& a, const Packet4i& b) { return (a - b); }+template<> EIGEN_STRONG_INLINE Packet4f psub<Packet4f>(const Packet4f& a, const Packet4f& b)+{+  Packet4f c;+  c.v4f[0] = a.v4f[0] - b.v4f[0];+  c.v4f[1] = a.v4f[1] - b.v4f[1];+  return c;+} template<> EIGEN_STRONG_INLINE Packet2d psub<Packet2d>(const Packet2d& a, const Packet2d& b) { return (a - b); }  template<> EIGEN_STRONG_INLINE Packet4i pmul<Packet4i>(const Packet4i& a, const Packet4i& b) { return (a * b); }+template<> EIGEN_STRONG_INLINE Packet4f pmul<Packet4f>(const Packet4f& a, const Packet4f& b)+{+  Packet4f c;+  c.v4f[0] = a.v4f[0] * b.v4f[0];+  c.v4f[1] = a.v4f[1] * b.v4f[1];+  return c;+} template<> EIGEN_STRONG_INLINE Packet2d pmul<Packet2d>(const Packet2d& a, const Packet2d& b) { return (a * b); }  template<> EIGEN_STRONG_INLINE Packet4i pdiv<Packet4i>(const Packet4i& a, const Packet4i& b) { return (a / b); }+template<> EIGEN_STRONG_INLINE Packet4f pdiv<Packet4f>(const Packet4f& a, const Packet4f& b)+{+  Packet4f c;+  c.v4f[0] = a.v4f[0] / b.v4f[0];+  c.v4f[1] = a.v4f[1] / b.v4f[1];+  return c;+} template<> EIGEN_STRONG_INLINE Packet2d pdiv<Packet2d>(const Packet2d& a, const Packet2d& b) { return (a / b); }  template<> EIGEN_STRONG_INLINE Packet4i pnegate(const Packet4i& a) { return (-a); }+template<> EIGEN_STRONG_INLINE Packet4f pnegate(const Packet4f& a)+{+  Packet4f c;+  c.v4f[0] = -a.v4f[0];+  c.v4f[1] = -a.v4f[1];+  return c;+} template<> EIGEN_STRONG_INLINE Packet2d pnegate(const Packet2d& a) { return (-a); }  template<> EIGEN_STRONG_INLINE Packet4i pconj(const Packet4i& a) { return a; }+template<> EIGEN_STRONG_INLINE Packet4f pconj(const Packet4f& a) { return a; } template<> EIGEN_STRONG_INLINE Packet2d pconj(const Packet2d& a) { return a; }  template<> EIGEN_STRONG_INLINE Packet4i pmadd(const Packet4i& a, const Packet4i& b, const Packet4i& c) { return padd<Packet4i>(pmul<Packet4i>(a, b), c); }+template<> EIGEN_STRONG_INLINE Packet4f pmadd(const Packet4f& a, const Packet4f& b, const Packet4f& c)+{+  Packet4f res;+  res.v4f[0] = vec_madd(a.v4f[0], b.v4f[0], c.v4f[0]);+  res.v4f[1] = vec_madd(a.v4f[1], b.v4f[1], c.v4f[1]);+  return res;+} template<> EIGEN_STRONG_INLINE Packet2d pmadd(const Packet2d& a, const Packet2d& b, const Packet2d& c) { return vec_madd(a, b, c); }  template<> EIGEN_STRONG_INLINE Packet4i plset<Packet4i>(const int& a)    { return padd<Packet4i>(pset1<Packet4i>(a), p4i_COUNTDOWN); }+template<> EIGEN_STRONG_INLINE Packet4f plset<Packet4f>(const float& a)  { return padd<Packet4f>(pset1<Packet4f>(a), p4f_COUNTDOWN); } template<> EIGEN_STRONG_INLINE Packet2d plset<Packet2d>(const double& a) { return padd<Packet2d>(pset1<Packet2d>(a), p2d_COUNTDOWN); }  template<> EIGEN_STRONG_INLINE Packet4i pmin<Packet4i>(const Packet4i& a, const Packet4i& b) { return vec_min(a, b); } template<> EIGEN_STRONG_INLINE Packet2d pmin<Packet2d>(const Packet2d& a, const Packet2d& b) { return vec_min(a, b); }+template<> EIGEN_STRONG_INLINE Packet4f pmin<Packet4f>(const Packet4f& a, const Packet4f& b)+{+  Packet4f res;+  res.v4f[0] = pmin(a.v4f[0], b.v4f[0]);+  res.v4f[1] = pmin(a.v4f[1], b.v4f[1]);+  return res;+}  template<> EIGEN_STRONG_INLINE Packet4i pmax<Packet4i>(const Packet4i& a, const Packet4i& b) { return vec_max(a, b); } template<> EIGEN_STRONG_INLINE Packet2d pmax<Packet2d>(const Packet2d& a, const Packet2d& b) { return vec_max(a, b); }+template<> EIGEN_STRONG_INLINE Packet4f pmax<Packet4f>(const Packet4f& a, const Packet4f& b)+{+  Packet4f res;+  res.v4f[0] = pmax(a.v4f[0], b.v4f[0]);+  res.v4f[1] = pmax(a.v4f[1], b.v4f[1]);+  return res;+}  template<> EIGEN_STRONG_INLINE Packet4i pand<Packet4i>(const Packet4i& a, const Packet4i& b) { return vec_and(a, b); } template<> EIGEN_STRONG_INLINE Packet2d pand<Packet2d>(const Packet2d& a, const Packet2d& b) { return vec_and(a, b); }+template<> EIGEN_STRONG_INLINE Packet4f pand<Packet4f>(const Packet4f& a, const Packet4f& b)+{+  Packet4f res;+  res.v4f[0] = pand(a.v4f[0], b.v4f[0]);+  res.v4f[1] = pand(a.v4f[1], b.v4f[1]);+  return res;+}  template<> EIGEN_STRONG_INLINE Packet4i por<Packet4i>(const Packet4i& a, const Packet4i& b) { return vec_or(a, b); } template<> EIGEN_STRONG_INLINE Packet2d por<Packet2d>(const Packet2d& a, const Packet2d& b) { return vec_or(a, b); }+template<> EIGEN_STRONG_INLINE Packet4f por<Packet4f>(const Packet4f& a, const Packet4f& b)+{+  Packet4f res;+  res.v4f[0] = pand(a.v4f[0], b.v4f[0]);+  res.v4f[1] = pand(a.v4f[1], b.v4f[1]);+  return res;+}  template<> EIGEN_STRONG_INLINE Packet4i pxor<Packet4i>(const Packet4i& a, const Packet4i& b) { return vec_xor(a, b); } template<> EIGEN_STRONG_INLINE Packet2d pxor<Packet2d>(const Packet2d& a, const Packet2d& b) { return vec_xor(a, b); }+template<> EIGEN_STRONG_INLINE Packet4f pxor<Packet4f>(const Packet4f& a, const Packet4f& b)+{+  Packet4f res;+  res.v4f[0] = pand(a.v4f[0], b.v4f[0]);+  res.v4f[1] = pand(a.v4f[1], b.v4f[1]);+  return res;+}  template<> EIGEN_STRONG_INLINE Packet4i pandnot<Packet4i>(const Packet4i& a, const Packet4i& b) { return pand<Packet4i>(a, vec_nor(b, b)); } template<> EIGEN_STRONG_INLINE Packet2d pandnot<Packet2d>(const Packet2d& a, const Packet2d& b) { return vec_and(a, vec_nor(b, b)); }+template<> EIGEN_STRONG_INLINE Packet4f pandnot<Packet4f>(const Packet4f& a, const Packet4f& b)+{+  Packet4f res;+  res.v4f[0] = pandnot(a.v4f[0], b.v4f[0]);+  res.v4f[1] = pandnot(a.v4f[1], b.v4f[1]);+  return res;+} +template<> EIGEN_STRONG_INLINE Packet4f pround<Packet4f>(const Packet4f& a)+{+  Packet4f res;+  res.v4f[0] = vec_round(a.v4f[0]);+  res.v4f[1] = vec_round(a.v4f[1]);+  return res;+} template<> EIGEN_STRONG_INLINE Packet2d pround<Packet2d>(const Packet2d& a) { return vec_round(a); }+template<> EIGEN_STRONG_INLINE Packet4f pceil<Packet4f>(const  Packet4f& a)+{+  Packet4f res;+  res.v4f[0] = vec_ceil(a.v4f[0]);+  res.v4f[1] = vec_ceil(a.v4f[1]);+  return res;+} template<> EIGEN_STRONG_INLINE Packet2d pceil<Packet2d>(const  Packet2d& a) { return vec_ceil(a); }+template<> EIGEN_STRONG_INLINE Packet4f pfloor<Packet4f>(const Packet4f& a)+{+  Packet4f res;+  res.v4f[0] = vec_floor(a.v4f[0]);+  res.v4f[1] = vec_floor(a.v4f[1]);+  return res;+} template<> EIGEN_STRONG_INLINE Packet2d pfloor<Packet2d>(const Packet2d& a) { return vec_floor(a); }  template<> EIGEN_STRONG_INLINE Packet4i ploadu<Packet4i>(const int*       from) { return pload<Packet4i>(from); }+template<> EIGEN_STRONG_INLINE Packet4f ploadu<Packet4f>(const float*     from) { return pload<Packet4f>(from); } template<> EIGEN_STRONG_INLINE Packet2d ploadu<Packet2d>(const double*    from) { return pload<Packet2d>(from); }  @@ -482,6 +659,14 @@   return vec_perm(p, p, p16uc_DUPLICATE32_HI); } +template<> EIGEN_STRONG_INLINE Packet4f ploaddup<Packet4f>(const float*    from)+{+  Packet4f p = pload<Packet4f>(from);+  p.v4f[1] = vec_splat(p.v4f[0], 1);+  p.v4f[0] = vec_splat(p.v4f[0], 0);+  return p;+}+ template<> EIGEN_STRONG_INLINE Packet2d ploaddup<Packet2d>(const double*   from) {   Packet2d p = pload<Packet2d>(from);@@ -489,12 +674,15 @@ }  template<> EIGEN_STRONG_INLINE void pstoreu<int>(int*        to, const Packet4i& from) { pstore<int>(to, from); }+template<> EIGEN_STRONG_INLINE void pstoreu<float>(float*    to, const Packet4f& from) { pstore<float>(to, from); } template<> EIGEN_STRONG_INLINE void pstoreu<double>(double*  to, const Packet2d& from) { pstore<double>(to, from); }  template<> EIGEN_STRONG_INLINE void prefetch<int>(const int*       addr) { EIGEN_ZVECTOR_PREFETCH(addr); }+template<> EIGEN_STRONG_INLINE void prefetch<float>(const float*   addr) { EIGEN_ZVECTOR_PREFETCH(addr); } template<> EIGEN_STRONG_INLINE void prefetch<double>(const double* addr) { EIGEN_ZVECTOR_PREFETCH(addr); }  template<> EIGEN_STRONG_INLINE int    pfirst<Packet4i>(const Packet4i& a) { int    EIGEN_ALIGN16 x[4]; pstore(x, a); return x[0]; }+template<> EIGEN_STRONG_INLINE float  pfirst<Packet4f>(const Packet4f& a) { float  EIGEN_ALIGN16 x[2]; vec_st2f(a.v4f[0], &x[0]); return x[0]; } template<> EIGEN_STRONG_INLINE double pfirst<Packet2d>(const Packet2d& a) { double EIGEN_ALIGN16 x[2]; pstore(x, a); return x[0]; }  template<> EIGEN_STRONG_INLINE Packet4i preverse(const Packet4i& a)@@ -507,8 +695,23 @@   return reinterpret_cast<Packet2d>(vec_perm(reinterpret_cast<Packet16uc>(a), reinterpret_cast<Packet16uc>(a), p16uc_REVERSE64)); } +template<> EIGEN_STRONG_INLINE Packet4f preverse(const Packet4f& a)+{+  Packet4f rev;+  rev.v4f[0] = preverse<Packet2d>(a.v4f[1]);+  rev.v4f[1] = preverse<Packet2d>(a.v4f[0]);+  return rev;+}+ template<> EIGEN_STRONG_INLINE Packet4i pabs<Packet4i>(const Packet4i& a) { return vec_abs(a); } template<> EIGEN_STRONG_INLINE Packet2d pabs<Packet2d>(const Packet2d& a) { return vec_abs(a); }+template<> EIGEN_STRONG_INLINE Packet4f pabs<Packet4f>(const Packet4f& a)+{+  Packet4f res;+  res.v4f[0] = pabs(a.v4f[0]);+  res.v4f[1] = pabs(a.v4f[1]);+  return res;+}  template<> EIGEN_STRONG_INLINE int predux<Packet4i>(const Packet4i& a) {@@ -527,6 +730,13 @@   sum = padd<Packet2d>(a, b);   return pfirst(sum); }+template<> EIGEN_STRONG_INLINE float predux<Packet4f>(const Packet4f& a)+{+  Packet2d sum;+  sum = padd<Packet2d>(a.v4f[0], a.v4f[1]);+  double first = predux<Packet2d>(sum);+  return static_cast<float>(first);+}  template<> EIGEN_STRONG_INLINE Packet4i preduxp<Packet4i>(const Packet4i* vecs) {@@ -567,6 +777,21 @@   return sum; } +template<> EIGEN_STRONG_INLINE Packet4f preduxp<Packet4f>(const Packet4f* vecs)+{+  PacketBlock<Packet4f,4> transpose;+  transpose.packet[0] = vecs[0];+  transpose.packet[1] = vecs[1];+  transpose.packet[2] = vecs[2];+  transpose.packet[3] = vecs[3];+  ptranspose(transpose);++  Packet4f sum = padd(transpose.packet[0], transpose.packet[1]);+  sum = padd(sum, transpose.packet[2]);+  sum = padd(sum, transpose.packet[3]);+  return sum;+}+ // Other reduction functions: // mul template<> EIGEN_STRONG_INLINE int predux_mul<Packet4i>(const Packet4i& a)@@ -581,6 +806,12 @@   return pfirst(pmul(a, reinterpret_cast<Packet2d>(vec_sld(reinterpret_cast<Packet4i>(a), reinterpret_cast<Packet4i>(a), 8)))); } +template<> EIGEN_STRONG_INLINE float predux_mul<Packet4f>(const Packet4f& a)+{+  // Return predux_mul<Packet2d> of the subvectors product+  return static_cast<float>(pfirst(predux_mul(pmul(a.v4f[0], a.v4f[1]))));+}+ // min template<> EIGEN_STRONG_INLINE int predux_min<Packet4i>(const Packet4i& a) {@@ -595,6 +826,14 @@   return pfirst(pmin<Packet2d>(a, reinterpret_cast<Packet2d>(vec_sld(reinterpret_cast<Packet4i>(a), reinterpret_cast<Packet4i>(a), 8)))); } +template<> EIGEN_STRONG_INLINE float predux_min<Packet4f>(const Packet4f& a)+{+  Packet2d b, res;+  b   = pmin<Packet2d>(a.v4f[0], a.v4f[1]);+  res = pmin<Packet2d>(b, reinterpret_cast<Packet2d>(vec_sld(reinterpret_cast<Packet4i>(b), reinterpret_cast<Packet4i>(b), 8)));+  return static_cast<float>(pfirst(res));+}+ // max template<> EIGEN_STRONG_INLINE int predux_max<Packet4i>(const Packet4i& a) {@@ -610,6 +849,14 @@   return pfirst(pmax<Packet2d>(a, reinterpret_cast<Packet2d>(vec_sld(reinterpret_cast<Packet4i>(a), reinterpret_cast<Packet4i>(a), 8)))); } +template<> EIGEN_STRONG_INLINE float predux_max<Packet4f>(const Packet4f& a)+{+  Packet2d b, res;+  b   = pmax<Packet2d>(a.v4f[0], a.v4f[1]);+  res = pmax<Packet2d>(b, reinterpret_cast<Packet2d>(vec_sld(reinterpret_cast<Packet4i>(b), reinterpret_cast<Packet4i>(b), 8)));+  return static_cast<float>(pfirst(res));+}+ EIGEN_DEVICE_FUNC inline void ptranspose(PacketBlock<Packet4i,4>& kernel) {   Packet4i t0 = vec_mergeh(kernel.packet[0], kernel.packet[2]);@@ -630,321 +877,6 @@   kernel.packet[1] = t1; } -template<> EIGEN_STRONG_INLINE Packet4i pblend(const Selector<4>& ifPacket, const Packet4i& thenPacket, const Packet4i& elsePacket) {-  Packet4ui select = { ifPacket.select[0], ifPacket.select[1], ifPacket.select[2], ifPacket.select[3] };-  Packet4ui mask = vec_cmpeq(select, reinterpret_cast<Packet4ui>(p4i_ONE));-  return vec_sel(elsePacket, thenPacket, mask);-}---template<> EIGEN_STRONG_INLINE Packet2d pblend(const Selector<2>& ifPacket, const Packet2d& thenPacket, const Packet2d& elsePacket) {-  Packet2ul select = { ifPacket.select[0], ifPacket.select[1] };-  Packet2ul mask = vec_cmpeq(select, reinterpret_cast<Packet2ul>(p2l_ONE));-  return vec_sel(elsePacket, thenPacket, mask);-}--/* z13 has no vector float support so we emulate that with double-   z14 has proper vector float support.-*/-#if !defined(__ARCH__) || (defined(__ARCH__) && __ARCH__ < 12)-/* Helper function to simulate a vec_splat_packet4f- */-template<int element> EIGEN_STRONG_INLINE Packet4f vec_splat_packet4f(const Packet4f&   from)-{-  Packet4f splat;-  switch (element) {-  case 0:-    splat.v4f[0] = vec_splat(from.v4f[0], 0);-    splat.v4f[1] = splat.v4f[0];-    break;-  case 1:-    splat.v4f[0] = vec_splat(from.v4f[0], 1);-    splat.v4f[1] = splat.v4f[0];-    break;-  case 2:-    splat.v4f[0] = vec_splat(from.v4f[1], 0);-    splat.v4f[1] = splat.v4f[0];-    break;-  case 3:-    splat.v4f[0] = vec_splat(from.v4f[1], 1);-    splat.v4f[1] = splat.v4f[0];-    break;-  }-  return splat;-}--/* This is a tricky one, we have to translate float alignment to vector elements of sizeof double- */-template<int Offset>-struct palign_impl<Offset,Packet4f>-{-  static EIGEN_STRONG_INLINE void run(Packet4f& first, const Packet4f& second)-  {-    switch (Offset % 4) {-    case 1:-      first.v4f[0] = vec_sld(first.v4f[0], first.v4f[1], 8);-      first.v4f[1] = vec_sld(first.v4f[1], second.v4f[0], 8);-      break;-    case 2:-      first.v4f[0] = first.v4f[1];-      first.v4f[1] = second.v4f[0];-      break;-    case 3:-      first.v4f[0] = vec_sld(first.v4f[1],  second.v4f[0], 8);-      first.v4f[1] = vec_sld(second.v4f[0], second.v4f[1], 8);-      break;-    }-  }-};--template<> EIGEN_STRONG_INLINE Packet4f pload<Packet4f>(const float*   from)-{-  // FIXME: No intrinsic yet-  EIGEN_DEBUG_ALIGNED_LOAD-  Packet4f vfrom;-  vfrom.v4f[0] = vec_ld2f(&from[0]);-  vfrom.v4f[1] = vec_ld2f(&from[2]);-  return vfrom;-}--template<> EIGEN_STRONG_INLINE void pstore<float>(float*   to, const Packet4f& from)-{-  // FIXME: No intrinsic yet-  EIGEN_DEBUG_ALIGNED_STORE-  vec_st2f(from.v4f[0], &to[0]);-  vec_st2f(from.v4f[1], &to[2]);-}--template<> EIGEN_STRONG_INLINE Packet4f pset1<Packet4f>(const float&    from)-{-  Packet4f to;-  to.v4f[0] = pset1<Packet2d>(static_cast<const double&>(from));-  to.v4f[1] = to.v4f[0];-  return to;-}--template<> EIGEN_STRONG_INLINE void-pbroadcast4<Packet4f>(const float *a,-                      Packet4f& a0, Packet4f& a1, Packet4f& a2, Packet4f& a3)-{-  a3 = pload<Packet4f>(a);-  a0 = vec_splat_packet4f<0>(a3);-  a1 = vec_splat_packet4f<1>(a3);-  a2 = vec_splat_packet4f<2>(a3);-  a3 = vec_splat_packet4f<3>(a3);-}--template<> EIGEN_DEVICE_FUNC inline Packet4f pgather<float, Packet4f>(const float* from, Index stride)-{-  float EIGEN_ALIGN16 ai[4];-  ai[0] = from[0*stride];-  ai[1] = from[1*stride];-  ai[2] = from[2*stride];-  ai[3] = from[3*stride];- return pload<Packet4f>(ai);-}--template<> EIGEN_DEVICE_FUNC inline void pscatter<float, Packet4f>(float* to, const Packet4f& from, Index stride)-{-  float EIGEN_ALIGN16 ai[4];-  pstore<float>((float *)ai, from);-  to[0*stride] = ai[0];-  to[1*stride] = ai[1];-  to[2*stride] = ai[2];-  to[3*stride] = ai[3];-}--template<> EIGEN_STRONG_INLINE Packet4f padd<Packet4f>(const Packet4f& a, const Packet4f& b)-{-  Packet4f c;-  c.v4f[0] = a.v4f[0] + b.v4f[0];-  c.v4f[1] = a.v4f[1] + b.v4f[1];-  return c;-}--template<> EIGEN_STRONG_INLINE Packet4f psub<Packet4f>(const Packet4f& a, const Packet4f& b)-{-  Packet4f c;-  c.v4f[0] = a.v4f[0] - b.v4f[0];-  c.v4f[1] = a.v4f[1] - b.v4f[1];-  return c;-}--template<> EIGEN_STRONG_INLINE Packet4f pmul<Packet4f>(const Packet4f& a, const Packet4f& b)-{-  Packet4f c;-  c.v4f[0] = a.v4f[0] * b.v4f[0];-  c.v4f[1] = a.v4f[1] * b.v4f[1];-  return c;-}--template<> EIGEN_STRONG_INLINE Packet4f pdiv<Packet4f>(const Packet4f& a, const Packet4f& b)-{-  Packet4f c;-  c.v4f[0] = a.v4f[0] / b.v4f[0];-  c.v4f[1] = a.v4f[1] / b.v4f[1];-  return c;-}--template<> EIGEN_STRONG_INLINE Packet4f pnegate(const Packet4f& a)-{-  Packet4f c;-  c.v4f[0] = -a.v4f[0];-  c.v4f[1] = -a.v4f[1];-  return c;-}--template<> EIGEN_STRONG_INLINE Packet4f pmadd(const Packet4f& a, const Packet4f& b, const Packet4f& c)-{-  Packet4f res;-  res.v4f[0] = vec_madd(a.v4f[0], b.v4f[0], c.v4f[0]);-  res.v4f[1] = vec_madd(a.v4f[1], b.v4f[1], c.v4f[1]);-  return res;-}--template<> EIGEN_STRONG_INLINE Packet4f pmin<Packet4f>(const Packet4f& a, const Packet4f& b)-{-  Packet4f res;-  res.v4f[0] = pmin(a.v4f[0], b.v4f[0]);-  res.v4f[1] = pmin(a.v4f[1], b.v4f[1]);-  return res;-}--template<> EIGEN_STRONG_INLINE Packet4f pmax<Packet4f>(const Packet4f& a, const Packet4f& b)-{-  Packet4f res;-  res.v4f[0] = pmax(a.v4f[0], b.v4f[0]);-  res.v4f[1] = pmax(a.v4f[1], b.v4f[1]);-  return res;-}--template<> EIGEN_STRONG_INLINE Packet4f pand<Packet4f>(const Packet4f& a, const Packet4f& b)-{-  Packet4f res;-  res.v4f[0] = pand(a.v4f[0], b.v4f[0]);-  res.v4f[1] = pand(a.v4f[1], b.v4f[1]);-  return res;-}--template<> EIGEN_STRONG_INLINE Packet4f por<Packet4f>(const Packet4f& a, const Packet4f& b)-{-  Packet4f res;-  res.v4f[0] = pand(a.v4f[0], b.v4f[0]);-  res.v4f[1] = pand(a.v4f[1], b.v4f[1]);-  return res;-}--template<> EIGEN_STRONG_INLINE Packet4f pxor<Packet4f>(const Packet4f& a, const Packet4f& b)-{-  Packet4f res;-  res.v4f[0] = pand(a.v4f[0], b.v4f[0]);-  res.v4f[1] = pand(a.v4f[1], b.v4f[1]);-  return res;-}--template<> EIGEN_STRONG_INLINE Packet4f pandnot<Packet4f>(const Packet4f& a, const Packet4f& b)-{-  Packet4f res;-  res.v4f[0] = pandnot(a.v4f[0], b.v4f[0]);-  res.v4f[1] = pandnot(a.v4f[1], b.v4f[1]);-  return res;-}--template<> EIGEN_STRONG_INLINE Packet4f pround<Packet4f>(const Packet4f& a)-{-  Packet4f res;-  res.v4f[0] = vec_round(a.v4f[0]);-  res.v4f[1] = vec_round(a.v4f[1]);-  return res;-}--template<> EIGEN_STRONG_INLINE Packet4f pceil<Packet4f>(const  Packet4f& a)-{-  Packet4f res;-  res.v4f[0] = vec_ceil(a.v4f[0]);-  res.v4f[1] = vec_ceil(a.v4f[1]);-  return res;-}--template<> EIGEN_STRONG_INLINE Packet4f pfloor<Packet4f>(const Packet4f& a)-{-  Packet4f res;-  res.v4f[0] = vec_floor(a.v4f[0]);-  res.v4f[1] = vec_floor(a.v4f[1]);-  return res;-}--template<> EIGEN_STRONG_INLINE Packet4f ploaddup<Packet4f>(const float*    from)-{-  Packet4f p = pload<Packet4f>(from);-  p.v4f[1] = vec_splat(p.v4f[0], 1);-  p.v4f[0] = vec_splat(p.v4f[0], 0);-  return p;-}--template<> EIGEN_STRONG_INLINE float  pfirst<Packet4f>(const Packet4f& a) { float  EIGEN_ALIGN16 x[2]; vec_st2f(a.v4f[0], &x[0]); return x[0]; }--template<> EIGEN_STRONG_INLINE Packet4f preverse(const Packet4f& a)-{-  Packet4f rev;-  rev.v4f[0] = preverse<Packet2d>(a.v4f[1]);-  rev.v4f[1] = preverse<Packet2d>(a.v4f[0]);-  return rev;-}--template<> EIGEN_STRONG_INLINE Packet4f pabs<Packet4f>(const Packet4f& a)-{-  Packet4f res;-  res.v4f[0] = pabs(a.v4f[0]);-  res.v4f[1] = pabs(a.v4f[1]);-  return res;-}--template<> EIGEN_STRONG_INLINE float predux<Packet4f>(const Packet4f& a)-{-  Packet2d sum;-  sum = padd<Packet2d>(a.v4f[0], a.v4f[1]);-  double first = predux<Packet2d>(sum);-  return static_cast<float>(first);-}--template<> EIGEN_STRONG_INLINE Packet4f preduxp<Packet4f>(const Packet4f* vecs)-{-  PacketBlock<Packet4f,4> transpose;-  transpose.packet[0] = vecs[0];-  transpose.packet[1] = vecs[1];-  transpose.packet[2] = vecs[2];-  transpose.packet[3] = vecs[3];-  ptranspose(transpose);--  Packet4f sum = padd(transpose.packet[0], transpose.packet[1]);-  sum = padd(sum, transpose.packet[2]);-  sum = padd(sum, transpose.packet[3]);-  return sum;-}--template<> EIGEN_STRONG_INLINE float predux_mul<Packet4f>(const Packet4f& a)-{-  // Return predux_mul<Packet2d> of the subvectors product-  return static_cast<float>(pfirst(predux_mul(pmul(a.v4f[0], a.v4f[1]))));-}--template<> EIGEN_STRONG_INLINE float predux_min<Packet4f>(const Packet4f& a)-{-  Packet2d b, res;-  b   = pmin<Packet2d>(a.v4f[0], a.v4f[1]);-  res = pmin<Packet2d>(b, reinterpret_cast<Packet2d>(vec_sld(reinterpret_cast<Packet4i>(b), reinterpret_cast<Packet4i>(b), 8)));-  return static_cast<float>(pfirst(res));-}--template<> EIGEN_STRONG_INLINE float predux_max<Packet4f>(const Packet4f& a)-{-  Packet2d b, res;-  b   = pmax<Packet2d>(a.v4f[0], a.v4f[1]);-  res = pmax<Packet2d>(b, reinterpret_cast<Packet2d>(vec_sld(reinterpret_cast<Packet4i>(b), reinterpret_cast<Packet4i>(b), 8)));-  return static_cast<float>(pfirst(res));-}- /* Split the Packet4f PacketBlock into 4 Packet2d PacketBlocks and transpose each one  */ EIGEN_DEVICE_FUNC inline void@@ -983,6 +915,12 @@   kernel.packet[3].v4f[1] = t3.packet[1]; } +template<> EIGEN_STRONG_INLINE Packet4i pblend(const Selector<4>& ifPacket, const Packet4i& thenPacket, const Packet4i& elsePacket) {+  Packet4ui select = { ifPacket.select[0], ifPacket.select[1], ifPacket.select[2], ifPacket.select[3] };+  Packet4ui mask = vec_cmpeq(select, reinterpret_cast<Packet4ui>(p4i_ONE));+  return vec_sel(elsePacket, thenPacket, mask);+}+ template<> EIGEN_STRONG_INLINE Packet4f pblend(const Selector<4>& ifPacket, const Packet4f& thenPacket, const Packet4f& elsePacket) {   Packet2ul select_hi = { ifPacket.select[0], ifPacket.select[1] };   Packet2ul select_lo = { ifPacket.select[2], ifPacket.select[3] };@@ -993,196 +931,12 @@   result.v4f[1] = vec_sel(elsePacket.v4f[1], thenPacket.v4f[1], mask_lo);   return result; }-#else-template<int Offset>-struct palign_impl<Offset,Packet4f>-{-  static EIGEN_STRONG_INLINE void run(Packet4f& first, const Packet4f& second)-  {-    switch (Offset % 4) {-    case 1:-      first = vec_sld(first, second, 4); break;-    case 2:-      first = vec_sld(first, second, 8); break;-    case 3:-      first = vec_sld(first, second, 12); break;-    }-  }-}; -template<> EIGEN_STRONG_INLINE Packet4f pload<Packet4f>(const float* from)-{-  // FIXME: No intrinsic yet-  EIGEN_DEBUG_ALIGNED_LOAD-  Packet *vfrom;-  vfrom = (Packet *) from;-  return vfrom->v4f;-}--template<> EIGEN_STRONG_INLINE void pstore<float>(float* to, const Packet4f& from)-{-  // FIXME: No intrinsic yet-  EIGEN_DEBUG_ALIGNED_STORE-  Packet *vto;-  vto = (Packet *) to;-  vto->v4f = from;-}--template<> EIGEN_STRONG_INLINE Packet4f pset1<Packet4f>(const float& from)-{-  return vec_splats(from);-}--template<> EIGEN_STRONG_INLINE void-pbroadcast4<Packet4f>(const float *a,-                      Packet4f& a0, Packet4f& a1, Packet4f& a2, Packet4f& a3)-{-  a3 = pload<Packet4f>(a);-  a0 = vec_splat(a3, 0);-  a1 = vec_splat(a3, 1);-  a2 = vec_splat(a3, 2);-  a3 = vec_splat(a3, 3);-}--template<> EIGEN_DEVICE_FUNC inline Packet4f pgather<float, Packet4f>(const float* from, Index stride)-{-  float EIGEN_ALIGN16 af[4];-  af[0] = from[0*stride];-  af[1] = from[1*stride];-  af[2] = from[2*stride];-  af[3] = from[3*stride];- return pload<Packet4f>(af);-}--template<> EIGEN_DEVICE_FUNC inline void pscatter<float, Packet4f>(float* to, const Packet4f& from, Index stride)-{-  float EIGEN_ALIGN16 af[4];-  pstore<float>((float*)af, from);-  to[0*stride] = af[0];-  to[1*stride] = af[1];-  to[2*stride] = af[2];-  to[3*stride] = af[3];-}--template<> EIGEN_STRONG_INLINE Packet4f padd<Packet4f>(const Packet4f& a, const Packet4f& b) { return (a + b); }-template<> EIGEN_STRONG_INLINE Packet4f psub<Packet4f>(const Packet4f& a, const Packet4f& b) { return (a - b); }-template<> EIGEN_STRONG_INLINE Packet4f pmul<Packet4f>(const Packet4f& a, const Packet4f& b) { return (a * b); }-template<> EIGEN_STRONG_INLINE Packet4f pdiv<Packet4f>(const Packet4f& a, const Packet4f& b) { return (a / b); }-template<> EIGEN_STRONG_INLINE Packet4f pnegate<Packet4f>(const Packet4f& a) { return (-a); }-template<> EIGEN_STRONG_INLINE Packet4f pconj<Packet4f>  (const Packet4f& a) { return a; }-template<> EIGEN_STRONG_INLINE Packet4f pmadd<Packet4f>  (const Packet4f& a, const Packet4f& b, const Packet4f& c) { return vec_madd(a, b, c); }-template<> EIGEN_STRONG_INLINE Packet4f pmin<Packet4f>   (const Packet4f& a, const Packet4f& b) { return vec_min(a, b); }-template<> EIGEN_STRONG_INLINE Packet4f pmax<Packet4f>   (const Packet4f& a, const Packet4f& b) { return vec_max(a, b); }-template<> EIGEN_STRONG_INLINE Packet4f pand<Packet4f>   (const Packet4f& a, const Packet4f& b) { return vec_and(a, b); }-template<> EIGEN_STRONG_INLINE Packet4f por<Packet4f>    (const Packet4f& a, const Packet4f& b) { return vec_or(a, b); }-template<> EIGEN_STRONG_INLINE Packet4f pxor<Packet4f>   (const Packet4f& a, const Packet4f& b) { return vec_xor(a, b); }-template<> EIGEN_STRONG_INLINE Packet4f pandnot<Packet4f>(const Packet4f& a, const Packet4f& b) { return vec_and(a, vec_nor(b, b)); }-template<> EIGEN_STRONG_INLINE Packet4f pround<Packet4f> (const Packet4f& a) { return vec_round(a); }-template<> EIGEN_STRONG_INLINE Packet4f pceil<Packet4f>  (const Packet4f& a) { return vec_ceil(a); }-template<> EIGEN_STRONG_INLINE Packet4f pfloor<Packet4f> (const Packet4f& a) { return vec_floor(a); }-template<> EIGEN_STRONG_INLINE Packet4f pabs<Packet4f>   (const Packet4f& a) { return vec_abs(a); }-template<> EIGEN_STRONG_INLINE float pfirst<Packet4f>(const Packet4f& a) { float EIGEN_ALIGN16 x[4]; pstore(x, a); return x[0]; }--template<> EIGEN_STRONG_INLINE Packet4f ploaddup<Packet4f>(const float* from)-{-  Packet4f p = pload<Packet4f>(from);-  return vec_perm(p, p, p16uc_DUPLICATE32_HI);-}--template<> EIGEN_STRONG_INLINE Packet4f preverse(const Packet4f& a)-{-  return reinterpret_cast<Packet4f>(vec_perm(reinterpret_cast<Packet16uc>(a), reinterpret_cast<Packet16uc>(a), p16uc_REVERSE32));-}--template<> EIGEN_STRONG_INLINE float predux<Packet4f>(const Packet4f& a)-{-  Packet4f b, sum;-  b   = vec_sld(a, a, 8);-  sum = padd<Packet4f>(a, b);-  b   = vec_sld(sum, sum, 4);-  sum = padd<Packet4f>(sum, b);-  return pfirst(sum);-}--template<> EIGEN_STRONG_INLINE Packet4f preduxp<Packet4f>(const Packet4f* vecs)-{-  Packet4f v[4], sum[4];--  // It's easier and faster to transpose then add as columns-  // Check: http://www.freevec.org/function/matrix_4x4_transpose_floats for explanation-  // Do the transpose, first set of moves-  v[0] = vec_mergeh(vecs[0], vecs[2]);-  v[1] = vec_mergel(vecs[0], vecs[2]);-  v[2] = vec_mergeh(vecs[1], vecs[3]);-  v[3] = vec_mergel(vecs[1], vecs[3]);-  // Get the resulting vectors-  sum[0] = vec_mergeh(v[0], v[2]);-  sum[1] = vec_mergel(v[0], v[2]);-  sum[2] = vec_mergeh(v[1], v[3]);-  sum[3] = vec_mergel(v[1], v[3]);--  // Now do the summation:-  // Lines 0+1-  sum[0] = padd<Packet4f>(sum[0], sum[1]);-  // Lines 2+3-  sum[1] = padd<Packet4f>(sum[2], sum[3]);-  // Add the results-  sum[0] = padd<Packet4f>(sum[0], sum[1]);--  return sum[0];-}--// Other reduction functions:-// mul-template<> EIGEN_STRONG_INLINE float predux_mul<Packet4f>(const Packet4f& a)-{-  Packet4f prod;-  prod = pmul(a, vec_sld(a, a, 8));-  return pfirst(pmul(prod, vec_sld(prod, prod, 4)));-}--// min-template<> EIGEN_STRONG_INLINE float predux_min<Packet4f>(const Packet4f& a)-{-  Packet4f b, res;-  b   = pmin<Packet4f>(a, vec_sld(a, a, 8));-  res = pmin<Packet4f>(b, vec_sld(b, b, 4));-  return pfirst(res);-}--// max-template<> EIGEN_STRONG_INLINE float predux_max<Packet4f>(const Packet4f& a)-{-  Packet4f b, res;-  b = pmax<Packet4f>(a, vec_sld(a, a, 8));-  res = pmax<Packet4f>(b, vec_sld(b, b, 4));-  return pfirst(res);-}--EIGEN_DEVICE_FUNC inline void-ptranspose(PacketBlock<Packet4f,4>& kernel) {-  Packet4f t0 = vec_mergeh(kernel.packet[0], kernel.packet[2]);-  Packet4f t1 = vec_mergel(kernel.packet[0], kernel.packet[2]);-  Packet4f t2 = vec_mergeh(kernel.packet[1], kernel.packet[3]);-  Packet4f t3 = vec_mergel(kernel.packet[1], kernel.packet[3]);-  kernel.packet[0] = vec_mergeh(t0, t2);-  kernel.packet[1] = vec_mergel(t0, t2);-  kernel.packet[2] = vec_mergeh(t1, t3);-  kernel.packet[3] = vec_mergel(t1, t3);-}--template<> EIGEN_STRONG_INLINE Packet4f pblend(const Selector<4>& ifPacket, const Packet4f& thenPacket, const Packet4f& elsePacket) {-  Packet4ui select = { ifPacket.select[0], ifPacket.select[1], ifPacket.select[2], ifPacket.select[3] };-  Packet4ui mask = vec_cmpeq(select, reinterpret_cast<Packet4ui>(p4i_ONE));+template<> EIGEN_STRONG_INLINE Packet2d pblend(const Selector<2>& ifPacket, const Packet2d& thenPacket, const Packet2d& elsePacket) {+  Packet2ul select = { ifPacket.select[0], ifPacket.select[1] };+  Packet2ul mask = vec_cmpeq(select, reinterpret_cast<Packet2ul>(p2l_ONE));   return vec_sel(elsePacket, thenPacket, mask); }--#endif--template<> EIGEN_STRONG_INLINE void prefetch<float>(const float*   addr) { EIGEN_ZVECTOR_PREFETCH(addr); }-template<> EIGEN_STRONG_INLINE Packet4f ploadu<Packet4f> (const float* from) { return pload<Packet4f>(from); }-template<> EIGEN_STRONG_INLINE void pstoreu<float>(float* to, const Packet4f& from) { pstore<float>(to, from); }-template<> EIGEN_STRONG_INLINE Packet4f plset<Packet4f>  (const float& a)  { return padd<Packet4f>(pset1<Packet4f>(a), p4f_COUNTDOWN); }  } // end namespace internal 
eigen3/Eigen/src/Core/functors/AssignmentFunctors.h view
@@ -144,7 +144,7 @@   EIGEN_EMPTY_STRUCT_CTOR(swap_assign_op)   EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void assignCoeff(Scalar& a, const Scalar& b) const   {-#ifdef EIGEN_CUDACC+#ifdef __CUDACC__     // FIXME is there some kind of cuda::swap?     Scalar t=b; const_cast<Scalar&>(b)=a; a=t; #else
eigen3/Eigen/src/Core/functors/UnaryFunctors.h view
@@ -264,26 +264,6 @@  /** \internal   *-  * \brief Template functor to compute the exponential of a scalar - 1.-  *-  * \sa class CwiseUnaryOp, ArrayBase::expm1()-  */-template<typename Scalar> struct scalar_expm1_op {-  EIGEN_EMPTY_STRUCT_CTOR(scalar_expm1_op)-  EIGEN_DEVICE_FUNC inline const Scalar operator() (const Scalar& a) const { return numext::expm1(a); }-  template <typename Packet>-  EIGEN_DEVICE_FUNC inline Packet packetOp(const Packet& a) const { return internal::pexpm1(a); }-};-template <typename Scalar>-struct functor_traits<scalar_expm1_op<Scalar> > {-  enum {-    PacketAccess = packet_traits<Scalar>::HasExpm1,-    Cost = functor_traits<scalar_exp_op<Scalar> >::Cost // TODO measure cost of expm1-  };-};--/** \internal-  *   * \brief Template functor to compute the logarithm of a scalar   *   * \sa class CwiseUnaryOp, ArrayBase::log()@@ -698,13 +678,7 @@ template<typename Scalar> struct scalar_isnan_op {   EIGEN_EMPTY_STRUCT_CTOR(scalar_isnan_op)   typedef bool result_type;-  EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE result_type operator() (const Scalar& a) const {-#if defined(__SYCL_DEVICE_ONLY__)-    return numext::isnan(a);-#else  -    return (numext::isnan)(a);-#endif-  }+  EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE result_type operator() (const Scalar& a) const { return (numext::isnan)(a); } }; template<typename Scalar> struct functor_traits<scalar_isnan_op<Scalar> >@@ -722,13 +696,7 @@ template<typename Scalar> struct scalar_isinf_op {   EIGEN_EMPTY_STRUCT_CTOR(scalar_isinf_op)   typedef bool result_type;-  EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE result_type operator() (const Scalar& a) const {-#if defined(__SYCL_DEVICE_ONLY__)-    return numext::isinf(a);-#else-    return (numext::isinf)(a);-#endif-  }+  EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE result_type operator() (const Scalar& a) const { return (numext::isinf)(a); } }; template<typename Scalar> struct functor_traits<scalar_isinf_op<Scalar> >@@ -746,13 +714,7 @@ template<typename Scalar> struct scalar_isfinite_op {   EIGEN_EMPTY_STRUCT_CTOR(scalar_isfinite_op)   typedef bool result_type;-  EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE result_type operator() (const Scalar& a) const {-#if defined(__SYCL_DEVICE_ONLY__)-    return numext::isfinite(a);-#else-    return (numext::isfinite)(a);-#endif-  }+  EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE result_type operator() (const Scalar& a) const { return (numext::isfinite)(a); } }; template<typename Scalar> struct functor_traits<scalar_isfinite_op<Scalar> >
eigen3/Eigen/src/Core/products/GeneralBlockPanelKernel.h view
@@ -580,7 +580,7 @@ }  template<typename Packet>-const DoublePacket<Packet>& predux_half_dowto4(const DoublePacket<Packet> &a)+const DoublePacket<Packet>& predux_downto4(const DoublePacket<Packet> &a) {   return a; }@@ -1197,10 +1197,16 @@             EIGEN_ASM_COMMENT("begin gebp micro kernel 2pX4");             RhsPacket B_0, B1, B2, B3, T0; -   #define EIGEN_GEBGP_ONESTEP(K) \+          // NOTE: the begin/end asm comments below work around bug 935!+          // but they are not enough for gcc>=6 without FMA (bug 1637)+          #if EIGEN_GNUC_AT_LEAST(6,0) && defined(EIGEN_VECTORIZE_SSE)+            #define EIGEN_GEBP_2PX4_SPILLING_WORKAROUND __asm__  ("" : [a0] "+x,m" (A0),[a1] "+x,m" (A1));+          #else+            #define EIGEN_GEBP_2PX4_SPILLING_WORKAROUND+          #endif+          #define EIGEN_GEBGP_ONESTEP(K) \             do {                                                                \               EIGEN_ASM_COMMENT("begin step of gebp micro kernel 2pX4");        \-              EIGEN_ASM_COMMENT("Note: these asm comments work around bug 935!"); \               traits.loadLhs(&blA[(0+2*K)*LhsProgress], A0);                    \               traits.loadLhs(&blA[(1+2*K)*LhsProgress], A1);                    \               traits.broadcastRhs(&blB[(0+4*K)*RhsProgress], B_0, B1, B2, B3);  \@@ -1212,6 +1218,7 @@               traits.madd(A1, B2,  C6, B2);                                     \               traits.madd(A0, B3,  C3, T0);                                     \               traits.madd(A1, B3,  C7, B3);                                     \+              EIGEN_GEBP_2PX4_SPILLING_WORKAROUND                               \               EIGEN_ASM_COMMENT("end step of gebp micro kernel 2pX4");          \             } while(false)             @@ -1523,13 +1530,13 @@           prefetch(&blA[0]);           const RhsScalar* blB = &blockB[j2*strideB+offsetB*nr]; -          // The following piece of code won't work for 512 bit registers+          // The following piece of code wont work for 512 bit registers           // Moreover, if LhsProgress==8 it assumes that there is a half packet of the same size           // as nr (which is currently 4) for the return type.-          typedef typename unpacket_traits<SResPacket>::half SResPacketHalf;+          const int SResPacketHalfSize = unpacket_traits<typename unpacket_traits<SResPacket>::half>::size;           if ((SwappedTraits::LhsProgress % 4) == 0 &&               (SwappedTraits::LhsProgress <= 8) &&-              (SwappedTraits::LhsProgress!=8 || unpacket_traits<SResPacketHalf>::size==nr))+              (SwappedTraits::LhsProgress!=8 || SResPacketHalfSize==nr))           {             SAccPacket C0, C1, C2, C3;             straits.initAcc(C0);@@ -1596,13 +1603,13 @@                 SRhsPacketHalf b0;                 straits.loadLhsUnaligned(blB, a0);                 straits.loadRhs(blA, b0);-                SAccPacketHalf c0 = predux_half_dowto4(C0);+                SAccPacketHalf c0 = predux_downto4(C0);                 straits.madd(a0,b0,c0,b0);                 straits.acc(c0, alphav, R);               }               else               {-                straits.acc(predux_half_dowto4(C0), alphav, R);+                straits.acc(predux_downto4(C0), alphav, R);               }               res.scatterPacket(i, j2, R);             }@@ -1924,7 +1931,7 @@ //       const Scalar* b6 = &rhs[(j2+6)*rhsStride]; //       const Scalar* b7 = &rhs[(j2+7)*rhsStride]; //       Index k=0;-//       if(PacketSize==8) // TODO enable vectorized transposition for PacketSize==4+//       if(PacketSize==8) // TODO enbale vectorized transposition for PacketSize==4 //       { //         for(; k<peeled_k; k+=PacketSize) { //           PacketBlock<Packet> kernel;
eigen3/Eigen/src/Core/products/GeneralMatrixMatrix.h view
@@ -427,13 +427,7 @@   template<typename Dst>   static void evalTo(Dst& dst, const Lhs& lhs, const Rhs& rhs)   {-    // See http://eigen.tuxfamily.org/bz/show_bug.cgi?id=404 for a discussion and helper program-    // to determine the following heuristic.-    // EIGEN_GEMM_TO_COEFFBASED_THRESHOLD is typically defined to 20 in GeneralProduct.h,-    // unless it has been specialized by the user or for a given architecture.-    // Note that the condition rhs.rows()>0 was required because lazy produc is (was?) not happy with empty inputs.-    // I'm not sure it is still required.-    if((rhs.rows()+dst.rows()+dst.cols())<EIGEN_GEMM_TO_COEFFBASED_THRESHOLD && rhs.rows()>0)+    if((rhs.rows()+dst.rows()+dst.cols())<20 && rhs.rows()>0)       lazyproduct::evalTo(dst, lhs, rhs);     else     {@@ -445,7 +439,7 @@   template<typename Dst>   static void addTo(Dst& dst, const Lhs& lhs, const Rhs& rhs)   {-    if((rhs.rows()+dst.rows()+dst.cols())<EIGEN_GEMM_TO_COEFFBASED_THRESHOLD && rhs.rows()>0)+    if((rhs.rows()+dst.rows()+dst.cols())<20 && rhs.rows()>0)       lazyproduct::addTo(dst, lhs, rhs);     else       scaleAndAddTo(dst,lhs, rhs, Scalar(1));@@ -454,7 +448,7 @@   template<typename Dst>   static void subTo(Dst& dst, const Lhs& lhs, const Rhs& rhs)   {-    if((rhs.rows()+dst.rows()+dst.cols())<EIGEN_GEMM_TO_COEFFBASED_THRESHOLD && rhs.rows()>0)+    if((rhs.rows()+dst.rows()+dst.cols())<20 && rhs.rows()>0)       lazyproduct::subTo(dst, lhs, rhs);     else       scaleAndAddTo(dst, lhs, rhs, Scalar(-1));
eigen3/Eigen/src/Core/products/GeneralMatrixMatrixTriangular.h view
@@ -296,13 +296,13 @@  template<typename MatrixType, unsigned int UpLo> template<typename ProductType>-EIGEN_DEVICE_FUNC TriangularView<MatrixType,UpLo>& TriangularViewImpl<MatrixType,UpLo,Dense>::_assignProduct(const ProductType& prod, const Scalar& alpha, bool beta)+TriangularView<MatrixType,UpLo>& TriangularViewImpl<MatrixType,UpLo,Dense>::_assignProduct(const ProductType& prod, const Scalar& alpha, bool beta) {   EIGEN_STATIC_ASSERT((UpLo&UnitDiag)==0, WRITING_TO_TRIANGULAR_PART_WITH_UNIT_DIAGONAL_IS_NOT_SUPPORTED);   eigen_assert(derived().nestedExpression().rows() == prod.rows() && derived().cols() == prod.cols());-+     general_product_to_triangular_selector<MatrixType, ProductType, UpLo, internal::traits<ProductType>::InnerSize==1>::run(derived().nestedExpression().const_cast_derived(), prod, alpha, beta);-+     return derived(); } 
eigen3/Eigen/src/Core/products/GeneralMatrixMatrixTriangular_BLAS.h view
@@ -37,7 +37,7 @@  namespace internal { -template <typename Index, typename Scalar, int AStorageOrder, bool ConjugateA, int ResStorageOrder, int UpLo>+template <typename Index, typename Scalar, int AStorageOrder, bool ConjugateA, int ResStorageOrder, int  UpLo> struct general_matrix_matrix_rankupdate :        general_matrix_matrix_triangular_product<          Index,Scalar,AStorageOrder,ConjugateA,Scalar,AStorageOrder,ConjugateA,ResStorageOrder,UpLo,BuiltIn> {};
eigen3/Eigen/src/Core/products/GeneralMatrixVector.h view
@@ -1,7 +1,7 @@ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. //-// Copyright (C) 2008-2016 Gael Guennebaud <gael.guennebaud@inria.fr>+// Copyright (C) 2008-2009 Gael Guennebaud <gael.guennebaud@inria.fr> // // 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@@ -15,8 +15,10 @@ namespace internal {  /* Optimized col-major matrix * vector product:- * This algorithm processes the matrix per vertical panels,- * which are then processed horizontaly per chunck of 8*PacketSize x 1 vertical segments.+ * This algorithm processes 4 columns at onces that allows to both reduce+ * the number of load/stores of the result by a factor 4 and to reduce+ * the instruction dependency. Moreover, we know that all bands have the+ * same alignment pattern.  *  * Mixing type logic: C += alpha * A * B  *  |  A  |  B  |alpha| comments@@ -25,7 +27,33 @@  *  |cplx |real |cplx | invalid, the caller has to do tmp: = A * B; C += alpha*tmp  *  |cplx |real |real | optimal case, vectorization possible via real-cplx mul  *+ * Accesses to the matrix coefficients follow the following logic:+ *+ * - if all columns have the same alignment then+ *   - if the columns have the same alignment as the result vector, then easy! (-> AllAligned case)+ *   - otherwise perform unaligned loads only (-> NoneAligned case)+ * - otherwise+ *   - if even columns have the same alignment then+ *     // odd columns are guaranteed to have the same alignment too+ *     - if even or odd columns have the same alignment as the result, then+ *       // for a register size of 2 scalars, this is guarantee to be the case (e.g., SSE with double)+ *       - perform half aligned and half unaligned loads (-> EvenAligned case)+ *     - otherwise perform unaligned loads only (-> NoneAligned case)+ *   - otherwise, if the register size is 4 scalars (e.g., SSE with float) then+ *     - one over 4 consecutive columns is guaranteed to be aligned with the result vector,+ *       perform simple aligned loads for this column and aligned loads plus re-alignment for the other. (-> FirstAligned case)+ *       // this re-alignment is done by the palign function implemented for SSE in Eigen/src/Core/arch/SSE/PacketMath.h+ *   - otherwise,+ *     // if we get here, this means the register size is greater than 4 (e.g., AVX with floats),+ *     // we currently fall back to the NoneAligned case+ *  * The same reasoning apply for the transposed case.+ *+ * The last case (PacketSize>4) could probably be improved by generalizing the FirstAligned case, but since we do not support AVX yet...+ * One might also wonder why in the EvenAligned case we perform unaligned loads instead of using the aligned-loads plus re-alignment+ * strategy as in the FirstAligned case. The reason is that we observed that unaligned loads on a 8 byte boundary are not too slow+ * compared to unaligned loads on a 4 byte boundary.+ *  */ template<typename Index, typename LhsScalar, typename LhsMapper, bool ConjugateLhs, typename RhsScalar, typename RhsMapper, bool ConjugateRhs, int Version> struct general_matrix_vector_product<Index,LhsScalar,LhsMapper,ColMajor,ConjugateLhs,RhsScalar,RhsMapper,ConjugateRhs,Version>@@ -59,149 +87,242 @@ template<typename Index, typename LhsScalar, typename LhsMapper, bool ConjugateLhs, typename RhsScalar, typename RhsMapper, bool ConjugateRhs, int Version> EIGEN_DONT_INLINE void general_matrix_vector_product<Index,LhsScalar,LhsMapper,ColMajor,ConjugateLhs,RhsScalar,RhsMapper,ConjugateRhs,Version>::run(   Index rows, Index cols,-  const LhsMapper& alhs,+  const LhsMapper& lhs,   const RhsMapper& rhs,         ResScalar* res, Index resIncr,   RhsScalar alpha) {   EIGEN_UNUSED_VARIABLE(resIncr);   eigen_internal_assert(resIncr==1);+  #ifdef _EIGEN_ACCUMULATE_PACKETS+  #error _EIGEN_ACCUMULATE_PACKETS has already been defined+  #endif+  #define _EIGEN_ACCUMULATE_PACKETS(Alignment0,Alignment13,Alignment2) \+    pstore(&res[j], \+      padd(pload<ResPacket>(&res[j]), \+        padd( \+      padd(pcj.pmul(lhs0.template load<LhsPacket, Alignment0>(j),    ptmp0), \+      pcj.pmul(lhs1.template load<LhsPacket, Alignment13>(j),   ptmp1)),   \+      padd(pcj.pmul(lhs2.template load<LhsPacket, Alignment2>(j),    ptmp2), \+      pcj.pmul(lhs3.template load<LhsPacket, Alignment13>(j),   ptmp3)) ))) -  // The following copy tells the compiler that lhs's attributes are not modified outside this function-  // This helps GCC to generate propoer code.-  LhsMapper lhs(alhs);+  typedef typename LhsMapper::VectorMapper LhsScalars;    conj_helper<LhsScalar,RhsScalar,ConjugateLhs,ConjugateRhs> cj;   conj_helper<LhsPacket,RhsPacket,ConjugateLhs,ConjugateRhs> pcj;+  if(ConjugateRhs)+    alpha = numext::conj(alpha);++  enum { AllAligned = 0, EvenAligned, FirstAligned, NoneAligned };+  const Index columnsAtOnce = 4;+  const Index peels = 2;+  const Index LhsPacketAlignedMask = LhsPacketSize-1;+  const Index ResPacketAlignedMask = ResPacketSize-1;+//  const Index PeelAlignedMask = ResPacketSize*peels-1;+  const Index size = rows;+   const Index lhsStride = lhs.stride();-  // TODO: for padded aligned inputs, we could enable aligned reads-  enum { LhsAlignment = Unaligned }; -  const Index n8 = rows-8*ResPacketSize+1;-  const Index n4 = rows-4*ResPacketSize+1;-  const Index n3 = rows-3*ResPacketSize+1;-  const Index n2 = rows-2*ResPacketSize+1;-  const Index n1 = rows-1*ResPacketSize+1;+  // How many coeffs of the result do we have to skip to be aligned.+  // Here we assume data are at least aligned on the base scalar type.+  Index alignedStart = internal::first_default_aligned(res,size);+  Index alignedSize = ResPacketSize>1 ? alignedStart + ((size-alignedStart) & ~ResPacketAlignedMask) : 0;+  const Index peeledSize = alignedSize - RhsPacketSize*peels - RhsPacketSize + 1; -  // TODO: improve the following heuristic:-  const Index block_cols = cols<128 ? cols : (lhsStride*sizeof(LhsScalar)<32000?16:4);-  ResPacket palpha = pset1<ResPacket>(alpha);+  const Index alignmentStep = LhsPacketSize>1 ? (LhsPacketSize - lhsStride % LhsPacketSize) & LhsPacketAlignedMask : 0;+  Index alignmentPattern = alignmentStep==0 ? AllAligned+                       : alignmentStep==(LhsPacketSize/2) ? EvenAligned+                       : FirstAligned; -  for(Index j2=0; j2<cols; j2+=block_cols)+  // we cannot assume the first element is aligned because of sub-matrices+  const Index lhsAlignmentOffset = lhs.firstAligned(size);++  // find how many columns do we have to skip to be aligned with the result (if possible)+  Index skipColumns = 0;+  // if the data cannot be aligned (TODO add some compile time tests when possible, e.g. for floats)+  if( (lhsAlignmentOffset < 0) || (lhsAlignmentOffset == size) || (UIntPtr(res)%sizeof(ResScalar)) )   {-    Index jend = numext::mini(j2+block_cols,cols);-    Index i=0;-    for(; i<n8; i+=ResPacketSize*8)-    {-      ResPacket c0 = pset1<ResPacket>(ResScalar(0)),-                c1 = pset1<ResPacket>(ResScalar(0)),-                c2 = pset1<ResPacket>(ResScalar(0)),-                c3 = pset1<ResPacket>(ResScalar(0)),-                c4 = pset1<ResPacket>(ResScalar(0)),-                c5 = pset1<ResPacket>(ResScalar(0)),-                c6 = pset1<ResPacket>(ResScalar(0)),-                c7 = pset1<ResPacket>(ResScalar(0));+    alignedSize = 0;+    alignedStart = 0;+    alignmentPattern = NoneAligned;+  }+  else if(LhsPacketSize > 4)+  {+    // TODO: extend the code to support aligned loads whenever possible when LhsPacketSize > 4.+    // Currently, it seems to be better to perform unaligned loads anyway+    alignmentPattern = NoneAligned;+  }+  else if (LhsPacketSize>1)+  {+  //    eigen_internal_assert(size_t(firstLhs+lhsAlignmentOffset)%sizeof(LhsPacket)==0 || size<LhsPacketSize); -      for(Index j=j2; j<jend; j+=1)-      {-        RhsPacket b0 = pset1<RhsPacket>(rhs(j,0));-        c0 = pcj.pmadd(lhs.template load<LhsPacket,LhsAlignment>(i+LhsPacketSize*0,j),b0,c0);-        c1 = pcj.pmadd(lhs.template load<LhsPacket,LhsAlignment>(i+LhsPacketSize*1,j),b0,c1);-        c2 = pcj.pmadd(lhs.template load<LhsPacket,LhsAlignment>(i+LhsPacketSize*2,j),b0,c2);-        c3 = pcj.pmadd(lhs.template load<LhsPacket,LhsAlignment>(i+LhsPacketSize*3,j),b0,c3);-        c4 = pcj.pmadd(lhs.template load<LhsPacket,LhsAlignment>(i+LhsPacketSize*4,j),b0,c4);-        c5 = pcj.pmadd(lhs.template load<LhsPacket,LhsAlignment>(i+LhsPacketSize*5,j),b0,c5);-        c6 = pcj.pmadd(lhs.template load<LhsPacket,LhsAlignment>(i+LhsPacketSize*6,j),b0,c6);-        c7 = pcj.pmadd(lhs.template load<LhsPacket,LhsAlignment>(i+LhsPacketSize*7,j),b0,c7);-      }-      pstoreu(res+i+ResPacketSize*0, pmadd(c0,palpha,ploadu<ResPacket>(res+i+ResPacketSize*0)));-      pstoreu(res+i+ResPacketSize*1, pmadd(c1,palpha,ploadu<ResPacket>(res+i+ResPacketSize*1)));-      pstoreu(res+i+ResPacketSize*2, pmadd(c2,palpha,ploadu<ResPacket>(res+i+ResPacketSize*2)));-      pstoreu(res+i+ResPacketSize*3, pmadd(c3,palpha,ploadu<ResPacket>(res+i+ResPacketSize*3)));-      pstoreu(res+i+ResPacketSize*4, pmadd(c4,palpha,ploadu<ResPacket>(res+i+ResPacketSize*4)));-      pstoreu(res+i+ResPacketSize*5, pmadd(c5,palpha,ploadu<ResPacket>(res+i+ResPacketSize*5)));-      pstoreu(res+i+ResPacketSize*6, pmadd(c6,palpha,ploadu<ResPacket>(res+i+ResPacketSize*6)));-      pstoreu(res+i+ResPacketSize*7, pmadd(c7,palpha,ploadu<ResPacket>(res+i+ResPacketSize*7)));+    while (skipColumns<LhsPacketSize &&+          alignedStart != ((lhsAlignmentOffset + alignmentStep*skipColumns)%LhsPacketSize))+      ++skipColumns;+    if (skipColumns==LhsPacketSize)+    {+      // nothing can be aligned, no need to skip any column+      alignmentPattern = NoneAligned;+      skipColumns = 0;     }-    if(i<n4)+    else     {-      ResPacket c0 = pset1<ResPacket>(ResScalar(0)),-                c1 = pset1<ResPacket>(ResScalar(0)),-                c2 = pset1<ResPacket>(ResScalar(0)),-                c3 = pset1<ResPacket>(ResScalar(0));+      skipColumns = (std::min)(skipColumns,cols);+      // note that the skiped columns are processed later.+    } -      for(Index j=j2; j<jend; j+=1)-      {-        RhsPacket b0 = pset1<RhsPacket>(rhs(j,0));-        c0 = pcj.pmadd(lhs.template load<LhsPacket,LhsAlignment>(i+LhsPacketSize*0,j),b0,c0);-        c1 = pcj.pmadd(lhs.template load<LhsPacket,LhsAlignment>(i+LhsPacketSize*1,j),b0,c1);-        c2 = pcj.pmadd(lhs.template load<LhsPacket,LhsAlignment>(i+LhsPacketSize*2,j),b0,c2);-        c3 = pcj.pmadd(lhs.template load<LhsPacket,LhsAlignment>(i+LhsPacketSize*3,j),b0,c3);-      }-      pstoreu(res+i+ResPacketSize*0, pmadd(c0,palpha,ploadu<ResPacket>(res+i+ResPacketSize*0)));-      pstoreu(res+i+ResPacketSize*1, pmadd(c1,palpha,ploadu<ResPacket>(res+i+ResPacketSize*1)));-      pstoreu(res+i+ResPacketSize*2, pmadd(c2,palpha,ploadu<ResPacket>(res+i+ResPacketSize*2)));-      pstoreu(res+i+ResPacketSize*3, pmadd(c3,palpha,ploadu<ResPacket>(res+i+ResPacketSize*3)));+    /*    eigen_internal_assert(  (alignmentPattern==NoneAligned)+                      || (skipColumns + columnsAtOnce >= cols)+                      || LhsPacketSize > size+                      || (size_t(firstLhs+alignedStart+lhsStride*skipColumns)%sizeof(LhsPacket))==0);*/+  }+  else if(Vectorizable)+  {+    alignedStart = 0;+    alignedSize = size;+    alignmentPattern = AllAligned;+  } -      i+=ResPacketSize*4;-    }-    if(i<n3)-    {-      ResPacket c0 = pset1<ResPacket>(ResScalar(0)),-                c1 = pset1<ResPacket>(ResScalar(0)),-                c2 = pset1<ResPacket>(ResScalar(0));+  const Index offset1 = (alignmentPattern==FirstAligned && alignmentStep==1)?3:1;+  const Index offset3 = (alignmentPattern==FirstAligned && alignmentStep==1)?1:3; -      for(Index j=j2; j<jend; j+=1)-      {-        RhsPacket b0 = pset1<RhsPacket>(rhs(j,0));-        c0 = pcj.pmadd(lhs.template load<LhsPacket,LhsAlignment>(i+LhsPacketSize*0,j),b0,c0);-        c1 = pcj.pmadd(lhs.template load<LhsPacket,LhsAlignment>(i+LhsPacketSize*1,j),b0,c1);-        c2 = pcj.pmadd(lhs.template load<LhsPacket,LhsAlignment>(i+LhsPacketSize*2,j),b0,c2);-      }-      pstoreu(res+i+ResPacketSize*0, pmadd(c0,palpha,ploadu<ResPacket>(res+i+ResPacketSize*0)));-      pstoreu(res+i+ResPacketSize*1, pmadd(c1,palpha,ploadu<ResPacket>(res+i+ResPacketSize*1)));-      pstoreu(res+i+ResPacketSize*2, pmadd(c2,palpha,ploadu<ResPacket>(res+i+ResPacketSize*2)));+  Index columnBound = ((cols-skipColumns)/columnsAtOnce)*columnsAtOnce + skipColumns;+  for (Index i=skipColumns; i<columnBound; i+=columnsAtOnce)+  {+    RhsPacket ptmp0 = pset1<RhsPacket>(alpha*rhs(i, 0)),+              ptmp1 = pset1<RhsPacket>(alpha*rhs(i+offset1, 0)),+              ptmp2 = pset1<RhsPacket>(alpha*rhs(i+2, 0)),+              ptmp3 = pset1<RhsPacket>(alpha*rhs(i+offset3, 0)); -      i+=ResPacketSize*3;-    }-    if(i<n2)+    // this helps a lot generating better binary code+    const LhsScalars lhs0 = lhs.getVectorMapper(0, i+0),   lhs1 = lhs.getVectorMapper(0, i+offset1),+                     lhs2 = lhs.getVectorMapper(0, i+2),   lhs3 = lhs.getVectorMapper(0, i+offset3);++    if (Vectorizable)     {-      ResPacket c0 = pset1<ResPacket>(ResScalar(0)),-                c1 = pset1<ResPacket>(ResScalar(0));+      /* explicit vectorization */+      // process initial unaligned coeffs+      for (Index j=0; j<alignedStart; ++j)+      {+        res[j] = cj.pmadd(lhs0(j), pfirst(ptmp0), res[j]);+        res[j] = cj.pmadd(lhs1(j), pfirst(ptmp1), res[j]);+        res[j] = cj.pmadd(lhs2(j), pfirst(ptmp2), res[j]);+        res[j] = cj.pmadd(lhs3(j), pfirst(ptmp3), res[j]);+      } -      for(Index j=j2; j<jend; j+=1)+      if (alignedSize>alignedStart)       {-        RhsPacket b0 = pset1<RhsPacket>(rhs(j,0));-        c0 = pcj.pmadd(lhs.template load<LhsPacket,LhsAlignment>(i+LhsPacketSize*0,j),b0,c0);-        c1 = pcj.pmadd(lhs.template load<LhsPacket,LhsAlignment>(i+LhsPacketSize*1,j),b0,c1);+        switch(alignmentPattern)+        {+          case AllAligned:+            for (Index j = alignedStart; j<alignedSize; j+=ResPacketSize)+              _EIGEN_ACCUMULATE_PACKETS(Aligned,Aligned,Aligned);+            break;+          case EvenAligned:+            for (Index j = alignedStart; j<alignedSize; j+=ResPacketSize)+              _EIGEN_ACCUMULATE_PACKETS(Aligned,Unaligned,Aligned);+            break;+          case FirstAligned:+          {+            Index j = alignedStart;+            if(peels>1)+            {+              LhsPacket A00, A01, A02, A03, A10, A11, A12, A13;+              ResPacket T0, T1;++              A01 = lhs1.template load<LhsPacket, Aligned>(alignedStart-1);+              A02 = lhs2.template load<LhsPacket, Aligned>(alignedStart-2);+              A03 = lhs3.template load<LhsPacket, Aligned>(alignedStart-3);++              for (; j<peeledSize; j+=peels*ResPacketSize)+              {+                A11 = lhs1.template load<LhsPacket, Aligned>(j-1+LhsPacketSize);  palign<1>(A01,A11);+                A12 = lhs2.template load<LhsPacket, Aligned>(j-2+LhsPacketSize);  palign<2>(A02,A12);+                A13 = lhs3.template load<LhsPacket, Aligned>(j-3+LhsPacketSize);  palign<3>(A03,A13);++                A00 = lhs0.template load<LhsPacket, Aligned>(j);+                A10 = lhs0.template load<LhsPacket, Aligned>(j+LhsPacketSize);+                T0  = pcj.pmadd(A00, ptmp0, pload<ResPacket>(&res[j]));+                T1  = pcj.pmadd(A10, ptmp0, pload<ResPacket>(&res[j+ResPacketSize]));++                T0  = pcj.pmadd(A01, ptmp1, T0);+                A01 = lhs1.template load<LhsPacket, Aligned>(j-1+2*LhsPacketSize);  palign<1>(A11,A01);+                T0  = pcj.pmadd(A02, ptmp2, T0);+                A02 = lhs2.template load<LhsPacket, Aligned>(j-2+2*LhsPacketSize);  palign<2>(A12,A02);+                T0  = pcj.pmadd(A03, ptmp3, T0);+                pstore(&res[j],T0);+                A03 = lhs3.template load<LhsPacket, Aligned>(j-3+2*LhsPacketSize);  palign<3>(A13,A03);+                T1  = pcj.pmadd(A11, ptmp1, T1);+                T1  = pcj.pmadd(A12, ptmp2, T1);+                T1  = pcj.pmadd(A13, ptmp3, T1);+                pstore(&res[j+ResPacketSize],T1);+              }+            }+            for (; j<alignedSize; j+=ResPacketSize)+              _EIGEN_ACCUMULATE_PACKETS(Aligned,Unaligned,Unaligned);+            break;+          }+          default:+            for (Index j = alignedStart; j<alignedSize; j+=ResPacketSize)+              _EIGEN_ACCUMULATE_PACKETS(Unaligned,Unaligned,Unaligned);+            break;+        }       }-      pstoreu(res+i+ResPacketSize*0, pmadd(c0,palpha,ploadu<ResPacket>(res+i+ResPacketSize*0)));-      pstoreu(res+i+ResPacketSize*1, pmadd(c1,palpha,ploadu<ResPacket>(res+i+ResPacketSize*1)));-      i+=ResPacketSize*2;+    } // end explicit vectorization++    /* process remaining coeffs (or all if there is no explicit vectorization) */+    for (Index j=alignedSize; j<size; ++j)+    {+      res[j] = cj.pmadd(lhs0(j), pfirst(ptmp0), res[j]);+      res[j] = cj.pmadd(lhs1(j), pfirst(ptmp1), res[j]);+      res[j] = cj.pmadd(lhs2(j), pfirst(ptmp2), res[j]);+      res[j] = cj.pmadd(lhs3(j), pfirst(ptmp3), res[j]);     }-    if(i<n1)+  }++  // process remaining first and last columns (at most columnsAtOnce-1)+  Index end = cols;+  Index start = columnBound;+  do+  {+    for (Index k=start; k<end; ++k)     {-      ResPacket c0 = pset1<ResPacket>(ResScalar(0));-      for(Index j=j2; j<jend; j+=1)+      RhsPacket ptmp0 = pset1<RhsPacket>(alpha*rhs(k, 0));+      const LhsScalars lhs0 = lhs.getVectorMapper(0, k);++      if (Vectorizable)       {-        RhsPacket b0 = pset1<RhsPacket>(rhs(j,0));-        c0 = pcj.pmadd(lhs.template load<LhsPacket,LhsAlignment>(i+0,j),b0,c0);+        /* explicit vectorization */+        // process first unaligned result's coeffs+        for (Index j=0; j<alignedStart; ++j)+          res[j] += cj.pmul(lhs0(j), pfirst(ptmp0));+        // process aligned result's coeffs+        if (lhs0.template aligned<LhsPacket>(alignedStart))+          for (Index i = alignedStart;i<alignedSize;i+=ResPacketSize)+            pstore(&res[i], pcj.pmadd(lhs0.template load<LhsPacket, Aligned>(i), ptmp0, pload<ResPacket>(&res[i])));+        else+          for (Index i = alignedStart;i<alignedSize;i+=ResPacketSize)+            pstore(&res[i], pcj.pmadd(lhs0.template load<LhsPacket, Unaligned>(i), ptmp0, pload<ResPacket>(&res[i])));       }-      pstoreu(res+i+ResPacketSize*0, pmadd(c0,palpha,ploadu<ResPacket>(res+i+ResPacketSize*0)));-      i+=ResPacketSize;++      // process remaining scalars (or all if no explicit vectorization)+      for (Index i=alignedSize; i<size; ++i)+        res[i] += cj.pmul(lhs0(i), pfirst(ptmp0));     }-    for(;i<rows;++i)+    if (skipColumns)     {-      ResScalar c0(0);-      for(Index j=j2; j<jend; j+=1)-        c0 += cj.pmul(lhs(i,j), rhs(j,0));-      res[i] += alpha*c0;+      start = 0;+      end = skipColumns;+      skipColumns = 0;     }-  }+    else+      break;+  } while(Vectorizable);+  #undef _EIGEN_ACCUMULATE_PACKETS }  /* Optimized row-major matrix * vector product:- * This algorithm processes 4 rows at once that allows to both reduce+ * This algorithm processes 4 rows at onces that allows to both reduce  * the number of load/stores of the result by a factor 4 and to reduce  * the instruction dependency. Moreover, we know that all bands have the  * same alignment pattern.@@ -242,160 +363,253 @@ template<typename Index, typename LhsScalar, typename LhsMapper, bool ConjugateLhs, typename RhsScalar, typename RhsMapper, bool ConjugateRhs, int Version> EIGEN_DONT_INLINE void general_matrix_vector_product<Index,LhsScalar,LhsMapper,RowMajor,ConjugateLhs,RhsScalar,RhsMapper,ConjugateRhs,Version>::run(   Index rows, Index cols,-  const LhsMapper& alhs,+  const LhsMapper& lhs,   const RhsMapper& rhs,   ResScalar* res, Index resIncr,   ResScalar alpha) {-  // The following copy tells the compiler that lhs's attributes are not modified outside this function-  // This helps GCC to generate propoer code.-  LhsMapper lhs(alhs);-   eigen_internal_assert(rhs.stride()==1);++  #ifdef _EIGEN_ACCUMULATE_PACKETS+  #error _EIGEN_ACCUMULATE_PACKETS has already been defined+  #endif++  #define _EIGEN_ACCUMULATE_PACKETS(Alignment0,Alignment13,Alignment2) {\+    RhsPacket b = rhs.getVectorMapper(j, 0).template load<RhsPacket, Aligned>(0);  \+    ptmp0 = pcj.pmadd(lhs0.template load<LhsPacket, Alignment0>(j), b, ptmp0); \+    ptmp1 = pcj.pmadd(lhs1.template load<LhsPacket, Alignment13>(j), b, ptmp1); \+    ptmp2 = pcj.pmadd(lhs2.template load<LhsPacket, Alignment2>(j), b, ptmp2); \+    ptmp3 = pcj.pmadd(lhs3.template load<LhsPacket, Alignment13>(j), b, ptmp3); }+   conj_helper<LhsScalar,RhsScalar,ConjugateLhs,ConjugateRhs> cj;   conj_helper<LhsPacket,RhsPacket,ConjugateLhs,ConjugateRhs> pcj; -  // TODO: fine tune the following heuristic. The rationale is that if the matrix is very large,-  //       processing 8 rows at once might be counter productive wrt cache.-  const Index n8 = lhs.stride()*sizeof(LhsScalar)>32000 ? 0 : rows-7;-  const Index n4 = rows-3;-  const Index n2 = rows-1;+  typedef typename LhsMapper::VectorMapper LhsScalars; -  // TODO: for padded aligned inputs, we could enable aligned reads-  enum { LhsAlignment = Unaligned };+  enum { AllAligned=0, EvenAligned=1, FirstAligned=2, NoneAligned=3 };+  const Index rowsAtOnce = 4;+  const Index peels = 2;+  const Index RhsPacketAlignedMask = RhsPacketSize-1;+  const Index LhsPacketAlignedMask = LhsPacketSize-1;+  const Index depth = cols;+  const Index lhsStride = lhs.stride(); -  Index i=0;-  for(; i<n8; i+=8)-  {-    ResPacket c0 = pset1<ResPacket>(ResScalar(0)),-              c1 = pset1<ResPacket>(ResScalar(0)),-              c2 = pset1<ResPacket>(ResScalar(0)),-              c3 = pset1<ResPacket>(ResScalar(0)),-              c4 = pset1<ResPacket>(ResScalar(0)),-              c5 = pset1<ResPacket>(ResScalar(0)),-              c6 = pset1<ResPacket>(ResScalar(0)),-              c7 = pset1<ResPacket>(ResScalar(0));+  // How many coeffs of the result do we have to skip to be aligned.+  // Here we assume data are at least aligned on the base scalar type+  // if that's not the case then vectorization is discarded, see below.+  Index alignedStart = rhs.firstAligned(depth);+  Index alignedSize = RhsPacketSize>1 ? alignedStart + ((depth-alignedStart) & ~RhsPacketAlignedMask) : 0;+  const Index peeledSize = alignedSize - RhsPacketSize*peels - RhsPacketSize + 1; -    Index j=0;-    for(; j+LhsPacketSize<=cols; j+=LhsPacketSize)-    {-      RhsPacket b0 = rhs.template load<RhsPacket, Unaligned>(j,0);+  const Index alignmentStep = LhsPacketSize>1 ? (LhsPacketSize - lhsStride % LhsPacketSize) & LhsPacketAlignedMask : 0;+  Index alignmentPattern = alignmentStep==0 ? AllAligned+                           : alignmentStep==(LhsPacketSize/2) ? EvenAligned+                           : FirstAligned; -      c0 = pcj.pmadd(lhs.template load<LhsPacket,LhsAlignment>(i+0,j),b0,c0);-      c1 = pcj.pmadd(lhs.template load<LhsPacket,LhsAlignment>(i+1,j),b0,c1);-      c2 = pcj.pmadd(lhs.template load<LhsPacket,LhsAlignment>(i+2,j),b0,c2);-      c3 = pcj.pmadd(lhs.template load<LhsPacket,LhsAlignment>(i+3,j),b0,c3);-      c4 = pcj.pmadd(lhs.template load<LhsPacket,LhsAlignment>(i+4,j),b0,c4);-      c5 = pcj.pmadd(lhs.template load<LhsPacket,LhsAlignment>(i+5,j),b0,c5);-      c6 = pcj.pmadd(lhs.template load<LhsPacket,LhsAlignment>(i+6,j),b0,c6);-      c7 = pcj.pmadd(lhs.template load<LhsPacket,LhsAlignment>(i+7,j),b0,c7);-    }-    ResScalar cc0 = predux(c0);-    ResScalar cc1 = predux(c1);-    ResScalar cc2 = predux(c2);-    ResScalar cc3 = predux(c3);-    ResScalar cc4 = predux(c4);-    ResScalar cc5 = predux(c5);-    ResScalar cc6 = predux(c6);-    ResScalar cc7 = predux(c7);-    for(; j<cols; ++j)-    {-      RhsScalar b0 = rhs(j,0);+  // we cannot assume the first element is aligned because of sub-matrices+  const Index lhsAlignmentOffset = lhs.firstAligned(depth);+  const Index rhsAlignmentOffset = rhs.firstAligned(rows); -      cc0 += cj.pmul(lhs(i+0,j), b0);-      cc1 += cj.pmul(lhs(i+1,j), b0);-      cc2 += cj.pmul(lhs(i+2,j), b0);-      cc3 += cj.pmul(lhs(i+3,j), b0);-      cc4 += cj.pmul(lhs(i+4,j), b0);-      cc5 += cj.pmul(lhs(i+5,j), b0);-      cc6 += cj.pmul(lhs(i+6,j), b0);-      cc7 += cj.pmul(lhs(i+7,j), b0);-    }-    res[(i+0)*resIncr] += alpha*cc0;-    res[(i+1)*resIncr] += alpha*cc1;-    res[(i+2)*resIncr] += alpha*cc2;-    res[(i+3)*resIncr] += alpha*cc3;-    res[(i+4)*resIncr] += alpha*cc4;-    res[(i+5)*resIncr] += alpha*cc5;-    res[(i+6)*resIncr] += alpha*cc6;-    res[(i+7)*resIncr] += alpha*cc7;+  // find how many rows do we have to skip to be aligned with rhs (if possible)+  Index skipRows = 0;+  // if the data cannot be aligned (TODO add some compile time tests when possible, e.g. for floats)+  if( (sizeof(LhsScalar)!=sizeof(RhsScalar)) ||+      (lhsAlignmentOffset < 0) || (lhsAlignmentOffset == depth) ||+      (rhsAlignmentOffset < 0) || (rhsAlignmentOffset == rows) )+  {+    alignedSize = 0;+    alignedStart = 0;+    alignmentPattern = NoneAligned;   }-  for(; i<n4; i+=4)+  else if(LhsPacketSize > 4)   {-    ResPacket c0 = pset1<ResPacket>(ResScalar(0)),-              c1 = pset1<ResPacket>(ResScalar(0)),-              c2 = pset1<ResPacket>(ResScalar(0)),-              c3 = pset1<ResPacket>(ResScalar(0));+    // TODO: extend the code to support aligned loads whenever possible when LhsPacketSize > 4.+    alignmentPattern = NoneAligned;+  }+  else if (LhsPacketSize>1)+  {+  //    eigen_internal_assert(size_t(firstLhs+lhsAlignmentOffset)%sizeof(LhsPacket)==0  || depth<LhsPacketSize); -    Index j=0;-    for(; j+LhsPacketSize<=cols; j+=LhsPacketSize)+    while (skipRows<LhsPacketSize &&+           alignedStart != ((lhsAlignmentOffset + alignmentStep*skipRows)%LhsPacketSize))+      ++skipRows;+    if (skipRows==LhsPacketSize)     {-      RhsPacket b0 = rhs.template load<RhsPacket, Unaligned>(j,0);--      c0 = pcj.pmadd(lhs.template load<LhsPacket,LhsAlignment>(i+0,j),b0,c0);-      c1 = pcj.pmadd(lhs.template load<LhsPacket,LhsAlignment>(i+1,j),b0,c1);-      c2 = pcj.pmadd(lhs.template load<LhsPacket,LhsAlignment>(i+2,j),b0,c2);-      c3 = pcj.pmadd(lhs.template load<LhsPacket,LhsAlignment>(i+3,j),b0,c3);+      // nothing can be aligned, no need to skip any column+      alignmentPattern = NoneAligned;+      skipRows = 0;     }-    ResScalar cc0 = predux(c0);-    ResScalar cc1 = predux(c1);-    ResScalar cc2 = predux(c2);-    ResScalar cc3 = predux(c3);-    for(; j<cols; ++j)+    else     {-      RhsScalar b0 = rhs(j,0);--      cc0 += cj.pmul(lhs(i+0,j), b0);-      cc1 += cj.pmul(lhs(i+1,j), b0);-      cc2 += cj.pmul(lhs(i+2,j), b0);-      cc3 += cj.pmul(lhs(i+3,j), b0);+      skipRows = (std::min)(skipRows,Index(rows));+      // note that the skiped columns are processed later.     }-    res[(i+0)*resIncr] += alpha*cc0;-    res[(i+1)*resIncr] += alpha*cc1;-    res[(i+2)*resIncr] += alpha*cc2;-    res[(i+3)*resIncr] += alpha*cc3;+    /*    eigen_internal_assert(  alignmentPattern==NoneAligned+                      || LhsPacketSize==1+                      || (skipRows + rowsAtOnce >= rows)+                      || LhsPacketSize > depth+                      || (size_t(firstLhs+alignedStart+lhsStride*skipRows)%sizeof(LhsPacket))==0);*/   }-  for(; i<n2; i+=2)+  else if(Vectorizable)   {-    ResPacket c0 = pset1<ResPacket>(ResScalar(0)),-              c1 = pset1<ResPacket>(ResScalar(0));+    alignedStart = 0;+    alignedSize = depth;+    alignmentPattern = AllAligned;+  } -    Index j=0;-    for(; j+LhsPacketSize<=cols; j+=LhsPacketSize)-    {-      RhsPacket b0 = rhs.template load<RhsPacket, Unaligned>(j,0);+  const Index offset1 = (alignmentPattern==FirstAligned && alignmentStep==1)?3:1;+  const Index offset3 = (alignmentPattern==FirstAligned && alignmentStep==1)?1:3; -      c0 = pcj.pmadd(lhs.template load<LhsPacket,LhsAlignment>(i+0,j),b0,c0);-      c1 = pcj.pmadd(lhs.template load<LhsPacket,LhsAlignment>(i+1,j),b0,c1);-    }-    ResScalar cc0 = predux(c0);-    ResScalar cc1 = predux(c1);-    for(; j<cols; ++j)+  Index rowBound = ((rows-skipRows)/rowsAtOnce)*rowsAtOnce + skipRows;+  for (Index i=skipRows; i<rowBound; i+=rowsAtOnce)+  {+    // FIXME: what is the purpose of this EIGEN_ALIGN_DEFAULT ??+    EIGEN_ALIGN_MAX ResScalar tmp0 = ResScalar(0);+    ResScalar tmp1 = ResScalar(0), tmp2 = ResScalar(0), tmp3 = ResScalar(0);++    // this helps the compiler generating good binary code+    const LhsScalars lhs0 = lhs.getVectorMapper(i+0, 0),    lhs1 = lhs.getVectorMapper(i+offset1, 0),+                     lhs2 = lhs.getVectorMapper(i+2, 0),    lhs3 = lhs.getVectorMapper(i+offset3, 0);++    if (Vectorizable)     {-      RhsScalar b0 = rhs(j,0);+      /* explicit vectorization */+      ResPacket ptmp0 = pset1<ResPacket>(ResScalar(0)), ptmp1 = pset1<ResPacket>(ResScalar(0)),+                ptmp2 = pset1<ResPacket>(ResScalar(0)), ptmp3 = pset1<ResPacket>(ResScalar(0)); -      cc0 += cj.pmul(lhs(i+0,j), b0);-      cc1 += cj.pmul(lhs(i+1,j), b0);+      // process initial unaligned coeffs+      // FIXME this loop get vectorized by the compiler !+      for (Index j=0; j<alignedStart; ++j)+      {+        RhsScalar b = rhs(j, 0);+        tmp0 += cj.pmul(lhs0(j),b); tmp1 += cj.pmul(lhs1(j),b);+        tmp2 += cj.pmul(lhs2(j),b); tmp3 += cj.pmul(lhs3(j),b);+      }++      if (alignedSize>alignedStart)+      {+        switch(alignmentPattern)+        {+          case AllAligned:+            for (Index j = alignedStart; j<alignedSize; j+=RhsPacketSize)+              _EIGEN_ACCUMULATE_PACKETS(Aligned,Aligned,Aligned);+            break;+          case EvenAligned:+            for (Index j = alignedStart; j<alignedSize; j+=RhsPacketSize)+              _EIGEN_ACCUMULATE_PACKETS(Aligned,Unaligned,Aligned);+            break;+          case FirstAligned:+          {+            Index j = alignedStart;+            if (peels>1)+            {+              /* Here we proccess 4 rows with with two peeled iterations to hide+               * the overhead of unaligned loads. Moreover unaligned loads are handled+               * using special shift/move operations between the two aligned packets+               * overlaping the desired unaligned packet. This is *much* more efficient+               * than basic unaligned loads.+               */+              LhsPacket A01, A02, A03, A11, A12, A13;+              A01 = lhs1.template load<LhsPacket, Aligned>(alignedStart-1);+              A02 = lhs2.template load<LhsPacket, Aligned>(alignedStart-2);+              A03 = lhs3.template load<LhsPacket, Aligned>(alignedStart-3);++              for (; j<peeledSize; j+=peels*RhsPacketSize)+              {+                RhsPacket b = rhs.getVectorMapper(j, 0).template load<RhsPacket, Aligned>(0);+                A11 = lhs1.template load<LhsPacket, Aligned>(j-1+LhsPacketSize);  palign<1>(A01,A11);+                A12 = lhs2.template load<LhsPacket, Aligned>(j-2+LhsPacketSize);  palign<2>(A02,A12);+                A13 = lhs3.template load<LhsPacket, Aligned>(j-3+LhsPacketSize);  palign<3>(A03,A13);++                ptmp0 = pcj.pmadd(lhs0.template load<LhsPacket, Aligned>(j), b, ptmp0);+                ptmp1 = pcj.pmadd(A01, b, ptmp1);+                A01 = lhs1.template load<LhsPacket, Aligned>(j-1+2*LhsPacketSize);  palign<1>(A11,A01);+                ptmp2 = pcj.pmadd(A02, b, ptmp2);+                A02 = lhs2.template load<LhsPacket, Aligned>(j-2+2*LhsPacketSize);  palign<2>(A12,A02);+                ptmp3 = pcj.pmadd(A03, b, ptmp3);+                A03 = lhs3.template load<LhsPacket, Aligned>(j-3+2*LhsPacketSize);  palign<3>(A13,A03);++                b = rhs.getVectorMapper(j+RhsPacketSize, 0).template load<RhsPacket, Aligned>(0);+                ptmp0 = pcj.pmadd(lhs0.template load<LhsPacket, Aligned>(j+LhsPacketSize), b, ptmp0);+                ptmp1 = pcj.pmadd(A11, b, ptmp1);+                ptmp2 = pcj.pmadd(A12, b, ptmp2);+                ptmp3 = pcj.pmadd(A13, b, ptmp3);+              }+            }+            for (; j<alignedSize; j+=RhsPacketSize)+              _EIGEN_ACCUMULATE_PACKETS(Aligned,Unaligned,Unaligned);+            break;+          }+          default:+            for (Index j = alignedStart; j<alignedSize; j+=RhsPacketSize)+              _EIGEN_ACCUMULATE_PACKETS(Unaligned,Unaligned,Unaligned);+            break;+        }+        tmp0 += predux(ptmp0);+        tmp1 += predux(ptmp1);+        tmp2 += predux(ptmp2);+        tmp3 += predux(ptmp3);+      }+    } // end explicit vectorization++    // process remaining coeffs (or all if no explicit vectorization)+    // FIXME this loop get vectorized by the compiler !+    for (Index j=alignedSize; j<depth; ++j)+    {+      RhsScalar b = rhs(j, 0);+      tmp0 += cj.pmul(lhs0(j),b); tmp1 += cj.pmul(lhs1(j),b);+      tmp2 += cj.pmul(lhs2(j),b); tmp3 += cj.pmul(lhs3(j),b);     }-    res[(i+0)*resIncr] += alpha*cc0;-    res[(i+1)*resIncr] += alpha*cc1;+    res[i*resIncr]            += alpha*tmp0;+    res[(i+offset1)*resIncr]  += alpha*tmp1;+    res[(i+2)*resIncr]        += alpha*tmp2;+    res[(i+offset3)*resIncr]  += alpha*tmp3;   }-  for(; i<rows; ++i)++  // process remaining first and last rows (at most columnsAtOnce-1)+  Index end = rows;+  Index start = rowBound;+  do   {-    ResPacket c0 = pset1<ResPacket>(ResScalar(0));-    Index j=0;-    for(; j+LhsPacketSize<=cols; j+=LhsPacketSize)+    for (Index i=start; i<end; ++i)     {-      RhsPacket b0 = rhs.template load<RhsPacket,Unaligned>(j,0);-      c0 = pcj.pmadd(lhs.template load<LhsPacket,LhsAlignment>(i,j),b0,c0);+      EIGEN_ALIGN_MAX ResScalar tmp0 = ResScalar(0);+      ResPacket ptmp0 = pset1<ResPacket>(tmp0);+      const LhsScalars lhs0 = lhs.getVectorMapper(i, 0);+      // process first unaligned result's coeffs+      // FIXME this loop get vectorized by the compiler !+      for (Index j=0; j<alignedStart; ++j)+        tmp0 += cj.pmul(lhs0(j), rhs(j, 0));++      if (alignedSize>alignedStart)+      {+        // process aligned rhs coeffs+        if (lhs0.template aligned<LhsPacket>(alignedStart))+          for (Index j = alignedStart;j<alignedSize;j+=RhsPacketSize)+            ptmp0 = pcj.pmadd(lhs0.template load<LhsPacket, Aligned>(j), rhs.getVectorMapper(j, 0).template load<RhsPacket, Aligned>(0), ptmp0);+        else+          for (Index j = alignedStart;j<alignedSize;j+=RhsPacketSize)+            ptmp0 = pcj.pmadd(lhs0.template load<LhsPacket, Unaligned>(j), rhs.getVectorMapper(j, 0).template load<RhsPacket, Aligned>(0), ptmp0);+        tmp0 += predux(ptmp0);+      }++      // process remaining scalars+      // FIXME this loop get vectorized by the compiler !+      for (Index j=alignedSize; j<depth; ++j)+        tmp0 += cj.pmul(lhs0(j), rhs(j, 0));+      res[i*resIncr] += alpha*tmp0;     }-    ResScalar cc0 = predux(c0);-    for(; j<cols; ++j)+    if (skipRows)     {-      cc0 += cj.pmul(lhs(i,j), rhs(j,0));+      start = 0;+      end = skipRows;+      skipRows = 0;     }-    res[i*resIncr] += alpha*cc0;-  }+    else+      break;+  } while(Vectorizable);++  #undef _EIGEN_ACCUMULATE_PACKETS }  } // end namespace internal
eigen3/Eigen/src/Core/products/Parallelizer.h view
@@ -117,7 +117,7 @@   // compute the number of threads we are going to use   Index threads = std::min<Index>(nbThreads(), pb_max_threads); -  // if multi-threading is explicitly disabled, not useful, or if we already are in a parallel session,+  // if multi-threading is explicitely disabled, not useful, or if we already are in a parallel session,   // then abort multi-threading   // FIXME omp_get_num_threads()>1 only works for openmp, what if the user does not use openmp?   if((!Condition) || (threads==1) || (omp_get_num_threads()>1))
eigen3/Eigen/src/Core/products/SelfadjointMatrixVector.h view
@@ -15,7 +15,7 @@ namespace internal {  /* Optimized selfadjoint matrix * vector product:- * This algorithm processes 2 columns at once that allows to both reduce+ * This algorithm processes 2 columns at onces that allows to both reduce  * the number of load/stores of the result by a factor 2 and to reduce  * the instruction dependency.  */
eigen3/Eigen/src/Core/products/SelfadjointProduct.h view
@@ -120,7 +120,7 @@  template<typename MatrixType, unsigned int UpLo> template<typename DerivedU>-EIGEN_DEVICE_FUNC SelfAdjointView<MatrixType,UpLo>& SelfAdjointView<MatrixType,UpLo>+SelfAdjointView<MatrixType,UpLo>& SelfAdjointView<MatrixType,UpLo> ::rankUpdate(const MatrixBase<DerivedU>& u, const Scalar& alpha) {   selfadjoint_product_selector<MatrixType,DerivedU,UpLo>::run(_expression().const_cast_derived(), u.derived(), alpha);
eigen3/Eigen/src/Core/products/SelfadjointRank2Update.h view
@@ -57,7 +57,7 @@  template<typename MatrixType, unsigned int UpLo> template<typename DerivedU, typename DerivedV>-EIGEN_DEVICE_FUNC SelfAdjointView<MatrixType,UpLo>& SelfAdjointView<MatrixType,UpLo>+SelfAdjointView<MatrixType,UpLo>& SelfAdjointView<MatrixType,UpLo> ::rankUpdate(const MatrixBase<DerivedU>& u, const MatrixBase<DerivedV>& v, const Scalar& alpha) {   typedef internal::blas_traits<DerivedU> UBlasTraits;
eigen3/Eigen/src/Core/util/BlasUtil.h view
@@ -222,11 +222,6 @@     return ploadt<Packet, AlignmentType>(&operator()(i, j));   } -  template <typename PacketT, int AlignmentT>-  EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE PacketT load(Index i, Index j) const {-    return ploadt<PacketT, AlignmentT>(&operator()(i, j));-  }-   EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE HalfPacket loadHalfPacket(Index i, Index j) const {     return ploadt<HalfPacket, AlignmentType>(&operator()(i, j));   }
eigen3/Eigen/src/Core/util/Constants.h view
@@ -25,10 +25,6 @@   */ const int DynamicIndex = 0xffffff; -/** This value means that the increment to go from one value to another in a sequence is not constant for each step.-  */-const int UndefinedIncr = 0xfffffe;- /** This value means +Infinity; it is currently used only as the p parameter to MatrixBase::lpNorm<int>().   * The value Infinity there means the L-infinity norm.   */
eigen3/Eigen/src/Core/util/DisableStupidWarnings.h view
@@ -4,6 +4,7 @@ #ifdef _MSC_VER   // 4100 - unreferenced formal parameter (occurred e.g. in aligned_allocator::destroy(pointer p))   // 4101 - unreferenced local variable+  // 4127 - conditional expression is constant   // 4181 - qualifier applied to reference type ignored   // 4211 - nonstandard extension used : redefined extern to static   // 4244 - 'argument' : conversion from 'type1' to 'type2', possible loss of data@@ -19,7 +20,7 @@   #ifndef EIGEN_PERMANENTLY_DISABLE_STUPID_WARNINGS     #pragma warning( push )   #endif-  #pragma warning( disable : 4100 4101 4181 4211 4244 4273 4324 4503 4512 4522 4700 4714 4717 4800)+  #pragma warning( disable : 4100 4101 4127 4181 4211 4244 4273 4324 4503 4512 4522 4700 4714 4717 4800)  #elif defined __INTEL_COMPILER   // 2196 - routine is both "inline" and "noinline" ("noinline" assumed)@@ -41,17 +42,18 @@     #pragma clang diagnostic push   #endif   #pragma clang diagnostic ignored "-Wconstant-logical-operand"-  #if __clang_major__ >= 3 && __clang_minor__ >= 5-    #pragma clang diagnostic ignored "-Wabsolute-value"-  #endif  #elif defined __GNUC__ -  #ifndef EIGEN_PERMANENTLY_DISABLE_STUPID_WARNINGS+  #if (!defined(EIGEN_PERMANENTLY_DISABLE_STUPID_WARNINGS)) &&  (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))     #pragma GCC diagnostic push   #endif   // g++ warns about local variables shadowing member functions, which is too strict   #pragma GCC diagnostic ignored "-Wshadow"+  #if __GNUC__ == 4 && __GNUC_MINOR__ < 8+    // Until g++-4.7 there are warnings when comparing unsigned int vs 0, even in templated functions:+    #pragma GCC diagnostic ignored "-Wtype-limits"+  #endif   #if __GNUC__>=6     #pragma GCC diagnostic ignored "-Wignored-attributes"   #endif@@ -59,7 +61,6 @@ #endif  #if defined __NVCC__-  #pragma diag_suppress boolean_controlling_expr_is_constant   // Disable the "statement is unreachable" message   #pragma diag_suppress code_is_unreachable   // Disable the "dynamic initialization in unreachable code" message@@ -77,7 +78,6 @@   #pragma diag_suppress 2671   #pragma diag_suppress 2735   #pragma diag_suppress 2737-  #pragma diag_suppress 2739 #endif  #endif // not EIGEN_WARNINGS_DISABLED
eigen3/Eigen/src/Core/util/ForwardDeclarations.h view
@@ -83,7 +83,6 @@ template<typename ExpressionType> class SwapWrapper;  template<typename XprType, int BlockRows=Dynamic, int BlockCols=Dynamic, bool InnerPanel = false> class Block;-template<typename XprType, typename RowIndices, typename ColIndices> class IndexedView;  template<typename MatrixType, int Size=Dynamic> class VectorBlock; template<typename MatrixType> class Transpose;
eigen3/Eigen/src/Core/util/MKL_support.h view
@@ -55,11 +55,7 @@   #if defined EIGEN_USE_MKL-#   if (!defined MKL_DIRECT_CALL) && (!defined EIGEN_MKL_NO_DIRECT_CALL)-#       define MKL_DIRECT_CALL-#       define MKL_DIRECT_CALL_JUST_SET-#   endif-#   include <mkl.h>+#   include <mkl.h>  /*Check IMKL version for compatibility: < 10.3 is not usable with Eigen*/ #   ifndef INTEL_MKL_VERSION #       undef EIGEN_USE_MKL /* INTEL_MKL_VERSION is not even defined on older versions */@@ -73,9 +69,6 @@ #       undef   EIGEN_USE_MKL_VML #       undef   EIGEN_USE_LAPACKE_STRICT #       undef   EIGEN_USE_LAPACKE-#       ifdef   MKL_DIRECT_CALL_JUST_SET-#           undef MKL_DIRECT_CALL-#       endif #   endif #endif 
eigen3/Eigen/src/Core/util/Macros.h view
@@ -13,7 +13,7 @@  #define EIGEN_WORLD_VERSION 3 #define EIGEN_MAJOR_VERSION 3-#define EIGEN_MINOR_VERSION 90+#define EIGEN_MINOR_VERSION 7  #define EIGEN_VERSION_AT_LEAST(x,y,z) (EIGEN_WORLD_VERSION>x || (EIGEN_WORLD_VERSION>=x && \                                       (EIGEN_MAJOR_VERSION>y || (EIGEN_MAJOR_VERSION>=y && \@@ -23,7 +23,7 @@  /// \internal EIGEN_COMP_GNUC set to 1 for all compilers compatible with GCC #ifdef __GNUC__-  #define EIGEN_COMP_GNUC (__GNUC__*10+__GNUC_MINOR__)+  #define EIGEN_COMP_GNUC 1 #else   #define EIGEN_COMP_GNUC 0 #endif@@ -73,17 +73,12 @@  // For the record, here is a table summarizing the possible values for EIGEN_COMP_MSVC: //  name  ver   MSC_VER-//  2008         9      1500-//  2010        10      1600-//  2012        11      1700-//  2013        12      1800-//  2015        14      1900-//  "15"        15      1900-//  2017-14.1   15.0    1910-//  2017-14.11  15.3    1911-//  2017-14.12  15.5    1912-//  2017-14.13  15.6    1913-//  2017-14.14  15.7    1914+//  2008    9      1500+//  2010   10      1600+//  2012   11      1700+//  2013   12      1800+//  2015   14      1900+//  "15"   15      1900  /// \internal EIGEN_COMP_MSVC_STRICT set to 1 if the compiler is really Microsoft Visual C++ and not ,e.g., ICC or clang-cl #if EIGEN_COMP_MSVC && !(EIGEN_COMP_ICC || EIGEN_COMP_LLVM || EIGEN_COMP_CLANG)@@ -354,14 +349,6 @@ # define __has_feature(x) 0 #endif -// Some old compilers do not support template specializations like:-// template<typename T,int N> void foo(const T x[N]);-#if !( EIGEN_COMP_CLANG && ((EIGEN_COMP_CLANG<309) || defined(__apple_build_version__)) || EIGEN_COMP_GNUC_STRICT && EIGEN_COMP_GNUC<49)-#define EIGEN_HAS_STATIC_ARRAY_TEMPLATE 1-#else-#define EIGEN_HAS_STATIC_ARRAY_TEMPLATE 0-#endif- // Upperbound on the C++ version to use. // Expected values are 03, 11, 14, 17, etc. // By default, let's use an arbitrarily large C++ version.@@ -375,11 +362,6 @@ #define EIGEN_HAS_CXX11 0 #endif -#if EIGEN_MAX_CPP_VER>=14 && (defined(__cplusplus) && (__cplusplus > 201103L) || EIGEN_COMP_MSVC >= 1910)-#define EIGEN_HAS_CXX14 1-#else-#define EIGEN_HAS_CXX14 0-#endif  // Do we support r-value references? #ifndef EIGEN_HAS_RVALUE_REFERENCES@@ -398,8 +380,7 @@ #if EIGEN_MAX_CPP_VER>=11 && \     ((defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901))       \   || (defined(__GNUC__) && defined(_GLIBCXX_USE_C99)) \-  || (defined(_LIBCPP_VERSION) && !defined(_MSC_VER)) \-  || (EIGEN_COMP_MSVC >= 1900) || defined(__SYCL_DEVICE_ONLY__))+  || (defined(_LIBCPP_VERSION) && !defined(_MSC_VER)))   #define EIGEN_HAS_C99_MATH 1 #else   #define EIGEN_HAS_C99_MATH 0@@ -415,16 +396,6 @@ #endif #endif -// Does the compiler support type_trais?-#ifndef EIGEN_HAS_TYPE_TRAITS-#if EIGEN_MAX_CPP_VER>=11 && (EIGEN_HAS_CXX11 || EIGEN_COMP_MSVC >= 1700)-#define EIGEN_HAS_TYPE_TRAITS 1-#define EIGEN_INCLUDE_TYPE_TRAITS-#else-#define EIGEN_HAS_TYPE_TRAITS 0-#endif-#endif- // Does the compiler support variadic templates? #ifndef EIGEN_HAS_VARIADIC_TEMPLATES #if EIGEN_MAX_CPP_VER>=11 && (__cplusplus > 199711L || EIGEN_COMP_MSVC >= 1900) \@@ -432,8 +403,6 @@     // ^^ Disable the use of variadic templates when compiling with versions of nvcc older than 8.0 on ARM devices:     //    this prevents nvcc from crashing when compiling Eigen on Tegra X1 #define EIGEN_HAS_VARIADIC_TEMPLATES 1-#elif  EIGEN_MAX_CPP_VER>=11 && (__cplusplus > 199711L || EIGEN_COMP_MSVC >= 1900) && defined(__SYCL_DEVICE_ONLY__)-#define EIGEN_HAS_VARIADIC_TEMPLATES 1 #else #define EIGEN_HAS_VARIADIC_TEMPLATES 0 #endif@@ -442,14 +411,13 @@ // Does the compiler fully support const expressions? (as in c++14) #ifndef EIGEN_HAS_CONSTEXPR -#if defined(EIGEN_CUDACC)+#ifdef __CUDACC__ // Const expressions are supported provided that c++11 is enabled and we're using either clang or nvcc 7.5 or above #if EIGEN_MAX_CPP_VER>=14 && (__cplusplus > 199711L && (EIGEN_COMP_CLANG || EIGEN_CUDACC_VER >= 70500))   #define EIGEN_HAS_CONSTEXPR 1 #endif #elif EIGEN_MAX_CPP_VER>=14 && (__has_feature(cxx_relaxed_constexpr) || (defined(__cplusplus) && __cplusplus >= 201402L) || \-  (EIGEN_GNUC_AT_LEAST(4,8) && (__cplusplus > 199711L)) || \-  (EIGEN_COMP_CLANG >= 306 && (__cplusplus > 199711L)))+  (EIGEN_GNUC_AT_LEAST(4,8) && (__cplusplus > 199711L))) #define EIGEN_HAS_CONSTEXPR 1 #endif @@ -559,8 +527,8 @@ //  - static is not very good because it prevents definitions from different object files to be merged. //           So static causes the resulting linked executable to be bloated with multiple copies of the same function. //  - inline is not perfect either as it unwantedly hints the compiler toward inlining the function.-#define EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS EIGEN_DEVICE_FUNC-#define EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS EIGEN_DEVICE_FUNC inline+#define EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS+#define EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS inline  #ifdef NDEBUG # ifndef EIGEN_NO_DEBUG@@ -658,14 +626,6 @@ #endif  -#if EIGEN_COMP_MSVC-  // NOTE MSVC often gives C4127 warnings with compiletime if statements. See bug 1362.-  // This workaround is ugly, but it does the job.-#  define EIGEN_CONST_CONDITIONAL(cond)  (void)0, cond-#else-#  define EIGEN_CONST_CONDITIONAL(cond)  cond-#endif- //------------------------------------------------------------------------------------------ // Static and dynamic alignment control //@@ -686,7 +646,7 @@  * If we made alignment depend on whether or not EIGEN_VECTORIZE is defined, it would be impossible to link  * vectorized and non-vectorized code.  */-#if (defined EIGEN_CUDACC)+#if (defined __CUDACC__)   #define EIGEN_ALIGN_TO_BOUNDARY(n) __align__(n) #elif EIGEN_COMP_GNUC || EIGEN_COMP_PGI || EIGEN_COMP_IBM || EIGEN_COMP_ARM   #define EIGEN_ALIGN_TO_BOUNDARY(n) __attribute__((aligned(n)))@@ -703,10 +663,10 @@ #if defined(EIGEN_DONT_VECTORIZE)   #define EIGEN_IDEAL_MAX_ALIGN_BYTES 0 #elif defined(EIGEN_VECTORIZE_AVX512)-  // 64 bytes static alignment is preferred only if really required+  // 64 bytes static alignmeent is preferred only if really required   #define EIGEN_IDEAL_MAX_ALIGN_BYTES 64 #elif defined(__AVX__)-  // 32 bytes static alignment is preferred only if really required+  // 32 bytes static alignmeent is preferred only if really required   #define EIGEN_IDEAL_MAX_ALIGN_BYTES 32 #else   #define EIGEN_IDEAL_MAX_ALIGN_BYTES 16@@ -724,7 +684,7 @@ #error EIGEN_MAX_STATIC_ALIGN_BYTES and EIGEN_DONT_ALIGN[_STATICALLY] are both defined with EIGEN_MAX_STATIC_ALIGN_BYTES!=0. Use EIGEN_MAX_STATIC_ALIGN_BYTES=0 as a synonym of EIGEN_DONT_ALIGN_STATICALLY. #endif -// EIGEN_DONT_ALIGN_STATICALLY and EIGEN_DONT_ALIGN are deprecated+// EIGEN_DONT_ALIGN_STATICALLY and EIGEN_DONT_ALIGN are deprectated // They imply EIGEN_MAX_STATIC_ALIGN_BYTES=0 #if defined(EIGEN_DONT_ALIGN_STATICALLY) || defined(EIGEN_DONT_ALIGN)   #ifdef EIGEN_MAX_STATIC_ALIGN_BYTES@@ -783,7 +743,7 @@ #endif  // At this stage, EIGEN_MAX_STATIC_ALIGN_BYTES>0 is the true test whether we want to align arrays on the stack or not.-// It takes into account both the user choice to explicitly enable/disable alignment (by setting EIGEN_MAX_STATIC_ALIGN_BYTES)+// It takes into account both the user choice to explicitly enable/disable alignment (by settting EIGEN_MAX_STATIC_ALIGN_BYTES) // and the architecture config (EIGEN_ARCH_WANTS_STACK_ALIGNMENT). // Henceforth, only EIGEN_MAX_STATIC_ALIGN_BYTES should be used. @@ -896,8 +856,7 @@   typedef typename Eigen::internal::ref_selector<Derived>::type Nested; \   typedef typename Eigen::internal::traits<Derived>::StorageKind StorageKind; \   typedef typename Eigen::internal::traits<Derived>::StorageIndex StorageIndex; \-  enum CompileTimeTraits \-      { RowsAtCompileTime = Eigen::internal::traits<Derived>::RowsAtCompileTime, \+  enum { RowsAtCompileTime = Eigen::internal::traits<Derived>::RowsAtCompileTime, \         ColsAtCompileTime = Eigen::internal::traits<Derived>::ColsAtCompileTime, \         Flags = Eigen::internal::traits<Derived>::Flags, \         SizeAtCompileTime = Base::SizeAtCompileTime, \@@ -973,7 +932,7 @@                 const typename internal::plain_constant_type<EXPR,SCALAR>::type, const EXPR>  // Workaround for MSVC 2010 (see ML thread "patch with compile for for MSVC 2010")-#if EIGEN_COMP_MSVC_STRICT && (EIGEN_COMP_MSVC_STRICT<=1600)+#if EIGEN_COMP_MSVC_STRICT<=1600 #define EIGEN_MSVC10_WORKAROUND_BINARYOP_RETURN_TYPE(X) typename internal::enable_if<true,X>::type #else #define EIGEN_MSVC10_WORKAROUND_BINARYOP_RETURN_TYPE(X) X@@ -1008,7 +967,7 @@ #  define EIGEN_TRY try #  define EIGEN_CATCH(X) catch (X) #else-#  ifdef EIGEN_CUDA_ARCH+#  ifdef __CUDA_ARCH__ #    define EIGEN_THROW_X(X) asm("trap;") #    define EIGEN_THROW asm("trap;") #  else@@ -1030,7 +989,13 @@ #   define EIGEN_NOEXCEPT #   define EIGEN_NOEXCEPT_IF(x) #   define EIGEN_NO_THROW throw()-#   define EIGEN_EXCEPTION_SPEC(X) throw(X)+#   if EIGEN_COMP_MSVC+      // MSVC does not support exception specifications (warning C4290),+      // and they are deprecated in c++11 anyway.+#     define EIGEN_EXCEPTION_SPEC(X) throw()+#   else+#     define EIGEN_EXCEPTION_SPEC(X) throw(X)+#   endif #endif  #endif // EIGEN_MACROS_H
eigen3/Eigen/src/Core/util/Memory.h view
@@ -63,7 +63,7 @@  namespace internal { -EIGEN_DEVICE_FUNC+EIGEN_DEVICE_FUNC  inline void throw_std_bad_alloc() {   #ifdef EIGEN_EXCEPTIONS@@ -114,7 +114,7 @@   void *previous_aligned = static_cast<char *>(original)+previous_offset;   if(aligned!=previous_aligned)     std::memmove(aligned, previous_aligned, size);-+     *(reinterpret_cast<void**>(aligned) - 1) = original;   return aligned; }@@ -142,7 +142,7 @@ {   eigen_assert(is_malloc_allowed() && "heap allocation is forbidden (EIGEN_RUNTIME_NO_MALLOC is defined and g_is_malloc_allowed is false)"); }-#else+#else  EIGEN_DEVICE_FUNC inline void check_that_malloc_is_allowed() {} #endif@@ -471,8 +471,8 @@ }  /** \internal Returns the smallest integer multiple of \a base and greater or equal to \a size-  */-template<typename Index>+  */ +template<typename Index>  inline Index first_multiple(Index size, Index base) {   return ((size+base-1)/base)*base;@@ -502,7 +502,7 @@   { std::copy(start, end, target); } }; -// intelligent memmove. falls back to std::memmove for POD types, uses std::copy otherwise.+// intelligent memmove. falls back to std::memmove for POD types, uses std::copy otherwise.  template<typename T, bool UseMemmove> struct smart_memmove_helper;  template<typename T> void smart_memmove(const T* start, const T* end, T* target)@@ -522,15 +522,15 @@  template<typename T> struct smart_memmove_helper<T,false> {   static inline void run(const T* start, const T* end, T* target)-  {+  {      if (UIntPtr(target) < UIntPtr(start))     {       std::copy(start, end, target);     }-    else+    else                                      {       std::ptrdiff_t count = (std::ptrdiff_t(end)-std::ptrdiff_t(start)) / sizeof(T);-      std::copy_backward(start, end, target + count);+      std::copy_backward(start, end, target + count);      }   } };@@ -603,7 +603,7 @@ {   std::swap(a.ptr(),b.ptr()); }-+     } // end namespace internal  /** \internal@@ -622,7 +622,7 @@   * The underlying stack allocation function can controlled with the EIGEN_ALLOCA preprocessor token.   */ #ifdef EIGEN_ALLOCA-+     #if EIGEN_DEFAULT_ALIGN_BYTES>0     // We always manually re-align the result of EIGEN_ALLOCA.     // If alloca is already aligned, the compiler should be smart enough to optimize away the re-alignment.@@ -645,7 +645,7 @@     Eigen::internal::check_size_for_overflow<TYPE>(SIZE); \     TYPE* NAME = (BUFFER)!=0 ? BUFFER : reinterpret_cast<TYPE*>(Eigen::internal::aligned_malloc(sizeof(TYPE)*SIZE));    \     Eigen::internal::aligned_stack_memory_handler<TYPE> EIGEN_CAT(NAME,_stack_memory_destructor)((BUFFER)==0 ? NAME : 0,SIZE,true)-+     #endif  @@ -703,13 +703,13 @@ *  - 32 bytes alignment if AVX is enabled. *  - 64 bytes alignment if AVX512 is enabled. *-* This can be controlled using the \c EIGEN_MAX_ALIGN_BYTES macro as documented+* This can be controled using the \c EIGEN_MAX_ALIGN_BYTES macro as documented * \link TopicPreprocessorDirectivesPerformance there \endlink. * * Example: * \code * // Matrix4f requires 16 bytes alignment:-* std::map< int, Matrix4f, std::less<int>,+* std::map< int, Matrix4f, std::less<int>,  *           aligned_allocator<std::pair<const int, Matrix4f> > > my_map_mat4; * // Vector3f does not require 16 bytes alignment, no need to use Eigen's allocator: * std::map< int, Vector3f > my_map_vec3;@@ -747,7 +747,15 @@   pointer allocate(size_type num, const void* /*hint*/ = 0)   {     internal::check_size_for_overflow<T>(num);-    return static_cast<pointer>( internal::aligned_malloc(num * sizeof(T)) );+    size_type size = num * sizeof(T);+#if EIGEN_COMP_GNUC_STRICT && EIGEN_GNUC_AT_LEAST(7,0)+    // workaround gcc bug https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87544+    // It triggered eigen/Eigen/src/Core/util/Memory.h:189:12: warning: argument 1 value '18446744073709551612' exceeds maximum object size 9223372036854775807+    if(size>=std::size_t((std::numeric_limits<std::ptrdiff_t>::max)()))+      return 0;+    else+#endif+      return static_cast<pointer>( internal::aligned_malloc(size) );   }    void deallocate(pointer p, size_type /*num*/)
eigen3/Eigen/src/Core/util/Meta.h view
@@ -11,7 +11,7 @@ #ifndef EIGEN_META_H #define EIGEN_META_H -#if defined(EIGEN_CUDA_ARCH)+#if defined(__CUDA_ARCH__) #include <cfloat> #include <math_constants.h> #endif@@ -97,29 +97,40 @@ template<> struct is_arithmetic<signed long>   { enum { value = true }; }; template<> struct is_arithmetic<unsigned long> { enum { value = true }; }; +template<typename T> struct is_integral        { enum { value = false }; };+template<> struct is_integral<bool>            { enum { value = true }; };+template<> struct is_integral<char>            { enum { value = true }; };+template<> struct is_integral<signed char>     { enum { value = true }; };+template<> struct is_integral<unsigned char>   { enum { value = true }; };+template<> struct is_integral<signed short>    { enum { value = true }; };+template<> struct is_integral<unsigned short>  { enum { value = true }; };+template<> struct is_integral<signed int>      { enum { value = true }; };+template<> struct is_integral<unsigned int>    { enum { value = true }; };+template<> struct is_integral<signed long>     { enum { value = true }; };+template<> struct is_integral<unsigned long>   { enum { value = true }; };+ #if EIGEN_HAS_CXX11-template<> struct is_arithmetic<signed long long>   { enum { value = true }; };-template<> struct is_arithmetic<unsigned long long> { enum { value = true }; };-using std::is_integral;+using std::make_unsigned; #else-template<typename T> struct is_integral               { enum { value = false }; };-template<> struct is_integral<bool>                   { enum { value = true }; };-template<> struct is_integral<char>                   { enum { value = true }; };-template<> struct is_integral<signed char>            { enum { value = true }; };-template<> struct is_integral<unsigned char>          { enum { value = true }; };-template<> struct is_integral<signed short>           { enum { value = true }; };-template<> struct is_integral<unsigned short>         { enum { value = true }; };-template<> struct is_integral<signed int>             { enum { value = true }; };-template<> struct is_integral<unsigned int>           { enum { value = true }; };-template<> struct is_integral<signed long>            { enum { value = true }; };-template<> struct is_integral<unsigned long>          { enum { value = true }; };+// TODO: Possibly improve this implementation of make_unsigned.+// It is currently used only by+// template<typename Scalar> struct random_default_impl<Scalar, false, true>.+template<typename> struct make_unsigned;+template<> struct make_unsigned<char>             { typedef unsigned char type; };+template<> struct make_unsigned<signed char>      { typedef unsigned char type; };+template<> struct make_unsigned<unsigned char>    { typedef unsigned char type; };+template<> struct make_unsigned<signed short>     { typedef unsigned short type; };+template<> struct make_unsigned<unsigned short>   { typedef unsigned short type; };+template<> struct make_unsigned<signed int>       { typedef unsigned int type; };+template<> struct make_unsigned<unsigned int>     { typedef unsigned int type; };+template<> struct make_unsigned<signed long>      { typedef unsigned long type; };+template<> struct make_unsigned<unsigned long>    { typedef unsigned long type; }; #if EIGEN_COMP_MSVC-template<> struct is_integral<signed __int64>         { enum { value = true }; };-template<> struct is_integral<unsigned __int64>       { enum { value = true }; };+template<> struct make_unsigned<signed __int64>   { typedef unsigned __int64 type; };+template<> struct make_unsigned<unsigned __int64> { typedef unsigned __int64 type; }; #endif #endif - template <typename T> struct add_const { typedef const T type; }; template <typename T> struct add_const<T&> { typedef T& type; }; @@ -175,7 +186,7 @@ template<typename T> struct enable_if<true,T> { typedef T type; }; -#if defined(EIGEN_CUDA_ARCH)+#if defined(__CUDA_ARCH__) #if !defined(__FLT_EPSILON__) #define __FLT_EPSILON__ FLT_EPSILON #define __DBL_EPSILON__ DBL_EPSILON@@ -278,7 +289,7 @@ #endif  /** \internal-  * A base class do disable default copy ctor and copy assignment operator.+  * A base class do disable default copy ctor and copy assignement operator.   */ class noncopyable {@@ -290,59 +301,6 @@ };  /** \internal-  * Provides access to the number of elements in the object of as a compile-time constant expression.-  * It "returns" Eigen::Dynamic if the size cannot be resolved at compile-time (default).-  *-  * Similar to std::tuple_size, but more general.-  *-  * It currently supports:-  *  - any types T defining T::SizeAtCompileTime-  *  - plain C arrays as T[N]-  *  - std::array (c++11)-  *  - some internal types such as SingleRange and AllRange-  *-  * The second template parameter eases SFINAE-based specializations.-  */-template<typename T, typename EnableIf = void> struct array_size {-  enum { value = Dynamic };-};--template<typename T> struct array_size<T,typename internal::enable_if<((T::SizeAtCompileTime&0)==0)>::type> {-  enum { value = T::SizeAtCompileTime };-};--template<typename T, int N> struct array_size<const T (&)[N]> {-  enum { value = N };-};-template<typename T, int N> struct array_size<T (&)[N]> {-  enum { value = N };-};--#if EIGEN_HAS_CXX11-template<typename T, std::size_t N> struct array_size<const std::array<T,N> > {-  enum { value = N };-};-template<typename T, std::size_t N> struct array_size<std::array<T,N> > {-  enum { value = N };-};-#endif--/** \internal-  * Analogue of the std::size free function.-  * It returns the size of the container or view \a x of type \c T-  *-  * It currently supports:-  *  - any types T defining a member T::size() const-  *  - plain C arrays as T[N]-  *-  */-template<typename T>-Index size(const T& x) { return x.size(); }--template<typename T,std::size_t N>-Index size(const T (&) [N]) { return N; }--/** \internal   * Convenient struct to get the result type of a unary or binary functor.   *   * It supports both the current STL mechanism (using the result_type member) as well as@@ -439,10 +397,10 @@ template <typename T> struct has_ReturnType {-  template <typename C> static meta_yes testFunctor(C const *, typename C::ReturnType const * = 0);-  template <typename C> static meta_no  testFunctor(...);+  template <typename C> static meta_yes testFunctor(typename C::ReturnType const *);+  template <typename C> static meta_no testFunctor(...); -  enum { value = sizeof(testFunctor<T>(static_cast<T*>(0))) == sizeof(meta_yes) };+  enum { value = sizeof(testFunctor<T>(0)) == sizeof(meta_yes) }; };  template<typename T> const T* return_ptr();@@ -529,13 +487,13 @@  namespace numext {   -#if defined(EIGEN_CUDA_ARCH)+#if defined(__CUDA_ARCH__) template<typename T> EIGEN_DEVICE_FUNC   void swap(T &a, T &b) { T tmp = b; b = a; a = tmp; } #else template<typename T> EIGEN_STRONG_INLINE void swap(T &a, T &b) { std::swap(a,b); } #endif -#if defined(EIGEN_CUDA_ARCH)+#if defined(__CUDA_ARCH__) using internal::device::numeric_limits; #else using std::numeric_limits;
eigen3/Eigen/src/Core/util/ReenableStupidWarnings.h view
@@ -8,7 +8,7 @@     #pragma warning pop   #elif defined __clang__     #pragma clang diagnostic pop-  #elif defined __GNUC__+  #elif defined __GNUC__  &&  (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))     #pragma GCC diagnostic pop   #endif 
eigen3/Eigen/src/Core/util/XprHelper.h view
@@ -34,27 +34,7 @@   return IndexDest(idx); } -// true if T can be considered as an integral index (i.e., and integral type or enum)-template<typename T> struct is_valid_index_type-{-  enum { value =-#if EIGEN_HAS_TYPE_TRAITS-    internal::is_integral<T>::value || std::is_enum<T>::value-#elif EIGEN_COMP_MSVC-    internal::is_integral<T>::value || __is_enum(T)-#else-    // without C++11, we use is_convertible to Index instead of is_integral in order to treat enums as Index.-    internal::is_convertible<T,Index>::value-#endif-  };-}; -// true if both types are not valid index types-template<typename RowIndices, typename ColIndices>-struct valid_indexed_view_overload {-  enum { value = !(internal::is_valid_index_type<RowIndices>::value && internal::is_valid_index_type<ColIndices>::value) };-};- // promote_scalar_arg is an helper used in operation between an expression and a scalar, like: //    expression * scalar // Its role is to determine how the type T of the scalar operand should be promoted given the scalar type ExprScalar of the given expression.@@ -129,7 +109,6 @@     EIGEN_EMPTY_STRUCT_CTOR(variable_if_dynamic)     EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE explicit variable_if_dynamic(T v) { EIGEN_ONLY_USED_FOR_DEBUG(v); eigen_assert(v == T(Value)); }     EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE T value() { return T(Value); }-    EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE operator T() const { return T(Value); }     EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void setValue(T) {} }; @@ -140,7 +119,6 @@   public:     EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE explicit variable_if_dynamic(T value) : m_value(value) {}     EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE T value() const { return m_value; }-    EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE operator T() const { return m_value; }     EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void setValue(T value) { m_value = value; } }; @@ -693,7 +671,7 @@  // Internal helper defining the cost of a scalar division for the type T. // The default heuristic can be specialized for each scalar type and architecture.-template<typename T,bool Vectorized=false,typename EnableIf = void>+template<typename T,bool Vectorized=false,typename EnaleIf = void> struct scalar_div_cost {   enum { value = 8*NumTraits<T>::MulCost }; };
eigen3/Eigen/src/Eigenvalues/ComplexEigenSolver.h view
@@ -214,7 +214,7 @@      /** \brief Reports whether previous computation was successful.       *-      * \returns \c Success if computation was successful, \c NoConvergence otherwise.+      * \returns \c Success if computation was succesful, \c NoConvergence otherwise.       */     ComputationInfo info() const     {
eigen3/Eigen/src/Eigenvalues/ComplexSchur.h view
@@ -212,7 +212,7 @@      /** \brief Reports whether previous computation was successful.       *-      * \returns \c Success if computation was successful, \c NoConvergence otherwise.+      * \returns \c Success if computation was succesful, \c NoConvergence otherwise.       */     ComputationInfo info() const     {
eigen3/Eigen/src/Eigenvalues/EigenSolver.h view
@@ -277,7 +277,7 @@     template<typename InputType>     EigenSolver& compute(const EigenBase<InputType>& matrix, bool computeEigenvectors = true); -    /** \returns NumericalIssue if the input contains INF or NaN values or overflow occurred. Returns Success otherwise. */+    /** \returns NumericalIssue if the input contains INF or NaN values or overflow occured. Returns Success otherwise. */     ComputationInfo info() const     {       eigen_assert(m_isInitialized && "EigenSolver is not initialized.");
eigen3/Eigen/src/Eigenvalues/GeneralizedEigenSolver.h view
@@ -311,7 +311,6 @@     // Aliases:     Map<VectorType> v(reinterpret_cast<Scalar*>(m_tmp.data()), size);     ComplexVectorType &cv = m_tmp;-    const MatrixType &mZ = m_realQZ.matrixZ();     const MatrixType &mS = m_realQZ.matrixS();     const MatrixType &mT = m_realQZ.matrixT(); @@ -351,7 +350,7 @@               }             }           }-          m_eivec.col(i).real().noalias() = mZ.transpose() * v;+          m_eivec.col(i).real().noalias() = m_realQZ.matrixZ().transpose() * v;           m_eivec.col(i).real().normalize();           m_eivec.col(i).imag().setConstant(0);         }@@ -400,7 +399,7 @@                               / (alpha*mT.coeffRef(j,j) - static_cast<Scalar>(beta*mS.coeffRef(j,j)));             }           }-          m_eivec.col(i+1).noalias() = (mZ.transpose() * cv);+          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();         }
eigen3/Eigen/src/Eigenvalues/GeneralizedSelfAdjointEigenSolver.h view
@@ -121,7 +121,7 @@       *       * \returns    Reference to \c *this       *-      * According to \p options, this function computes eigenvalues and (if requested)+      * Accoring 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$
eigen3/Eigen/src/Eigenvalues/HessenbergDecomposition.h view
@@ -315,7 +315,7 @@      // A = A H'     matA.rightCols(remainingSize)-        .applyHouseholderOnTheRight(matA.col(i).tail(remainingSize-1), numext::conj(h), &temp.coeffRef(0));+        .applyHouseholderOnTheRight(matA.col(i).tail(remainingSize-1).conjugate(), numext::conj(h), &temp.coeffRef(0));   } } 
eigen3/Eigen/src/Eigenvalues/MatrixBaseEigenvalues.h view
@@ -66,7 +66,6 @@ inline typename MatrixBase<Derived>::EigenvaluesReturnType MatrixBase<Derived>::eigenvalues() const {-  typedef typename internal::traits<Derived>::Scalar Scalar;   return internal::eigenvalues_selector<Derived, NumTraits<Scalar>::IsComplex>::run(derived()); } @@ -85,10 +84,9 @@   * \sa SelfAdjointEigenSolver::eigenvalues(), MatrixBase::eigenvalues()   */ template<typename MatrixType, unsigned int UpLo> -EIGEN_DEVICE_FUNC inline typename SelfAdjointView<MatrixType, UpLo>::EigenvaluesReturnType+inline typename SelfAdjointView<MatrixType, UpLo>::EigenvaluesReturnType SelfAdjointView<MatrixType, UpLo>::eigenvalues() const {-  typedef typename SelfAdjointView<MatrixType, UpLo>::PlainObject PlainObject;   PlainObject thisAsMatrix(*this);   return SelfAdjointEigenSolver<PlainObject>(thisAsMatrix, false).eigenvalues(); }@@ -149,7 +147,7 @@   * \sa eigenvalues(), MatrixBase::operatorNorm()   */ template<typename MatrixType, unsigned int UpLo>-EIGEN_DEVICE_FUNC inline typename SelfAdjointView<MatrixType, UpLo>::RealScalar+inline typename SelfAdjointView<MatrixType, UpLo>::RealScalar SelfAdjointView<MatrixType, UpLo>::operatorNorm() const {   return eigenvalues().cwiseAbs().maxCoeff();
eigen3/Eigen/src/Eigenvalues/RealQZ.h view
@@ -161,7 +161,7 @@        /** \brief Reports whether previous computation was successful.        *-       * \returns \c Success if computation was successful, \c NoConvergence otherwise.+       * \returns \c Success if computation was succesful, \c NoConvergence otherwise.        */       ComputationInfo info() const       {
eigen3/Eigen/src/Eigenvalues/RealSchur.h view
@@ -190,7 +190,7 @@     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.+      * \returns \c Success if computation was succesful, \c NoConvergence otherwise.       */     ComputationInfo info() const     {
eigen3/Eigen/src/Eigenvalues/SelfAdjointEigenSolver.h view
@@ -337,7 +337,7 @@      /** \brief Reports whether previous computation was successful.       *-      * \returns \c Success if computation was successful, \c NoConvergence otherwise.+      * \returns \c Success if computation was succesful, \c NoConvergence otherwise.       */     EIGEN_DEVICE_FUNC     ComputationInfo info() const
eigen3/Eigen/src/Geometry/AlignedBox.h view
@@ -63,7 +63,7 @@    /** Default constructor initializing a null box. */   EIGEN_DEVICE_FUNC inline AlignedBox()-  { if (EIGEN_CONST_CONDITIONAL(AmbientDimAtCompileTime!=Dynamic)) setEmpty(); }+  { if (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)
eigen3/Eigen/src/Geometry/ParametrizedLine.h view
@@ -104,44 +104,7 @@   template <int OtherOptions>   EIGEN_DEVICE_FUNC VectorType intersectionPoint(const Hyperplane<_Scalar, _AmbientDim, OtherOptions>& 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<typename XprType>-  EIGEN_DEVICE_FUNC inline ParametrizedLine& transform(const MatrixBase<XprType>& 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<int TrOptions>-  EIGEN_DEVICE_FUNC inline ParametrizedLine& transform(const Transform<Scalar,AmbientDimAtCompileTime,Affine,TrOptions>& t,-                                                       TransformTraits traits = Affine)-  {-    transform(t.linear(), traits);-    origin() += t.translation();-    return *this;-  }--/** \returns \c *this with scalar type casted to \a NewScalarType+  /** \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.
eigen3/Eigen/src/Geometry/Scaling.h view
@@ -29,22 +29,6 @@   *   * \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 <typename Scalar, int Dim, int Mode>-  struct uniformscaling_times_affine_returntype-  {-    enum-    {-      NewMode = int(Mode) == int(Isometry) ? Affine : Mode-    };-    typedef Transform <Scalar, Dim, NewMode> type;-  };-}- template<typename _Scalar> class UniformScaling {@@ -76,11 +60,9 @@    /** Concatenates a uniform scaling and an affine transformation */   template<int Dim, int Mode, int Options>-  inline typename-	internal::uniformscaling_times_affine_returntype<Scalar,Dim,Mode>::type-	operator* (const Transform<Scalar, Dim, Mode, Options>& t) const+  inline Transform<Scalar,Dim,(int(Mode)==int(Isometry)?Affine:Mode)> operator* (const Transform<Scalar,Dim, Mode, Options>& t) const   {-    typename internal::uniformscaling_times_affine_returntype<Scalar,Dim,Mode>::type res = t;+    Transform<Scalar,Dim,(int(Mode)==int(Isometry)?Affine:Mode)> res = t;     res.prescale(factor());     return res;   }@@ -88,7 +70,7 @@   /** Concatenates a uniform scaling and a linear transformation matrix */   // TODO returns an expression   template<typename Derived>-  inline typename Eigen::internal::plain_matrix_type<Derived>::type operator* (const MatrixBase<Derived>& other) const+  inline typename internal::plain_matrix_type<Derived>::type operator* (const MatrixBase<Derived>& other) const   { return other * m_factor; }    template<typename Derived,int Dim>@@ -128,7 +110,7 @@ /** Concatenates a linear transformation matrix and a uniform scaling   * \relates UniformScaling   */-// NOTE this operator is defined in MatrixBase and not as a friend function+// NOTE this operator is defiend in MatrixBase and not as a friend function // of UniformScaling to fix an internal crash of Intel's ICC template<typename Derived,typename Scalar> EIGEN_EXPR_BINARYOP_SCALAR_RETURN_TYPE(Derived,Scalar,product)
eigen3/Eigen/src/Geometry/Transform.h view
@@ -335,7 +335,7 @@            OtherModeIsAffineCompact = OtherMode == int(AffineCompact)     }; -    if(EIGEN_CONST_CONDITIONAL(ModeIsAffineCompact == OtherModeIsAffineCompact))+    if(ModeIsAffineCompact == OtherModeIsAffineCompact)     {       // We need the block expression because the code is compiled for all       // combinations of transformations and will trigger a compile time error@@ -343,7 +343,7 @@       m_matrix.template block<Dim,Dim+1>(0,0) = other.matrix().template block<Dim,Dim+1>(0,0);       makeAffine();     }-    else if(EIGEN_CONST_CONDITIONAL(OtherModeIsAffineCompact))+    else if(OtherModeIsAffineCompact)     {       typedef typename Transform<Scalar,Dim,OtherMode,OtherOptions>::MatrixType OtherMatrixType;       internal::transform_construct_from_matrix<OtherMatrixType,Mode,Options,Dim,HDim>::run(this, other.matrix());@@ -481,7 +481,7 @@     TransformTimeDiagonalReturnType res;     res.linear().noalias() = a*b.linear();     res.translation().noalias() = a*b.translation();-    if (EIGEN_CONST_CONDITIONAL(Mode!=int(AffineCompact)))+    if (Mode!=int(AffineCompact))       res.matrix().row(Dim) = b.matrix().row(Dim);     return res;   }@@ -755,7 +755,7 @@ Transform<Scalar,Dim,Mode,Options>& Transform<Scalar,Dim,Mode,Options>::operator=(const QMatrix& other) {   EIGEN_STATIC_ASSERT(Dim==2, YOU_MADE_A_PROGRAMMING_MISTAKE)-  if (EIGEN_CONST_CONDITIONAL(Mode == int(AffineCompact)))+  if (Mode == int(AffineCompact))     m_matrix << other.m11(), other.m21(), other.dx(),                 other.m12(), other.m22(), other.dy();   else@@ -801,7 +801,7 @@ {   check_template_params();   EIGEN_STATIC_ASSERT(Dim==2, YOU_MADE_A_PROGRAMMING_MISTAKE)-  if (EIGEN_CONST_CONDITIONAL(Mode == int(AffineCompact)))+  if (Mode == int(AffineCompact))     m_matrix << other.m11(), other.m21(), other.dx(),                 other.m12(), other.m22(), other.dy();   else@@ -819,7 +819,7 @@ QTransform Transform<Scalar,Dim,Mode,Options>::toQTransform(void) const {   EIGEN_STATIC_ASSERT(Dim==2, YOU_MADE_A_PROGRAMMING_MISTAKE)-  if (EIGEN_CONST_CONDITIONAL(Mode == int(AffineCompact)))+  if (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));@@ -912,7 +912,7 @@ Transform<Scalar,Dim,Mode,Options>::pretranslate(const MatrixBase<OtherDerived> &other) {   EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(OtherDerived,int(Dim))-  if(EIGEN_CONST_CONDITIONAL(int(Mode)==int(Projective)))+  if(int(Mode)==int(Projective))     affine() += other * m_matrix.row(Dim);   else     translation() += other;
eigen3/Eigen/src/Householder/Householder.h view
@@ -103,7 +103,7 @@   * \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+  *                  this->cols() * essential.size() entries   *   * \sa MatrixBase::makeHouseholder(), MatrixBase::makeHouseholderInPlace(),    *     MatrixBase::applyHouseholderOnTheRight()@@ -140,7 +140,7 @@   * \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+  *                  this->cols() * essential.size() entries   *   * \sa MatrixBase::makeHouseholder(), MatrixBase::makeHouseholderInPlace(),    *     MatrixBase::applyHouseholderOnTheLeft()@@ -160,10 +160,10 @@   {     Map<typename internal::plain_col_type<PlainObject>::type> tmp(workspace,rows());     Block<Derived, Derived::RowsAtCompileTime, EssentialPart::SizeAtCompileTime> right(derived(), 0, 1, rows(), cols()-1);-    tmp.noalias() = right * essential;+    tmp.noalias() = right * essential.conjugate();     tmp += this->col(0);     this->col(0) -= tau * tmp;-    right.noalias() -= tau * tmp * essential.adjoint();+    right.noalias() -= tau * tmp * essential.transpose();   } } 
eigen3/Eigen/src/Householder/HouseholderSequence.h view
@@ -140,22 +140,6 @@       Side     > ConjugateReturnType; -    typedef HouseholderSequence<-      VectorsType,-      typename internal::conditional<NumTraits<Scalar>::IsComplex,-        typename internal::remove_all<typename CoeffsType::ConjugateReturnType>::type,-        CoeffsType>::type,-      Side-    > AdjointReturnType;--    typedef HouseholderSequence<-      typename internal::conditional<NumTraits<Scalar>::IsComplex,-        typename internal::remove_all<typename VectorsType::ConjugateReturnType>::type,-        VectorsType>::type,-      CoeffsType,-      Side-    > TransposeReturnType;-     /** \brief Constructor.       * \param[in]  v      %Matrix containing the essential parts of the Householder vectors       * \param[in]  h      Vector containing the Householder coefficients@@ -174,7 +158,7 @@       * \sa setLength(), setShift()       */     HouseholderSequence(const VectorsType& v, const CoeffsType& h)-      : m_vectors(v), m_coeffs(h), m_reverse(false), m_length(v.diagonalSize()),+      : m_vectors(v), m_coeffs(h), m_trans(false), m_length(v.diagonalSize()),         m_shift(0)     {     }@@ -183,7 +167,7 @@     HouseholderSequence(const HouseholderSequence& other)       : m_vectors(other.m_vectors),         m_coeffs(other.m_coeffs),-        m_reverse(other.m_reverse),+        m_trans(other.m_trans),         m_length(other.m_length),         m_shift(other.m_shift)     {@@ -222,34 +206,28 @@     }      /** \brief %Transpose of the Householder sequence. */-    TransposeReturnType transpose() const+    HouseholderSequence transpose() const     {-      return TransposeReturnType(m_vectors.conjugate(), m_coeffs)-              .setReverseFlag(!m_reverse)-              .setLength(m_length)-              .setShift(m_shift);+      return HouseholderSequence(*this).setTrans(!m_trans);     }      /** \brief Complex conjugate of the Householder sequence. */     ConjugateReturnType conjugate() const     {       return ConjugateReturnType(m_vectors.conjugate(), m_coeffs.conjugate())-             .setReverseFlag(m_reverse)+             .setTrans(m_trans)              .setLength(m_length)              .setShift(m_shift);     }      /** \brief Adjoint (conjugate transpose) of the Householder sequence. */-    AdjointReturnType adjoint() const+    ConjugateReturnType adjoint() const     {-      return AdjointReturnType(m_vectors, m_coeffs.conjugate())-              .setReverseFlag(!m_reverse)-              .setLength(m_length)-              .setShift(m_shift);+      return conjugate().setTrans(!m_trans);     }      /** \brief Inverse of the Householder sequence (equals the adjoint). */-    AdjointReturnType inverse() const { return adjoint(); }+    ConjugateReturnType inverse() const { return adjoint(); }      /** \internal */     template<typename DestType> inline void evalTo(DestType& dst) const@@ -273,7 +251,7 @@         for(Index k = vecs-1; k >= 0; --k)         {           Index cornerSize = rows() - k - m_shift;-          if(m_reverse)+          if(m_trans)             dst.bottomRightCorner(cornerSize, cornerSize)                .applyHouseholderOnTheRight(essentialVector(k), m_coeffs.coeff(k), workspace.data());           else@@ -293,12 +271,12 @@         for(Index k = vecs-1; k >= 0; --k)         {           Index cornerSize = rows() - k - m_shift;-          if(m_reverse)+          if(m_trans)             dst.bottomRightCorner(cornerSize, cornerSize)-               .applyHouseholderOnTheRight(essentialVector(k), m_coeffs.coeff(k), workspace.data());+               .applyHouseholderOnTheRight(essentialVector(k), m_coeffs.coeff(k), &workspace.coeffRef(0));           else             dst.bottomRightCorner(cornerSize, cornerSize)-               .applyHouseholderOnTheLeft(essentialVector(k), m_coeffs.coeff(k), workspace.data());+               .applyHouseholderOnTheLeft(essentialVector(k), m_coeffs.coeff(k), &workspace.coeffRef(0));         }       }     }@@ -317,7 +295,7 @@       workspace.resize(dst.rows());       for(Index k = 0; k < m_length; ++k)       {-        Index actual_k = m_reverse ? m_length-k-1 : k;+        Index actual_k = m_trans ? m_length-k-1 : k;         dst.rightCols(rows()-m_shift-actual_k)            .applyHouseholderOnTheRight(essentialVector(actual_k), m_coeffs.coeff(actual_k), workspace.data());       }@@ -340,8 +318,8 @@       {         for(Index i = 0; i < m_length; i+=BlockSize)         {-          Index end = m_reverse ? (std::min)(m_length,i+BlockSize) : m_length-i;-          Index k = m_reverse ? i : (std::max)(Index(0),end-BlockSize);+          Index end = m_trans ? (std::min)(m_length,i+BlockSize) : m_length-i;+          Index k = m_trans ? i : (std::max)(Index(0),end-BlockSize);           Index bs = end-k;           Index start = k + m_shift;           @@ -352,7 +330,7 @@                                                                    Side==OnTheRight ? m_vectors.cols()-start : bs);           typename internal::conditional<Side==OnTheRight, Transpose<SubVectorsType>, SubVectorsType&>::type sub_vecs(sub_vecs1);           Block<Dest,Dynamic,Dynamic> sub_dst(dst,dst.rows()-rows()+m_shift+k,0, rows()-m_shift-k,dst.cols());-          apply_block_householder_on_the_left(sub_dst, sub_vecs, m_coeffs.segment(k, bs), !m_reverse);+          apply_block_householder_on_the_left(sub_dst, sub_vecs, m_coeffs.segment(k, bs), !m_trans);         }       }       else@@ -360,7 +338,7 @@         workspace.resize(dst.cols());         for(Index k = 0; k < m_length; ++k)         {-          Index actual_k = m_reverse ? k : m_length-k-1;+          Index actual_k = m_trans ? k : m_length-k-1;           dst.bottomRows(rows()-m_shift-actual_k)             .applyHouseholderOnTheLeft(essentialVector(actual_k), m_coeffs.coeff(actual_k), workspace.data());         }@@ -425,27 +403,25 @@    protected: -    /** \internal-      * \brief Sets the reverse flag.-      * \param [in]  reverse  New value of the reverse flag.+    /** \brief Sets the transpose flag.+      * \param [in]  trans  New value of the transpose 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$.+      * By default, the transpose flag is not set. If the transpose flag is set, then this object represents +      * \f$ H^T = H_{n-1}^T \ldots H_1^T H_0^T \f$ instead of \f$ H = H_0 H_1 \ldots H_{n-1} \f$.       *-      * \sa reverseFlag(), transpose(), adjoint()+      * \sa trans()       */-    HouseholderSequence& setReverseFlag(bool reverse)+    HouseholderSequence& setTrans(bool trans)     {-      m_reverse = reverse;+      m_trans = trans;       return *this;     } -    bool reverseFlag() const { return m_reverse; }     /**< \internal \brief Returns the reverse flag. */+    bool trans() const { return m_trans; }     /**< \brief Returns the transpose flag. */      typename VectorsType::Nested m_vectors;     typename CoeffsType::Nested m_coeffs;-    bool m_reverse;+    bool m_trans;     Index m_length;     Index m_shift; };
eigen3/Eigen/src/IterativeLinearSolvers/ConjugateGradient.h view
@@ -50,7 +50,8 @@     tol_error = 0;     return;   }-  RealScalar threshold = tol*tol*rhsNorm2;+  const RealScalar considerAsZero = (std::numeric_limits<RealScalar>::min)();+  RealScalar threshold = numext::maxi(tol*tol*rhsNorm2,considerAsZero);   RealScalar residualNorm2 = residual.squaredNorm();   if (residualNorm2 < threshold)   {@@ -58,7 +59,7 @@     tol_error = sqrt(residualNorm2 / rhsNorm2);     return;   }-  +   VectorType p(n);   p = precond.solve(residual);      // initial search direction 
eigen3/Eigen/src/IterativeLinearSolvers/IncompleteLUT.h view
@@ -136,7 +136,7 @@      /** \brief Reports whether previous computation was successful.       *-      * \returns \c Success if computation was successful,+      * \returns \c Success if computation was succesful,       *          \c NumericalIssue if the matrix.appears to be negative.       */     ComputationInfo info() const@@ -230,7 +230,7 @@   SparseMatrix<Scalar,ColMajor, StorageIndex> mat1 = amat;   SparseMatrix<Scalar,ColMajor, StorageIndex> 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...+  //       on the other hand for a really non-symmetric pattern, mat2*mat1 should be prefered...   SparseMatrix<Scalar,ColMajor, StorageIndex> AtA = mat2 + mat1;   AMDOrdering<StorageIndex> ordering;   ordering(AtA,m_P);
eigen3/Eigen/src/IterativeLinearSolvers/IterativeSolverBase.h view
@@ -275,7 +275,7 @@   const Preconditioner& preconditioner() const { return m_preconditioner; }    /** \returns the max number of iterations.-    * It is either the value set by setMaxIterations or, by default,+    * It is either the value setted by setMaxIterations or, by default,     * twice the number of columns of the matrix.     */   Index maxIterations() const
eigen3/Eigen/src/Jacobi/Jacobi.h view
@@ -37,20 +37,17 @@     typedef typename NumTraits<Scalar>::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; }+    Scalar& c() { return m_c; }+    Scalar c() const { return m_c; }+    Scalar& s() { return m_s; }+    Scalar s() const { return m_s; }      /** Concatenates two planar rotation */-    EIGEN_DEVICE_FUNC     JacobiRotation operator*(const JacobiRotation& other)     {       using numext::conj;@@ -59,27 +56,20 @@     }      /** 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<typename Derived>-    EIGEN_DEVICE_FUNC     bool makeJacobi(const MatrixBase<Derived>&, 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* z=0);+    void makeGivens(const Scalar& p, const Scalar& q, Scalar* r=0);    protected:-    EIGEN_DEVICE_FUNC-    void makeGivens(const Scalar& p, const Scalar& q, Scalar* z, internal::true_type);-    EIGEN_DEVICE_FUNC-    void makeGivens(const Scalar& p, const Scalar& q, Scalar* z, internal::false_type);+    void makeGivens(const Scalar& p, const Scalar& q, Scalar* r, internal::true_type);+    void makeGivens(const Scalar& p, const Scalar& q, Scalar* r, internal::false_type);      Scalar m_c, m_s; };@@ -94,7 +84,6 @@ {   using std::sqrt;   using std::abs;-  typedef typename NumTraits<Scalar>::Real RealScalar;   RealScalar deno = RealScalar(2)*abs(y);   if(deno < (std::numeric_limits<RealScalar>::min)())   {@@ -143,7 +132,7 @@   * \f$ V = \left ( \begin{array}{c} p \\ q \end{array} \right )\f$ yields:   * \f$ G^* V = \left ( \begin{array}{c} r \\ 0 \end{array} \right )\f$.   *-  * The value of \a z is returned if \a z is not null (the default is null).+  * The value of \a r is returned if \a r is not null (the default is null).   * Also note that G is built such that the cosine is always real.   *   * Example: \include Jacobi_makeGivens.cpp@@ -156,9 +145,9 @@   * \sa MatrixBase::applyOnTheLeft(), MatrixBase::applyOnTheRight()   */ template<typename Scalar>-void JacobiRotation<Scalar>::makeGivens(const Scalar& p, const Scalar& q, Scalar* z)+void JacobiRotation<Scalar>::makeGivens(const Scalar& p, const Scalar& q, Scalar* r) {-  makeGivens(p, q, z, typename internal::conditional<NumTraits<Scalar>::IsComplex, internal::true_type, internal::false_type>::type());+  makeGivens(p, q, r, typename internal::conditional<NumTraits<Scalar>::IsComplex, internal::true_type, internal::false_type>::type()); }  @@ -274,7 +263,6 @@   * \sa MatrixBase::applyOnTheLeft(), MatrixBase::applyOnTheRight()   */ template<typename VectorX, typename VectorY, typename OtherScalar>-EIGEN_DEVICE_FUNC void apply_rotation_in_the_plane(DenseBase<VectorX>& xpr_x, DenseBase<VectorY>& xpr_y, const JacobiRotation<OtherScalar>& j); } 
eigen3/Eigen/src/LU/FullPivLU.h view
@@ -48,7 +48,7 @@   * 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:+  * As an exemple, here is how the original matrix can be retrieved:   * \include class_FullPivLU.cpp   * Output: \verbinclude class_FullPivLU.out   *@@ -411,9 +411,11 @@      #ifndef EIGEN_PARSED_BY_DOXYGEN     template<typename RhsType, typename DstType>+    EIGEN_DEVICE_FUNC     void _solve_impl(const RhsType &rhs, DstType &dst) const;      template<bool Conjugate, typename RhsType, typename DstType>+    EIGEN_DEVICE_FUNC     void _solve_impl_transposed(const RhsType &rhs, DstType &dst) const;     #endif 
eigen3/Eigen/src/LU/PartialPivLU.h view
@@ -420,8 +420,8 @@     * \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<Block<Block<...> > >+    *   1 - reduce the number of instanciations to the strict minimum+    *   2 - avoid infinite recursion of the instanciations with Block<Block<Block<...> > >     */   static Index blocked_lu(Index rows, Index cols, Scalar* lu_data, Index luStride, PivIndex* row_transpositions, PivIndex& nb_transpositions, Index maxBlockSize=256)   {
eigen3/Eigen/src/OrderingMethods/Eigen_Colamd.h view
@@ -1493,7 +1493,7 @@ 	c = Col [c].shared1.parent ;  	/* continue until we hit an ordered column.  There are */-	/* guaranteed not to be anymore unordered columns */+	/* guarranteed not to be anymore unordered columns */ 	/* above an ordered column */       } while (Col [c].shared2.order == COLAMD_EMPTY) ; @@ -1638,7 +1638,7 @@ 	  COLAMD_ASSERT (ROW_IS_ALIVE (*cp1))  ; 	  COLAMD_ASSERT (ROW_IS_ALIVE (*cp2))  ; 	  /* row indices will same order for both supercols, */-	  /* no gather scatter necessary */+	  /* no gather scatter nessasary */ 	  if (*cp1++ != *cp2++) 	  { 	    break ;@@ -1688,7 +1688,7 @@  /*   Defragments and compacts columns and rows in the workspace A.  Used when-  all available memory has been used while performing row merging.  Returns+  all avaliable memory has been used while performing row merging.  Returns   the index of the first free position in A, after garbage collection.  The   time taken by this routine is linear is the size of the array A, which is   itself linear in the number of nonzeros in the input matrix.
eigen3/Eigen/src/OrderingMethods/Ordering.h view
@@ -31,7 +31,7 @@   for (int i = 0; i < C.rows(); i++)    {       for (typename MatrixType::InnerIterator it(C, i); it; ++it)-        it.valueRef() = typename MatrixType::Scalar(0);+        it.valueRef() = 0.0;   }   symmat = C + A; }
eigen3/Eigen/src/PaStiXSupport/PaStiXSupport.h view
@@ -203,7 +203,7 @@           /** \brief Reports whether previous computation was successful.       *-      * \returns \c Success if computation was successful,+      * \returns \c Success if computation was succesful,       *          \c NumericalIssue if the PaStiX reports a problem       *          \c InvalidInput if the input matrix is invalid       *
eigen3/Eigen/src/PardisoSupport/PardisoSupport.h view
@@ -140,7 +140,7 @@        /** \brief Reports whether previous computation was successful.       *-      * \returns \c Success if computation was successful,+      * \returns \c Success if computation was succesful,       *          \c NumericalIssue if the matrix appears to be negative.       */     ComputationInfo info() const
eigen3/Eigen/src/QR/ColPivHouseholderQR.h view
@@ -402,7 +402,7 @@       */     RealScalar maxPivot() const { return m_maxpivot; } -    /** \brief Reports whether the QR factorization was successful.+    /** \brief Reports whether the QR factorization was succesful.       *       * \note This function always returns \c Success. It is provided for compatibility       * with other factorization routines.@@ -416,6 +416,7 @@      #ifndef EIGEN_PARSED_BY_DOXYGEN     template<typename RhsType, typename DstType>+    EIGEN_DEVICE_FUNC     void _solve_impl(const RhsType &rhs, DstType &dst) const;     #endif @@ -595,7 +596,11 @@    typename RhsType::PlainObject c(rhs); -  c.applyOnTheLeft(householderQ().setLength(nonzero_pivots).adjoint() );+  // Note that the matrix Q = H_0^* H_1^*... so its inverse is Q^* = (H_0 H_1 ...)^T+  c.applyOnTheLeft(householderSequence(m_qr, m_hCoeffs)+                    .setLength(nonzero_pivots)+                    .transpose()+    );    m_qr.topLeftCorner(nonzero_pivots, nonzero_pivots)       .template triangularView<Upper>()
eigen3/Eigen/src/QR/CompleteOrthogonalDecomposition.h view
@@ -353,7 +353,7 @@   inline RealScalar maxPivot() const { return m_cpqr.maxPivot(); }    /** \brief Reports whether the complete orthogonal decomposition was-   * successful.+   * succesful.    *    * \note This function always returns \c Success. It is provided for    * compatibility@@ -367,7 +367,7 @@  #ifndef EIGEN_PARSED_BY_DOXYGEN   template <typename RhsType, typename DstType>-  void _solve_impl(const RhsType& rhs, DstType& dst) const;+  EIGEN_DEVICE_FUNC void _solve_impl(const RhsType& rhs, DstType& dst) const; #endif   protected:@@ -452,7 +452,7 @@         // 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_cpqr.m_qr.row(k).tail(cols - rank).transpose(), m_zCoeffs(k),                 &m_temp(0));       }       if (k != rank - 1) {@@ -500,8 +500,11 @@   }    // Compute c = Q^* * rhs+  // Note that the matrix Q = H_0^* H_1^*... so its inverse is+  // Q^* = (H_0 H_1 ...)^T   typename RhsType::PlainObject c(rhs);-  c.applyOnTheLeft(matrixQ().setLength(rank).adjoint());+  c.applyOnTheLeft(+      householderSequence(matrixQTZ(), hCoeffs()).setLength(rank).transpose());    // Solve T z = c(1:rank, :)   dst.topRows(rank) = matrixT()
eigen3/Eigen/src/QR/FullPivHouseholderQR.h view
@@ -392,21 +392,22 @@       *          diagonal coefficient of U.       */     RealScalar maxPivot() const { return m_maxpivot; }-+         #ifndef EIGEN_PARSED_BY_DOXYGEN     template<typename RhsType, typename DstType>+    EIGEN_DEVICE_FUNC     void _solve_impl(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;
eigen3/Eigen/src/QR/HouseholderQR.h view
@@ -204,27 +204,28 @@      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<typename RhsType, typename DstType>+    EIGEN_DEVICE_FUNC     void _solve_impl(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;@@ -353,7 +354,11 @@    typename RhsType::PlainObject c(rhs); -  c.applyOnTheLeft(householderQ().setLength(rank).adjoint() );+  // Note that the matrix Q = H_0^* H_1^*... so its inverse is Q^* = (H_0 H_1 ...)^T+  c.applyOnTheLeft(householderSequence(+    m_qr.leftCols(rank),+    m_hCoeffs.head(rank)).transpose()+  );    m_qr.topLeftCorner(rank, rank)       .template triangularView<Upper>()
eigen3/Eigen/src/SPQRSupport/SuiteSparseQRSupport.h view
@@ -220,7 +220,7 @@          /** \brief Reports whether previous computation was successful.       *-      * \returns \c Success if computation was successful,+      * \returns \c Success if computation was succesful,       *          \c NumericalIssue if the sparse QR can not be computed       */     ComputationInfo info() const
eigen3/Eigen/src/SVD/BDCSVD.h view
@@ -22,11 +22,6 @@ // #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@@ -62,7 +57,7 @@  * 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+ * For instance, this concerns Intel's compiler (ICC), which perfroms 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.  *@@ -217,7 +212,7 @@  // Method to allocate and initialize matrix and attributes template<typename MatrixType>-void BDCSVD<MatrixType>::allocate(Eigen::Index rows, Eigen::Index cols, unsigned int computationOptions)+void BDCSVD<MatrixType>::allocate(Index rows, Index cols, unsigned int computationOptions) {   m_isTranspose = (cols > rows); @@ -393,7 +388,7 @@ //@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<typename MatrixType>-void BDCSVD<MatrixType>::divide (Eigen::Index firstCol, Eigen::Index lastCol, Eigen::Index firstRowW, Eigen::Index firstColW, Eigen::Index shift)+void BDCSVD<MatrixType>::divide (Index firstCol, Index lastCol, Index firstRowW, Index firstColW, Index shift) {   // requires rows = cols + 1;   using std::pow;@@ -573,7 +568,7 @@ // 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 <typename MatrixType>-void BDCSVD<MatrixType>::computeSVDofM(Eigen::Index firstCol, Eigen::Index n, MatrixXr& U, VectorType& singVals, MatrixXr& V)+void BDCSVD<MatrixType>::computeSVDofM(Index firstCol, Index n, MatrixXr& U, VectorType& singVals, MatrixXr& V) {   const RealScalar considerZero = (std::numeric_limits<RealScalar>::min)();   using std::abs;@@ -596,7 +591,7 @@   // 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)); }+  while(actual_n>1 && diag(actual_n-1)==Literal(0)) --actual_n;   Index m = 0; // size of the deflated problem   for(Index k=0;k<actual_n;++k)     if(abs(col0(k))>considerZero)@@ -623,11 +618,13 @@   std::cout << "  shift:    " << shifts.transpose() << "\n";      {+    Index actual_n = n;+    while(actual_n>1 && abs(col0(actual_n-1))<considerZero) --actual_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());+    std::cout << "    check3 (>0)      : " << ((diag.segment(1,actual_n-1)-singVals.head(actual_n-1).array()) / singVals.head(actual_n-1).array()).transpose() << "\n\n\n";+    std::cout << "    check4 (>0)      : " << ((singVals.segment(1,actual_n-1)-singVals.head(actual_n-1))).transpose() << "\n\n\n";   } #endif   @@ -655,13 +652,13 @@ #endif    #ifdef EIGEN_BDCSVD_SANITY_CHECKS+  assert(U.allFinite());+  assert(V.allFinite());+  assert((U.transpose() * U - MatrixXr(MatrixXr::Identity(U.cols(),U.cols()))).norm() < 1e-14 * n);+  assert((V.transpose() * V - MatrixXr(MatrixXr::Identity(V.cols(),V.cols()))).norm() < 1e-14 * n);   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<RealScalar>::epsilon() * n);-//   assert((V.transpose() * V - MatrixXr(MatrixXr::Identity(V.cols(),V.cols()))).norm() < 100*NumTraits<RealScalar>::epsilon() * n); #endif      // Because of deflation, the singular values might not be completely sorted.@@ -676,15 +673,6 @@       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@@ -761,22 +749,19 @@     RealScalar mid = left + (right-left) / Literal(2);     RealScalar fMid = secularEq(mid, col0, diag, perm, diag, Literal(0)); #ifdef EIGEN_BDCSVD_DEBUG_VERBOSE-    std::cout << "right-left = " << right-left << "\n";-//     std::cout << "fMid = " << fMid << " " << secularEq(mid-left, col0, diag, perm, ArrayXr(diag-left), left)-//                            << " " << secularEq(mid-right, col0, diag, perm, ArrayXr(diag-right), right)   << "\n";-    std::cout << "     = " << secularEq(left+RealScalar(0.000001)*(right-left), col0, diag, perm, diag, 0)-              << " "       << secularEq(left+RealScalar(0.1)     *(right-left), col0, diag, perm, diag, 0)-              << " "       << secularEq(left+RealScalar(0.2)     *(right-left), col0, diag, perm, diag, 0)-              << " "       << secularEq(left+RealScalar(0.3)     *(right-left), col0, diag, perm, diag, 0)-              << " "       << secularEq(left+RealScalar(0.4)     *(right-left), col0, diag, perm, diag, 0)-              << " "       << secularEq(left+RealScalar(0.49)    *(right-left), col0, diag, perm, diag, 0)-              << " "       << secularEq(left+RealScalar(0.5)     *(right-left), col0, diag, perm, diag, 0)-              << " "       << secularEq(left+RealScalar(0.51)    *(right-left), col0, diag, perm, diag, 0)-              << " "       << secularEq(left+RealScalar(0.6)     *(right-left), col0, diag, perm, diag, 0)-              << " "       << secularEq(left+RealScalar(0.7)     *(right-left), col0, diag, perm, diag, 0)-              << " "       << secularEq(left+RealScalar(0.8)     *(right-left), col0, diag, perm, diag, 0)-              << " "       << secularEq(left+RealScalar(0.9)     *(right-left), col0, diag, perm, diag, 0)-              << " "       << secularEq(left+RealScalar(0.999999)*(right-left), col0, diag, perm, diag, 0) << "\n";+    std::cout << right-left << "\n";+    std::cout << "fMid = " << fMid << " " << secularEq(mid-left, col0, diag, perm, diag-left, left) << " " << secularEq(mid-right, col0, diag, perm, diag-right, right)   << "\n";+    std::cout << "     = " << secularEq(0.1*(left+right), col0, diag, perm, diag, 0)+              << " "       << secularEq(0.2*(left+right), col0, diag, perm, diag, 0)+              << " "       << secularEq(0.3*(left+right), col0, diag, perm, diag, 0)+              << " "       << secularEq(0.4*(left+right), col0, diag, perm, diag, 0)+              << " "       << secularEq(0.49*(left+right), col0, diag, perm, diag, 0)+              << " "       << secularEq(0.5*(left+right), col0, diag, perm, diag, 0)+              << " "       << secularEq(0.51*(left+right), col0, diag, perm, diag, 0)+              << " "       << secularEq(0.6*(left+right), col0, diag, perm, diag, 0)+              << " "       << secularEq(0.7*(left+right), col0, diag, perm, diag, 0)+              << " "       << secularEq(0.8*(left+right), col0, diag, perm, diag, 0)+              << " "       << secularEq(0.9*(left+right), col0, diag, perm, diag, 0) << "\n"; #endif     RealScalar shift = (k == actual_n-1 || fMid > Literal(0)) ? left : right;     @@ -819,16 +804,13 @@       // 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((std::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;@@ -861,30 +843,18 @@         else           rightShifted = -(std::numeric_limits<RealScalar>::min)();       }-+             RealScalar fLeft = secularEq(leftShifted, col0, diag, perm, diagShifted, shift); -#if defined EIGEN_INTERNAL_DEBUGGING || defined EIGEN_BDCSVD_SANITY_CHECKS+#if defined EIGEN_INTERNAL_DEBUGGING || defined EIGEN_BDCSVD_DEBUG_VERBOSE       RealScalar fRight = secularEq(rightShifted, col0, diag, perm, diagShifted, shift); #endif -#ifdef EIGEN_BDCSVD_SANITY_CHECKS-      if(!(std::isfinite)(fLeft))-        std::cout << "f(" << leftShifted << ") =" << fLeft << " ; " << left << " " << shift << " " << right << "\n";-      assert((std::isfinite)(fLeft));--      if(!(std::isfinite)(fRight))-        std::cout << "f(" << rightShifted << ") =" << fRight << " ; " << left << " " << shift << " " << right << "\n";-//       assert((std::isfinite)(fRight));-#endif- #ifdef  EIGEN_BDCSVD_DEBUG_VERBOSE       if(!(fLeft * fRight<0))       {-        std::cout << "f(leftShifted) using  leftShifted=" << leftShifted << " ;  diagShifted(1:10):" << diagShifted.head(10).transpose()  << "\n ; "-                  << "left==shift=" << bool(left==shift) << " ; left-shift = " << (left-shift) << "\n";-        std::cout << "k=" << k << ", " <<  fLeft << " * " << fRight << " == " << fLeft * fRight << "  ;  "-                  << "[" << left << " .. " << right << "] -> [" << leftShifted << " " << rightShifted << "], shift=" << shift << " ,  f(right)=" <<  secularEq(0, col0, diag, perm, diagShifted, shift) << " == " << secularEq(right, col0, diag, perm, diag, 0) << "\n";+        std::cout << "fLeft: " << leftShifted << " - " << diagShifted.head(10).transpose()  << "\n ; " << bool(left==shift) << " " << (left-shift) << "\n";+        std::cout << k << " : " <<  fLeft << " * " << fRight << " == " << fLeft * fRight << "  ;  " << left << " - " << right << " -> " <<  leftShifted << " " << rightShifted << "   shift=" << shift << "\n";       } #endif       eigen_internal_assert(fLeft * fRight < Literal(0));@@ -893,8 +863,6 @@       {         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;@@ -913,15 +881,6 @@     shifts[k] = shift;     mus[k] = muCur; -#ifdef  EIGEN_BDCSVD_DEBUG_VERBOSE-    if(k+1<n)-      std::cout << "found " << singVals[k] << " == " << shift << " + " << muCur << " from " << diag(k) << " .. "  << diag(k+1) << "\n";-#endif-#ifdef EIGEN_BDCSVD_SANITY_CHECKS-    assert(k==0 || singVals[k]>=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 -@@ -956,42 +915,14 @@       // see equation (3.6)       RealScalar dk = diag(k);       RealScalar prod = (singVals(last) + dk) * (mus(last) + (shifts(last) - 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(last) << " + " << dk << ") * (" << mus(last) << " + (" << shifts(last) << " - " << dk << "))" << "\n";-        std::cout << "     = " << singVals(last) + dk << " * " << mus(last) + (shifts(last) - dk) <<  "\n";-      }-      assert(prod>=0);-#endif        for(Index l = 0; l<m; ++l)       {         Index i = perm(l);         if(i!=k)         {-#ifdef EIGEN_BDCSVD_SANITY_CHECKS-          if(i>=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 << "  " <<diag(i) << "\n";-            Index j = (i<k /*|| l==0*/) ? i : perm(l-1);-            std::cout << "  " << "j=" << j << "\n";-          }-#endif           Index j = i<k ? i : perm(l-1);-#ifdef EIGEN_BDCSVD_SANITY_CHECKS-          if(!(dk!=Literal(0) || diag(i)!=Literal(0)))-          {-            std::cout << "k=" << k << ", i=" << i << ", l=" << l << ", perm.size()=" << perm.size() << "\n";-          }-          assert(dk!=Literal(0) || diag(i)!=Literal(0));-#endif           prod *= ((singVals(j)+dk) / ((diag(i)+dk))) * ((mus(j)+(shifts(j)-dk)) / ((diag(i)-dk)));-#ifdef EIGEN_BDCSVD_SANITY_CHECKS-          assert(prod>=0);-#endif #ifdef EIGEN_BDCSVD_DEBUG_VERBOSE           if(i!=k && std::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))@@ -1003,9 +934,6 @@       std::cout << "zhat(" << k << ") =  sqrt( " << prod << ")  ;  " << (singVals(last) + dk) << " * " << mus(last) + shifts(last) << " - " << dk << "\n"; #endif       RealScalar tmp = sqrt(prod);-#ifdef EIGEN_BDCSVD_SANITY_CHECKS-      assert((std::isfinite)(tmp));-#endif       zhat(k) = col0(k) > Literal(0) ? tmp : -tmp;     }   }@@ -1059,7 +987,7 @@ // i >= 1, di almost null and zi non null. // We use a rotation to zero out zi applied to the left of M template <typename MatrixType>-void BDCSVD<MatrixType>::deflation43(Eigen::Index firstCol, Eigen::Index shift, Eigen::Index i, Eigen::Index size)+void BDCSVD<MatrixType>::deflation43(Index firstCol, Index shift, Index i, Index size) {   using std::abs;   using std::sqrt;@@ -1088,7 +1016,7 @@ // We apply two rotations to have zj = 0; // TODO deflation44 is still broken and not properly tested template <typename MatrixType>-void BDCSVD<MatrixType>::deflation44(Eigen::Index firstColu , Eigen::Index firstColm, Eigen::Index firstRowW, Eigen::Index firstColW, Eigen::Index i, Eigen::Index j, Eigen::Index size)+void BDCSVD<MatrixType>::deflation44(Index firstColu , Index firstColm, Index firstRowW, Index firstColW, Index i, Index j, Index size) {   using std::abs;   using std::sqrt;@@ -1115,7 +1043,7 @@   }   c/=r;   s/=r;-  m_computed(firstColm + i, firstColm) = 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); @@ -1128,7 +1056,7 @@  // acts on block from (firstCol+shift, firstCol+shift) to (lastCol+shift, lastCol+shift) [inclusive] template <typename MatrixType>-void BDCSVD<MatrixType>::deflation(Eigen::Index firstCol, Eigen::Index lastCol, Eigen::Index k, Eigen::Index firstRowW, Eigen::Index firstColW, Eigen::Index shift)+void BDCSVD<MatrixType>::deflation(Index firstCol, Index lastCol, Index k, Index firstRowW, Index firstColW, Index shift) {   using std::sqrt;   using std::abs;@@ -1189,7 +1117,6 @@ #endif #ifdef EIGEN_BDCSVD_DEBUG_VERBOSE   std::cout << "to be sorted: " << diag.transpose() << "\n\n";-  std::cout << "            : " << col0.transpose() << "\n\n"; #endif   {     // Check for total deflation@@ -1280,7 +1207,7 @@        if( (diag(i) - diag(i-1)) < NumTraits<RealScalar>::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<RealScalar>::epsilon()*/*diag(i)*/maxDiag << "\n";+        std::cout << "deflation 4.4 with i = " << i << " because " << (diag(i) - diag(i-1)) << " < " << NumTraits<RealScalar>::epsilon()*diag(i) << "\n"; #endif         eigen_internal_assert(abs(diag(i) - diag(i-1))<epsilon_coarse && " diagonal entries are not properly sorted");         deflation44(firstCol, firstCol + shift, firstRowW, firstColW, i-1, i, length);@@ -1299,7 +1226,7 @@ #endif }//end deflation -#ifndef EIGEN_CUDACC+#ifndef __CUDACC__ /** \svd_module   *   * \return the singular value decomposition of \c *this computed by Divide & Conquer algorithm
eigen3/Eigen/src/SVD/JacobiSVD.h view
@@ -610,7 +610,7 @@ };  template<typename MatrixType, int QRPreconditioner>-void JacobiSVD<MatrixType, QRPreconditioner>::allocate(Eigen::Index rows, Eigen::Index cols, unsigned int computationOptions)+void JacobiSVD<MatrixType, QRPreconditioner>::allocate(Index rows, Index cols, unsigned int computationOptions) {   eigen_assert(rows >= 0 && cols >= 0); 
eigen3/Eigen/src/SVD/SVDBase.h view
@@ -180,8 +180,10 @@   RealScalar threshold() const   {     eigen_assert(m_isInitialized || m_usePrescribedThreshold);+    // this temporary is needed to workaround a MSVC issue+    Index diagSize = (std::max<Index>)(1,m_diagSize);     return m_usePrescribedThreshold ? m_prescribedThreshold-                                    : (std::max<Index>)(1,m_diagSize)*NumTraits<Scalar>::epsilon();+                                    : diagSize*NumTraits<Scalar>::epsilon();   }    /** \returns true if \a U (full or thin) is asked for in this SVD decomposition */@@ -212,6 +214,7 @@      #ifndef EIGEN_PARSED_BY_DOXYGEN   template<typename RhsType, typename DstType>+  EIGEN_DEVICE_FUNC   void _solve_impl(const RhsType &rhs, DstType &dst) const;   #endif 
eigen3/Eigen/src/SVD/UpperBidiagonalization.h view
@@ -127,7 +127,7 @@        .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);+       .applyHouseholderOnTheRight(mat.row(k).tail(remainingCols-1).transpose(), mat.coeff(k,k+1), tempData);   } } @@ -202,7 +202,7 @@       {         SubColumnType y_k( Y.col(k).tail(remainingCols) );         -        // let's use the beginning of column k of Y as a temporary vector+        // let's use the begining of column k of Y as a temporary vector         SubColumnType tmp( Y.col(k).head(k) );         y_k.noalias()  = A.block(k,k+1, remainingRows,remainingCols).adjoint() * v_k; // bottleneck         tmp.noalias()  = V_k1.adjoint()  * v_k;@@ -231,7 +231,7 @@       {         SubColumnType x_k ( X.col(k).tail(remainingRows-1) );         -        // let's use the beginning of column k of X as a temporary vectors+        // let's use the begining of column k of X as a temporary vectors         // note that tmp0 and tmp1 overlaps         SubColumnType tmp0 ( X.col(k).head(k) ),                       tmp1 ( X.col(k).head(k+1) );
eigen3/Eigen/src/SparseCholesky/SimplicialCholesky.h view
@@ -101,7 +101,7 @@          /** \brief Reports whether previous computation was successful.       *-      * \returns \c Success if computation was successful,+      * \returns \c Success if computation was succesful,       *          \c NumericalIssue if the matrix.appears to be negative.       */     ComputationInfo info() const
eigen3/Eigen/src/SparseCholesky/SimplicialCholesky_impl.h view
@@ -122,7 +122,7 @@   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+    y[k] = 0.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@@ -146,12 +146,12 @@     /* 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);+    y[k] = 0.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);+      y[i] = 0.0;        /* the nonzero entry L(k,i) */       Scalar l_ki;
eigen3/Eigen/src/SparseCore/SparseAssign.h view
@@ -83,7 +83,7 @@     // 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));+    dst.reserve((std::max)(src.rows(),src.cols())*2);     for (Index j=0; j<outerEvaluationSize; ++j)     {       dst.startVec(j);@@ -107,7 +107,7 @@          DstXprType temp(src.rows(), src.cols()); -    temp.reserve((std::min)(src.rows()*src.cols(), (std::max)(src.rows(),src.cols())*2));+    temp.reserve((std::max)(src.rows(),src.cols())*2);     for (Index j=0; j<outerEvaluationSize; ++j)     {       temp.startVec(j);
eigen3/Eigen/src/SparseCore/SparseBlock.h view
@@ -326,6 +326,46 @@  //---------- +/** \returns the \a outer -th column (resp. row) of the matrix \c *this if \c *this+  * is col-major (resp. row-major).+  */+template<typename Derived>+typename SparseMatrixBase<Derived>::InnerVectorReturnType SparseMatrixBase<Derived>::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.+  */+template<typename Derived>+const typename SparseMatrixBase<Derived>::ConstInnerVectorReturnType SparseMatrixBase<Derived>::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).+  */+template<typename Derived>+typename SparseMatrixBase<Derived>::InnerVectorsReturnType+SparseMatrixBase<Derived>::innerVectors(Index outerStart, Index outerSize)+{+  return Block<Derived,Dynamic,Dynamic,true>(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.+  */+template<typename Derived>+const typename SparseMatrixBase<Derived>::ConstInnerVectorsReturnType+SparseMatrixBase<Derived>::innerVectors(Index outerStart, Index outerSize) const+{+  return Block<const Derived,Dynamic,Dynamic,true>(derived(),+                                                  IsRowMajor ? outerStart : 0, IsRowMajor ? 0 : outerStart,+                                                  IsRowMajor ? outerSize : rows(), IsRowMajor ? cols() : outerSize);++}+ /** Generic implementation of sparse Block expression.   * Real-only.   */
eigen3/Eigen/src/SparseCore/SparseCompressedBase.h view
@@ -185,15 +185,7 @@     }      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<Scalar&>(m_values[m_id]); } @@ -253,14 +245,6 @@     }      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<Scalar&>(m_values[m_id-1]); }
eigen3/Eigen/src/SparseCore/SparseCwiseBinaryOp.h view
@@ -212,7 +212,8 @@    enum {     CoeffReadCost = evaluator<Lhs>::CoeffReadCost + evaluator<Rhs>::CoeffReadCost + functor_traits<BinaryOp>::Cost,-    Flags = XprType::Flags+    // Expose storage order of the sparse expression+    Flags = (XprType::Flags & ~RowMajorBit) | (int(Rhs::Flags)&RowMajorBit)   };    explicit binary_evaluator(const XprType& xpr)@@ -299,7 +300,8 @@    enum {     CoeffReadCost = evaluator<Lhs>::CoeffReadCost + evaluator<Rhs>::CoeffReadCost + functor_traits<BinaryOp>::Cost,-    Flags = XprType::Flags+    // Expose storage order of the sparse expression+    Flags = (XprType::Flags & ~RowMajorBit) | (int(Lhs::Flags)&RowMajorBit)   };    explicit binary_evaluator(const XprType& xpr)@@ -531,7 +533,8 @@      enum {     CoeffReadCost = evaluator<LhsArg>::CoeffReadCost + evaluator<RhsArg>::CoeffReadCost + functor_traits<BinaryOp>::Cost,-    Flags = XprType::Flags+    // Expose storage order of the sparse expression+    Flags = (XprType::Flags & ~RowMajorBit) | (int(RhsArg::Flags)&RowMajorBit)   };      explicit sparse_conjunction_evaluator(const XprType& xpr)@@ -605,7 +608,8 @@      enum {     CoeffReadCost = evaluator<LhsArg>::CoeffReadCost + evaluator<RhsArg>::CoeffReadCost + functor_traits<BinaryOp>::Cost,-    Flags = XprType::Flags+    // Expose storage order of the sparse expression+    Flags = (XprType::Flags & ~RowMajorBit) | (int(LhsArg::Flags)&RowMajorBit)   };      explicit sparse_conjunction_evaluator(const XprType& xpr)
eigen3/Eigen/src/SparseCore/SparseDenseProduct.h view
@@ -88,11 +88,10 @@   typedef typename internal::remove_all<SparseLhsType>::type Lhs;   typedef typename internal::remove_all<DenseRhsType>::type Rhs;   typedef typename internal::remove_all<DenseResType>::type Res;-  typedef evaluator<Lhs> LhsEval;-  typedef typename LhsEval::InnerIterator LhsInnerIterator;+  typedef typename evaluator<Lhs>::InnerIterator LhsInnerIterator;   static void run(const SparseLhsType& lhs, const DenseRhsType& rhs, DenseResType& res, const AlphaType& alpha)   {-    LhsEval lhsEval(lhs);+    evaluator<Lhs> lhsEval(lhs);     for(Index c=0; c<rhs.cols(); ++c)     {       for(Index j=0; j<lhs.outerSize(); ++j)@@ -112,37 +111,16 @@   typedef typename internal::remove_all<SparseLhsType>::type Lhs;   typedef typename internal::remove_all<DenseRhsType>::type Rhs;   typedef typename internal::remove_all<DenseResType>::type Res;-  typedef evaluator<Lhs> LhsEval;-  typedef typename LhsEval::InnerIterator LhsInnerIterator;+  typedef typename evaluator<Lhs>::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<n; ++i)-        processRow(lhsEval,rhs,res,alpha,i);-    }-    else-#endif+    evaluator<Lhs> lhsEval(lhs);+    for(Index j=0; j<lhs.outerSize(); ++j)     {-      for(Index i=0; i<n; ++i)-        processRow(lhsEval, rhs, res, alpha, i);+      typename Res::RowXpr res_j(res.row(j));+      for(LhsInnerIterator it(lhsEval,j); it ;++it)+        res_j += (alpha*it.value()) * rhs.row(it.index());     }-  }--  static void processRow(const LhsEval& lhsEval, const DenseRhsType& rhs, Res& res, const typename Res::Scalar& alpha, Index i)-  {-    typename Res::RowXpr res_i(res.row(i));-    for(LhsInnerIterator it(lhsEval,i); it ;++it)-      res_i += (alpha*it.value()) * rhs.row(it.index());   } }; 
eigen3/Eigen/src/SparseCore/SparseMatrix.h view
@@ -21,7 +21,7 @@   * 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+  * space inbetween 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@@ -503,7 +503,7 @@       }     }     -    /** Suppresses all nonzeros which are \b much \b smaller \b than \a reference under the tolerance \a epsilon */+    /** Suppresses all nonzeros which are \b much \b smaller \b than \a reference under the tolerence \a epsilon */     void prune(const Scalar& reference, const RealScalar& epsilon = NumTraits<RealScalar>::dummy_precision())     {       prune(default_prunning_func(reference,epsilon));@@ -893,7 +893,7 @@        Index p = m_outerIndex[outer] + m_innerNonZeros[outer]++;       m_data.index(p) = convert_index(inner);-      return (m_data.value(p) = 0);+      return (m_data.value(p) = Scalar(0));     }  private:@@ -986,7 +986,7 @@   *   * \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.+  * be explicitely stored into a std::vector for instance.   */ template<typename Scalar, int _Options, typename _StorageIndex> template<typename InputIterators>@@ -1274,7 +1274,7 @@   m_innerNonZeros[outer]++;    m_data.index(p) = inner;-  return (m_data.value(p) = 0);+  return (m_data.value(p) = Scalar(0)); }  template<typename _Scalar, int _Options, typename _StorageIndex>@@ -1381,7 +1381,7 @@   }    m_data.index(p) = inner;-  return (m_data.value(p) = 0);+  return (m_data.value(p) = Scalar(0)); }  namespace internal {
eigen3/Eigen/src/SparseCore/SparseMatrixBase.h view
@@ -350,6 +350,18 @@     const ConstTransposeReturnType transpose() const { return ConstTransposeReturnType(derived()); }     const AdjointReturnType adjoint() const { return AdjointReturnType(transpose()); } +    // inner-vector+    typedef Block<Derived,IsRowMajor?1:Dynamic,IsRowMajor?Dynamic:1,true>       InnerVectorReturnType;+    typedef Block<const Derived,IsRowMajor?1:Dynamic,IsRowMajor?Dynamic:1,true> ConstInnerVectorReturnType;+    InnerVectorReturnType innerVector(Index outer);+    const ConstInnerVectorReturnType innerVector(Index outer) const;++    // set of inner-vectors+    typedef Block<Derived,Dynamic,Dynamic,true> InnerVectorsReturnType;+    typedef Block<const Derived,Dynamic,Dynamic,true> ConstInnerVectorsReturnType;+    InnerVectorsReturnType innerVectors(Index outerStart, Index outerSize);+    const ConstInnerVectorsReturnType innerVectors(Index outerStart, Index outerSize) const;+     DenseMatrixType toDense() const     {       return DenseMatrixType(derived());
eigen3/Eigen/src/SparseCore/SparseProduct.h view
@@ -17,7 +17,7 @@   * 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();             // supress numerical zeros (exact)   * C = (A*B).pruned(ref);   * C = (A*B).pruned(ref,epsilon);   * \endcode
eigen3/Eigen/src/SparseCore/SparseVector.h view
@@ -281,7 +281,7 @@     }      /** 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.+      * Overloaded for performance: this version performs a \em shallow swap by swaping pointers and attributes only.       * \sa SparseMatrixBase::swap()       */     inline void swap(SparseVector& other)
eigen3/Eigen/src/SparseLU/SparseLU.h view
@@ -193,7 +193,7 @@          /** \brief Reports whether previous computation was successful.       *-      * \returns \c Success if computation was successful,+      * \returns \c Success if computation was succesful,       *          \c NumericalIssue if the LU factorization reports a problem, zero diagonal for instance       *          \c InvalidInput if the input matrix is invalid       *@@ -499,8 +499,6 @@   eigen_assert(m_analysisIsOk && "analyzePattern() should be called first");    eigen_assert((matrix.rows() == matrix.cols()) && "Only for squared matrices");   -  typedef typename IndexVector::Scalar StorageIndex; -     m_isInitialized = true;      @@ -747,9 +745,8 @@       }       else       {-        // FIXME: the following lines should use Block expressions and not Map!         Map<const Matrix<Scalar,Dynamic,Dynamic, ColMajor>, 0, OuterStride<> > A( &(m_mapL.valuePtr()[luptr]), nsupc, nsupc, OuterStride<>(lda) );-        Map< Matrix<Scalar,Dynamic,Dest::ColsAtCompileTime, ColMajor>, 0, OuterStride<> > U (&(X.coeffRef(fsupc,0)), nsupc, nrhs, OuterStride<>(n) );+        Map< Matrix<Scalar,Dynamic,Dest::ColsAtCompileTime, ColMajor>, 0, OuterStride<> > U (&(X(fsupc,0)), nsupc, nrhs, OuterStride<>(n) );         U = A.template triangularView<Upper>().solve(U);       } 
eigen3/Eigen/src/SparseLU/SparseLU_Memory.h view
@@ -51,7 +51,7 @@   /** -  * Expand the existing storage to accommodate more fill-ins+  * Expand the existing storage to accomodate 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
eigen3/Eigen/src/SparseLU/SparseLU_column_dfs.h view
@@ -151,7 +151,7 @@         StorageIndex ito = glu.xlsub(fsupc+1);         glu.xlsub(jcolm1) = ito;          StorageIndex istop = ito + jptr - jm1ptr; -        xprune(jcolm1) = istop; // initialize xprune(jcol-1)+        xprune(jcolm1) = istop; // intialize xprune(jcol-1)         glu.xlsub(jcol) = istop;                   for (StorageIndex ifrom = jm1ptr; ifrom < nextl; ++ifrom, ++ito)@@ -166,7 +166,7 @@   // Tidy up the pointers before exit   glu.xsup(nsuper+1) = jcolp1;    glu.supno(jcolp1) = nsuper; -  xprune(jcol) = StorageIndex(nextl);  // Initialize upper bound for pruning+  xprune(jcol) = StorageIndex(nextl);  // Intialize upper bound for pruning   glu.xlsub(jcolp1) = StorageIndex(nextl);       return 0; 
eigen3/Eigen/src/SparseLU/SparseLU_gemm_kernel.h view
@@ -215,7 +215,7 @@         if(RK==4){ a3 = pload<Packet>(A3+i+(I+1)*PacketSize);  }\                    pstore(C0+i+(I)*PacketSize, c0);         -        // aggressive vectorization and peeling+        // agressive vectorization and peeling         for(Index i=0; i<actual_b_end1; i+=PacketSize*8)         {           EIGEN_ASM_COMMENT("SPARSELU_GEMML_KERNEL2");
eigen3/Eigen/src/SparseLU/SparseLU_panel_bmod.h view
@@ -38,7 +38,7 @@  * \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]+ * were already copied i nto the spa[m,w]  *   * \param m number of rows in the matrix  * \param w Panel size
eigen3/Eigen/src/SuperLUSupport/SuperLUSupport.h view
@@ -297,8 +297,8 @@ template<typename Scalar, int Flags, typename Index> MappedSparseMatrix<Scalar,Flags,Index> map_superlu(SluMatrix& sluMat) {-  eigen_assert((Flags&RowMajor)==RowMajor && sluMat.Stype == SLU_NR-         || (Flags&ColMajor)==ColMajor && sluMat.Stype == SLU_NC);+  eigen_assert(((Flags&RowMajor)==RowMajor && sluMat.Stype == SLU_NR)+         || ((Flags&ColMajor)==ColMajor && sluMat.Stype == SLU_NC));    Index outerSize = (Flags&RowMajor)==RowMajor ? sluMat.ncol : sluMat.nrow; @@ -352,7 +352,7 @@          /** \brief Reports whether previous computation was successful.       *-      * \returns \c Success if computation was successful,+      * \returns \c Success if computation was succesful,       *          \c NumericalIssue if the matrix.appears to be negative.       */     ComputationInfo info() const
eigen3/Eigen/src/UmfPackSupport/UmfPackSupport.h view
@@ -10,16 +10,6 @@ #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... */@@ -27,85 +17,42 @@ // generic double/complex<double> wrapper functions:  - // Defaults-inline void umfpack_defaults(double control[UMFPACK_CONTROL], double, int)+inline void umfpack_defaults(double control[UMFPACK_CONTROL], double) { umfpack_di_defaults(control); } -inline void umfpack_defaults(double control[UMFPACK_CONTROL], std::complex<double>, int)+inline void umfpack_defaults(double control[UMFPACK_CONTROL], std::complex<double>) { 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<double>, SuiteSparse_long)-{ umfpack_zl_defaults(control); }--// Report info-inline void umfpack_report_info(double control[UMFPACK_CONTROL], double info[UMFPACK_INFO], double, int)+inline void umfpack_report_info(double control[UMFPACK_CONTROL], double info[UMFPACK_INFO], double) { umfpack_di_report_info(control, info);} -inline void umfpack_report_info(double control[UMFPACK_CONTROL], double info[UMFPACK_INFO], std::complex<double>, int)+inline void umfpack_report_info(double control[UMFPACK_CONTROL], double info[UMFPACK_INFO], std::complex<double>) { 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<double>, SuiteSparse_long)-{ umfpack_zl_report_info(control, info);}--// Report status-inline void umfpack_report_status(double control[UMFPACK_CONTROL], int status, double, int)+inline void umfpack_report_status(double control[UMFPACK_CONTROL], int status, double) { umfpack_di_report_status(control, status);} -inline void umfpack_report_status(double control[UMFPACK_CONTROL], int status, std::complex<double>, int)+inline void umfpack_report_status(double control[UMFPACK_CONTROL], int status, std::complex<double>) { 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<double>, SuiteSparse_long)-{ umfpack_zl_report_status(control, status);}--// report control-inline void umfpack_report_control(double control[UMFPACK_CONTROL], double, int)+inline void umfpack_report_control(double control[UMFPACK_CONTROL], double) { umfpack_di_report_control(control);} -inline void umfpack_report_control(double control[UMFPACK_CONTROL], std::complex<double>, int)+inline void umfpack_report_control(double control[UMFPACK_CONTROL], std::complex<double>) { 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<double>, SuiteSparse_long)-{ umfpack_zl_report_control(control);}--// Free numeric-inline void umfpack_free_numeric(void **Numeric, double, int)+inline void umfpack_free_numeric(void **Numeric, double) { umfpack_di_free_numeric(Numeric); *Numeric = 0; } -inline void umfpack_free_numeric(void **Numeric, std::complex<double>, int)+inline void umfpack_free_numeric(void **Numeric, std::complex<double>) { 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<double>, SuiteSparse_long)-{ umfpack_zl_free_numeric(Numeric); *Numeric = 0; }--// Free symbolic-inline void umfpack_free_symbolic(void **Symbolic, double, int)+inline void umfpack_free_symbolic(void **Symbolic, double) { umfpack_di_free_symbolic(Symbolic); *Symbolic = 0; } -inline void umfpack_free_symbolic(void **Symbolic, std::complex<double>, int)+inline void umfpack_free_symbolic(void **Symbolic, std::complex<double>) { 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<double>, 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])@@ -119,21 +66,7 @@ {   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<double> 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])@@ -147,21 +80,7 @@ {   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<double> 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])@@ -176,21 +95,6 @@   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<double> Ax[],-                                      std::complex<double> X[], const std::complex<double> 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);@@ -201,19 +105,6 @@   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<double>)-{-  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) {@@ -229,46 +120,19 @@   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<double> Lx[], SuiteSparse_long Up[], SuiteSparse_long Ui[], std::complex<double> Ux[],-                                            SuiteSparse_long P[], SuiteSparse_long Q[], std::complex<double> 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)+inline int umfpack_get_determinant(double *Mx, double *Ex, void *NumericHandle, double User_Info [UMFPACK_INFO]) {   return umfpack_di_get_determinant(Mx,Ex,NumericHandle,User_Info); } -inline int umfpack_get_determinant(std::complex<double> *Mx, double *Ex, void *NumericHandle, double User_Info [UMFPACK_INFO], int)+inline int umfpack_get_determinant(std::complex<double> *Mx, double *Ex, void *NumericHandle, double User_Info [UMFPACK_INFO]) {   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<double> *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   *@@ -300,7 +164,7 @@     typedef Matrix<int, 1, MatrixType::ColsAtCompileTime> IntRowVectorType;     typedef Matrix<int, MatrixType::RowsAtCompileTime, 1> IntColVectorType;     typedef SparseMatrix<Scalar> LUMatrixType;-    typedef SparseMatrix<Scalar,ColMajor,StorageIndex> UmfpackMatrixType;+    typedef SparseMatrix<Scalar,ColMajor,int> UmfpackMatrixType;     typedef Ref<const UmfpackMatrixType, StandardCompressedFormat> UmfpackMatrixRef;     enum {       ColsAtCompileTime = MatrixType::ColsAtCompileTime,@@ -328,8 +192,8 @@      ~UmfPackLU()     {-      if(m_symbolic) umfpack_free_symbolic(&m_symbolic,Scalar(), StorageIndex());-      if(m_numeric)  umfpack_free_numeric(&m_numeric,Scalar(), StorageIndex());+      if(m_symbolic) umfpack_free_symbolic(&m_symbolic,Scalar());+      if(m_numeric)  umfpack_free_numeric(&m_numeric,Scalar());     }      inline Index rows() const { return mp_matrix.rows(); }@@ -337,7 +201,7 @@      /** \brief Reports whether previous computation was successful.       *-      * \returns \c Success if computation was successful,+      * \returns \c Success if computation was succesful,       *          \c NumericalIssue if the matrix.appears to be negative.       */     ComputationInfo info() const@@ -377,8 +241,8 @@     template<typename InputMatrixType>     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());+      if(m_symbolic) umfpack_free_symbolic(&m_symbolic,Scalar());+      if(m_numeric)  umfpack_free_numeric(&m_numeric,Scalar());       grab(matrix.derived());       analyzePattern_impl();       factorize_impl();@@ -393,8 +257,8 @@     template<typename InputMatrixType>     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());+      if(m_symbolic) umfpack_free_symbolic(&m_symbolic,Scalar());+      if(m_numeric)  umfpack_free_numeric(&m_numeric,Scalar());        grab(matrix.derived()); @@ -445,7 +309,7 @@     {       eigen_assert(m_analysisIsOk && "UmfPackLU: you must first call analyzePattern()");       if(m_numeric)-        umfpack_free_numeric(&m_numeric,Scalar(),StorageIndex());+        umfpack_free_numeric(&m_numeric,Scalar());        grab(matrix.derived()); @@ -456,28 +320,28 @@       *       * \sa umfpackControl()       */-    void printUmfpackControl()+    void umfpackReportControl()     {-      umfpack_report_control(m_control.data(), Scalar(),StorageIndex());+      umfpack_report_control(m_control.data(), Scalar());     }      /** Prints statistics collected by UmfPack.       *       * \sa analyzePattern(), compute()       */-    void printUmfpackInfo()+    void umfpackReportInfo()     {       eigen_assert(m_analysisIsOk && "UmfPackLU: you must first call analyzePattern()");-      umfpack_report_info(m_control.data(), m_umfpackInfo.data(), Scalar(),StorageIndex());+      umfpack_report_info(m_control.data(), m_umfpackInfo.data(), Scalar());     }      /** Prints the status of the previous factorization operation performed by UmfPack (symbolic or numerical factorization).       *       * \sa analyzePattern(), compute()       */-    void printUmfpackStatus() {+    void umfpackReportStatus() {       eigen_assert(m_analysisIsOk && "UmfPackLU: you must first call analyzePattern()");-      umfpack_report_status(m_control.data(), m_fact_errorCode, Scalar(),StorageIndex());+      umfpack_report_status(m_control.data(), m_fact_errorCode, Scalar());     }      /** \internal */@@ -498,13 +362,13 @@       m_symbolic              = 0;       m_extractedDataAreDirty = true; -      umfpack_defaults(m_control.data(), Scalar(),StorageIndex());+      umfpack_defaults(m_control.data(), Scalar());     }      void analyzePattern_impl()     {-      m_fact_errorCode = umfpack_symbolic(internal::convert_index<StorageIndex>(mp_matrix.rows()),-                                          internal::convert_index<StorageIndex>(mp_matrix.cols()),+      m_fact_errorCode = umfpack_symbolic(internal::convert_index<int>(mp_matrix.rows()),+                                          internal::convert_index<int>(mp_matrix.cols()),                                           mp_matrix.outerIndexPtr(), mp_matrix.innerIndexPtr(), mp_matrix.valuePtr(),                                           &m_symbolic, m_control.data(), m_umfpackInfo.data()); @@ -544,7 +408,7 @@      // cached data to reduce reallocation, etc.     mutable LUMatrixType m_l;-    StorageIndex m_fact_errorCode;+    int m_fact_errorCode;     UmfpackControl m_control;     mutable UmfpackInfo m_umfpackInfo; @@ -574,7 +438,7 @@   if (m_extractedDataAreDirty)   {     // get size of the data-    StorageIndex lnz, unz, rows, cols, nz_udiag;+    int lnz, unz, rows, cols, nz_udiag;     umfpack_get_lunz(&lnz, &unz, &rows, &cols, &nz_udiag, m_numeric, Scalar());      // allocate data@@ -600,7 +464,7 @@ typename UmfPackLU<MatrixType>::Scalar UmfPackLU<MatrixType>::determinant() const {   Scalar det;-  umfpack_get_determinant(&det, 0, m_numeric, 0, StorageIndex());+  umfpack_get_determinant(&det, 0, m_numeric, 0);   return det; } @@ -613,7 +477,7 @@   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"); -  StorageIndex errorCode;+  int errorCode;   Scalar* x_ptr = 0;   Matrix<Scalar,Dynamic,1> x_tmp;   if(x.innerStride()!=1)@@ -625,10 +489,9 @@   {     if(x.innerStride()==1)       x_ptr = &x.col(j).coeffRef(0);-      errorCode = umfpack_solve(UMFPACK_A,-                                mp_matrix.outerIndexPtr(), mp_matrix.innerIndexPtr(), mp_matrix.valuePtr(),-                                x_ptr, &b.const_cast_derived().col(j).coeffRef(0),-                                m_numeric, m_control.data(), m_umfpackInfo.data());+    errorCode = umfpack_solve(UMFPACK_A,+        mp_matrix.outerIndexPtr(), mp_matrix.innerIndexPtr(), mp_matrix.valuePtr(),+        x_ptr, &b.const_cast_derived().col(j).coeffRef(0), m_numeric, m_control.data(), m_umfpackInfo.data());     if(x.innerStride()!=1)       x.col(j) = x_tmp;     if (errorCode!=0)
eigen3/Eigen/src/misc/lapacke.h view
@@ -43,6 +43,10 @@ #include "lapacke_config.h" #endif +#ifdef __cplusplus+extern "C" {+#endif /* __cplusplus */+ #include <stdlib.h>  #ifndef lapack_int@@ -103,11 +107,6 @@ 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 )
eigen3/Eigen/src/plugins/ArrayCwiseUnaryOps.h view
@@ -10,7 +10,6 @@ typedef CwiseUnaryOp<internal::scalar_boolean_not_op<Scalar>, const Derived> BooleanNotReturnType;  typedef CwiseUnaryOp<internal::scalar_exp_op<Scalar>, const Derived> ExpReturnType;-typedef CwiseUnaryOp<internal::scalar_expm1_op<Scalar>, const Derived> Expm1ReturnType; typedef CwiseUnaryOp<internal::scalar_log_op<Scalar>, const Derived> LogReturnType; typedef CwiseUnaryOp<internal::scalar_log1p_op<Scalar>, const Derived> Log1pReturnType; typedef CwiseUnaryOp<internal::scalar_log10_op<Scalar>, const Derived> Log10ReturnType;@@ -91,20 +90,6 @@   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 <a href="group__CoeffwiseMathFunctions.html#cwisetable_expm1">Math functions</a>, 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@@ -113,7 +98,7 @@   * Example: \include Cwise_log.cpp   * Output: \verbinclude Cwise_log.out   *-  * \sa <a href="group__CoeffwiseMathFunctions.html#cwisetable_log">Math functions</a>, log()+  * \sa <a href="group__CoeffwiseMathFunctions.html#cwisetable_log">Math functions</a>, exp()   */ EIGEN_DEVICE_FUNC inline const LogReturnType
eigen3/Eigen/src/plugins/BlockMethods.h view
@@ -40,126 +40,68 @@ template<int Size> struct FixedSegmentReturnType { typedef VectorBlock<Derived, Size> Type; }; template<int Size> struct ConstFixedSegmentReturnType { typedef const VectorBlock<const Derived, Size> Type; }; -/// \internal inner-vector-typedef Block<Derived,IsRowMajor?1:Dynamic,IsRowMajor?Dynamic:1,true>       InnerVectorReturnType;-typedef Block<const Derived,IsRowMajor?1:Dynamic,IsRowMajor?Dynamic:1,true> ConstInnerVectorReturnType;--/// \internal set of inner-vectors-typedef Block<Derived,Dynamic,Dynamic,true> InnerVectorsReturnType;-typedef Block<const Derived,Dynamic,Dynamic,true> ConstInnerVectorsReturnType;- #endif // not EIGEN_PARSED_BY_DOXYGEN -/// \returns an expression of a block in \c *this with either dynamic or fixed sizes.+/// \returns a dynamic-size expression of a block in *this. ///-/// \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.+/// \param startRow the first row in the block+/// \param startCol the first column in the block+/// \param blockRows the number of rows in the block+/// \param blockCols the number of columns in the block ///-/// Example using runtime (aka dynamic) sizes: \include MatrixBase_block_int_int_int_int.cpp+/// Example: \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<N>,-/// or Eigen::fix<N>(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<NRows>,cols)-/// \endcode-///-/// This function thus fully covers the features offered by the following overloads block<NRows,NCols>(Index, Index),-/// and block<NRows,NCols>(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+/// \note Even though 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<N>(int)+/// \sa class Block, block(Index,Index) ///-template<typename NRowsType, typename NColsType> EIGEN_DEVICE_FUNC-#ifndef EIGEN_PARSED_BY_DOXYGEN-inline typename FixedBlockXpr<internal::get_fixed_value<NRowsType>::value,internal::get_fixed_value<NColsType>::value>::Type-#else-inline typename FixedBlockXpr<...,...>::Type-#endif-block(Index startRow, Index startCol, NRowsType blockRows, NColsType blockCols)+inline BlockXpr block(Index startRow, Index startCol, Index blockRows, Index blockCols) {-  return typename FixedBlockXpr<internal::get_fixed_value<NRowsType>::value,internal::get_fixed_value<NColsType>::value>::Type(-            derived(), startRow, startCol, internal::get_runtime_value(blockRows), internal::get_runtime_value(blockCols));+  return BlockXpr(derived(), startRow, startCol, blockRows, blockCols); } -/// This is the const version of block(Index,Index,NRowsType,NColsType)-template<typename NRowsType, typename NColsType>+/// This is the const version of block(Index,Index,Index,Index). */ EIGEN_DEVICE_FUNC-#ifndef EIGEN_PARSED_BY_DOXYGEN-inline const typename ConstFixedBlockXpr<internal::get_fixed_value<NRowsType>::value,internal::get_fixed_value<NColsType>::value>::Type-#else-inline const typename ConstFixedBlockXpr<...,...>::Type-#endif-block(Index startRow, Index startCol, NRowsType blockRows, NColsType blockCols) const+inline const ConstBlockXpr block(Index startRow, Index startCol, Index blockRows, Index blockCols) const {-  return typename ConstFixedBlockXpr<internal::get_fixed_value<NRowsType>::value,internal::get_fixed_value<NColsType>::value>::Type(-            derived(), startRow, startCol, internal::get_runtime_value(blockRows), internal::get_runtime_value(blockCols));+  return ConstBlockXpr(derived(), startRow, startCol, blockRows, blockCols); }   -/// \returns a expression of a top-right corner of \c *this with either dynamic or fixed sizes.++/// \returns a dynamic-size expression of a top-right corner of *this. /// /// \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+/// Example: \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<N>,-/// or Eigen::fix<N>(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+/// \sa class Block, block(Index,Index,Index,Index) ///-template<typename NRowsType, typename NColsType> EIGEN_DEVICE_FUNC-#ifndef EIGEN_PARSED_BY_DOXYGEN-inline typename FixedBlockXpr<internal::get_fixed_value<NRowsType>::value,internal::get_fixed_value<NColsType>::value>::Type-#else-inline typename FixedBlockXpr<...,...>::Type-#endif-topRightCorner(NRowsType cRows, NColsType cCols)+inline BlockXpr topRightCorner(Index cRows, Index cCols) {-  return typename FixedBlockXpr<internal::get_fixed_value<NRowsType>::value,internal::get_fixed_value<NColsType>::value>::Type-            (derived(), 0, cols() - internal::get_runtime_value(cCols), internal::get_runtime_value(cRows), internal::get_runtime_value(cCols));+  return BlockXpr(derived(), 0, cols() - cCols, cRows, cCols); } -/// This is the const version of topRightCorner(NRowsType, NColsType).-template<typename NRowsType, typename NColsType>+/// This is the const version of topRightCorner(Index, Index). EIGEN_DEVICE_FUNC-#ifndef EIGEN_PARSED_BY_DOXYGEN-inline const typename ConstFixedBlockXpr<internal::get_fixed_value<NRowsType>::value,internal::get_fixed_value<NColsType>::value>::Type-#else-inline const typename ConstFixedBlockXpr<...,...>::Type-#endif-topRightCorner(NRowsType cRows, NColsType cCols) const+inline const ConstBlockXpr topRightCorner(Index cRows, Index cCols) const {-  return typename ConstFixedBlockXpr<internal::get_fixed_value<NRowsType>::value,internal::get_fixed_value<NColsType>::value>::Type-            (derived(), 0, cols() - internal::get_runtime_value(cCols), internal::get_runtime_value(cRows), internal::get_runtime_value(cCols));+  return ConstBlockXpr(derived(), 0, cols() - cCols, cRows, cCols); } -/// \returns an expression of a fixed-size top-right corner of \c *this.+/// \returns an expression of a fixed-size top-right corner of *this. /// /// \tparam CRows the number of rows in the corner /// \tparam CCols the number of columns in the corner@@ -186,7 +128,7 @@   return typename ConstFixedBlockXpr<CRows,CCols>::Type(derived(), 0, cols() - CCols); } -/// \returns an expression of a top-right corner of \c *this.+/// \returns an expression of a top-right corner of *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@@ -220,51 +162,32 @@   -/// \returns an expression of a top-left corner of \c *this  with either dynamic or fixed sizes.+/// \returns a dynamic-size expression of a top-left corner of *this. /// /// \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<N>,-/// or Eigen::fix<N>(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+/// \sa class Block, block(Index,Index,Index,Index) ///-template<typename NRowsType, typename NColsType> EIGEN_DEVICE_FUNC-#ifndef EIGEN_PARSED_BY_DOXYGEN-inline typename FixedBlockXpr<internal::get_fixed_value<NRowsType>::value,internal::get_fixed_value<NColsType>::value>::Type-#else-inline typename FixedBlockXpr<...,...>::Type-#endif-topLeftCorner(NRowsType cRows, NColsType cCols)+inline BlockXpr topLeftCorner(Index cRows, Index cCols) {-  return typename FixedBlockXpr<internal::get_fixed_value<NRowsType>::value,internal::get_fixed_value<NColsType>::value>::Type-            (derived(), 0, 0, internal::get_runtime_value(cRows), internal::get_runtime_value(cCols));+  return BlockXpr(derived(), 0, 0, cRows, cCols); }  /// This is the const version of topLeftCorner(Index, Index).-template<typename NRowsType, typename NColsType> EIGEN_DEVICE_FUNC-#ifndef EIGEN_PARSED_BY_DOXYGEN-inline const typename ConstFixedBlockXpr<internal::get_fixed_value<NRowsType>::value,internal::get_fixed_value<NColsType>::value>::Type-#else-inline const typename ConstFixedBlockXpr<...,...>::Type-#endif-topLeftCorner(NRowsType cRows, NColsType cCols) const+inline const ConstBlockXpr topLeftCorner(Index cRows, Index cCols) const {-  return typename ConstFixedBlockXpr<internal::get_fixed_value<NRowsType>::value,internal::get_fixed_value<NColsType>::value>::Type-            (derived(), 0, 0, internal::get_runtime_value(cRows), internal::get_runtime_value(cCols));+  return ConstBlockXpr(derived(), 0, 0, cRows, cCols); } -/// \returns an expression of a fixed-size top-left corner of \c *this.+/// \returns an expression of a fixed-size top-left corner of *this. /// /// The template parameters CRows and CCols are the number of rows and columns in the corner. ///@@ -273,7 +196,7 @@ /// EIGEN_DOC_BLOCK_ADDONS_NOT_INNER_PANEL ///-/// \sa block(Index,Index,NRowsType,NColsType), class Block+/// \sa class Block, block(Index,Index,Index,Index) /// template<int CRows, int CCols> EIGEN_DEVICE_FUNC@@ -290,7 +213,7 @@   return typename ConstFixedBlockXpr<CRows,CCols>::Type(derived(), 0, 0); } -/// \returns an expression of a top-left corner of \c *this.+/// \returns an expression of a top-left corner of *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@@ -324,53 +247,32 @@   -/// \returns an expression of a bottom-right corner of \c *this  with either dynamic or fixed sizes.+/// \returns a dynamic-size expression of a bottom-right corner of *this. /// /// \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<N>,-/// or Eigen::fix<N>(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+/// \sa class Block, block(Index,Index,Index,Index) ///-template<typename NRowsType, typename NColsType> EIGEN_DEVICE_FUNC-#ifndef EIGEN_PARSED_BY_DOXYGEN-inline typename FixedBlockXpr<internal::get_fixed_value<NRowsType>::value,internal::get_fixed_value<NColsType>::value>::Type-#else-inline typename FixedBlockXpr<...,...>::Type-#endif-bottomRightCorner(NRowsType cRows, NColsType cCols)+inline BlockXpr bottomRightCorner(Index cRows, Index cCols) {-  return typename FixedBlockXpr<internal::get_fixed_value<NRowsType>::value,internal::get_fixed_value<NColsType>::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));+  return BlockXpr(derived(), rows() - cRows, cols() - cCols, cRows, cCols); } -/// This is the const version of bottomRightCorner(NRowsType, NColsType).-template<typename NRowsType, typename NColsType>+/// This is the const version of bottomRightCorner(Index, Index). EIGEN_DEVICE_FUNC-#ifndef EIGEN_PARSED_BY_DOXYGEN-inline const typename ConstFixedBlockXpr<internal::get_fixed_value<NRowsType>::value,internal::get_fixed_value<NColsType>::value>::Type-#else-inline const typename ConstFixedBlockXpr<...,...>::Type-#endif-bottomRightCorner(NRowsType cRows, NColsType cCols) const+inline const ConstBlockXpr bottomRightCorner(Index cRows, Index cCols) const {-  return typename ConstFixedBlockXpr<internal::get_fixed_value<NRowsType>::value,internal::get_fixed_value<NColsType>::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));+  return ConstBlockXpr(derived(), rows() - cRows, cols() - cCols, cRows, cCols); } -/// \returns an expression of a fixed-size bottom-right corner of \c *this.+/// \returns an expression of a fixed-size bottom-right corner of *this. /// /// The template parameters CRows and CCols are the number of rows and columns in the corner. ///@@ -379,7 +281,7 @@ /// EIGEN_DOC_BLOCK_ADDONS_NOT_INNER_PANEL ///-/// \sa block(Index,Index,NRowsType,NColsType), class Block+/// \sa class Block, block(Index,Index,Index,Index) /// template<int CRows, int CCols> EIGEN_DEVICE_FUNC@@ -396,7 +298,7 @@   return typename ConstFixedBlockXpr<CRows,CCols>::Type(derived(), rows() - CRows, cols() - CCols); } -/// \returns an expression of a bottom-right corner of \c *this.+/// \returns an expression of a bottom-right corner of *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@@ -430,53 +332,32 @@   -/// \returns an expression of a bottom-left corner of \c *this  with either dynamic or fixed sizes.+/// \returns a dynamic-size expression of a bottom-left corner of *this. /// /// \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<N>,-/// or Eigen::fix<N>(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+/// \sa class Block, block(Index,Index,Index,Index) ///-template<typename NRowsType, typename NColsType> EIGEN_DEVICE_FUNC-#ifndef EIGEN_PARSED_BY_DOXYGEN-inline typename FixedBlockXpr<internal::get_fixed_value<NRowsType>::value,internal::get_fixed_value<NColsType>::value>::Type-#else-inline typename FixedBlockXpr<...,...>::Type-#endif-bottomLeftCorner(NRowsType cRows, NColsType cCols)+inline BlockXpr bottomLeftCorner(Index cRows, Index cCols) {-  return typename FixedBlockXpr<internal::get_fixed_value<NRowsType>::value,internal::get_fixed_value<NColsType>::value>::Type-            (derived(), rows() - internal::get_runtime_value(cRows), 0,-                        internal::get_runtime_value(cRows), internal::get_runtime_value(cCols));+  return BlockXpr(derived(), rows() - cRows, 0, cRows, cCols); } -/// This is the const version of bottomLeftCorner(NRowsType, NColsType).-template<typename NRowsType, typename NColsType>+/// This is the const version of bottomLeftCorner(Index, Index). EIGEN_DEVICE_FUNC-#ifndef EIGEN_PARSED_BY_DOXYGEN-inline typename ConstFixedBlockXpr<internal::get_fixed_value<NRowsType>::value,internal::get_fixed_value<NColsType>::value>::Type-#else-inline typename ConstFixedBlockXpr<...,...>::Type-#endif-bottomLeftCorner(NRowsType cRows, NColsType cCols) const+inline const ConstBlockXpr bottomLeftCorner(Index cRows, Index cCols) const {-  return typename ConstFixedBlockXpr<internal::get_fixed_value<NRowsType>::value,internal::get_fixed_value<NColsType>::value>::Type-            (derived(), rows() - internal::get_runtime_value(cRows), 0,-                        internal::get_runtime_value(cRows), internal::get_runtime_value(cCols));+  return ConstBlockXpr(derived(), rows() - cRows, 0, cRows, cCols); } -/// \returns an expression of a fixed-size bottom-left corner of \c *this.+/// \returns an expression of a fixed-size bottom-left corner of *this. /// /// The template parameters CRows and CCols are the number of rows and columns in the corner. ///@@ -485,7 +366,7 @@ /// EIGEN_DOC_BLOCK_ADDONS_NOT_INNER_PANEL ///-/// \sa block(Index,Index,NRowsType,NColsType), class Block+/// \sa class Block, block(Index,Index,Index,Index) /// template<int CRows, int CCols> EIGEN_DEVICE_FUNC@@ -502,7 +383,7 @@   return typename ConstFixedBlockXpr<CRows,CCols>::Type(derived(), rows() - CRows, 0); } -/// \returns an expression of a bottom-left corner of \c *this.+/// \returns an expression of a bottom-left corner of *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@@ -536,50 +417,31 @@   -/// \returns a block consisting of the top rows of \c *this.+/// \returns a block consisting of the top rows of *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<N>,-/// or Eigen::fix<N>(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+/// \sa class Block, block(Index,Index,Index,Index) ///-template<typename NRowsType> EIGEN_DEVICE_FUNC-#ifndef EIGEN_PARSED_BY_DOXYGEN-inline typename NRowsBlockXpr<internal::get_fixed_value<NRowsType>::value>::Type-#else-inline typename NRowsBlockXpr<...>::Type-#endif-topRows(NRowsType n)+inline RowsBlockXpr topRows(Index n) {-  return typename NRowsBlockXpr<internal::get_fixed_value<NRowsType>::value>::Type-            (derived(), 0, 0, internal::get_runtime_value(n), cols());+  return RowsBlockXpr(derived(), 0, 0, n, cols()); } -/// This is the const version of topRows(NRowsType).-template<typename NRowsType>+/// This is the const version of topRows(Index). EIGEN_DEVICE_FUNC-#ifndef EIGEN_PARSED_BY_DOXYGEN-inline const typename ConstNRowsBlockXpr<internal::get_fixed_value<NRowsType>::value>::Type-#else-inline const typename ConstNRowsBlockXpr<...>::Type-#endif-topRows(NRowsType n) const+inline ConstRowsBlockXpr topRows(Index n) const {-  return typename ConstNRowsBlockXpr<internal::get_fixed_value<NRowsType>::value>::Type-            (derived(), 0, 0, internal::get_runtime_value(n), cols());+  return ConstRowsBlockXpr(derived(), 0, 0, n, cols()); } -/// \returns a block consisting of the top rows of \c *this.+/// \returns a block consisting of the top rows of *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@@ -592,7 +454,7 @@ /// EIGEN_DOC_BLOCK_ADDONS_INNER_PANEL_IF(row-major) ///-/// \sa block(Index,Index,NRowsType,NColsType), class Block+/// \sa class Block, block(Index,Index,Index,Index) /// template<int N> EIGEN_DEVICE_FUNC@@ -611,50 +473,31 @@   -/// \returns a block consisting of the bottom rows of \c *this.+/// \returns a block consisting of the bottom rows of *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<N>,-/// or Eigen::fix<N>(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+/// \sa class Block, block(Index,Index,Index,Index) ///-template<typename NRowsType> EIGEN_DEVICE_FUNC-#ifndef EIGEN_PARSED_BY_DOXYGEN-inline typename NRowsBlockXpr<internal::get_fixed_value<NRowsType>::value>::Type-#else-inline typename NRowsBlockXpr<...>::Type-#endif-bottomRows(NRowsType n)+inline RowsBlockXpr bottomRows(Index n) {-  return typename NRowsBlockXpr<internal::get_fixed_value<NRowsType>::value>::Type-            (derived(), rows() - internal::get_runtime_value(n), 0, internal::get_runtime_value(n), cols());+  return RowsBlockXpr(derived(), rows() - n, 0, n, cols()); } -/// This is the const version of bottomRows(NRowsType).-template<typename NRowsType>+/// This is the const version of bottomRows(Index). EIGEN_DEVICE_FUNC-#ifndef EIGEN_PARSED_BY_DOXYGEN-inline const typename ConstNRowsBlockXpr<internal::get_fixed_value<NRowsType>::value>::Type-#else-inline const typename ConstNRowsBlockXpr<...>::Type-#endif-bottomRows(NRowsType n) const+inline ConstRowsBlockXpr bottomRows(Index n) const {-  return typename ConstNRowsBlockXpr<internal::get_fixed_value<NRowsType>::value>::Type-            (derived(), rows() - internal::get_runtime_value(n), 0, internal::get_runtime_value(n), cols());+  return ConstRowsBlockXpr(derived(), rows() - n, 0, n, cols()); } -/// \returns a block consisting of the bottom rows of \c *this.+/// \returns a block consisting of the bottom rows of *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@@ -667,7 +510,7 @@ /// EIGEN_DOC_BLOCK_ADDONS_INNER_PANEL_IF(row-major) ///-/// \sa block(Index,Index,NRowsType,NColsType), class Block+/// \sa class Block, block(Index,Index,Index,Index) /// template<int N> EIGEN_DEVICE_FUNC@@ -686,51 +529,32 @@   -/// \returns a block consisting of a range of rows of \c *this.+/// \returns a block consisting of a range of rows of *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<N>,-/// or Eigen::fix<N>(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+/// \sa class Block, block(Index,Index,Index,Index) ///-template<typename NRowsType> EIGEN_DEVICE_FUNC-#ifndef EIGEN_PARSED_BY_DOXYGEN-inline typename NRowsBlockXpr<internal::get_fixed_value<NRowsType>::value>::Type-#else-inline typename NRowsBlockXpr<...>::Type-#endif-middleRows(Index startRow, NRowsType n)+inline RowsBlockXpr middleRows(Index startRow, Index n) {-  return typename NRowsBlockXpr<internal::get_fixed_value<NRowsType>::value>::Type-            (derived(), startRow, 0, internal::get_runtime_value(n), cols());+  return RowsBlockXpr(derived(), startRow, 0, n, cols()); } -/// This is the const version of middleRows(Index,NRowsType).-template<typename NRowsType>+/// This is the const version of middleRows(Index,Index). EIGEN_DEVICE_FUNC-#ifndef EIGEN_PARSED_BY_DOXYGEN-inline const typename ConstNRowsBlockXpr<internal::get_fixed_value<NRowsType>::value>::Type-#else-inline const typename ConstNRowsBlockXpr<...>::Type-#endif-middleRows(Index startRow, NRowsType n) const+inline ConstRowsBlockXpr middleRows(Index startRow, Index n) const {-  return typename ConstNRowsBlockXpr<internal::get_fixed_value<NRowsType>::value>::Type-            (derived(), startRow, 0, internal::get_runtime_value(n), cols());+  return ConstRowsBlockXpr(derived(), startRow, 0, n, cols()); } -/// \returns a block consisting of a range of rows of \c *this.+/// \returns a block consisting of a range of rows of *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@@ -744,7 +568,7 @@ /// EIGEN_DOC_BLOCK_ADDONS_INNER_PANEL_IF(row-major) ///-/// \sa block(Index,Index,NRowsType,NColsType), class Block+/// \sa class Block, block(Index,Index,Index,Index) /// template<int N> EIGEN_DEVICE_FUNC@@ -763,50 +587,31 @@   -/// \returns a block consisting of the left columns of \c *this.+/// \returns a block consisting of the left columns of *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<N>,-/// or Eigen::fix<N>(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+/// \sa class Block, block(Index,Index,Index,Index) ///-template<typename NColsType> EIGEN_DEVICE_FUNC-#ifndef EIGEN_PARSED_BY_DOXYGEN-inline typename NColsBlockXpr<internal::get_fixed_value<NColsType>::value>::Type-#else-inline typename NColsBlockXpr<...>::Type-#endif-leftCols(NColsType n)+inline ColsBlockXpr leftCols(Index n) {-  return typename NColsBlockXpr<internal::get_fixed_value<NColsType>::value>::Type-            (derived(), 0, 0, rows(), internal::get_runtime_value(n));+  return ColsBlockXpr(derived(), 0, 0, rows(), n); } -/// This is the const version of leftCols(NColsType).-template<typename NColsType>+/// This is the const version of leftCols(Index). EIGEN_DEVICE_FUNC-#ifndef EIGEN_PARSED_BY_DOXYGEN-inline const typename ConstNColsBlockXpr<internal::get_fixed_value<NColsType>::value>::Type-#else-inline const typename ConstNColsBlockXpr<...>::Type-#endif-leftCols(NColsType n) const+inline ConstColsBlockXpr leftCols(Index n) const {-  return typename ConstNColsBlockXpr<internal::get_fixed_value<NColsType>::value>::Type-            (derived(), 0, 0, rows(), internal::get_runtime_value(n));+  return ConstColsBlockXpr(derived(), 0, 0, rows(), n); } -/// \returns a block consisting of the left columns of \c *this.+/// \returns a block consisting of the left columns of *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@@ -819,7 +624,7 @@ /// EIGEN_DOC_BLOCK_ADDONS_INNER_PANEL_IF(column-major) ///-/// \sa block(Index,Index,NRowsType,NColsType), class Block+/// \sa class Block, block(Index,Index,Index,Index) /// template<int N> EIGEN_DEVICE_FUNC@@ -838,50 +643,31 @@   -/// \returns a block consisting of the right columns of \c *this.+/// \returns a block consisting of the right columns of *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<N>,-/// or Eigen::fix<N>(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+/// \sa class Block, block(Index,Index,Index,Index) ///-template<typename NColsType> EIGEN_DEVICE_FUNC-#ifndef EIGEN_PARSED_BY_DOXYGEN-inline typename NColsBlockXpr<internal::get_fixed_value<NColsType>::value>::Type-#else-inline typename NColsBlockXpr<...>::Type-#endif-rightCols(NColsType n)+inline ColsBlockXpr rightCols(Index n) {-  return typename NColsBlockXpr<internal::get_fixed_value<NColsType>::value>::Type-            (derived(), 0, cols() - internal::get_runtime_value(n), rows(), internal::get_runtime_value(n));+  return ColsBlockXpr(derived(), 0, cols() - n, rows(), n); } -/// This is the const version of rightCols(NColsType).-template<typename NColsType>+/// This is the const version of rightCols(Index). EIGEN_DEVICE_FUNC-#ifndef EIGEN_PARSED_BY_DOXYGEN-inline const typename ConstNColsBlockXpr<internal::get_fixed_value<NColsType>::value>::Type-#else-inline const typename ConstNColsBlockXpr<...>::Type-#endif-rightCols(NColsType n) const+inline ConstColsBlockXpr rightCols(Index n) const {-  return typename ConstNColsBlockXpr<internal::get_fixed_value<NColsType>::value>::Type-            (derived(), 0, cols() - internal::get_runtime_value(n), rows(), internal::get_runtime_value(n));+  return ConstColsBlockXpr(derived(), 0, cols() - n, rows(), n); } -/// \returns a block consisting of the right columns of \c *this.+/// \returns a block consisting of the right columns of *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@@ -894,7 +680,7 @@ /// EIGEN_DOC_BLOCK_ADDONS_INNER_PANEL_IF(column-major) ///-/// \sa block(Index,Index,NRowsType,NColsType), class Block+/// \sa class Block, block(Index,Index,Index,Index) /// template<int N> EIGEN_DEVICE_FUNC@@ -913,51 +699,32 @@   -/// \returns a block consisting of a range of columns of \c *this.+/// \returns a block consisting of a range of columns of *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<N>,-/// or Eigen::fix<N>(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+/// \sa class Block, block(Index,Index,Index,Index) ///-template<typename NColsType> EIGEN_DEVICE_FUNC-#ifndef EIGEN_PARSED_BY_DOXYGEN-inline typename NColsBlockXpr<internal::get_fixed_value<NColsType>::value>::Type-#else-inline typename NColsBlockXpr<...>::Type-#endif-middleCols(Index startCol, NColsType numCols)+inline ColsBlockXpr middleCols(Index startCol, Index numCols) {-  return typename NColsBlockXpr<internal::get_fixed_value<NColsType>::value>::Type-            (derived(), 0, startCol, rows(), internal::get_runtime_value(numCols));+  return ColsBlockXpr(derived(), 0, startCol, rows(), numCols); } -/// This is the const version of middleCols(Index,NColsType).-template<typename NColsType>+/// This is the const version of middleCols(Index,Index). EIGEN_DEVICE_FUNC-#ifndef EIGEN_PARSED_BY_DOXYGEN-inline const typename ConstNColsBlockXpr<internal::get_fixed_value<NColsType>::value>::Type-#else-inline const typename ConstNColsBlockXpr<...>::Type-#endif-middleCols(Index startCol, NColsType numCols) const+inline ConstColsBlockXpr middleCols(Index startCol, Index numCols) const {-  return typename ConstNColsBlockXpr<internal::get_fixed_value<NColsType>::value>::Type-            (derived(), 0, startCol, rows(), internal::get_runtime_value(numCols));+  return ConstColsBlockXpr(derived(), 0, startCol, rows(), numCols); } -/// \returns a block consisting of a range of columns of \c *this.+/// \returns a block consisting of a range of columns of *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@@ -971,7 +738,7 @@ /// EIGEN_DOC_BLOCK_ADDONS_INNER_PANEL_IF(column-major) ///-/// \sa block(Index,Index,NRowsType,NColsType), class Block+/// \sa class Block, block(Index,Index,Index,Index) /// template<int N> EIGEN_DEVICE_FUNC@@ -990,7 +757,7 @@   -/// \returns a fixed-size expression of a block of \c *this.+/// \returns a fixed-size expression of a block in *this. /// /// The template parameters \a NRows and \a NCols are the number of /// rows and columns in the block.@@ -1001,18 +768,12 @@ /// 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<NRows,NCols>(i,j)  <-->  mat.block(i,j,fix<NRows>,fix<NCols>)-/// \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+/// \sa class Block, block(Index,Index,Index,Index) /// template<int NRows, int NCols> EIGEN_DEVICE_FUNC@@ -1029,7 +790,7 @@   return typename ConstFixedBlockXpr<NRows,NCols>::Type(derived(), startRow, startCol); } -/// \returns an expression of a block of \c *this.+/// \returns an expression of a block in *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@@ -1044,21 +805,11 @@ /// \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<NRows,NCols>(i,j,rows,cols)     <-->  mat.block(i,j,fix<NRows>(rows),fix<NCols>(cols))-/// \endcode-/// If we known that, e.g., NRows==Dynamic and NCols!=Dynamic, then the equivalence becomes:-/// \code-/// mat.template block<Dynamic,NCols>(i,j,rows,NCols)  <-->  mat.block(i,j,rows,fix<NCols>)-/// \endcode+/// Output: \verbinclude MatrixBase_template_int_int_block_int_int_int_int.cpp /// EIGEN_DOC_BLOCK_ADDONS_NOT_INNER_PANEL ///-/// \sa block(Index,Index,NRowsType,NColsType), class Block+/// \sa class Block, block(Index,Index,Index,Index) /// template<int NRows, int NCols> inline typename FixedBlockXpr<NRows,NCols>::Type block(Index startRow, Index startCol,@@ -1075,7 +826,7 @@   return typename ConstFixedBlockXpr<NRows,NCols>::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.+/// \returns an expression of the \a i-th column of *this. Note that the numbering starts at 0. /// /// Example: \include MatrixBase_col.cpp /// Output: \verbinclude MatrixBase_col.out@@ -1096,7 +847,7 @@   return ConstColXpr(derived(), i); } -/// \returns an expression of the \a i-th row of \c *this. Note that the numbering starts at 0.+/// \returns an expression of the \a i-th row of *this. Note that the numbering starts at 0. /// /// Example: \include MatrixBase_row.cpp /// Output: \verbinclude MatrixBase_row.out@@ -1117,153 +868,96 @@   return ConstRowXpr(derived(), i); } -/// \returns an expression of a segment (i.e. a vector block) in \c *this with either dynamic or fixed sizes.+/// \returns a dynamic-size expression of a segment (i.e. a vector block) in *this. /// /// \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<N>,-/// or Eigen::fix<N>(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+/// \note Even though 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<N>, fix<N>(int), class Block+/// \sa class Block, segment(Index) ///-template<typename NType> EIGEN_DEVICE_FUNC-#ifndef EIGEN_PARSED_BY_DOXYGEN-inline typename FixedSegmentReturnType<internal::get_fixed_value<NType>::value>::Type-#else-inline typename FixedSegmentReturnType<...>::Type-#endif-segment(Index start, NType n)+inline SegmentReturnType segment(Index start, Index n) {   EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)-  return typename FixedSegmentReturnType<internal::get_fixed_value<NType>::value>::Type-            (derived(), start, internal::get_runtime_value(n));+  return SegmentReturnType(derived(), start, n); }  -/// This is the const version of segment(Index,NType).-template<typename NType>+/// This is the const version of segment(Index,Index). EIGEN_DEVICE_FUNC-#ifndef EIGEN_PARSED_BY_DOXYGEN-inline const typename ConstFixedSegmentReturnType<internal::get_fixed_value<NType>::value>::Type-#else-inline const typename ConstFixedSegmentReturnType<...>::Type-#endif-segment(Index start, NType n) const+inline ConstSegmentReturnType segment(Index start, Index n) const {   EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)-  return typename ConstFixedSegmentReturnType<internal::get_fixed_value<NType>::value>::Type-            (derived(), start, internal::get_runtime_value(n));+  return ConstSegmentReturnType(derived(), start, n); } -/// \returns an expression of the first coefficients of \c *this with either dynamic or fixed sizes.+/// \returns a dynamic-size expression of the first coefficients of *this. /// /// \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<N>,-/// or Eigen::fix<N>(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+/// \note Even though 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<typename NType> EIGEN_DEVICE_FUNC-#ifndef EIGEN_PARSED_BY_DOXYGEN-inline typename FixedSegmentReturnType<internal::get_fixed_value<NType>::value>::Type-#else-inline typename FixedSegmentReturnType<...>::Type-#endif-head(NType n)+inline SegmentReturnType head(Index n) {   EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)-  return typename FixedSegmentReturnType<internal::get_fixed_value<NType>::value>::Type-              (derived(), 0, internal::get_runtime_value(n));+  return SegmentReturnType(derived(), 0, n); } -/// This is the const version of head(NType).-template<typename NType>+/// This is the const version of head(Index). EIGEN_DEVICE_FUNC-#ifndef EIGEN_PARSED_BY_DOXYGEN-inline const typename ConstFixedSegmentReturnType<internal::get_fixed_value<NType>::value>::Type-#else-inline const typename ConstFixedSegmentReturnType<...>::Type-#endif-head(NType n) const+inline ConstSegmentReturnType head(Index n) const {   EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)-  return typename ConstFixedSegmentReturnType<internal::get_fixed_value<NType>::value>::Type-            (derived(), 0, internal::get_runtime_value(n));+  return ConstSegmentReturnType(derived(), 0, n); } -/// \returns an expression of a last coefficients of \c *this with either dynamic or fixed sizes.+/// \returns a dynamic-size expression of the last coefficients of *this. /// /// \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<N>,-/// or Eigen::fix<N>(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+/// \note Even though 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<typename NType> EIGEN_DEVICE_FUNC-#ifndef EIGEN_PARSED_BY_DOXYGEN-inline typename FixedSegmentReturnType<internal::get_fixed_value<NType>::value>::Type-#else-inline typename FixedSegmentReturnType<...>::Type-#endif-tail(NType n)+inline SegmentReturnType tail(Index n) {   EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)-  return typename FixedSegmentReturnType<internal::get_fixed_value<NType>::value>::Type-            (derived(), this->size() - internal::get_runtime_value(n), internal::get_runtime_value(n));+  return SegmentReturnType(derived(), this->size() - n, n); }  /// This is the const version of tail(Index).-template<typename NType> EIGEN_DEVICE_FUNC-#ifndef EIGEN_PARSED_BY_DOXYGEN-inline const typename ConstFixedSegmentReturnType<internal::get_fixed_value<NType>::value>::Type-#else-inline const typename ConstFixedSegmentReturnType<...>::Type-#endif-tail(NType n) const+inline ConstSegmentReturnType tail(Index n) const {   EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)-  return typename ConstFixedSegmentReturnType<internal::get_fixed_value<NType>::value>::Type-            (derived(), this->size() - internal::get_runtime_value(n), internal::get_runtime_value(n));+  return ConstSegmentReturnType(derived(), this->size() - n, n); }  /// \returns a fixed-size expression of a segment (i.e. a vector block) in \c *this@@ -1280,7 +974,7 @@ /// Example: \include MatrixBase_template_int_segment.cpp /// Output: \verbinclude MatrixBase_template_int_segment.out ///-/// \sa segment(Index,NType), class Block+/// \sa class Block /// template<int N> EIGEN_DEVICE_FUNC@@ -1299,7 +993,7 @@   return typename ConstFixedSegmentReturnType<N>::Type(derived(), start, n); } -/// \returns a fixed-size expression of the first coefficients of \c *this.+/// \returns a fixed-size expression of the first coefficients of *this. /// /// \only_for_vectors ///@@ -1312,7 +1006,7 @@ /// Example: \include MatrixBase_template_int_start.cpp /// Output: \verbinclude MatrixBase_template_int_start.out ///-/// \sa head(NType), class Block+/// \sa class Block /// template<int N> EIGEN_DEVICE_FUNC@@ -1331,7 +1025,7 @@   return typename ConstFixedSegmentReturnType<N>::Type(derived(), 0, n); } -/// \returns a fixed-size expression of the last coefficients of \c *this.+/// \returns a fixed-size expression of the last coefficients of *this. /// /// \only_for_vectors ///@@ -1344,7 +1038,7 @@ /// Example: \include MatrixBase_template_int_end.cpp /// Output: \verbinclude MatrixBase_template_int_end.out ///-/// \sa tail(NType), class Block+/// \sa class Block /// template<int N> EIGEN_DEVICE_FUNC@@ -1361,40 +1055,4 @@ {   EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)   return typename ConstFixedSegmentReturnType<N>::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).-///-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.-///-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).-///-InnerVectorsReturnType-innerVectors(Index outerStart, Index outerSize)-{-  return Block<Derived,Dynamic,Dynamic,true>(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.-///-const ConstInnerVectorsReturnType-innerVectors(Index outerStart, Index outerSize) const-{-  return Block<const Derived,Dynamic,Dynamic,true>(derived(),-                                                  IsRowMajor ? outerStart : 0, IsRowMajor ? 0 : outerStart,-                                                  IsRowMajor ? outerSize : rows(), IsRowMajor ? cols() : outerSize);- }
+ eigen3/INSTALL view
@@ -0,0 +1,35 @@+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.
+ eigen3/bench/BenchSparseUtil.h view
@@ -0,0 +1,149 @@++#include <Eigen/Sparse>+#include <bench/BenchTimer.h>+#include <set>++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<Scalar,Dynamic,Dynamic> DenseMatrix;+typedef Matrix<Scalar,Dynamic,1> DenseVector;+typedef SparseMatrix<Scalar> 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<float>(0,1) < density) ? internal::random<Scalar>() : 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<int> aux;+    for(int i = 0; i < nnzPerCol; i++)+    {+      int k = internal::random<int>(0,rows-1);+      while (aux.find(k)!=aux.end())+        k = internal::random<int>(0,rows-1);+      aux.insert(k);++      dst.insert(k,j) = internal::random<Scalar>();+    }+  }+  dst.finalize();+}++void eiToDense(const EigenSparseMatrix& src, DenseMatrix& dst)+{+  dst.setZero();+  for (int j=0; j<src.cols(); ++j)+    for (EigenSparseMatrix::InnerIterator it(src.derived(), j); it; ++it)+      dst(it.index(),j) = it.value();+}++#ifndef NOGMM+#include "gmm/gmm.h"+typedef gmm::csc_matrix<Scalar> GmmSparse;+typedef gmm::col_matrix< gmm::wsvector<Scalar> > GmmDynSparse;+void eiToGmm(const EigenSparseMatrix& src, GmmSparse& dst)+{+  GmmDynSparse tmp(src.rows(), src.cols());+  for (int j=0; j<src.cols(); ++j)+    for (EigenSparseMatrix::InnerIterator it(src.derived(), j); it; ++it)+      tmp(it.index(),j) = it.value();+  gmm::copy(tmp, dst);+}+#endif++#ifndef NOMTL+#include <boost/numeric/mtl/mtl.hpp>+typedef mtl::compressed2D<Scalar, mtl::matrix::parameters<mtl::tag::col_major> > MtlSparse;+typedef mtl::compressed2D<Scalar, mtl::matrix::parameters<mtl::tag::row_major> > MtlSparseRowMajor;+void eiToMtl(const EigenSparseMatrix& src, MtlSparse& dst)+{+  mtl::matrix::inserter<MtlSparse> ins(dst);+  for (int j=0; j<src.cols(); ++j)+    for (EigenSparseMatrix::InnerIterator it(src.derived(), j); it; ++it)+      ins[it.index()][j] = it.value();+}+#endif++#ifdef CSPARSE+extern "C" {+#include "cs.h"+}+void eiToCSparse(const EigenSparseMatrix& src, cs* &dst)+{+  cs* aux = cs_spalloc (0, 0, 1, 1, 1);+  for (int j=0; j<src.cols(); ++j)+    for (EigenSparseMatrix::InnerIterator it(src.derived(), j); it; ++it)+      if (!cs_entry(aux, it.index(), j, it.value()))+      {+        std::cout << "cs_entry error\n";+        exit(2);+      }+   dst = cs_compress(aux);+//    cs_spfree(aux);+}+#endif // CSPARSE++#ifndef NOUBLAS+#include <boost/numeric/ublas/vector.hpp>+#include <boost/numeric/ublas/matrix.hpp>+#include <boost/numeric/ublas/io.hpp>+#include <boost/numeric/ublas/triangular.hpp>+#include <boost/numeric/ublas/vector_sparse.hpp>+#include <boost/numeric/ublas/matrix_sparse.hpp>+#include <boost/numeric/ublas/vector_of_vector.hpp>+#include <boost/numeric/ublas/operation.hpp>++typedef boost::numeric::ublas::compressed_matrix<Scalar,boost::numeric::ublas::column_major> UBlasSparse;++void eiToUblas(const EigenSparseMatrix& src, UBlasSparse& dst)+{+  dst.resize(src.rows(), src.cols(), false);+  for (int j=0; j<src.cols(); ++j)+    for (EigenSparseMatrix::InnerIterator it(src.derived(), j); it; ++it)+      dst(it.index(),j) = it.value();+}++template <typename EigenType, typename UblasType>+void eiToUblasVec(const EigenType& src, UblasType& dst)+{+  dst.resize(src.size());+  for (int j=0; j<src.size(); ++j)+      dst[j] = src.coeff(j);+}+#endif++#ifdef OSKI+extern "C" {+#include <oski/oski.h>+}+#endif
+ eigen3/bench/BenchTimer.h view
@@ -0,0 +1,195 @@+// This file is part of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2008-2010 Gael Guennebaud <gael.guennebaud@inria.fr>+// Copyright (C) 2009 Benoit Jacob <jacob.benoit.1@gmail.com>+//+// 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 <windows.h>+#elif defined(__APPLE__)+#include <mach/mach_time.h>+#else+# include <unistd.h>+#endif++static void escape(void *p) {+  asm volatile("" : : "g"(p) : "memory");+}++static void clobber() {+  asm volatile("" : : : "memory");+}++#include <Eigen/Core>++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<TRIES; ++uglyvarname1){ \+      TIMER.start(); \+      for(int uglyvarname2=0; uglyvarname2<REP; ++uglyvarname2){ \+        CODE; \+      } \+      TIMER.stop(); \+      clobber(); \+    } \+  }++}++// clean #defined tokens+#ifdef EIGEN_BT_UNDEF_NOMINMAX+# undef EIGEN_BT_UNDEF_NOMINMAX+# undef NOMINMAX+#endif++#ifdef EIGEN_BT_UNDEF_WIN32_LEAN_AND_MEAN+# undef EIGEN_BT_UNDEF_WIN32_LEAN_AND_MEAN+# undef WIN32_LEAN_AND_MEAN+#endif++#endif // EIGEN_BENCH_TIMERR_H
+ eigen3/bench/BenchUtil.h view
@@ -0,0 +1,92 @@++#ifndef EIGEN_BENCH_UTIL_H+#define EIGEN_BENCH_UTIL_H++#include <Eigen/Core>+#include "BenchTimer.h"++using namespace std;+using namespace Eigen;++#include <boost/preprocessor/repetition/enum_params.hpp>+#include <boost/preprocessor/repetition.hpp>+#include <boost/preprocessor/seq.hpp>+#include <boost/preprocessor/array.hpp>+#include <boost/preprocessor/arithmetic.hpp>+#include <boost/preprocessor/comparison.hpp>+#include <boost/preprocessor/punctuation.hpp>+#include <boost/preprocessor/punctuation/comma.hpp>+#include <boost/preprocessor/stringize.hpp>++template<typename MatrixType> void initMatrix_random(MatrixType& mat) __attribute__((noinline));+template<typename MatrixType> void initMatrix_random(MatrixType& mat)+{+  mat.setRandom();// = MatrixType::random(mat.rows(), mat.cols());+}++template<typename MatrixType> void initMatrix_identity(MatrixType& mat) __attribute__((noinline));+template<typename MatrixType> 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 <gmm/gmm.h>+template <typename EigenMatrixType, typename GmmMatrixType>+void eiToGmm(const EigenMatrixType& src, GmmMatrixType& dst)+{+  dst.resize(src.rows(),src.cols());+  for (int j=0; j<src.cols(); ++j)+    for (int i=0; i<src.rows(); ++i)+      dst(i,j) = src.coeff(i,j);+}+#endif+++#ifdef BENCH_GSL+#include <gsl/gsl_matrix.h>+#include <gsl/gsl_linalg.h>+#include <gsl/gsl_eigen.h>+template <typename EigenMatrixType>+void eiToGsl(const EigenMatrixType& src, gsl_matrix** dst)+{+  for (int j=0; j<src.cols(); ++j)+    for (int i=0; i<src.rows(); ++i)+      gsl_matrix_set(*dst, i, j, src.coeff(i,j));+}+#endif++#ifdef BENCH_UBLAS+#include <boost/numeric/ublas/matrix.hpp>+#include <boost/numeric/ublas/vector.hpp>+template <typename EigenMatrixType, typename UblasMatrixType>+void eiToUblas(const EigenMatrixType& src, UblasMatrixType& dst)+{+  dst.resize(src.rows(),src.cols());+  for (int j=0; j<src.cols(); ++j)+    for (int i=0; i<src.rows(); ++i)+      dst(i,j) = src.coeff(i,j);+}+template <typename EigenType, typename UblasType>+void eiToUblasVec(const EigenType& src, UblasType& dst)+{+  dst.resize(src.size());+  for (int j=0; j<src.size(); ++j)+      dst[j] = src.coeff(j);+}+#endif++#endif // EIGEN_BENCH_UTIL_H
+ eigen3/bench/README.txt view
@@ -0,0 +1,55 @@++This folder contains a couple of benchmark utities and Eigen benchmarks.++****************************+* bench_multi_compilers.sh *+****************************++This script allows to run a benchmark on a set of different compilers/compiler options.+It takes two arguments:+ - a file defining the list of the compilers with their options+ - the .cpp file of the benchmark++Examples:++$ ./bench_multi_compilers.sh basicbench.cxxlist basicbenchmark.cpp++    g++-4.1 -O3 -DNDEBUG -finline-limit=10000+    3d-3x3   /   4d-4x4   /   Xd-4x4   /   Xd-20x20   /+    0.271102   0.131416   0.422322   0.198633+    0.201658   0.102436   0.397566   0.207282++    g++-4.2 -O3 -DNDEBUG -finline-limit=10000+    3d-3x3   /   4d-4x4   /   Xd-4x4   /   Xd-20x20   /+    0.107805   0.0890579   0.30265   0.161843+    0.127157   0.0712581   0.278341   0.191029++    g++-4.3 -O3 -DNDEBUG -finline-limit=10000+    3d-3x3   /   4d-4x4   /   Xd-4x4   /   Xd-20x20   /+    0.134318   0.105291   0.3704   0.180966+    0.137703   0.0732472   0.31225   0.202204++    icpc -fast -DNDEBUG -fno-exceptions -no-inline-max-size+    3d-3x3   /   4d-4x4   /   Xd-4x4   /   Xd-20x20   /+    0.226145   0.0941319   0.371873   0.159433+    0.109302   0.0837538   0.328102   0.173891+++$ ./bench_multi_compilers.sh ompbench.cxxlist ompbenchmark.cpp++    g++-4.2 -O3 -DNDEBUG -finline-limit=10000 -fopenmp+    double, fixed-size 4x4: 0.00165105s  0.0778739s+    double, 32x32: 0.0654769s 0.075289s  => 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)+++
+ eigen3/bench/analyze-blocking-sizes.cpp view
@@ -0,0 +1,876 @@+// This file is part of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2015 Benoit Jacob <benoitjacob@google.com>+//+// 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 <iostream>+#include <cstdint>+#include <cstdlib>+#include <vector>+#include <algorithm>+#include <fstream>+#include <string>+#include <cmath>+#include <cassert>+#include <cstring>+#include <memory>++#include <Eigen/Core>++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<inputfile_entry_t> 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<preprocessed_inputfile_entry_t> 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<inputfile_entry_t>::const_iterator& begin,+    const vector<inputfile_entry_t>::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_inputfile_t>& 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_inputfile_t>& preprocessed_inputfiles,+        const vector<size_t>& 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_inputfile_t>& preprocessed_inputfiles,+        const vector<size_t>& 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_inputfile_t>& preprocessed_inputfiles,+        const vector<vector<size_t>>& 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<size_t>& 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<size_t>& subset, size_t set_size)+{+  return subset[0] == set_size - subset.size();+}++void next_subset(vector<size_t>& 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<size_t>(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_inputfile_t>& preprocessed_inputfiles,+       float required_efficiency_to_beat,+       vector<size_t>& inout_remainder,+       vector<size_t>& 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<size_t> 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<size_t> candidate_indices_subset;+      make_first_subset(candidate_indices_subset_size,+                        candidate_indices_subset,+                        candidate_indices.size());++      vector<size_t> best_candidate_indices_subset;+      float best_efficiency = 0.0f;+      vector<size_t> 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<size_t> 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_inputfile_t>& preprocessed_inputfiles,+       float required_efficiency_to_beat,+       vector<vector<size_t>>& out_partition)+{+  out_partition.resize(0);++  vector<size_t> remainder;+  for (size_t i = 0; i < preprocessed_inputfiles.size(); i++) {+    remainder.push_back(i);+  }++  while (!remainder.empty()) {+    vector<size_t> 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_inputfile_t>& preprocessed_inputfiles,+       const vector<vector<size_t>>& 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<string>&) 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<string>& input_filenames) const override+  {+    vector<preprocessed_inputfile_t> 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<vector<vector<size_t>>> partitions;+    cerr << "searching for partitions...\r" << flush;+    while (true)+    {+      vector<vector<size_t>> 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<string>& 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_entry_t> results;+    vector<results_entry_t> 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<size_t>(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<float> 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<unique_ptr<action_t>>& available_actions)+{+  cerr << "usage: " << argv[0] << " <action> [options...] <input files...>" << 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<unique_ptr<action_t>> available_actions;+  available_actions.emplace_back(new partition_action_t);+  available_actions.emplace_back(new evaluate_defaults_action_t);++  vector<string> 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 invokation 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);+}
+ eigen3/bench/basicbench.cxxlist view
@@ -0,0 +1,28 @@+#!/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"
+ eigen3/bench/basicbenchmark.cpp view
@@ -0,0 +1,35 @@++#include <iostream>+#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<LazyEval>, MODES );+  std::cout << endl;+  BOOST_PP_SEQ_FOR_EACH(_RUN_BENCH, benchBasic<EarlyEval>, MODES );+  std::cout << endl;++  return 0;+}
+ eigen3/bench/basicbenchmark.h view
@@ -0,0 +1,63 @@++#ifndef EIGEN_BENCH_BASICBENCH_H+#define EIGEN_BENCH_BASICBENCH_H++enum {LazyEval, EarlyEval, OmpEval};++template<int Mode, typename MatrixType>+void benchBasic_loop(const MatrixType& I, MatrixType& m, int iterations) __attribute__((noinline));++template<int Mode, typename MatrixType>+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.lazy() * m)).eval();+    }+    else if (Mode==OmpEval)+    {+      asm("#begin_bench_loop OmpEval");+      if (MatrixType::SizeAtCompileTime!=Eigen::Dynamic) asm("#fixedsize");+      m = (I + 0.00005 * (m + m.lazy() * m)).evalOMP();+    }+    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<int Mode, typename MatrixType>+double benchBasic(const MatrixType& mat, int size, int tries) __attribute__((noinline));++template<int Mode, typename MatrixType>+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<tries; ++t)+  {+    initMatrix_random(m);+    timer.start();+    benchBasic_loop<Mode>(I, m, iterations);+    timer.stop();+    cerr << m;+  }+  return timer.value();+};++#endif // EIGEN_BENCH_BASICBENCH_H
+ eigen3/bench/benchBlasGemm.cpp view
@@ -0,0 +1,219 @@+// 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 <iostream>++#include <Eigen/Core>+#include "BenchTimer.h"++// include the BLAS headers+extern "C" {+#include <cblas.h>+}+#include <string>++#ifdef _FLOAT+typedef float Scalar;+#define CBLAS_GEMM cblas_sgemm+#else+typedef double Scalar;+#define CBLAS_GEMM cblas_dgemm+#endif+++typedef Eigen::Matrix<Scalar,Eigen::Dynamic,Eigen::Dynamic> 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<nbtries ; ++k)+    {+        timer.start();+        for (uint j=0 ; j<nbloops ; ++j)+              #ifdef EIGEN_DEFAULT_TO_ROW_MAJOR+              CBLAS_GEMM(CblasRowMajor, CblasNoTrans, CblasNoTrans, M, N, K, alpha, ma.data(), K, mb.data(), N, beta, mc.data(), N);+              #else+              CBLAS_GEMM(CblasColMajor, CblasNoTrans, CblasNoTrans, M, N, K, alpha, ma.data(), M, mb.data(), K, beta, mc.data(), M);+              #endif+        timer.stop();+    }+    if (!(std::string(argv[1])=="auto"))+      std::cout << "cblas: " << timer.value() << " (" << 1e-3*floor(1e-6*nbmad/timer.value()) << " GFlops/s)\n";+    else+        std::cout << M << " : " << timer.value() << " ; " << 1e-3*floor(1e-6*nbmad/timer.value()) << "\n";+  }++  // clear+  ma = MyMatrix::Random(M,K);+  mb = MyMatrix::Random(K,N);+  mc = MyMatrix::Random(M,N);++  // eigen+//   if (!(std::string(argv[1])=="auto"))+  {+      timer.reset();+      for (uint k=0 ; k<nbtries ; ++k)+      {+          timer.start();+          bench_eigengemm(mc, ma, mb, nbloops);+          timer.stop();+      }+      if (!(std::string(argv[1])=="auto"))+        std::cout << "eigen : " << timer.value() << " (" << 1e-3*floor(1e-6*nbmad/timer.value()) << " GFlops/s)\n";+      else+        std::cout << M << " : " << timer.value() << " ; " << 1e-3*floor(1e-6*nbmad/timer.value()) << "\n";+  }++  std::cout << "l1: " << Eigen::l1CacheSize() << std::endl;+  std::cout << "l2: " << Eigen::l2CacheSize() << std::endl;+  ++  return 0;+}++using namespace Eigen;++void bench_eigengemm(MyMatrix& mc, const MyMatrix& ma, const MyMatrix& mb, int nbloops)+{+  for (uint j=0 ; j<nbloops ; ++j)+      mc.noalias() += ma * mb;+}++#define MYVERIFY(A,M) if (!(A)) { \+    std::cout << "FAIL: " << M << "\n"; \+  }+void check_product(int M, int N, int K)+{+  MyMatrix ma(M,K), mb(K,N), mc(M,N), maT(K,M), mbT(N,K), meigen(M,N), mref(M,N);+  ma = MyMatrix::Random(M,K);+  mb = MyMatrix::Random(K,N);+  maT = ma.transpose();+  mbT = mb.transpose();+  mc = MyMatrix::Random(M,N);++  MyMatrix::Scalar eps = 1e-4;++  meigen = mref = mc;+  CBLAS_GEMM(CblasColMajor, CblasNoTrans, CblasNoTrans, M, N, K, 1, ma.data(), M, mb.data(), K, 1, mref.data(), M);+  meigen += ma * mb;+  MYVERIFY(meigen.isApprox(mref, eps),". * .");++  meigen = mref = mc;+  CBLAS_GEMM(CblasColMajor, CblasTrans, CblasNoTrans, M, N, K, 1, maT.data(), K, mb.data(), K, 1, mref.data(), M);+  meigen += maT.transpose() * mb;+  MYVERIFY(meigen.isApprox(mref, eps),"T * .");++  meigen = mref = mc;+  CBLAS_GEMM(CblasColMajor, CblasTrans, CblasTrans, M, N, K, 1, maT.data(), K, mbT.data(), N, 1, mref.data(), M);+  meigen += (maT.transpose()) * (mbT.transpose());+  MYVERIFY(meigen.isApprox(mref, eps),"T * T");++  meigen = mref = mc;+  CBLAS_GEMM(CblasColMajor, CblasNoTrans, CblasTrans, M, N, K, 1, ma.data(), M, mbT.data(), N, 1, mref.data(), M);+  meigen += ma * mbT.transpose();+  MYVERIFY(meigen.isApprox(mref, eps),". * T");+}++void check_product(void)+{+  int M, N, K;+  for (uint i=0; i<1000; ++i)+  {+    M = internal::random<int>(1,64);+    N = internal::random<int>(1,768);+    K = internal::random<int>(1,768);+    M = (0 + M) * 1;+    std::cout << M << " x " << N << " x " << K << "\n";+    check_product(M, N, K);+  }+}+
+ eigen3/bench/benchCholesky.cpp view
@@ -0,0 +1,142 @@++// g++ -DNDEBUG -O3 -I.. benchLLT.cpp  -o benchLLT && ./benchLLT+// options:+//  -DBENCH_GSL -lgsl /usr/lib/libcblas.so.3+//  -DEIGEN_DONT_VECTORIZE+//  -msse2+//  -DREPEAT=100+//  -DTRIES=10+//  -DSCALAR=double++#include <iostream>++#include <Eigen/Core>+#include <Eigen/Cholesky>+#include <bench/BenchUtil.h>+using namespace Eigen;++#ifndef REPEAT+#define REPEAT 10000+#endif++#ifndef TRIES+#define TRIES 10+#endif++typedef float Scalar;++template <typename MatrixType>+__attribute__ ((noinline)) void benchLLT(const MatrixType& m)+{+  int rows = m.rows();+  int cols = m.cols();++  double cost = 0;+  for (int j=0; j<rows; ++j)+  {+    int r = std::max(rows - j -1,0);+    cost += 2*(r*j+r+j);+  }++  int repeats = (REPEAT*1000)/(rows*rows);++  typedef typename MatrixType::Scalar Scalar;+  typedef Matrix<Scalar, MatrixType::RowsAtCompileTime, MatrixType::RowsAtCompileTime> SquareMatrixType;++  MatrixType a = MatrixType::Random(rows,cols);+  SquareMatrixType covMat =  a * a.adjoint();++  BenchTimer timerNoSqrt, timerSqrt;++  Scalar acc = 0;+  int r = internal::random<int>(0,covMat.rows()-1);+  int c = internal::random<int>(0,covMat.cols()-1);+  for (int t=0; t<TRIES; ++t)+  {+    timerNoSqrt.start();+    for (int k=0; k<repeats; ++k)+    {+      LDLT<SquareMatrixType> cholnosqrt(covMat);+      acc += cholnosqrt.matrixL().coeff(r,c);+    }+    timerNoSqrt.stop();+  }++  for (int t=0; t<TRIES; ++t)+  {+    timerSqrt.start();+    for (int k=0; k<repeats; ++k)+    {+      LLT<SquareMatrixType> 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; t<TRIES; ++t)+    {+      timerSqrt.start();+      for (int k=0; k<repeats; ++k)+      {+        gsl_matrix_memcpy(gslCopy,gslCovMat);+        gsl_linalg_cholesky_decomp(gslCopy);+        acc += gsl_matrix_get(gslCopy,r,c);+      }+      timerSqrt.stop();+    }++    std::cout << " | \t"+              << timerSqrt.value() * REPEAT / repeats << "s";++    gsl_matrix_free(gslCovMat);+  }+  #endif+  std::cout << "\n";+  // make sure the compiler does not optimize too much+  if (acc==123)+    std::cout << acc;+}++int main(int argc, char* argv[])+{+  const int dynsizes[] = {4,6,8,16,24,32,49,64,128,256,512,900,1500,0};+  std::cout << "size            LDLT                            LLT";+//   #ifdef BENCH_GSL+//   std::cout << "       GSL (standard + double + ATLAS)  ";+//   #endif+  std::cout << "\n";+  for (int i=0; dynsizes[i]>0; ++i)+    benchLLT(Matrix<Scalar,Dynamic,Dynamic>(dynsizes[i],dynsizes[i]));++  benchLLT(Matrix<Scalar,2,2>());+  benchLLT(Matrix<Scalar,3,3>());+  benchLLT(Matrix<Scalar,4,4>());+  benchLLT(Matrix<Scalar,5,5>());+  benchLLT(Matrix<Scalar,6,6>());+  benchLLT(Matrix<Scalar,7,7>());+  benchLLT(Matrix<Scalar,8,8>());+  benchLLT(Matrix<Scalar,12,12>());+  benchLLT(Matrix<Scalar,16,16>());+  return 0;+}+
+ eigen3/bench/benchEigenSolver.cpp view
@@ -0,0 +1,212 @@++// 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 <iostream>++#include <Eigen/Core>+#include <Eigen/QR>+#include <bench/BenchUtil.h>+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 <typename MatrixType>+__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<Scalar, MatrixType::RowsAtCompileTime, MatrixType::RowsAtCompileTime> SquareMatrixType;++  MatrixType a = MatrixType::Random(rows,cols);+  SquareMatrixType covMat =  a * a.adjoint();++  BenchTimer timerSa, timerStd;++  Scalar acc = 0;+  int r = internal::random<int>(0,covMat.rows()-1);+  int c = internal::random<int>(0,covMat.cols()-1);+  {+    SelfAdjointEigenSolver<SquareMatrixType> ei(covMat);+    for (int t=0; t<TRIES; ++t)+    {+      timerSa.start();+      for (int k=0; k<saRepeats; ++k)+      {+        ei.compute(covMat);+        acc += ei.eigenvectors().coeff(r,c);+      }+      timerSa.stop();+    }+  }++  {+    EigenSolver<SquareMatrixType> ei(covMat);+    for (int t=0; t<TRIES; ++t)+    {+      timerStd.start();+      for (int k=0; k<stdRepeats; ++k)+      {+        ei.compute(covMat);+        acc += ei.eigenvectors().coeff(r,c);+      }+      timerStd.stop();+    }+  }++  if (MatrixType::RowsAtCompileTime==Dynamic)+    std::cout << "dyn   ";+  else+    std::cout << "fixed ";+  std::cout << covMat.rows() << " \t"+            << timerSa.value() * REPEAT / saRepeats << "s \t"+            << timerStd.value() * REPEAT / stdRepeats << "s";++  #ifdef BENCH_GMM+  if (MatrixType::RowsAtCompileTime==Dynamic)+  {+    timerSa.reset();+    timerStd.reset();++    gmm::dense_matrix<Scalar> gmmCovMat(covMat.rows(),covMat.cols());+    gmm::dense_matrix<Scalar> eigvect(covMat.rows(),covMat.cols());+    std::vector<Scalar> eigval(covMat.rows());+    eiToGmm(covMat, gmmCovMat);+    for (int t=0; t<TRIES; ++t)+    {+      timerSa.start();+      for (int k=0; k<saRepeats; ++k)+      {+        gmm::symmetric_qr_algorithm(gmmCovMat, eigval, eigvect);+        acc += eigvect(r,c);+      }+      timerSa.stop();+    }+    // the non-selfadjoint solver does not compute the eigen vectors+//     for (int t=0; t<TRIES; ++t)+//     {+//       timerStd.start();+//       for (int k=0; k<stdRepeats; ++k)+//       {+//         gmm::implicit_qr_algorithm(gmmCovMat, eigval, eigvect);+//         acc += eigvect(r,c);+//       }+//       timerStd.stop();+//     }++    std::cout << " | \t"+              << timerSa.value() * REPEAT / saRepeats << "s"+              << /*timerStd.value() * REPEAT / stdRepeats << "s"*/ "   na   ";+  }+  #endif++  #ifdef BENCH_GSL+  if (MatrixType::RowsAtCompileTime==Dynamic)+  {+    timerSa.reset();+    timerStd.reset();++    gsl_matrix* gslCovMat = gsl_matrix_alloc(covMat.rows(),covMat.cols());+    gsl_matrix* gslCopy = gsl_matrix_alloc(covMat.rows(),covMat.cols());+    gsl_matrix* eigvect = gsl_matrix_alloc(covMat.rows(),covMat.cols());+    gsl_vector* eigval  = gsl_vector_alloc(covMat.rows());+    gsl_eigen_symmv_workspace* eisymm = gsl_eigen_symmv_alloc(covMat.rows());+    +    gsl_matrix_complex* eigvectz = gsl_matrix_complex_alloc(covMat.rows(),covMat.cols());+    gsl_vector_complex* eigvalz  = gsl_vector_complex_alloc(covMat.rows());+    gsl_eigen_nonsymmv_workspace* einonsymm = gsl_eigen_nonsymmv_alloc(covMat.rows());+    +    eiToGsl(covMat, &gslCovMat);+    for (int t=0; t<TRIES; ++t)+    {+      timerSa.start();+      for (int k=0; k<saRepeats; ++k)+      {+        gsl_matrix_memcpy(gslCopy,gslCovMat);+        gsl_eigen_symmv(gslCopy, eigval, eigvect, eisymm);+        acc += gsl_matrix_get(eigvect,r,c);+      }+      timerSa.stop();+    }+    for (int t=0; t<TRIES; ++t)+    {+      timerStd.start();+      for (int k=0; k<stdRepeats; ++k)+      {+        gsl_matrix_memcpy(gslCopy,gslCovMat);+        gsl_eigen_nonsymmv(gslCopy, eigvalz, eigvectz, einonsymm);+        acc += GSL_REAL(gsl_matrix_complex_get(eigvectz,r,c));+      }+      timerStd.stop();+    }++    std::cout << " | \t"+              << timerSa.value() * REPEAT / saRepeats << "s \t"+              << timerStd.value() * REPEAT / stdRepeats << "s";++    gsl_matrix_free(gslCovMat);+    gsl_vector_free(gslCopy);+    gsl_matrix_free(eigvect);+    gsl_vector_free(eigval);+    gsl_matrix_complex_free(eigvectz);+    gsl_vector_complex_free(eigvalz);+    gsl_eigen_symmv_free(eisymm);+    gsl_eigen_nonsymmv_free(einonsymm);+  }+  #endif++  std::cout << "\n";+  +  // make sure the compiler does not optimize too much+  if (acc==123)+    std::cout << acc;+}++int main(int argc, char* argv[])+{+  const int dynsizes[] = {4,6,8,12,16,24,32,64,128,256,512,0};+  std::cout << "size            selfadjoint       generic";+  #ifdef BENCH_GMM+  std::cout << "        GMM++          ";+  #endif+  #ifdef BENCH_GSL+  std::cout << "       GSL (double + ATLAS)  ";+  #endif+  std::cout << "\n";+  for (uint i=0; dynsizes[i]>0; ++i)+    benchEigenSolver(Matrix<Scalar,Dynamic,Dynamic>(dynsizes[i],dynsizes[i]));++  benchEigenSolver(Matrix<Scalar,2,2>());+  benchEigenSolver(Matrix<Scalar,3,3>());+  benchEigenSolver(Matrix<Scalar,4,4>());+  benchEigenSolver(Matrix<Scalar,6,6>());+  benchEigenSolver(Matrix<Scalar,8,8>());+  benchEigenSolver(Matrix<Scalar,12,12>());+  benchEigenSolver(Matrix<Scalar,16,16>());+  return 0;+}+
+ eigen3/bench/benchFFT.cpp view
@@ -0,0 +1,115 @@+// 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 <iostream>++#include <bench/BenchUtil.h>+#include <complex>+#include <vector>+#include <Eigen/Core>++#include <unsupported/Eigen/FFT>++using namespace Eigen;+using namespace std;+++template <typename T>+string nameof();++template <> string nameof<float>() {return "float";}+template <> string nameof<double>() {return "double";}+template <> string nameof<long double>() {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 <typename T>+void bench(int nfft,bool fwd,bool unscaled=false, bool halfspec=false)+{+    typedef typename NumTraits<T>::Real Scalar;+    typedef typename std::complex<Scalar> Complex;+    int nits = NDATA/nfft;+    vector<T> inbuf(nfft);+    vector<Complex > 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<Scalar>() << " ";+    double mflops = 5.*nfft*log2((double)nfft) / (1e6 * timer.value() / (double)nits );+    if ( NumTraits<T>::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<complex<float> >(NFFT,true);+    bench<complex<float> >(NFFT,false);+    bench<float>(NFFT,true);+    bench<float>(NFFT,false);+    bench<float>(NFFT,false,true);+    bench<float>(NFFT,false,true,true);++    bench<complex<double> >(NFFT,true);+    bench<complex<double> >(NFFT,false);+    bench<double>(NFFT,true);+    bench<double>(NFFT,false);+    bench<complex<long double> >(NFFT,true);+    bench<complex<long double> >(NFFT,false);+    bench<long double>(NFFT,true);+    bench<long double>(NFFT,false);+    return 0;+}
+ eigen3/bench/benchGeometry.cpp view
@@ -0,0 +1,134 @@+#include <iostream>+#include <iomanip>+#include <Eigen/Core>+#include <Eigen/Geometry>+#include <bench/BenchTimer.h>++using namespace Eigen;+using namespace std;++#ifndef REPEAT+#define REPEAT 1000000+#endif++enum func_opt+{+    TV,+    TMATV,+    TMATVMAT,+};+++template <class res, class arg1, class arg2, int opt>+struct func;++template <class res, class arg1, class arg2>+struct func<res, arg1, arg2, TV>+{+    static EIGEN_DONT_INLINE res run( arg1& a1, arg2& a2 )+    {+	asm ("");+	return a1 * a2;+    }+};++template <class res, class arg1, class arg2>+struct func<res, arg1, arg2, TMATV>+{+    static EIGEN_DONT_INLINE res run( arg1& a1, arg2& a2 )+    {+	asm ("");+	return a1.matrix() * a2;+    }+};++template <class res, class arg1, class arg2>+struct func<res, arg1, arg2, TMATVMAT>+{+    static EIGEN_DONT_INLINE res run( arg1& a1, arg2& a2 )+    {+	asm ("");+	return res(a1.matrix() * a2.matrix());+    }+};++template <class func, class arg1, class arg2>+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<REPEAT; ++k)+		a2 = func::run( a1, a2 );+	    timer.stop();+	}+	cout << setprecision(4) << fixed << timer.value() << "s  " << endl;;+    }+};+++#define run_vec( op, scalar, mode, option, vsize ) \+    std::cout << #scalar << "\t " << #mode << "\t " << #option << " " << #vsize " "; \+    {\+	typedef Transform<scalar, 3, mode, option> Trans;\+	typedef Matrix<scalar, vsize, 1, option> Vec;\+	typedef func<Vec,Trans,Vec,op> Func;\+	test_transform< Func, Trans, Vec >::run();\+    }++#define run_trans( op, scalar, mode, option ) \+    std::cout << #scalar << "\t " << #mode << "\t " << #option << "   "; \+    {\+	typedef Transform<scalar, 3, mode, option> Trans;\+	typedef func<Trans,Trans,Trans,op> 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);+}+
+ eigen3/bench/benchVecAdd.cpp view
@@ -0,0 +1,135 @@++#include <iostream>+#include <Eigen/Core>+#include <bench/BenchTimer.h>+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<Scalar>(size2);+    Scalar* b = internal::aligned_new<Scalar>(size2+4)+1;+    Scalar* c = internal::aligned_new<Scalar>(size2); +    +    for (int i=0; i<size; ++i)+    {+        a[i] = b[i] = c[i] = 0;+    }+    +    BenchTimer timer;+    +    timer.reset();+    for (int k=0; k<10; ++k)+    {+        timer.start();+        benchVec(a, b, c, size2);+        timer.stop();+    }+    std::cout << timer.value() << "s  " << (double(size2*REPEAT)/timer.value())/(1024.*1024.*1024.) << " GFlops\n";+    return 0;+    for (int innersize = size; innersize>2 ; --innersize)+    {+        if (size2%innersize==0)+        {+            int outersize = size2/innersize;+            MatrixXf ma = Map<MatrixXf>(a, innersize, outersize );+            MatrixXf mb = Map<MatrixXf>(b, innersize, outersize );+            MatrixXf mc = Map<MatrixXf>(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<VectorXf>(a, size2);+    VectorXf vb = Map<VectorXf>(b, size2);+    VectorXf vc = Map<VectorXf>(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<REPEAT; ++k)+        a = a + b;+}++void benchVec(VectorXf& a, VectorXf& b, VectorXf& c)+{+    for (int k=0; k<REPEAT; ++k)+        a = a + b;+}++void benchVec(Scalar* a, Scalar* b, Scalar* c, int size)+{+    typedef internal::packet_traits<Scalar>::type PacketScalar;+    const int PacketSize = internal::packet_traits<Scalar>::size;+    PacketScalar a0, a1, a2, a3, b0, b1, b2, b3;+    for (int k=0; k<REPEAT; ++k)+        for (int i=0; i<size; i+=PacketSize*8)+        {+//             a0 = internal::pload(&a[i]);+//             b0 = internal::pload(&b[i]);+//             a1 = internal::pload(&a[i+1*PacketSize]);+//             b1 = internal::pload(&b[i+1*PacketSize]);+//             a2 = internal::pload(&a[i+2*PacketSize]);+//             b2 = internal::pload(&b[i+2*PacketSize]);+//             a3 = internal::pload(&a[i+3*PacketSize]);+//             b3 = internal::pload(&b[i+3*PacketSize]);+//             internal::pstore(&a[i], internal::padd(a0, b0));+//             a0 = internal::pload(&a[i+4*PacketSize]);+//             b0 = internal::pload(&b[i+4*PacketSize]);+//             +//             internal::pstore(&a[i+1*PacketSize], internal::padd(a1, b1));+//             a1 = internal::pload(&a[i+5*PacketSize]);+//             b1 = internal::pload(&b[i+5*PacketSize]);+//             +//             internal::pstore(&a[i+2*PacketSize], internal::padd(a2, b2));+//             a2 = internal::pload(&a[i+6*PacketSize]);+//             b2 = internal::pload(&b[i+6*PacketSize]);+//             +//             internal::pstore(&a[i+3*PacketSize], internal::padd(a3, b3));+//             a3 = internal::pload(&a[i+7*PacketSize]);+//             b3 = internal::pload(&b[i+7*PacketSize]);+//             +//             internal::pstore(&a[i+4*PacketSize], internal::padd(a0, b0));+//             internal::pstore(&a[i+5*PacketSize], internal::padd(a1, b1));+//             internal::pstore(&a[i+6*PacketSize], internal::padd(a2, b2));+//             internal::pstore(&a[i+7*PacketSize], internal::padd(a3, b3));+            +            internal::pstore(&a[i+2*PacketSize], internal::padd(internal::ploadu(&a[i+2*PacketSize]), internal::ploadu(&b[i+2*PacketSize])));+            internal::pstore(&a[i+3*PacketSize], internal::padd(internal::ploadu(&a[i+3*PacketSize]), internal::ploadu(&b[i+3*PacketSize])));+            internal::pstore(&a[i+4*PacketSize], internal::padd(internal::ploadu(&a[i+4*PacketSize]), internal::ploadu(&b[i+4*PacketSize])));+            internal::pstore(&a[i+5*PacketSize], internal::padd(internal::ploadu(&a[i+5*PacketSize]), internal::ploadu(&b[i+5*PacketSize])));+            internal::pstore(&a[i+6*PacketSize], internal::padd(internal::ploadu(&a[i+6*PacketSize]), internal::ploadu(&b[i+6*PacketSize])));+            internal::pstore(&a[i+7*PacketSize], internal::padd(internal::ploadu(&a[i+7*PacketSize]), internal::ploadu(&b[i+7*PacketSize])));+        }+}
+ eigen3/bench/bench_gemm.cpp view
@@ -0,0 +1,340 @@++// g++-4.4 bench_gemm.cpp -I .. -O2 -DNDEBUG -lrt -fopenmp && OMP_NUM_THREADS=2  ./a.out+// icpc bench_gemm.cpp -I .. -O3 -DNDEBUG -lrt -openmp  && OMP_NUM_THREADS=2  ./a.out++// Compilation options:+// +// -DSCALAR=std::complex<double>+// -DSCALARA=double or -DSCALARB=double+// -DHAVE_BLAS+// -DDECOUPLED+//++#include <iostream>+#include <Eigen/Core>+#include <bench/BenchTimer.h>++using namespace std;+using namespace Eigen;++#ifndef SCALAR+// #define SCALAR std::complex<float>+#define SCALAR float+#endif++#ifndef SCALARA+#define SCALARA SCALAR+#endif++#ifndef SCALARB+#define SCALARB SCALAR+#endif++typedef SCALAR Scalar;+typedef NumTraits<Scalar>::Real RealScalar;+typedef Matrix<SCALARA,Dynamic,Dynamic> A;+typedef Matrix<SCALARB,Dynamic,Dynamic> B;+typedef Matrix<Scalar,Dynamic,Dynamic> C;+typedef Matrix<RealScalar,Dynamic,Dynamic> M;++#ifdef HAVE_BLAS++extern "C" {+  #include <Eigen/src/misc/blas.h>+}++static float fone = 1;+static float fzero = 0;+static double done = 1;+static double szero = 0;+static std::complex<float> cfone = 1;+static std::complex<float> cfzero = 0;+static std::complex<double> cdone = 1;+static std::complex<double> 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;++void blas_gemm(const MatrixXf& a, const MatrixXf& b, MatrixXf& c)+{+  int M = c.rows(); int N = c.cols(); int K = a.cols();+  int lda = a.rows(); int ldb = b.rows(); int ldc = c.rows();++  sgemm_(&notrans,&notrans,&M,&N,&K,&fone,+         const_cast<float*>(a.data()),&lda,+         const_cast<float*>(b.data()),&ldb,&fone,+         c.data(),&ldc);+}++EIGEN_DONT_INLINE void blas_gemm(const MatrixXd& a, const MatrixXd& b, MatrixXd& c)+{+  int M = c.rows(); int N = c.cols(); int K = a.cols();+  int lda = a.rows(); int ldb = b.rows(); int ldc = c.rows();++  dgemm_(&notrans,&notrans,&M,&N,&K,&done,+         const_cast<double*>(a.data()),&lda,+         const_cast<double*>(b.data()),&ldb,&done,+         c.data(),&ldc);+}++void blas_gemm(const MatrixXcf& a, const MatrixXcf& b, MatrixXcf& c)+{+  int M = c.rows(); int N = c.cols(); int K = a.cols();+  int lda = a.rows(); int ldb = b.rows(); int ldc = c.rows();++  cgemm_(&notrans,&notrans,&M,&N,&K,(float*)&cfone,+         const_cast<float*>((const float*)a.data()),&lda,+         const_cast<float*>((const float*)b.data()),&ldb,(float*)&cfone,+         (float*)c.data(),&ldc);+}++void blas_gemm(const MatrixXcd& a, const MatrixXcd& b, MatrixXcd& c)+{+  int M = c.rows(); int N = c.cols(); int K = a.cols();+  int lda = a.rows(); int ldb = b.rows(); int ldc = c.rows();++  zgemm_(&notrans,&notrans,&M,&N,&K,(double*)&cdone,+         const_cast<double*>((const double*)a.data()),&lda,+         const_cast<double*>((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;+}++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<typename A, typename B, typename C>+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<Scalar,Scalar> 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<argc;)+  {+    if(argv[i][0]=='-')+    {+      if(argv[i][1]=='s')+      {+        ++i;+        s = atoi(argv[i++]);+        m = n = p = s;+        if(argv[i][0]!='-')+        {+          n = atoi(argv[i++]);+          p = atoi(argv[i++]);+        }+      }+      else if(argv[i][1]=='c')+      {+        ++i;+        cache_size1 = atoi(argv[i++]);+        if(argv[i][0]!='-')+        {+          cache_size2 = atoi(argv[i++]);+          if(argv[i][0]!='-')+            cache_size3 = atoi(argv[i++]);+        }+      }+      else if(argv[i][1]=='t')+      {+        ++i;+        tries = atoi(argv[i++]);+      }+      else if(argv[i][1]=='p')+      {+        ++i;+        rep = atoi(argv[i++]);+      }+    }+    else+    {+      need_help = true;+      break;+    }+  }++  if(need_help)+  {+    std::cout << argv[0] << " -s <matrix sizes> -c <cache sizes> -t <nb tries> -p <nb repeats>\n";+    std::cout << "   <matrix sizes> : size\n";+    std::cout << "   <matrix sizes> : 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<Scalar,Scalar>(kc, mc, nc);+  std::cout << "blocking size (mc x kc) = " << mc << " x " << kc << "\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 << "\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<Scalar>() .lazyProduct( b.cast<Scalar>() );+      if(!r.isApprox(c)) {+        std::cout << r - c << "\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++  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<A::Scalar>::IsComplex) && (NumTraits<B::Scalar>::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<A::Scalar>::IsComplex) && (NumTraits<B::Scalar>::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<A::Scalar>::IsComplex) && (!NumTraits<B::Scalar>::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;+}+
+ eigen3/bench/bench_multi_compilers.sh view
@@ -0,0 +1,28 @@+#!/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<g ; ++i )) ; do+  # check the compiler exists+  compiler=`echo ${CLIST[$i]} | cut -d " " -f 1`+  if [ -e `which $compiler` ]; then+    echo "${CLIST[$i]}"+#     echo "${CLIST[$i]} $benchfile -I.. -o bench~"+#     if [ -e ./.bench ] ; then rm .bench; fi+    ${CLIST[$i]} $benchfile -I.. -o .bench && ./.bench 2> /dev/null+    echo ""+  else+    echo "compiler not found: $compiler"+  fi+done++fi
+ eigen3/bench/bench_norm.cpp view
@@ -0,0 +1,360 @@+#include <typeinfo>+#include <iostream>+#include <Eigen/Core>+#include "BenchTimer.h"+using namespace Eigen;+using namespace std;++template<typename T>+EIGEN_DONT_INLINE typename T::Scalar sqsumNorm(T& v)+{+  return v.norm();+}++template<typename T>+EIGEN_DONT_INLINE typename T::Scalar stableNorm(T& v)+{+  return v.stableNorm();+}++template<typename T>+EIGEN_DONT_INLINE typename T::Scalar hypotNorm(T& v)+{+  return v.hypotNorm();+}++template<typename T>+EIGEN_DONT_INLINE typename T::Scalar blueNorm(T& v)+{+  return v.blueNorm();+}++template<typename T>+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<n;++i)+  {+    Scalar ax = std::abs(v.coeff(i));+    if (scale >= ax)+    {+      ssq += numext::abs2(ax/scale);+    }+    else+    {+      ssq = Scalar(1) + ssq * numext::abs2(scale/ax);+      scale = ax;+    }+  }+  return scale * std::sqrt(ssq);+}++template<typename T>+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<typename T>+EIGEN_DONT_INLINE typename T::Scalar bl2passNorm(T& v)+{+  return v.stableNorm();+}++template<typename T>+EIGEN_DONT_INLINE typename T::Scalar divacNorm(T& v)+{+  int n =v.size() / 2;+  for (int i=0;i<n;++i)+    v(i) = v(2*i)*v(2*i) + v(2*i+1)*v(2*i+1);+  n = n/2;+  while (n>0)+  {+    for (int i=0;i<n;++i)+      v(i) = v(2*i) + v(2*i+1);+    n = n/2;+  }+  return std::sqrt(v(0));+}++namespace Eigen {+namespace internal {+#ifdef EIGEN_VECTORIZE+Packet4f plt(const Packet4f& a, Packet4f& b) { return _mm_cmplt_ps(a,b); }+Packet2d plt(const Packet2d& a, Packet2d& b) { return _mm_cmplt_pd(a,b); }++Packet4f pandnot(const Packet4f& a, Packet4f& b) { return _mm_andnot_ps(a,b); }+Packet2d pandnot(const Packet2d& a, Packet2d& b) { return _mm_andnot_pd(a,b); }+#endif+}+}++template<typename T>+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  = std::numeric_limits<int>::max();            // largest integer+    ibeta = std::numeric_limits<Scalar>::radix; //NumTraits<Scalar>::Base;                    // base for floating-point numbers+    it    = std::numeric_limits<Scalar>::digits; //NumTraits<Scalar>::Mantissa;                // number of base-beta digits in mantissa+    iemin = std::numeric_limits<Scalar>::min_exponent;  // minimum exponent+    iemax = std::numeric_limits<Scalar>::max_exponent;  // maximum exponent+    rbig  = std::numeric_limits<Scalar>::max();         // 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;          // overfow 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<Scalar>::type Packet;+  const int ps = internal::packet_traits<Scalar>::size;+  Packet pasml = internal::pset1<Packet>(Scalar(0));+  Packet pamed = internal::pset1<Packet>(Scalar(0));+  Packet pabig = internal::pset1<Packet>(Scalar(0));+  Packet ps2m = internal::pset1<Packet>(s2m);+  Packet ps1m = internal::pset1<Packet>(s1m);+  Packet pb2  = internal::pset1<Packet>(b2);+  Packet pb1  = internal::pset1<Packet>(b1);+  for(int j=0; j<v.size(); j+=ps)+  {+    Packet ax = internal::pabs(v.template packet<Aligned>(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<float> ac = 0; \+  Eigen::BenchTimer tf, td, tcf; tf.reset(); td.reset(); tcf.reset();\+  for (int k=0; k<tries; ++k) { \+    tf.start(); \+    for (int i=0; i<iters; ++i) { af += NRM(vf); } \+    tf.stop(); \+  } \+  for (int k=0; k<tries; ++k) { \+    td.start(); \+    for (int i=0; i<iters; ++i) { ad += NRM(vd); } \+    td.stop(); \+  } \+  /*for (int k=0; k<std::max(1,tries/3); ++k) { \+    tcf.start(); \+    for (int i=0; i<iters; ++i) { ac += NRM(vcf); } \+    tcf.stop(); \+  } */\+  std::cout << #NRM << "\t" << tf.value() << "   " << td.value() <<  "    " << tcf.value() << "\n"; \+}++void check_accuracy(double basef, double based, int s)+{+  double yf = basef * std::abs(internal::random<double>());+  double yd = based * std::abs(internal::random<double>());+  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<s; ++i)+  {+    vf[i] = std::abs(internal::random<double>()) * std::pow(double(10), internal::random<int>(ef0,ef1));+    vd[i] = std::abs(internal::random<double>()) * std::pow(double(10), internal::random<int>(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<long double>()) << "\t" << sqsumNorm(vd.cast<long double>()) << "\n";+  std::cout << "hypotNorm\t"  << hypotNorm(vf)  << "\t" << hypotNorm(vd)  << "\t" << hypotNorm(vf.cast<long double>()) << "\t" << hypotNorm(vd.cast<long double>()) << "\n";+  std::cout << "blueNorm\t"   << blueNorm(vf)   << "\t" << blueNorm(vd)   << "\t" << blueNorm(vf.cast<long double>()) << "\t" << blueNorm(vd.cast<long double>()) << "\n";+  std::cout << "pblueNorm\t"  << pblueNorm(vf)  << "\t" << pblueNorm(vd)  << "\t" << blueNorm(vf.cast<long double>()) << "\t" << blueNorm(vd.cast<long double>()) << "\n";+  std::cout << "lapackNorm\t" << lapackNorm(vf) << "\t" << lapackNorm(vd) << "\t" << lapackNorm(vf.cast<long double>()) << "\t" << lapackNorm(vd.cast<long double>()) << "\n";+  std::cout << "twopassNorm\t" << twopassNorm(vf) << "\t" << twopassNorm(vd) << "\t" << twopassNorm(vf.cast<long double>()) << "\t" << twopassNorm(vd.cast<long double>()) << "\n";+//   std::cout << "bl2passNorm\t" << bl2passNorm(vf) << "\t" << bl2passNorm(vd) << "\t" << bl2passNorm(vf.cast<long double>()) << "\t" << bl2passNorm(vd.cast<long double>()) << "\n";+}++int main(int argc, char** argv)+{+  int tries = 10;+  int iters = 100000;+  double y = 1.1345743233455785456788e12 * internal::random<double>();+  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);+  }+}
+ eigen3/bench/bench_reverse.cpp view
@@ -0,0 +1,84 @@++#include <iostream>+#include <Eigen/Core>+#include <bench/BenchUtil.h>+using namespace Eigen;++#ifndef REPEAT+#define REPEAT 100000+#endif++#ifndef TRIES+#define TRIES 20+#endif++typedef double Scalar;++template <typename MatrixType>+__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<int>(0,rows-1);+  int c = internal::random<int>(0,cols-1);+  for (int t=0; t<TRIES; ++t)+  {+    timerB.start();+    for (int k=0; k<repeats; ++k)+    {+      asm("#begin foo");+      b = a.reverse();+      asm("#end foo");+      acc += b.coeff(r,c);+    }+    timerB.stop();+  }++  if (MatrixType::RowsAtCompileTime==Dynamic)+    std::cout << "dyn   ";+  else+    std::cout << "fixed ";+  std::cout << rows << " x " << cols << " \t"+            << (timerB.value() * REPEAT) / repeats << "s "+            << "(" << 1e-6 * size*repeats/timerB.value() << " MFLOPS)\t";++  std::cout << "\n";+  // make sure the compiler does not optimize too much+  if (acc==123)+    std::cout << acc;+}++int main(int argc, char* argv[])+{+  const int dynsizes[] = {4,6,8,16,24,32,49,64,128,256,512,900,0};+  std::cout << "size            no sqrt                           standard";+//   #ifdef BENCH_GSL+//   std::cout << "       GSL (standard + double + ATLAS)  ";+//   #endif+  std::cout << "\n";+  for (uint i=0; dynsizes[i]>0; ++i)+  {+    bench_reverse(Matrix<Scalar,Dynamic,Dynamic>(dynsizes[i],dynsizes[i]));+    bench_reverse(Matrix<Scalar,Dynamic,1>(dynsizes[i]*dynsizes[i]));+  }+//   bench_reverse(Matrix<Scalar,2,2>());+//   bench_reverse(Matrix<Scalar,3,3>());+//   bench_reverse(Matrix<Scalar,4,4>());+//   bench_reverse(Matrix<Scalar,5,5>());+//   bench_reverse(Matrix<Scalar,6,6>());+//   bench_reverse(Matrix<Scalar,7,7>());+//   bench_reverse(Matrix<Scalar,8,8>());+//   bench_reverse(Matrix<Scalar,12,12>());+//   bench_reverse(Matrix<Scalar,16,16>());+  return 0;+}+
+ eigen3/bench/bench_sum.cpp view
@@ -0,0 +1,18 @@+#include <iostream>+#include <Eigen/Core>+using namespace Eigen;+using namespace std;++int main() +{+  typedef Matrix<SCALAR,Eigen::Dynamic,1> 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;+}
+ eigen3/bench/bench_unrolling view
@@ -0,0 +1,12 @@+#!/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
+ eigen3/bench/benchmark-blocking-sizes.cpp view
@@ -0,0 +1,677 @@+// This file is part of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2015 Benoit Jacob <benoitjacob@google.com>+//+// 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 <iostream>+#include <cstdint>+#include <cstdlib>+#include <vector>+#include <fstream>+#include <memory>+#include <cstdio>++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 <Eigen/Core>++#include <bench/BenchTimer.h>++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<Scalar>::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<Scalar, Scalar>(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 <typename T>+string type_name()+{+  return "unknown";+}++template<>+string type_name<float>()+{+  return "float";+}++template<>+string type_name<double>()+{+  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<unique_ptr<action_t>>& available_actions)+{+  cerr << "usage: " << argv[0] << " <action> [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<float> 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<benchmark_t>& 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<benchmark_t>& 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<benchmark_t>& 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<benchmark_t>& benchmarks)+{+  size_t first_benchmark_to_run;+  vector<benchmark_t> 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<benchmark_t> 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<benchmark_t> 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<benchmark_t> 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<unique_ptr<action_t>> 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<Scalar>() << endl;+  cout << "packet size: " << internal::packet_traits<MatrixType::Scalar>::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;+}
+ eigen3/bench/benchmark.cpp view
@@ -0,0 +1,39 @@+// g++ -O3 -DNDEBUG -DMATSIZE=<x> benchmark.cpp -o benchmark && time ./benchmark++#include <iostream>++#include <Eigen/Core>++#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<SCALAR,MATSIZE,MATSIZE> I = Matrix<SCALAR,MATSIZE,MATSIZE>::Ones();+    Matrix<SCALAR,MATSIZE,MATSIZE> 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<SCALAR,MATSIZE,MATSIZE>::Ones() + 0.00005 * (m + (m*m));+    }+    asm("#end");+    cout << m << endl;+    return 0;+}
+ eigen3/bench/benchmarkSlice.cpp view
@@ -0,0 +1,38 @@+// g++ -O3 -DNDEBUG benchmarkX.cpp -o benchmarkX && time ./benchmarkX++#include <iostream>++#include <Eigen/Core>++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<SCALAR, Eigen::Dynamic, Eigen::Dynamic> Mat;+  Mat m(100, 100);+  m.setRandom();++  for(int a = 0; a < REPEAT; a++)+  {+    int r, c, nr, nc;+    r = Eigen::internal::random<int>(0,10);+    c = Eigen::internal::random<int>(0,10);+    nr = Eigen::internal::random<int>(50,80);+    nc = Eigen::internal::random<int>(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;+}
+ eigen3/bench/benchmarkX.cpp view
@@ -0,0 +1,36 @@+// g++ -fopenmp -I .. -O3 -DNDEBUG -finline-limit=1000 benchmarkX.cpp -o b && time ./b++#include <iostream>++#include <Eigen/Core>++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;+}
+ eigen3/bench/benchmarkXcwise.cpp view
@@ -0,0 +1,35 @@+// g++ -O3 -DNDEBUG benchmarkX.cpp -o benchmarkX && time ./benchmarkX++#include <iostream>+#include <Eigen/Core>++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;+}
+ eigen3/bench/benchmark_suite view
@@ -0,0 +1,18 @@+#!/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
+ eigen3/bench/btl/CMakeLists.txt view
@@ -0,0 +1,107 @@+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(IS_ICPC)++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 (MKL_FOUND)++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(_current_var)++  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 (${_argn_length} EQUAL ${_src_length})++  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(btl_add_target_property)++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)++
+ eigen3/bench/btl/COPYING view
@@ -0,0 +1,340 @@+                    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.++    <one line to give the program's name and a brief idea of what it does.>+    Copyright (C) <year>  <name of author>++    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.++  <signature of Ty Coon>, 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.
+ eigen3/bench/btl/README view
@@ -0,0 +1,154 @@+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 <regexp>+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 exemple:+  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<real_type>+	*** stl_matrix : must correspond to std::vector<stl_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<Portable_Perf_Analyzer,Action>(size_min,size_max,nb_point);+ with+     bench<Mixed_Perf_Analyzer,Action>(size_min,size_max,nb_point);+ in generic/bench.hh++.+++
+ eigen3/bench/btl/actions/action_aat_product.hh view
@@ -0,0 +1,145 @@+//=====================================================+// File   :  action_aat_product.hh+// Author :  L. Plagne <laurent.plagne@edf.fr)>+// 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 <string>+#include "init/init_function.hh"+#include "init/init_vector.hh"+#include "init/init_matrix.hh"++using namespace std;++template<class Interface>+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<pseudo_random>(A_stl,_size);+    init_matrix<null_function>(X_stl,_size);+    init_matrix<null_function>(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<typename Interface::real_type>::aat_product(A_stl,X_stl,_size);++    typename Interface::real_type error=+      STL_interface<typename Interface::real_type>::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+++
+ eigen3/bench/btl/actions/action_ata_product.hh view
@@ -0,0 +1,145 @@+//=====================================================+// File   :  action_ata_product.hh+// Author :  L. Plagne <laurent.plagne@edf.fr)>+// 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 <string>+#include "init/init_function.hh"+#include "init/init_vector.hh"+#include "init/init_matrix.hh"++using namespace std;++template<class Interface>+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<pseudo_random>(A_stl,_size);+    init_matrix<null_function>(X_stl,_size);+    init_matrix<null_function>(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<typename Interface::real_type>::ata_product(A_stl,X_stl,_size);++    typename Interface::real_type error=+      STL_interface<typename Interface::real_type>::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+++
+ eigen3/bench/btl/actions/action_atv_product.hh view
@@ -0,0 +1,134 @@+//=====================================================+// File   :  action_atv_product.hh+// Author :  L. Plagne <laurent.plagne@edf.fr)>+// 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 <string>+#include "init/init_function.hh"+#include "init/init_vector.hh"+#include "init/init_matrix.hh"++using namespace std;++template<class Interface>+class Action_atv_product {++public :++  Action_atv_product( int size ) : _size(size)+  {+    MESSAGE("Action_atv_product Ctor");++    // STL matrix and vector initialization++    init_matrix<pseudo_random>(A_stl,_size);+    init_vector<pseudo_random>(B_stl,_size);+    init_vector<null_function>(X_stl,_size);+    init_vector<null_function>(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<typename Interface::real_type>::atv_product(A_stl,B_stl,X_stl,_size);++    typename Interface::real_type error=+      STL_interface<typename Interface::real_type>::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+++
+ eigen3/bench/btl/actions/action_axpby.hh view
@@ -0,0 +1,127 @@+//=====================================================+// File   :  action_axpby.hh+// Copyright (C) 2008 Gael Guennebaud <gael.guennebaud@inria.fr>+//=====================================================+//+// 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 <string>+#include "init/init_function.hh"+#include "init/init_vector.hh"+#include "init/init_matrix.hh"++using namespace std;++template<class Interface>+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<pseudo_random>(X_stl,_size);+    init_vector<pseudo_random>(Y_stl,_size);+    init_vector<null_function>(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<typename Interface::real_type>::axpby(_alpha,X_stl,_beta,Y_stl,_size);++    typename Interface::real_type error=+      STL_interface<typename Interface::real_type>::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
+ eigen3/bench/btl/actions/action_axpy.hh view
@@ -0,0 +1,139 @@+//=====================================================+// File   :  action_axpy.hh+// Author :  L. Plagne <laurent.plagne@edf.fr)>+// 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 <string>+#include "init/init_function.hh"+#include "init/init_vector.hh"+#include "init/init_matrix.hh"++using namespace std;++template<class Interface>+class Action_axpy {++public :++  // Ctor++  Action_axpy( int size ):_coef(1.0),_size(size)+  {+    MESSAGE("Action_axpy Ctor");++    // STL vector initialization++    init_vector<pseudo_random>(X_stl,_size);+    init_vector<pseudo_random>(Y_stl,_size);+    init_vector<null_function>(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<typename Interface::real_type>::axpy(_coef,X_stl,Y_stl,_size);++    typename Interface::real_type error=+      STL_interface<typename Interface::real_type>::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
+ eigen3/bench/btl/actions/action_cholesky.hh view
@@ -0,0 +1,128 @@+//=====================================================+// File   :  action_cholesky.hh+// Copyright (C) 2008 Gael Guennebaud <gael.guennebaud@inria.fr>+//=====================================================+//+// 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 <string>+#include "init/init_function.hh"+#include "init/init_vector.hh"+#include "init/init_matrix.hh"++using namespace std;++template<class Interface>+class Action_cholesky {++public :++  // Ctor++  Action_cholesky( int size ):_size(size)+  {+    MESSAGE("Action_cholesky Ctor");++    // STL mat/vec initialization+    init_matrix_symm<pseudo_random>(X_stl,_size);+    init_matrix<null_function>(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<typename Interface::real_type>::cholesky(X_stl,C_stl,_size);+//+//     typename Interface::real_type error=+//       STL_interface<typename Interface::real_type>::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
+ eigen3/bench/btl/actions/action_ger.hh view
@@ -0,0 +1,128 @@++// 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 <string>+#include "init/init_function.hh"+#include "init/init_vector.hh"+#include "init/init_matrix.hh"++using namespace std;++template<class Interface>+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<pseudo_random>(A_stl,_size);+    init_vector<pseudo_random>(B_stl,_size);+    init_vector<pseudo_random>(X_stl,_size);+    init_vector<null_function>(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<typename Interface::real_type>::ger(A_stl,B_stl,X_stl,_size);++    typename Interface::real_type error=+      STL_interface<typename Interface::real_type>::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
+ eigen3/bench/btl/actions/action_hessenberg.hh view
@@ -0,0 +1,233 @@+//=====================================================+// File   :  action_hessenberg.hh+// Copyright (C) 2008 Gael Guennebaud <gael.guennebaud@inria.fr>+//=====================================================+//+// 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 <string>+#include "init/init_function.hh"+#include "init/init_vector.hh"+#include "init/init_matrix.hh"++using namespace std;++template<class Interface>+class Action_hessenberg {++public :++  // Ctor++  Action_hessenberg( int size ):_size(size)+  {+    MESSAGE("Action_hessenberg Ctor");++    // STL vector initialization+    init_matrix<pseudo_random>(X_stl,_size);++    init_matrix<null_function>(C_stl,_size);+    init_matrix<null_function>(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<typename Interface::real_type>::hessenberg(X_stl,C_stl,_size);+//+//     typename Interface::real_type error=+//       STL_interface<typename Interface::real_type>::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 Interface>+class Action_tridiagonalization {++public :++  // Ctor++  Action_tridiagonalization( int size ):_size(size)+  {+    MESSAGE("Action_tridiagonalization Ctor");++    // STL vector initialization+    init_matrix<pseudo_random>(X_stl,_size);+    +    for(int i=0; i<_size; ++i)+    {+      for(int j=0; j<i; ++j)+        X_stl[i][j] = X_stl[j][i];+    }+    +    init_matrix<null_function>(C_stl,_size);+    init_matrix<null_function>(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<typename Interface::real_type>::tridiagonalization(X_stl,C_stl,_size);+//+//     typename Interface::real_type error=+//       STL_interface<typename Interface::real_type>::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
+ eigen3/bench/btl/actions/action_lu_decomp.hh view
@@ -0,0 +1,124 @@+//=====================================================+// File   :  action_lu_decomp.hh+// Copyright (C) 2008 Gael Guennebaud <gael.guennebaud@inria.fr>+//=====================================================+//+// 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 <string>+#include "init/init_function.hh"+#include "init/init_vector.hh"+#include "init/init_matrix.hh"++using namespace std;++template<class Interface>+class Action_lu_decomp {++public :++  // Ctor++  Action_lu_decomp( int size ):_size(size)+  {+    MESSAGE("Action_lu_decomp Ctor");++    // STL vector initialization+    init_matrix<pseudo_random>(X_stl,_size);++    init_matrix<null_function>(C_stl,_size);+    init_matrix<null_function>(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<typename Interface::real_type>::lu_decomp(X_stl,C_stl,_size);+//+//     typename Interface::real_type error=+//       STL_interface<typename Interface::real_type>::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
+ eigen3/bench/btl/actions/action_lu_solve.hh view
@@ -0,0 +1,136 @@+//=====================================================+// File   :  action_lu_solve.hh+// Author :  L. Plagne <laurent.plagne@edf.fr)>        +// 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 <string>+#include "init/init_function.hh"+#include "init/init_vector.hh"+#include "init/init_matrix.hh"++using namespace std;++template<class Interface>+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<pseudo_random>(A_stl,size);+    init_vector<pseudo_random>(B_stl,size);+    init_vector<null_function>(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<nb_calc;ii++){++      // LU factorization+      Interface::copy_matrix(A,LU,size);+      Interface::LU_factor(LU,pivot,size);+      +      // LU solve++      Interface::LU_solve(LU,pivot,B,X,size);++    }++    // Time stop++    chronos.stop();++    double time=chronos.user_time();+  +    // check result :++    typename Interface::stl_vector B_new_stl(size);+    Interface::vector_to_stl(X,X_stl);++    STL_interface<typename Interface::real_type>::matrix_vector_product(A_stl,X_stl,B_new_stl,size); +  +    typename Interface::real_type error=+      STL_interface<typename Interface::real_type>::norm_diff(B_stl,B_new_stl);+    +    if (error>1.e-5){+      INFOS("WRONG CALCULATION...residual=" << error);+      STL_interface<typename Interface::real_type>::display_vector(B_stl);+      STL_interface<typename Interface::real_type>::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+++
+ eigen3/bench/btl/actions/action_matrix_matrix_product.hh view
@@ -0,0 +1,150 @@+//=====================================================+// File   :  action_matrix_matrix_product.hh+// Author :  L. Plagne <laurent.plagne@edf.fr)>+// 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 <string>+#include "init/init_function.hh"+#include "init/init_vector.hh"+#include "init/init_matrix.hh"++using namespace std;++template<class Interface>+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<pseudo_random>(A_stl,_size);+    init_matrix<pseudo_random>(B_stl,_size);+    init_matrix<null_function>(X_stl,_size);+    init_matrix<null_function>(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<typename Interface::real_type>::matrix_matrix_product(A_stl,B_stl,X_stl,_size);+      typename Interface::real_type error=+        STL_interface<typename Interface::real_type>::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+++
+ eigen3/bench/btl/actions/action_matrix_matrix_product_bis.hh view
@@ -0,0 +1,152 @@+//=====================================================+// File   :  action_matrix_matrix_product_bis.hh+// Author :  L. Plagne <laurent.plagne@edf.fr)>+// 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 <string>+#include "init_function.hh"+#include "init_vector.hh"+#include "init_matrix.hh"++using namespace std;++template<class Interface>+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<pseudo_random>(A_stl,size);+    init_matrix<pseudo_random>(B_stl,size);+    init_matrix<null_function>(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<typename Interface::real_type>::matrix_matrix_product(A_stl,B_stl,X_stl,size);++    typename Interface::real_type error=+      STL_interface<typename Interface::real_type>::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+++
+ eigen3/bench/btl/actions/action_matrix_vector_product.hh view
@@ -0,0 +1,153 @@+//=====================================================+// File   :  action_matrix_vector_product.hh+// Author :  L. Plagne <laurent.plagne@edf.fr)>+// 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 <string>+#include "init/init_function.hh"+#include "init/init_vector.hh"+#include "init/init_matrix.hh"++using namespace std;++template<class Interface>+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<pseudo_random>(A_stl,_size);+    init_vector<pseudo_random>(B_stl,_size);+    init_vector<null_function>(X_stl,_size);+    init_vector<null_function>(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<typename Interface::real_type>::matrix_vector_product(A_stl,B_stl,X_stl,_size);++    typename Interface::real_type error=+      STL_interface<typename Interface::real_type>::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+++
+ eigen3/bench/btl/actions/action_partial_lu.hh view
@@ -0,0 +1,125 @@+//=====================================================+// File   :  action_lu_decomp.hh+// Copyright (C) 2008 Gael Guennebaud <gael.guennebaud@inria.fr>+//=====================================================+//+// 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 <string>+#include "init/init_function.hh"+#include "init/init_vector.hh"+#include "init/init_matrix.hh"++using namespace std;++template<class Interface>+class Action_partial_lu {++public :++  // Ctor++  Action_partial_lu( int size ):_size(size)+  {+    MESSAGE("Action_partial_lu Ctor");++    // STL vector initialization+    init_matrix<pseudo_random>(X_stl,_size);+    init_matrix<null_function>(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<typename Interface::real_type>::lu_decomp(X_stl,C_stl,_size);+//+//     typename Interface::real_type error=+//       STL_interface<typename Interface::real_type>::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
+ eigen3/bench/btl/actions/action_rot.hh view
@@ -0,0 +1,116 @@++// 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 <string>+#include "init/init_function.hh"+#include "init/init_vector.hh"+#include "init/init_matrix.hh"++using namespace std;++template<class Interface>+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<pseudo_random>(A_stl,_size);+    init_vector<pseudo_random>(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<typename Interface::real_type>::rot(A_stl,B_stl,X_stl,_size);++//     typename Interface::real_type error=+//       STL_interface<typename Interface::real_type>::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
+ eigen3/bench/btl/actions/action_symv.hh view
@@ -0,0 +1,139 @@+//=====================================================+// File   :  action_symv.hh+// Author :  L. Plagne <laurent.plagne@edf.fr)>+// 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 <string>+#include "init/init_function.hh"+#include "init/init_vector.hh"+#include "init/init_matrix.hh"++using namespace std;++template<class Interface>+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<pseudo_random>(A_stl,_size);+    init_vector<pseudo_random>(B_stl,_size);+    init_vector<null_function>(X_stl,_size);+    init_vector<null_function>(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<typename Interface::real_type>::symv(A_stl,B_stl,X_stl,_size);++    typename Interface::real_type error=+      STL_interface<typename Interface::real_type>::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
+ eigen3/bench/btl/actions/action_syr2.hh view
@@ -0,0 +1,133 @@+//=====================================================+// File   :  action_syr2.hh+// Author :  L. Plagne <laurent.plagne@edf.fr)>+// 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 <string>+#include "init/init_function.hh"+#include "init/init_vector.hh"+#include "init/init_matrix.hh"++using namespace std;++template<class Interface>+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<pseudo_random>(A_stl,_size);+    init_vector<pseudo_random>(B_stl,_size);+    init_vector<pseudo_random>(X_stl,_size);+    init_vector<null_function>(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<typename Interface::real_type>::syr2(A_stl,B_stl,X_stl,_size);++    typename Interface::real_type error=+      STL_interface<typename Interface::real_type>::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
+ eigen3/bench/btl/actions/action_trisolve.hh view
@@ -0,0 +1,137 @@+//=====================================================+// File   :  action_trisolve.hh+// Copyright (C) 2008 Gael Guennebaud <gael.guennebaud@inria.fr>+//=====================================================+//+// 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 <string>+#include "init/init_function.hh"+#include "init/init_vector.hh"+#include "init/init_matrix.hh"++using namespace std;++template<class Interface>+class Action_trisolve {++public :++  // Ctor++  Action_trisolve( int size ):_size(size)+  {+    MESSAGE("Action_trisolve Ctor");++    // STL vector initialization+    init_matrix<pseudo_random>(L_stl,_size);+    init_vector<pseudo_random>(B_stl,_size);+    init_vector<null_function>(X_stl,_size);+    for (int j=0; j<_size; ++j)+    {+      for (int i=0; i<j; ++i)+        L_stl[j][i] = 0;+      L_stl[j][j] += 3;+    }++    init_vector<null_function>(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<typename Interface::real_type>::trisolve_lower(L_stl,B_stl,X_stl,_size);++    typename Interface::real_type error=+      STL_interface<typename Interface::real_type>::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
+ eigen3/bench/btl/actions/action_trisolve_matrix.hh view
@@ -0,0 +1,165 @@+//=====================================================+// File   :  action_matrix_matrix_product.hh+// Author :  L. Plagne <laurent.plagne@edf.fr)>+// 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 <string>+#include "init/init_function.hh"+#include "init/init_vector.hh"+#include "init/init_matrix.hh"++using namespace std;++template<class Interface>+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<pseudo_random>(A_stl,_size);+    init_matrix<pseudo_random>(B_stl,_size);+    init_matrix<null_function>(X_stl,_size);+    init_matrix<null_function>(resu_stl,_size);++    for (int j=0; j<_size; ++j)+    {+      for (int i=0; i<j; ++i)+        A_stl[j][i] = 0;+      A_stl[j][j] += 3;+    }++    // 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);++    _cost = 0;+    for (int j=0; j<_size; ++j)+    {+      _cost += 2*j + 1;+    }+    _cost *= _size;+  }++  // invalidate copy ctor++  Action_trisolve_matrix( const  Action_trisolve_matrix & )+  {+    INFOS("illegal call to Action_trisolve_matrix Copy Ctor");+    exit(0);+  }++  // Dtor++  ~Action_trisolve_matrix( void ){++    MESSAGE("Action_trisolve_matrix 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 "trisolve_matrix_"+Interface::name();+  }++  double nb_op_base( void ){+    return _cost;+  }++  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::trisolve_lower_matrix(A,B,X,_size);+  }++  void check_result( void ){++    // calculation check++//     Interface::matrix_to_stl(X,resu_stl);+//+//     STL_interface<typename Interface::real_type>::matrix_matrix_product(A_stl,B_stl,X_stl,_size);+//+//     typename Interface::real_type error=+//       STL_interface<typename Interface::real_type>::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+++
+ eigen3/bench/btl/actions/action_trmm.hh view
@@ -0,0 +1,165 @@+//=====================================================+// File   :  action_matrix_matrix_product.hh+// Author :  L. Plagne <laurent.plagne@edf.fr)>+// 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 <string>+#include "init/init_function.hh"+#include "init/init_vector.hh"+#include "init/init_matrix.hh"++using namespace std;++template<class Interface>+class Action_trmm {++public :++  // Ctor++  Action_trmm( int size ):_size(size)+  {+    MESSAGE("Action_trmm Ctor");++    // STL matrix and vector initialization++    init_matrix<pseudo_random>(A_stl,_size);+    init_matrix<pseudo_random>(B_stl,_size);+    init_matrix<null_function>(X_stl,_size);+    init_matrix<null_function>(resu_stl,_size);++    for (int j=0; j<_size; ++j)+    {+      for (int i=0; i<j; ++i)+        A_stl[j][i] = 0;+      A_stl[j][j] += 3;+    }++    // 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);++    _cost = 0;+    for (int j=0; j<_size; ++j)+    {+      _cost += 2*j + 1;+    }+    _cost *= _size;+  }++  // invalidate copy ctor++  Action_trmm( const  Action_trmm & )+  {+    INFOS("illegal call to Action_trmm Copy Ctor");+    exit(0);+  }++  // Dtor++  ~Action_trmm( void ){++    MESSAGE("Action_trmm 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 "trmm_"+Interface::name();+  }++  double nb_op_base( void ){+    return _cost;+  }++  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::trmm(A,B,X,_size);+  }++  void check_result( void ){++    // calculation check++//     Interface::matrix_to_stl(X,resu_stl);+//+//     STL_interface<typename Interface::real_type>::matrix_matrix_product(A_stl,B_stl,X_stl,_size);+//+//     typename Interface::real_type error=+//       STL_interface<typename Interface::real_type>::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+++
+ eigen3/bench/btl/actions/basic_actions.hh view
@@ -0,0 +1,21 @@++#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"+
+ eigen3/bench/btl/cmake/FindACML.cmake view
@@ -0,0 +1,51 @@++if (ACML_LIBRARIES)+  set(ACML_FIND_QUIETLY TRUE)+endif (ACML_LIBRARIES)++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)
+ eigen3/bench/btl/cmake/FindATLAS.cmake view
@@ -0,0 +1,31 @@++if (ATLAS_LIBRARIES)+  set(ATLAS_FIND_QUIETLY TRUE)+endif (ATLAS_LIBRARIES)++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(ATLAS_LIB AND ATLAS_CBLAS AND ATLAS_LAPACK AND ATLAS_F77BLAS)++include(FindPackageHandleStandardArgs)+find_package_handle_standard_args(ATLAS DEFAULT_MSG ATLAS_LIBRARIES)++mark_as_advanced(ATLAS_LIBRARIES)
+ eigen3/bench/btl/cmake/FindBLAZE.cmake view
@@ -0,0 +1,31 @@+# - 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 <gael.guennebaud@inria.fr>+# Adapted from FindEigen.cmake:+# Copyright (c) 2006, 2007 Montel Laurent, <montel@kde.org>+# 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 (BLAZE_INCLUDE_DIR)++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(BLAZE_INCLUDE_DIR)+
+ eigen3/bench/btl/cmake/FindBlitz.cmake view
@@ -0,0 +1,40 @@+# - 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, <montel@kde.org>+# Copyright (c) 2007, Allen Winter, <winter@kde.org>+# Copyright (C) 2008 Gael Guennebaud <gael.guennebaud@inria.fr>+# 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 (BLITZ_INCLUDES AND BLITZ_LIBRARIES)++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)
+ eigen3/bench/btl/cmake/FindCBLAS.cmake view
@@ -0,0 +1,35 @@+# include(FindLibraryWithDebug)++if (CBLAS_INCLUDES AND CBLAS_LIBRARIES)+  set(CBLAS_FIND_QUIETLY TRUE)+endif (CBLAS_INCLUDES AND CBLAS_LIBRARIES)++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)
+ eigen3/bench/btl/cmake/FindGMM.cmake view
@@ -0,0 +1,17 @@+if (GMM_INCLUDE_DIR)+  # in cache already+  set(GMM_FOUND TRUE)+else (GMM_INCLUDE_DIR)++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(GMM_INCLUDE_DIR)
+ eigen3/bench/btl/cmake/FindMKL.cmake view
@@ -0,0 +1,65 @@++if (MKL_LIBRARIES)+  set(MKL_FIND_QUIETLY TRUE)+endif (MKL_LIBRARIES)++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(${CMAKE_HOST_SYSTEM_PROCESSOR} STREQUAL "x86_64")++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(${CMAKE_HOST_SYSTEM_PROCESSOR} STREQUAL "x86_64")++endif(CMAKE_MINOR_VERSION GREATER 4)++include(FindPackageHandleStandardArgs)+find_package_handle_standard_args(MKL DEFAULT_MSG MKL_LIBRARIES)++mark_as_advanced(MKL_LIBRARIES)
+ eigen3/bench/btl/cmake/FindMTL4.cmake view
@@ -0,0 +1,31 @@+# - 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 <gael.guennebaud@inria.fr>+# Adapted from FindEigen.cmake:+# Copyright (c) 2006, 2007 Montel Laurent, <montel@kde.org>+# 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 (MTL4_INCLUDE_DIR)++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(MTL4_INCLUDE_DIR)+
+ eigen3/bench/btl/cmake/FindOPENBLAS.cmake view
@@ -0,0 +1,17 @@++if (OPENBLAS_LIBRARIES)+  set(OPENBLAS_FIND_QUIETLY TRUE)+endif (OPENBLAS_LIBRARIES)++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)
+ eigen3/bench/btl/cmake/FindPackageHandleStandardArgs.cmake view
@@ -0,0 +1,60 @@+# 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 <UPPERCASED_NAME>_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)
+ eigen3/bench/btl/cmake/FindTvmet.cmake view
@@ -0,0 +1,32 @@+# - 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 <gael.guennebaud@inria.fr>+# Adapted from FindEigen.cmake:+# Copyright (c) 2006, 2007 Montel Laurent, <montel@kde.org>+# 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 (TVMET_INCLUDE_DIR)++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(TVMET_INCLUDE_DIR)+
+ eigen3/bench/btl/cmake/MacroOptionalAddSubdirectory.cmake view
@@ -0,0 +1,31 @@+# - MACRO_OPTIONAL_ADD_SUBDIRECTORY() combines ADD_SUBDIRECTORY() with an OPTION()+# MACRO_OPTIONAL_ADD_SUBDIRECTORY( <dir> )+# 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, <neundorf@kde.org>+#+# 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)
+ eigen3/bench/btl/data/CMakeLists.txt view
@@ -0,0 +1,32 @@++ADD_CUSTOM_TARGET(copy_scripts)++SET(script_files go_mean mk_mean_script.sh mk_new_gnuplot.sh+    perlib_plot_settings.txt action_settings.txt gnuplot_common_settings.hh )++FOREACH(script_file ${script_files})+ADD_CUSTOM_COMMAND(+  TARGET copy_scripts+  POST_BUILD+  COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/${script_file} ${CMAKE_CURRENT_BINARY_DIR}/+  ARGS+)+ENDFOREACH(script_file)++ADD_CUSTOM_COMMAND(+  TARGET copy_scripts+  POST_BUILD+  COMMAND ${CMAKE_CXX_COMPILER} --version | head -n 1 > ${CMAKE_CURRENT_BINARY_DIR}/compiler_version.txt+  ARGS+)+ADD_CUSTOM_COMMAND(+  TARGET copy_scripts+  POST_BUILD+  COMMAND echo "${Eigen_SOURCE_DIR}" > ${CMAKE_CURRENT_BINARY_DIR}/eigen_root_dir.txt+  ARGS+)++add_executable(smooth smooth.cxx)+add_executable(regularize regularize.cxx)+add_executable(main mean.cxx)+add_dependencies(main copy_scripts)
+ eigen3/bench/btl/data/action_settings.txt view
@@ -0,0 +1,19 @@+aat ; "{/*1.5 A x A^T}" ; "matrix size" ; 4:5000+ata ; "{/*1.5 A^T x A}" ; "matrix size" ; 4:5000+atv ; "{/*1.5 matrix^T x vector}" ; "matrix size" ; 4:5000+axpby ; "{/*1.5 Y = alpha X + beta Y}" ; "vector size" ; 5:1000000+axpy ; "{/*1.5 Y += alpha X}" ; "vector size" ; 5:1000000+matrix_matrix ; "{/*1.5 matrix matrix product}" ; "matrix size" ; 4:5000+matrix_vector ; "{/*1.5 matrix vector product}" ; "matrix size" ; 4:5000+trmm ; "{/*1.5 triangular matrix matrix product}" ; "matrix size" ; 4:5000+trisolve_vector ; "{/*1.5 triangular solver - vector (X = inv(L) X)}" ; "size" ; 4:5000+trisolve_matrix ; "{/*1.5 triangular solver - matrix (M = inv(L) M)}" ; "size" ; 4:5000+cholesky ; "{/*1.5 Cholesky decomposition}" ; "matrix size" ; 4:5000+complete_lu_decomp ; "{/*1.5 Complete LU decomposition}" ; "matrix size" ; 4:5000+partial_lu_decomp ; "{/*1.5 Partial LU decomposition}" ; "matrix size" ; 4:5000+tridiagonalization ; "{/*1.5 Tridiagonalization}" ; "matrix size" ; 4:5000+hessenberg ; "{/*1.5 Hessenberg decomposition}" ; "matrix size" ; 4:5000+symv ; "{/*1.5 symmetric matrix vector product}" ; "matrix size" ; 4:5000+syr2 ; "{/*1.5 symmretric rank-2 update (A += u^T v + u v^T)}" ; "matrix size" ; 4:5000+ger ; "{/*1.5 general rank-1 update (A += u v^T)}" ; "matrix size" ; 4:5000+rot ; "{/*1.5 apply rotation in the plane}" ; "vector size" ; 4:1000000
+ eigen3/bench/btl/data/gnuplot_common_settings.hh view
@@ -0,0 +1,87 @@+set noclip points+set clip one+set noclip two+set bar 1.000000+set border 31 lt -1 lw 1.000+set xdata+set ydata+set zdata+set x2data+set y2data+set boxwidth+set dummy x,y+set format x "%g"+set format y "%g"+set format x2 "%g"+set format y2 "%g"+set format z "%g"+set angles radians+set nogrid+set key title ""+set key left top Right noreverse box linetype -2 linewidth 1.000 samplen 4 spacing 1 width 0+set nolabel+set noarrow+# set nolinestyle # deprecated+set nologscale+set logscale x 10+set offsets 0, 0, 0, 0+set pointsize 1+set encoding default+set nopolar+set noparametric+set view 60, 30, 1, 1+set samples 100, 100+set isosamples 10, 10+set surface+set nocontour+set clabel '%8.3g'+set mapping cartesian+set nohidden3d+set cntrparam order 4+set cntrparam linear+set cntrparam levels auto 5+set cntrparam points 5+set size ratio 0 1,1+set origin 0,0+# set data style lines+# set function style lines+set xzeroaxis lt -2 lw 1.000+set x2zeroaxis lt -2 lw 1.000+set yzeroaxis lt -2 lw 1.000+set y2zeroaxis lt -2 lw 1.000+set tics in+set ticslevel 0.5+set tics scale 1, 0.5+set mxtics default+set mytics default+set mx2tics default+set my2tics default+set xtics border mirror norotate autofreq+set ytics border mirror norotate autofreq+set ztics border nomirror norotate autofreq+set nox2tics+set noy2tics+set timestamp "" bottom norotate offset 0,0+set rrange [ * : * ] noreverse nowriteback  # (currently [-0:10] )+set trange [ * : * ] noreverse nowriteback  # (currently [-5:5] )+set urange [ * : * ] noreverse nowriteback  # (currently [-5:5] )+set vrange [ * : * ] noreverse nowriteback  # (currently [-5:5] )+set xlabel "matrix size" offset 0,0+set x2label "" offset 0,0+set timefmt "%d/%m/%y\n%H:%M"+set xrange [ 10 : 1000 ] noreverse nowriteback+set x2range [ * : * ] noreverse nowriteback  # (currently [-10:10] )+set ylabel "MFLOPS" offset 0,0+set y2label "" offset 0,0+set yrange [ * : * ] noreverse nowriteback  # (currently [-10:10] )+set y2range [ * : * ] noreverse nowriteback  # (currently [-10:10] )+set zlabel "" offset 0,0+set zrange [ * : * ] noreverse nowriteback  # (currently [-10:10] )+set zero 1e-08+set lmargin -1+set bmargin -1+set rmargin -1+set tmargin -1+set locale "C"+set xrange [4:1024]+
+ eigen3/bench/btl/data/go_mean view
@@ -0,0 +1,58 @@+#!/bin/bash++if [ $# < 1 ]; then+  echo "Usage: $0 working_directory [tiny|large [prefix]]"+else++mkdir -p $1+##cp ../libs/*/*.dat $1++mode=large+if [ $# > 2 ]; then+  mode=$2+fi+if [ $# > 3 ]; then+  prefix=$3+fi++EIGENDIR=`cat eigen_root_dir.txt`++webpagefilename=$1/index.html+meanstatsfilename=$1/mean.html++echo ''  > $meanstatsfilename+echo ''  > $webpagefilename+echo '<p><strong>Configuration</strong>'  >> $webpagefilename+echo '<ul>'\+  '<li>' `cat /proc/cpuinfo | grep "model name" | head -n 1`\+  '  (' `uname -m` ')</li>'\+  '<li> compiler: ' `cat compiler_version.txt` '</li>'\+  '<li> eigen3: ' `hg identify -i $EIGENDIR` '</li>'\+  '</ul>' \+  '</p>'  >> $webpagefilename++source mk_mean_script.sh axpy $1 11 2500 100000 250000  $mode $prefix+source mk_mean_script.sh axpby $1 11 2500 100000 250000 $mode $prefix+source mk_mean_script.sh matrix_vector $1 11 50 300 1000 $mode $prefix+source mk_mean_script.sh atv $1 11 50 300 1000 $mode $prefix+source mk_mean_script.sh matrix_matrix $1 11 100 300 1000 $mode $prefix+source mk_mean_script.sh aat $1 11 100 300 1000 $mode $prefix+# source mk_mean_script.sh ata $1 11 100 300 1000 $mode $prefix+source mk_mean_script.sh trmm $1 11 100 300 1000 $mode $prefix+source mk_mean_script.sh trisolve_vector $1 11 100 300 1000 $mode $prefix+source mk_mean_script.sh trisolve_matrix $1 11 100 300 1000 $mode $prefix+source mk_mean_script.sh cholesky $1 11 100 300 1000 $mode $prefix+source mk_mean_script.sh partial_lu_decomp $1 11 100 300 1000 $mode $prefix+source mk_mean_script.sh tridiagonalization $1 11 100 300 1000 $mode $prefix+source mk_mean_script.sh hessenberg $1 11 100 300 1000 $mode $prefix+source mk_mean_script.sh symv $1 11 50 300 1000 $mode $prefix+source mk_mean_script.sh syr2 $1 11 50 300 1000 $mode $prefix+source mk_mean_script.sh ger $1 11 50 300 1000 $mode $prefix+source mk_mean_script.sh rot $1 11 2500 100000 250000 $mode $prefix+source mk_mean_script.sh complete_lu_decomp $1 11 100 300 1000 $mode $prefix++fi++## compile the web page ##++#echo `cat footer.html` >> $webpagefilename
+ eigen3/bench/btl/data/mean.cxx view
@@ -0,0 +1,182 @@+//=====================================================+// File   :  mean.cxx+// Author :  L. Plagne <laurent.plagne@edf.fr)>        +// Copyright (C) EDF R&D,  lun sep 30 14:23:15 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 <vector>+#include <string>+#include <iostream>+#include <fstream>+#include "bench_parameter.hh"+#include "utils/xy_file.hh"+#include <set>++using namespace std;++double mean_calc(const vector<int> & tab_sizes, const vector<double> & tab_mflops, const int size_min, const int size_max);++class Lib_Mean{++public:+  Lib_Mean( void ):_lib_name(),_mean_in_cache(),_mean_out_of_cache(){+    MESSAGE("Lib_mean Default Ctor");+    MESSAGE("!!! should not be used");+    exit(0);+  }+  Lib_Mean(const string & name, const double & mic, const double & moc):_lib_name(name),_mean_in_cache(mic),_mean_out_of_cache(moc){+    MESSAGE("Lib_mean Ctor");+  }+  Lib_Mean(const Lib_Mean & lm):_lib_name(lm._lib_name),_mean_in_cache(lm._mean_in_cache),_mean_out_of_cache(lm._mean_out_of_cache){+    MESSAGE("Lib_mean Copy Ctor");+  }+  ~Lib_Mean( void ){+    MESSAGE("Lib_mean Dtor");+  }+    +  double _mean_in_cache;+  double _mean_out_of_cache;+  string _lib_name;++  bool operator < ( const Lib_Mean &right) const +  {+    //return ( this->_mean_out_of_cache > right._mean_out_of_cache) ;+    return ( this->_mean_in_cache > right._mean_in_cache) ;+  }++}; +++int main( int argc , char *argv[] )+{++  if (argc<6){+    INFOS("!!! Error ... usage : main what mic Mic moc Moc filename1 finename2...");+    exit(0);+  }+  INFOS(argc);++  int min_in_cache=atoi(argv[2]);+  int max_in_cache=atoi(argv[3]);+  int min_out_of_cache=atoi(argv[4]);+  int max_out_of_cache=atoi(argv[5]);+++  multiset<Lib_Mean> s_lib_mean ;++  for (int i=6;i<argc;i++){+    +    string filename=argv[i];+    +    INFOS(filename);++    double mic=0;+    double moc=0;++    {+      +      vector<int> tab_sizes;+      vector<double> tab_mflops;++      read_xy_file(filename,tab_sizes,tab_mflops);++      mic=mean_calc(tab_sizes,tab_mflops,min_in_cache,max_in_cache);+      moc=mean_calc(tab_sizes,tab_mflops,min_out_of_cache,max_out_of_cache);++      Lib_Mean cur_lib_mean(filename,mic,moc);+      +      s_lib_mean.insert(cur_lib_mean);	++    }   +           +  }+++  cout << "<TABLE BORDER CELLPADDING=2>" << endl ;+  cout << "  <TR>" << endl ;+  cout << "    <TH ALIGN=CENTER> " << argv[1] << " </TH>" << endl ;+  cout << "    <TH ALIGN=CENTER> <a href=""#mean_marker""> in cache <BR> mean perf <BR> Mflops </a></TH>" << endl ;+  cout << "    <TH ALIGN=CENTER> in cache <BR> % best </TH>" << endl ;+  cout << "    <TH ALIGN=CENTER> <a href=""#mean_marker""> out of cache <BR> mean perf <BR> Mflops </a></TH>" << endl ;+  cout << "    <TH ALIGN=CENTER> out of cache <BR> % best </TH>" << endl ;+  cout << "    <TH ALIGN=CENTER> details </TH>" << endl ;+  cout << "    <TH ALIGN=CENTER> comments </TH>" << endl ;+  cout << "  </TR>" << endl ;++  multiset<Lib_Mean>::iterator is = s_lib_mean.begin();+  Lib_Mean best(*is);  +  ++  for (is=s_lib_mean.begin(); is!=s_lib_mean.end() ; is++){++    cout << "  <TR>" << endl ;+    cout << "     <TD> " << is->_lib_name << " </TD>" << endl ;+    cout << "     <TD> " << is->_mean_in_cache << " </TD>" << endl ;+    cout << "     <TD> " << 100*(is->_mean_in_cache/best._mean_in_cache) << " </TD>" << endl ;+    cout << "     <TD> " << is->_mean_out_of_cache << " </TD>" << endl ;+    cout << "     <TD> " << 100*(is->_mean_out_of_cache/best._mean_out_of_cache) << " </TD>" << endl ;+    cout << "     <TD> " << +      "<a href=\"#"<<is->_lib_name<<"_"<<argv[1]<<"\">snippet</a>/" +      "<a href=\"#"<<is->_lib_name<<"_flags\">flags</a>  </TD>" << endl ;+    cout << "     <TD> " << +      "<a href=\"#"<<is->_lib_name<<"_comments\">click here</a>  </TD>" << endl ;+    cout << "  </TR>" << endl ;+  +  }++  cout << "</TABLE>" << endl ;++  ofstream output_file ("../order_lib",ios::out) ;+  +  for (is=s_lib_mean.begin(); is!=s_lib_mean.end() ; is++){+    output_file << is->_lib_name << endl ;+  }++  output_file.close();++}++double mean_calc(const vector<int> & tab_sizes, const vector<double> & tab_mflops, const int size_min, const int size_max){+  +  int size=tab_sizes.size();+  int nb_sample=0;+  double mean=0.0;++  for (int i=0;i<size;i++){+    +    +    if ((tab_sizes[i]>=size_min)&&(tab_sizes[i]<=size_max)){+      +      nb_sample++;+      mean+=tab_mflops[i];++    }++    +  }++  if (nb_sample==0){+    INFOS("no data for mean calculation");+    return 0.0;+  }++  return mean/nb_sample;+}++  ++
+ eigen3/bench/btl/data/mk_gnuplot_script.sh view
@@ -0,0 +1,68 @@+#! /bin/bash+WHAT=$1+DIR=$2+echo $WHAT script generation+cat $WHAT.hh > $WHAT.gnuplot++DATA_FILE=`find $DIR -name "*.dat" | grep $WHAT`++echo plot \\ >> $WHAT.gnuplot++for FILE in $DATA_FILE+do+    LAST=$FILE+done++echo LAST=$LAST++for FILE in $DATA_FILE+do+     if [ $FILE != $LAST ]+     then+	BASE=${FILE##*/} ; BASE=${FILE##*/} ; AVANT=bench_${WHAT}_ ; REDUC=${BASE##*$AVANT} ; TITLE=${REDUC%.dat}+	echo "'"$FILE"'" title "'"$TITLE"'" ",\\" >>  $WHAT.gnuplot+     fi+done+BASE=${LAST##*/} ; BASE=${FILE##*/} ; AVANT=bench_${WHAT}_ ; REDUC=${BASE##*$AVANT} ; TITLE=${REDUC%.dat}+echo "'"$LAST"'" title "'"$TITLE"'" >>  $WHAT.gnuplot++#echo set term postscript color >> $WHAT.gnuplot+#echo set output "'"$WHAT.ps"'" >> $WHAT.gnuplot+echo set term pbm small color >> $WHAT.gnuplot+echo set output "'"$WHAT.ppm"'" >> $WHAT.gnuplot+echo plot \\ >> $WHAT.gnuplot++for FILE in $DATA_FILE+do+     if [ $FILE != $LAST ]+     then+	BASE=${FILE##*/} ; BASE=${FILE##*/} ; AVANT=bench_${WHAT}_ ; REDUC=${BASE##*$AVANT} ; TITLE=${REDUC%.dat}+	echo "'"$FILE"'" title "'"$TITLE"'" ",\\" >>  $WHAT.gnuplot+     fi+done+BASE=${LAST##*/} ; BASE=${FILE##*/} ; AVANT=bench_${WHAT}_ ; REDUC=${BASE##*$AVANT} ; TITLE=${REDUC%.dat}+echo "'"$LAST"'" title "'"$TITLE"'" >>  $WHAT.gnuplot++echo set term jpeg large >> $WHAT.gnuplot+echo set output "'"$WHAT.jpg"'" >> $WHAT.gnuplot+echo plot \\ >> $WHAT.gnuplot++for FILE in $DATA_FILE+do+     if [ $FILE != $LAST ]+     then+	BASE=${FILE##*/} ; BASE=${FILE##*/} ; AVANT=bench_${WHAT}_ ; REDUC=${BASE##*$AVANT} ; TITLE=${REDUC%.dat}+	echo "'"$FILE"'" title "'"$TITLE"'" ",\\" >>  $WHAT.gnuplot+     fi+done+BASE=${LAST##*/} ; BASE=${FILE##*/} ; AVANT=bench_${WHAT}_ ; REDUC=${BASE##*$AVANT} ; TITLE=${REDUC%.dat}+echo "'"$LAST"'" title "'"$TITLE"'" >>  $WHAT.gnuplot+++gnuplot -persist < $WHAT.gnuplot++rm $WHAT.gnuplot++++
+ eigen3/bench/btl/data/mk_mean_script.sh view
@@ -0,0 +1,52 @@+#! /bin/bash+WHAT=$1+DIR=$2+MINIC=$3+MAXIC=$4+MINOC=$5+MAXOC=$6+prefix=$8++meanstatsfilename=$2/mean.html++WORK_DIR=tmp+mkdir $WORK_DIR++DATA_FILE=`find $DIR -name "*.dat" | grep _${WHAT}`++if [ -n "$DATA_FILE" ]; then++  echo ""+  echo "$1..."+  for FILE in $DATA_FILE+  do+          ##echo hello world+          ##echo "mk_mean_script1" ${FILE}+    BASE=${FILE##*/} ; BASE=${FILE##*/} ; AVANT=bench_${WHAT}_ ; REDUC=${BASE##*$AVANT} ; TITLE=${REDUC%.dat}++    ##echo "mk_mean_script1" ${TITLE}+    cp $FILE ${WORK_DIR}/${TITLE}++  done++  cd $WORK_DIR+  ../main $1 $3 $4 $5 $6 * >> ../$meanstatsfilename+  ../mk_new_gnuplot.sh $1 $2 $7+  rm -f *.gnuplot+  cd ..++  echo '<br/>' >> $meanstatsfilename++  webpagefilename=$2/index.html+  # echo '<h3>'${WHAT}'</h3>'  >> $webpagefilename+  echo '<hr/><a href="'$prefix$1'.pdf"><img src="'$prefix$1'.png" alt="'${WHAT}'" /></a><br/>'  >> $webpagefilename++fi++rm -R $WORK_DIR++++++
+ eigen3/bench/btl/data/mk_new_gnuplot.sh view
@@ -0,0 +1,54 @@+#!/bin/bash+WHAT=$1+DIR=$2++cat ../gnuplot_common_settings.hh > ${WHAT}.gnuplot++echo "set title " `grep ${WHAT} ../action_settings.txt | head -n 1 | cut -d ";" -f 2` >> $WHAT.gnuplot+echo "set xlabel " `grep ${WHAT} ../action_settings.txt | head -n 1 | cut -d ";" -f 3` " offset 0,0" >> $WHAT.gnuplot+echo "set xrange [" `grep ${WHAT} ../action_settings.txt | head -n 1 | cut -d ";" -f 4` "]" >> $WHAT.gnuplot++if [ $# > 3 ]; then+  if [ "$3" == "tiny" ]; then+    echo "set xrange [2:16]" >> $WHAT.gnuplot+    echo "set nologscale" >> $WHAT.gnuplot+  fi+fi++++DATA_FILE=`cat ../order_lib`+echo set term postscript color rounded enhanced >> $WHAT.gnuplot+echo set output "'"../${DIR}/$WHAT.ps"'" >> $WHAT.gnuplot++# echo set term svg color rounded enhanced >> $WHAT.gnuplot+# echo "set terminal svg enhanced size 1000 1000 fname \"Times\" fsize 36" >> $WHAT.gnuplot+# echo set output "'"../${DIR}/$WHAT.svg"'" >> $WHAT.gnuplot++echo plot \\ >> $WHAT.gnuplot++for FILE in $DATA_FILE+do+    LAST=$FILE+done++for FILE in $DATA_FILE+do+    BASE=${FILE##*/} ; BASE=${FILE##*/} ; AVANT=bench_${WHAT}_ ; REDUC=${BASE##*$AVANT} ; TITLE=${REDUC%.dat}++    echo "'"$FILE"'" `grep $TITLE ../perlib_plot_settings.txt | head -n 1 | cut -d ";" -f 2` "\\" >>  $WHAT.gnuplot+    if [ $FILE != $LAST ]+    then+      echo ", \\" >>  $WHAT.gnuplot+    fi+done+echo " " >>  $WHAT.gnuplot++gnuplot -persist < $WHAT.gnuplot++rm $WHAT.gnuplot++ps2pdf ../${DIR}/$WHAT.ps ../${DIR}/$WHAT.pdf+convert -background white -density 120 -rotate 90 -resize 800 +dither -colors 256 -quality 0 ../${DIR}/$WHAT.ps -background white -flatten  ../${DIR}/$WHAT.png++# pstoedit -rotate -90 -xscale 0.8 -yscale 0.8 -centered -yshift -50 -xshift -100  -f plot-svg aat.ps  aat2.svg
+ eigen3/bench/btl/data/perlib_plot_settings.txt view
@@ -0,0 +1,16 @@+eigen3 ;          with lines lw 4 lt 1 lc rgbcolor "black"+eigen2 ;          with lines lw 3 lt 1 lc rgbcolor "#999999"+EigenBLAS ;       with lines lw 3 lt 3 lc rgbcolor "#999999"+eigen3_novec ;    with lines lw 2 lt 1 lc rgbcolor "#999999"+eigen3_nogccvec ; with lines lw 2 lt 2 lc rgbcolor "#991010"+INTEL_MKL ;       with lines lw 3 lt 1 lc rgbcolor "#ff0000"+ATLAS ;           with lines lw 3 lt 1 lc rgbcolor "#008000"+gmm ;             with lines lw 3 lt 1 lc rgbcolor "#0000ff"+ublas ;           with lines lw 3 lt 1 lc rgbcolor "#00b7ff"+mtl4 ;            with lines lw 3 lt 1 lc rgbcolor "#d18847"+blitz ;           with lines lw 3 lt 1 lc rgbcolor "#ff00ff"+F77 ;             with lines lw 3 lt 3 lc rgbcolor "#e6e64c"+OPENBLAS ;        with lines lw 3 lt 1 lc rgbcolor "#C05600"+C ;               with lines lw 3 lt 3 lc rgbcolor "#e6bd96"+ACML ;            with lines lw 2 lt 3 lc rgbcolor "#e6e64c"+blaze ;           with lines lw 3 lt 1 lc rgbcolor "#ff00ff"
+ eigen3/bench/btl/data/regularize.cxx view
@@ -0,0 +1,131 @@+//=====================================================+// File   :  regularize.cxx+// Author :  L. Plagne <laurent.plagne@edf.fr)>        +// Copyright (C) EDF R&D,  lun sep 30 14:23:15 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 <vector>+#include <string>+#include <iostream>+#include <fstream>+#include "bench_parameter.hh"+#include <set>++using namespace std;++void read_xy_file(const string & filename, vector<int> & tab_sizes, vector<double> & tab_mflops);+void regularize_curve(const string & filename,+		      const vector<double> & tab_mflops, +		      const vector<int> & tab_sizes, +		      int start_cut_size, int stop_cut_size);+/////////////////////////////////////////////////////////////////////////////////////////////////++int main( int argc , char *argv[] )+{++  // input data++  if (argc<4){+    INFOS("!!! Error ... usage : main filename start_cut_size stop_cut_size regularize_filename");+    exit(0);+  }+  INFOS(argc);++  int start_cut_size=atoi(argv[2]);+  int stop_cut_size=atoi(argv[3]);++  string filename=argv[1];+  string regularize_filename=argv[4];+  +  INFOS(filename);+  INFOS("start_cut_size="<<start_cut_size);++  vector<int> tab_sizes;+  vector<double> tab_mflops;++  read_xy_file(filename,tab_sizes,tab_mflops);++  // regularizeing++  regularize_curve(regularize_filename,tab_mflops,tab_sizes,start_cut_size,stop_cut_size);+  ++}++//////////////////////////////////////////////////////////////////////////////////////++void regularize_curve(const string & filename,+		      const vector<double> & tab_mflops, +		      const vector<int> & tab_sizes, +		      int start_cut_size, int stop_cut_size)+{+  int size=tab_mflops.size();+  ofstream output_file (filename.c_str(),ios::out) ;++  int i=0;++  while(tab_sizes[i]<start_cut_size){+    +    output_file << tab_sizes[i] << " " <<  tab_mflops[i] << endl ;+    i++;++  }+    +  output_file << endl ;++  while(tab_sizes[i]<stop_cut_size){+    +    i++;++  }++  while(i<size){+    +    output_file << tab_sizes[i] << " " <<  tab_mflops[i] << endl ;+    i++;++  }++  output_file.close();++}++///////////////////////////////////////////////////////////////////////////////////////////////////////////////////++void read_xy_file(const string & filename, vector<int> & tab_sizes, vector<double> & tab_mflops){++  ifstream input_file (filename.c_str(),ios::in) ;++  if (!input_file){+    INFOS("!!! Error opening "<<filename);+    exit(0);+  }+  +  int nb_point=0;+  int size=0;+  double mflops=0;++  while (input_file >> size >> mflops ){+    nb_point++;+    tab_sizes.push_back(size);+    tab_mflops.push_back(mflops);+  }+  SCRUTE(nb_point);++  input_file.close();+}+
+ eigen3/bench/btl/data/smooth.cxx view
@@ -0,0 +1,198 @@+//=====================================================+// File   :  smooth.cxx+// Author :  L. Plagne <laurent.plagne@edf.fr)>        +// Copyright (C) EDF R&D,  lun sep 30 14:23:15 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 <vector>+#include <deque>+#include <string>+#include <iostream>+#include <fstream>+#include "bench_parameter.hh"+#include <set>++using namespace std;++void read_xy_file(const string & filename, vector<int> & tab_sizes, vector<double> & tab_mflops);+void write_xy_file(const string & filename, vector<int> & tab_sizes, vector<double> & tab_mflops);+void smooth_curve(const vector<double> & tab_mflops, vector<double> & smooth_tab_mflops,int window_half_width);+void centered_smooth_curve(const vector<double> & tab_mflops, vector<double> & smooth_tab_mflops,int window_half_width);++/////////////////////////////////////////////////////////////////////////////////////////////////++int main( int argc , char *argv[] )+{++  // input data++  if (argc<3){+    INFOS("!!! Error ... usage : main filename window_half_width smooth_filename");+    exit(0);+  }+  INFOS(argc);++  int window_half_width=atoi(argv[2]);++  string filename=argv[1];+  string smooth_filename=argv[3];+  +  INFOS(filename);+  INFOS("window_half_width="<<window_half_width);++  vector<int> tab_sizes;+  vector<double> tab_mflops;++  read_xy_file(filename,tab_sizes,tab_mflops);++  // smoothing++  vector<double> smooth_tab_mflops;++  //smooth_curve(tab_mflops,smooth_tab_mflops,window_half_width);+  centered_smooth_curve(tab_mflops,smooth_tab_mflops,window_half_width);++  // output result++  write_xy_file(smooth_filename,tab_sizes,smooth_tab_mflops);+  ++}++///////////////////////////////////////////////////////////////////////////////////////////////////////////////////++template<class VECTOR>+double weighted_mean(const VECTOR & data)+{++  double mean=0.0;+  +  for (int i=0 ; i<data.size() ; i++){++    mean+=data[i];++  }++  return mean/double(data.size()) ;++}    +++++///////////////////////////////////////////////////////////////////////////////////////////////////////////////////+++void smooth_curve(const vector<double> & tab_mflops, vector<double> & smooth_tab_mflops,int window_half_width){+  +  int window_width=2*window_half_width+1;++  int size=tab_mflops.size();++  vector<double> sample(window_width);+  +  for (int i=0 ; i < size ; i++){+    +    for ( int j=0 ; j < window_width ; j++ ){+      +      int shifted_index=i+j-window_half_width;+      if (shifted_index<0) shifted_index=0;+      if (shifted_index>size-1) shifted_index=size-1;+      sample[j]=tab_mflops[shifted_index];+      +    }++    smooth_tab_mflops.push_back(weighted_mean(sample));++  }++}++void centered_smooth_curve(const vector<double> & tab_mflops, vector<double> & smooth_tab_mflops,int window_half_width){+  +  int max_window_width=2*window_half_width+1;++  int size=tab_mflops.size();++  +  for (int i=0 ; i < size ; i++){++    deque<double> sample;++    +    sample.push_back(tab_mflops[i]);++    for ( int j=1 ; j <= window_half_width ; j++ ){+      +      int before=i-j;+      int after=i+j;+      +      if ((before>=0)&&(after<size)) // inside of the vector+	{ +	  sample.push_front(tab_mflops[before]);+	  sample.push_back(tab_mflops[after]);+	}+    }+    +    smooth_tab_mflops.push_back(weighted_mean(sample));+    +  }++}+++///////////////////////////////////////////////////////////////////////////////////////////////////////////////////++void write_xy_file(const string & filename, vector<int> & tab_sizes, vector<double> & tab_mflops){++  ofstream output_file (filename.c_str(),ios::out) ;+  +  for (int i=0 ; i < tab_sizes.size() ; i++)+    {+      output_file << tab_sizes[i] << " " <<  tab_mflops[i] << endl ;+    }+  +  output_file.close();++}+++///////////////////////////////////////////////////////////////////////////////////////////////////////////////////++void read_xy_file(const string & filename, vector<int> & tab_sizes, vector<double> & tab_mflops){++  ifstream input_file (filename.c_str(),ios::in) ;++  if (!input_file){+    INFOS("!!! Error opening "<<filename);+    exit(0);+  }+  +  int nb_point=0;+  int size=0;+  double mflops=0;++  while (input_file >> size >> mflops ){+    nb_point++;+    tab_sizes.push_back(size);+    tab_mflops.push_back(mflops);+  }+  SCRUTE(nb_point);++  input_file.close();+}+
+ eigen3/bench/btl/data/smooth_all.sh view
@@ -0,0 +1,68 @@+#! /bin/bash+ORIG_DIR=$1+SMOOTH_DIR=${ORIG_DIR}_smooth+mkdir ${SMOOTH_DIR}++AXPY_FILE=`find ${ORIG_DIR} -name "*.dat" | grep axpy`+for FILE in ${AXPY_FILE}+do+    echo $FILE+    BASE=${FILE##*/}+    ./smooth ${ORIG_DIR}/${BASE} 4 ${SMOOTH_DIR}/${BASE}_tmp+    ./regularize ${SMOOTH_DIR}/${BASE}_tmp 2500 15000 ${SMOOTH_DIR}/${BASE}+    rm -f  ${SMOOTH_DIR}/${BASE}_tmp+done+++MATRIX_VECTOR_FILE=`find ${ORIG_DIR} -name "*.dat" | grep matrix_vector`+for FILE in ${MATRIX_VECTOR_FILE}+do+    echo $FILE+    BASE=${FILE##*/}+    ./smooth ${ORIG_DIR}/${BASE} 4 ${SMOOTH_DIR}/${BASE}_tmp+    ./regularize ${SMOOTH_DIR}/${BASE}_tmp 50 180 ${SMOOTH_DIR}/${BASE}+    rm -f  ${SMOOTH_DIR}/${BASE}_tmp+done++MATRIX_MATRIX_FILE=`find ${ORIG_DIR} -name "*.dat" | grep matrix_matrix`+for FILE in ${MATRIX_MATRIX_FILE}+do+    echo $FILE+    BASE=${FILE##*/}+    ./smooth ${ORIG_DIR}/${BASE} 4 ${SMOOTH_DIR}/${BASE}+done++AAT_FILE=`find ${ORIG_DIR} -name "*.dat" | grep _aat`+for FILE in ${AAT_FILE}+do+    echo $FILE+    BASE=${FILE##*/}+    ./smooth ${ORIG_DIR}/${BASE} 4 ${SMOOTH_DIR}/${BASE}+done+++ATA_FILE=`find ${ORIG_DIR} -name "*.dat" | grep _ata`+for FILE in ${ATA_FILE}+do+    echo $FILE+    BASE=${FILE##*/}+    ./smooth ${ORIG_DIR}/${BASE} 4 ${SMOOTH_DIR}/${BASE}+done++### no smoothing for tinyvector and matrices libs++TINY_BLITZ_FILE=`find ${ORIG_DIR} -name "*.dat" | grep tiny_blitz`+for FILE in ${TINY_BLITZ_FILE}+do+    echo $FILE+    BASE=${FILE##*/}+    cp ${ORIG_DIR}/${BASE} ${SMOOTH_DIR}/${BASE}+done++TVMET_FILE=`find ${ORIG_DIR} -name "*.dat" | grep tvmet`+for FILE in ${TVMET_FILE}+do+    echo $FILE+    BASE=${FILE##*/}+    cp ${ORIG_DIR}/${BASE} ${SMOOTH_DIR}/${BASE}+done
+ eigen3/bench/btl/generic_bench/bench.hh view
@@ -0,0 +1,168 @@+//=====================================================+// File   :  bench.hh+// Author :  L. Plagne <laurent.plagne@edf.fr)>+// 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 <iostream>+#include "utilities.h"+#include "size_lin_log.hh"+#include "xy_file.hh"+#include <vector>+#include <string>+#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 <template<class> 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 " <<filename);++  // utilities++  std::vector<double> tab_mflops(nb_point);+  std::vector<int> tab_sizes(nb_point);++  // matrices and vector size calculations+  size_lin_log(nb_point,size_min,size_max,tab_sizes);++  std::vector<int> oldSizes;+  std::vector<double> oldFlops;+  bool hasOldResults = read_xy_file(filename, oldSizes, oldFlops, true);+  int oldi = oldSizes.size() - 1;++  // loop on matrix size+  Perf_Analyzer<Action> perf_action;+  for (int i=nb_point-1;i>=0;i--)+  {+    //INFOS("size=" <<tab_sizes[i]<<"   ("<<nb_point-i<<"/"<<nb_point<<")");+    std::cout << " " << "size = " << tab_sizes[i] << "  " << std::flush;++    BTL_DISABLE_SSE_EXCEPTIONS();+    #ifdef HAVE_MKL+    {+      float dummy;+      cblas_saxpy(1,0,&dummy,1,&dummy,1);+    }+    #endif++    tab_mflops[i] = perf_action.eval_mflops(tab_sizes[i]);+    std::cout << tab_mflops[i];+    +    if (hasOldResults)+    {+      while (oldi>=0 && oldSizes[oldi]>tab_sizes[i])+        --oldi;+      if (oldi>=0 && oldSizes[oldi]==tab_sizes[i])+      {+        if (oldFlops[oldi]<tab_mflops[i])+          std::cout << "\t > ";+        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<int> newSizes;+      std::vector<double> newFlops;+      unsigned int i=0;+      unsigned int j=0;+      while (i<tab_sizes.size() && j<oldSizes.size())+      {+        if (tab_sizes[i] == oldSizes[j])+        {+          newSizes.push_back(tab_sizes[i]);+          newFlops.push_back(std::max(tab_mflops[i], oldFlops[j]));+          ++i;+          ++j;+        }+        else if (tab_sizes[i] < oldSizes[j])+        {+          newSizes.push_back(tab_sizes[i]);+          newFlops.push_back(tab_mflops[i]);+          ++i;+        }+        else+        {+          newSizes.push_back(oldSizes[j]);+          newFlops.push_back(oldFlops[j]);+          ++j;+        }+      }+      while (i<tab_sizes.size())+      {+        newSizes.push_back(tab_sizes[i]);+        newFlops.push_back(tab_mflops[i]);+        ++i;+      }+      while (j<oldSizes.size())+      {+        newSizes.push_back(oldSizes[j]);+        newFlops.push_back(oldFlops[j]);+        ++j;+      }+      tab_mflops = newFlops;+      tab_sizes = newSizes;+    }+  }++  // dump the result in a file  :+  dump_xy_file(tab_sizes,tab_mflops,filename);++}++// default Perf Analyzer++template <class Action>+BTL_DONT_INLINE void bench( int size_min, int size_max, int nb_point ){++  // if the rdtsc is not available :+  bench<Portable_Perf_Analyzer,Action>(size_min,size_max,nb_point);+  // if the rdtsc is available :+//    bench<Mixed_Perf_Analyzer,Action>(size_min,size_max,nb_point);+++  // Only for small problem size. Otherwize it will be too long+//   bench<X86_Perf_Analyzer,Action>(size_min,size_max,nb_point);+//   bench<STL_Perf_Analyzer,Action>(size_min,size_max,nb_point);++}++#endif
+ eigen3/bench/btl/generic_bench/bench_parameter.hh view
@@ -0,0 +1,53 @@+//=====================================================+// File   :  bench_parameter.hh+// Author :  L. Plagne <laurent.plagne@edf.fr)>+// 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
+ eigen3/bench/btl/generic_bench/btl.hh view
@@ -0,0 +1,242 @@+//=====================================================+// File   :  btl.hh+// Copyright (C) 2008 Gael Guennebaud <gael.guennebaud@inria.fr>+//=====================================================+//+// 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 <iostream>+#include <algorithm>+#include <vector>+#include <string>+#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<const std::string&>(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<len && (at(i)==' '||at(i)=='\t'||at(i)=='\r'||at(i)=='\n'); ++lspaces,++i);++        if ( right && lspaces < len )+            for(i=len-1; i>=0 && (at(i)==' '||at(i)=='\t'||at(i)=='\r'||at(i)=='\n'); rspaces++,i--);++        *this = substr(lspaces, len-lspaces-rspaces);+    }++    std::vector<BtlString> split( const BtlString& delims = "\t\n ") const+    {+        std::vector<BtlString> 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)<this->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<int(*)(int)>(::tolower) );+        return *this;+    }+    BtlString toUpperCase( void )+    {+        std::transform(begin(), end(), begin(), static_cast<int(*)(int)>(::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<BtlString> elements = this->split("/\\");+        path = "";+        filename = elements.back();+        elements.pop_back();+        if (this->at(0)=='/')+            path = "/";+        for (unsigned int i=0 ; i<elements.size() ; ++i)+            path += elements[i] + "/";+    }+};++class BtlConfig+{+public:+  BtlConfig()+    : overwriteResults(false), checkResults(true), realclock(false), tries(DEFAULT_NB_TRIES)+  {+    char * _config;+    _config = getenv ("BTL_CONFIG");+    if (_config!=NULL)+    {+      std::vector<BtlString> config = BtlString(_config).split(" \t\n");+      for (unsigned int i = 0; i<config.size(); i++)+      {+        if (config[i].beginsWith("-a"))+        {+          if (i+1==config.size())+          {+            std::cerr << "error processing option: " << config[i] << "\n";+            exit(2);+          }+          Instance.m_selectedActionNames = config[i+1].split(":");++          i += 1;+        }+        else if (config[i].beginsWith("-t"))+        {+          if (i+1==config.size())+          {+            std::cerr << "error processing option: " << config[i] << "\n";+            exit(2);+          }+          Instance.tries = atoi(config[i+1].c_str());++          i += 1;+        }+        else if (config[i].beginsWith("--overwrite"))+        {+          Instance.overwriteResults = true;+        }+        else if (config[i].beginsWith("--nocheck"))+        {+          Instance.checkResults = false;+        }+        else if (config[i].beginsWith("--real"))+        {+          Instance.realclock = true;+        }+      }+    }++    BTL_DISABLE_SSE_EXCEPTIONS();+  }++  BTL_DONT_INLINE static bool skipAction(const std::string& _name)+  {+    if (Instance.m_selectedActionNames.empty())+      return false;++    BtlString name(_name);+    for (unsigned int i=0; i<Instance.m_selectedActionNames.size(); ++i)+      if (name.contains(Instance.m_selectedActionNames[i]))+        return false;++    return true;+  }++  static BtlConfig Instance;+  bool overwriteResults;+  bool checkResults;+  bool realclock;+  int tries;++protected:+  std::vector<BtlString> m_selectedActionNames;+};++#define BTL_MAIN \+  BtlConfig BtlConfig::Instance++#endif // BTL_HH
+ eigen3/bench/btl/generic_bench/init/init_function.hh view
@@ -0,0 +1,54 @@+//=====================================================+// File   :  init_function.hh+// Author :  L. Plagne <laurent.plagne@edf.fr)>        +// 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
+ eigen3/bench/btl/generic_bench/init/init_matrix.hh view
@@ -0,0 +1,64 @@+//=====================================================+// File   :  init_matrix.hh+// Author :  L. Plagne <laurent.plagne@edf.fr)>+// 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<double init_function(int,int), class Vector>+BTL_DONT_INLINE void init_row(Vector & X, int size, int row){++  X.resize(size);++  for (unsigned int j=0;j<X.size();j++){+    X[j]=typename Vector::value_type(init_function(row,j));+  }+}+++// Matrix is a Vector of Vector+// The Matrix class must satisfy the following part of STL vector concept :+//            resize() method+//            [] operator for setting rows+template<double init_function(int,int),class Vector>+BTL_DONT_INLINE void init_matrix(Vector &  A, int size){+  A.resize(size);+  for (unsigned int row=0; row<A.size() ; row++){+    init_row<init_function>(A[row],size,row);+  }+}++template<double init_function(int,int),class Matrix>+BTL_DONT_INLINE void init_matrix_symm(Matrix&  A, int size){+  A.resize(size);+  for (unsigned int row=0; row<A.size() ; row++)+    A[row].resize(size);+  for (unsigned int row=0; row<A.size() ; row++){+    A[row][row] = init_function(row,row);+    for (unsigned int col=0; col<row ; col++){+      double x = init_function(row,col);+      A[row][col] = A[col][row] = x;+    }+  }+}++#endif
+ eigen3/bench/btl/generic_bench/init/init_vector.hh view
@@ -0,0 +1,37 @@+//=====================================================+// File   :  init_vector.hh+// Author :  L. Plagne <laurent.plagne@edf.fr)>+// 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<double init_function(int), class Vector>+void init_vector(Vector & X, int size){++  X.resize(size);++  for (unsigned int i=0;i<X.size();i++){+    X[i]=typename Vector::value_type(init_function(i));+  }+}++#endif
+ eigen3/bench/btl/generic_bench/static/bench_static.hh view
@@ -0,0 +1,80 @@+//=====================================================+// File   :  bench_static.hh+// Author :  L. Plagne <laurent.plagne@edf.fr)>+// 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 <iostream>+#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 <template<class> class Perf_Analyzer, template<class> class Action, template<class,int> class Interface>+BTL_DONT_INLINE  void bench_static(void)+{+  if (BtlConfig::skipAction(Action<Interface<REAL_TYPE,10> >::name()))+    return;++  string filename = "bench_" + Action<Interface<REAL_TYPE,10> >::name() + ".dat";++  INFOS("starting " << filename);++  const int max_size = TINY_MV_MAX_SIZE;++  std::vector<double> tab_mflops;+  std::vector<double> tab_sizes;++  static_size_generator<max_size,Perf_Analyzer,Action,Interface>::go(tab_sizes,tab_mflops);++  dump_xy_file(tab_sizes,tab_mflops,filename);+}++// default Perf Analyzer+template <template<class> class Action, template<class,int> class Interface>+BTL_DONT_INLINE  void bench_static(void)+{+  bench_static<Portable_Perf_Analyzer,Action,Interface>();+  //bench_static<Mixed_Perf_Analyzer,Action,Interface>();+  //bench_static<X86_Perf_Analyzer,Action,Interface>();+}++#endif+++++++++++++++
+ eigen3/bench/btl/generic_bench/static/intel_bench_fixed_size.hh view
@@ -0,0 +1,66 @@+//=====================================================+// File   :  intel_bench_fixed_size.hh+// Author :  L. Plagne <laurent.plagne@edf.fr)>        +// Copyright (C) EDF R&D,  mar déc 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 <class Action>+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="<<nb_init);+    //INFOS("time_baseline="<<time_baseline);+    nb_init*=2;+    time_baseline=time_init(nb_init,action);+  }+  +  time_baseline=time_baseline/(double(nb_init));+  +  double time_action=time_calculate(nb_calc,action);+  +  while (time_action < MIN_TIME) {+    +    nb_calc*=2;+    time_action=time_calculate(nb_calc,action);+  }++  INFOS("nb_init="<<nb_init);+  INFOS("nb_calc="<<nb_calc);+  +  +  time_action=time_action/(double(nb_calc));+  +  action.check_result();+  +  time_action=time_action-time_baseline;++  return action.nb_op_base()/(time_action*1000000.0);++}++#endif
+ eigen3/bench/btl/generic_bench/static/static_size_generator.hh view
@@ -0,0 +1,57 @@+//=====================================================+// File   :  static_size_generator.hh+// Author :  L. Plagne <laurent.plagne@edf.fr)>        +// Copyright (C) EDF R&D,  mar déc 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 _STATIC_SIZE_GENERATOR_HH+#define _STATIC_SIZE_GENERATOR_HH+#include <vector>++using namespace std;++//recursive generation of statically defined matrix and vector sizes++template <int SIZE,template<class> class Perf_Analyzer, template<class> class Action, template<class,int> class Interface> +struct static_size_generator{+  static void go(vector<double> & tab_sizes, vector<double> & tab_mflops)+  {+    tab_sizes.push_back(SIZE);+    std::cout << tab_sizes.back() << " \t" << std::flush;+    Perf_Analyzer<Action<Interface<REAL_TYPE,SIZE> > > perf_action;+    tab_mflops.push_back(perf_action.eval_mflops(SIZE));+    std::cout << tab_mflops.back() << " MFlops" << std::endl;+    static_size_generator<SIZE-1,Perf_Analyzer,Action,Interface>::go(tab_sizes,tab_mflops);+  };+};++//recursion end++template <template<class> class Perf_Analyzer, template<class> class Action, template<class,int> class Interface> +struct static_size_generator<1,Perf_Analyzer,Action,Interface>{  +  static  void go(vector<double> & tab_sizes, vector<double> & tab_mflops)+  {+    tab_sizes.push_back(1);+    Perf_Analyzer<Action<Interface<REAL_TYPE,1> > > perf_action;+    tab_mflops.push_back(perf_action.eval_mflops(1));+  };+};++#endif+  +  +  +  
+ eigen3/bench/btl/generic_bench/timers/STL_perf_analyzer.hh view
@@ -0,0 +1,82 @@+//=====================================================+// File   :  STL_perf_analyzer.hh+// Author :  L. Plagne <laurent.plagne@edf.fr)>        +// 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 _STL_PERF_ANALYSER_HH+#define _STL_PERF_ANALYSER_HH++#include "STL_timer.hh"+#include "bench_parameter.hh"++template<class ACTION>+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 <<" "<<baseline_time<<" "<<calculate_time<<" "<<corrected_time<<" "<<action.nb_op_base() << endl;    +    +    return action.nb_op_base()/(corrected_time*1000000.0);+    //return action.nb_op_base()/(calculate_time*1000000.0);+    +  }+private:++  STL_Timer _chronos;+  unsigned long long _nb_sample;++  +};++  +  +#endif
+ eigen3/bench/btl/generic_bench/timers/STL_timer.hh view
@@ -0,0 +1,78 @@+//=====================================================+// File   :  STL_Timer.hh+// Author :  L. Plagne <laurent.plagne@edf.fr)>        +// 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.+// +// 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 <iostream>+#include <iomanip>+#include <vector>+#include <map>+#include <algorithm>+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<long> 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;+};+
+ eigen3/bench/btl/generic_bench/timers/mixed_perf_analyzer.hh view
@@ -0,0 +1,73 @@+//=====================================================+// File   :  mixed_perf_analyzer.hh+// Author :  L. Plagne <laurent.plagne@edf.fr)>        +// Copyright (C) EDF R&D,  mar déc 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 Action>+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<Action> _ppa;+  X86_Perf_Analyzer<Action> _x86pa;+  bool _use_ppa;++};++#endif++  +    +  
+ eigen3/bench/btl/generic_bench/timers/portable_perf_analyzer.hh view
@@ -0,0 +1,103 @@+//=====================================================+// File   :  portable_perf_analyzer.hh+// Author :  L. Plagne <laurent.plagne@edf.fr)>+// Copyright (C) EDF R&D,  mar d�c 3 18:59:35 CET 2002+// Copyright (C) 2008 Gael Guennebaud <gael.guennebaud@inria.fr>+//=====================================================+//+// 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 Action>+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<BtlConfig::Instance.tries; ++i)+    {+      Action _action(size);+      std::cout << " " << _action.nb_op_base()*_nb_calc/(m_time_action*1e6) << " ";+      _action.initialize();+      m_time_action = std::min(m_time_action, time_calculate(_action));+    }++    double time_action = m_time_action / (double(_nb_calc));++    // check+    if (BtlConfig::Instance.checkResults && size<128)+    {+      action.initialize();+      action.calculate();+      action.check_result();+    }+    return action.nb_op_base()/(time_action*1e6);+  }++  BTL_DONT_INLINE double time_calculate(Action & action)+  {+    // time measurement+    action.calculate();+    _chronos.start();+    for (unsigned int ii=0;ii<_nb_calc;ii++)+    {+      action.calculate();+    }+    _chronos.stop();+    return _chronos.user_time();+  }++  unsigned long long get_nb_calc()+  {+    return _nb_calc;+  }+++private:+  unsigned long long _nb_calc;+  double m_time_action;+  Portable_Timer _chronos;++};++#endif //_PORTABLE_PERF_ANALYZER_HH+
+ eigen3/bench/btl/generic_bench/timers/portable_perf_analyzer_old.hh view
@@ -0,0 +1,134 @@+//=====================================================+// File   :  portable_perf_analyzer.hh+// Author :  L. Plagne <laurent.plagne@edf.fr)>+// 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 Action>+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<NB_TRIES; ++i)+//       time_baseline = std::min(time_baseline, time_init(action));+//+//     time_baseline = time_baseline/(double(_nb_init));++    double time_action = time_calculate(action);+    while (time_action < MIN_TIME)+    {+      _nb_calc *= 2;+      time_action = time_calculate(action);+    }++    // optimize+    for (int i=1; i<NB_TRIES; ++i)+      time_action = std::min(time_action, time_calculate(action));++//     INFOS("size="<<size);+//     INFOS("_nb_init="<<_nb_init);+//     INFOS("_nb_calc="<<_nb_calc);++    time_action = time_action / (double(_nb_calc));++    action.check_result();+++    double time_baseline = time_init(action);+    for (int i=1; i<NB_TRIES; ++i)+      time_baseline = std::min(time_baseline, time_init(action));+    time_baseline = time_baseline/(double(_nb_init));++++//     INFOS("time_baseline="<<time_baseline);+//     INFOS("time_action="<<time_action);++    time_action = time_action - time_baseline;++//     INFOS("time_corrected="<<time_action);++    return action.nb_op_base()/(time_action*1000000.0);+  }++  inline double time_init(Action & action)+  {+    // time measurement+    _chronos.start();+    for (int ii=0; ii<_nb_init; ii++)+      action.initialize();+    _chronos.stop();+    return _chronos.user_time();+  }+++  inline double time_calculate(Action & action)+  {+    // time measurement+    _chronos.start();+    for (int ii=0;ii<_nb_calc;ii++)+    {+      action.initialize();+      action.calculate();+    }+    _chronos.stop();+    return _chronos.user_time();+  }++  unsigned long long get_nb_calc( void )+  {+    return _nb_calc;+  }+++private:+  unsigned long long _nb_calc;+  unsigned long long _nb_init;+  Portable_Timer _chronos;++};++#endif //_PORTABLE_PERF_ANALYZER_HH
+ eigen3/bench/btl/generic_bench/timers/portable_timer.hh view
@@ -0,0 +1,187 @@+//=====================================================+// File   :  portable_timer.hh+// Author :  L. Plagne <laurent.plagne@edf.fr)> from boost lib+// Copyright (C) EDF R&D,  lun sep 30 14:23:17 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.+//+//  simple_time extracted from the boost library+//+#ifndef _PORTABLE_TIMER_HH+#define _PORTABLE_TIMER_HH++#include <ctime>+#include <cstdlib>++#include <time.h>+++#define USEC_IN_SEC 1000000+++//  timer  -------------------------------------------------------------------//++//  A timer object measures CPU time.+#if defined(_MSC_VER)++#define NOMINMAX+#include <windows.h>++/*#ifndef hr_timer+#include "hr_time.h"+#define hr_timer+#endif*/++ class Portable_Timer+ {+  public:++   typedef struct {+    LARGE_INTEGER start;+    LARGE_INTEGER stop;+   } stopWatch;+++   Portable_Timer()+   {+	 startVal.QuadPart = 0;+	 stopVal.QuadPart = 0;+	 QueryPerformanceFrequency(&frequency);+   }++   void start() { QueryPerformanceCounter(&startVal); }++   void stop() { QueryPerformanceCounter(&stopVal); }++   double elapsed() {+	 LARGE_INTEGER time;+     time.QuadPart = stopVal.QuadPart - startVal.QuadPart;+     return LIToSecs(time);+   }++   double user_time() { return elapsed(); }+++ private:++   double LIToSecs(LARGE_INTEGER& L) {+     return ((double)L.QuadPart /(double)frequency.QuadPart) ;+   }++   LARGE_INTEGER startVal;+   LARGE_INTEGER stopVal;+   LARGE_INTEGER frequency;+++ }; // Portable_Timer++#elif defined(__APPLE__)+#include <CoreServices/CoreServices.h>+#include <mach/mach_time.h>+++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 <sys/time.h>+#include <sys/resource.h>+#include <unistd.h>+#include <sys/times.h>++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
+ eigen3/bench/btl/generic_bench/timers/x86_perf_analyzer.hh view
@@ -0,0 +1,108 @@+//=====================================================+// File   :  x86_perf_analyzer.hh+// Author :  L. Plagne <laurent.plagne@edf.fr)>+// 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 ACTION>+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="<<baseline_time);+//     INFOS("calculate_time="<<calculate_time);+//     INFOS("corrected_time="<<corrected_time);++//    cout << size <<" "<<baseline_time<<" "<<calculate_time<<" "<<corrected_time<<" "<<action.nb_op_base() << endl;++    return action.nb_op_base()/(corrected_time*1000000.0);+    //return action.nb_op_base()/(calculate_time*1000000.0);+  }++private:++  X86_Timer _chronos;+  unsigned long long _nb_sample;+++};++++#endif
+ eigen3/bench/btl/generic_bench/timers/x86_timer.hh view
@@ -0,0 +1,246 @@+//=====================================================+// File   :  x86_timer.hh+// Author :  L. Plagne <laurent.plagne@edf.fr)>        +// 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 <sys/time.h>+#include <sys/resource.h>+#include <unistd.h>+#include <sys/times.h>+//#include "system_time.h"+#define u32 unsigned int+#include <asm/msr.h>+#include "utilities.h"+#include <map>+#include <fstream>+#include <string>+#include <iostream>++// 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<unsigned long long , unsigned long long>::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<unsigned long long,unsigned long long>::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<unsigned long long,unsigned long long>::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<unsigned long long,unsigned long long> _counted_clicks;++  vector<double> _history_mean_clicks;+  vector<double> _history_shortest_clicks;+  vector<double> _history_most_occured_clicks;++  unsigned long long _nb_sample;++  ++};+++#endif
+ eigen3/bench/btl/generic_bench/utils/size_lin_log.hh view
@@ -0,0 +1,70 @@+//=====================================================+// File   :  size_lin_log.hh+// Author :  L. Plagne <laurent.plagne@edf.fr)>        +// Copyright (C) EDF R&D,  mar déc 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<class Vector>+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<nine;i++){+      +      X[i]=i+1;++    }++    Vector log_size;+    size_log(nb_point-nine,ten,size_max,log_size);++    for (int i=0;i<nb_point-nine;i++){+      +      X[i+nine]=log_size[i];++    }+  }+  else{++    for (int i=0;i<nb_point;i++){+      +      X[i]=i+1;++    }+  }++ //  for (int i=0;i<nb_point;i++){+    +//        INFOS("computed sizes : X["<<i<<"]="<<X[i]);+    +//   }++}+  +#endif+    ++
+ eigen3/bench/btl/generic_bench/utils/size_log.hh view
@@ -0,0 +1,54 @@+//=====================================================+// File   :  size_log.hh+// Author :  L. Plagne <laurent.plagne@edf.fr)>        +// Copyright (C) EDF R&D,  lun sep 30 14:23:17 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 SIZE_LOG+#define SIZE_LOG++#include "math.h"+// The Vector class must satisfy the following part of STL vector concept :+//            resize() method+//            [] operator for seting element+// the vector element are int compatible.+template<class Vector>+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<nb_point;i++){++    ls = ls_min + float(i)*delta_ls ;+    +    size=int(exp(ls)); ++    X[i]=size;+  }++}+++#endif
+ eigen3/bench/btl/generic_bench/utils/utilities.h view
@@ -0,0 +1,90 @@+//=============================================================================+// File      : utilities.h+// Created   : mar jun 19 13:18:14 CEST 2001+// Author    : Antoine YESSAYAN, Paul RASCLE, EDF+// Project   : SALOME+// Copyright : EDF 2001+// $Header$+//=============================================================================++/* ---  Definition macros file to print information if _DEBUG_ is defined --- */++# ifndef UTILITIES_H+# define UTILITIES_H++# include <stdlib.h>+//# include <iostream> ok for gcc3.01+# include <iostream>++/* ---  INFOS is always defined (without _DEBUG_): to be used for warnings, with release version --- */++# define HEREWEARE cout<<flush ; cerr << __FILE__ << " [" << __LINE__ << "] : " << flush ;+# define INFOS(chain) {HEREWEARE ; cerr << chain << endl ;}+# define PYSCRIPT(chain) {cout<<flush ; cerr << "---PYSCRIPT--- " << chain << endl ;}++/* --- To print date and time of compilation of current source on stdout --- */++# if defined ( __GNUC__ )+# define COMPILER		"g++" ;+# elif defined ( __sun )+# define COMPILER		"CC" ;+# elif defined ( __KCC )+# define COMPILER		"KCC" ;+# elif defined ( __PGI )+# define COMPILER		"pgCC" ;+# else+# define COMPILER		"undefined" ;+# endif++# ifdef INFOS_COMPILATION+# error INFOS_COMPILATION already defined+# endif+# define INFOS_COMPILATION	{\+					cerr << flush;\+					cout << __FILE__ ;\+					cout << " [" << __LINE__ << "] : " ;\+					cout << "COMPILED with " << COMPILER ;\+					cout << ", " << __DATE__ ; \+					cout << " at " << __TIME__ << endl ;\+					cout << "\n\n" ;\+					cout << flush ;\+				}++# ifdef _DEBUG_++/* --- the following MACROS are useful at debug time --- */++# define HERE cout<<flush ; cerr << "- Trace " << __FILE__ << " [" << __LINE__ << "] : " << flush ;+# define SCRUTE(var) HERE ; cerr << #var << "=" << var << endl ;+# define MESSAGE(chain) {HERE ; cerr << chain << endl ;}+# define INTERRUPTION(code) HERE ; cerr << "INTERRUPTION return code= " << code << endl ; exit(code) ;++# ifndef ASSERT+# define ASSERT(condition) if (!(condition)){ HERE ; cerr << "CONDITION " << #condition << " NOT VERIFIED"<< endl ; INTERRUPTION(1) ;}+# endif /* ASSERT */++#define REPERE cout<<flush ; cerr << "   --------------" << endl << flush ;+#define BEGIN_OF(chain) {REPERE ; HERE ; cerr << "Begin of: " << chain << endl ; REPERE ; }+#define END_OF(chain) {REPERE ; HERE ; cerr << "Normal end of: " << chain << endl ; REPERE ; }++++# else /* ifdef _DEBUG_*/++# define HERE+# define SCRUTE(var)+# define MESSAGE(chain)+# define INTERRUPTION(code)++# ifndef ASSERT+# define ASSERT(condition)+# endif /* ASSERT */++#define REPERE+#define BEGIN_OF(chain)+#define END_OF(chain)+++# endif /* ifdef _DEBUG_*/++# endif /* ifndef UTILITIES_H */
+ eigen3/bench/btl/generic_bench/utils/xy_file.hh view
@@ -0,0 +1,75 @@+//=====================================================+// File   :  dump_file_x_y.hh+// Author :  L. Plagne <laurent.plagne@edf.fr)>        +// 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 <fstream>+#include <iostream>+#include <string>+#include <vector>+using namespace std;++bool read_xy_file(const std::string & filename, std::vector<int> & tab_sizes,+                  std::vector<double> & tab_mflops, bool quiet = false)+{++  std::ifstream input_file (filename.c_str(),std::ios::in);++  if (!input_file){+    if (!quiet) {+      INFOS("!!! Error opening "<<filename);+    }+    return false;+  }++  int nb_point=0;+  int size=0;+  double mflops=0;++  while (input_file >> 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 seting element+// the vector element must have the << operator define++using namespace std;++template<class Vector_A, class Vector_B>+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<size;i++)+    outfile << X[i] << " " << Y[i] << endl;++  outfile.close();+} ++#endif
+ eigen3/bench/btl/libs/BLAS/CMakeLists.txt view
@@ -0,0 +1,47 @@++find_package(ATLAS)+if (ATLAS_FOUND)+  btl_add_bench(btl_atlas main.cpp)+  if(BUILD_btl_atlas)+    target_link_libraries(btl_atlas ${ATLAS_LIBRARIES})+    set_target_properties(btl_atlas PROPERTIES COMPILE_FLAGS "-DCBLASNAME=ATLAS -DHAS_LAPACK=1")+  endif(BUILD_btl_atlas)+endif (ATLAS_FOUND)++find_package(MKL)+if (MKL_FOUND)+  btl_add_bench(btl_mkl main.cpp)+  if(BUILD_btl_mkl)+    target_link_libraries(btl_mkl ${MKL_LIBRARIES})+    set_target_properties(btl_mkl PROPERTIES COMPILE_FLAGS "-DCBLASNAME=INTEL_MKL -DHAS_LAPACK=1")+  endif(BUILD_btl_mkl)+endif (MKL_FOUND)+++find_package(OPENBLAS)+if (OPENBLAS_FOUND)+  btl_add_bench(btl_openblas main.cpp)+  if(BUILD_btl_openblas)+    target_link_libraries(btl_openblas ${OPENBLAS_LIBRARIES} )+    set_target_properties(btl_openblas PROPERTIES COMPILE_FLAGS "-DCBLASNAME=OPENBLAS")+  endif(BUILD_btl_openblas)+endif (OPENBLAS_FOUND)++find_package(ACML)+if (ACML_FOUND)+  btl_add_bench(btl_acml main.cpp)+  if(BUILD_btl_acml)+    target_link_libraries(btl_acml ${ACML_LIBRARIES} )+    set_target_properties(btl_acml PROPERTIES COMPILE_FLAGS "-DCBLASNAME=ACML -DHAS_LAPACK=1")+  endif(BUILD_btl_acml)+endif (ACML_FOUND)++if(Eigen_SOURCE_DIR AND CMAKE_Fortran_COMPILER_WORKS)+  # we are inside Eigen and blas/lapack interface is compilable+  include_directories(${Eigen_SOURCE_DIR})+  btl_add_bench(btl_eigenblas main.cpp)+  if(BUILD_btl_eigenblas)+    target_link_libraries(btl_eigenblas eigen_blas eigen_lapack )+    set_target_properties(btl_eigenblas PROPERTIES COMPILE_FLAGS "-DCBLASNAME=EigenBLAS")+  endif()+endif()
+ eigen3/bench/btl/libs/BLAS/blas.h view
@@ -0,0 +1,675 @@+#ifndef BLAS_H+#define BLAS_H++#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 *);++#if defined(F_INTERFACE_GFORT) && !defined(__64BIT__)+int   BLASFUNC(cdotu)  (int *, float  * , int *, float  *,  int *);+int   BLASFUNC(cdotc)  (int *, float  *,  int *, float  *,  int *);+void  BLASFUNC(zdotu)  (double *, int *, double  *, int *, double  *, int *);+void  BLASFUNC(zdotc)  (double *, int *, double  *, int *, double  *, int *);+void  BLASFUNC(xdotu)  (double *, int *, double  *, int *, double  *, int *);+void  BLASFUNC(xdotc)  (double *, int *, double  *, int *, double  *, int *);+#elif  defined(F_INTERFACE_F2C) || \+     defined(F_INTERFACE_PGI) || \+     defined(F_INTERFACE_GFORT) || \+    (defined(F_INTERFACE_PATHSCALE) && defined(__64BIT__))+void  BLASFUNC(cdotu)  (float *,  int *, float  * , int *, float  *,  int *);+void  BLASFUNC(cdotc)  (float *,  int *, float  *,  int *, float  *,  int *);+void  BLASFUNC(zdotu)  (double *, int *, double  *, int *, double  *, int *);+void  BLASFUNC(zdotc)  (double *, int *, double  *, int *, double  *, int *);+void  BLASFUNC(xdotu)  (double *, int *, double  *, int *, double  *, int *);+void  BLASFUNC(xdotc)  (double *, int *, double  *, int *, double  *, int *);+#else+std::complex<float>   BLASFUNC(cdotu)  (int *, float  *, int *, float  *, int *);+std::complex<float>   BLASFUNC(cdotc)  (int *, float  *, int *, float  *, int *);+std::complex<double>  BLASFUNC(zdotu)  (int *, double  *, int *, double  *, int *);+std::complex<double>  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
+ eigen3/bench/btl/libs/BLAS/blas_interface.hh view
@@ -0,0 +1,83 @@+//=====================================================+// File   :  blas_interface.hh+// Author :  L. Plagne <laurent.plagne@edf.fr)>+// 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 <c_interface_base.h>+#include <complex>+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 real> 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+++
+ eigen3/bench/btl/libs/BLAS/blas_interface_impl.hh view
@@ -0,0 +1,147 @@++#define BLAS_FUNC(NAME) CAT(CAT(SCALAR_PREFIX,NAME),_)++template<> class blas_interface<SCALAR> : public c_interface_base<SCALAR>+{++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)(&notrans,&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)(&notrans,&notrans,&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)(&notrans,&notrans,&N,&N,&N,&fone,A,&N,B,&N,&fzero,X,&N);+  }++//   static inline void ata_product(gene_matrix & A, gene_matrix & X, int N){+//     ssyrk_(&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,&notrans,&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, &notrans, &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, &notrans, &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, &notrans,&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<SCALAR>::fone = SCALAR(1);+SCALAR blas_interface<SCALAR>::fzero = SCALAR(0);
+ eigen3/bench/btl/libs/BLAS/c_interface_base.h view
@@ -0,0 +1,73 @@++#ifndef BTL_C_INTERFACE_BASE_H+#define BTL_C_INTERFACE_BASE_H++#include "utilities.h"+#include <vector>++template<class real> class c_interface_base+{++public:++  typedef real                      real_type;+  typedef std::vector<real>         stl_vector;+  typedef std::vector<stl_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<N;j++)+      for (int i=0;i<N;i++)+        A[i+N*j] = A_stl[j][i];+  }++  static inline void vector_from_stl(gene_vector & B, stl_vector & B_stl){+    int N = B_stl.size();+    B = new real[N];+    for (int i=0;i<N;i++)+      B[i] = B_stl[i];+  }++  static inline void vector_to_stl(gene_vector & B, stl_vector & B_stl){+    int N = B_stl.size();+    for (int i=0;i<N;i++)+      B_stl[i] = B[i];+  }++  static inline void matrix_to_stl(gene_matrix & A, stl_matrix & A_stl){+    int N = A_stl.size();+    for (int j=0;j<N;j++){+      A_stl[j].resize(N);+      for (int i=0;i<N;i++)+        A_stl[j][i] = A[i+N*j];+    }+  }++  static inline void copy_vector(const gene_vector & source, gene_vector & cible, int N){+    for (int i=0;i<N;i++)+      cible[i]=source[i];+  }++  static inline void copy_matrix(const gene_matrix & source, gene_matrix & cible, int N){+    for (int j=0;j<N;j++){+      for (int i=0;i<N;i++){+        cible[i+N*j] = source[i+N*j];+      }+    }+  }++};++#endif
+ eigen3/bench/btl/libs/BLAS/main.cpp view
@@ -0,0 +1,73 @@+//=====================================================+// File   :  main.cpp+// Author :  L. Plagne <laurent.plagne@edf.fr)>+// 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<Action_axpy<blas_interface<REAL_TYPE> > >(MIN_AXPY,MAX_AXPY,NB_POINT);+  bench<Action_axpby<blas_interface<REAL_TYPE> > >(MIN_AXPY,MAX_AXPY,NB_POINT);++  bench<Action_matrix_vector_product<blas_interface<REAL_TYPE> > >(MIN_MV,MAX_MV,NB_POINT);+  bench<Action_atv_product<blas_interface<REAL_TYPE> > >(MIN_MV,MAX_MV,NB_POINT);+  bench<Action_symv<blas_interface<REAL_TYPE> > >(MIN_MV,MAX_MV,NB_POINT);+  bench<Action_syr2<blas_interface<REAL_TYPE> > >(MIN_MV,MAX_MV,NB_POINT);++  bench<Action_ger<blas_interface<REAL_TYPE> > >(MIN_MV,MAX_MV,NB_POINT);+  bench<Action_rot<blas_interface<REAL_TYPE> > >(MIN_AXPY,MAX_AXPY,NB_POINT);++  bench<Action_matrix_matrix_product<blas_interface<REAL_TYPE> > >(MIN_MM,MAX_MM,NB_POINT);+//   bench<Action_ata_product<blas_interface<REAL_TYPE> > >(MIN_MM,MAX_MM,NB_POINT);+  bench<Action_aat_product<blas_interface<REAL_TYPE> > >(MIN_MM,MAX_MM,NB_POINT);++  bench<Action_trisolve<blas_interface<REAL_TYPE> > >(MIN_MM,MAX_MM,NB_POINT);+  bench<Action_trisolve_matrix<blas_interface<REAL_TYPE> > >(MIN_MM,MAX_MM,NB_POINT);++  bench<Action_trmm<blas_interface<REAL_TYPE> > >(MIN_MM,MAX_MM,NB_POINT);++  bench<Action_cholesky<blas_interface<REAL_TYPE> > >(MIN_LU,MAX_LU,NB_POINT);+  bench<Action_partial_lu<blas_interface<REAL_TYPE> > >(MIN_LU,MAX_LU,NB_POINT);++  #ifdef HAS_LAPACK+//   bench<Action_lu_decomp<blas_interface<REAL_TYPE> > >(MIN_LU,MAX_LU,NB_POINT);+  bench<Action_hessenberg<blas_interface<REAL_TYPE> > >(MIN_LU,MAX_LU,NB_POINT);+  bench<Action_tridiagonalization<blas_interface<REAL_TYPE> > >(MIN_LU,MAX_LU,NB_POINT);+  #endif++  //bench<Action_lu_solve<blas_LU_solve_interface<REAL_TYPE> > >(MIN_LU,MAX_LU,NB_POINT);++  return 0;+}++
+ eigen3/bench/btl/libs/STL/CMakeLists.txt view
@@ -0,0 +1,2 @@++btl_add_bench(btl_STL main.cpp OFF)
+ eigen3/bench/btl/libs/STL/STL_interface.hh view
@@ -0,0 +1,244 @@+//=====================================================+// File   :  STL_interface.hh+// Author :  L. Plagne <laurent.plagne@edf.fr)>+// 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 <string>+#include <vector>+#include "utilities.h"++using namespace std;++template<class real>+class STL_interface{++public :++  typedef real real_type ;++  typedef std::vector<real>  stl_vector;+  typedef std::vector<stl_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<N;i++){+      cible[i]=source[i];+    }+  }+++  static inline void copy_matrix(const gene_matrix & source, gene_matrix & cible, int N){+    for (int i=0;i<N;i++)+      for (int j=0;j<N;j++)+        cible[i][j]=source[i][j];+  }++//   static inline void ata_product(const gene_matrix & A, gene_matrix & X, int N)+//   {+//     real somme;+//     for (int j=0;j<N;j++){+//       for (int i=0;i<N;i++){+//         somme=0.0;+//         for (int k=0;k<N;k++)+//           somme += A[i][k]*A[j][k];+//         X[j][i]=somme;+//       }+//     }+//   }++  static inline void aat_product(const gene_matrix & A, gene_matrix & X, int N)+  {+    real somme;+    for (int j=0;j<N;j++){+      for (int i=0;i<N;i++){+        somme=0.0;+        if(i>=j)+        {+          for (int k=0;k<N;k++){+            somme+=A[k][i]*A[k][j];+          }+          X[j][i]=somme;+        }+      }+    }+  }+++  static inline void matrix_matrix_product(const gene_matrix & A, const gene_matrix & B, gene_matrix & X, int N)+  {+    real somme;+    for (int j=0;j<N;j++){+      for (int i=0;i<N;i++){+        somme=0.0;+        for (int k=0;k<N;k++)+          somme+=A[k][i]*B[j][k];+        X[j][i]=somme;+      }+    }+  }++  static inline void matrix_vector_product(gene_matrix & A, gene_vector & B, gene_vector & X, int N)+  {+    real somme;+    for (int i=0;i<N;i++){+      somme=0.0;+      for (int j=0;j<N;j++)+        somme+=A[j][i]*B[j];+      X[i]=somme;+    }+  }++  static inline void symv(gene_matrix & A, gene_vector & B, gene_vector & X, int N)+  {+    for (int j=0; j<N; ++j)+      X[j] = 0;+    for (int j=0; j<N; ++j)+    {+      real t1 = B[j];+      real t2 = 0;+      X[j] += t1 * A[j][j];+      for (int i=j+1; i<N; ++i) {+        X[i] += t1 * A[j][i];+        t2 += A[j][i] * B[i];+      }+      X[j] += t2;+    }+  }+  +  static inline void syr2(gene_matrix & A, gene_vector & B, gene_vector & X, int N)+  {+    for (int j=0; j<N; ++j)+    {+      for (int i=j; i<N; ++i)+        A[j][i] += B[i]*X[j] + B[j]*X[i];+    }+  }++  static inline void ger(gene_matrix & A, gene_vector & X, gene_vector & Y, int N)+  {+    for (int j=0; j<N; ++j)+    {+      for (int i=j; i<N; ++i)+        A[j][i] += X[i]*Y[j];+    }+  }++  static inline void atv_product(gene_matrix & A, gene_vector & B, gene_vector & X, int N)+  {+    real somme;+    for (int i=0;i<N;i++){+      somme = 0.0;+      for (int j=0;j<N;j++)+        somme += A[i][j]*B[j];+      X[i] = somme;+    }+  }++  static inline void axpy(real coef, const gene_vector & X, gene_vector & Y, int N){+    for (int i=0;i<N;i++)+      Y[i]+=coef*X[i];+  }++  static inline void axpby(real a, const gene_vector & X, real b, gene_vector & Y, int N){+    for (int i=0;i<N;i++)+      Y[i] = a*X[i] + b*Y[i];+  }++  static inline void trisolve_lower(const gene_matrix & L, const gene_vector & B, gene_vector & X, int N){+    copy_vector(B,X,N);+    for(int i=0; i<N; ++i)+    {+      X[i] /= L[i][i];+      real tmp = X[i];+      for (int j=i+1; j<N; ++j)+        X[j] -= tmp * L[i][j];+    }+  }++  static inline real norm_diff(const stl_vector & A, const stl_vector & B)+  {+    int N=A.size();+    real somme=0.0;+    real somme2=0.0;++    for (int i=0;i<N;i++){+      real diff=A[i]-B[i];+      somme+=diff*diff;+      somme2+=A[i]*A[i];+    }+    return somme/somme2;+  }++  static inline real norm_diff(const stl_matrix & A, const stl_matrix & B)+  {+    int N=A[0].size();+    real somme=0.0;+    real somme2=0.0;++    for (int i=0;i<N;i++){+      for (int j=0;j<N;j++){+        real diff=A[i][j] - B[i][j];+        somme += diff*diff;+        somme2 += A[i][j]*A[i][j];+      }+    }++    return somme/somme2;+  }++  static inline void display_vector(const stl_vector & A)+  {+    int N=A.size();+    for (int i=0;i<N;i++){+      INFOS("A["<<i<<"]="<<A[i]<<endl);+    }+  }++};++#endif
+ eigen3/bench/btl/libs/STL/main.cpp view
@@ -0,0 +1,42 @@+//=====================================================+// File   :  main.cpp+// Author :  L. Plagne <laurent.plagne@edf.fr)>+// Copyright (C) EDF R&D,  lun sep 30 14:23:23 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 "STL_interface.hh"+#include "bench.hh"+#include "basic_actions.hh"++BTL_MAIN;++int main()+{+  bench<Action_axpy<STL_interface<REAL_TYPE> > >(MIN_AXPY,MAX_AXPY,NB_POINT);+  bench<Action_axpby<STL_interface<REAL_TYPE> > >(MIN_AXPY,MAX_AXPY,NB_POINT);+  bench<Action_matrix_vector_product<STL_interface<REAL_TYPE> > >(MIN_MV,MAX_MV,NB_POINT);+  bench<Action_atv_product<STL_interface<REAL_TYPE> > >(MIN_MV,MAX_MV,NB_POINT);+  bench<Action_symv<STL_interface<REAL_TYPE> > >(MIN_MV,MAX_MV,NB_POINT);+  bench<Action_syr2<STL_interface<REAL_TYPE> > >(MIN_MV,MAX_MV,NB_POINT);+  bench<Action_matrix_matrix_product<STL_interface<REAL_TYPE> > >(MIN_MM,MAX_MM,NB_POINT);+  bench<Action_ata_product<STL_interface<REAL_TYPE> > >(MIN_MM,MAX_MM,NB_POINT);+  bench<Action_aat_product<STL_interface<REAL_TYPE> > >(MIN_MM,MAX_MM,NB_POINT);++  return 0;+}++
+ eigen3/bench/btl/libs/blaze/CMakeLists.txt view
@@ -0,0 +1,13 @@++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 ()
+ eigen3/bench/btl/libs/blaze/blaze_interface.hh view
@@ -0,0 +1,140 @@+//=====================================================+// Copyright (C) 2008 Gael Guennebaud <gael.guennebaud@inria.fr>+//=====================================================+//+// 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 <blaze/Math.h>+#include <blaze/Blaze.h>+// using namespace blaze;++#include <vector>++template<class real>+class blaze_interface {++public :++  typedef real real_type ;++  typedef std::vector<real>        stl_vector;+  typedef std::vector<stl_vector > stl_matrix;++  typedef blaze::DynamicMatrix<real,blaze::columnMajor>  gene_matrix;+  typedef blaze::DynamicVector<real>  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<A_stl.size() ; j++){+      for (int i=0; i<A_stl[j].size() ; i++){+        A(i,j) = A_stl[j][i];+      }+    }+  }++  static inline void vector_from_stl(gene_vector & B, stl_vector & B_stl){+    B.resize(B_stl.size());+    for (int i=0; i<B_stl.size() ; i++){+      B[i] = B_stl[i];+    }+  }++  static inline void vector_to_stl(gene_vector & B, stl_vector & B_stl){+    for (int i=0; i<B_stl.size() ; i++){+      B_stl[i] = B[i];+    }+  }++  static inline void matrix_to_stl(gene_matrix & A, stl_matrix & A_stl){+    int N=A_stl.size();+    for (int j=0;j<N;j++){+      A_stl[j].resize(N);+      for (int i=0;i<N;i++){+        A_stl[j][i] = A(i,j);+      }+    }+  }++  static inline void matrix_matrix_product(const gene_matrix & A, const gene_matrix & B, gene_matrix & X, int N){+    X = (A*B);+  }++  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<int> 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
+ eigen3/bench/btl/libs/blaze/main.cpp view
@@ -0,0 +1,40 @@+//=====================================================+// Copyright (C) 2008 Gael Guennebaud <gael.guennebaud@inria.fr>+//=====================================================+//+// 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<Action_axpy<blaze_interface<REAL_TYPE> > >(MIN_AXPY,MAX_AXPY,NB_POINT);+  bench<Action_axpby<blaze_interface<REAL_TYPE> > >(MIN_AXPY,MAX_AXPY,NB_POINT);++  bench<Action_matrix_vector_product<blaze_interface<REAL_TYPE> > >(MIN_MV,MAX_MV,NB_POINT);+  bench<Action_atv_product<blaze_interface<REAL_TYPE> > >(MIN_MV,MAX_MV,NB_POINT);+//   bench<Action_matrix_matrix_product<blaze_interface<REAL_TYPE> > >(MIN_MM,MAX_MM,NB_POINT);+//   bench<Action_ata_product<blaze_interface<REAL_TYPE> > >(MIN_MM,MAX_MM,NB_POINT);+//   bench<Action_aat_product<blaze_interface<REAL_TYPE> > >(MIN_MM,MAX_MM,NB_POINT);++  return 0;+}++
+ eigen3/bench/btl/libs/blitz/CMakeLists.txt view
@@ -0,0 +1,17 @@++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 (BUILD_btl_blitz)++  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 (BUILD_btl_tiny_blitz)++endif (BLITZ_FOUND)
+ eigen3/bench/btl/libs/blitz/blitz_LU_solve_interface.hh view
@@ -0,0 +1,192 @@+//=====================================================+// File   :  blitz_LU_solve_interface.hh+// Author :  L. Plagne <laurent.plagne@edf.fr)>        +// 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 <vector>++BZ_USING_NAMESPACE(blitz)++template<class real>+class blitz_LU_solve_interface : public blitz_interface<real>+{++public :++  typedef typename blitz_interface<real>::gene_matrix gene_matrix;+  typedef typename blitz_interface<real>::gene_vector gene_vector;++  typedef blitz::Array<int,1> 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<col_end+1 ; j++){+	+	somme+=A(row,j)*B(j);+	+    }++    return somme;++  }+++++  static inline real matrix_matrix_product_sliced(gene_matrix & A, int row, int col_start, int col_end, gene_matrix & B, int row_shift, int col )+  {+    +    real somme=0.;+    +    for (int j=col_start ; j<col_end+1 ; j++){+	+	somme+=A(row,j)*B(j+row_shift,col);+	+    }++    return somme;++  }++  inline static void LU_factor(gene_matrix & LU, Pivot_Vector & pivot, int N)+  {++    ASSERT( LU.rows()==LU.cols() ) ;+    int index_max = 0 ;+    real big = 0. ;+    real theSum = 0. ;+    real dum = 0. ;+    // Get the implicit scaling information :+    gene_vector ImplicitScaling( N ) ;+    for( int i=0; i<N; i++ ) {+      big = 0. ;+      for( int j=0; j<N; j++ ) {+	if( abs( LU( i, 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<N; j++ ) {+      for( int i=0; i<j; i++ ) {+	theSum = LU( i, j ) ;+	theSum -= matrix_matrix_product_sliced(LU, i, 0, i-1, LU, 0, j) ;+	//	theSum -= sum( LU( i, Range( fromStart, i-1 ) )*LU( Range( fromStart, i-1 ), j ) ) ;+	LU( i, j ) = theSum ;+      }+      +      // Search for the largest pivot element :+      big = 0. ;+      for( int i=j; i<N; i++ ) {+	theSum = LU( i, j ) ;+	theSum -= matrix_matrix_product_sliced(LU, i, 0, j-1, LU, 0, j) ;+	//	theSum -= sum( LU( i, Range( fromStart, j-1 ) )*LU( Range( fromStart, j-1 ), j ) ) ;+	LU( i, j ) = theSum ;+	if( (ImplicitScaling( i )*abs( theSum ))>=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<N; k++ ) {+	  dum = LU( index_max, k ) ;+	  LU( index_max, k ) = LU( j, k ) ;+	  LU( j, k ) = dum ;+	}+	ImplicitScaling( index_max ) = ImplicitScaling( j ) ;+      }+      pivot( j ) = index_max ;+      if ( LU( j, j )==0. ) LU( j, j ) = 1.e-20 ;+      // Divide by the pivot element :+      if( j<N ) {+	dum = 1./LU( j, j ) ;+	for( int i=j+1; i<N; i++ ) LU( i, j ) *= dum ;+      }+    }++  }++  inline static void LU_solve(const gene_matrix & LU, const Pivot_Vector pivot, gene_vector &B, gene_vector X, int N)+  {++    // Pour conserver le meme header, on travaille sur X, copie du second-membre B+    X = B.copy() ;+    ASSERT( LU.rows()==LU.cols() ) ;+    firstIndex indI ;+    // Forward substitution :+    int ii = 0 ;+    real theSum = 0. ;+    for( int i=0; i<N; i++ ) {+      int ip = pivot( i ) ;+      theSum = X( ip ) ;+      //      theSum = B( ip ) ;+      X( ip ) = X( i ) ;+      //      B( ip ) = B( i ) ;+      if( ii ) {+	theSum -= matrix_vector_product_sliced(LU, X, i, ii-1, i-1) ;+	//	theSum -= sum( LU( i, Range( ii-1, i-1 ) )*X( Range( ii-1, i-1 ) ) ) ;+	//	theSum -= sum( LU( i, Range( ii-1, i-1 ) )*B( Range( ii-1, i-1 ) ) ) ;+      } else if( theSum ) {+	ii = i+1 ;+      }+      X( i ) = theSum ;+      //      B( i ) = theSum ;+    }+    // Backsubstitution :+    for( int i=N-1; i>=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
+ eigen3/bench/btl/libs/blitz/blitz_interface.hh view
@@ -0,0 +1,147 @@+//=====================================================+// File   :  blitz_interface.hh+// Author :  L. Plagne <laurent.plagne@edf.fr)>+// Copyright (C) EDF R&D,  lun sep 30 14:23:30 CEST 2002+// Copyright (C) 2008 Gael Guennebaud <gael.guennebaud@inria.fr>+//=====================================================+//+// 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 <blitz/blitz.h>+#include <blitz/array.h>+#include <blitz/vector-et.h>+#include <blitz/vecwhere.h>+#include <blitz/matrix.h>+#include <vector>++BZ_USING_NAMESPACE(blitz)++template<class real>+class blitz_interface{++public :++  typedef real real_type ;++  typedef std::vector<real>  stl_vector;+  typedef std::vector<stl_vector > stl_matrix;++  typedef blitz::Array<real, 2>  gene_matrix;+  typedef blitz::Array<real, 1>  gene_vector;+//   typedef blitz::Matrix<real, blitz::ColumnMajor>  gene_matrix;+//   typedef blitz::Vector<real> 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<A_stl.size() ; j++){+      for (int i=0; i<A_stl[j].size() ; i++){+        A(i,j)=A_stl[j][i];+      }+    }+  }++  static inline void vector_from_stl(gene_vector & B, stl_vector & B_stl){+    B.resize(B_stl.size());+    for (int i=0; i<B_stl.size() ; i++){+      B(i)=B_stl[i];+    }+  }++  static inline void vector_to_stl(gene_vector & B, stl_vector & B_stl){+    for (int i=0; i<B_stl.size() ; i++){+      B_stl[i]=B(i);+    }+  }++  static inline void matrix_to_stl(gene_matrix & A, stl_matrix & A_stl){+    int N=A_stl.size();+    for (int j=0;j<N;j++){+      A_stl[j].resize(N);+      for (int i=0;i<N;i++)+        A_stl[j][i] = A(i,j);+    }+  }++  static inline void matrix_matrix_product(const gene_matrix & A, const gene_matrix & B, gene_matrix & X, int N)+  {+    firstIndex i;+    secondIndex j;+    thirdIndex k;+    X = sum(A(i,k) * B(k,j), k);+  }++  static inline void ata_product(const gene_matrix & A, gene_matrix & X, int N)+  {+    firstIndex i;+    secondIndex j;+    thirdIndex k;+    X = sum(A(k,i) * A(k,j), k);+  }++  static inline void aat_product(const gene_matrix & A, gene_matrix & X, int N)+  {+    firstIndex i;+    secondIndex j;+    thirdIndex k;+    X = sum(A(i,k) * A(j,k), k);+  }++  static inline void matrix_vector_product(gene_matrix & A, gene_vector & B, gene_vector & X, int N)+  {+    firstIndex i;+    secondIndex j;+    X = sum(A(i,j)*B(j),j);+  }++  static inline void atv_product(gene_matrix & A, gene_vector & B, gene_vector & X, int N)+  {+    firstIndex i;+    secondIndex j;+    X = sum(A(j,i) * B(j),j);+  }++  static inline void axpy(const real coef, const gene_vector & X, gene_vector & Y, int N)+  {+    firstIndex i;+    Y = Y(i) + coef * X(i);+    //Y += coef * X;+  }++  static inline void copy_matrix(const gene_matrix & source, gene_matrix & cible, int N){+    cible = source;+    //cible.template operator=<gene_matrix>(source);+//     for (int i=0;i<N;i++){+//       for (int j=0;j<N;j++){+//         cible(i,j)=source(i,j);+//       }+//     }+  }++  static inline void copy_vector(const gene_vector & source, gene_vector & cible, int N){+    //cible.template operator=<gene_vector>(source);+    cible = source;+  }++};++#endif
+ eigen3/bench/btl/libs/blitz/btl_blitz.cpp view
@@ -0,0 +1,51 @@+//=====================================================+// File   :  main.cpp+// Author :  L. Plagne <laurent.plagne@edf.fr)>+// 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<Action_matrix_vector_product<blitz_interface<REAL_TYPE> > >(MIN_MV,MAX_MV,NB_POINT);+  bench<Action_atv_product<blitz_interface<REAL_TYPE> > >(MIN_MV,MAX_MV,NB_POINT);++  bench<Action_matrix_matrix_product<blitz_interface<REAL_TYPE> > >(MIN_MM,MAX_MM,NB_POINT);+  bench<Action_ata_product<blitz_interface<REAL_TYPE> > >(MIN_MM,MAX_MM,NB_POINT);+  bench<Action_aat_product<blitz_interface<REAL_TYPE> > >(MIN_MM,MAX_MM,NB_POINT);++  bench<Action_axpy<blitz_interface<REAL_TYPE> > >(MIN_AXPY,MAX_AXPY,NB_POINT);++  //bench<Action_lu_solve<blitz_LU_solve_interface<REAL_TYPE> > >(MIN_LU,MAX_LU,NB_POINT);++  return 0;+}++
+ eigen3/bench/btl/libs/blitz/btl_tiny_blitz.cpp view
@@ -0,0 +1,38 @@+//=====================================================+// File   :  main.cpp+// Author :  L. Plagne <laurent.plagne@edf.fr)>+// 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<Action_axpy,tiny_blitz_interface>();+  bench_static<Action_matrix_matrix_product,tiny_blitz_interface>();+  bench_static<Action_matrix_vector_product,tiny_blitz_interface>();++  return 0;+}++
+ eigen3/bench/btl/libs/blitz/tiny_blitz_interface.hh view
@@ -0,0 +1,106 @@+//=====================================================+// File   :  tiny_blitz_interface.hh+// Author :  L. Plagne <laurent.plagne@edf.fr)>+// 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 <blitz/tinyvec-et.h>++#include <vector>++BZ_USING_NAMESPACE(blitz)++template<class real, int SIZE>+class tiny_blitz_interface+{++public :++  typedef real real_type ;++  typedef std::vector<real>  stl_vector;+  typedef std::vector<stl_vector > stl_matrix;++  typedef TinyVector<real,SIZE> gene_vector;+  typedef TinyMatrix<real,SIZE,SIZE> 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<A_stl.size() ; j++)+      for (int i=0; i<A_stl[j].size() ; i++)+        A(i,j)=A_stl[j][i];+  }++  static inline void vector_from_stl(gene_vector & B, stl_vector & B_stl){+    for (int i=0; i<B_stl.size() ; i++)+      B(i) = B_stl[i];+  }++  static inline void vector_to_stl(gene_vector & B, stl_vector & B_stl){+    for (int i=0; i<B_stl.size() ; i++)+      B_stl[i] = B(i);+  }++  static inline void matrix_to_stl(gene_matrix & A, stl_matrix & A_stl){+    int N = A_stl.size();+    for (int j=0;j<N;j++)+    {+      A_stl[j].resize(N);+      for (int i=0;i<N;i++)+        A_stl[j][i] = A(i,j);+    }+  }++  static inline void copy_matrix(const gene_matrix & source, gene_matrix & cible, int N){+    for (int j=0;j<N;j++)+      for (int i=0;i<N;i++)+        cible(i,j) = source(i,j);+  }++  static inline void copy_vector(const gene_vector & source, gene_vector & cible, int N){+    for (int i=0;i<N;i++){+      cible(i) = source(i);+    }+  }++  static inline void matrix_matrix_product(const gene_matrix & A, const gene_matrix & B, gene_matrix & X, int N){+    X = product(A,B);+  }++  static inline void matrix_vector_product(gene_matrix & A, gene_vector & B, gene_vector & X, int N){+    X = product(A,B);+  }++  static inline void axpy(const real coef, const gene_vector & X, gene_vector & Y, int N){+    Y += coef * X;+  }++};+++#endif
+ eigen3/bench/btl/libs/eigen2/CMakeLists.txt view
@@ -0,0 +1,19 @@++find_package(Eigen2)++if(EIGEN2_FOUND)++  include_directories(BEFORE ${EIGEN2_INCLUDE_DIR})+  btl_add_bench(btl_eigen2_linear main_linear.cpp)+  btl_add_bench(btl_eigen2_vecmat main_vecmat.cpp)+  btl_add_bench(btl_eigen2_matmat main_matmat.cpp)+  btl_add_bench(btl_eigen2_adv main_adv.cpp      )++  btl_add_target_property(btl_eigen2_linear COMPILE_FLAGS "-fno-exceptions -DBTL_PREFIX=eigen2")+  btl_add_target_property(btl_eigen2_vecmat COMPILE_FLAGS "-fno-exceptions -DBTL_PREFIX=eigen2")+  btl_add_target_property(btl_eigen2_matmat COMPILE_FLAGS "-fno-exceptions -DBTL_PREFIX=eigen2")+  btl_add_target_property(btl_eigen2_adv    COMPILE_FLAGS "-fno-exceptions -DBTL_PREFIX=eigen2")++  btl_add_bench(btl_tiny_eigen2 btl_tiny_eigen2.cpp OFF)++endif() # EIGEN2_FOUND
+ eigen3/bench/btl/libs/eigen2/btl_tiny_eigen2.cpp view
@@ -0,0 +1,46 @@+//=====================================================+// Copyright (C) 2008 Gael Guennebaud <gael.guennebaud@inria.fr>+//=====================================================+//+// 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<Action_axpy,eigen2_interface>();+  bench_static<Action_matrix_matrix_product,eigen2_interface>();+  bench_static<Action_matrix_vector_product,eigen2_interface>();+  bench_static<Action_atv_product,eigen2_interface>();+  bench_static<Action_cholesky,eigen2_interface>();+  bench_static<Action_trisolve,eigen2_interface>();++  return 0;+}++
+ eigen3/bench/btl/libs/eigen2/eigen2_interface.hh view
@@ -0,0 +1,168 @@+//=====================================================+// Copyright (C) 2008 Gael Guennebaud <g.gael@free.fr>+//=====================================================+//+// 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 <cblas.h>+#include <Eigen/Core>+#include <Eigen/Cholesky>+#include <Eigen/LU>+#include <Eigen/QR>+#include <vector>+#include "btl.hh"++using namespace Eigen;++template<class real, int SIZE=Dynamic>+class eigen2_interface+{++public :++  enum {IsFixedSize = (SIZE!=Dynamic)};++  typedef real real_type;++  typedef std::vector<real> stl_vector;+  typedef std::vector<stl_vector> stl_matrix;++  typedef Eigen::Matrix<real,SIZE,SIZE> gene_matrix;+  typedef Eigen::Matrix<real,SIZE,1> 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<A_stl.size() ; j++){+      for (int i=0; i<A_stl[j].size() ; i++){+        A.coeffRef(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(),1);++    for (int i=0; i<B_stl.size() ; i++){+      B.coeffRef(i) = B_stl[i];+    }+  }++  static BTL_DONT_INLINE  void vector_to_stl(gene_vector & B, stl_vector & B_stl){+    for (int i=0; i<B_stl.size() ; i++){+      B_stl[i] = B.coeff(i);+    }+  }++  static BTL_DONT_INLINE  void matrix_to_stl(gene_matrix & A, stl_matrix & A_stl){+    int N=A_stl.size();++    for (int j=0;j<N;j++){+      A_stl[j].resize(N);+      for (int i=0;i<N;i++){+        A_stl[j][i] = A.coeff(i,j);+      }+    }+  }++  static inline void matrix_matrix_product(const gene_matrix & A, const gene_matrix & B, gene_matrix & X, int N){+    X = (A*B).lazy();+  }++  static inline void transposed_matrix_matrix_product(const gene_matrix & A, const gene_matrix & B, gene_matrix & X, int N){+    X = (A.transpose()*B.transpose()).lazy();+  }++  static inline void ata_product(const gene_matrix & A, gene_matrix & X, int N){+    X = (A.transpose()*A).lazy();+  }++  static inline void aat_product(const gene_matrix & A, gene_matrix & X, int N){+    X = (A*A.transpose()).lazy();+  }++  static inline void matrix_vector_product(const gene_matrix & A, const gene_vector & B, gene_vector & X, int N){+    X = (A*B)/*.lazy()*/;+  }++  static inline void atv_product(gene_matrix & A, gene_vector & B, gene_vector & X, int N){+    X = (A.transpose()*B)/*.lazy()*/;+  }++  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 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;+  }++  static inline void trisolve_lower(const gene_matrix & L, const gene_vector& B, gene_vector& X, int N){+    X = L.template marked<LowerTriangular>().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<LowerTriangular>().solveTriangular(B);+  }++  static inline void cholesky(const gene_matrix & X, gene_matrix & C, int N){+    C = X.llt().matrixL();+//     C = X;+//     Cholesky<gene_matrix>::computeInPlace(C);+//     Cholesky<gene_matrix>::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<gene_matrix>(X).packedMatrix();+  }++  static inline void hessenberg(const gene_matrix & X, gene_matrix & C, int N){+    C = HessenbergDecomposition<gene_matrix>(X).packedMatrix();+  }++++};++#endif
+ eigen3/bench/btl/libs/eigen2/main_adv.cpp view
@@ -0,0 +1,44 @@+//=====================================================+// Copyright (C) 2008 Gael Guennebaud <gael.guennebaud@inria.fr>+//=====================================================+//+// 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<Action_trisolve<eigen2_interface<REAL_TYPE> > >(MIN_MM,MAX_MM,NB_POINT);+  bench<Action_trisolve_matrix<eigen2_interface<REAL_TYPE> > >(MIN_MM,MAX_MM,NB_POINT);+  bench<Action_cholesky<eigen2_interface<REAL_TYPE> > >(MIN_MM,MAX_MM,NB_POINT);+  bench<Action_lu_decomp<eigen2_interface<REAL_TYPE> > >(MIN_MM,MAX_MM,NB_POINT);+//   bench<Action_partial_lu<eigen2_interface<REAL_TYPE> > >(MIN_MM,MAX_MM,NB_POINT);++  bench<Action_hessenberg<eigen2_interface<REAL_TYPE> > >(MIN_MM,MAX_MM,NB_POINT);+  bench<Action_tridiagonalization<eigen2_interface<REAL_TYPE> > >(MIN_MM,MAX_MM,NB_POINT);++  return 0;+}++
+ eigen3/bench/btl/libs/eigen2/main_linear.cpp view
@@ -0,0 +1,34 @@+//=====================================================+// Copyright (C) 2008 Gael Guennebaud <gael.guennebaud@inria.fr>+//=====================================================+//+// 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<Action_axpy<eigen2_interface<REAL_TYPE> > >(MIN_AXPY,MAX_AXPY,NB_POINT);+  bench<Action_axpby<eigen2_interface<REAL_TYPE> > >(MIN_AXPY,MAX_AXPY,NB_POINT);+  +  return 0;+}++
+ eigen3/bench/btl/libs/eigen2/main_matmat.cpp view
@@ -0,0 +1,35 @@+//=====================================================+// Copyright (C) 2008 Gael Guennebaud <gael.guennebaud@inria.fr>+//=====================================================+//+// 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<Action_matrix_matrix_product<eigen2_interface<REAL_TYPE> > >(MIN_MM,MAX_MM,NB_POINT);+//   bench<Action_ata_product<eigen2_interface<REAL_TYPE> > >(MIN_MM,MAX_MM,NB_POINT);+  bench<Action_aat_product<eigen2_interface<REAL_TYPE> > >(MIN_MM,MAX_MM,NB_POINT);+//   bench<Action_trmm<eigen2_interface<REAL_TYPE> > >(MIN_MM,MAX_MM,NB_POINT);++  return 0;+}++
+ eigen3/bench/btl/libs/eigen2/main_vecmat.cpp view
@@ -0,0 +1,36 @@+//=====================================================+// Copyright (C) 2008 Gael Guennebaud <gael.guennebaud@inria.fr>+//=====================================================+//+// 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<Action_matrix_vector_product<eigen2_interface<REAL_TYPE> > >(MIN_MV,MAX_MV,NB_POINT);+  bench<Action_atv_product<eigen2_interface<REAL_TYPE> > >(MIN_MV,MAX_MV,NB_POINT);+//   bench<Action_symv<eigen2_interface<REAL_TYPE> > >(MIN_MV,MAX_MV,NB_POINT);+//   bench<Action_syr2<eigen2_interface<REAL_TYPE> > >(MIN_MV,MAX_MV,NB_POINT);+//   bench<Action_ger<eigen2_interface<REAL_TYPE> > >(MIN_MV,MAX_MV,NB_POINT);++  return 0;+}++
+ eigen3/bench/btl/libs/eigen3/CMakeLists.txt view
@@ -0,0 +1,65 @@+++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(BUILD_btl_eigen3_adv)++  endif(NOT BTL_NOVEC)++  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(BUILD_btl_tiny_eigen3_novec)+  endif(NOT BTL_NOVEC)++endif (EIGEN3_FOUND)
+ eigen3/bench/btl/libs/eigen3/btl_tiny_eigen3.cpp view
@@ -0,0 +1,46 @@+//=====================================================+// Copyright (C) 2008 Gael Guennebaud <gael.guennebaud@inria.fr>+//=====================================================+//+// 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<Action_axpy,eigen2_interface>();+  bench_static<Action_matrix_matrix_product,eigen2_interface>();+  bench_static<Action_matrix_vector_product,eigen2_interface>();+  bench_static<Action_atv_product,eigen2_interface>();+  bench_static<Action_cholesky,eigen2_interface>();+  bench_static<Action_trisolve,eigen2_interface>();++  return 0;+}++
+ eigen3/bench/btl/libs/eigen3/eigen3_interface.hh view
@@ -0,0 +1,240 @@+//=====================================================+// Copyright (C) 2008 Gael Guennebaud <gael.guennebaud@inria.fr>+//=====================================================+//+// 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 <Eigen/Eigen>+#include <vector>+#include "btl.hh"++using namespace Eigen;++template<class real, int SIZE=Dynamic>+class eigen3_interface+{++public :++  enum {IsFixedSize = (SIZE!=Dynamic)};++  typedef real real_type;++  typedef std::vector<real> stl_vector;+  typedef std::vector<stl_vector> stl_matrix;++  typedef Eigen::Matrix<real,SIZE,SIZE> gene_matrix;+  typedef Eigen::Matrix<real,SIZE,1> 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<A_stl.size() ; j++){+      for (unsigned int i=0; i<A_stl[j].size() ; i++){+        A.coeffRef(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(),1);++    for (unsigned int i=0; i<B_stl.size() ; i++){+      B.coeffRef(i) = B_stl[i];+    }+  }++  static BTL_DONT_INLINE  void vector_to_stl(gene_vector & B, stl_vector & B_stl){+    for (unsigned int i=0; i<B_stl.size() ; i++){+      B_stl[i] = B.coeff(i);+    }+  }++  static BTL_DONT_INLINE  void matrix_to_stl(gene_matrix & A, stl_matrix & A_stl){+    int  N=A_stl.size();++    for (int j=0;j<N;j++){+      A_stl[j].resize(N);+      for (int i=0;i<N;i++){+        A_stl[j][i] = A.coeff(i,j);+      }+    }+  }++  static inline void matrix_matrix_product(const gene_matrix & A, const gene_matrix & B, gene_matrix & X, int  /*N*/){+    X.noalias() = A*B;+  }++  static inline void transposed_matrix_matrix_product(const gene_matrix & A, const gene_matrix & B, gene_matrix & X, int  /*N*/){+    X.noalias() = A.transpose()*B.transpose();+  }++//   static inline void ata_product(const gene_matrix & A, gene_matrix & X, int  /*N*/){+//     X.noalias() = A.transpose()*A;+//   }++  static inline void aat_product(const gene_matrix & A, gene_matrix & X, int  /*N*/){+    X.template triangularView<Lower>().setZero();+    X.template selfadjointView<Lower>().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<Lower>() * B);+//     internal::product_selfadjoint_vector<real,0,LowerTriangularBit,false,false>(N,A.data(),N, B.data(), 1, X.data(), 1);+  }++  template<typename Dest, typename Src> static void triassign(Dest& dst, const Src& src)+  {+    typedef typename Dest::Scalar Scalar;+    typedef typename internal::packet_traits<Scalar>::type Packet;+    const int PacketSize = sizeof(Packet)/sizeof(Scalar);+    int size = dst.cols();+    for(int j=0; j<size; j+=1)+    {+//       const int alignedEnd = alignedStart + ((innerSize-alignedStart) & ~packetAlignedMask);+      Scalar* A0 = dst.data() + j*dst.stride();+      int starti = j;+      int alignedEnd = starti;+      int alignedStart = (starti) + internal::first_aligned(&A0[starti], size-starti);+      alignedEnd = alignedStart + ((size-alignedStart)/(2*PacketSize))*(PacketSize*2);++      // do the non-vectorizable part of the assignment+      for (int index = starti; index<alignedStart ; ++index)+      {+        if(Dest::Flags&RowMajorBit)+          dst.copyCoeff(j, index, src);+        else+          dst.copyCoeff(index, j, src);+      }++      // do the vectorizable part of the assignment+      for (int index = alignedStart; index<alignedEnd; index+=PacketSize)+      {+        if(Dest::Flags&RowMajorBit)+          dst.template copyPacket<Src, Aligned, Unaligned>(j, index, src);+        else+          dst.template copyPacket<Src, Aligned, Unaligned>(index, j, src);+      }++      // do the non-vectorizable part of the assignment+      for (int index = alignedEnd; index<size; ++index)+      {+        if(Dest::Flags&RowMajorBit)+          dst.copyCoeff(j, index, src);+        else+          dst.copyCoeff(index, j, src);+      }+      //dst.col(j).tail(N-j) = src.col(j).tail(N-j);+    }+  }++  static EIGEN_DONT_INLINE void syr2(gene_matrix & A,  gene_vector & X, gene_vector & Y, int  N){+    // internal::product_selfadjoint_rank2_update<real,0,LowerTriangularBit>(N,A.data(),N, X.data(), 1, Y.data(), 1, -1);+    for(int j=0; j<N; ++j)+      A.col(j).tail(N-j) += X[j] * Y.tail(N-j) + Y[j] * X.tail(N-j);+  }++  static EIGEN_DONT_INLINE void ger(gene_matrix & A,  gene_vector & X, gene_vector & Y, int  N){+    for(int j=0; j<N; ++j)+      A.col(j) += X * Y[j];+  }++  static EIGEN_DONT_INLINE void rot(gene_vector & A,  gene_vector & B, real c, real s, int  /*N*/){+    internal::apply_rotation_in_the_plane(A, B, JacobiRotation<real>(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<Lower>().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<Upper>().solve(B);+  }++  static inline void trmm(const gene_matrix & L, const gene_matrix& B, gene_matrix& X, int  /*N*/){+    X.noalias() = L.template triangularView<Lower>() * B;+  }++  static inline void cholesky(const gene_matrix & X, gene_matrix & C, int  /*N*/){+    C = X;+    internal::llt_inplace<real,Lower>::blocked(C);+    //C = X.llt().matrixL();+//     C = X;+//     Cholesky<gene_matrix>::computeInPlace(C);+//     Cholesky<gene_matrix>::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<DenseIndex,1,Dynamic> 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<gene_matrix>::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<gene_matrix>(X).packedMatrix();+  }++++};++#endif
+ eigen3/bench/btl/libs/eigen3/main_adv.cpp view
@@ -0,0 +1,44 @@+//=====================================================+// Copyright (C) 2008 Gael Guennebaud <gael.guennebaud@inria.fr>+//=====================================================+//+// 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<Action_trisolve<eigen3_interface<REAL_TYPE> > >(MIN_LU,MAX_LU,NB_POINT);+  bench<Action_trisolve_matrix<eigen3_interface<REAL_TYPE> > >(MIN_LU,MAX_LU,NB_POINT);+  bench<Action_cholesky<eigen3_interface<REAL_TYPE> > >(MIN_LU,MAX_LU,NB_POINT);+//   bench<Action_lu_decomp<eigen3_interface<REAL_TYPE> > >(MIN_LU,MAX_LU,NB_POINT);+  bench<Action_partial_lu<eigen3_interface<REAL_TYPE> > >(MIN_LU,MAX_LU,NB_POINT);++//   bench<Action_hessenberg<eigen3_interface<REAL_TYPE> > >(MIN_LU,MAX_LU,NB_POINT);+  bench<Action_tridiagonalization<eigen3_interface<REAL_TYPE> > >(MIN_LU,MAX_LU,NB_POINT);++  return 0;+}++
+ eigen3/bench/btl/libs/eigen3/main_linear.cpp view
@@ -0,0 +1,35 @@+//=====================================================+// Copyright (C) 2008 Gael Guennebaud <gael.guennebaud@inria.fr>+//=====================================================+//+// 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<Action_axpy<eigen3_interface<REAL_TYPE> > >(MIN_AXPY,MAX_AXPY,NB_POINT);+  bench<Action_axpby<eigen3_interface<REAL_TYPE> > >(MIN_AXPY,MAX_AXPY,NB_POINT);+  bench<Action_rot<eigen3_interface<REAL_TYPE> > >(MIN_AXPY,MAX_AXPY,NB_POINT);+  +  return 0;+}++
+ eigen3/bench/btl/libs/eigen3/main_matmat.cpp view
@@ -0,0 +1,35 @@+//=====================================================+// Copyright (C) 2008 Gael Guennebaud <gael.guennebaud@inria.fr>+//=====================================================+//+// 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<Action_matrix_matrix_product<eigen3_interface<REAL_TYPE> > >(MIN_MM,MAX_MM,NB_POINT);+//   bench<Action_ata_product<eigen3_interface<REAL_TYPE> > >(MIN_MM,MAX_MM,NB_POINT);+  bench<Action_aat_product<eigen3_interface<REAL_TYPE> > >(MIN_MM,MAX_MM,NB_POINT);+  bench<Action_trmm<eigen3_interface<REAL_TYPE> > >(MIN_MM,MAX_MM,NB_POINT);++  return 0;+}++
+ eigen3/bench/btl/libs/eigen3/main_vecmat.cpp view
@@ -0,0 +1,36 @@+//=====================================================+// Copyright (C) 2008 Gael Guennebaud <gael.guennebaud@inria.fr>+//=====================================================+//+// 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<Action_matrix_vector_product<eigen3_interface<REAL_TYPE> > >(MIN_MV,MAX_MV,NB_POINT);+  bench<Action_atv_product<eigen3_interface<REAL_TYPE> > >(MIN_MV,MAX_MV,NB_POINT);+  bench<Action_symv<eigen3_interface<REAL_TYPE> > >(MIN_MV,MAX_MV,NB_POINT);+  bench<Action_syr2<eigen3_interface<REAL_TYPE> > >(MIN_MV,MAX_MV,NB_POINT);+  bench<Action_ger<eigen3_interface<REAL_TYPE> > >(MIN_MV,MAX_MV,NB_POINT);++  return 0;+}++
+ eigen3/bench/btl/libs/gmm/CMakeLists.txt view
@@ -0,0 +1,6 @@++find_package(GMM)+if (GMM_FOUND)+  include_directories(${GMM_INCLUDES})+  btl_add_bench(btl_gmm main.cpp)+endif (GMM_FOUND)
+ eigen3/bench/btl/libs/gmm/gmm_LU_solve_interface.hh view
@@ -0,0 +1,192 @@+//=====================================================+// File   :  blitz_LU_solve_interface.hh+// Author :  L. Plagne <laurent.plagne@edf.fr)>        +// 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 <vector>++BZ_USING_NAMESPACE(blitz)++template<class real>+class blitz_LU_solve_interface : public blitz_interface<real>+{++public :++  typedef typename blitz_interface<real>::gene_matrix gene_matrix;+  typedef typename blitz_interface<real>::gene_vector gene_vector;++  typedef blitz::Array<int,1> 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<col_end+1 ; j++){+	+	somme+=A(row,j)*B(j);+	+    }++    return somme;++  }+++++  static inline real matrix_matrix_product_sliced(gene_matrix & A, int row, int col_start, int col_end, gene_matrix & B, int row_shift, int col )+  {+    +    real somme=0.;+    +    for (int j=col_start ; j<col_end+1 ; j++){+	+	somme+=A(row,j)*B(j+row_shift,col);+	+    }++    return somme;++  }++  inline static void LU_factor(gene_matrix & LU, Pivot_Vector & pivot, int N)+  {++    ASSERT( LU.rows()==LU.cols() ) ;+    int index_max = 0 ;+    real big = 0. ;+    real theSum = 0. ;+    real dum = 0. ;+    // Get the implicit scaling information :+    gene_vector ImplicitScaling( N ) ;+    for( int i=0; i<N; i++ ) {+      big = 0. ;+      for( int j=0; j<N; j++ ) {+	if( abs( LU( i, 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<N; j++ ) {+      for( int i=0; i<j; i++ ) {+	theSum = LU( i, j ) ;+	theSum -= matrix_matrix_product_sliced(LU, i, 0, i-1, LU, 0, j) ;+	//	theSum -= sum( LU( i, Range( fromStart, i-1 ) )*LU( Range( fromStart, i-1 ), j ) ) ;+	LU( i, j ) = theSum ;+      }+      +      // Search for the largest pivot element :+      big = 0. ;+      for( int i=j; i<N; i++ ) {+	theSum = LU( i, j ) ;+	theSum -= matrix_matrix_product_sliced(LU, i, 0, j-1, LU, 0, j) ;+	//	theSum -= sum( LU( i, Range( fromStart, j-1 ) )*LU( Range( fromStart, j-1 ), j ) ) ;+	LU( i, j ) = theSum ;+	if( (ImplicitScaling( i )*abs( theSum ))>=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<N; k++ ) {+	  dum = LU( index_max, k ) ;+	  LU( index_max, k ) = LU( j, k ) ;+	  LU( j, k ) = dum ;+	}+	ImplicitScaling( index_max ) = ImplicitScaling( j ) ;+      }+      pivot( j ) = index_max ;+      if ( LU( j, j )==0. ) LU( j, j ) = 1.e-20 ;+      // Divide by the pivot element :+      if( j<N ) {+	dum = 1./LU( j, j ) ;+	for( int i=j+1; i<N; i++ ) LU( i, j ) *= dum ;+      }+    }++  }++  inline static void LU_solve(const gene_matrix & LU, const Pivot_Vector pivot, gene_vector &B, gene_vector X, int N)+  {++    // Pour conserver le meme header, on travaille sur X, copie du second-membre B+    X = B.copy() ;+    ASSERT( LU.rows()==LU.cols() ) ;+    firstIndex indI ;+    // Forward substitution :+    int ii = 0 ;+    real theSum = 0. ;+    for( int i=0; i<N; i++ ) {+      int ip = pivot( i ) ;+      theSum = X( ip ) ;+      //      theSum = B( ip ) ;+      X( ip ) = X( i ) ;+      //      B( ip ) = B( i ) ;+      if( ii ) {+	theSum -= matrix_vector_product_sliced(LU, X, i, ii-1, i-1) ;+	//	theSum -= sum( LU( i, Range( ii-1, i-1 ) )*X( Range( ii-1, i-1 ) ) ) ;+	//	theSum -= sum( LU( i, Range( ii-1, i-1 ) )*B( Range( ii-1, i-1 ) ) ) ;+      } else if( theSum ) {+	ii = i+1 ;+      }+      X( i ) = theSum ;+      //      B( i ) = theSum ;+    }+    // Backsubstitution :+    for( int i=N-1; i>=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
+ eigen3/bench/btl/libs/gmm/gmm_interface.hh view
@@ -0,0 +1,144 @@+//=====================================================+// Copyright (C) 2008 Gael Guennebaud <gael.guennebaud@inria.fr>+//=====================================================+//+// 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 <gmm/gmm.h>+#include <vector>++using namespace gmm;++template<class real>+class gmm_interface {++public :++  typedef real real_type ;++  typedef std::vector<real>  stl_vector;+  typedef std::vector<stl_vector > stl_matrix;++  typedef gmm::dense_matrix<real> 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<A_stl.size() ; j++){+      for (int i=0; i<A_stl[j].size() ; i++){+        A(i,j) = A_stl[j][i];+      }+    }+  }++  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){+    int N=A_stl.size();++    for (int j=0;j<N;j++){+      A_stl[j].resize(N);+      for (int i=0;i<N;i++){+        A_stl[j][i] = A(i,j);+      }+    }+  }++  static inline void matrix_matrix_product(const gene_matrix & A, const gene_matrix & B, gene_matrix & X, int N){+    gmm::mult(A,B, X);+  }++  static inline void transposed_matrix_matrix_product(const gene_matrix & A, const gene_matrix & B, gene_matrix & X, int N){+    gmm::mult(gmm::transposed(A),gmm::transposed(B), X);+  }++  static inline void ata_product(const gene_matrix & A, gene_matrix & X, int N){+    gmm::mult(gmm::transposed(A),A, X);+  }++  static inline void aat_product(const gene_matrix & A, gene_matrix & X, int N){+    gmm::mult(A,gmm::transposed(A), X);+  }++  static inline void matrix_vector_product(gene_matrix & A, gene_vector & B, gene_vector & X, int N){+    gmm::mult(A,B,X);+  }++  static inline void atv_product(gene_matrix & A, gene_vector & B, gene_vector & X, int N){+    gmm::mult(gmm::transposed(A),B,X);+  }++  static inline void axpy(const real coef, const gene_vector & X, gene_vector & Y, int N){+    gmm::add(gmm::scaled(X,coef), Y);+  }++  static inline void axpby(real a, const gene_vector & X, real b, gene_vector & Y, int N){+    gmm::add(gmm::scaled(X,a), gmm::scaled(Y,b), Y);+  }++  static inline void copy_matrix(const gene_matrix & source, gene_matrix & cible, int N){+    gmm::copy(source,cible);+  }++  static inline void copy_vector(const gene_vector & source, gene_vector & cible, int N){+    gmm::copy(source,cible);+  }++  static inline void trisolve_lower(const gene_matrix & L, const gene_vector& B, gene_vector & X, int N){+    gmm::copy(B,X);+    gmm::lower_tri_solve(L, X, false);+  }++  static inline void partial_lu_decomp(const gene_matrix & X, gene_matrix & R, int N){+    gmm::copy(X,R);+    std::vector<int> 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
+ eigen3/bench/btl/libs/gmm/main.cpp view
@@ -0,0 +1,51 @@+//=====================================================+// Copyright (C) 2008 Gael Guennebaud <gael.guennebaud@inria.fr>+//=====================================================+//+// 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<Action_axpy<gmm_interface<REAL_TYPE> > >(MIN_AXPY,MAX_AXPY,NB_POINT);+  bench<Action_axpby<gmm_interface<REAL_TYPE> > >(MIN_AXPY,MAX_AXPY,NB_POINT);++  bench<Action_matrix_vector_product<gmm_interface<REAL_TYPE> > >(MIN_MV,MAX_MV,NB_POINT);+  bench<Action_atv_product<gmm_interface<REAL_TYPE> > >(MIN_MV,MAX_MV,NB_POINT);++  bench<Action_matrix_matrix_product<gmm_interface<REAL_TYPE> > >(MIN_MM,MAX_MM,NB_POINT);+//   bench<Action_ata_product<gmm_interface<REAL_TYPE> > >(MIN_MM,MAX_MM,NB_POINT);+//   bench<Action_aat_product<gmm_interface<REAL_TYPE> > >(MIN_MM,MAX_MM,NB_POINT);++  bench<Action_trisolve<gmm_interface<REAL_TYPE> > >(MIN_MM,MAX_MM,NB_POINT);+  //bench<Action_lu_solve<blitz_LU_solve_interface<REAL_TYPE> > >(MIN_LU,MAX_LU,NB_POINT);++  bench<Action_partial_lu<gmm_interface<REAL_TYPE> > >(MIN_MM,MAX_MM,NB_POINT);+  +  bench<Action_hessenberg<gmm_interface<REAL_TYPE> > >(MIN_MM,MAX_MM,NB_POINT);+  bench<Action_tridiagonalization<gmm_interface<REAL_TYPE> > >(MIN_MM,MAX_MM,NB_POINT);++  return 0;+}++
+ eigen3/bench/btl/libs/mtl4/.kdbgrc.main view
@@ -0,0 +1,12 @@+[General]+DebuggerCmdStr=+DriverName=GDB+FileVersion=1+OptionsSelected=+ProgramArgs=+TTYLevel=7+WorkingDirectory=++[Memory]+ColumnWidths=80,0+NumExprs=0
+ eigen3/bench/btl/libs/mtl4/CMakeLists.txt view
@@ -0,0 +1,6 @@++find_package(MTL4)+if (MTL4_FOUND)+  include_directories(${MTL4_INCLUDE_DIR})+  btl_add_bench(btl_mtl4 main.cpp)+endif (MTL4_FOUND)
+ eigen3/bench/btl/libs/mtl4/main.cpp view
@@ -0,0 +1,46 @@+//=====================================================+// Copyright (C) 2008 Gael Guennebaud <gael.guennebaud@inria.fr>+//=====================================================+//+// 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<Action_axpy<mtl4_interface<REAL_TYPE> > >(MIN_AXPY,MAX_AXPY,NB_POINT);+  bench<Action_axpby<mtl4_interface<REAL_TYPE> > >(MIN_AXPY,MAX_AXPY,NB_POINT);++  bench<Action_matrix_vector_product<mtl4_interface<REAL_TYPE> > >(MIN_MV,MAX_MV,NB_POINT);+  bench<Action_atv_product<mtl4_interface<REAL_TYPE> > >(MIN_MV,MAX_MV,NB_POINT);+  bench<Action_matrix_matrix_product<mtl4_interface<REAL_TYPE> > >(MIN_MM,MAX_MM,NB_POINT);+//   bench<Action_ata_product<mtl4_interface<REAL_TYPE> > >(MIN_MM,MAX_MM,NB_POINT);+//   bench<Action_aat_product<mtl4_interface<REAL_TYPE> > >(MIN_MM,MAX_MM,NB_POINT);++  bench<Action_trisolve<mtl4_interface<REAL_TYPE> > >(MIN_MM,MAX_MM,NB_POINT);+//   bench<Action_cholesky<mtl4_interface<REAL_TYPE> > >(MIN_MM,MAX_MM,NB_POINT);+//   bench<Action_lu_decomp<mtl4_interface<REAL_TYPE> > >(MIN_MM,MAX_MM,NB_POINT);++  return 0;+}++
+ eigen3/bench/btl/libs/mtl4/mtl4_LU_solve_interface.hh view
@@ -0,0 +1,192 @@+//=====================================================+// File   :  blitz_LU_solve_interface.hh+// Author :  L. Plagne <laurent.plagne@edf.fr)>        +// 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 <vector>++BZ_USING_NAMESPACE(blitz)++template<class real>+class blitz_LU_solve_interface : public blitz_interface<real>+{++public :++  typedef typename blitz_interface<real>::gene_matrix gene_matrix;+  typedef typename blitz_interface<real>::gene_vector gene_vector;++  typedef blitz::Array<int,1> 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<col_end+1 ; j++){+	+	somme+=A(row,j)*B(j);+	+    }++    return somme;++  }+++++  static inline real matrix_matrix_product_sliced(gene_matrix & A, int row, int col_start, int col_end, gene_matrix & B, int row_shift, int col )+  {+    +    real somme=0.;+    +    for (int j=col_start ; j<col_end+1 ; j++){+	+	somme+=A(row,j)*B(j+row_shift,col);+	+    }++    return somme;++  }++  inline static void LU_factor(gene_matrix & LU, Pivot_Vector & pivot, int N)+  {++    ASSERT( LU.rows()==LU.cols() ) ;+    int index_max = 0 ;+    real big = 0. ;+    real theSum = 0. ;+    real dum = 0. ;+    // Get the implicit scaling information :+    gene_vector ImplicitScaling( N ) ;+    for( int i=0; i<N; i++ ) {+      big = 0. ;+      for( int j=0; j<N; j++ ) {+	if( abs( LU( i, 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<N; j++ ) {+      for( int i=0; i<j; i++ ) {+	theSum = LU( i, j ) ;+	theSum -= matrix_matrix_product_sliced(LU, i, 0, i-1, LU, 0, j) ;+	//	theSum -= sum( LU( i, Range( fromStart, i-1 ) )*LU( Range( fromStart, i-1 ), j ) ) ;+	LU( i, j ) = theSum ;+      }+      +      // Search for the largest pivot element :+      big = 0. ;+      for( int i=j; i<N; i++ ) {+	theSum = LU( i, j ) ;+	theSum -= matrix_matrix_product_sliced(LU, i, 0, j-1, LU, 0, j) ;+	//	theSum -= sum( LU( i, Range( fromStart, j-1 ) )*LU( Range( fromStart, j-1 ), j ) ) ;+	LU( i, j ) = theSum ;+	if( (ImplicitScaling( i )*abs( theSum ))>=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<N; k++ ) {+	  dum = LU( index_max, k ) ;+	  LU( index_max, k ) = LU( j, k ) ;+	  LU( j, k ) = dum ;+	}+	ImplicitScaling( index_max ) = ImplicitScaling( j ) ;+      }+      pivot( j ) = index_max ;+      if ( LU( j, j )==0. ) LU( j, j ) = 1.e-20 ;+      // Divide by the pivot element :+      if( j<N ) {+	dum = 1./LU( j, j ) ;+	for( int i=j+1; i<N; i++ ) LU( i, j ) *= dum ;+      }+    }++  }++  inline static void LU_solve(const gene_matrix & LU, const Pivot_Vector pivot, gene_vector &B, gene_vector X, int N)+  {++    // Pour conserver le meme header, on travaille sur X, copie du second-membre B+    X = B.copy() ;+    ASSERT( LU.rows()==LU.cols() ) ;+    firstIndex indI ;+    // Forward substitution :+    int ii = 0 ;+    real theSum = 0. ;+    for( int i=0; i<N; i++ ) {+      int ip = pivot( i ) ;+      theSum = X( ip ) ;+      //      theSum = B( ip ) ;+      X( ip ) = X( i ) ;+      //      B( ip ) = B( i ) ;+      if( ii ) {+	theSum -= matrix_vector_product_sliced(LU, X, i, ii-1, i-1) ;+	//	theSum -= sum( LU( i, Range( ii-1, i-1 ) )*X( Range( ii-1, i-1 ) ) ) ;+	//	theSum -= sum( LU( i, Range( ii-1, i-1 ) )*B( Range( ii-1, i-1 ) ) ) ;+      } else if( theSum ) {+	ii = i+1 ;+      }+      X( i ) = theSum ;+      //      B( i ) = theSum ;+    }+    // Backsubstitution :+    for( int i=N-1; i>=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
+ eigen3/bench/btl/libs/mtl4/mtl4_interface.hh view
@@ -0,0 +1,144 @@+//=====================================================+// Copyright (C) 2008 Gael Guennebaud <gael.guennebaud@inria.fr>+//=====================================================+//+// 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 <boost/numeric/mtl/mtl.hpp>+#include <boost/numeric/mtl/utility/range_generator.hpp>+// #include <boost/numeric/mtl/operation/cholesky.hpp>+#include <vector>++using namespace mtl;++template<class real>+class mtl4_interface {++public :++  typedef real real_type ;++  typedef std::vector<real>  stl_vector;+  typedef std::vector<stl_vector > stl_matrix;++  typedef mtl::dense2D<real, mtl::matrix::parameters<mtl::tag::col_major> > gene_matrix;+  typedef mtl::dense_vector<real>  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<A_stl.size() ; j++){+      for (int i=0; i<A_stl[j].size() ; i++){+        A(i,j) = A_stl[j][i];+      }+    }+  }++  static inline void vector_from_stl(gene_vector & B, stl_vector & B_stl){+    B.change_dim(B_stl.size());+    for (int i=0; i<B_stl.size() ; i++){+      B[i] = B_stl[i];+    }+  }++  static inline void vector_to_stl(gene_vector & B, stl_vector & B_stl){+    for (int i=0; i<B_stl.size() ; i++){+      B_stl[i] = B[i];+    }+  }++  static inline void matrix_to_stl(gene_matrix & A, stl_matrix & A_stl){+    int N=A_stl.size();+    for (int j=0;j<N;j++){+      A_stl[j].resize(N);+      for (int i=0;i<N;i++){+        A_stl[j][i] = A(i,j);+      }+    }+  }++  static inline void matrix_matrix_product(const gene_matrix & A, const gene_matrix & B, gene_matrix & X, int N){+    X = (A*B);+//     morton_dense<double, doppled_64_row_mask> 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<int> 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
+ eigen3/bench/btl/libs/tensors/CMakeLists.txt view
@@ -0,0 +1,44 @@+++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(NOT BTL_NOVEC)++endif (TENSOR_FOUND)
+ eigen3/bench/btl/libs/tensors/main_linear.cpp view
@@ -0,0 +1,23 @@+// This file is part of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2014 Benoit Steiner <benoit.steiner.goog@gmail.com>+//+// 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<Action_axpy<tensor_interface<REAL_TYPE> > >(MIN_AXPY,MAX_AXPY,NB_POINT);+  bench<Action_axpby<tensor_interface<REAL_TYPE> > >(MIN_AXPY,MAX_AXPY,NB_POINT);++  return 0;+}
+ eigen3/bench/btl/libs/tensors/main_matmat.cpp view
@@ -0,0 +1,21 @@+//=====================================================+// Copyright (C) 2014 Benoit Steiner <benoit.steiner.goog@gmail.com>+//=====================================================+//+// 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<Action_matrix_matrix_product<tensor_interface<REAL_TYPE> > >(MIN_MM,MAX_MM,NB_POINT);++  return 0;+}
+ eigen3/bench/btl/libs/tensors/main_vecmat.cpp view
@@ -0,0 +1,21 @@+//=====================================================+// Copyright (C) 2014 Benoit Steiner <benoit.steiner.goog@gmail.com>+//=====================================================+//+// 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<Action_matrix_vector_product<tensor_interface<REAL_TYPE> > >(MIN_MV,MAX_MV,NB_POINT);++  return 0;+}
+ eigen3/bench/btl/libs/tensors/tensor_interface.hh view
@@ -0,0 +1,105 @@+//=====================================================+// Copyright (C) 2014 Benoit Steiner <benoit.steiner.goog@gmail.com>+//=====================================================+//+// 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 <unsupported/Eigen/CXX11/Tensor>+#include <vector>+#include "btl.hh"++using namespace Eigen;++template<class real>+class tensor_interface+{+public :+  typedef real real_type;+  typedef typename Eigen::Tensor<real,2>::Index Index;++  typedef std::vector<real> stl_vector;+  typedef std::vector<stl_vector> stl_matrix;++  typedef Eigen::Tensor<real,2> gene_matrix;+  typedef Eigen::Tensor<real,1> 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<Index,2>(A_stl[0].size(), A_stl.size()));++    for (unsigned int j=0; j<A_stl.size() ; j++){+      for (unsigned int i=0; i<A_stl[j].size() ; i++){+        A.coeffRef(Eigen::array<Index,2>(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<B_stl.size() ; i++){+      B.coeffRef(i) = B_stl[i];+    }+  }++  static BTL_DONT_INLINE  void vector_to_stl(gene_vector & B, stl_vector & B_stl){+    for (unsigned int i=0; i<B_stl.size() ; i++){+      B_stl[i] = B.coeff(i);+    }+  }++  static BTL_DONT_INLINE  void matrix_to_stl(gene_matrix & A, stl_matrix & A_stl){+    int  N=A_stl.size();++    for (int j=0;j<N;j++){+      A_stl[j].resize(N);+      for (int i=0;i<N;i++){+        A_stl[j][i] = A.coeff(Eigen::array<Index,2>(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<real_type, 1>::DimensionPair DimPair;+    const Eigen::array<DimPair, 1> 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<real_type, 1>::DimensionPair DimPair;+    const Eigen::array<DimPair, 1> 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
+ eigen3/bench/btl/libs/tvmet/CMakeLists.txt view
@@ -0,0 +1,6 @@++find_package(Tvmet)+if (TVMET_FOUND)+  include_directories(${TVMET_INCLUDE_DIR})+  btl_add_bench(btl_tvmet main.cpp OFF)+endif (TVMET_FOUND)
+ eigen3/bench/btl/libs/tvmet/main.cpp view
@@ -0,0 +1,40 @@+//=====================================================+// File   :  main.cpp+// Author :  L. Plagne <laurent.plagne@edf.fr)>+// 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<Action_axpy,tvmet_interface>();+  bench_static<Action_matrix_matrix_product,tvmet_interface>();+  bench_static<Action_matrix_vector_product,tvmet_interface>();+  bench_static<Action_atv_product,tvmet_interface>();++  return 0;+}++
+ eigen3/bench/btl/libs/tvmet/tvmet_interface.hh view
@@ -0,0 +1,104 @@+//=====================================================+// File   :  tvmet_interface.hh+// Author :  L. Plagne <laurent.plagne@edf.fr)>+// 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 <tvmet/tvmet.h>+#include <tvmet/Vector.h>+#include <tvmet/Matrix.h>++#include <vector>++using namespace tvmet;++template<class real, int SIZE>+class tvmet_interface{++public :++  typedef real real_type ;++  typedef std::vector<real>  stl_vector;+  typedef std::vector<stl_vector > stl_matrix;++  typedef Vector<real,SIZE> gene_vector;+  typedef Matrix<real,SIZE,SIZE> 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<A_stl.size() ; j++)+      for (int i=0; i<A_stl[j].size() ; i++)+        A(i,j) = A_stl[j][i];+  }++  static inline void vector_from_stl(gene_vector & B, stl_vector & B_stl){+    for (int i=0; i<B_stl.size() ; i++)+      B[i]=B_stl[i];+  }++  static inline void vector_to_stl(gene_vector & B, stl_vector & B_stl){+    for (int i=0; i<B_stl.size() ; i++){+      B_stl[i]=B[i];+    }+  }++  static inline void matrix_to_stl(gene_matrix & A, stl_matrix & A_stl){+    int N = A_stl.size();+    for (int j=0;j<N;j++){+      A_stl[j].resize(N);+      for (int i=0;i<N;i++)+        A_stl[j][i] = A(i,j);+    }+  }+++  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;+  }++  static inline void matrix_matrix_product(const gene_matrix & A, const gene_matrix & B, gene_matrix & X, int N){+    X = prod(A,B);+  }++  static inline void matrix_vector_product(gene_matrix & A, gene_vector & B, gene_vector & X, int N){+    X = prod(A,B);+  }++  static inline void atv_product(gene_matrix & A, gene_vector & B, gene_vector & X, int N){+    X = prod(trans(A),B);+  }++  static inline void axpy(const real coef, const gene_vector & X, gene_vector & Y, int N){+    Y+=coef*X;+  }++};+++#endif
+ eigen3/bench/btl/libs/ublas/CMakeLists.txt view
@@ -0,0 +1,7 @@++find_package(Boost)+if (Boost_FOUND)+  include_directories(${Boost_INCLUDE_DIRS})+  include_directories(${Boost_INCLUDES})+  btl_add_bench(btl_ublas main.cpp)+endif (Boost_FOUND)
+ eigen3/bench/btl/libs/ublas/main.cpp view
@@ -0,0 +1,44 @@+//=====================================================+// File   :  main.cpp+// Author :  L. Plagne <laurent.plagne@edf.fr)>+// 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<Action_axpy<ublas_interface<REAL_TYPE> > >(MIN_AXPY,MAX_AXPY,NB_POINT);+  bench<Action_axpby<ublas_interface<REAL_TYPE> > >(MIN_AXPY,MAX_AXPY,NB_POINT);++  bench<Action_matrix_vector_product<ublas_interface<REAL_TYPE> > >(MIN_MV,MAX_MV,NB_POINT);+  bench<Action_atv_product<ublas_interface<REAL_TYPE> > >(MIN_MV,MAX_MV,NB_POINT);++  bench<Action_matrix_matrix_product<ublas_interface<REAL_TYPE> > >(MIN_MM,MAX_MM,NB_POINT);+//   bench<Action_ata_product<ublas_interface<REAL_TYPE> > >(MIN_MM,MAX_MM,NB_POINT);+//   bench<Action_aat_product<ublas_interface<REAL_TYPE> > >(MIN_MM,MAX_MM,NB_POINT);++  bench<Action_trisolve<ublas_interface<REAL_TYPE> > >(MIN_MM,MAX_MM,NB_POINT);++  return 0;+}++
+ eigen3/bench/btl/libs/ublas/ublas_interface.hh view
@@ -0,0 +1,141 @@+//=====================================================+// File   :  ublas_interface.hh+// Author :  L. Plagne <laurent.plagne@edf.fr)>+// 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 <boost/numeric/ublas/vector.hpp>+#include <boost/numeric/ublas/matrix.hpp>+#include <boost/numeric/ublas/io.hpp>+#include <boost/numeric/ublas/triangular.hpp>++using namespace boost::numeric;++template <class real>+class ublas_interface{++public :++  typedef real real_type ;++  typedef std::vector<real> stl_vector;+  typedef std::vector<stl_vector> stl_matrix;++  typedef typename boost::numeric::ublas::matrix<real,boost::numeric::ublas::column_major> gene_matrix;+  typedef typename boost::numeric::ublas::vector<real> 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<A_stl.size() ; j++)+      for (int i=0; i<A_stl[j].size() ; i++)+        A(i,j)=A_stl[j][i];+  }++  static inline void vector_from_stl(gene_vector & B, stl_vector & B_stl){+    B.resize(B_stl.size());+    for (int i=0; i<B_stl.size() ; i++)+      B(i)=B_stl[i];+  }++  static inline void vector_to_stl(gene_vector & B, stl_vector & B_stl){+    for (int i=0; i<B_stl.size() ; i++)+      B_stl[i]=B(i);+  }++  static inline void matrix_to_stl(gene_matrix & A, stl_matrix & A_stl){+    int N=A_stl.size();+    for (int j=0;j<N;j++)+    {+      A_stl[j].resize(N);+      for (int i=0;i<N;i++)+        A_stl[j][i]=A(i,j);+    }+  }++  static inline void copy_vector(const gene_vector & source, gene_vector & cible, int N){+    for (int i=0;i<N;i++){+      cible(i) = source(i);+    }+  }++  static inline void copy_matrix(const gene_matrix & source, gene_matrix & cible, int N){+    for (int i=0;i<N;i++){+      for (int j=0;j<N;j++){+        cible(i,j) = source(i,j);+      }+    }+  }++  static inline void matrix_vector_product_slow(gene_matrix & A, gene_vector & B, gene_vector & X, int N){+    X =  prod(A,B);+  }++  static inline void matrix_matrix_product_slow(gene_matrix & A, gene_matrix & B, gene_matrix & X, int N){+    X =  prod(A,B);+  }++  static inline void axpy_slow(const real coef, const gene_vector & X, gene_vector & Y, int N){+    Y+=coef*X;+  }++  // alias free assignements++  static inline void matrix_vector_product(gene_matrix & A, gene_vector & B, gene_vector & X, int N){+    X.assign(prod(A,B));+  }++  static inline void atv_product(gene_matrix & A, gene_vector & B, gene_vector & X, int N){+    X.assign(prod(trans(A),B));+  }++  static inline void matrix_matrix_product(gene_matrix & A, gene_matrix & B, gene_matrix & X, int N){+    X.assign(prod(A,B));+  }++  static inline void axpy(const real coef, const gene_vector & X, gene_vector & Y, int N){+    Y.plus_assign(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 ata_product(gene_matrix & A, gene_matrix & X, int N){+    // X =  prod(trans(A),A);+    X.assign(prod(trans(A),A));+  }++  static inline void aat_product(gene_matrix & A, gene_matrix & X, int N){+    // X =  prod(A,trans(A));+    X.assign(prod(A,trans(A)));+  }++  static inline void trisolve_lower(const gene_matrix & L, const gene_vector& B, gene_vector & X, int N){+    X = solve(L, B, ublas::lower_tag ());+  }++};++#endif
+ eigen3/bench/check_cache_queries.cpp view
@@ -0,0 +1,101 @@++#define EIGEN_INTERNAL_DEBUG_CACHE_QUERY+#include <iostream>+#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<max_funcs; ++i)+    DUMP_CPUID(i);++  DUMP_CPUID(0x80000000);+  DUMP_CPUID(0x80000001);+  DUMP_CPUID(0x80000002);+  DUMP_CPUID(0x80000003);+  DUMP_CPUID(0x80000004);+  DUMP_CPUID(0x80000005);+  DUMP_CPUID(0x80000006);+  DUMP_CPUID(0x80000007);+  DUMP_CPUID(0x80000008);+  #else+  cout << "EIGEN_CPUID is not defined" << endl;+  #endif+  return 0;+}
+ eigen3/bench/dense_solvers.cpp view
@@ -0,0 +1,186 @@+#include <iostream>+#include "BenchTimer.h"+#include <Eigen/Dense>+#include <map>+#include <vector>+#include <string>+#include <sstream>+using namespace Eigen;++std::map<std::string,Array<float,1,8,DontAlign|RowMajor> > results;+std::vector<std::string> labels;+std::vector<Array2i> sizes;++template<typename Solver,typename MatrixType>+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<typename Solver,typename MatrixType>+EIGEN_DONT_INLINE+void compute(Solver &solver, const MatrixType &A) {+  solver.compute(A);+}++template<typename Scalar,int Size>+void bench(int id, int rows, int size = Size)+{+  typedef Matrix<Scalar,Dynamic,Size> Mat;+  typedef Matrix<Scalar,Dynamic,Dynamic> MatDyn;+  typedef Matrix<Scalar,Size,Size> 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<MatSquare> llt(size);+  LDLT<MatSquare> ldlt(size);+  PartialPivLU<MatSquare> lu(size);+  FullPivLU<MatSquare> fplu(size,size);+  HouseholderQR<Mat> qr(A.rows(),A.cols());+  ColPivHouseholderQR<Mat> cpqr(A.rows(),A.cols());+  CompleteOrthogonalDecomposition<Mat> cod(A.rows(),A.cols());+  FullPivHouseholderQR<Mat> fpqr(A.rows(),A.cols());+  JacobiSVD<MatDyn> jsvd(A.rows(),A.cols());+  BDCSVD<MatDyn> 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<labels.size(); ++i)+    results[labels[i]].fill(-1);++  const int small = 8;+  sizes.push_back(Array2i(small,small));+  sizes.push_back(Array2i(100,100));+  sizes.push_back(Array2i(1000,1000));+  sizes.push_back(Array2i(4000,4000));+  sizes.push_back(Array2i(10000,small));+  sizes.push_back(Array2i(10000,100));+  sizes.push_back(Array2i(10000,1000));+  sizes.push_back(Array2i(10000,4000));++  using namespace std;++  for(int k=0; k<sizes.size(); ++k)+  {+    cout << sizes[k](0) << "x" << sizes[k](1) << "...\n";+    bench<float,Dynamic>(k,sizes[k](0),sizes[k](1));+  }++  cout.width(32);+  cout << "solver/size";+  cout << "  ";+  for(int k=0; k<sizes.size(); ++k)+  {+    std::stringstream ss;+    ss << sizes[k](0) << "x" << sizes[k](1);+    cout.width(10); cout << ss.str(); cout << " ";+  }+  cout << endl;+++  for(int i=0; i<labels.size(); ++i)+  {+    cout.width(32); cout << labels[i]; cout << "  ";+    ArrayXf r = (results[labels[i]]*100000.f).floor()/100.f;+    for(int k=0; k<sizes.size(); ++k)+    {+      cout.width(10);+      if(r(k)>=1e6)  cout << "-";+      else           cout << r(k);+      cout << " ";+    }+    cout << endl;+  }++  // HTML output+  cout << "<table class=\"manual\">" << endl;+  cout << "<tr><th>solver/size</th>" << endl;+  for(int k=0; k<sizes.size(); ++k)+    cout << "  <th>" << sizes[k](0) << "x" << sizes[k](1) << "</th>";+  cout << "</tr>" << endl;+  for(int i=0; i<labels.size(); ++i)+  {+    cout << "<tr";+    if(i%2==1) cout << " class=\"alt\"";+    cout << "><td>" << labels[i] << "</td>";+    ArrayXf r = (results[labels[i]]*100000.f).floor()/100.f;+    for(int k=0; k<sizes.size(); ++k)+    {+      if(r(k)>=1e6) cout << "<td>-</td>";+      else+      {+        cout << "<td>" << 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 << " <sup><a href=\"#note_ls\">*</a></sup>";+        cout << "</td>";+      }+    }+    cout << "</tr>" << endl;+  }+  cout << "</table>" << 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";+}
+ eigen3/bench/eig33.cpp view
@@ -0,0 +1,195 @@+// This file is part of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2010 Gael Guennebaud <gael.guennebaud@inria.fr>+//+// 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 <iostream>+#include <Eigen/Core>+#include <Eigen/Eigenvalues>+#include <Eigen/Geometry>+#include <bench/BenchTimer.h>++using namespace Eigen;+using namespace std;++template<typename Matrix, typename Roots>+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<typename Matrix, typename Vector>+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<Lower>()*/.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 differents 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<Scalar>::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<Scalar>::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<Mat> 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";+}
+ eigen3/bench/geometry.cpp view
@@ -0,0 +1,126 @@++#include <iostream>+#include <Eigen/Geometry>+#include <bench/BenchTimer.h>++using namespace std;+using namespace Eigen;++#ifndef SCALAR+#define SCALAR float+#endif++#ifndef SIZE+#define SIZE 8+#endif++typedef SCALAR Scalar;+typedef NumTraits<Scalar>::Real RealScalar;+typedef Matrix<RealScalar,Dynamic,Dynamic> A;+typedef Matrix</*Real*/Scalar,Dynamic,Dynamic> B;+typedef Matrix<Scalar,Dynamic,Dynamic> C;+typedef Matrix<RealScalar,Dynamic,Dynamic> M;++template<typename Transformation, typename Data>+EIGEN_DONT_INLINE void transform(const Transformation& t, Data& data)+{+  EIGEN_ASM_COMMENT("begin");+  data = t * data;+  EIGEN_ASM_COMMENT("end");+}++template<typename Scalar, typename Data>+EIGEN_DONT_INLINE void transform(const Quaternion<Scalar>& t, Data& data)+{+  EIGEN_ASM_COMMENT("begin quat");+  for(int i=0;i<data.cols();++i)+    data.col(i) = t * data.col(i);+  EIGEN_ASM_COMMENT("end quat");+}++template<typename T> struct ToRotationMatrixWrapper+{+  enum {Dim = T::Dim};+  typedef typename T::Scalar Scalar;+  ToRotationMatrixWrapper(const T& o) : object(o) {}+  T object;+};++template<typename QType, typename Data>+EIGEN_DONT_INLINE void transform(const ToRotationMatrixWrapper<QType>& t, Data& data)+{+  EIGEN_ASM_COMMENT("begin quat via mat");+  data = t.object.toRotationMatrix() * data;+  EIGEN_ASM_COMMENT("end quat via mat");+}++template<typename Scalar, int Dim, typename Data>+EIGEN_DONT_INLINE void transform(const Transform<Scalar,Dim,Projective>& t, Data& data)+{+  data = (t * data.colwise().homogeneous()).template block<Dim,Data::ColsAtCompileTime>(0,0);+}++template<typename T> struct get_dim { enum { Dim = T::Dim }; };+template<typename S, int R, int C, int O, int MR, int MC>+struct get_dim<Matrix<S,R,C,O,MR,MC> > { enum { Dim = R }; };++template<typename Transformation, int N>+struct bench_impl+{+  static EIGEN_DONT_INLINE void run(const Transformation& t)+  {+    Matrix<typename Transformation::Scalar,get_dim<Transformation>::Dim,N> data;+    data.setRandom();+    bench_impl<Transformation,N-1>::run(t);+    BenchTimer timer;+    BENCH(timer,10,100000,transform(t,data));+    cout.width(9);+    cout << timer.best() << " ";+  }+};+++template<typename Transformation>+struct bench_impl<Transformation,0>+{+  static EIGEN_DONT_INLINE void run(const Transformation&) {}+};++template<typename Transformation>+EIGEN_DONT_INLINE void bench(const std::string& msg, const Transformation& t)+{+  cout << msg << " ";+  bench_impl<Transformation,SIZE>::run(t);+  std::cout << "\n";+}++int main(int argc, char ** argv)+{+  Matrix<Scalar,3,4> mat34; mat34.setRandom();+  Transform<Scalar,3,Isometry> iso3(mat34);+  Transform<Scalar,3,Affine> aff3(mat34);+  Transform<Scalar,3,AffineCompact> caff3(mat34);+  Transform<Scalar,3,Projective> proj3(mat34);+  Quaternion<Scalar> quat;quat.setIdentity();+  ToRotationMatrixWrapper<Quaternion<Scalar> > quatmat(quat);+  Matrix<Scalar,3,3> mat33; mat33.setRandom();+  +  cout.precision(4);+  std::cout+     << "N          ";+  for(int i=0;i<SIZE;++i)+  {+    cout.width(9);+    cout << i+1 << " ";+  }+  cout << "\n";+  +  bench("matrix 3x3", mat33);+  bench("quaternion", quat);+  bench("quat-mat  ", quatmat);+  bench("isometry3 ", iso3);+  bench("affine3   ", aff3);+  bench("c affine3 ", caff3);+  bench("proj3     ", proj3);+}+
+ eigen3/bench/perf_monitoring/gemm/changesets.txt view
@@ -0,0 +1,61 @@+#3.0.1+#3.1.1+#3.2.0+3.2.4+#5745:37f59e65eb6c+5891:d8652709345d  # introduce AVX+#5893:24b4dc92c6d3  # merge+5895:997c2ef9fc8b  # introduce FMA+#5904:e1eafd14eaa1  # complex and AVX+5908:f8ee3c721251  # improve packing with ptranspose+#5921:ca808bb456b0  # merge+#5927:8b1001f9e3ac+5937:5a4ca1ad8c53  # New gebp kernel handling up to 3 packets x 4 register-level blocks+#5949:f3488f4e45b2  # merge+#5969:e09031dccfd9  # Disable 3pX4 kernel on Altivec+#5992:4a429f5e0483  # merge+before-evaluators+#6334:f6a45e5b8b7c  # Implement evaluator for sparse outer products+#6639:c9121c60b5c7+#6655:06f163b5221f  # Properly detect FMA support on ARM+#6677:700e023044e7   # FMA has been wrongly disabled+#6681:11d31dafb0e3+#6699:5e6e8e10aad1   # merge default to tensors+#6726:ff2d2388e7b9   # merge default to tensors+#6742:0cbd6195e829   # merge default to tensors+#6747:853d2bafeb8f   # Generalized the gebp apis+6765:71584fd55762   # Made the blocking computation aware of the l3 cache; Also optimized the blocking parameters to take into account the number of threads used for a computation+#6781:9cc5a931b2c6   # generalized gemv+#6792:f6e1daab600a   # ensured that contractions that can be reduced to a matrix vector product+#6844:039efd86b75c   # merge tensor+6845:7333ed40c6ef   # change prefetching in gebp+#6856:b5be5e10eb7f   # merge index conversion+#6893:c3a64aba7c70   # clean blocking size computation+#6898:6fb31ebe6492   # rotating kernel for ARM+6899:877facace746   # rotating kernel for ARM only+#6904:c250623ae9fa   # result_of+6921:915f1b1fc158   # fix prefetching change for ARM+6923:9ff25f6dacc6   # prefetching+6933:52572e60b5d3   # blocking size strategy+6937:c8c042f286b2   # avoid redundant pack_rhs+6981:7e5d6f78da59   # dynamic loop swapping+6984:45f26866c091   # rm dynamic loop swapping, adjust lhs's micro panel height to fully exploit L1 cache+6986:a675d05b6f8f   # blocking heuristic: block on the rhs in L1 if the lhs fit in L1.+7013:f875e75f07e5   # organize a little our default cache sizes, and use a saner default L1 outside of x86 (10% faster on Nexus 5)+7015:8aad8f35c955   # Refactor computeProductBlockingSizes to make room for the possibility of using lookup tables+7016:a58d253e8c91   # Polish lookup tables generation+7018:9b27294a8186   # actual_panel_rows computation should always be resilient to parameters not consistent with the known L1 cache size, see comment+7019:c758b1e2c073   # Provide a empirical lookup table for blocking sizes measured on a Nexus 5. Only for float, only for Android on ARM 32bit for now.+7085:627e039fba68   # Bug 986: add support for coefficient-based product with 0 depth.+7098:b6f1db9cf9ec   # Bug 992: don't select a 3p GEMM path with non-vectorizable scalar types, this hits unsupported paths in symm/triangular products code+7591:09a8e2186610   # 3.3-alpha1+7650:b0f3c8f43025   # help clang inlining+#8744:74b789ada92a   # Improved the matrix multiplication blocking in the case where mr is not a power of 2 (e.g on Haswell CPUs)+8789:efcb912e4356   # 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+8972:81d53c711775   # 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+8985:d935df21a082   # Remove the rotating kernel.+8988:6c2dc56e73b3   # Bug 256: enable vectorization with unaligned loads/stores.+9148:b8b8c421e36c   # Relax mixing-type constraints for binary coefficient-wise operators+9174:d228bc282ac9   # merge+9212:c90098affa7b   # Fix performance regression introduced in changeset 8aad8f35c955+9213:9f1c14e4694b   # Fix performance regression in dgemm introduced by changeset 81d53c711775
+ eigen3/bench/perf_monitoring/gemm/gemm.cpp view
@@ -0,0 +1,67 @@+#include <iostream>+#include <fstream>+#include <vector>+#include <Eigen/Core>+#include "../../BenchTimer.h"+using namespace Eigen;++#ifndef SCALAR+#error SCALAR must be defined+#endif++typedef SCALAR Scalar;++typedef Matrix<Scalar,Dynamic,Dynamic> Mat;++EIGEN_DONT_INLINE+void gemm(const Mat &A, const Mat &B, Mat &C)+{+  C.noalias() += A * B;+}++EIGEN_DONT_INLINE+double bench(long m, long n, long k)+{+  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<Scalar>::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, gemm(A,B,C));+  +  return 1e-9 * rep * flops / t.best();+}++int main(int argc, char **argv)+{+  std::vector<double> results;+  +  std::ifstream settings("gemm_settings.txt");+  long m, n, k;+  while(settings >> m >> n >> k)+  {+    //std::cerr << "  Testing " << m << " " << n << " " << k << std::endl;+    results.push_back( bench(m, n, k) );+  }+  +  std::cout << RowVectorXd::Map(results.data(), results.size());+  +  return 0;+}
+ eigen3/bench/perf_monitoring/gemm/gemm_settings.txt view
@@ -0,0 +1,15 @@+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
+ eigen3/bench/perf_monitoring/gemm/lazy_gemm.cpp view
@@ -0,0 +1,98 @@+#include <iostream>+#include <fstream>+#include <vector>+#include <Eigen/Core>+#include "../../BenchTimer.h"+using namespace Eigen;++#ifndef SCALAR+#error SCALAR must be defined+#endif++typedef SCALAR Scalar;++template<typename MatA, typename MatB, typename MatC>+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<int m, int n, int k, int TA>+EIGEN_DONT_INLINE+double bench()+{+  typedef Matrix<Scalar,m,k,TA> MatA;+  typedef Matrix<Scalar,k,n> MatB;+  typedef Matrix<Scalar,m,n> 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<int m, int n, int k>+double bench_t(int t)+{+  if(t)+    return bench<m,n,k,RowMajor>();+  else+    return bench<m,n,k,0>();+}++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<double> results;+  +  std::ifstream settings("lazy_gemm_settings.txt");+  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;+}
+ eigen3/bench/perf_monitoring/gemm/lazy_gemm_settings.txt view
@@ -0,0 +1,15 @@+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
+ eigen3/bench/perf_monitoring/gemm/make_plot.sh view
@@ -0,0 +1,38 @@+#!/bin/bash++# base name of the bench+# it reads $1.out+# and generates $1.pdf+WHAT=$1+bench=$2++header="rev "+while read line+do+  if [ ! -z '$line' ]; then+    header="$header  \"$line\""+  fi+done < $bench"_settings.txt"++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 $bench"_settings.txt" | 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+# convert -background white -density 120 -rotate 90 -resize 800 +dither -colors 256 -quality 0 $WHAT.ps -background white -flatten  .$WHAT.png++# clean+rm $WHAT.out.header $WHAT.gnuplot
+ eigen3/bench/perf_monitoring/gemm/run.sh view
@@ -0,0 +1,156 @@+#!/bin/bash++# ./run.sh gemm+# ./run.sh lazy_gemm++# Examples of environment variables to be set:+#   PREFIX="haswell-fma-"+#   CXX_FLAGS="-mfma"++# Options:+#   -up : enforce the recomputation of existing data, and keep best results as a merging strategy+#   -s  : recompute selected changesets only and keep bests++bench=$1++if echo "$*" | grep '\-up' > /dev/null; then+  update=true+else+  update=false+fi++if echo "$*" | grep '\-s' > /dev/null; then+  selected=true+else+  selected=false+fi++global_args="$*"++if [ $selected == true ]; then+ echo "Recompute selected changesets only and keep bests"+elif [ $update == true ]; then+ echo "(Re-)Compute all changesets and keep bests"+else+ echo "Skip previously computed changesets"+fi++++if [ ! -d "eigen_src" ]; then+  hg clone https://bitbucket.org/eigen/eigen eigen_src+else+  cd eigen_src+  hg pull -u+  cd ..+fi++if [ ! -z '$CXX' ]; then+  CXX=g+++fi++function make_backup+{+  if [ -f "$1.out" ]; then+    mv "$1.out" "$1.backup"+  fi+}++function merge+{+  count1=`echo $1 |  wc -w`+  count2=`echo $2 |  wc -w`+  +  if [ $count1 == $count2 ]; then+    a=( $1 ); b=( $2 )+    res=""+    for (( i=0 ; i<$count1 ; i++ )); do+      ai=${a[$i]}; bi=${b[$i]}+      tmp=`echo "if ($ai > $bi) $ai else $bi " | bc -l`+      res="$res $tmp"+    done+    echo $res++  else+    echo $1+  fi+}++function test_current +{+  rev=$1+  scalar=$2+  name=$3+  +  prev=""+  if [ -e "$name.backup" ]; then+    prev=`grep $rev "$name.backup" | cut -c 14-`+  fi+  res=$prev+  count_rev=`echo $prev |  wc -w`+  count_ref=`cat $bench"_settings.txt" |  wc -l`+  if echo "$global_args" | grep "$rev" > /dev/null; then+    rev_found=true+  else+    rev_found=false+  fi+#  echo $update et $selected et $rev_found because $rev et "$global_args"+#  echo $count_rev et $count_ref+  if [ $update == true ] || [ $count_rev != $count_ref ] || ([ $selected == true ] &&  [ $rev_found == true ]); then+    if $CXX -O2 -DNDEBUG -march=native $CXX_FLAGS -I eigen_src $bench.cpp -DSCALAR=$scalar -o $name; then+      curr=`./$name`+      if [ $count_rev == $count_ref ]; then+        echo "merge previous $prev"+        echo "with new       $curr"+      else+        echo "got            $curr"+      fi+      res=`merge "$curr" "$prev"`+#       echo $res+      echo "$rev $res" >> $name.out+    else+      echo "Compilation failed, skip rev $rev"+    fi+  else+    echo "Skip existing results for $rev / $name"+    echo "$rev $res" >> $name.out+  fi+}++make_backup $PREFIX"s"$bench+make_backup $PREFIX"d"$bench+make_backup $PREFIX"c"$bench++cut -f1 -d"#" < changesets.txt | grep -E '[[:alnum:]]' | while read rev+do+  if [ ! -z '$rev' ]; then+    echo "Testing rev $rev"+    cd eigen_src+    hg up -C $rev > /dev/null+    actual_rev=`hg identify | cut -f1 -d' '`+    cd ..+    +    test_current $actual_rev float                  $PREFIX"s"$bench+    test_current $actual_rev double                 $PREFIX"d"$bench+    test_current $actual_rev "std::complex<double>" $PREFIX"c"$bench+  fi+  +done++echo "Float:"+cat $PREFIX"s""$bench.out"+echo " "++echo "Double:"+cat $PREFIX"d""$bench.out"+echo ""++echo "Complex:"+cat $PREFIX"c""$bench.out"+echo ""++./make_plot.sh $PREFIX"s"$bench $bench+./make_plot.sh $PREFIX"d"$bench $bench+./make_plot.sh $PREFIX"c"$bench $bench++
+ eigen3/bench/product_threshold.cpp view
@@ -0,0 +1,143 @@++#include <iostream>+#include <Eigen/Core>+#include <bench/BenchTimer.h>++using namespace Eigen;+using namespace std;++#define END 9++template<int S> struct map_size { enum { ret = S }; };+template<>  struct map_size<10> { enum { ret = 20 }; };+template<>  struct map_size<11> { enum { ret = 50 }; };+template<>  struct map_size<12> { enum { ret = 100 }; };+template<>  struct map_size<13> { enum { ret = 300 }; };++template<int M, int N,int K> struct alt_prod+{+  enum {+    ret = M==1 && N==1 ? InnerProduct+        : K==1 ? OuterProduct+        : M==1 ? GemvProduct+        : N==1 ? GemvProduct+        : GemmProduct+  };+};+        +void print_mode(int mode)+{+  if(mode==InnerProduct) std::cout << "i";+  if(mode==OuterProduct) std::cout << "o";+  if(mode==CoeffBasedProductMode) std::cout << "c";+  if(mode==LazyCoeffBasedProductMode) std::cout << "l";+  if(mode==GemvProduct) std::cout << "v";+  if(mode==GemmProduct) std::cout << "m";+}++template<int Mode, typename Lhs, typename Rhs, typename Res>+EIGEN_DONT_INLINE void prod(const Lhs& a, const Rhs& b, Res& c)+{+  c.noalias() += typename ProductReturnType<Lhs,Rhs,Mode>::Type(a,b);+}++template<int M, int N, int K, typename Scalar, int Mode>+EIGEN_DONT_INLINE void bench_prod()+{+  typedef Matrix<Scalar,M,K> Lhs; Lhs a; a.setRandom();+  typedef Matrix<Scalar,K,N> Rhs; Rhs b; b.setRandom();+  typedef Matrix<Scalar,M,N> Res; Res c; c.setRandom();++  BenchTimer t;+  double n = 2.*double(M)*double(N)*double(K);+  int rep = 100000./n;+  rep /= 2;+  if(rep<1) rep = 1;+  do {+    rep *= 2;+    t.reset();+    BENCH(t,1,rep,prod<CoeffBasedProductMode>(a,b,c));+  } while(t.best()<0.1);+  +  t.reset();+  BENCH(t,5,rep,prod<Mode>(a,b,c));++  print_mode(Mode);+  std::cout << int(1e-6*n*rep/t.best()) << "\t";+}++template<int N> struct print_n;+template<int M, int N, int K> struct loop_on_m;+template<int M, int N, int K, typename Scalar, int Mode> struct loop_on_n;++template<int M, int N, int K>+struct loop_on_k+{+  static void run()+  {+    std::cout << "K=" << K << "\t";+    print_n<N>::run();+    std::cout << "\n";++    loop_on_m<M,N,K>::run();+    std::cout << "\n\n";++    loop_on_k<M,N,K+1>::run();+  }+};++template<int M, int N>+struct loop_on_k<M,N,END> { static void run(){} };+++template<int M, int N, int K>+struct loop_on_m+{+  static void run()+  {+    std::cout << M << "f\t";+    loop_on_n<M,N,K,float,CoeffBasedProductMode>::run();+    std::cout << "\n";+    +    std::cout << M << "f\t";+    loop_on_n<M,N,K,float,-1>::run();+    std::cout << "\n";++    loop_on_m<M+1,N,K>::run();+  }+};++template<int N, int K>+struct loop_on_m<END,N,K> { static void run(){} };++template<int M, int N, int K, typename Scalar, int Mode>+struct loop_on_n+{+  static void run()+  {+    bench_prod<M,N,K,Scalar,Mode==-1? alt_prod<M,N,K>::ret : Mode>();+    +    loop_on_n<M,N+1,K,Scalar,Mode>::run();+  }+};++template<int M, int K, typename Scalar, int Mode>+struct loop_on_n<M,END,K,Scalar,Mode> { static void run(){} };++template<int N> struct print_n+{+  static void run()+  {+    std::cout << map_size<N>::ret << "\t";+    print_n<N+1>::run();+  }+};++template<> struct print_n<END> { static void run(){} };++int main()+{+  loop_on_k<1,1,1>::run();+  +  return 0; +}
+ eigen3/bench/quat_slerp.cpp view
@@ -0,0 +1,247 @@++#include <iostream>+#include <Eigen/Geometry>+#include <bench/BenchTimer.h>+using namespace Eigen;+using namespace std;++++template<typename Q>+EIGEN_DONT_INLINE Q nlerp(const Q& a, const Q& b, typename Q::Scalar t)+{+  return Q((a.coeffs() * (1.0-t) + b.coeffs() * t).normalized());+}++template<typename Q>+EIGEN_DONT_INLINE Q slerp_eigen(const Q& a, const Q& b, typename Q::Scalar t)+{+  return a.slerp(t,b);+}++template<typename Q>+EIGEN_DONT_INLINE Q slerp_legacy(const Q& a, const Q& b, typename Q::Scalar t)+{+  typedef typename Q::Scalar Scalar;+  static const Scalar one = Scalar(1) - dummy_precision<Scalar>();+  Scalar d = a.dot(b);+  Scalar absD = internal::abs(d);+  if (absD>=one)+    return a;++  // theta is the angle between the 2 quaternions+  Scalar theta = std::acos(absD);+  Scalar sinTheta = internal::sin(theta);++  Scalar scale0 = internal::sin( ( Scalar(1) - t ) * theta) / sinTheta;+  Scalar scale1 = internal::sin( ( t * theta) ) / sinTheta;+  if (d<0)+    scale1 = -scale1;++  return Q(scale0 * a.coeffs() + scale1 * b.coeffs());+}++template<typename Q>+EIGEN_DONT_INLINE Q slerp_legacy_nlerp(const Q& a, const Q& b, typename Q::Scalar t)+{+  typedef typename Q::Scalar Scalar;+  static const Scalar one = Scalar(1) - epsilon<Scalar>();+  Scalar d = a.dot(b);+  Scalar absD = internal::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 = std::acos(absD);+    Scalar sinTheta = internal::sin(theta);++    scale0 = internal::sin( ( Scalar(1) - t ) * theta) / sinTheta;+    scale1 = internal::sin( ( t * theta) ) / sinTheta;+    if (d<0)+      scale1 = -scale1;+  }++  return Q(scale0 * a.coeffs() + scale1 * b.coeffs());+}++template<typename T>+inline T sin_over_x(T x)+{+  if (T(1) + x*x == T(1))+    return T(1);+  else+    return std::sin(x)/x;+}++template<typename Q>+EIGEN_DONT_INLINE Q slerp_rw(const Q& a, const Q& b, typename Q::Scalar t)+{+  typedef typename Q::Scalar Scalar;+  +  Scalar d = a.dot(b);+  Scalar theta;+  if (d<0.0)+    theta = /*M_PI -*/ Scalar(2)*std::asin( (a.coeffs()+b.coeffs()).norm()/2 );+  else+    theta = Scalar(2)*std::asin( (a.coeffs()-b.coeffs()).norm()/2 );+  +  // theta is the angle between the 2 quaternions+//   Scalar theta = std::acos(absD);+  Scalar sinOverTheta = sin_over_x(theta);++  Scalar scale0 = (Scalar(1)-t)*sin_over_x( ( Scalar(1) - t ) * theta) / sinOverTheta;+  Scalar scale1 = t * sin_over_x( ( t * theta) ) / sinOverTheta;+  if (d<0)+    scale1 = -scale1;++  return Quaternion<Scalar>(scale0 * a.coeffs() + scale1 * b.coeffs());+}++template<typename Q>+EIGEN_DONT_INLINE Q slerp_gael(const Q& a, const Q& b, typename Q::Scalar t)+{+  typedef typename Q::Scalar Scalar;+  +  Scalar d = a.dot(b);+  Scalar theta;+//   theta = Scalar(2) * atan2((a.coeffs()-b.coeffs()).norm(),(a.coeffs()+b.coeffs()).norm());+//   if (d<0.0)+//     theta = M_PI-theta;+  +  if (d<0.0)+    theta = /*M_PI -*/ Scalar(2)*std::asin( (-a.coeffs()-b.coeffs()).norm()/2 );+  else+    theta = Scalar(2)*std::asin( (a.coeffs()-b.coeffs()).norm()/2 );+  +  +  Scalar scale0;+  Scalar scale1;+  if(theta*theta-Scalar(6)==-Scalar(6))+  {+    scale0 = Scalar(1) - t;+    scale1 = t;+  }+  else+  {+    Scalar sinTheta = std::sin(theta);+    scale0 = internal::sin( ( Scalar(1) - t ) * theta) / sinTheta;+    scale1 = internal::sin( ( t * theta) ) / sinTheta;+    if (d<0)+      scale1 = -scale1;+  }++  return Quaternion<Scalar>(scale0 * a.coeffs() + scale1 * b.coeffs());+}++int main()+{+  typedef double RefScalar;+  typedef float TestScalar;+  +  typedef Quaternion<RefScalar>  Qd;+  typedef Quaternion<TestScalar> Qf;+  +  unsigned int g_seed = (unsigned int) time(NULL);+  std::cout << g_seed << "\n";+//   g_seed = 1259932496;+  srand(g_seed);+  +  Matrix<RefScalar,Dynamic,1> maxerr(7);+  maxerr.setZero();+  +  Matrix<RefScalar,Dynamic,1> avgerr(7);+  avgerr.setZero();+  +  cout << "double=>float=>double       nlerp        eigen        legacy(snap)         legacy(nlerp)        rightway         gael's criteria\n";+  +  int rep = 100;+  int iters = 40;+  for (int w=0; w<rep; ++w)+  {+    Qf a, b;+    a.coeffs().setRandom();+    a.normalize();+    b.coeffs().setRandom();+    b.normalize();+    +    Qf c[6];+    +    Qd ar(a.cast<RefScalar>());+    Qd br(b.cast<RefScalar>());+    Qd cr;+    +    +    +    cout.precision(8);+    cout << std::scientific;+    for (int i=0; i<iters; ++i)+    {+      RefScalar t = 0.65;+      cr = slerp_rw(ar,br,t);+      +      Qf refc = cr.cast<TestScalar>();+      c[0] = nlerp(a,b,t);+      c[1] = slerp_eigen(a,b,t);+      c[2] = slerp_legacy(a,b,t);+      c[3] = slerp_legacy_nlerp(a,b,t);+      c[4] = slerp_rw(a,b,t);+      c[5] = slerp_gael(a,b,t);+      +      VectorXd err(7);+      err[0] = (cr.coeffs()-refc.cast<RefScalar>().coeffs()).norm();+//       std::cout << err[0] << "    ";+      for (int k=0; k<6; ++k)+      {+        err[k+1] = (c[k].coeffs()-refc.coeffs()).norm();+//         std::cout << err[k+1] << "    ";+      }+      maxerr = maxerr.cwise().max(err);+      avgerr += err;+//       std::cout << "\n";+      b = cr.cast<TestScalar>();+      br = cr;+    }+//     std::cout << "\n";+  }+  avgerr /= RefScalar(rep*iters);+  cout << "\n\nAccuracy:\n"+       << "  max: " << maxerr.transpose() << "\n";+  cout << "  avg: " << avgerr.transpose() << "\n";+  +  // perf bench+  Quaternionf a,b;+  a.coeffs().setRandom();+  a.normalize();+  b.coeffs().setRandom();+  b.normalize();+  //b = a;+  float s = 0.65;+    +  #define BENCH(FUNC) {\+    BenchTimer t; \+    for(int k=0; k<2; ++k) {\+      t.start(); \+      for(int i=0; i<1000000; ++i) \+        FUNC(a,b,s); \+      t.stop(); \+    } \+    cout << "  " << #FUNC << " => \t " << t.value() << "s\n"; \+  }+  +  cout << "\nSpeed:\n" << std::fixed;+  BENCH(nlerp);+  BENCH(slerp_eigen);+  BENCH(slerp_legacy);+  BENCH(slerp_legacy_nlerp);+  BENCH(slerp_rw);+  BENCH(slerp_gael);+}+
+ eigen3/bench/quatmul.cpp view
@@ -0,0 +1,47 @@+#include <iostream>+#include <Eigen/Core>+#include <Eigen/Geometry>+#include <bench/BenchTimer.h>++using namespace Eigen; ++template<typename Quat>+EIGEN_DONT_INLINE void quatmul_default(const Quat& a, const Quat& b, Quat& c)+{+  c = a * b;+}++template<typename Quat>+EIGEN_DONT_INLINE void quatmul_novec(const Quat& a, const Quat& b, Quat& c)+{+  c = internal::quat_product<0, Quat, Quat, typename Quat::Scalar, Aligned>::run(a,b);+}++template<typename Quat> void bench(const std::string& label)+{+  int tries = 10;+  int rep = 1000000;+  BenchTimer t;+  +  Quat a(4, 1, 2, 3);+  Quat b(2, 3, 4, 5);+  Quat c;+  +  std::cout.precision(3);+  +  BENCH(t, tries, rep, quatmul_default(a,b,c));+  std::cout << label << " default " << 1e3*t.best(CPU_TIMER) << "ms  \t" << 1e-6*double(rep)/(t.best(CPU_TIMER)) << " M mul/s\n";+  +  BENCH(t, tries, rep, quatmul_novec(a,b,c));+  std::cout << label << " novec   " << 1e3*t.best(CPU_TIMER) << "ms  \t" << 1e-6*double(rep)/(t.best(CPU_TIMER)) << " M mul/s\n";+}++int main()+{+  bench<Quaternionf>("float ");+  bench<Quaterniond>("double");++  return 0;++}+
+ eigen3/bench/sparse_cholesky.cpp view
@@ -0,0 +1,216 @@+// #define EIGEN_TAUCS_SUPPORT+// #define EIGEN_CHOLMOD_SUPPORT+#include <iostream>+#include <Eigen/Sparse>++// g++ -DSIZE=10000 -DDENSITY=0.001  sparse_cholesky.cpp -I.. -DDENSEMATRI -O3 -g0 -DNDEBUG   -DNBTRIES=1 -I /home/gael/Coding/LinearAlgebra/taucs_full/src/ -I/home/gael/Coding/LinearAlgebra/taucs_full/build/linux/  -L/home/gael/Coding/LinearAlgebra/taucs_full/lib/linux/ -ltaucs /home/gael/Coding/LinearAlgebra/GotoBLAS/libgoto.a -lpthread -I /home/gael/Coding/LinearAlgebra/SuiteSparse/CHOLMOD/Include/ $CHOLLIB -I /home/gael/Coding/LinearAlgebra/SuiteSparse/UFconfig/ /home/gael/Coding/LinearAlgebra/SuiteSparse/CCOLAMD/Lib/libccolamd.a   /home/gael/Coding/LinearAlgebra/SuiteSparse/CHOLMOD/Lib/libcholmod.a -lmetis /home/gael/Coding/LinearAlgebra/SuiteSparse/AMD/Lib/libamd.a  /home/gael/Coding/LinearAlgebra/SuiteSparse/CAMD/Lib/libcamd.a   /home/gael/Coding/LinearAlgebra/SuiteSparse/CCOLAMD/Lib/libccolamd.a  /home/gael/Coding/LinearAlgebra/SuiteSparse/COLAMD/Lib/libcolamd.a -llapack && ./a.out++#define NOGMM+#define NOMTL++#ifndef SIZE+#define SIZE 10+#endif++#ifndef DENSITY+#define DENSITY 0.01+#endif++#ifndef REPEAT+#define REPEAT 1+#endif++#include "BenchSparseUtil.h"++#ifndef MINDENSITY+#define MINDENSITY 0.0004+#endif++#ifndef NBTRIES+#define NBTRIES 10+#endif++#define BENCH(X) \+  timer.reset(); \+  for (int _j=0; _j<NBTRIES; ++_j) { \+    timer.start(); \+    for (int _k=0; _k<REPEAT; ++_k) { \+        X  \+  } timer.stop(); }++// typedef SparseMatrix<Scalar,UpperTriangular> EigenSparseTriMatrix;+typedef SparseMatrix<Scalar,SelfAdjoint|LowerTriangular> EigenSparseSelfAdjointMatrix;++void fillSpdMatrix(float density, int rows, int cols,  EigenSparseSelfAdjointMatrix& dst)+{+  dst.startFill(rows*cols*density);+  for(int j = 0; j < cols; j++)+  {+    dst.fill(j,j) = internal::random<Scalar>(10,20);+    for(int i = j+1; i < rows; i++)+    {+      Scalar v = (internal::random<float>(0,1) < density) ? internal::random<Scalar>() : 0;+      if (v!=0)+        dst.fill(i,j) = v;+    }++  }+  dst.endFill();+}++#include <Eigen/Cholesky>++template<int Backend>+void doEigen(const char* name, const EigenSparseSelfAdjointMatrix& sm1, int flags = 0)+{+  std::cout << name << "..." << std::flush;+  BenchTimer timer;+  timer.start();+  SparseLLT<EigenSparseSelfAdjointMatrix,Backend> chol(sm1, flags);+  timer.stop();+  std::cout << ":\t" << timer.value() << endl;++  std::cout << "  nnz: " << sm1.nonZeros() << " => " << chol.matrixL().nonZeros() << "\n";+//   std::cout << "sparse\n" << chol.matrixL() << "%\n";+}++int main(int argc, char *argv[])+{+  int rows = SIZE;+  int cols = SIZE;+  float density = DENSITY;+  BenchTimer timer;++  VectorXf b = VectorXf::Random(cols);+  VectorXf x = VectorXf::Random(cols);++  bool densedone = false;++  //for (float density = DENSITY; density>=MINDENSITY; density*=0.5)+//   float density = 0.5;+  {+    EigenSparseSelfAdjointMatrix sm1(rows, cols);+    std::cout << "Generate sparse matrix (might take a while)...\n";+    fillSpdMatrix(density, rows, cols, sm1);+    std::cout << "DONE\n\n";++    // dense matrices+    #ifdef DENSEMATRIX+    if (!densedone)+    {+      densedone = true;+      std::cout << "Eigen Dense\t" << density*100 << "%\n";+      DenseMatrix m1(rows,cols);+      eiToDense(sm1, m1);+      m1 = (m1 + m1.transpose()).eval();+      m1.diagonal() *= 0.5;++//       BENCH(LLT<DenseMatrix> chol(m1);)+//       std::cout << "dense:\t" << timer.value() << endl;++      BenchTimer timer;+      timer.start();+      LLT<DenseMatrix> chol(m1);+      timer.stop();+      std::cout << "dense:\t" << timer.value() << endl;+      int count = 0;+      for (int j=0; j<cols; ++j)+        for (int i=j; i<rows; ++i)+          if (!internal::isMuchSmallerThan(internal::abs(chol.matrixL()(i,j)), 0.1))+            count++;+      std::cout << "dense: " << "nnz = " << count << "\n";+//       std::cout << "dense:\n" << m1 << "\n\n" << chol.matrixL() << endl;+    }+    #endif++    // eigen sparse matrices+    doEigen<Eigen::DefaultBackend>("Eigen/Sparse", sm1, Eigen::IncompleteFactorization);++    #ifdef EIGEN_CHOLMOD_SUPPORT+    doEigen<Eigen::Cholmod>("Eigen/Cholmod", sm1, Eigen::IncompleteFactorization);+    #endif++    #ifdef EIGEN_TAUCS_SUPPORT+    doEigen<Eigen::Taucs>("Eigen/Taucs", sm1, Eigen::IncompleteFactorization);+    #endif++    #if 0+    // TAUCS+    {+      taucs_ccs_matrix A = sm1.asTaucsMatrix();++      //BENCH(taucs_ccs_matrix* chol = taucs_ccs_factor_llt(&A, 0, 0);)+//       BENCH(taucs_supernodal_factor_to_ccs(taucs_ccs_factor_llt_ll(&A));)+//       std::cout << "taucs:\t" << timer.value() << endl;++      taucs_ccs_matrix* chol = taucs_ccs_factor_llt(&A, 0, 0);++      for (int j=0; j<cols; ++j)+      {+        for (int i=chol->colptr[j]; i<chol->colptr[j+1]; ++i)+          std::cout << chol->values.d[i] << " ";+      }+    }++    // CHOLMOD+    #ifdef EIGEN_CHOLMOD_SUPPORT+    {+      cholmod_common c;+      cholmod_start (&c);+      cholmod_sparse A;+      cholmod_factor *L;++      A = sm1.asCholmodMatrix();+      BenchTimer timer;+//       timer.reset();+      timer.start();+      std::vector<int> perm(cols);+//       std::vector<int> set(ncols);+      for (int i=0; i<cols; ++i)+        perm[i] = i;+//       c.nmethods = 1;+//       c.method[0] = 1;++      c.nmethods = 1;+      c.method [0].ordering = CHOLMOD_NATURAL;+      c.postorder = 0;+      c.final_ll = 1;++      L = cholmod_analyze_p(&A, &perm[0], &perm[0], cols, &c);+      timer.stop();+      std::cout << "cholmod/analyze:\t" << timer.value() << endl;+      timer.reset();+      timer.start();+      cholmod_factorize(&A, L, &c);+      timer.stop();+      std::cout << "cholmod/factorize:\t" << timer.value() << endl;++      cholmod_sparse* cholmat = cholmod_factor_to_sparse(L, &c);++      cholmod_print_factor(L, "Factors", &c);++      cholmod_print_sparse(cholmat, "Chol", &c);+      cholmod_write_sparse(stdout, cholmat, 0, 0, &c);+//+//       cholmod_print_sparse(&A, "A", &c);+//       cholmod_write_sparse(stdout, &A, 0, 0, &c);+++//       for (int j=0; j<cols; ++j)+//       {+//           for (int i=chol->colptr[j]; i<chol->colptr[j+1]; ++i)+//             std::cout << chol->values.s[i] << " ";+//       }+    }+    #endif++    #endif++++  }+++  return 0;+}+
+ eigen3/bench/sparse_dense_product.cpp view
@@ -0,0 +1,187 @@++//g++ -O3 -g0 -DNDEBUG  sparse_product.cpp -I.. -I/home/gael/Coding/LinearAlgebra/mtl4/ -DDENSITY=0.005 -DSIZE=10000 && ./a.out+//g++ -O3 -g0 -DNDEBUG  sparse_product.cpp -I.. -I/home/gael/Coding/LinearAlgebra/mtl4/ -DDENSITY=0.05 -DSIZE=2000 && ./a.out+// -DNOGMM -DNOMTL -DCSPARSE+// -I /home/gael/Coding/LinearAlgebra/CSparse/Include/ /home/gael/Coding/LinearAlgebra/CSparse/Lib/libcsparse.a+#ifndef SIZE+#define SIZE 650000+#endif++#ifndef DENSITY+#define DENSITY 0.01+#endif++#ifndef REPEAT+#define REPEAT 1+#endif++#include "BenchSparseUtil.h"++#ifndef MINDENSITY+#define MINDENSITY 0.0004+#endif++#ifndef NBTRIES+#define NBTRIES 10+#endif++#define BENCH(X) \+  timer.reset(); \+  for (int _j=0; _j<NBTRIES; ++_j) { \+    timer.start(); \+    for (int _k=0; _k<REPEAT; ++_k) { \+        X  \+  } timer.stop(); }+++#ifdef CSPARSE+cs* cs_sorted_multiply(const cs* a, const cs* b)+{+  cs* A = cs_transpose (a, 1) ;+  cs* B = cs_transpose (b, 1) ;+  cs* D = cs_multiply (B,A) ;   /* D = B'*A' */+  cs_spfree (A) ;+  cs_spfree (B) ;+  cs_dropzeros (D) ;      /* drop zeros from D */+  cs* C = cs_transpose (D, 1) ;   /* C = D', so that C is sorted */+  cs_spfree (D) ;+  return C;+}+#endif++int main(int argc, char *argv[])+{+  int rows = SIZE;+  int cols = SIZE;+  float density = DENSITY;++  EigenSparseMatrix sm1(rows,cols);+  DenseVector v1(cols), v2(cols);+  v1.setRandom();++  BenchTimer timer;+  for (float density = DENSITY; density>=MINDENSITY; density*=0.5)+  {+    //fillMatrix(density, rows, cols, sm1);+    fillMatrix2(7, rows, cols, sm1);++    // dense matrices+    #ifdef DENSEMATRIX+    {+      std::cout << "Eigen Dense\t" << density*100 << "%\n";+      DenseMatrix m1(rows,cols);+      eiToDense(sm1, m1);++      timer.reset();+      timer.start();+      for (int k=0; k<REPEAT; ++k)+        v2 = m1 * v1;+      timer.stop();+      std::cout << "   a * v:\t" << timer.best() << "  " << double(REPEAT)/timer.best() << " * / sec " << endl;++      timer.reset();+      timer.start();+      for (int k=0; k<REPEAT; ++k)+        v2 = m1.transpose() * v1;+      timer.stop();+      std::cout << "   a' * v:\t" << timer.best() << endl;+    }+    #endif++    // eigen sparse matrices+    {+      std::cout << "Eigen sparse\t" << sm1.nonZeros()/float(sm1.rows()*sm1.cols())*100 << "%\n";++      BENCH(asm("#myc"); v2 = sm1 * v1; asm("#myd");)+      std::cout << "   a * v:\t" << timer.best()/REPEAT << "  " << double(REPEAT)/timer.best(REAL_TIMER) << " * / sec " << endl;+++      BENCH( { asm("#mya"); v2 = sm1.transpose() * v1; asm("#myb"); })++      std::cout << "   a' * v:\t" << timer.best()/REPEAT << endl;+    }++//     {+//       DynamicSparseMatrix<Scalar> m1(sm1);+//       std::cout << "Eigen dyn-sparse\t" << m1.nonZeros()/float(m1.rows()*m1.cols())*100 << "%\n";+//+//       BENCH(for (int k=0; k<REPEAT; ++k) v2 = m1 * v1;)+//       std::cout << "   a * v:\t" << timer.value() << endl;+//+//       BENCH(for (int k=0; k<REPEAT; ++k) v2 = m1.transpose() * v1;)+//       std::cout << "   a' * v:\t" << timer.value() << endl;+//     }++    // GMM+++    #ifndef NOGMM+    {+      std::cout << "GMM++ sparse\t" << density*100 << "%\n";+      //GmmDynSparse  gmmT3(rows,cols);+      GmmSparse m1(rows,cols);+      eiToGmm(sm1, m1);++      std::vector<Scalar> gmmV1(cols), gmmV2(cols);+      Map<Matrix<Scalar,Dynamic,1> >(&gmmV1[0], cols) = v1;+      Map<Matrix<Scalar,Dynamic,1> >(&gmmV2[0], cols) = v2;++      BENCH( asm("#myx"); gmm::mult(m1, gmmV1, gmmV2); asm("#myy"); )+      std::cout << "   a * v:\t" << timer.value() << endl;++      BENCH( gmm::mult(gmm::transposed(m1), gmmV1, gmmV2); )+      std::cout << "   a' * v:\t" << timer.value() << endl;+    }+    #endif+    +    #ifndef NOUBLAS+    {+      std::cout << "ublas sparse\t" << density*100 << "%\n";+      UBlasSparse m1(rows,cols);+      eiToUblas(sm1, m1);+      +      boost::numeric::ublas::vector<Scalar> uv1, uv2;+      eiToUblasVec(v1,uv1);+      eiToUblasVec(v2,uv2);++//       std::vector<Scalar> gmmV1(cols), gmmV2(cols);+//       Map<Matrix<Scalar,Dynamic,1> >(&gmmV1[0], cols) = v1;+//       Map<Matrix<Scalar,Dynamic,1> >(&gmmV2[0], cols) = v2;++      BENCH( uv2 = boost::numeric::ublas::prod(m1, uv1); )+      std::cout << "   a * v:\t" << timer.value() << endl;++//       BENCH( boost::ublas::prod(gmm::transposed(m1), gmmV1, gmmV2); )+//       std::cout << "   a' * v:\t" << timer.value() << endl;+    }+    #endif++    // MTL4+    #ifndef NOMTL+    {+      std::cout << "MTL4\t" << density*100 << "%\n";+      MtlSparse m1(rows,cols);+      eiToMtl(sm1, m1);+      mtl::dense_vector<Scalar> mtlV1(cols, 1.0);+      mtl::dense_vector<Scalar> mtlV2(cols, 1.0);++      timer.reset();+      timer.start();+      for (int k=0; k<REPEAT; ++k)+        mtlV2 = m1 * mtlV1;+      timer.stop();+      std::cout << "   a * v:\t" << timer.value() << endl;++      timer.reset();+      timer.start();+      for (int k=0; k<REPEAT; ++k)+        mtlV2 = trans(m1) * mtlV1;+      timer.stop();+      std::cout << "   a' * v:\t" << timer.value() << endl;+    }+    #endif++    std::cout << "\n\n";+  }++  return 0;+}+
+ eigen3/bench/sparse_lu.cpp view
@@ -0,0 +1,132 @@++// g++ -I.. sparse_lu.cpp -O3 -g0 -I /usr/include/superlu/ -lsuperlu -lgfortran -DSIZE=1000 -DDENSITY=.05 && ./a.out++#define EIGEN_SUPERLU_SUPPORT+#define EIGEN_UMFPACK_SUPPORT+#include <Eigen/Sparse>++#define NOGMM+#define NOMTL++#ifndef SIZE+#define SIZE 10+#endif++#ifndef DENSITY+#define DENSITY 0.01+#endif++#ifndef REPEAT+#define REPEAT 1+#endif++#include "BenchSparseUtil.h"++#ifndef MINDENSITY+#define MINDENSITY 0.0004+#endif++#ifndef NBTRIES+#define NBTRIES 10+#endif++#define BENCH(X) \+  timer.reset(); \+  for (int _j=0; _j<NBTRIES; ++_j) { \+    timer.start(); \+    for (int _k=0; _k<REPEAT; ++_k) { \+        X  \+  } timer.stop(); }++typedef Matrix<Scalar,Dynamic,1> VectorX;++#include <Eigen/LU>++template<int Backend>+void doEigen(const char* name, const EigenSparseMatrix& sm1, const VectorX& b, VectorX& x, int flags = 0)+{+  std::cout << name << "..." << std::flush;+  BenchTimer timer; timer.start();+  SparseLU<EigenSparseMatrix,Backend> lu(sm1, flags);+  timer.stop();+  if (lu.succeeded())+    std::cout << ":\t" << timer.value() << endl;+  else+  {+    std::cout << ":\t FAILED" << endl;+    return;+  }++  bool ok;+  timer.reset(); timer.start();+  ok = lu.solve(b,&x);+  timer.stop();+  if (ok)+    std::cout << "  solve:\t" << timer.value() << endl;+  else+    std::cout << "  solve:\t" << " FAILED" << endl;++  //std::cout << x.transpose() << "\n";+}++int main(int argc, char *argv[])+{+  int rows = SIZE;+  int cols = SIZE;+  float density = DENSITY;+  BenchTimer timer;++  VectorX b = VectorX::Random(cols);+  VectorX x = VectorX::Random(cols);++  bool densedone = false;++  //for (float density = DENSITY; density>=MINDENSITY; density*=0.5)+//   float density = 0.5;+  {+    EigenSparseMatrix sm1(rows, cols);+    fillMatrix(density, rows, cols, sm1);++    // dense matrices+    #ifdef DENSEMATRIX+    if (!densedone)+    {+      densedone = true;+      std::cout << "Eigen Dense\t" << density*100 << "%\n";+      DenseMatrix m1(rows,cols);+      eiToDense(sm1, m1);++      BenchTimer timer;+      timer.start();+      FullPivLU<DenseMatrix> lu(m1);+      timer.stop();+      std::cout << "Eigen/dense:\t" << timer.value() << endl;++      timer.reset();+      timer.start();+      lu.solve(b,&x);+      timer.stop();+      std::cout << "  solve:\t" << timer.value() << endl;+//       std::cout << b.transpose() << "\n";+//       std::cout << x.transpose() << "\n";+    }+    #endif++    #ifdef EIGEN_UMFPACK_SUPPORT+    x.setZero();+    doEigen<Eigen::UmfPack>("Eigen/UmfPack (auto)", sm1, b, x, 0);+    #endif++    #ifdef EIGEN_SUPERLU_SUPPORT+    x.setZero();+    doEigen<Eigen::SuperLU>("Eigen/SuperLU (nat)", sm1, b, x, Eigen::NaturalOrdering);+//     doEigen<Eigen::SuperLU>("Eigen/SuperLU (MD AT+A)", sm1, b, x, Eigen::MinimumDegree_AT_PLUS_A);+//     doEigen<Eigen::SuperLU>("Eigen/SuperLU (MD ATA)", sm1, b, x, Eigen::MinimumDegree_ATA);+    doEigen<Eigen::SuperLU>("Eigen/SuperLU (COLAMD)", sm1, b, x, Eigen::ColApproxMinimumDegree);+    #endif++  }++  return 0;+}+
+ eigen3/bench/sparse_product.cpp view
@@ -0,0 +1,323 @@++//g++ -O3 -g0 -DNDEBUG  sparse_product.cpp -I.. -I/home/gael/Coding/LinearAlgebra/mtl4/ -DDENSITY=0.005 -DSIZE=10000 && ./a.out+//g++ -O3 -g0 -DNDEBUG  sparse_product.cpp -I.. -I/home/gael/Coding/LinearAlgebra/mtl4/ -DDENSITY=0.05 -DSIZE=2000 && ./a.out+// -DNOGMM -DNOMTL -DCSPARSE+// -I /home/gael/Coding/LinearAlgebra/CSparse/Include/ /home/gael/Coding/LinearAlgebra/CSparse/Lib/libcsparse.a++#include <typeinfo>++#ifndef SIZE+#define SIZE 1000000+#endif++#ifndef NNZPERCOL+#define NNZPERCOL 6+#endif++#ifndef REPEAT+#define REPEAT 1+#endif++#include <algorithm>+#include "BenchTimer.h"+#include "BenchUtil.h"+#include "BenchSparseUtil.h"++#ifndef NBTRIES+#define NBTRIES 1+#endif++#define BENCH(X) \+  timer.reset(); \+  for (int _j=0; _j<NBTRIES; ++_j) { \+    timer.start(); \+    for (int _k=0; _k<REPEAT; ++_k) { \+        X  \+  } timer.stop(); }++// #ifdef MKL+//+// #include "mkl_types.h"+// #include "mkl_spblas.h"+//+// template<typename Lhs,typename Rhs,typename Res>+// void mkl_multiply(const Lhs& lhs, const Rhs& rhs, Res& res)+// {+//   char n = 'N';+//   float alpha = 1;+//   char matdescra[6];+//   matdescra[0] = 'G';+//   matdescra[1] = 0;+//   matdescra[2] = 0;+//   matdescra[3] = 'C';+//   mkl_scscmm(&n, lhs.rows(), rhs.cols(), lhs.cols(), &alpha, matdescra,+//              lhs._valuePtr(), lhs._innerIndexPtr(), lhs.outerIndexPtr(),+//              pntre, b, &ldb, &beta, c, &ldc);+// //   mkl_somatcopy('C', 'T', lhs.rows(), lhs.cols(), 1,+// //                 lhs._valuePtr(), lhs.rows(), DST, dst_stride);+// }+//+// #endif+++#ifdef CSPARSE+cs* cs_sorted_multiply(const cs* a, const cs* b)+{+//   return cs_multiply(a,b);++  cs* A = cs_transpose(a, 1);+  cs* B = cs_transpose(b, 1);+  cs* D = cs_multiply(B,A);   /* D = B'*A' */+  cs_spfree (A) ;+  cs_spfree (B) ;+  cs_dropzeros (D) ;      /* drop zeros from D */+  cs* C = cs_transpose (D, 1) ;   /* C = D', so that C is sorted */+  cs_spfree (D) ;+  return C;++//   cs* A = cs_transpose(a, 1);+//   cs* C = cs_transpose(A, 1);+//   return C;+}++cs* cs_sorted_multiply2(const cs* a, const cs* b)+{+  cs* D = cs_multiply(a,b);+  cs* E = cs_transpose(D,1);+  cs_spfree(D);+  cs* C = cs_transpose(E,1);+  cs_spfree(E);+  return C;+}+#endif++void bench_sort();++int main(int argc, char *argv[])+{+//   bench_sort();++  int rows = SIZE;+  int cols = SIZE;+  float density = DENSITY;++  EigenSparseMatrix sm1(rows,cols), sm2(rows,cols), sm3(rows,cols), sm4(rows,cols);++  BenchTimer timer;+  for (int nnzPerCol = NNZPERCOL; nnzPerCol>1; nnzPerCol/=1.1)+  {+    sm1.setZero();+    sm2.setZero();+    fillMatrix2(nnzPerCol, rows, cols, sm1);+    fillMatrix2(nnzPerCol, rows, cols, sm2);+//     std::cerr << "filling OK\n";++    // dense matrices+    #ifdef DENSEMATRIX+    {+      std::cout << "Eigen Dense\t" << nnzPerCol << "%\n";+      DenseMatrix m1(rows,cols), m2(rows,cols), m3(rows,cols);+      eiToDense(sm1, m1);+      eiToDense(sm2, m2);++      timer.reset();+      timer.start();+      for (int k=0; k<REPEAT; ++k)+        m3 = m1 * m2;+      timer.stop();+      std::cout << "   a * b:\t" << timer.value() << endl;++      timer.reset();+      timer.start();+      for (int k=0; k<REPEAT; ++k)+        m3 = m1.transpose() * m2;+      timer.stop();+      std::cout << "   a' * b:\t" << timer.value() << endl;++      timer.reset();+      timer.start();+      for (int k=0; k<REPEAT; ++k)+        m3 = m1.transpose() * m2.transpose();+      timer.stop();+      std::cout << "   a' * b':\t" << timer.value() << endl;++      timer.reset();+      timer.start();+      for (int k=0; k<REPEAT; ++k)+        m3 = m1 * m2.transpose();+      timer.stop();+      std::cout << "   a * b':\t" << timer.value() << endl;+    }+    #endif++    // eigen sparse matrices+    {+      std::cout << "Eigen sparse\t" << sm1.nonZeros()/(float(sm1.rows())*float(sm1.cols()))*100 << "% * "+                << sm2.nonZeros()/(float(sm2.rows())*float(sm2.cols()))*100 << "%\n";++      BENCH(sm3 = sm1 * sm2; )+      std::cout << "   a * b:\t" << timer.value() << endl;++//       BENCH(sm3 = sm1.transpose() * sm2; )+//       std::cout << "   a' * b:\t" << timer.value() << endl;+// //+//       BENCH(sm3 = sm1.transpose() * sm2.transpose(); )+//       std::cout << "   a' * b':\t" << timer.value() << endl;+// //+//       BENCH(sm3 = sm1 * sm2.transpose(); )+//       std::cout << "   a * b' :\t" << timer.value() << endl;+++//       std::cout << "\n";+//+//       BENCH( sm3._experimentalNewProduct(sm1, sm2); )+//       std::cout << "   a * b:\t" << timer.value() << endl;+//+//       BENCH(sm3._experimentalNewProduct(sm1.transpose(),sm2); )+//       std::cout << "   a' * b:\t" << timer.value() << endl;+// //+//       BENCH(sm3._experimentalNewProduct(sm1.transpose(),sm2.transpose()); )+//       std::cout << "   a' * b':\t" << timer.value() << endl;+// //+//       BENCH(sm3._experimentalNewProduct(sm1, sm2.transpose());)+//       std::cout << "   a * b' :\t" << timer.value() << endl;+    }++    // eigen dyn-sparse matrices+    /*{+      DynamicSparseMatrix<Scalar> m1(sm1), m2(sm2), m3(sm3);+      std::cout << "Eigen dyn-sparse\t" << m1.nonZeros()/(float(m1.rows())*float(m1.cols()))*100 << "% * "+                << m2.nonZeros()/(float(m2.rows())*float(m2.cols()))*100 << "%\n";++//       timer.reset();+//       timer.start();+      BENCH(for (int k=0; k<REPEAT; ++k) m3 = m1 * m2;)+//       timer.stop();+      std::cout << "   a * b:\t" << timer.value() << endl;+//       std::cout << sm3 << "\n";++      timer.reset();+      timer.start();+//       std::cerr << "transpose...\n";+//       EigenSparseMatrix sm4 = sm1.transpose();+//       std::cout << sm4.nonZeros() << " == " << sm1.nonZeros() << "\n";+//       exit(1);+//       std::cerr << "transpose OK\n";+//       std::cout << sm1 << "\n\n" << sm1.transpose() << "\n\n" << sm4.transpose() << "\n\n";+      BENCH(for (int k=0; k<REPEAT; ++k) m3 = m1.transpose() * m2;)+//       timer.stop();+      std::cout << "   a' * b:\t" << timer.value() << endl;++//       timer.reset();+//       timer.start();+      BENCH( for (int k=0; k<REPEAT; ++k) m3 = m1.transpose() * m2.transpose(); )+//       timer.stop();+      std::cout << "   a' * b':\t" << timer.value() << endl;++//       timer.reset();+//       timer.start();+      BENCH( for (int k=0; k<REPEAT; ++k) m3 = m1 * m2.transpose(); )+//       timer.stop();+      std::cout << "   a * b' :\t" << timer.value() << endl;+    }*/++    // CSparse+    #ifdef CSPARSE+    {+      std::cout << "CSparse \t" << nnzPerCol << "%\n";+      cs *m1, *m2, *m3;+      eiToCSparse(sm1, m1);+      eiToCSparse(sm2, m2);++      BENCH(+      {+        m3 = cs_sorted_multiply(m1, m2);+        if (!m3)+        {+          std::cerr << "cs_multiply failed\n";+        }+//         cs_print(m3, 0);+        cs_spfree(m3);+      }+      );+//       timer.stop();+      std::cout << "   a * b:\t" << timer.value() << endl;++//       BENCH( { m3 = cs_sorted_multiply2(m1, m2); cs_spfree(m3); } );+//       std::cout << "   a * b:\t" << timer.value() << endl;+    }+    #endif++    #ifndef NOUBLAS+    {+      std::cout << "ublas\t" << nnzPerCol << "%\n";+      UBlasSparse m1(rows,cols), m2(rows,cols), m3(rows,cols);+      eiToUblas(sm1, m1);+      eiToUblas(sm2, m2);++      BENCH(boost::numeric::ublas::prod(m1, m2, m3););+      std::cout << "   a * b:\t" << timer.value() << endl;+    }+    #endif++    // GMM+++    #ifndef NOGMM+    {+      std::cout << "GMM++ sparse\t" << nnzPerCol << "%\n";+      GmmDynSparse  gmmT3(rows,cols);+      GmmSparse m1(rows,cols), m2(rows,cols), m3(rows,cols);+      eiToGmm(sm1, m1);+      eiToGmm(sm2, m2);++      BENCH(gmm::mult(m1, m2, gmmT3););+      std::cout << "   a * b:\t" << timer.value() << endl;++//       BENCH(gmm::mult(gmm::transposed(m1), m2, gmmT3););+//       std::cout << "   a' * b:\t" << timer.value() << endl;+//+//       if (rows<500)+//       {+//         BENCH(gmm::mult(gmm::transposed(m1), gmm::transposed(m2), gmmT3););+//         std::cout << "   a' * b':\t" << timer.value() << endl;+//+//         BENCH(gmm::mult(m1, gmm::transposed(m2), gmmT3););+//         std::cout << "   a * b':\t" << timer.value() << endl;+//       }+//       else+//       {+//         std::cout << "   a' * b':\t" << "forever" << endl;+//         std::cout << "   a * b':\t" << "forever" << endl;+//       }+    }+    #endif++    // MTL4+    #ifndef NOMTL+    {+      std::cout << "MTL4\t" << nnzPerCol << "%\n";+      MtlSparse m1(rows,cols), m2(rows,cols), m3(rows,cols);+      eiToMtl(sm1, m1);+      eiToMtl(sm2, m2);++      BENCH(m3 = m1 * m2;);+      std::cout << "   a * b:\t" << timer.value() << endl;++//       BENCH(m3 = trans(m1) * m2;);+//       std::cout << "   a' * b:\t" << timer.value() << endl;+//+//       BENCH(m3 = trans(m1) * trans(m2););+//       std::cout << "  a' * b':\t" << timer.value() << endl;+//+//       BENCH(m3 = m1 * trans(m2););+//       std::cout << "   a * b' :\t" << timer.value() << endl;+    }+    #endif++    std::cout << "\n\n";+  }++  return 0;+}+++
+ eigen3/bench/sparse_randomsetter.cpp view
@@ -0,0 +1,125 @@++#define NOGMM+#define NOMTL++#include <map>+#include <ext/hash_map>+#include <google/dense_hash_map>+#include <google/sparse_hash_map>++#ifndef SIZE+#define SIZE 10000+#endif++#ifndef DENSITY+#define DENSITY 0.01+#endif++#ifndef REPEAT+#define REPEAT 1+#endif++#include "BenchSparseUtil.h"++#ifndef MINDENSITY+#define MINDENSITY 0.0004+#endif++#ifndef NBTRIES+#define NBTRIES 10+#endif++#define BENCH(X) \+  timer.reset(); \+  for (int _j=0; _j<NBTRIES; ++_j) { \+    timer.start(); \+    for (int _k=0; _k<REPEAT; ++_k) { \+        X  \+  } timer.stop(); }+++static double rtime;+static double nentries;++template<typename SetterType>+void dostuff(const char* name, EigenSparseMatrix& sm1)+{+  int rows = sm1.rows();+  int cols = sm1.cols();+  sm1.setZero();+  BenchTimer t;+  SetterType* set1 = new SetterType(sm1);+  t.reset(); t.start();+  for (int k=0; k<nentries; ++k)+    (*set1)(internal::random<int>(0,rows-1),internal::random<int>(0,cols-1)) += 1;+  t.stop();+  std::cout << "std::map =>      \t" << t.value()-rtime+            << " nnz=" << set1->nonZeros() << std::flush;++  // getchar();++  t.reset(); t.start(); delete set1; t.stop();+  std::cout << "  back: \t" << t.value() << "\n";+}+    +int main(int argc, char *argv[])+{+  int rows = SIZE;+  int cols = SIZE;+  float density = DENSITY;++  EigenSparseMatrix sm1(rows,cols), sm2(rows,cols);+++  nentries = rows*cols*density;+  std::cout << "n = " << nentries << "\n";+  int dummy;+  BenchTimer t;++  t.reset(); t.start();+  for (int k=0; k<nentries; ++k)+    dummy = internal::random<int>(0,rows-1) + internal::random<int>(0,cols-1);+  t.stop();+  rtime = t.value();+  std::cout << "rtime = " << rtime << " (" << dummy << ")\n\n";+  const int Bits = 6;+  for (;;)+  {+    dostuff<RandomSetter<EigenSparseMatrix,StdMapTraits,Bits> >("std::map     ", sm1);+    dostuff<RandomSetter<EigenSparseMatrix,GnuHashMapTraits,Bits> >("gnu::hash_map", sm1);+    dostuff<RandomSetter<EigenSparseMatrix,GoogleDenseHashMapTraits,Bits> >("google::dense", sm1);+    dostuff<RandomSetter<EigenSparseMatrix,GoogleSparseHashMapTraits,Bits> >("google::sparse", sm1);++//     {+//       RandomSetter<EigenSparseMatrix,GnuHashMapTraits,Bits> set1(sm1);+//       t.reset(); t.start();+//       for (int k=0; k<n; ++k)+//         set1(internal::random<int>(0,rows-1),internal::random<int>(0,cols-1)) += 1;+//       t.stop();+//       std::cout << "gnu::hash_map => \t" << t.value()-rtime+//                 << " nnz=" << set1.nonZeros() << "\n";getchar();+//     }+//     {+//       RandomSetter<EigenSparseMatrix,GoogleDenseHashMapTraits,Bits> set1(sm1);+//       t.reset(); t.start();+//       for (int k=0; k<n; ++k)+//         set1(internal::random<int>(0,rows-1),internal::random<int>(0,cols-1)) += 1;+//       t.stop();+//       std::cout << "google::dense => \t" << t.value()-rtime+//                 << " nnz=" << set1.nonZeros() << "\n";getchar();+//     }+//     {+//       RandomSetter<EigenSparseMatrix,GoogleSparseHashMapTraits,Bits> set1(sm1);+//       t.reset(); t.start();+//       for (int k=0; k<n; ++k)+//         set1(internal::random<int>(0,rows-1),internal::random<int>(0,cols-1)) += 1;+//       t.stop();+//       std::cout << "google::sparse => \t" << t.value()-rtime+//                 << " nnz=" << set1.nonZeros() << "\n";getchar();+//     }+    std::cout << "\n\n";+  }++  return 0;+}+
+ eigen3/bench/sparse_setter.cpp view
@@ -0,0 +1,485 @@++//g++ -O3 -g0 -DNDEBUG  sparse_product.cpp -I.. -I/home/gael/Coding/LinearAlgebra/mtl4/ -DDENSITY=0.005 -DSIZE=10000 && ./a.out+//g++ -O3 -g0 -DNDEBUG  sparse_product.cpp -I.. -I/home/gael/Coding/LinearAlgebra/mtl4/ -DDENSITY=0.05 -DSIZE=2000 && ./a.out+// -DNOGMM -DNOMTL -DCSPARSE+// -I /home/gael/Coding/LinearAlgebra/CSparse/Include/ /home/gael/Coding/LinearAlgebra/CSparse/Lib/libcsparse.a+#ifndef SIZE+#define SIZE 100000+#endif++#ifndef NBPERROW+#define NBPERROW 24+#endif++#ifndef REPEAT+#define REPEAT 2+#endif++#ifndef NBTRIES+#define NBTRIES 2+#endif++#ifndef KK+#define KK 10+#endif++#ifndef NOGOOGLE+#define EIGEN_GOOGLEHASH_SUPPORT+#include <google/sparse_hash_map>+#endif++#include "BenchSparseUtil.h"++#define CHECK_MEM+// #define CHECK_MEM  std/**/::cout << "check mem\n"; getchar();++#define BENCH(X) \+  timer.reset(); \+  for (int _j=0; _j<NBTRIES; ++_j) { \+    timer.start(); \+    for (int _k=0; _k<REPEAT; ++_k) { \+        X  \+  } timer.stop(); }++typedef std::vector<Vector2i> Coordinates;+typedef std::vector<float> Values;++EIGEN_DONT_INLINE Scalar* setinnerrand_eigen(const Coordinates& coords, const Values& vals);+EIGEN_DONT_INLINE Scalar* setrand_eigen_dynamic(const Coordinates& coords, const Values& vals);+EIGEN_DONT_INLINE Scalar* setrand_eigen_compact(const Coordinates& coords, const Values& vals);+EIGEN_DONT_INLINE Scalar* setrand_eigen_sumeq(const Coordinates& coords, const Values& vals);+EIGEN_DONT_INLINE Scalar* setrand_eigen_gnu_hash(const Coordinates& coords, const Values& vals);+EIGEN_DONT_INLINE Scalar* setrand_eigen_google_dense(const Coordinates& coords, const Values& vals);+EIGEN_DONT_INLINE Scalar* setrand_eigen_google_sparse(const Coordinates& coords, const Values& vals);+EIGEN_DONT_INLINE Scalar* setrand_scipy(const Coordinates& coords, const Values& vals);+EIGEN_DONT_INLINE Scalar* setrand_ublas_mapped(const Coordinates& coords, const Values& vals);+EIGEN_DONT_INLINE Scalar* setrand_ublas_coord(const Coordinates& coords, const Values& vals);+EIGEN_DONT_INLINE Scalar* setrand_ublas_compressed(const Coordinates& coords, const Values& vals);+EIGEN_DONT_INLINE Scalar* setrand_ublas_genvec(const Coordinates& coords, const Values& vals);+EIGEN_DONT_INLINE Scalar* setrand_mtl(const Coordinates& coords, const Values& vals);++int main(int argc, char *argv[])+{+  int rows = SIZE;+  int cols = SIZE;+  bool fullyrand = true;++  BenchTimer timer;+  Coordinates coords;+  Values values;+  if(fullyrand)+  {+    Coordinates pool;+    pool.reserve(cols*NBPERROW);+    std::cerr << "fill pool" << "\n";+    for (int i=0; i<cols*NBPERROW; )+    {+//       DynamicSparseMatrix<int> stencil(SIZE,SIZE);+      Vector2i ij(internal::random<int>(0,rows-1),internal::random<int>(0,cols-1));+//       if(stencil.coeffRef(ij.x(), ij.y())==0)+      {+//         stencil.coeffRef(ij.x(), ij.y()) = 1;+        pool.push_back(ij);++      }+      ++i;+    }+    std::cerr << "pool ok" << "\n";+    int n = cols*NBPERROW*KK;+    coords.reserve(n);+    values.reserve(n);+    for (int i=0; i<n; ++i)+    {+      int i = internal::random<int>(0,pool.size());+      coords.push_back(pool[i]);+      values.push_back(internal::random<Scalar>());+    }+  }+  else+  {+    for (int j=0; j<cols; ++j)+    for (int i=0; i<NBPERROW; ++i)+    {+      coords.push_back(Vector2i(internal::random<int>(0,rows-1),j));+      values.push_back(internal::random<Scalar>());+    }+  }+  std::cout << "nnz = " << coords.size()  << "\n";+  CHECK_MEM++    // dense matrices+    #ifdef DENSEMATRIX+    {+      BENCH(setrand_eigen_dense(coords,values);)+      std::cout << "Eigen Dense\t" << timer.value() << "\n";+    }+    #endif++    // eigen sparse matrices+//     if (!fullyrand)+//     {+//       BENCH(setinnerrand_eigen(coords,values);)+//       std::cout << "Eigen fillrand\t" << timer.value() << "\n";+//     }+    {+      BENCH(setrand_eigen_dynamic(coords,values);)+      std::cout << "Eigen dynamic\t" << timer.value() << "\n";+    }+//     {+//       BENCH(setrand_eigen_compact(coords,values);)+//       std::cout << "Eigen compact\t" << timer.value() << "\n";+//     }+    {+      BENCH(setrand_eigen_sumeq(coords,values);)+      std::cout << "Eigen sumeq\t" << timer.value() << "\n";+    }+    {+//       BENCH(setrand_eigen_gnu_hash(coords,values);)+//       std::cout << "Eigen std::map\t" << timer.value() << "\n";+    }+    {+      BENCH(setrand_scipy(coords,values);)+      std::cout << "scipy\t" << timer.value() << "\n";+    }+    #ifndef NOGOOGLE+    {+      BENCH(setrand_eigen_google_dense(coords,values);)+      std::cout << "Eigen google dense\t" << timer.value() << "\n";+    }+    {+      BENCH(setrand_eigen_google_sparse(coords,values);)+      std::cout << "Eigen google sparse\t" << timer.value() << "\n";+    }+    #endif++    #ifndef NOUBLAS+    {+//       BENCH(setrand_ublas_mapped(coords,values);)+//       std::cout << "ublas mapped\t" << timer.value() << "\n";+    }+    {+      BENCH(setrand_ublas_genvec(coords,values);)+      std::cout << "ublas vecofvec\t" << timer.value() << "\n";+    }+    /*{+      timer.reset();+      timer.start();+      for (int k=0; k<REPEAT; ++k)+        setrand_ublas_compressed(coords,values);+      timer.stop();+      std::cout << "ublas comp\t" << timer.value() << "\n";+    }+    {+      timer.reset();+      timer.start();+      for (int k=0; k<REPEAT; ++k)+        setrand_ublas_coord(coords,values);+      timer.stop();+      std::cout << "ublas coord\t" << timer.value() << "\n";+    }*/+    #endif+++    // MTL4+    #ifndef NOMTL+    {+      BENCH(setrand_mtl(coords,values));+      std::cout << "MTL\t" << timer.value() << "\n";+    }+    #endif++  return 0;+}++EIGEN_DONT_INLINE Scalar* setinnerrand_eigen(const Coordinates& coords, const Values& vals)+{+  using namespace Eigen;+  SparseMatrix<Scalar> mat(SIZE,SIZE);+  //mat.startFill(2000000/*coords.size()*/);+  for (int i=0; i<coords.size(); ++i)+  {+    mat.insert(coords[i].x(), coords[i].y()) = vals[i];+  }+  mat.finalize();+  CHECK_MEM;+  return 0;+}++EIGEN_DONT_INLINE Scalar* setrand_eigen_dynamic(const Coordinates& coords, const Values& vals)+{+  using namespace Eigen;+  DynamicSparseMatrix<Scalar> mat(SIZE,SIZE);+  mat.reserve(coords.size()/10);+  for (int i=0; i<coords.size(); ++i)+  {+    mat.coeffRef(coords[i].x(), coords[i].y()) += vals[i];+  }+  mat.finalize();+  CHECK_MEM;+  return &mat.coeffRef(coords[0].x(), coords[0].y());+}++EIGEN_DONT_INLINE Scalar* setrand_eigen_sumeq(const Coordinates& coords, const Values& vals)+{+  using namespace Eigen;+  int n = coords.size()/KK;+  DynamicSparseMatrix<Scalar> mat(SIZE,SIZE);+  for (int j=0; j<KK; ++j)+  {+    DynamicSparseMatrix<Scalar> aux(SIZE,SIZE);+    mat.reserve(n);+    for (int i=j*n; i<(j+1)*n; ++i)+    {+      aux.insert(coords[i].x(), coords[i].y()) += vals[i];+    }+    aux.finalize();+    mat += aux;+  }+  return &mat.coeffRef(coords[0].x(), coords[0].y());+}++EIGEN_DONT_INLINE Scalar* setrand_eigen_compact(const Coordinates& coords, const Values& vals)+{+  using namespace Eigen;+  DynamicSparseMatrix<Scalar> setter(SIZE,SIZE);+  setter.reserve(coords.size()/10);+  for (int i=0; i<coords.size(); ++i)+  {+    setter.coeffRef(coords[i].x(), coords[i].y()) += vals[i];+  }+  SparseMatrix<Scalar> mat = setter;+  CHECK_MEM;+  return &mat.coeffRef(coords[0].x(), coords[0].y());+}++EIGEN_DONT_INLINE Scalar* setrand_eigen_gnu_hash(const Coordinates& coords, const Values& vals)+{+  using namespace Eigen;+  SparseMatrix<Scalar> mat(SIZE,SIZE);+  {+    RandomSetter<SparseMatrix<Scalar>, StdMapTraits > setter(mat);+    for (int i=0; i<coords.size(); ++i)+    {+      setter(coords[i].x(), coords[i].y()) += vals[i];+    }+    CHECK_MEM;+  }+  return &mat.coeffRef(coords[0].x(), coords[0].y());+}++#ifndef NOGOOGLE+EIGEN_DONT_INLINE Scalar* setrand_eigen_google_dense(const Coordinates& coords, const Values& vals)+{+  using namespace Eigen;+  SparseMatrix<Scalar> mat(SIZE,SIZE);+  {+    RandomSetter<SparseMatrix<Scalar>, GoogleDenseHashMapTraits> setter(mat);+    for (int i=0; i<coords.size(); ++i)+      setter(coords[i].x(), coords[i].y()) += vals[i];+    CHECK_MEM;+  }+  return &mat.coeffRef(coords[0].x(), coords[0].y());+}++EIGEN_DONT_INLINE Scalar* setrand_eigen_google_sparse(const Coordinates& coords, const Values& vals)+{+  using namespace Eigen;+  SparseMatrix<Scalar> mat(SIZE,SIZE);+  {+    RandomSetter<SparseMatrix<Scalar>, GoogleSparseHashMapTraits> setter(mat);+    for (int i=0; i<coords.size(); ++i)+      setter(coords[i].x(), coords[i].y()) += vals[i];+    CHECK_MEM;+  }+  return &mat.coeffRef(coords[0].x(), coords[0].y());+}+#endif+++template <class T>+void coo_tocsr(const int n_row,+               const int n_col,+               const int nnz,+               const Coordinates Aij,+               const Values Ax,+                     int Bp[],+                     int Bj[],+                     T Bx[])+{+    //compute number of non-zero entries per row of A coo_tocsr+    std::fill(Bp, Bp + n_row, 0);++    for (int n = 0; n < nnz; n++){+        Bp[Aij[n].x()]++;+    }++    //cumsum the nnz per row to get Bp[]+    for(int i = 0, cumsum = 0; i < n_row; i++){+        int temp = Bp[i];+        Bp[i] = cumsum;+        cumsum += temp;+    }+    Bp[n_row] = nnz;++    //write Aj,Ax into Bj,Bx+    for(int n = 0; n < nnz; n++){+        int row  = Aij[n].x();+        int dest = Bp[row];++        Bj[dest] = Aij[n].y();+        Bx[dest] = Ax[n];++        Bp[row]++;+    }++    for(int i = 0, last = 0; i <= n_row; i++){+        int temp = Bp[i];+        Bp[i]  = last;+        last   = temp;+    }++    //now Bp,Bj,Bx form a CSR representation (with possible duplicates)+}++template< class T1, class T2 >+bool kv_pair_less(const std::pair<T1,T2>& x, const std::pair<T1,T2>& y){+    return x.first < y.first;+}+++template<class I, class T>+void csr_sort_indices(const I n_row,+                      const I Ap[],+                            I Aj[],+                            T Ax[])+{+    std::vector< std::pair<I,T> > temp;++    for(I i = 0; i < n_row; i++){+        I row_start = Ap[i];+        I row_end   = Ap[i+1];++        temp.clear();++        for(I jj = row_start; jj < row_end; jj++){+            temp.push_back(std::make_pair(Aj[jj],Ax[jj]));+        }++        std::sort(temp.begin(),temp.end(),kv_pair_less<I,T>);++        for(I jj = row_start, n = 0; jj < row_end; jj++, n++){+            Aj[jj] = temp[n].first;+            Ax[jj] = temp[n].second;+        }+    }+}++template <class I, class T>+void csr_sum_duplicates(const I n_row,+                        const I n_col,+                              I Ap[],+                              I Aj[],+                              T Ax[])+{+    I nnz = 0;+    I row_end = 0;+    for(I i = 0; i < n_row; i++){+        I jj = row_end;+        row_end = Ap[i+1];+        while( jj < row_end ){+            I j = Aj[jj];+            T x = Ax[jj];+            jj++;+            while( jj < row_end && Aj[jj] == j ){+                x += Ax[jj];+                jj++;+            }+            Aj[nnz] = j;+            Ax[nnz] = x;+            nnz++;+        }+        Ap[i+1] = nnz;+    }+}++EIGEN_DONT_INLINE Scalar* setrand_scipy(const Coordinates& coords, const Values& vals)+{+  using namespace Eigen;+  SparseMatrix<Scalar> mat(SIZE,SIZE);+  mat.resizeNonZeros(coords.size());+//   std::cerr << "setrand_scipy...\n";+  coo_tocsr<Scalar>(SIZE,SIZE, coords.size(), coords, vals, mat._outerIndexPtr(), mat._innerIndexPtr(), mat._valuePtr());+//   std::cerr << "coo_tocsr ok\n";++  csr_sort_indices(SIZE, mat._outerIndexPtr(), mat._innerIndexPtr(), mat._valuePtr());++  csr_sum_duplicates(SIZE, SIZE, mat._outerIndexPtr(), mat._innerIndexPtr(), mat._valuePtr());++  mat.resizeNonZeros(mat._outerIndexPtr()[SIZE]);++  return &mat.coeffRef(coords[0].x(), coords[0].y());+}+++#ifndef NOUBLAS+EIGEN_DONT_INLINE Scalar* setrand_ublas_mapped(const Coordinates& coords, const Values& vals)+{+  using namespace boost;+  using namespace boost::numeric;+  using namespace boost::numeric::ublas;+  mapped_matrix<Scalar> aux(SIZE,SIZE);+  for (int i=0; i<coords.size(); ++i)+  {+    aux(coords[i].x(), coords[i].y()) += vals[i];+  }+  CHECK_MEM;+  compressed_matrix<Scalar> mat(aux);+  return 0;// &mat(coords[0].x(), coords[0].y());+}+/*EIGEN_DONT_INLINE Scalar* setrand_ublas_coord(const Coordinates& coords, const Values& vals)+{+  using namespace boost;+  using namespace boost::numeric;+  using namespace boost::numeric::ublas;+  coordinate_matrix<Scalar> aux(SIZE,SIZE);+  for (int i=0; i<coords.size(); ++i)+  {+    aux(coords[i].x(), coords[i].y()) = vals[i];+  }+  compressed_matrix<Scalar> mat(aux);+  return 0;//&mat(coords[0].x(), coords[0].y());+}+EIGEN_DONT_INLINE Scalar* setrand_ublas_compressed(const Coordinates& coords, const Values& vals)+{+  using namespace boost;+  using namespace boost::numeric;+  using namespace boost::numeric::ublas;+  compressed_matrix<Scalar> mat(SIZE,SIZE);+  for (int i=0; i<coords.size(); ++i)+  {+    mat(coords[i].x(), coords[i].y()) = vals[i];+  }+  return 0;//&mat(coords[0].x(), coords[0].y());+}*/+EIGEN_DONT_INLINE Scalar* setrand_ublas_genvec(const Coordinates& coords, const Values& vals)+{+  using namespace boost;+  using namespace boost::numeric;+  using namespace boost::numeric::ublas;++//   ublas::vector<coordinate_vector<Scalar> > foo;+  generalized_vector_of_vector<Scalar, row_major, ublas::vector<coordinate_vector<Scalar> > > aux(SIZE,SIZE);+  for (int i=0; i<coords.size(); ++i)+  {+    aux(coords[i].x(), coords[i].y()) += vals[i];+  }+  CHECK_MEM;+  compressed_matrix<Scalar,row_major> mat(aux);+  return 0;//&mat(coords[0].x(), coords[0].y());+}+#endif++#ifndef NOMTL+EIGEN_DONT_INLINE void setrand_mtl(const Coordinates& coords, const Values& vals);+#endif+
+ eigen3/bench/sparse_transpose.cpp view
@@ -0,0 +1,104 @@++//g++ -O3 -g0 -DNDEBUG  sparse_transpose.cpp -I.. -I/home/gael/Coding/LinearAlgebra/mtl4/ -DDENSITY=0.005 -DSIZE=10000 && ./a.out+// -DNOGMM -DNOMTL+// -DCSPARSE -I /home/gael/Coding/LinearAlgebra/CSparse/Include/ /home/gael/Coding/LinearAlgebra/CSparse/Lib/libcsparse.a++#ifndef SIZE+#define SIZE 10000+#endif++#ifndef DENSITY+#define DENSITY 0.01+#endif++#ifndef REPEAT+#define REPEAT 1+#endif++#include "BenchSparseUtil.h"++#ifndef MINDENSITY+#define MINDENSITY 0.0004+#endif++#ifndef NBTRIES+#define NBTRIES 10+#endif++#define BENCH(X) \+  timer.reset(); \+  for (int _j=0; _j<NBTRIES; ++_j) { \+    timer.start(); \+    for (int _k=0; _k<REPEAT; ++_k) { \+        X  \+  } timer.stop(); }++int main(int argc, char *argv[])+{+  int rows = SIZE;+  int cols = SIZE;+  float density = DENSITY;++  EigenSparseMatrix sm1(rows,cols), sm3(rows,cols);++  BenchTimer timer;+  for (float density = DENSITY; density>=MINDENSITY; density*=0.5)+  {+    fillMatrix(density, rows, cols, sm1);++    // dense matrices+    #ifdef DENSEMATRIX+    {+      DenseMatrix m1(rows,cols), m3(rows,cols);+      eiToDense(sm1, m1);+      BENCH(for (int k=0; k<REPEAT; ++k) m3 = m1.transpose();)+      std::cout << "  Eigen dense:\t" << timer.value() << endl;+    }+    #endif++    std::cout << "Non zeros: " << sm1.nonZeros()/float(sm1.rows()*sm1.cols())*100 << "%\n";++    // eigen sparse matrices+    {+      BENCH(for (int k=0; k<REPEAT; ++k) sm3 = sm1.transpose();)+      std::cout << "  Eigen:\t" << timer.value() << endl;+    }++    // CSparse+    #ifdef CSPARSE+    {+      cs *m1, *m3;+      eiToCSparse(sm1, m1);++      BENCH(for (int k=0; k<REPEAT; ++k) { m3 = cs_transpose(m1,1); cs_spfree(m3);})+      std::cout << "  CSparse:\t" << timer.value() << endl;+    }+    #endif++    // GMM+++    #ifndef NOGMM+    {+      GmmDynSparse  gmmT3(rows,cols);+      GmmSparse m1(rows,cols), m3(rows,cols);+      eiToGmm(sm1, m1);+      BENCH(for (int k=0; k<REPEAT; ++k) gmm::copy(gmm::transposed(m1),m3);)+      std::cout << "  GMM:\t\t" << timer.value() << endl;+    }+    #endif++    // MTL4+    #ifndef NOMTL+    {+      MtlSparse m1(rows,cols), m3(rows,cols);+      eiToMtl(sm1, m1);+      BENCH(for (int k=0; k<REPEAT; ++k) m3 = trans(m1);)+      std::cout << "  MTL4:\t\t" << timer.value() << endl;+    }+    #endif++    std::cout << "\n\n";+  }++  return 0;+}+
+ eigen3/bench/sparse_trisolver.cpp view
@@ -0,0 +1,220 @@++//g++ -O3 -g0 -DNDEBUG  sparse_product.cpp -I.. -I/home/gael/Coding/LinearAlgebra/mtl4/ -DDENSITY=0.005 -DSIZE=10000 && ./a.out+//g++ -O3 -g0 -DNDEBUG  sparse_product.cpp -I.. -I/home/gael/Coding/LinearAlgebra/mtl4/ -DDENSITY=0.05 -DSIZE=2000 && ./a.out+// -DNOGMM -DNOMTL+// -I /home/gael/Coding/LinearAlgebra/CSparse/Include/ /home/gael/Coding/LinearAlgebra/CSparse/Lib/libcsparse.a++#ifndef SIZE+#define SIZE 10000+#endif++#ifndef DENSITY+#define DENSITY 0.01+#endif++#ifndef REPEAT+#define REPEAT 1+#endif++#include "BenchSparseUtil.h"++#ifndef MINDENSITY+#define MINDENSITY 0.0004+#endif++#ifndef NBTRIES+#define NBTRIES 10+#endif++#define BENCH(X) \+  timer.reset(); \+  for (int _j=0; _j<NBTRIES; ++_j) { \+    timer.start(); \+    for (int _k=0; _k<REPEAT; ++_k) { \+        X  \+  } timer.stop(); }++typedef SparseMatrix<Scalar,UpperTriangular> EigenSparseTriMatrix;+typedef SparseMatrix<Scalar,RowMajorBit|UpperTriangular> EigenSparseTriMatrixRow;++void fillMatrix(float density, int rows, int cols,  EigenSparseTriMatrix& dst)+{+  dst.startFill(rows*cols*density);+  for(int j = 0; j < cols; j++)+  {+    for(int i = 0; i < j; i++)+    {+      Scalar v = (internal::random<float>(0,1) < density) ? internal::random<Scalar>() : 0;+      if (v!=0)+        dst.fill(i,j) = v;+    }+    dst.fill(j,j) = internal::random<Scalar>();+  }+  dst.endFill();+}++int main(int argc, char *argv[])+{+  int rows = SIZE;+  int cols = SIZE;+  float density = DENSITY;+  BenchTimer timer;+  #if 1+  EigenSparseTriMatrix sm1(rows,cols);+  typedef Matrix<Scalar,Dynamic,1> DenseVector;+  DenseVector b = DenseVector::Random(cols);+  DenseVector x = DenseVector::Random(cols);++  bool densedone = false;++  for (float density = DENSITY; density>=MINDENSITY; density*=0.5)+  {+    EigenSparseTriMatrix sm1(rows, cols);+    fillMatrix(density, rows, cols, sm1);++    // dense matrices+    #ifdef DENSEMATRIX+    if (!densedone)+    {+      densedone = true;+      std::cout << "Eigen Dense\t" << density*100 << "%\n";+      DenseMatrix m1(rows,cols);+      Matrix<Scalar,Dynamic,Dynamic,Dynamic,Dynamic,RowMajorBit> m2(rows,cols);+      eiToDense(sm1, m1);+      m2 = m1;++      BENCH(x = m1.marked<UpperTriangular>().solveTriangular(b);)+      std::cout << "   colmajor^-1 * b:\t" << timer.value() << endl;+//       std::cerr << x.transpose() << "\n";++      BENCH(x = m2.marked<UpperTriangular>().solveTriangular(b);)+      std::cout << "   rowmajor^-1 * b:\t" << timer.value() << endl;+//       std::cerr << x.transpose() << "\n";+    }+    #endif++    // eigen sparse matrices+    {+      std::cout << "Eigen sparse\t" << density*100 << "%\n";+      EigenSparseTriMatrixRow sm2 = sm1;++      BENCH(x = sm1.solveTriangular(b);)+      std::cout << "   colmajor^-1 * b:\t" << timer.value() << endl;+//       std::cerr << x.transpose() << "\n";++      BENCH(x = sm2.solveTriangular(b);)+      std::cout << "   rowmajor^-1 * b:\t" << timer.value() << endl;+//       std::cerr << x.transpose() << "\n";++//       x = b;+//       BENCH(sm1.inverseProductInPlace(x);)+//       std::cout << "   colmajor^-1 * b:\t" << timer.value() << " (inplace)" << endl;+//       std::cerr << x.transpose() << "\n";+//+//       x = b;+//       BENCH(sm2.inverseProductInPlace(x);)+//       std::cout << "   rowmajor^-1 * b:\t" << timer.value() << " (inplace)" << endl;+//       std::cerr << x.transpose() << "\n";+    }++++    // CSparse+    #ifdef CSPARSE+    {+      std::cout << "CSparse \t" << density*100 << "%\n";+      cs *m1;+      eiToCSparse(sm1, m1);++      BENCH(x = b; if (!cs_lsolve (m1, x.data())){std::cerr << "cs_lsolve failed\n"; break;}; )+      std::cout << "   colmajor^-1 * b:\t" << timer.value() << endl;+    }+    #endif++    // GMM+++    #ifndef NOGMM+    {+      std::cout << "GMM++ sparse\t" << density*100 << "%\n";+      GmmSparse m1(rows,cols);+      gmm::csr_matrix<Scalar> m2;+      eiToGmm(sm1, m1);+      gmm::copy(m1,m2);+      std::vector<Scalar> gmmX(cols), gmmB(cols);+      Map<Matrix<Scalar,Dynamic,1> >(&gmmX[0], cols) = x;+      Map<Matrix<Scalar,Dynamic,1> >(&gmmB[0], cols) = b;++      gmmX = gmmB;+      BENCH(gmm::upper_tri_solve(m1, gmmX, false);)+      std::cout << "   colmajor^-1 * b:\t" << timer.value() << endl;+//       std::cerr << Map<Matrix<Scalar,Dynamic,1> >(&gmmX[0], cols).transpose() << "\n";++      gmmX = gmmB;+      BENCH(gmm::upper_tri_solve(m2, gmmX, false);)+      timer.stop();+      std::cout << "   rowmajor^-1 * b:\t" << timer.value() << endl;+//       std::cerr << Map<Matrix<Scalar,Dynamic,1> >(&gmmX[0], cols).transpose() << "\n";+    }+    #endif++    // MTL4+    #ifndef NOMTL+    {+      std::cout << "MTL4\t" << density*100 << "%\n";+      MtlSparse m1(rows,cols);+      MtlSparseRowMajor m2(rows,cols);+      eiToMtl(sm1, m1);+      m2 = m1;+      mtl::dense_vector<Scalar> x(rows, 1.0);+      mtl::dense_vector<Scalar> b(rows, 1.0);++      BENCH(x = mtl::upper_trisolve(m1,b);)+      std::cout << "   colmajor^-1 * b:\t" << timer.value() << endl;+//       std::cerr << x << "\n";++      BENCH(x = mtl::upper_trisolve(m2,b);)+      std::cout << "   rowmajor^-1 * b:\t" << timer.value() << endl;+//       std::cerr << x << "\n";+    }+    #endif+++    std::cout << "\n\n";+  }+  #endif++  #if 0+    // bench small matrices (in-place versus return bye value)+    {+      timer.reset();+      for (int _j=0; _j<10; ++_j) {+        Matrix4f m = Matrix4f::Random();+        Vector4f b = Vector4f::Random();+        Vector4f x = Vector4f::Random();+        timer.start();+        for (int _k=0; _k<1000000; ++_k) {+          b = m.inverseProduct(b);+        }+        timer.stop();+      }+      std::cout << "4x4 :\t" << timer.value() << endl;+    }++    {+      timer.reset();+      for (int _j=0; _j<10; ++_j) {+        Matrix4f m = Matrix4f::Random();+        Vector4f b = Vector4f::Random();+        Vector4f x = Vector4f::Random();+        timer.start();+        for (int _k=0; _k<1000000; ++_k) {+          m.inverseProductInPlace(x);+        }+        timer.stop();+      }+      std::cout << "4x4 IP :\t" << timer.value() << endl;+    }+  #endif++  return 0;+}+
+ eigen3/bench/spbench/CMakeLists.txt view
@@ -0,0 +1,85 @@+++set(BLAS_FOUND TRUE)+set(LAPACK_FOUND TRUE)+set(BLAS_LIBRARIES eigen_blas_static)+set(LAPACK_LIBRARIES eigen_lapack_static)++set(SPARSE_LIBS "")++# find_library(PARDISO_LIBRARIES pardiso412-GNU450-X86-64)+# if(PARDISO_LIBRARIES)+#   add_definitions("-DEIGEN_PARDISO_SUPPORT")+#   set(SPARSE_LIBS ${SPARSE_LIBS} ${PARDISO_LIBRARIES})+# endif(PARDISO_LIBRARIES)++find_package(Cholmod)+if(CHOLMOD_FOUND AND BLAS_FOUND AND LAPACK_FOUND)+  add_definitions("-DEIGEN_CHOLMOD_SUPPORT")+  include_directories(${CHOLMOD_INCLUDES})+  set(SPARSE_LIBS ${SPARSE_LIBS} ${CHOLMOD_LIBRARIES} ${BLAS_LIBRARIES} ${LAPACK_LIBRARIES})+  set(CHOLMOD_ALL_LIBS  ${CHOLMOD_LIBRARIES} ${BLAS_LIBRARIES} ${LAPACK_LIBRARIES})+endif()++find_package(Umfpack)+if(UMFPACK_FOUND AND BLAS_FOUND)+  add_definitions("-DEIGEN_UMFPACK_SUPPORT")+  include_directories(${UMFPACK_INCLUDES})+  set(SPARSE_LIBS ${SPARSE_LIBS} ${UMFPACK_LIBRARIES} ${BLAS_LIBRARIES})+  set(UMFPACK_ALL_LIBS ${UMFPACK_LIBRARIES} ${BLAS_LIBRARIES})+endif()++find_package(SuperLU 4.0)+if(SUPERLU_FOUND AND BLAS_FOUND)+  add_definitions("-DEIGEN_SUPERLU_SUPPORT")+  include_directories(${SUPERLU_INCLUDES})+  set(SPARSE_LIBS ${SPARSE_LIBS} ${SUPERLU_LIBRARIES} ${BLAS_LIBRARIES})+  set(SUPERLU_ALL_LIBS ${SUPERLU_LIBRARIES} ${BLAS_LIBRARIES})+endif()+++find_package(PASTIX QUIET COMPONENTS METIS SCOTCH)+# 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 AND BLAS_FOUND)+  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})  +  endif(SCOTCH_FOUND)+  set(SPARSE_LIBS ${SPARSE_LIBS} ${PASTIX_LIBRARIES_DEP} ${ORDERING_LIBRARIES})+  set(PASTIX_ALL_LIBS ${PASTIX_LIBRARIES_DEP})+endif()++if(METIS_FOUND)+  include_directories(${METIS_INCLUDE_DIRS})+  set (SPARSE_LIBS ${SPARSE_LIBS} ${METIS_LIBRARIES})+  add_definitions("-DEIGEN_METIS_SUPPORT")+endif(METIS_FOUND)++find_library(RT_LIBRARY rt)+if(RT_LIBRARY)+  set(SPARSE_LIBS ${SPARSE_LIBS} ${RT_LIBRARY})+endif(RT_LIBRARY)++add_executable(spbenchsolver spbenchsolver.cpp)+target_link_libraries (spbenchsolver ${SPARSE_LIBS})++add_executable(spsolver sp_solver.cpp)+target_link_libraries (spsolver ${SPARSE_LIBS})+++add_executable(test_sparseLU test_sparseLU.cpp)+target_link_libraries (test_sparseLU ${SPARSE_LIBS})+
+ eigen3/bench/spbench/sp_solver.cpp view
@@ -0,0 +1,125 @@+// Small bench routine for Eigen available in Eigen+// (C) Desire NUENTSA WAKAM, INRIA++#include <iostream>+#include <fstream>+#include <iomanip>+#include <Eigen/Jacobi>+#include <Eigen/Householder>+#include <Eigen/IterativeLinearSolvers>+#include <Eigen/LU>+#include <unsupported/Eigen/SparseExtra>+//#include <Eigen/SparseLU>+#include <Eigen/SuperLUSupport>+// #include <unsupported/Eigen/src/IterativeSolvers/Scaling.h>+#include <bench/BenchTimer.h>+#include <unsupported/Eigen/IterativeSolvers>+using namespace std;+using namespace Eigen;++int main(int argc, char **args)+{+  SparseMatrix<double, ColMajor> A; +  typedef SparseMatrix<double, ColMajor>::Index Index;+  typedef Matrix<double, Dynamic, Dynamic> DenseMatrix;+  typedef Matrix<double, Dynamic, 1> DenseRhs;+  VectorXd b, x, tmp;+  BenchTimer timer,totaltime; +  //SparseLU<SparseMatrix<double, ColMajor> >   solver;+//   SuperLU<SparseMatrix<double, ColMajor> >   solver;+  ConjugateGradient<SparseMatrix<double, ColMajor>, Lower,IncompleteCholesky<double,Lower> > solver; +  ifstream matrix_file; +  string line;+  int  n;+  // Set parameters+//   solver.iparm(IPARM_THREAD_NBR) = 4;+  /* Fill the matrix with sparse matrix stored in Matrix-Market coordinate column-oriented format */+  if (argc < 2) assert(false && "please, give the matrix market file ");+  +  timer.start();+  totaltime.start();+  loadMarket(A, args[1]);+  cout << "End charging matrix " << endl;+  bool iscomplex=false, isvector=false;+  int sym;+  getMarketHeader(args[1], sym, iscomplex, isvector);+  if (iscomplex) { cout<< " Not for complex matrices \n"; return -1; }+  if (isvector) { cout << "The provided file is not a matrix file\n"; return -1;}+  if (sym != 0) { // symmetric matrices, only the lower part is stored+    SparseMatrix<double, ColMajor> temp; +    temp = A;+    A = temp.selfadjointView<Lower>();+  }+  timer.stop();+  +  n = A.cols();+  // ====== TESTS FOR SPARSE TUTORIAL ======+//   cout<< "OuterSize " << A.outerSize() << " inner " << A.innerSize() << endl; +//   SparseMatrix<double, RowMajor> mat1(A); +//   SparseMatrix<double, RowMajor> mat2;+//   cout << " norm of A " << mat1.norm() << endl; ;+//   PermutationMatrix<Dynamic, Dynamic, int> perm(n);+//   perm.resize(n,1);+//   perm.indices().setLinSpaced(n, 0, n-1);+//   mat2 = perm * mat1;+//   mat.subrows();+//   mat2.resize(n,n); +//   mat2.reserve(10);+//   mat2.setConstant();+//   std::cout<< "NORM " << mat1.squaredNorm()<< endl;  ++  cout<< "Time to load the matrix " << timer.value() <<endl;+  /* Fill the right hand side */++//   solver.set_restart(374);+  if (argc > 2)+    loadMarketVector(b, args[2]);+  else +  {+    b.resize(n);+    tmp.resize(n);+//       tmp.setRandom();+    for (int i = 0; i < n; i++) tmp(i) = i; +    b = A * tmp ;+  }+//   Scaling<SparseMatrix<double> > scal; +//   scal.computeRef(A);+//   b = scal.LeftScaling().cwiseProduct(b);++  /* Compute the factorization */+  cout<< "Starting the factorization "<< endl; +  timer.reset();+  timer.start(); +  cout<< "Size of Input Matrix "<< b.size()<<"\n\n";+  cout<< "Rows and columns "<< A.rows() <<" " <<A.cols() <<"\n";+  solver.compute(A);+//   solver.analyzePattern(A);+//   solver.factorize(A);+  if (solver.info() != Success) {+    std::cout<< "The solver failed \n";+    return -1; +  }+  timer.stop(); +  float time_comp = timer.value(); +  cout <<" Compute Time " << time_comp<< endl; +  +  timer.reset();+  timer.start();+  x = solver.solve(b);+//   x = scal.RightScaling().cwiseProduct(x);+  timer.stop();+  float time_solve = timer.value(); +  cout<< " Time to solve " << time_solve << endl; + +  /* Check the accuracy */+  VectorXd tmp2 = b - A*x;+  double tempNorm = tmp2.norm()/b.norm();+  cout << "Relative norm of the computed solution : " << tempNorm <<"\n";+//   cout << "Iterations : " << solver.iterations() << "\n"; +  +  totaltime.stop();+  cout << "Total time " << totaltime.value() << "\n";+//  std::cout<<x.transpose()<<"\n";+  +  return 0;+}
+ eigen3/bench/spbench/spbench.dtd view
@@ -0,0 +1,31 @@+<!ELEMENT BENCH (AVAILSOLVER+,LINEARSYSTEM+)>+  <!ELEMENT AVAILSOLVER (SOLVER+)>+    <!ELEMENT SOLVER (TYPE,PACKAGE)>+      <!ELEMENT TYPE (#PCDATA)>  <!-- One of LU, LLT, LDLT, ITER -->+      <!ELEMENT PACKAGE (#PCDATA)>  <!-- Derived from a library -->+  <!ELEMENT LINEARSYSTEM (MATRIX,SOLVER_STAT+,BEST_SOLVER,GLOBAL_PARAMS*)>+    <!ELEMENT MATRIX (NAME,SIZE,ENTRIES,PATTERN?,SYMMETRY,POSDEF?,ARITHMETIC,RHS*)>+      <!ELEMENT NAME (#PCDATA)>+      <!ELEMENT SIZE (#PCDATA)>+      <!ELEMENT ENTRIES (#PCDATA)> <!-- The number of nonzeros elements -->+      <!ELEMENT PATTERN (#PCDATA)>  <!-- Is structural pattern symmetric or not -->+      <!ELEMENT SYMMETRY (#PCDATA)> <!-- symmmetry with numerical values -->+      <!ELEMENT POSDEF (#PCDATA)> <!-- Is the matrix positive definite or not -->+      <!ELEMENT ARITHMETIC (#PCDATA)> +      <!ELEMENT RHS (SOURCE)>  <!-- A matrix can have one or more right hand side associated. -->+        <!ELEMENT SOURCE (#PCDATA)> <!-- Source of the right hand side, either generated or provided -->+    <!ELEMENT SOLVER_STAT (PARAMS*,TIME,ERROR,ITER?)>+      <!ELEMENT PARAMS (#PCDATA)>+      <!ELEMENT TIME (COMPUTE,SOLVE,TOTAL)>+        <!ELEMENT COMPUTE (#PCDATA)> <!-- Time to analyze,to factorize, or to setup the preconditioner-->+        <!ELEMENT SOLVE (#PCDATA)> <!-- Time to solve with all the available rhs -->+        <!ELEMENT TOTAL (#PCDATA)>+      <!ELEMENT ERROR (#PCDATA)> <!-- Either the relative error or the relative residual norm -->+      <!ELEMENT ITER (#PCDATA)> <!-- Number of iterations -->+    <!ELEMENT BEST_SOLVER CDATA> <!-- Id of the best solver -->+    <!ELEMENT GLOBAL_PARAMS (#PCDATA)> <!-- Parameters shared by all solvers -->++<!ATTLIST SOLVER ID CDATA #REQUIRED>+<!ATTLIST SOLVER_STAT ID CDATA #REQUIRED>+<!ATTLIST BEST_SOLVER ID CDATA #REQUIRED>+<!ATTLIST RHS ID CDATA #IMPLIED>
+ eigen3/bench/spbench/spbenchsolver.cpp view
@@ -0,0 +1,87 @@+#include <bench/spbench/spbenchsolver.h>++void bench_printhelp()+{+    cout<< " \nbenchsolver : performs a benchmark of all the solvers available in Eigen \n\n";+    cout<< " MATRIX FOLDER : \n";+    cout<< " The matrices for the benchmark should be collected in a folder specified with an environment variable EIGEN_MATRIXDIR \n";+    cout<< " The matrices are stored using the matrix market coordinate format \n";+    cout<< " The matrix and associated right-hand side (rhs) files are named respectively \n";+    cout<< " as MatrixName.mtx and MatrixName_b.mtx. If the rhs does not exist, a random one is generated. \n";+    cout<< " If a matrix is SPD, the matrix should be named as MatrixName_SPD.mtx \n";+    cout<< " If a true solution exists, it should be named as MatrixName_x.mtx; \n"     ;+    cout<< " it will be used to compute the norm of the error relative to the computed solutions\n\n";+    cout<< " OPTIONS : \n"; +    cout<< " -h or --help \n    print this help and return\n\n";+    cout<< " -d matrixdir \n    Use matrixdir as the matrix folder instead of the one specified in the environment variable EIGEN_MATRIXDIR\n\n"; +    cout<< " -o outputfile.xml \n    Output the statistics to a xml file \n\n";+    cout<< " --eps <RelErr> Sets the relative tolerance for iterative solvers (default 1e-08) \n\n";+    cout<< " --maxits <MaxIts> Sets the maximum number of iterations (default 1000) \n\n";+    +}+int main(int argc, char ** args)+{+  +  bool help = ( get_options(argc, args, "-h") || get_options(argc, args, "--help") );+  if(help) {+    bench_printhelp();+    return 0;+  }++  // Get the location of the test matrices+  string matrix_dir;+  if (!get_options(argc, args, "-d", &matrix_dir))+  {+    if(getenv("EIGEN_MATRIXDIR") == NULL){+      std::cerr << "Please, specify the location of the matrices with -d mat_folder or the environment variable EIGEN_MATRIXDIR \n";+      std::cerr << " Run with --help to see the list of all the available options \n";+      return -1;+    }+    matrix_dir = getenv("EIGEN_MATRIXDIR");+  }+     +  std::ofstream statbuf;+  string statFile ;+  +  // Get the file to write the statistics+  bool statFileExists = get_options(argc, args, "-o", &statFile);+  if(statFileExists)+  {+    statbuf.open(statFile.c_str(), std::ios::out);+    if(statbuf.good()){+      statFileExists = true; +      printStatheader(statbuf);+      statbuf.close();+    }+    else+      std::cerr << "Unable to open the provided file for writting... \n";+  }       +  +  // Get the maximum number of iterations and the tolerance+  int maxiters = 1000; +  double tol = 1e-08; +  string inval; +  if (get_options(argc, args, "--eps", &inval))+    tol = atof(inval.c_str()); +  if(get_options(argc, args, "--maxits", &inval))+    maxiters = atoi(inval.c_str()); +  +  string current_dir; +  // Test the real-arithmetics matrices+  Browse_Matrices<double>(matrix_dir, statFileExists, statFile,maxiters, tol);+  +  // Test the complex-arithmetics matrices+  Browse_Matrices<std::complex<double> >(matrix_dir, statFileExists, statFile, maxiters, tol); +  +  if(statFileExists)+  {+    statbuf.open(statFile.c_str(), std::ios::app); +    statbuf << "</BENCH> \n";+    cout << "\n Output written in " << statFile << " ...\n";+    statbuf.close();+  }++  return 0;+}++      
+ eigen3/bench/spbench/spbenchsolver.h view
@@ -0,0 +1,554 @@+// This file is part of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2012 Désiré Nuentsa-Wakam <desire.nuentsa_wakam@inria.fr>+//+// 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 <iostream>+#include <fstream>+#include <Eigen/SparseCore>+#include <bench/BenchTimer.h>+#include <cstdlib>+#include <string>+#include <Eigen/Cholesky>+#include <Eigen/Jacobi>+#include <Eigen/Householder>+#include <Eigen/IterativeLinearSolvers>+#include <unsupported/Eigen/IterativeSolvers>+#include <Eigen/LU>+#include <unsupported/Eigen/SparseExtra>+#include <Eigen/SparseLU>++#include "spbenchstyle.h"++#ifdef EIGEN_METIS_SUPPORT+#include <Eigen/MetisSupport>+#endif++#ifdef EIGEN_CHOLMOD_SUPPORT+#include <Eigen/CholmodSupport>+#endif++#ifdef EIGEN_UMFPACK_SUPPORT+#include <Eigen/UmfPackSupport>+#endif++#ifdef EIGEN_PARDISO_SUPPORT+#include <Eigen/PardisoSupport>+#endif++#ifdef EIGEN_SUPERLU_SUPPORT+#include <Eigen/SuperLUSupport>+#endif++#ifdef EIGEN_PASTIX_SUPPORT+#include <Eigen/PaStiXSupport>+#endif++// CONSTANTS+#define EIGEN_UMFPACK  10+#define EIGEN_SUPERLU  20+#define EIGEN_PASTIX  30+#define EIGEN_PARDISO  40+#define EIGEN_SPARSELU_COLAMD 50+#define EIGEN_SPARSELU_METIS 51+#define EIGEN_BICGSTAB  60+#define EIGEN_BICGSTAB_ILUT  61+#define EIGEN_GMRES 70+#define EIGEN_GMRES_ILUT 71+#define EIGEN_SIMPLICIAL_LDLT  80+#define EIGEN_CHOLMOD_LDLT  90+#define EIGEN_PASTIX_LDLT  100+#define EIGEN_PARDISO_LDLT  110+#define EIGEN_SIMPLICIAL_LLT  120+#define EIGEN_CHOLMOD_SUPERNODAL_LLT  130+#define EIGEN_CHOLMOD_SIMPLICIAL_LLT  140+#define EIGEN_PASTIX_LLT  150+#define EIGEN_PARDISO_LLT  160+#define EIGEN_CG  170+#define EIGEN_CG_PRECOND  180++using namespace Eigen;+using namespace std; +++// Global variables for input parameters+int MaximumIters; // Maximum number of iterations+double RelErr; // Relative error of the computed solution+double best_time_val; // Current best time overall solvers +int best_time_id; //  id of the best solver for the current system ++template<typename T> inline typename NumTraits<T>::Real test_precision() { return NumTraits<T>::dummy_precision(); }+template<> inline float test_precision<float>() { return 1e-3f; }                                                             +template<> inline double test_precision<double>() { return 1e-6; }                                                            +template<> inline float test_precision<std::complex<float> >() { return test_precision<float>(); }+template<> inline double test_precision<std::complex<double> >() { return test_precision<double>(); }++void printStatheader(std::ofstream& out)+{+  // Print XML header+  // NOTE It would have been much easier to write these XML documents using external libraries like tinyXML or Xerces-C++.+  +  out << "<?xml version='1.0' encoding='UTF-8'?> \n";+  out << "<?xml-stylesheet type='text/xsl' href='#stylesheet' ?> \n"; +  out << "<!DOCTYPE BENCH  [\n<!ATTLIST xsl:stylesheet\n id\t ID  #REQUIRED>\n]>";+  out << "\n\n<!-- Generated by the Eigen library -->\n"; +  +  out << "\n<BENCH> \n" ; //root XML element +  // Print the xsl style section+  printBenchStyle(out); +  // List all available solvers +  out << " <AVAILSOLVER> \n";+#ifdef EIGEN_UMFPACK_SUPPORT+  out <<"  <SOLVER ID='" << EIGEN_UMFPACK << "'>\n"; +  out << "   <TYPE> LU </TYPE> \n";+  out << "   <PACKAGE> UMFPACK </PACKAGE> \n"; +  out << "  </SOLVER> \n"; +#endif+#ifdef EIGEN_SUPERLU_SUPPORT+  out <<"  <SOLVER ID='" << EIGEN_SUPERLU << "'>\n"; +  out << "   <TYPE> LU </TYPE> \n";+  out << "   <PACKAGE> SUPERLU </PACKAGE> \n"; +  out << "  </SOLVER> \n"; +#endif+#ifdef EIGEN_CHOLMOD_SUPPORT+  out <<"  <SOLVER ID='" << EIGEN_CHOLMOD_SIMPLICIAL_LLT << "'>\n"; +  out << "   <TYPE> LLT SP</TYPE> \n";+  out << "   <PACKAGE> CHOLMOD </PACKAGE> \n";+  out << "  </SOLVER> \n"; +  +  out <<"  <SOLVER ID='" << EIGEN_CHOLMOD_SUPERNODAL_LLT << "'>\n"; +  out << "   <TYPE> LLT</TYPE> \n";+  out << "   <PACKAGE> CHOLMOD </PACKAGE> \n";+  out << "  </SOLVER> \n";+  +  out <<"  <SOLVER ID='" << EIGEN_CHOLMOD_LDLT << "'>\n"; +  out << "   <TYPE> LDLT </TYPE> \n";+  out << "   <PACKAGE> CHOLMOD </PACKAGE> \n";  +  out << "  </SOLVER> \n"; +#endif+#ifdef EIGEN_PARDISO_SUPPORT+  out <<"  <SOLVER ID='" << EIGEN_PARDISO << "'>\n"; +  out << "   <TYPE> LU </TYPE> \n";+  out << "   <PACKAGE> PARDISO </PACKAGE> \n"; +  out << "  </SOLVER> \n"; +  +  out <<"  <SOLVER ID='" << EIGEN_PARDISO_LLT << "'>\n"; +  out << "   <TYPE> LLT </TYPE> \n";+  out << "   <PACKAGE> PARDISO </PACKAGE> \n"; +  out << "  </SOLVER> \n"; +  +  out <<"  <SOLVER ID='" << EIGEN_PARDISO_LDLT << "'>\n"; +  out << "   <TYPE> LDLT </TYPE> \n";+  out << "   <PACKAGE> PARDISO </PACKAGE> \n"; +  out << "  </SOLVER> \n"; +#endif+#ifdef EIGEN_PASTIX_SUPPORT+  out <<"  <SOLVER ID='" << EIGEN_PASTIX << "'>\n"; +  out << "   <TYPE> LU </TYPE> \n";+  out << "   <PACKAGE> PASTIX </PACKAGE> \n"; +  out << "  </SOLVER> \n"; +  +  out <<"  <SOLVER ID='" << EIGEN_PASTIX_LLT << "'>\n"; +  out << "   <TYPE> LLT </TYPE> \n";+  out << "   <PACKAGE> PASTIX </PACKAGE> \n"; +  out << "  </SOLVER> \n"; +  +  out <<"  <SOLVER ID='" << EIGEN_PASTIX_LDLT << "'>\n"; +  out << "   <TYPE> LDLT </TYPE> \n";+  out << "   <PACKAGE> PASTIX </PACKAGE> \n"; +  out << "  </SOLVER> \n"; +#endif+  +  out <<"  <SOLVER ID='" << EIGEN_BICGSTAB << "'>\n"; +  out << "   <TYPE> BICGSTAB </TYPE> \n";+  out << "   <PACKAGE> EIGEN </PACKAGE> \n"; +  out << "  </SOLVER> \n"; +  +  out <<"  <SOLVER ID='" << EIGEN_BICGSTAB_ILUT << "'>\n"; +  out << "   <TYPE> BICGSTAB_ILUT </TYPE> \n";+  out << "   <PACKAGE> EIGEN </PACKAGE> \n"; +  out << "  </SOLVER> \n"; +  +  out <<"  <SOLVER ID='" << EIGEN_GMRES_ILUT << "'>\n"; +  out << "   <TYPE> GMRES_ILUT </TYPE> \n";+  out << "   <PACKAGE> EIGEN </PACKAGE> \n"; +  out << "  </SOLVER> \n"; +  +  out <<"  <SOLVER ID='" << EIGEN_SIMPLICIAL_LDLT << "'>\n"; +  out << "   <TYPE> LDLT </TYPE> \n";+  out << "   <PACKAGE> EIGEN </PACKAGE> \n"; +  out << "  </SOLVER> \n"; +  +  out <<"  <SOLVER ID='" << EIGEN_SIMPLICIAL_LLT << "'>\n"; +  out << "   <TYPE> LLT </TYPE> \n";+  out << "   <PACKAGE> EIGEN </PACKAGE> \n"; +  out << "  </SOLVER> \n"; +  +  out <<"  <SOLVER ID='" << EIGEN_CG << "'>\n"; +  out << "   <TYPE> CG </TYPE> \n";+  out << "   <PACKAGE> EIGEN </PACKAGE> \n"; +  out << "  </SOLVER> \n"; +  +  out <<"  <SOLVER ID='" << EIGEN_SPARSELU_COLAMD << "'>\n"; +  out << "   <TYPE> LU_COLAMD </TYPE> \n";+  out << "   <PACKAGE> EIGEN </PACKAGE> \n"; +  out << "  </SOLVER> \n"; +  +#ifdef EIGEN_METIS_SUPPORT+  out <<"  <SOLVER ID='" << EIGEN_SPARSELU_METIS << "'>\n"; +  out << "   <TYPE> LU_METIS </TYPE> \n";+  out << "   <PACKAGE> EIGEN </PACKAGE> \n"; +  out << "  </SOLVER> \n"; +#endif+  out << " </AVAILSOLVER> \n"; +  +}+++template<typename Solver, typename Scalar>+void call_solver(Solver &solver, const int solver_id, const typename Solver::MatrixType& A, const Matrix<Scalar, Dynamic, 1>& b, const Matrix<Scalar, Dynamic, 1>& refX,std::ofstream& statbuf)+{+  +  double total_time;+  double compute_time;+  double solve_time; +  double rel_error;+  Matrix<Scalar, Dynamic, 1> x; +  BenchTimer timer; +  timer.reset();+  timer.start();+  solver.compute(A); +  if (solver.info() != Success)+  {+    std::cerr << "Solver failed ... \n";+    return;+  }+  timer.stop();+  compute_time = timer.value();+  statbuf << "    <TIME>\n"; +  statbuf << "     <COMPUTE> " << timer.value() << "</COMPUTE>\n";+  std::cout<< "COMPUTE TIME : " << timer.value() <<std::endl; +    +  timer.reset();+  timer.start();+  x = solver.solve(b); +  if (solver.info() == NumericalIssue)+  {+    std::cerr << "Solver failed ... \n";+    return;+  }+  timer.stop();+  solve_time = timer.value();+  statbuf << "     <SOLVE> " << timer.value() << "</SOLVE>\n"; +  std::cout<< "SOLVE TIME : " << timer.value() <<std::endl; +  +  total_time = solve_time + compute_time;+  statbuf << "     <TOTAL> " << total_time << "</TOTAL>\n"; +  std::cout<< "TOTAL TIME : " << total_time <<std::endl; +  statbuf << "    </TIME>\n"; +  +  // Verify the relative error+  if(refX.size() != 0)+    rel_error = (refX - x).norm()/refX.norm();+  else +  {+    // Compute the relative residual norm+    Matrix<Scalar, Dynamic, 1> temp; +    temp = A * x; +    rel_error = (b-temp).norm()/b.norm();+  }+  statbuf << "    <ERROR> " << rel_error << "</ERROR>\n"; +  std::cout<< "REL. ERROR : " << rel_error << "\n\n" ;+  if ( rel_error <= RelErr )+  {+    // check the best time if convergence+    if(!best_time_val || (best_time_val > total_time))+    {+      best_time_val = total_time;+      best_time_id = solver_id;+    }+  }+}++template<typename Solver, typename Scalar>+void call_directsolver(Solver& solver, const int solver_id, const typename Solver::MatrixType& A, const Matrix<Scalar, Dynamic, 1>& b, const Matrix<Scalar, Dynamic, 1>& refX, std::string& statFile)+{+    std::ofstream statbuf(statFile.c_str(), std::ios::app);+    statbuf << "   <SOLVER_STAT ID='" << solver_id <<"'>\n"; +    call_solver(solver, solver_id, A, b, refX,statbuf);+    statbuf << "   </SOLVER_STAT>\n";+    statbuf.close();+}++template<typename Solver, typename Scalar>+void call_itersolver(Solver &solver, const int solver_id, const typename Solver::MatrixType& A, const Matrix<Scalar, Dynamic, 1>& b, const Matrix<Scalar, Dynamic, 1>& refX, std::string& statFile)+{+  solver.setTolerance(RelErr); +  solver.setMaxIterations(MaximumIters);+  +  std::ofstream statbuf(statFile.c_str(), std::ios::app);+  statbuf << " <SOLVER_STAT ID='" << solver_id <<"'>\n"; +  call_solver(solver, solver_id, A, b, refX,statbuf); +  statbuf << "   <ITER> "<< solver.iterations() << "</ITER>\n";+  statbuf << " </SOLVER_STAT>\n";+  std::cout << "ITERATIONS : " << solver.iterations() <<"\n\n\n"; +  +}+++template <typename Scalar>+void SelectSolvers(const SparseMatrix<Scalar>&A, unsigned int sym, Matrix<Scalar, Dynamic, 1>& b, const Matrix<Scalar, Dynamic, 1>& refX, std::string& statFile)+{+  typedef SparseMatrix<Scalar, ColMajor> SpMat; +  // First, deal with Nonsymmetric and symmetric matrices+  best_time_id = 0; +  best_time_val = 0.0;+  //UMFPACK+  #ifdef EIGEN_UMFPACK_SUPPORT+  {+    cout << "Solving with UMFPACK LU ... \n"; +    UmfPackLU<SpMat> solver; +    call_directsolver(solver, EIGEN_UMFPACK, A, b, refX,statFile); +  }+  #endif+    //SuperLU+  #ifdef EIGEN_SUPERLU_SUPPORT+  {+    cout << "\nSolving with SUPERLU ... \n"; +    SuperLU<SpMat> solver;+    call_directsolver(solver, EIGEN_SUPERLU, A, b, refX,statFile); +  }+  #endif+    +   // PaStix LU+  #ifdef EIGEN_PASTIX_SUPPORT+  {+    cout << "\nSolving with PASTIX LU ... \n"; +    PastixLU<SpMat> solver; +    call_directsolver(solver, EIGEN_PASTIX, A, b, refX,statFile) ;+  }+  #endif++   //PARDISO LU+  #ifdef EIGEN_PARDISO_SUPPORT+  {+    cout << "\nSolving with PARDISO LU ... \n"; +    PardisoLU<SpMat>  solver; +    call_directsolver(solver, EIGEN_PARDISO, A, b, refX,statFile);+  }+  #endif+  +  // Eigen SparseLU METIS+  cout << "\n Solving with Sparse LU AND COLAMD ... \n";+  SparseLU<SpMat, COLAMDOrdering<int> >   solver;+  call_directsolver(solver, EIGEN_SPARSELU_COLAMD, A, b, refX, statFile); +  // Eigen SparseLU METIS+  #ifdef EIGEN_METIS_SUPPORT+  {+    cout << "\n Solving with Sparse LU AND METIS ... \n";+    SparseLU<SpMat, MetisOrdering<int> >   solver;+    call_directsolver(solver, EIGEN_SPARSELU_METIS, A, b, refX, statFile); +  }+  #endif+  +  //BiCGSTAB+  {+    cout << "\nSolving with BiCGSTAB ... \n"; +    BiCGSTAB<SpMat> solver; +    call_itersolver(solver, EIGEN_BICGSTAB, A, b, refX,statFile);+  }+  //BiCGSTAB+ILUT+  {+    cout << "\nSolving with BiCGSTAB and ILUT ... \n"; +    BiCGSTAB<SpMat, IncompleteLUT<Scalar> > solver; +    call_itersolver(solver, EIGEN_BICGSTAB_ILUT, A, b, refX,statFile); +  }+  +   +  //GMRES+//   {+//     cout << "\nSolving with GMRES ... \n"; +//     GMRES<SpMat> solver; +//     call_itersolver(solver, EIGEN_GMRES, A, b, refX,statFile); +//   }+  //GMRES+ILUT+  {+    cout << "\nSolving with GMRES and ILUT ... \n"; +    GMRES<SpMat, IncompleteLUT<Scalar> > solver; +    call_itersolver(solver, EIGEN_GMRES_ILUT, A, b, refX,statFile);+  }+  +  // Hermitian and not necessarily positive-definites+  if (sym != NonSymmetric)+  {+    // Internal Cholesky+    {+      cout << "\nSolving with Simplicial LDLT ... \n"; +      SimplicialLDLT<SpMat, Lower> solver;+      call_directsolver(solver, EIGEN_SIMPLICIAL_LDLT, A, b, refX,statFile); +    }+    +    // CHOLMOD+    #ifdef EIGEN_CHOLMOD_SUPPORT+    {+      cout << "\nSolving with CHOLMOD LDLT ... \n"; +      CholmodDecomposition<SpMat, Lower> solver;+      solver.setMode(CholmodLDLt);+       call_directsolver(solver,EIGEN_CHOLMOD_LDLT, A, b, refX,statFile);+    }+    #endif+    +    //PASTIX LLT+    #ifdef EIGEN_PASTIX_SUPPORT+    {+      cout << "\nSolving with PASTIX LDLT ... \n"; +      PastixLDLT<SpMat, Lower> solver; +      call_directsolver(solver,EIGEN_PASTIX_LDLT, A, b, refX,statFile); +    }+    #endif+    +    //PARDISO LLT+    #ifdef EIGEN_PARDISO_SUPPORT+    {+      cout << "\nSolving with PARDISO LDLT ... \n"; +      PardisoLDLT<SpMat, Lower> solver; +      call_directsolver(solver,EIGEN_PARDISO_LDLT, A, b, refX,statFile); +    }+    #endif+  }++   // Now, symmetric POSITIVE DEFINITE matrices+  if (sym == SPD)+  {+    +    //Internal Sparse Cholesky+    {+      cout << "\nSolving with SIMPLICIAL LLT ... \n"; +      SimplicialLLT<SpMat, Lower> solver; +      call_directsolver(solver,EIGEN_SIMPLICIAL_LLT, A, b, refX,statFile); +    }+    +    // CHOLMOD+    #ifdef EIGEN_CHOLMOD_SUPPORT+    {+      // CholMOD SuperNodal LLT+      cout << "\nSolving with CHOLMOD LLT (Supernodal)... \n"; +      CholmodDecomposition<SpMat, Lower> solver;+      solver.setMode(CholmodSupernodalLLt);+       call_directsolver(solver,EIGEN_CHOLMOD_SUPERNODAL_LLT, A, b, refX,statFile);+      // CholMod Simplicial LLT+      cout << "\nSolving with CHOLMOD LLT (Simplicial) ... \n"; +      solver.setMode(CholmodSimplicialLLt);+      call_directsolver(solver,EIGEN_CHOLMOD_SIMPLICIAL_LLT, A, b, refX,statFile);+    }+    #endif+    +    //PASTIX LLT+    #ifdef EIGEN_PASTIX_SUPPORT+    {+      cout << "\nSolving with PASTIX LLT ... \n"; +      PastixLLT<SpMat, Lower> solver; +      call_directsolver(solver,EIGEN_PASTIX_LLT, A, b, refX,statFile);+    }+    #endif+    +    //PARDISO LLT+    #ifdef EIGEN_PARDISO_SUPPORT+    {+      cout << "\nSolving with PARDISO LLT ... \n"; +      PardisoLLT<SpMat, Lower> solver; +      call_directsolver(solver,EIGEN_PARDISO_LLT, A, b, refX,statFile); +    }+    #endif+    +    // Internal CG+    {+      cout << "\nSolving with CG ... \n"; +      ConjugateGradient<SpMat, Lower> solver; +      call_itersolver(solver,EIGEN_CG, A, b, refX,statFile);+    }+    //CG+IdentityPreconditioner+//     {+//       cout << "\nSolving with CG and IdentityPreconditioner ... \n"; +//       ConjugateGradient<SpMat, Lower, IdentityPreconditioner> solver; +//       call_itersolver(solver,EIGEN_CG_PRECOND, A, b, refX,statFile);+//     }+  } // End SPD matrices +}++/* Browse all the matrices available in the specified folder + * and solve the associated linear system.+ * The results of each solve are printed in the standard output+ * and optionally in the provided html file+ */+template <typename Scalar>+void Browse_Matrices(const string folder, bool statFileExists, std::string& statFile, int maxiters, double tol)+{+  MaximumIters = maxiters; // Maximum number of iterations, global variable +  RelErr = tol;  //Relative residual error  as stopping criterion for iterative solvers+  MatrixMarketIterator<Scalar> it(folder);+  for ( ; it; ++it)+  {+    //print the infos for this linear system +    if(statFileExists)+    {+      std::ofstream statbuf(statFile.c_str(), std::ios::app);+      statbuf << "<LINEARSYSTEM> \n";+      statbuf << "   <MATRIX> \n";+      statbuf << "     <NAME> " << it.matname() << " </NAME>\n"; +      statbuf << "     <SIZE> " << it.matrix().rows() << " </SIZE>\n"; +      statbuf << "     <ENTRIES> " << it.matrix().nonZeros() << "</ENTRIES>\n";+      if (it.sym()!=NonSymmetric)+      {+        statbuf << "     <SYMMETRY> Symmetric </SYMMETRY>\n" ; +        if (it.sym() == SPD) +          statbuf << "     <POSDEF> YES </POSDEF>\n"; +        else +          statbuf << "     <POSDEF> NO </POSDEF>\n"; +          +      }+      else+      {+        statbuf << "     <SYMMETRY> NonSymmetric </SYMMETRY>\n" ; +        statbuf << "     <POSDEF> NO </POSDEF>\n"; +      }+      statbuf << "   </MATRIX> \n";+      statbuf.close();+    }+    +    cout<< "\n\n===================================================== \n";+    cout<< " ======  SOLVING WITH MATRIX " << it.matname() << " ====\n";+    cout<< " =================================================== \n\n";+    Matrix<Scalar, Dynamic, 1> refX;+    if(it.hasrefX()) refX = it.refX();+    // Call all suitable solvers for this linear system +    SelectSolvers<Scalar>(it.matrix(), it.sym(), it.rhs(), refX, statFile);+    +    if(statFileExists)+    {+      std::ofstream statbuf(statFile.c_str(), std::ios::app);+      statbuf << "  <BEST_SOLVER ID='"<< best_time_id+              << "'></BEST_SOLVER>\n"; +      statbuf << " </LINEARSYSTEM> \n"; +      statbuf.close();+    }+  } +} ++bool get_options(int argc, char **args, string option, string* value=0)+{+  int idx = 1, found=false; +  while (idx<argc && !found){+    if (option.compare(args[idx]) == 0){+      found = true; +      if(value) *value = args[idx+1];+    }+    idx+=2;+  }+  return found; +}
+ eigen3/bench/spbench/spbenchstyle.h view
@@ -0,0 +1,95 @@+// This file is part of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2012 Désiré Nuentsa-Wakam <desire.nuentsa_wakam@inria.fr>+//+// 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 SPBENCHSTYLE_H+#define SPBENCHSTYLE_H++void printBenchStyle(std::ofstream& out)+{+  out << "<xsl:stylesheet id='stylesheet' version='1.0' \+      xmlns:xsl='http://www.w3.org/1999/XSL/Transform' >\n \+      <xsl:template match='xsl:stylesheet' />\n \+      <xsl:template match='/'> <!-- Root of the document -->\n \+      <html>\n \+        <head> \n \+          <style type='text/css'> \n \+            td { white-space: nowrap;}\n \+          </style>\n \+        </head>\n \+        <body>";+  out<<"<table border='1' width='100%' height='100%'>\n \+        <TR> <!-- Write the table header -->\n \+        <TH>Matrix</TH> <TH>N</TH> <TH> NNZ</TH>  <TH> Sym</TH>  <TH> SPD</TH> <TH> </TH>\n \+          <xsl:for-each select='BENCH/AVAILSOLVER/SOLVER'>\n \+            <xsl:sort select='@ID' data-type='number'/>\n \+            <TH>\n \+              <xsl:value-of select='TYPE' />\n \+              <xsl:text></xsl:text>\n \+              <xsl:value-of select='PACKAGE' />\n \+              <xsl:text></xsl:text>\n \+            </TH>\n \+          </xsl:for-each>\n \+        </TR>";+        +  out<<"  <xsl:for-each select='BENCH/LINEARSYSTEM'>\n \+          <TR> <!-- print statistics for one linear system-->\n \+            <TH rowspan='4'> <xsl:value-of select='MATRIX/NAME' /> </TH>\n \+            <TD rowspan='4'> <xsl:value-of select='MATRIX/SIZE' /> </TD>\n \+            <TD rowspan='4'> <xsl:value-of select='MATRIX/ENTRIES' /> </TD>\n \+            <TD rowspan='4'> <xsl:value-of select='MATRIX/SYMMETRY' /> </TD>\n \+            <TD rowspan='4'> <xsl:value-of select='MATRIX/POSDEF' /> </TD>\n \+            <TH> Compute Time </TH>\n \+            <xsl:for-each select='SOLVER_STAT'>\n \+              <xsl:sort select='@ID' data-type='number'/>\n \+              <TD> <xsl:value-of select='TIME/COMPUTE' /> </TD>\n \+            </xsl:for-each>\n \+          </TR>";+  out<<"  <TR>\n \+            <TH> Solve Time </TH>\n \+            <xsl:for-each select='SOLVER_STAT'>\n \+              <xsl:sort select='@ID' data-type='number'/>\n \+              <TD> <xsl:value-of select='TIME/SOLVE' /> </TD>\n \+            </xsl:for-each>\n \+          </TR>\n \+          <TR>\n \+            <TH> Total Time </TH>\n \+            <xsl:for-each select='SOLVER_STAT'>\n \+              <xsl:sort select='@ID' data-type='number'/>\n \+              <xsl:choose>\n \+                <xsl:when test='@ID=../BEST_SOLVER/@ID'>\n \+                  <TD style='background-color:red'> <xsl:value-of select='TIME/TOTAL' />  </TD>\n \+                </xsl:when>\n \+                <xsl:otherwise>\n \+                  <TD>  <xsl:value-of select='TIME/TOTAL' /></TD>\n \+                </xsl:otherwise>\n \+              </xsl:choose>\n \+            </xsl:for-each>\n \+          </TR>";+  out<<"  <TR>\n \+              <TH> Error </TH>\n \+              <xsl:for-each select='SOLVER_STAT'>\n \+                <xsl:sort select='@ID' data-type='number'/>\n \+                <TD> <xsl:value-of select='ERROR' />\n \+                <xsl:if test='ITER'>\n \+                  <xsl:text>(</xsl:text>\n \+                  <xsl:value-of select='ITER' />\n \+                  <xsl:text>)</xsl:text>\n \+                </xsl:if> </TD>\n \+              </xsl:for-each>\n \+            </TR>\n \+          </xsl:for-each>\n \+      </table>\n \+    </body>\n \+    </html>\n \+  </xsl:template>\n \+  </xsl:stylesheet>\n\n";+  +}++#endif
+ eigen3/bench/spbench/test_sparseLU.cpp view
@@ -0,0 +1,93 @@+// Small bench routine for Eigen available in Eigen+// (C) Desire NUENTSA WAKAM, INRIA++#include <iostream>+#include <fstream>+#include <iomanip>+#include <unsupported/Eigen/SparseExtra>+#include <Eigen/SparseLU>+#include <bench/BenchTimer.h>+#ifdef EIGEN_METIS_SUPPORT+#include <Eigen/MetisSupport>+#endif++using namespace std;+using namespace Eigen;++int main(int argc, char **args)+{+//   typedef complex<double> scalar; +  typedef double scalar; +  SparseMatrix<scalar, ColMajor> A; +  typedef SparseMatrix<scalar, ColMajor>::Index Index;+  typedef Matrix<scalar, Dynamic, Dynamic> DenseMatrix;+  typedef Matrix<scalar, Dynamic, 1> DenseRhs;+  Matrix<scalar, Dynamic, 1> b, x, tmp;+//   SparseLU<SparseMatrix<scalar, ColMajor>, AMDOrdering<int> >   solver;+// #ifdef EIGEN_METIS_SUPPORT+//   SparseLU<SparseMatrix<scalar, ColMajor>, MetisOrdering<int> > solver; +//   std::cout<< "ORDERING : METIS\n"; +// #else+  SparseLU<SparseMatrix<scalar, ColMajor>, COLAMDOrdering<int> >  solver;+  std::cout<< "ORDERING : COLAMD\n"; +// #endif+  +  ifstream matrix_file; +  string line;+  int  n;+  BenchTimer timer; +  +  // Set parameters+  /* Fill the matrix with sparse matrix stored in Matrix-Market coordinate column-oriented format */+  if (argc < 2) assert(false && "please, give the matrix market file ");+  loadMarket(A, args[1]);+  cout << "End charging matrix " << endl;+  bool iscomplex=false, isvector=false;+  int sym;+  getMarketHeader(args[1], sym, iscomplex, isvector);+//   if (iscomplex) { cout<< " Not for complex matrices \n"; return -1; }+  if (isvector) { cout << "The provided file is not a matrix file\n"; return -1;}+  if (sym != 0) { // symmetric matrices, only the lower part is stored+    SparseMatrix<scalar, ColMajor> temp; +    temp = A;+    A = temp.selfadjointView<Lower>();+  }+  n = A.cols();+  /* Fill the right hand side */++  if (argc > 2)+    loadMarketVector(b, args[2]);+  else +  {+    b.resize(n);+    tmp.resize(n);+//       tmp.setRandom();+    for (int i = 0; i < n; i++) tmp(i) = i; +    b = A * tmp ;+  }++  /* Compute the factorization */+//   solver.isSymmetric(true);+  timer.start(); +//   solver.compute(A);+  solver.analyzePattern(A); +  timer.stop(); +  cout << "Time to analyze " << timer.value() << std::endl;+  timer.reset(); +  timer.start(); +  solver.factorize(A); +  timer.stop(); +  cout << "Factorize Time " << timer.value() << std::endl;+  timer.reset(); +  timer.start(); +  x = solver.solve(b);+  timer.stop();+  cout << "solve time " << timer.value() << std::endl; +  /* Check the accuracy */+  Matrix<scalar, Dynamic, 1> tmp2 = b - A*x;+  scalar tempNorm = tmp2.norm()/b.norm();+  cout << "Relative norm of the computed solution : " << tempNorm <<"\n";+  cout << "Number of nonzeros in the factor : " << solver.nnzL() + solver.nnzU() << std::endl; +  +  return 0;+}
+ eigen3/bench/spmv.cpp view
@@ -0,0 +1,233 @@++//g++-4.4 -DNOMTL  -Wl,-rpath /usr/local/lib/oski -L /usr/local/lib/oski/ -l oski -l oski_util -l oski_util_Tid  -DOSKI -I ~/Coding/LinearAlgebra/mtl4/  spmv.cpp  -I .. -O2 -DNDEBUG -lrt  -lm -l oski_mat_CSC_Tid  -loskilt && ./a.out r200000 c200000 n100 t1 p1++#define SCALAR double++#include <iostream>+#include <algorithm>+#include "BenchTimer.h"+#include "BenchSparseUtil.h"++#define SPMV_BENCH(CODE) BENCH(t,tries,repeats,CODE);++// #ifdef MKL+//+// #include "mkl_types.h"+// #include "mkl_spblas.h"+//+// template<typename Lhs,typename Rhs,typename Res>+// void mkl_multiply(const Lhs& lhs, const Rhs& rhs, Res& res)+// {+//   char n = 'N';+//   float alpha = 1;+//   char matdescra[6];+//   matdescra[0] = 'G';+//   matdescra[1] = 0;+//   matdescra[2] = 0;+//   matdescra[3] = 'C';+//   mkl_scscmm(&n, lhs.rows(), rhs.cols(), lhs.cols(), &alpha, matdescra,+//              lhs._valuePtr(), lhs._innerIndexPtr(), lhs.outerIndexPtr(),+//              pntre, b, &ldb, &beta, c, &ldc);+// //   mkl_somatcopy('C', 'T', lhs.rows(), lhs.cols(), 1,+// //                 lhs._valuePtr(), lhs.rows(), DST, dst_stride);+// }+//+// #endif++int main(int argc, char *argv[])+{+  int size = 10000;+  int rows = size;+  int cols = size;+  int nnzPerCol = 40;+  int tries = 2;+  int repeats = 2;++  bool need_help = false;+  for(int i = 1; i < argc; i++)+  {+    if(argv[i][0] == 'r')+    {+      rows = atoi(argv[i]+1);+    }+    else if(argv[i][0] == 'c')+    {+      cols = atoi(argv[i]+1);+    }+    else if(argv[i][0] == 'n')+    {+      nnzPerCol = atoi(argv[i]+1);+    }+    else if(argv[i][0] == 't')+    {+      tries = atoi(argv[i]+1);+    }+    else if(argv[i][0] == 'p')+    {+      repeats = atoi(argv[i]+1);+    }+    else+    {+      need_help = true;+    }+  }+  if(need_help)+  {+    std::cout << argv[0] << " r<nb rows> c<nb columns> n<non zeros per column> t<nb tries> p<nb repeats>\n";+    return 1;+  }++  std::cout << "SpMV " << rows << " x " << cols << " with " << nnzPerCol << " non zeros per column. (" << repeats << " repeats, and " << tries << " tries)\n\n";++  EigenSparseMatrix sm(rows,cols);+  DenseVector dv(cols), res(rows);+  dv.setRandom();++  BenchTimer t;+  while (nnzPerCol>=4)+  {+    std::cout << "nnz: " << nnzPerCol << "\n";+    sm.setZero();+    fillMatrix2(nnzPerCol, rows, cols, sm);++    // dense matrices+    #ifdef DENSEMATRIX+    {+      DenseMatrix dm(rows,cols), (rows,cols);+      eiToDense(sm, dm);++      SPMV_BENCH(res = dm * sm);+      std::cout << "Dense       " << t.value()/repeats << "\t";++      SPMV_BENCH(res = dm.transpose() * sm);+      std::cout << t.value()/repeats << endl;+    }+    #endif++    // eigen sparse matrices+    {+      SPMV_BENCH(res.noalias() += sm * dv; )+      std::cout << "Eigen       " << t.value()/repeats << "\t";++      SPMV_BENCH(res.noalias() += sm.transpose() * dv; )+      std::cout << t.value()/repeats << endl;+    }++    // CSparse+    #ifdef CSPARSE+    {+      std::cout << "CSparse \n";+      cs *csm;+      eiToCSparse(sm, csm);++//       BENCH();+//       timer.stop();+//       std::cout << "   a * b:\t" << timer.value() << endl;++//       BENCH( { m3 = cs_sorted_multiply2(m1, m2); cs_spfree(m3); } );+//       std::cout << "   a * b:\t" << timer.value() << endl;+    }+    #endif++    #ifdef OSKI+    {+      oski_matrix_t om;+      oski_vecview_t ov, ores;+      oski_Init();+      om = oski_CreateMatCSC(sm._outerIndexPtr(), sm._innerIndexPtr(), sm._valuePtr(), rows, cols,+                             SHARE_INPUTMAT, 1, INDEX_ZERO_BASED);+      ov = oski_CreateVecView(dv.data(), cols, STRIDE_UNIT);+      ores = oski_CreateVecView(res.data(), rows, STRIDE_UNIT);++      SPMV_BENCH( oski_MatMult(om, OP_NORMAL, 1, ov, 0, ores) );+      std::cout << "OSKI        " << t.value()/repeats << "\t";++      SPMV_BENCH( oski_MatMult(om, OP_TRANS, 1, ov, 0, ores) );+      std::cout << t.value()/repeats << "\n";++      // tune+      t.reset();+      t.start();+      oski_SetHintMatMult(om, OP_NORMAL, 1.0, SYMBOLIC_VEC, 0.0, SYMBOLIC_VEC, ALWAYS_TUNE_AGGRESSIVELY);+      oski_TuneMat(om);+      t.stop();+      double tuning = t.value();++      SPMV_BENCH( oski_MatMult(om, OP_NORMAL, 1, ov, 0, ores) );+      std::cout << "OSKI tuned  " << t.value()/repeats << "\t";++      SPMV_BENCH( oski_MatMult(om, OP_TRANS, 1, ov, 0, ores) );+      std::cout << t.value()/repeats << "\t(" << tuning <<  ")\n";+++      oski_DestroyMat(om);+      oski_DestroyVecView(ov);+      oski_DestroyVecView(ores);+      oski_Close();+    }+    #endif++    #ifndef NOUBLAS+    {+      using namespace boost::numeric;+      UblasMatrix um(rows,cols);+      eiToUblas(sm, um);++      boost::numeric::ublas::vector<Scalar> uv(cols), ures(rows);+      Map<Matrix<Scalar,Dynamic,1> >(&uv[0], cols) = dv;+      Map<Matrix<Scalar,Dynamic,1> >(&ures[0], rows) = res;++      SPMV_BENCH(ublas::axpy_prod(um, uv, ures, true));+      std::cout << "ublas       " << t.value()/repeats << "\t";++      SPMV_BENCH(ublas::axpy_prod(boost::numeric::ublas::trans(um), uv, ures, true));+      std::cout << t.value()/repeats << endl;+    }+    #endif++    // GMM+++    #ifndef NOGMM+    {+      GmmSparse gm(rows,cols);+      eiToGmm(sm, gm);++      std::vector<Scalar> gv(cols), gres(rows);+      Map<Matrix<Scalar,Dynamic,1> >(&gv[0], cols) = dv;+      Map<Matrix<Scalar,Dynamic,1> >(&gres[0], rows) = res;++      SPMV_BENCH(gmm::mult(gm, gv, gres));+      std::cout << "GMM++       " << t.value()/repeats << "\t";++      SPMV_BENCH(gmm::mult(gmm::transposed(gm), gv, gres));+      std::cout << t.value()/repeats << endl;+    }+    #endif++    // MTL4+    #ifndef NOMTL+    {+      MtlSparse mm(rows,cols);+      eiToMtl(sm, mm);+      mtl::dense_vector<Scalar> mv(cols, 1.0);+      mtl::dense_vector<Scalar> mres(rows, 1.0);++      SPMV_BENCH(mres = mm * mv);+      std::cout << "MTL4        " << t.value()/repeats << "\t";++      SPMV_BENCH(mres = trans(mm) * mv);+      std::cout << t.value()/repeats << endl;+    }+    #endif++    std::cout << "\n";++    if(nnzPerCol==1)+      break;+    nnzPerCol -= nnzPerCol/2;+  }++  return 0;+}+++
+ eigen3/bench/tensors/README view
@@ -0,0 +1,21 @@+The tensor benchmark suite is made of several parts.++The first part is a generic suite, in which each benchmark comes in 2 flavors: one that runs on CPU, and one that runs on GPU.++To compile the floating point CPU benchmarks, simply call:+g++ tensor_benchmarks_cpu.cc benchmark_main.cc -I ../../ -std=c++11 -O3 -DNDEBUG -pthread -mavx -o benchmarks_cpu++To compile the floating point GPU benchmarks, simply call:+nvcc tensor_benchmarks_gpu.cu benchmark_main.cc -I ../../ -std=c++11 -O2 -DNDEBUG -use_fast_math -ftz=true -arch compute_35 -o benchmarks_gpu++We also provide a version of the generic GPU tensor benchmarks that uses half floats (aka fp16) instead of regular floats. To compile these benchmarks, simply call the command line below. You'll need a recent GPU that supports compute capability 5.3 or higher to run them and nvcc 7.5 or higher to compile the code.+nvcc tensor_benchmarks_fp16_gpu.cu benchmark_main.cc -I ../../ -std=c++11 -O2 -DNDEBUG -use_fast_math -ftz=true -arch compute_53 -o benchmarks_fp16_gpu++last but not least, we also provide a suite of benchmarks to measure the scalability of the contraction code on CPU. To compile these benchmarks, call+g++ contraction_benchmarks_cpu.cc benchmark_main.cc -I ../../ -std=c++11 -O3 -DNDEBUG -pthread -mavx -o benchmarks_cpu++To compile the benchmark for SYCL, using ComputeCpp you currently need 2 passes (only for translation units containing device code):+1. The device compilation pass that generates the device code (SYCL kernels and referenced device functions) and glue code needed by the host compiler to reference the device code from host code.+{ComputeCpp_ROOT}/bin/compute++ -I ../../ -I {ComputeCpp_ROOT}/include/ -std=c++11 -mllvm -inline-threshold=1000 -Wno-ignored-attributes -sycl -intelspirmetadata -emit-llvm -no-serial-memop -sycl-compress-name -DBUILD_PLATFORM_SPIR -DNDBUG -O3 -c tensor_benchmarks_sycl.cc+2. The host compilation pass that generates the final host binary.+clang++-3.7 -include tensor_benchmarks_sycl.sycl benchmark_main.cc tensor_benchmarks_sycl.cc -pthread -I ../../ -I {ComputeCpp_ROOT}/include/ -L {ComputeCpp_ROOT}/lib/ -lComputeCpp -lOpenCL -D_GLIBCXX_USE_CXX11_ABI=0 -std=c++11 -o tensor_benchmark_sycl
+ eigen3/bench/tensors/benchmark.h view
@@ -0,0 +1,49 @@+/*+ * Copyright (C) 2012 The Android Open Source Project+ *+ * 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.+ */+#include <stddef.h>+#include <stdint.h>+#include <vector>++namespace testing {+class Benchmark {+ public:+  Benchmark(const char* name, void (*fn)(int)) {+    Register(name, fn, NULL);+  }+  Benchmark(const char* name, void (*fn_range)(int, int)) {+    Register(name, NULL, fn_range);+  }+  Benchmark* Arg(int x);+  Benchmark* Range(int lo, int hi);+  const char* Name();+  bool ShouldRun(int argc, char* argv[]);+  void Run();+ private:+  const char* name_;+  void (*fn_)(int);+  void (*fn_range_)(int, int);+  std::vector<int> args_;+  void Register(const char* name, void (*fn)(int), void (*fn_range)(int, int));+  void RunRepeatedlyWithArg(int iterations, int arg);+  void RunWithArg(int arg);+};+}  // namespace testing+void SetBenchmarkFlopsProcessed(int64_t);+void StopBenchmarkTiming();+void StartBenchmarkTiming();+#define BENCHMARK(f) \+    static ::testing::Benchmark* _benchmark_##f __attribute__((unused)) = \+        (new ::testing::Benchmark(#f, f))
+ eigen3/bench/tensors/benchmark_main.cc view
@@ -0,0 +1,237 @@+/*+ * Copyright (C) 2012 The Android Open Source Project+ *+ * 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.+ */+#include "benchmark.h"+#include <regex.h>+#include <stdio.h>+#include <stdlib.h>+#include <string.h>+#include <string>+#include <inttypes.h>+#include <time.h>+#include <map>++static int64_t g_flops_processed;+static int64_t g_benchmark_total_time_ns;+static int64_t g_benchmark_start_time_ns;+typedef std::map<std::string, ::testing::Benchmark*> BenchmarkMap;+typedef BenchmarkMap::iterator BenchmarkMapIt;++BenchmarkMap& gBenchmarks() {+  static BenchmarkMap g_benchmarks;+  return g_benchmarks;+}++static int g_name_column_width = 20;++static int Round(int n) {+  int base = 1;+  while (base*10 < n) {+    base *= 10;+  }+  if (n < 2*base) {+    return 2*base;+  }+  if (n < 5*base) {+    return 5*base;+  }+  return 10*base;+}++#ifdef __APPLE__+  #include <mach/mach_time.h>+  static mach_timebase_info_data_t g_time_info;+  static void __attribute__((constructor)) init_info() {+    mach_timebase_info(&g_time_info);+  }+#endif++static int64_t NanoTime() {+#if defined(__APPLE__)+  uint64_t t = mach_absolute_time();+  return t * g_time_info.numer / g_time_info.denom;+#else+  struct timespec t;+  t.tv_sec = t.tv_nsec = 0;+  clock_gettime(CLOCK_MONOTONIC, &t);+  return static_cast<int64_t>(t.tv_sec) * 1000000000LL + t.tv_nsec;+#endif+}++namespace testing {+Benchmark* Benchmark::Arg(int arg) {+  args_.push_back(arg);+  return this;+}++Benchmark* Benchmark::Range(int lo, int hi) {+  const int kRangeMultiplier = 8;+  if (hi < lo) {+    int temp = hi;+    hi = lo;+    lo = temp;+  }+  while (lo < hi) {+    args_.push_back(lo);+    lo *= kRangeMultiplier;+  }+  // We always run the hi number.+  args_.push_back(hi);+  return this;+}++const char* Benchmark::Name() {+  return name_;+}+bool Benchmark::ShouldRun(int argc, char* argv[]) {+  if (argc == 1) {+    return true;  // With no arguments, we run all benchmarks.+  }+  // Otherwise, we interpret each argument as a regular expression and+  // see if any of our benchmarks match.+  for (int i = 1; i < argc; i++) {+    regex_t re;+    if (regcomp(&re, argv[i], 0) != 0) {+      fprintf(stderr, "couldn't compile \"%s\" as a regular expression!\n", argv[i]);+      exit(EXIT_FAILURE);+    }+    int match = regexec(&re, name_, 0, NULL, 0);+    regfree(&re);+    if (match != REG_NOMATCH) {+      return true;+    }+  }+  return false;+}+void Benchmark::Register(const char* name, void (*fn)(int), void (*fn_range)(int, int)) {+  name_ = name;+  fn_ = fn;+  fn_range_ = fn_range;+  if (fn_ == NULL && fn_range_ == NULL) {+    fprintf(stderr, "%s: missing function\n", name_);+    exit(EXIT_FAILURE);+  }+  gBenchmarks().insert(std::make_pair(name, this));+}+void Benchmark::Run() {+  if (fn_ != NULL) {+    RunWithArg(0);+  } else {+    if (args_.empty()) {+      fprintf(stderr, "%s: no args!\n", name_);+      exit(EXIT_FAILURE);+    }+    for (size_t i = 0; i < args_.size(); ++i) {+      RunWithArg(args_[i]);+    }+  }+}+void Benchmark::RunRepeatedlyWithArg(int iterations, int arg) {+  g_flops_processed = 0;+  g_benchmark_total_time_ns = 0;+  g_benchmark_start_time_ns = NanoTime();+  if (fn_ != NULL) {+    fn_(iterations);+  } else {+    fn_range_(iterations, arg);+  }+  if (g_benchmark_start_time_ns != 0) {+    g_benchmark_total_time_ns += NanoTime() - g_benchmark_start_time_ns;+  }+}+void Benchmark::RunWithArg(int arg) {+  // run once in case it's expensive+  int iterations = 1;+  RunRepeatedlyWithArg(iterations, arg);+  while (g_benchmark_total_time_ns < 1e9 && iterations < 1e9) {+    int last = iterations;+    if (g_benchmark_total_time_ns/iterations == 0) {+      iterations = 1e9;+    } else {+      iterations = 1e9 / (g_benchmark_total_time_ns/iterations);+    }+    iterations = std::max(last + 1, std::min(iterations + iterations/2, 100*last));+    iterations = Round(iterations);+    RunRepeatedlyWithArg(iterations, arg);+  }+  char throughput[100];+  throughput[0] = '\0';+  if (g_benchmark_total_time_ns > 0 && g_flops_processed > 0) {+    double mflops_processed = static_cast<double>(g_flops_processed)/1e6;+    double seconds = static_cast<double>(g_benchmark_total_time_ns)/1e9;+    snprintf(throughput, sizeof(throughput), " %8.2f MFlops/s", mflops_processed/seconds);+  }+  char full_name[100];+  if (fn_range_ != NULL) {+    if (arg >= (1<<20)) {+      snprintf(full_name, sizeof(full_name), "%s/%dM", name_, arg/(1<<20));+    } else if (arg >= (1<<10)) {+      snprintf(full_name, sizeof(full_name), "%s/%dK", name_, arg/(1<<10));+    } else {+      snprintf(full_name, sizeof(full_name), "%s/%d", name_, arg);+    }+  } else {+    snprintf(full_name, sizeof(full_name), "%s", name_);+  }+  printf("%-*s %10d %10" PRId64 "%s\n", g_name_column_width, full_name,+         iterations, g_benchmark_total_time_ns/iterations, throughput);+  fflush(stdout);+}+}  // namespace testing+void SetBenchmarkFlopsProcessed(int64_t x) {+  g_flops_processed = x;+}+void StopBenchmarkTiming() {+  if (g_benchmark_start_time_ns != 0) {+    g_benchmark_total_time_ns += NanoTime() - g_benchmark_start_time_ns;+  }+  g_benchmark_start_time_ns = 0;+}+void StartBenchmarkTiming() {+  if (g_benchmark_start_time_ns == 0) {+    g_benchmark_start_time_ns = NanoTime();+  }+}+int main(int argc, char* argv[]) {+  if (gBenchmarks().empty()) {+    fprintf(stderr, "No benchmarks registered!\n");+    exit(EXIT_FAILURE);+  }+  for (BenchmarkMapIt it = gBenchmarks().begin(); it != gBenchmarks().end(); ++it) {+    int name_width = static_cast<int>(strlen(it->second->Name()));+    g_name_column_width = std::max(g_name_column_width, name_width);+  }+  bool need_header = true;+  for (BenchmarkMapIt it = gBenchmarks().begin(); it != gBenchmarks().end(); ++it) {+    ::testing::Benchmark* b = it->second;+    if (b->ShouldRun(argc, argv)) {+      if (need_header) {+        printf("%-*s %10s %10s\n", g_name_column_width, "", "iterations", "ns/op");+        fflush(stdout);+        need_header = false;+      }+      b->Run();+    }+  }+  if (need_header) {+    fprintf(stderr, "No matching benchmarks!\n");+    fprintf(stderr, "Available benchmarks:\n");+    for (BenchmarkMapIt it = gBenchmarks().begin(); it != gBenchmarks().end(); ++it) {+      fprintf(stderr, "  %s\n", it->second->Name());+    }+    exit(EXIT_FAILURE);+  }+  return 0;+}
+ eigen3/bench/tensors/contraction_benchmarks_cpu.cc view
@@ -0,0 +1,39 @@+#define EIGEN_USE_THREADS++#include <string>++#include "tensor_benchmarks.h"++#define CREATE_THREAD_POOL(threads)             \+Eigen::ThreadPool pool(threads);                \+Eigen::ThreadPoolDevice device(&pool, threads);+++// Contractions for number of threads ranging from 1 to 32+// Dimensions are Rows, Cols, Depth+#define BM_ContractionCPU(D1, D2, D3)                                         \+  static void BM_##Contraction##_##D1##x##D2##x##D3(int iters, int Threads) { \+    StopBenchmarkTiming();                                                    \+    CREATE_THREAD_POOL(Threads);                                              \+    BenchmarkSuite<Eigen::ThreadPoolDevice, float> suite(device, D1, D2, D3); \+    suite.contraction(iters);                                                 \+  }                                                                           \+  BENCHMARK_RANGE(BM_##Contraction##_##D1##x##D2##x##D3, 1, 32);+++// Vector Matrix and Matrix Vector products+BM_ContractionCPU(1, 2000, 500);+BM_ContractionCPU(2000, 1, 500);++// Various skinny matrices+BM_ContractionCPU(250, 3, 512);+BM_ContractionCPU(1500, 3, 512);++BM_ContractionCPU(512, 800, 4);+BM_ContractionCPU(512, 80, 800);+BM_ContractionCPU(512, 80, 13522);+BM_ContractionCPU(1, 80, 13522);++BM_ContractionCPU(3200, 512, 4);+BM_ContractionCPU(3200, 512, 80);+BM_ContractionCPU(3200, 80, 512);
+ eigen3/bench/tensors/tensor_benchmarks.h view
@@ -0,0 +1,478 @@+#ifndef THIRD_PARTY_EIGEN3_TENSOR_BENCHMARKS_H_+#define THIRD_PARTY_EIGEN3_TENSOR_BENCHMARKS_H_++typedef int TensorIndex;+#define EIGEN_DEFAULT_DENSE_INDEX_TYPE int++#include "unsupported/Eigen/CXX11/Tensor"+#include "benchmark.h"++#define BENCHMARK_RANGE(bench, lo, hi) \+  BENCHMARK(bench)->Range(lo, hi)++using Eigen::Tensor;+using Eigen::TensorMap;++// TODO(bsteiner): also templatize on the input type since we have users+// for int8 as well as floats.+template <typename Device, typename T> class BenchmarkSuite {+ public:+  BenchmarkSuite(const Device& device, size_t m, size_t k, size_t n)+      : m_(m), k_(k), n_(n), device_(device) {+    initialize();+  }++  BenchmarkSuite(const Device& device, size_t m)+      : m_(m), k_(m), n_(m), device_(device) {+    initialize();+  }++  ~BenchmarkSuite() {+    device_.deallocate(a_);+    device_.deallocate(b_);+    device_.deallocate(c_);+  }++  void memcpy(int num_iters) {+    eigen_assert(m_ == k_ && k_ == n_);+    StartBenchmarkTiming();+    for (int iter = 0; iter < num_iters; ++iter) {+      device_.memcpy(c_, a_, m_ * m_ * sizeof(T));+    }+    // Record the number of values copied per second+    finalizeBenchmark(static_cast<int64_t>(m_) * m_ * num_iters);+  }++  void typeCasting(int num_iters) {+    eigen_assert(m_ == n_);+    Eigen::array<TensorIndex, 2> sizes;+    if (sizeof(T) >= sizeof(int)) {+      sizes[0] = m_;+      sizes[1] = k_;+    } else {+      sizes[0] = m_ * sizeof(T) / sizeof(int);+      sizes[1] = k_ * sizeof(T) / sizeof(int);+    }+    const TensorMap<Tensor<int, 2, 0, TensorIndex>, Eigen::Aligned> A((int*)a_, sizes);+    TensorMap<Tensor<T, 2, 0, TensorIndex>, Eigen::Aligned> B(b_, sizes);++    StartBenchmarkTiming();+    for (int iter = 0; iter < num_iters; ++iter) {+      B.device(device_) = A.template cast<T>();+    }+    // Record the number of values copied per second+    finalizeBenchmark(static_cast<int64_t>(m_) * k_ * num_iters);+  }++  void random(int num_iters) {+    eigen_assert(m_ == k_ && k_ == n_);+    Eigen::array<TensorIndex, 2> sizes;+    sizes[0] = m_;+    sizes[1] = m_;+    TensorMap<Tensor<T, 2>, Eigen::Aligned> C(c_, sizes);++    StartBenchmarkTiming();+    for (int iter = 0; iter < num_iters; ++iter) {+      C.device(device_) = C.random();+    }+    // Record the number of random numbers generated per second+    finalizeBenchmark(static_cast<int64_t>(m_) * m_ * num_iters);+  }++  void slicing(int num_iters) {+    eigen_assert(m_ == k_ && k_ == n_);+    Eigen::array<TensorIndex, 2> sizes;+    sizes[0] = m_;+    sizes[1] = m_;+    const TensorMap<Tensor<T, 2>, Eigen::Aligned> A(a_, sizes);+    const TensorMap<Tensor<T, 2>, Eigen::Aligned> B(b_, sizes);+    TensorMap<Tensor<T, 2>, Eigen::Aligned> C(c_, sizes);++    const Eigen::DSizes<TensorIndex, 2> quarter_sizes(m_/2, m_/2);+    const Eigen::DSizes<TensorIndex, 2> first_quadrant(0, 0);+    const Eigen::DSizes<TensorIndex, 2> second_quadrant(0, m_/2);+    const Eigen::DSizes<TensorIndex, 2> third_quadrant(m_/2, 0);+    const Eigen::DSizes<TensorIndex, 2> fourth_quadrant(m_/2, m_/2);++    StartBenchmarkTiming();+    for (int iter = 0; iter < num_iters; ++iter) {+      C.slice(first_quadrant, quarter_sizes).device(device_) =+          A.slice(first_quadrant, quarter_sizes);+      C.slice(second_quadrant, quarter_sizes).device(device_) =+          B.slice(second_quadrant, quarter_sizes);+      C.slice(third_quadrant, quarter_sizes).device(device_) =+          A.slice(third_quadrant, quarter_sizes);+      C.slice(fourth_quadrant, quarter_sizes).device(device_) =+          B.slice(fourth_quadrant, quarter_sizes);+    }+    // Record the number of values copied from the rhs slice to the lhs slice+    // each second+    finalizeBenchmark(static_cast<int64_t>(m_) * m_ * num_iters);+  }++  void rowChip(int num_iters) {+    Eigen::array<TensorIndex, 2> input_size;+    input_size[0] = k_;+    input_size[1] = n_;+    const TensorMap<Tensor<T, 2, 0, TensorIndex>, Eigen::Aligned> B(b_, input_size);+    Eigen::array<TensorIndex, 1> output_size;+    output_size[0] = n_;+    TensorMap<Tensor<T, 1, 0, TensorIndex>, Eigen::Aligned> C(c_, output_size);++    StartBenchmarkTiming();+    for (int iter = 0; iter < num_iters; ++iter) {+      C.device(device_) = B.chip(iter % k_, 0);+    }+    // Record the number of values copied from the rhs chip to the lhs.+    finalizeBenchmark(static_cast<int64_t>(n_) * num_iters);+  }++  void colChip(int num_iters) {+    Eigen::array<TensorIndex, 2> input_size;+    input_size[0] = k_;+    input_size[1] = n_;+    const TensorMap<Tensor<T, 2, 0, TensorIndex>, Eigen::Aligned> B(b_, input_size);+    Eigen::array<TensorIndex, 1> output_size;+    output_size[0] = n_;+    TensorMap<Tensor<T, 1, 0, TensorIndex>, Eigen::Aligned> C(c_, output_size);++    StartBenchmarkTiming();+    for (int iter = 0; iter < num_iters; ++iter) {+      C.device(device_) = B.chip(iter % n_, 1);+    }+    // Record the number of values copied from the rhs chip to the lhs.+    finalizeBenchmark(static_cast<int64_t>(n_) * num_iters);+  }++  void shuffling(int num_iters) {+    eigen_assert(m_ == n_);+    Eigen::array<TensorIndex, 2> size_a;+    size_a[0] = m_;+    size_a[1] = k_;+    const TensorMap<Tensor<T, 2>, Eigen::Aligned> A(a_, size_a);+    Eigen::array<TensorIndex, 2> size_b;+    size_b[0] = k_;+    size_b[1] = m_;+    TensorMap<Tensor<T, 2>, Eigen::Aligned> B(b_, size_b);++    Eigen::array<int, 2> shuffle;+    shuffle[0] = 1;+    shuffle[1] = 0;++    StartBenchmarkTiming();+    for (int iter = 0; iter < num_iters; ++iter) {+      B.device(device_) = A.shuffle(shuffle);+    }+    // Record the number of values shuffled from A and copied to B each second+    finalizeBenchmark(static_cast<int64_t>(m_) * k_ * num_iters);+  }++ void padding(int num_iters) {+    eigen_assert(m_ == k_);+    Eigen::array<TensorIndex, 2> size_a;+    size_a[0] = m_;+    size_a[1] = k_-3;+    const TensorMap<Tensor<T, 2>, Eigen::Aligned> A(a_, size_a);+    Eigen::array<TensorIndex, 2> size_b;+    size_b[0] = k_;+    size_b[1] = m_;+    TensorMap<Tensor<T, 2>, Eigen::Aligned> B(b_, size_b);++#if defined(EIGEN_HAS_INDEX_LIST)+    Eigen::IndexPairList<Eigen::type2indexpair<0, 0>,+                         Eigen::type2indexpair<2, 1> > paddings;+#else+    Eigen::array<Eigen::IndexPair<TensorIndex>, 2> paddings;+    paddings[0] = Eigen::IndexPair<TensorIndex>(0, 0);+    paddings[1] = Eigen::IndexPair<TensorIndex>(2, 1);+#endif++    StartBenchmarkTiming();+    for (int iter = 0; iter < num_iters; ++iter) {+      B.device(device_) = A.pad(paddings);+    }+    // Record the number of values copied from the padded tensor A each second+    finalizeBenchmark(static_cast<int64_t>(m_) * k_ * num_iters);+  }++ void striding(int num_iters) {+    eigen_assert(m_ == k_);+    Eigen::array<TensorIndex, 2> size_a;+    size_a[0] = m_;+    size_a[1] = k_;+    const TensorMap<Tensor<T, 2>, Eigen::Aligned> A(a_, size_a);+    Eigen::array<TensorIndex, 2> size_b;+    size_b[0] = m_;+    size_b[1] = k_/2;+    TensorMap<Tensor<T, 2>, Eigen::Aligned> B(b_, size_b);++#ifndef EIGEN_HAS_INDEX_LIST+    Eigen::array<TensorIndex, 2> strides;+    strides[0] = 1;+    strides[1] = 2;+#else+    // Take advantage of cxx11 to give the compiler information it can use to+    // optimize the code.+    Eigen::IndexList<Eigen::type2index<1>, Eigen::type2index<2> > strides;+#endif++    StartBenchmarkTiming();+    for (int iter = 0; iter < num_iters; ++iter) {+      B.device(device_) = A.stride(strides);+    }+    // Record the number of values copied from the padded tensor A each second+    finalizeBenchmark(static_cast<int64_t>(m_) * k_ * num_iters);+  }++  void broadcasting(int num_iters) {+    Eigen::array<TensorIndex, 2> size_a;+    size_a[0] = m_;+    size_a[1] = 1;+    const TensorMap<Tensor<T, 2>, Eigen::Aligned> A(a_, size_a);+    Eigen::array<TensorIndex, 2> size_c;+    size_c[0] = m_;+    size_c[1] = n_;+    TensorMap<Tensor<T, 2>, Eigen::Aligned> C(c_, size_c);++#ifndef EIGEN_HAS_INDEX_LIST+    Eigen::array<int, 2> broadcast;+    broadcast[0] = 1;+    broadcast[1] = n_;+#else+    // Take advantage of cxx11 to give the compiler information it can use to+    // optimize the code.+    Eigen::IndexList<Eigen::type2index<1>, int> broadcast;+    broadcast.set(1, n_);+#endif++    StartBenchmarkTiming();+    for (int iter = 0; iter < num_iters; ++iter) {+      C.device(device_) = A.broadcast(broadcast);+    }+    // Record the number of values broadcasted from A and copied to C each second+    finalizeBenchmark(static_cast<int64_t>(m_) * n_ * num_iters);+  }++  void coeffWiseOp(int num_iters) {+    eigen_assert(m_ == k_ && k_ == n_);+    Eigen::array<TensorIndex, 2> sizes;+    sizes[0] = m_;+    sizes[1] = m_;+    const TensorMap<Tensor<T, 2>, Eigen::Aligned> A(a_, sizes);+    const TensorMap<Tensor<T, 2>, Eigen::Aligned> B(b_, sizes);+    TensorMap<Tensor<T, 2>, Eigen::Aligned> C(c_, sizes);++    StartBenchmarkTiming();+    for (int iter = 0; iter < num_iters; ++iter) {+      C.device(device_) = A * A.constant(static_cast<T>(3.14)) + B * B.constant(static_cast<T>(2.7));+    }+    // Record the number of FLOP executed per second (2 multiplications and+    // 1 addition per value)+    finalizeBenchmark(static_cast<int64_t>(3) * m_ * m_ * num_iters);+  }++  void algebraicFunc(int num_iters) {+    eigen_assert(m_ == k_ && k_ == n_);+    Eigen::array<TensorIndex, 2> sizes;+    sizes[0] = m_;+    sizes[1] = m_;+    const TensorMap<Tensor<T, 2>, Eigen::Aligned> A(a_, sizes);+    const TensorMap<Tensor<T, 2>, Eigen::Aligned> B(b_, sizes);+    TensorMap<Tensor<T, 2>, Eigen::Aligned> C(c_, sizes);++    StartBenchmarkTiming();+    for (int iter = 0; iter < num_iters; ++iter) {+      C.device(device_) = A.rsqrt() + B.sqrt() * B.square();+    }+    // Record the number of FLOP executed per second (assuming one operation+    // per value)+    finalizeBenchmark(static_cast<int64_t>(m_) * m_ * num_iters);+  }++  void transcendentalFunc(int num_iters) {+    eigen_assert(m_ == k_ && k_ == n_);+    Eigen::array<TensorIndex, 2> sizes;+    sizes[0] = m_;+    sizes[1] = m_;+    const TensorMap<Tensor<T, 2>, Eigen::Aligned> A(a_, sizes);+    const TensorMap<Tensor<T, 2>, Eigen::Aligned> B(b_, sizes);+    TensorMap<Tensor<T, 2>, Eigen::Aligned> C(c_, sizes);++    StartBenchmarkTiming();+    for (int iter = 0; iter < num_iters; ++iter) {+      C.device(device_) = A.exp() + B.log();+    }+    // Record the number of FLOP executed per second (assuming one operation+    // per value)+    finalizeBenchmark(static_cast<int64_t>(m_) * m_ * num_iters);+  }++ // Row reduction+  void rowReduction(int num_iters) {+    Eigen::array<TensorIndex, 2> input_size;+    input_size[0] = k_;+    input_size[1] = n_;+    const TensorMap<Tensor<T, 2, 0, TensorIndex>, Eigen::Aligned> B(b_, input_size);+    Eigen::array<TensorIndex, 1> output_size;+    output_size[0] = n_;+    TensorMap<Tensor<T, 1, 0, TensorIndex>, Eigen::Aligned> C(c_, output_size);++#ifndef EIGEN_HAS_INDEX_LIST+    Eigen::array<TensorIndex, 1> sum_along_dim;+    sum_along_dim[0] = 0;+#else+    // Take advantage of cxx11 to give the compiler information it can use to+    // optimize the code.+    Eigen::IndexList<Eigen::type2index<0>> sum_along_dim;+#endif++    StartBenchmarkTiming();+    for (int iter = 0; iter < num_iters; ++iter) {+      C.device(device_) = B.sum(sum_along_dim);+    }+    // Record the number of FLOP executed per second (assuming one operation+    // per value)+    finalizeBenchmark(static_cast<int64_t>(k_) * n_ * num_iters);+  }++  // Column reduction+  void colReduction(int num_iters) {+    Eigen::array<TensorIndex, 2> input_size;+    input_size[0] = k_;+    input_size[1] = n_;+    const TensorMap<Tensor<T, 2, 0, TensorIndex>, Eigen::Aligned> B(+        b_, input_size);+    Eigen::array<TensorIndex, 1> output_size;+    output_size[0] = k_;+    TensorMap<Tensor<T, 1, 0, TensorIndex>, Eigen::Aligned> C(+        c_, output_size);++#ifndef EIGEN_HAS_INDEX_LIST+    Eigen::array<TensorIndex, 1> sum_along_dim;+    sum_along_dim[0] = 1;+#else+    // Take advantage of cxx11 to give the compiler information it can use to+    // optimize the code.+    Eigen::IndexList<Eigen::type2index<1>> sum_along_dim;+#endif++    StartBenchmarkTiming();+    for (int iter = 0; iter < num_iters; ++iter) {+      C.device(device_) = B.sum(sum_along_dim);+    }+    // Record the number of FLOP executed per second (assuming one operation+    // per value)+    finalizeBenchmark(static_cast<int64_t>(k_) * n_ * num_iters);+  }++  // Full reduction+  void fullReduction(int num_iters) {+    Eigen::array<TensorIndex, 2> input_size;+    input_size[0] = k_;+    input_size[1] = n_;+    const TensorMap<Tensor<T, 2, 0, TensorIndex>, Eigen::Aligned> B(+        b_, input_size);+    Eigen::array<TensorIndex, 0> output_size;+    TensorMap<Tensor<T, 0, 0, TensorIndex>, Eigen::Aligned> C(+        c_, output_size);++    StartBenchmarkTiming();+    for (int iter = 0; iter < num_iters; ++iter) {+      C.device(device_) = B.sum();+    }+    // Record the number of FLOP executed per second (assuming one operation+    // per value)+    finalizeBenchmark(static_cast<int64_t>(k_) * n_ * num_iters);+  }++  // do a contraction which is equivalent to a matrix multiplication+  void contraction(int num_iters) {+    Eigen::array<TensorIndex, 2> sizeA;+    sizeA[0] = m_;+    sizeA[1] = k_;+    Eigen::array<TensorIndex, 2> sizeB;+    sizeB[0] = k_;+    sizeB[1] = n_;+    Eigen::array<TensorIndex, 2> sizeC;+    sizeC[0] = m_;+    sizeC[1] = n_;++    const TensorMap<Tensor<T, 2>, Eigen::Aligned> A(a_, sizeA);+    const TensorMap<Tensor<T, 2>, Eigen::Aligned> B(b_, sizeB);+    TensorMap<Tensor<T, 2>, Eigen::Aligned> C(c_, sizeC);++    typedef typename Tensor<T, 2>::DimensionPair DimPair;+    Eigen::array<DimPair, 1> dims;+    dims[0] = DimPair(1, 0);++    StartBenchmarkTiming();+    for (int iter = 0; iter < num_iters; ++iter) {+      C.device(device_) = A.contract(B, dims);+    }+    // Record the number of FLOP executed per second (size_ multiplications and+    // additions for each value in the resulting tensor)+    finalizeBenchmark(static_cast<int64_t>(2) * m_ * n_ * k_ * num_iters);+  }++  void convolution(int num_iters, int kernel_x, int kernel_y) {+    Eigen::array<TensorIndex, 2> input_sizes;+    input_sizes[0] = m_;+    input_sizes[1] = n_;+    TensorMap<Tensor<T, 2>, Eigen::Aligned> A(a_, input_sizes);+    Eigen::array<TensorIndex, 2> kernel_sizes;+    kernel_sizes[0] = kernel_x;+    kernel_sizes[1] = kernel_y;+    TensorMap<Tensor<T, 2>, Eigen::Aligned> B(b_, kernel_sizes);+    Eigen::array<TensorIndex, 2> result_sizes;+    result_sizes[0] = m_ - kernel_x + 1;+    result_sizes[1] = n_ - kernel_y + 1;+    TensorMap<Tensor<T, 2>, Eigen::Aligned> C(c_, result_sizes);+    Eigen::array<TensorIndex, 2> dims;+    dims[0] = 0;+    dims[1] = 1;++    StartBenchmarkTiming();+    for (int iter = 0; iter < num_iters; ++iter) {+      C.device(device_) = A.convolve(B, dims);+    }+    // Record the number of FLOP executed per second (kernel_size+    // multiplications and additions for each value in the resulting tensor)+    finalizeBenchmark(static_cast<int64_t>(2) *+        (m_ - kernel_x + 1) * (n_ - kernel_y + 1) * kernel_x * kernel_y * num_iters);+  }++ private:+  void initialize() {+    a_ = (T *) device_.allocate(m_ * k_ * sizeof(T));+    b_ = (T *) device_.allocate(k_ * n_ * sizeof(T));+    c_ = (T *) device_.allocate(m_ * n_ * sizeof(T));++    // Initialize the content of the memory pools to prevent asan from+    // complaining.+    device_.memset(a_, 12, m_ * k_ * sizeof(T));+    device_.memset(b_, 23, k_ * n_ * sizeof(T));+    device_.memset(c_, 31, m_ * n_ * sizeof(T));++    //BenchmarkUseRealTime();+  }++  inline void finalizeBenchmark(int64_t num_items) {+#if defined(EIGEN_USE_GPU) && defined(__CUDACC__)+    if (Eigen::internal::is_same<Device, Eigen::GpuDevice>::value) {+      device_.synchronize();+    }+#endif+    StopBenchmarkTiming();+    SetBenchmarkFlopsProcessed(num_items);+  }+++  TensorIndex m_;+  TensorIndex k_;+  TensorIndex n_;+  T* a_;+  T* b_;+  T* c_;+  Device device_;+};+#endif  // THIRD_PARTY_EIGEN3_TENSOR_BENCHMARKS_H_
+ eigen3/bench/tensors/tensor_benchmarks_cpu.cc view
@@ -0,0 +1,168 @@+#define EIGEN_USE_THREADS++#include <string>++#include "tensor_benchmarks.h"++#define CREATE_THREAD_POOL(threads)             \+Eigen::ThreadPool pool(threads);                \+Eigen::ThreadPoolDevice device(&pool, threads);++// Simple functions+#define BM_FuncCPU(FUNC, THREADS)                                    \+  static void BM_##FUNC##_##THREADS##T(int iters, int N) {           \+    StopBenchmarkTiming();                                           \+    CREATE_THREAD_POOL(THREADS);                                     \+    BenchmarkSuite<Eigen::ThreadPoolDevice, float> suite(device, N); \+    suite.FUNC(iters);                                               \+  }                                                                  \+  BENCHMARK_RANGE(BM_##FUNC##_##THREADS##T, 10, 5000);++BM_FuncCPU(memcpy, 4);+BM_FuncCPU(memcpy, 8);+BM_FuncCPU(memcpy, 12);++BM_FuncCPU(typeCasting, 4);+BM_FuncCPU(typeCasting, 8);+BM_FuncCPU(typeCasting, 12);++BM_FuncCPU(random, 4);+BM_FuncCPU(random, 8);+BM_FuncCPU(random, 12);++BM_FuncCPU(slicing, 4);+BM_FuncCPU(slicing, 8);+BM_FuncCPU(slicing, 12);++BM_FuncCPU(rowChip, 4);+BM_FuncCPU(rowChip, 8);+BM_FuncCPU(rowChip, 12);++BM_FuncCPU(colChip, 4);+BM_FuncCPU(colChip, 8);+BM_FuncCPU(colChip, 12);++BM_FuncCPU(shuffling, 4);+BM_FuncCPU(shuffling, 8);+BM_FuncCPU(shuffling, 12);++BM_FuncCPU(padding, 4);+BM_FuncCPU(padding, 8);+BM_FuncCPU(padding, 12);++BM_FuncCPU(striding, 4);+BM_FuncCPU(striding, 8);+BM_FuncCPU(striding, 12);++BM_FuncCPU(broadcasting, 4);+BM_FuncCPU(broadcasting, 8);+BM_FuncCPU(broadcasting, 12);++BM_FuncCPU(coeffWiseOp, 4);+BM_FuncCPU(coeffWiseOp, 8);+BM_FuncCPU(coeffWiseOp, 12);++BM_FuncCPU(algebraicFunc, 4);+BM_FuncCPU(algebraicFunc, 8);+BM_FuncCPU(algebraicFunc, 12);++BM_FuncCPU(transcendentalFunc, 4);+BM_FuncCPU(transcendentalFunc, 8);+BM_FuncCPU(transcendentalFunc, 12);++BM_FuncCPU(rowReduction, 4);+BM_FuncCPU(rowReduction, 8);+BM_FuncCPU(rowReduction, 12);++BM_FuncCPU(colReduction, 4);+BM_FuncCPU(colReduction, 8);+BM_FuncCPU(colReduction, 12);+++// Contractions+#define BM_FuncWithInputDimsCPU(FUNC, D1, D2, D3, THREADS)                      \+  static void BM_##FUNC##_##D1##x##D2##x##D3##_##THREADS##T(int iters, int N) { \+    StopBenchmarkTiming();                                                      \+    if (THREADS == 1) {                                                         \+      Eigen::DefaultDevice device;                                              \+      BenchmarkSuite<Eigen::DefaultDevice, float> suite(device, D1, D2, D3);    \+      suite.FUNC(iters);                                                        \+    } else {                                                                    \+      CREATE_THREAD_POOL(THREADS);                                              \+      BenchmarkSuite<Eigen::ThreadPoolDevice, float> suite(device, D1, D2, D3); \+      suite.FUNC(iters);                                                        \+    }                                                                           \+  }                                                                             \+  BENCHMARK_RANGE(BM_##FUNC##_##D1##x##D2##x##D3##_##THREADS##T, 10, 5000);+++BM_FuncWithInputDimsCPU(contraction, N, N, N, 1);+BM_FuncWithInputDimsCPU(contraction, N, N, N, 4);+BM_FuncWithInputDimsCPU(contraction, N, N, N, 8);+BM_FuncWithInputDimsCPU(contraction, N, N, N, 12);+BM_FuncWithInputDimsCPU(contraction, N, N, N, 16);++BM_FuncWithInputDimsCPU(contraction, 64, N, N, 1);+BM_FuncWithInputDimsCPU(contraction, 64, N, N, 4);+BM_FuncWithInputDimsCPU(contraction, 64, N, N, 8);+BM_FuncWithInputDimsCPU(contraction, 64, N, N, 12);+BM_FuncWithInputDimsCPU(contraction, 64, N, N, 16);++BM_FuncWithInputDimsCPU(contraction, N, 64, N, 1);+BM_FuncWithInputDimsCPU(contraction, N, 64, N, 4);+BM_FuncWithInputDimsCPU(contraction, N, 64, N, 8);+BM_FuncWithInputDimsCPU(contraction, N, 64, N, 12);+BM_FuncWithInputDimsCPU(contraction, N, 64, N, 16);++BM_FuncWithInputDimsCPU(contraction, N, N, 64, 1);+BM_FuncWithInputDimsCPU(contraction, N, N, 64, 4);+BM_FuncWithInputDimsCPU(contraction, N, N, 64, 8);+BM_FuncWithInputDimsCPU(contraction, N, N, 64, 12);+BM_FuncWithInputDimsCPU(contraction, N, N, 64, 16);++BM_FuncWithInputDimsCPU(contraction, 1, N, N, 1);+BM_FuncWithInputDimsCPU(contraction, 1, N, N, 4);+BM_FuncWithInputDimsCPU(contraction, 1, N, N, 8);+BM_FuncWithInputDimsCPU(contraction, 1, N, N, 12);+BM_FuncWithInputDimsCPU(contraction, 1, N, N, 16);++BM_FuncWithInputDimsCPU(contraction, N, N, 1, 1);+BM_FuncWithInputDimsCPU(contraction, N, N, 1, 4);+BM_FuncWithInputDimsCPU(contraction, N, N, 1, 8);+BM_FuncWithInputDimsCPU(contraction, N, N, 1, 12);+BM_FuncWithInputDimsCPU(contraction, N, N, 1, 16);+++// Convolutions+#define BM_FuncWithKernelDimsCPU(FUNC, DIM1, DIM2, THREADS)                    \+  static void BM_##FUNC##_##DIM1##x##DIM2##_##THREADS##T(int iters, int N) {   \+    StopBenchmarkTiming();                                                     \+    CREATE_THREAD_POOL(THREADS);                                               \+    BenchmarkSuite<Eigen::ThreadPoolDevice, float> suite(device, N);	       \+    suite.FUNC(iters, DIM1, DIM2);                                             \+  }                                                                            \+  BENCHMARK_RANGE(BM_##FUNC##_##DIM1##x##DIM2##_##THREADS##T, 128, 5000);++BM_FuncWithKernelDimsCPU(convolution, 7, 1, 4);+BM_FuncWithKernelDimsCPU(convolution, 7, 1, 8);+BM_FuncWithKernelDimsCPU(convolution, 7, 1, 12);++BM_FuncWithKernelDimsCPU(convolution, 1, 7, 4);+BM_FuncWithKernelDimsCPU(convolution, 1, 7, 8);+BM_FuncWithKernelDimsCPU(convolution, 1, 7, 12);++BM_FuncWithKernelDimsCPU(convolution, 7, 4, 4);+BM_FuncWithKernelDimsCPU(convolution, 7, 4, 8);+BM_FuncWithKernelDimsCPU(convolution, 7, 4, 12);++BM_FuncWithKernelDimsCPU(convolution, 4, 7, 4);+BM_FuncWithKernelDimsCPU(convolution, 4, 7, 8);+BM_FuncWithKernelDimsCPU(convolution, 4, 7, 12);++BM_FuncWithKernelDimsCPU(convolution, 7, 64, 4);+BM_FuncWithKernelDimsCPU(convolution, 7, 64, 8);+BM_FuncWithKernelDimsCPU(convolution, 7, 64, 12);++BM_FuncWithKernelDimsCPU(convolution, 64, 7, 4);+BM_FuncWithKernelDimsCPU(convolution, 64, 7, 8);+BM_FuncWithKernelDimsCPU(convolution, 64, 7, 12);
+ eigen3/bench/tensors/tensor_benchmarks_fp16_gpu.cu view
@@ -0,0 +1,77 @@+#define EIGEN_USE_GPU++#include <cuda.h>+#include <cuda_runtime.h>+#include <iostream>++#include "tensor_benchmarks.h"++// Simple functions+#define BM_FuncGPU(FUNC)                                                       \+  static void BM_##FUNC(int iters, int N) {                                    \+    StopBenchmarkTiming();                                                     \+    Eigen::CudaStreamDevice stream;                                            \+    Eigen::GpuDevice device(&stream);                                          \+    BenchmarkSuite<Eigen::GpuDevice, Eigen::half> suite(device, N);            \+    cudaDeviceSynchronize();                                                   \+    suite.FUNC(iters);                                                         \+  }                                                                            \+  BENCHMARK_RANGE(BM_##FUNC, 10, 5000);++BM_FuncGPU(memcpy);+BM_FuncGPU(typeCasting);+//BM_FuncGPU(random);+BM_FuncGPU(slicing);+BM_FuncGPU(rowChip);+BM_FuncGPU(colChip);+BM_FuncGPU(shuffling);+BM_FuncGPU(padding);+BM_FuncGPU(striding);+BM_FuncGPU(broadcasting);+BM_FuncGPU(coeffWiseOp);+BM_FuncGPU(algebraicFunc);+BM_FuncGPU(transcendentalFunc);+BM_FuncGPU(rowReduction);+BM_FuncGPU(colReduction);+BM_FuncGPU(fullReduction);+++// Contractions+#define BM_FuncWithInputDimsGPU(FUNC, D1, D2, D3)                              \+  static void BM_##FUNC##_##D1##x##D2##x##D3(int iters, int N) {               \+    StopBenchmarkTiming();                                                     \+    Eigen::CudaStreamDevice stream;                                            \+    Eigen::GpuDevice device(&stream);                                          \+    BenchmarkSuite<Eigen::GpuDevice, Eigen::half> suite(device, D1, D2, D3);   \+    cudaDeviceSynchronize();                                                   \+    suite.FUNC(iters);                                                         \+  }                                                                            \+  BENCHMARK_RANGE(BM_##FUNC##_##D1##x##D2##x##D3, 10, 5000);+++BM_FuncWithInputDimsGPU(contraction, N, N, N);+BM_FuncWithInputDimsGPU(contraction, 64, N, N);+BM_FuncWithInputDimsGPU(contraction, N, 64, N);+BM_FuncWithInputDimsGPU(contraction, N, N, 64);+++// Convolutions+#define BM_FuncWithKernelDimsGPU(FUNC, DIM1, DIM2)                             \+  static void BM_##FUNC##_##DIM1##x##DIM2(int iters, int N) {                  \+    StopBenchmarkTiming();                                                     \+    Eigen::CudaStreamDevice stream;                                            \+    Eigen::GpuDevice device(&stream);                                          \+    BenchmarkSuite<Eigen::GpuDevice, Eigen::half> suite(device, N);            \+    cudaDeviceSynchronize();                                                   \+    suite.FUNC(iters, DIM1, DIM2);                                             \+  }                                                                            \+  BENCHMARK_RANGE(BM_##FUNC##_##DIM1##x##DIM2, 128, 5000);++/*+BM_FuncWithKernelDimsGPU(convolution, 7, 1);+BM_FuncWithKernelDimsGPU(convolution, 1, 7);+BM_FuncWithKernelDimsGPU(convolution, 7, 4);+BM_FuncWithKernelDimsGPU(convolution, 4, 7);+BM_FuncWithKernelDimsGPU(convolution, 7, 64);+BM_FuncWithKernelDimsGPU(convolution, 64, 7);+*/
+ eigen3/bench/tensors/tensor_benchmarks_gpu.cu view
@@ -0,0 +1,75 @@+#define EIGEN_USE_GPU++#include <cuda.h>+#include <cuda_runtime.h>+#include <iostream>++#include "tensor_benchmarks.h"++// Simple functions+#define BM_FuncGPU(FUNC)                                                       \+  static void BM_##FUNC(int iters, int N) {                                    \+    StopBenchmarkTiming();                                                     \+    Eigen::CudaStreamDevice stream;                                            \+    Eigen::GpuDevice device(&stream);                                          \+    BenchmarkSuite<Eigen::GpuDevice, float> suite(device, N);                  \+    cudaDeviceSynchronize();                                                   \+    suite.FUNC(iters);                                                         \+  }                                                                            \+  BENCHMARK_RANGE(BM_##FUNC, 10, 5000);++BM_FuncGPU(memcpy);+BM_FuncGPU(typeCasting);+BM_FuncGPU(random);+BM_FuncGPU(slicing);+BM_FuncGPU(rowChip);+BM_FuncGPU(colChip);+BM_FuncGPU(shuffling);+BM_FuncGPU(padding);+BM_FuncGPU(striding);+BM_FuncGPU(broadcasting);+BM_FuncGPU(coeffWiseOp);+BM_FuncGPU(algebraicFunc);+BM_FuncGPU(transcendentalFunc);+BM_FuncGPU(rowReduction);+BM_FuncGPU(colReduction);+BM_FuncGPU(fullReduction);+++// Contractions+#define BM_FuncWithInputDimsGPU(FUNC, D1, D2, D3)                              \+  static void BM_##FUNC##_##D1##x##D2##x##D3(int iters, int N) {               \+    StopBenchmarkTiming();                                                     \+    Eigen::CudaStreamDevice stream;                                            \+    Eigen::GpuDevice device(&stream);                                          \+    BenchmarkSuite<Eigen::GpuDevice, float> suite(device, D1, D2, D3);         \+    cudaDeviceSynchronize();                                                   \+    suite.FUNC(iters);                                                         \+  }                                                                            \+  BENCHMARK_RANGE(BM_##FUNC##_##D1##x##D2##x##D3, 10, 5000);+++BM_FuncWithInputDimsGPU(contraction, N, N, N);+BM_FuncWithInputDimsGPU(contraction, 64, N, N);+BM_FuncWithInputDimsGPU(contraction, N, 64, N);+BM_FuncWithInputDimsGPU(contraction, N, N, 64);+++// Convolutions+#define BM_FuncWithKernelDimsGPU(FUNC, DIM1, DIM2)                             \+  static void BM_##FUNC##_##DIM1##x##DIM2(int iters, int N) {                  \+    StopBenchmarkTiming();                                                     \+    Eigen::CudaStreamDevice stream;                                            \+    Eigen::GpuDevice device(&stream);                                          \+    BenchmarkSuite<Eigen::GpuDevice, float> suite(device, N);                  \+    cudaDeviceSynchronize();                                                   \+    suite.FUNC(iters, DIM1, DIM2);                                             \+  }                                                                            \+  BENCHMARK_RANGE(BM_##FUNC##_##DIM1##x##DIM2, 128, 5000);++BM_FuncWithKernelDimsGPU(convolution, 7, 1);+BM_FuncWithKernelDimsGPU(convolution, 1, 7);+BM_FuncWithKernelDimsGPU(convolution, 7, 4);+BM_FuncWithKernelDimsGPU(convolution, 4, 7);+BM_FuncWithKernelDimsGPU(convolution, 7, 64);+BM_FuncWithKernelDimsGPU(convolution, 64, 7);
+ eigen3/bench/tensors/tensor_benchmarks_sycl.cc view
@@ -0,0 +1,37 @@+#define EIGEN_USE_SYCL++#include <SYCL/sycl.hpp>+#include <iostream>++#include "tensor_benchmarks.h"++using Eigen::array;+using Eigen::SyclDevice;+using Eigen::Tensor;+using Eigen::TensorMap;+// Simple functions+template <typename device_selector>+cl::sycl::queue sycl_queue() {+  return cl::sycl::queue(device_selector(), [=](cl::sycl::exception_list l) {+    for (const auto& e : l) {+      try {+        std::rethrow_exception(e);+      } catch (cl::sycl::exception e) {+        std::cout << e.what() << std::endl;+      }+    }+  });+}++#define BM_FuncGPU(FUNC)                                       \+  static void BM_##FUNC(int iters, int N) {                    \+    StopBenchmarkTiming();                                     \+    cl::sycl::queue q = sycl_queue<cl::sycl::gpu_selector>();  \+    Eigen::SyclDevice device(q);                               \+    BenchmarkSuite<Eigen::SyclDevice, float> suite(device, N); \+    suite.FUNC(iters);                                         \+  }                                                            \+  BENCHMARK_RANGE(BM_##FUNC, 10, 5000);++BM_FuncGPU(broadcasting);+BM_FuncGPU(coeffWiseOp);
+ eigen3/bench/vdw_new.cpp view
@@ -0,0 +1,56 @@+#include <iostream>+#include <Eigen/Core>++using namespace Eigen;++#ifndef SCALAR+#define SCALAR float+#endif++#ifndef SIZE+#define SIZE 10000+#endif++#ifndef REPEAT+#define REPEAT 10000+#endif++typedef Matrix<SCALAR, Eigen::Dynamic, 1> Vec;++using namespace std;++SCALAR E_VDW(const Vec &interactions1, const Vec &interactions2)+{+  return (interactions2.cwise()/interactions1)+         .cwise().cube()+         .cwise().square()+         .cwise().square()+         .sum();+}++int main() +{+  //+  //          1   2   3   4  ... (interactions)+  // ka       .   .   .   .  ...+  // rab      .   .   .   .  ...+  // energy   .   .   .   .  ...+  // ...     ... ... ... ... ...+  // (variables+  //    for+  // interaction)+  //+  Vec interactions1(SIZE), interactions2(SIZE); // SIZE is the number of vdw interactions in our system+  // SetupCalculations()+  SCALAR rab = 1.0;  +  interactions1.setConstant(2.4);+  interactions2.setConstant(rab);+  +  // Energy()+  SCALAR energy = 0.0;+  for (unsigned int i = 0; i<REPEAT; ++i) {+    energy += E_VDW(interactions1, interactions2);+    energy *= 1 + 1e-20 * i; // prevent compiler from optimizing the loop+  }+  cout << "energy = " << energy << endl;+}
+ eigen3/blas/BandTriangularSolver.h view
@@ -0,0 +1,97 @@+// This file is part of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2011 Gael Guennebaud <gael.guennebaud@inria.fr>+//+// 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_BAND_TRIANGULARSOLVER_H+#define EIGEN_BAND_TRIANGULARSOLVER_H++namespace internal {++ /* \internal+  * Solve Ax=b with A a band triangular matrix+  * TODO: extend it to matrices for x abd b */+template<typename Index, int Mode, typename LhsScalar, bool ConjLhs, typename RhsScalar, int StorageOrder>+struct band_solve_triangular_selector;+++template<typename Index, int Mode, typename LhsScalar, bool ConjLhs, typename RhsScalar>+struct band_solve_triangular_selector<Index,Mode,LhsScalar,ConjLhs,RhsScalar,RowMajor>+{+  typedef Map<const Matrix<LhsScalar,Dynamic,Dynamic,RowMajor>, 0, OuterStride<> > LhsMap;+  typedef Map<Matrix<RhsScalar,Dynamic,1> > RhsMap;+  enum { IsLower = (Mode&Lower) ? 1 : 0 };+  static void run(Index size, Index k, const LhsScalar* _lhs, Index lhsStride, RhsScalar* _other)+  {+    const LhsMap lhs(_lhs,size,k+1,OuterStride<>(lhsStride));+    RhsMap other(_other,size,1);+    typename internal::conditional<+                          ConjLhs,+                          const CwiseUnaryOp<typename internal::scalar_conjugate_op<LhsScalar>,LhsMap>,+                          const LhsMap&>+                        ::type cjLhs(lhs);+                        +    for(int col=0 ; col<other.cols() ; ++col)+    {+      for(int ii=0; ii<size; ++ii)+      {+        int i = IsLower ? ii : size-ii-1;+        int actual_k = (std::min)(k,ii);+        int actual_start = IsLower ? k-actual_k : 1;+        +        if(actual_k>0)+          other.coeffRef(i,col) -= cjLhs.row(i).segment(actual_start,actual_k).transpose()+                                  .cwiseProduct(other.col(col).segment(IsLower ? i-actual_k : i+1,actual_k)).sum();++        if((Mode&UnitDiag)==0)+          other.coeffRef(i,col) /= cjLhs(i,IsLower ? k : 0);+      }+    }+  }+  +};++template<typename Index, int Mode, typename LhsScalar, bool ConjLhs, typename RhsScalar>+struct band_solve_triangular_selector<Index,Mode,LhsScalar,ConjLhs,RhsScalar,ColMajor>+{+  typedef Map<const Matrix<LhsScalar,Dynamic,Dynamic,ColMajor>, 0, OuterStride<> > LhsMap;+  typedef Map<Matrix<RhsScalar,Dynamic,1> > RhsMap;+  enum { IsLower = (Mode&Lower) ? 1 : 0 };+  static void run(Index size, Index k, const LhsScalar* _lhs, Index lhsStride, RhsScalar* _other)+  {+    const LhsMap lhs(_lhs,k+1,size,OuterStride<>(lhsStride));+    RhsMap other(_other,size,1);+    typename internal::conditional<+                          ConjLhs,+                          const CwiseUnaryOp<typename internal::scalar_conjugate_op<LhsScalar>,LhsMap>,+                          const LhsMap&>+                        ::type cjLhs(lhs);+                        +    for(int col=0 ; col<other.cols() ; ++col)+    {+      for(int ii=0; ii<size; ++ii)+      {+        int i = IsLower ? ii : size-ii-1;+        int actual_k = (std::min)(k,size-ii-1);+        int actual_start = IsLower ? 1 : k-actual_k;+        +        if((Mode&UnitDiag)==0)+          other.coeffRef(i,col) /= cjLhs(IsLower ? 0 : k, i);++        if(actual_k>0)+          other.col(col).segment(IsLower ? i+1 : i-actual_k, actual_k)+              -= other.coeff(i,col) * cjLhs.col(i).segment(actual_start,actual_k);+        +      }+    }+  }+};+++} // end namespace internal++#endif // EIGEN_BAND_TRIANGULARSOLVER_H
+ eigen3/blas/CMakeLists.txt view
@@ -0,0 +1,57 @@++project(EigenBlas CXX)++include("../cmake/language_support.cmake")++workaround_9220(Fortran EIGEN_Fortran_COMPILER_WORKS)++if(EIGEN_Fortran_COMPILER_WORKS)+  enable_language(Fortran OPTIONAL)+  if(NOT CMAKE_Fortran_COMPILER)+    set(EIGEN_Fortran_COMPILER_WORKS OFF)+  endif()+endif()++add_custom_target(blas)++set(EigenBlas_SRCS  single.cpp double.cpp complex_single.cpp complex_double.cpp xerbla.cpp+                    f2c/srotm.c   f2c/srotmg.c  f2c/drotm.c f2c/drotmg.c+                    f2c/lsame.c   f2c/dspmv.c   f2c/ssbmv.c f2c/chbmv.c+                    f2c/sspmv.c   f2c/zhbmv.c   f2c/chpmv.c f2c/dsbmv.c+                    f2c/zhpmv.c   f2c/dtbmv.c   f2c/stbmv.c f2c/ctbmv.c+                    f2c/ztbmv.c   f2c/d_cnjg.c  f2c/r_cnjg.c+   )++if (EIGEN_Fortran_COMPILER_WORKS)+  set(EigenBlas_SRCS ${EigenBlas_SRCS} fortran/complexdots.f)+else()+  set(EigenBlas_SRCS ${EigenBlas_SRCS} f2c/complexdots.c)+endif()++add_library(eigen_blas_static ${EigenBlas_SRCS})+add_library(eigen_blas SHARED ${EigenBlas_SRCS})++if(EIGEN_STANDARD_LIBRARIES_TO_LINK_TO)+  target_link_libraries(eigen_blas_static ${EIGEN_STANDARD_LIBRARIES_TO_LINK_TO})+  target_link_libraries(eigen_blas        ${EIGEN_STANDARD_LIBRARIES_TO_LINK_TO})+endif()++add_dependencies(blas eigen_blas eigen_blas_static)++install(TARGETS eigen_blas eigen_blas_static+        RUNTIME DESTINATION bin+        LIBRARY DESTINATION lib+        ARCHIVE DESTINATION lib)++if(EIGEN_Fortran_COMPILER_WORKS)++if(BUILD_TESTING)+  if(EIGEN_LEAVE_TEST_IN_ALL_TARGET)+    add_subdirectory(testing) # can't do EXCLUDE_FROM_ALL here, breaks CTest+  else()+    add_subdirectory(testing EXCLUDE_FROM_ALL)+  endif()+endif()++endif()+
+ eigen3/blas/GeneralRank1Update.h view
@@ -0,0 +1,44 @@+// This file is part of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2012 Chen-Pang He <jdh8@ms63.hinet.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/.++#ifndef EIGEN_GENERAL_RANK1UPDATE_H+#define EIGEN_GENERAL_RANK1UPDATE_H++namespace internal {++/* Optimized matrix += alpha * uv' */+template<typename Scalar, typename Index, int StorageOrder, bool ConjLhs, bool ConjRhs>+struct general_rank1_update;++template<typename Scalar, typename Index, bool ConjLhs, bool ConjRhs>+struct general_rank1_update<Scalar,Index,ColMajor,ConjLhs,ConjRhs>+{+  static void run(Index rows, Index cols, Scalar* mat, Index stride, const Scalar* u, const Scalar* v, Scalar alpha)+  {+    typedef Map<const Matrix<Scalar,Dynamic,1> > OtherMap;+    typedef typename conj_expr_if<ConjLhs,OtherMap>::type ConjRhsType;+    conj_if<ConjRhs> cj;++    for (Index i=0; i<cols; ++i)+      Map<Matrix<Scalar,Dynamic,1> >(mat+stride*i,rows) += alpha * cj(v[i]) * ConjRhsType(OtherMap(u,rows));+  }+};++template<typename Scalar, typename Index, bool ConjLhs, bool ConjRhs>+struct general_rank1_update<Scalar,Index,RowMajor,ConjLhs,ConjRhs>+{+  static void run(Index rows, Index cols, Scalar* mat, Index stride, const Scalar* u, const Scalar* v, Scalar alpha)+  {+    general_rank1_update<Scalar,Index,ColMajor,ConjRhs,ConjRhs>::run(rows,cols,mat,stride,u,v,alpha);+  }+};++} // end namespace internal++#endif // EIGEN_GENERAL_RANK1UPDATE_H
+ eigen3/blas/PackedSelfadjointProduct.h view
@@ -0,0 +1,53 @@+// This file is part of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2012 Chen-Pang He <jdh8@ms63.hinet.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/.++#ifndef EIGEN_SELFADJOINT_PACKED_PRODUCT_H+#define EIGEN_SELFADJOINT_PACKED_PRODUCT_H++namespace internal {++/* Optimized matrix += alpha * uv'+ * The matrix is in packed form.+ */+template<typename Scalar, typename Index, int StorageOrder, int UpLo, bool ConjLhs, bool ConjRhs>+struct selfadjoint_packed_rank1_update;++template<typename Scalar, typename Index, int UpLo, bool ConjLhs, bool ConjRhs>+struct selfadjoint_packed_rank1_update<Scalar,Index,ColMajor,UpLo,ConjLhs,ConjRhs>+{+  typedef typename NumTraits<Scalar>::Real RealScalar;+  static void run(Index size, Scalar* mat, const Scalar* vec, RealScalar alpha)+  {+    typedef Map<const Matrix<Scalar,Dynamic,1> > OtherMap;+    typedef typename conj_expr_if<ConjLhs,OtherMap>::type ConjRhsType;+    conj_if<ConjRhs> cj;++    for (Index i=0; i<size; ++i)+    {+      Map<Matrix<Scalar,Dynamic,1> >(mat, UpLo==Lower ? size-i : (i+1)) += alpha * cj(vec[i]) * ConjRhsType(OtherMap(vec+(UpLo==Lower ? i : 0), UpLo==Lower ? size-i : (i+1)));+      //FIXME This should be handled outside.+      mat[UpLo==Lower ? 0 : i] = numext::real(mat[UpLo==Lower ? 0 : i]);+      mat += UpLo==Lower ? size-i : (i+1);+    }+  }+};++template<typename Scalar, typename Index, int UpLo, bool ConjLhs, bool ConjRhs>+struct selfadjoint_packed_rank1_update<Scalar,Index,RowMajor,UpLo,ConjLhs,ConjRhs>+{+  typedef typename NumTraits<Scalar>::Real RealScalar;+  static void run(Index size, Scalar* mat, const Scalar* vec, RealScalar alpha)+  {+    selfadjoint_packed_rank1_update<Scalar,Index,ColMajor,UpLo==Lower?Upper:Lower,ConjRhs,ConjLhs>::run(size,mat,vec,alpha);+  }+};++} // end namespace internal++#endif // EIGEN_SELFADJOINT_PACKED_PRODUCT_H
+ eigen3/blas/PackedTriangularMatrixVector.h view
@@ -0,0 +1,79 @@+// This file is part of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2012 Chen-Pang He <jdh8@ms63.hinet.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/.++#ifndef EIGEN_PACKED_TRIANGULAR_MATRIX_VECTOR_H+#define EIGEN_PACKED_TRIANGULAR_MATRIX_VECTOR_H++namespace internal {++template<typename Index, int Mode, typename LhsScalar, bool ConjLhs, typename RhsScalar, bool ConjRhs, int StorageOrder>+struct packed_triangular_matrix_vector_product;++template<typename Index, int Mode, typename LhsScalar, bool ConjLhs, typename RhsScalar, bool ConjRhs>+struct packed_triangular_matrix_vector_product<Index,Mode,LhsScalar,ConjLhs,RhsScalar,ConjRhs,ColMajor>+{+  typedef typename ScalarBinaryOpTraits<LhsScalar, RhsScalar>::ReturnType ResScalar;+  enum {+    IsLower     = (Mode & Lower)   ==Lower,+    HasUnitDiag = (Mode & UnitDiag)==UnitDiag,+    HasZeroDiag = (Mode & ZeroDiag)==ZeroDiag+  };+  static void run(Index size, const LhsScalar* lhs, const RhsScalar* rhs, ResScalar* res, ResScalar alpha)+  {+    internal::conj_if<ConjRhs> cj;+    typedef Map<const Matrix<LhsScalar,Dynamic,1> > LhsMap;+    typedef typename conj_expr_if<ConjLhs,LhsMap>::type ConjLhsType;+    typedef Map<Matrix<ResScalar,Dynamic,1> > ResMap;++    for (Index i=0; i<size; ++i)+    {+      Index s = IsLower&&(HasUnitDiag||HasZeroDiag) ? 1 : 0;+      Index r = IsLower ? size-i: i+1;+      if (EIGEN_IMPLIES(HasUnitDiag||HasZeroDiag, (--r)>0))+	ResMap(res+(IsLower ? s+i : 0),r) += alpha * cj(rhs[i]) * ConjLhsType(LhsMap(lhs+s,r));+      if (HasUnitDiag)+	res[i] += alpha * cj(rhs[i]);+      lhs += IsLower ? size-i: i+1;+    }+  };+};++template<typename Index, int Mode, typename LhsScalar, bool ConjLhs, typename RhsScalar, bool ConjRhs>+struct packed_triangular_matrix_vector_product<Index,Mode,LhsScalar,ConjLhs,RhsScalar,ConjRhs,RowMajor>+{+  typedef typename ScalarBinaryOpTraits<LhsScalar, RhsScalar>::ReturnType ResScalar;+  enum {+    IsLower     = (Mode & Lower)   ==Lower,+    HasUnitDiag = (Mode & UnitDiag)==UnitDiag,+    HasZeroDiag = (Mode & ZeroDiag)==ZeroDiag+  };+  static void run(Index size, const LhsScalar* lhs, const RhsScalar* rhs, ResScalar* res, ResScalar alpha)+  {+    internal::conj_if<ConjRhs> cj;+    typedef Map<const Matrix<LhsScalar,Dynamic,1> > LhsMap;+    typedef typename conj_expr_if<ConjLhs,LhsMap>::type ConjLhsType;+    typedef Map<const Matrix<RhsScalar,Dynamic,1> > RhsMap;+    typedef typename conj_expr_if<ConjRhs,RhsMap>::type ConjRhsType;++    for (Index i=0; i<size; ++i)+    {+      Index s = !IsLower&&(HasUnitDiag||HasZeroDiag) ? 1 : 0;+      Index r = IsLower ? i+1 : size-i;+      if (EIGEN_IMPLIES(HasUnitDiag||HasZeroDiag, (--r)>0))+	res[i] += alpha * (ConjLhsType(LhsMap(lhs+s,r)).cwiseProduct(ConjRhsType(RhsMap(rhs+(IsLower ? 0 : s+i),r)))).sum();+      if (HasUnitDiag)+	res[i] += alpha * cj(rhs[i]);+      lhs += IsLower ? i+1 : size-i;+    }+  };+};++} // end namespace internal++#endif // EIGEN_PACKED_TRIANGULAR_MATRIX_VECTOR_H
+ eigen3/blas/PackedTriangularSolverVector.h view
@@ -0,0 +1,88 @@+// This file is part of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2012 Chen-Pang He <jdh8@ms63.hinet.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/.++#ifndef EIGEN_PACKED_TRIANGULAR_SOLVER_VECTOR_H+#define EIGEN_PACKED_TRIANGULAR_SOLVER_VECTOR_H++namespace internal {++template<typename LhsScalar, typename RhsScalar, typename Index, int Side, int Mode, bool Conjugate, int StorageOrder>+struct packed_triangular_solve_vector;++// forward and backward substitution, row-major, rhs is a vector+template<typename LhsScalar, typename RhsScalar, typename Index, int Mode, bool Conjugate>+struct packed_triangular_solve_vector<LhsScalar, RhsScalar, Index, OnTheLeft, Mode, Conjugate, RowMajor>+{+  enum {+    IsLower = (Mode&Lower)==Lower+  };+  static void run(Index size, const LhsScalar* lhs, RhsScalar* rhs)+  {+    internal::conj_if<Conjugate> cj;+    typedef Map<const Matrix<LhsScalar,Dynamic,1> > LhsMap;+    typedef typename conj_expr_if<Conjugate,LhsMap>::type ConjLhsType;++    lhs += IsLower ? 0 : (size*(size+1)>>1)-1;+    for(Index pi=0; pi<size; ++pi)+    {+      Index i = IsLower ? pi : size-pi-1;+      Index s = IsLower ? 0 : 1;+      if (pi>0)+	rhs[i] -= (ConjLhsType(LhsMap(lhs+s,pi))+	    .cwiseProduct(Map<const Matrix<RhsScalar,Dynamic,1> >(rhs+(IsLower ? 0 : i+1),pi))).sum();+      if (!(Mode & UnitDiag))+	rhs[i] /= cj(lhs[IsLower ? i : 0]);+      IsLower ? lhs += pi+1 : lhs -= pi+2;+    }+  }+};++// forward and backward substitution, column-major, rhs is a vector+template<typename LhsScalar, typename RhsScalar, typename Index, int Mode, bool Conjugate>+struct packed_triangular_solve_vector<LhsScalar, RhsScalar, Index, OnTheLeft, Mode, Conjugate, ColMajor>+{+  enum {+    IsLower = (Mode&Lower)==Lower+  };+  static void run(Index size, const LhsScalar* lhs, RhsScalar* rhs)+  {+    internal::conj_if<Conjugate> cj;+    typedef Map<const Matrix<LhsScalar,Dynamic,1> > LhsMap;+    typedef typename conj_expr_if<Conjugate,LhsMap>::type ConjLhsType;++    lhs += IsLower ? 0 : size*(size-1)>>1;+    for(Index pi=0; pi<size; ++pi)+    {+      Index i = IsLower ? pi : size-pi-1;+      Index r = size - pi - 1;+      if (!(Mode & UnitDiag))+	rhs[i] /= cj(lhs[IsLower ? 0 : i]);+      if (r>0)+	Map<Matrix<RhsScalar,Dynamic,1> >(rhs+(IsLower? i+1 : 0),r) -=+	    rhs[i] * ConjLhsType(LhsMap(lhs+(IsLower? 1 : 0),r));+      IsLower ? lhs += size-pi : lhs -= r;+    }+  }+};++template<typename LhsScalar, typename RhsScalar, typename Index, int Mode, bool Conjugate, int StorageOrder>+struct packed_triangular_solve_vector<LhsScalar, RhsScalar, Index, OnTheRight, Mode, Conjugate, StorageOrder>+{+  static void run(Index size, const LhsScalar* lhs, RhsScalar* rhs)+  {+    packed_triangular_solve_vector<LhsScalar,RhsScalar,Index,OnTheLeft,+	((Mode&Upper)==Upper ? Lower : Upper) | (Mode&UnitDiag),+	Conjugate,StorageOrder==RowMajor?ColMajor:RowMajor+      >::run(size, lhs, rhs);+  }+};++} // end namespace internal++#endif // EIGEN_PACKED_TRIANGULAR_SOLVER_VECTOR_H
+ eigen3/blas/README.txt view
@@ -0,0 +1,6 @@++This directory contains a BLAS library built on top of Eigen.++This module is not built by default. In order to compile it, you need to+type 'make blas' from within your build dir.+
+ eigen3/blas/Rank2Update.h view
@@ -0,0 +1,57 @@+// This file is part of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2012 Chen-Pang He <jdh8@ms63.hinet.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/.++#ifndef EIGEN_RANK2UPDATE_H+#define EIGEN_RANK2UPDATE_H++namespace internal {++/* Optimized selfadjoint matrix += alpha * uv' + conj(alpha)*vu'+ * This is the low-level version of SelfadjointRank2Update.h+ */+template<typename Scalar, typename Index, int UpLo>+struct rank2_update_selector+{+  static void run(Index size, Scalar* mat, Index stride, const Scalar* u, const Scalar* v, Scalar alpha)+  {+    typedef Map<const Matrix<Scalar,Dynamic,1> > OtherMap;+    for (Index i=0; i<size; ++i)+    {+      Map<Matrix<Scalar,Dynamic,1> >(mat+stride*i+(UpLo==Lower ? i : 0), UpLo==Lower ? size-i : (i+1)) +=+      numext::conj(alpha) * numext::conj(u[i]) * OtherMap(v+(UpLo==Lower ? i : 0), UpLo==Lower ? size-i : (i+1))+                + alpha * numext::conj(v[i]) * OtherMap(u+(UpLo==Lower ? i : 0), UpLo==Lower ? size-i : (i+1));+    }+  }+};++/* Optimized selfadjoint matrix += alpha * uv' + conj(alpha)*vu'+ * The matrix is in packed form.+ */+template<typename Scalar, typename Index, int UpLo>+struct packed_rank2_update_selector+{+  static void run(Index size, Scalar* mat, const Scalar* u, const Scalar* v, Scalar alpha)+  {+    typedef Map<const Matrix<Scalar,Dynamic,1> > OtherMap;+    Index offset = 0;+    for (Index i=0; i<size; ++i)+    {+      Map<Matrix<Scalar,Dynamic,1> >(mat+offset, UpLo==Lower ? size-i : (i+1)) +=+      numext::conj(alpha) * numext::conj(u[i]) * OtherMap(v+(UpLo==Lower ? i : 0), UpLo==Lower ? size-i : (i+1))+                + alpha * numext::conj(v[i]) * OtherMap(u+(UpLo==Lower ? i : 0), UpLo==Lower ? size-i : (i+1));+      //FIXME This should be handled outside.+      mat[offset+(UpLo==Lower ? 0 : i)] = numext::real(mat[offset+(UpLo==Lower ? 0 : i)]);+      offset += UpLo==Lower ? size-i : (i+1);+    }+  }+};++} // end namespace internal++#endif // EIGEN_RANK2UPDATE_H
+ eigen3/blas/common.h view
@@ -0,0 +1,163 @@+// This file is part of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2009-2015 Gael Guennebaud <gael.guennebaud@inria.fr>+//+// 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_BLAS_COMMON_H+#define EIGEN_BLAS_COMMON_H++#include "../Eigen/Core"+#include "../Eigen/Jacobi"++#include <complex>++#ifndef SCALAR+#error the token SCALAR must be defined to compile this file+#endif++#include "../Eigen/src/misc/blas.h"++#define NOTR    0+#define TR      1+#define ADJ     2++#define LEFT    0+#define RIGHT   1++#define UP      0+#define LO      1++#define NUNIT   0+#define UNIT    1++#define INVALID 0xff++#define OP(X)   (   ((X)=='N' || (X)=='n') ? NOTR   \+                  : ((X)=='T' || (X)=='t') ? TR     \+                  : ((X)=='C' || (X)=='c') ? ADJ    \+                  : INVALID)++#define SIDE(X) (   ((X)=='L' || (X)=='l') ? LEFT   \+                  : ((X)=='R' || (X)=='r') ? RIGHT  \+                  : INVALID)++#define UPLO(X) (   ((X)=='U' || (X)=='u') ? UP     \+                  : ((X)=='L' || (X)=='l') ? LO     \+                  : INVALID)++#define DIAG(X) (   ((X)=='N' || (X)=='n') ? NUNIT  \+                  : ((X)=='U' || (X)=='u') ? UNIT   \+                  : INVALID)+++inline bool check_op(const char* op)+{+  return OP(*op)!=0xff;+}++inline bool check_side(const char* side)+{+  return SIDE(*side)!=0xff;+}++inline bool check_uplo(const char* uplo)+{+  return UPLO(*uplo)!=0xff;+}+++namespace Eigen {+#include "BandTriangularSolver.h"+#include "GeneralRank1Update.h"+#include "PackedSelfadjointProduct.h"+#include "PackedTriangularMatrixVector.h"+#include "PackedTriangularSolverVector.h"+#include "Rank2Update.h"+}++using namespace Eigen;++typedef SCALAR Scalar;+typedef NumTraits<Scalar>::Real RealScalar;+typedef std::complex<RealScalar> Complex;++enum+{+  IsComplex = Eigen::NumTraits<SCALAR>::IsComplex,+  Conj = IsComplex+};++typedef Matrix<Scalar,Dynamic,Dynamic,ColMajor> PlainMatrixType;+typedef Map<Matrix<Scalar,Dynamic,Dynamic,ColMajor>, 0, OuterStride<> > MatrixType;+typedef Map<const Matrix<Scalar,Dynamic,Dynamic,ColMajor>, 0, OuterStride<> > ConstMatrixType;+typedef Map<Matrix<Scalar,Dynamic,1>, 0, InnerStride<Dynamic> > StridedVectorType;+typedef Map<Matrix<Scalar,Dynamic,1> > CompactVectorType;++template<typename T>+Map<Matrix<T,Dynamic,Dynamic,ColMajor>, 0, OuterStride<> >+matrix(T* data, int rows, int cols, int stride)+{+  return Map<Matrix<T,Dynamic,Dynamic,ColMajor>, 0, OuterStride<> >(data, rows, cols, OuterStride<>(stride));+}++template<typename T>+Map<const Matrix<T,Dynamic,Dynamic,ColMajor>, 0, OuterStride<> >+matrix(const T* data, int rows, int cols, int stride)+{+  return Map<const Matrix<T,Dynamic,Dynamic,ColMajor>, 0, OuterStride<> >(data, rows, cols, OuterStride<>(stride));+}++template<typename T>+Map<Matrix<T,Dynamic,1>, 0, InnerStride<Dynamic> > make_vector(T* data, int size, int incr)+{+  return Map<Matrix<T,Dynamic,1>, 0, InnerStride<Dynamic> >(data, size, InnerStride<Dynamic>(incr));+}++template<typename T>+Map<const Matrix<T,Dynamic,1>, 0, InnerStride<Dynamic> > make_vector(const T* data, int size, int incr)+{+  return Map<const Matrix<T,Dynamic,1>, 0, InnerStride<Dynamic> >(data, size, InnerStride<Dynamic>(incr));+}++template<typename T>+Map<Matrix<T,Dynamic,1> > make_vector(T* data, int size)+{+  return Map<Matrix<T,Dynamic,1> >(data, size);+}++template<typename T>+Map<const Matrix<T,Dynamic,1> > make_vector(const T* data, int size)+{+  return Map<const Matrix<T,Dynamic,1> >(data, size);+}++template<typename T>+T* get_compact_vector(T* x, int n, int incx)+{+  if(incx==1)+    return x;++  typename Eigen::internal::remove_const<T>::type* ret = new Scalar[n];+  if(incx<0) make_vector(ret,n) = make_vector(x,n,-incx).reverse();+  else       make_vector(ret,n) = make_vector(x,n, incx);+  return ret;+}++template<typename T>+T* copy_back(T* x_cpy, T* x, int n, int incx)+{+  if(x_cpy==x)+    return 0;++  if(incx<0) make_vector(x,n,-incx).reverse() = make_vector(x_cpy,n);+  else       make_vector(x,n, incx)           = make_vector(x_cpy,n);+  return x_cpy;+}++#define EIGEN_BLAS_FUNC(X) EIGEN_CAT(SCALAR_SUFFIX,X##_)++#endif // EIGEN_BLAS_COMMON_H
+ eigen3/blas/complex_double.cpp view
@@ -0,0 +1,20 @@+// This file is part of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2009 Gael Guennebaud <gael.guennebaud@inria.fr>+//+// 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<double>+#define SCALAR_SUFFIX z+#define SCALAR_SUFFIX_UP "Z"+#define REAL_SCALAR_SUFFIX d+#define ISCOMPLEX     1++#include "level1_impl.h"+#include "level1_cplx_impl.h"+#include "level2_impl.h"+#include "level2_cplx_impl.h"+#include "level3_impl.h"
+ eigen3/blas/complex_single.cpp view
@@ -0,0 +1,20 @@+// This file is part of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2009 Gael Guennebaud <gael.guennebaud@inria.fr>+//+// 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<float>+#define SCALAR_SUFFIX c+#define SCALAR_SUFFIX_UP "C"+#define REAL_SCALAR_SUFFIX s+#define ISCOMPLEX     1++#include "level1_impl.h"+#include "level1_cplx_impl.h"+#include "level2_impl.h"+#include "level2_cplx_impl.h"+#include "level3_impl.h"
+ eigen3/blas/double.cpp view
@@ -0,0 +1,32 @@+// This file is part of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2009 Gael Guennebaud <gael.guennebaud@inria.fr>+// Copyright (C) 2012 Chen-Pang He <jdh8@ms63.hinet.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/.++#define SCALAR        double+#define SCALAR_SUFFIX d+#define SCALAR_SUFFIX_UP "D"+#define ISCOMPLEX     0++#include "level1_impl.h"+#include "level1_real_impl.h"+#include "level2_impl.h"+#include "level2_real_impl.h"+#include "level3_impl.h"++double BLASFUNC(dsdot)(int* n, float* x, int* incx, float* y, int* incy)+{+  if(*n<=0) return 0;++  if(*incx==1 && *incy==1)    return (make_vector(x,*n).cast<double>().cwiseProduct(make_vector(y,*n).cast<double>())).sum();+  else if(*incx>0 && *incy>0) return (make_vector(x,*n,*incx).cast<double>().cwiseProduct(make_vector(y,*n,*incy).cast<double>())).sum();+  else if(*incx<0 && *incy>0) return (make_vector(x,*n,-*incx).reverse().cast<double>().cwiseProduct(make_vector(y,*n,*incy).cast<double>())).sum();+  else if(*incx>0 && *incy<0) return (make_vector(x,*n,*incx).cast<double>().cwiseProduct(make_vector(y,*n,-*incy).reverse().cast<double>())).sum();+  else if(*incx<0 && *incy<0) return (make_vector(x,*n,-*incx).reverse().cast<double>().cwiseProduct(make_vector(y,*n,-*incy).reverse().cast<double>())).sum();+  else return 0;+}
+ eigen3/blas/f2c/chbmv.c view
@@ -0,0 +1,487 @@+/* chbmv.f -- translated by f2c (version 20100827).+   You must link the resulting object file with libf2c:+	on Microsoft Windows system, link with libf2c.lib;+	on Linux or Unix systems, link with .../path/to/libf2c.a -lm+	or, if you install libf2c.a in a standard place, with -lf2c -lm+	-- in that order, at the end of the command line, as in+		cc *.o -lf2c -lm+	Source for libf2c is in /netlib/f2c/libf2c.zip, e.g.,++		http://www.netlib.org/f2c/libf2c.zip+*/++#include "datatypes.h"++/* Subroutine */ int chbmv_(char *uplo, integer *n, integer *k, complex *+	alpha, complex *a, integer *lda, complex *x, integer *incx, complex *+	beta, complex *y, integer *incy, ftnlen uplo_len)+{+    /* System generated locals */+    integer a_dim1, a_offset, i__1, i__2, i__3, i__4, i__5;+    real r__1;+    complex q__1, q__2, q__3, q__4;++    /* Builtin functions */+    void r_cnjg(complex *, complex *);++    /* Local variables */+    integer i__, j, l, ix, iy, jx, jy, kx, ky, info;+    complex temp1, temp2;+    extern logical lsame_(char *, char *, ftnlen, ftnlen);+    integer kplus1;+    extern /* Subroutine */ int xerbla_(char *, integer *, ftnlen);++/*     .. Scalar Arguments .. */+/*     .. */+/*     .. Array Arguments .. */+/*     .. */++/*  Purpose */+/*  ======= */++/*  CHBMV  performs the matrix-vector  operation */++/*     y := alpha*A*x + beta*y, */++/*  where alpha and beta are scalars, x and y are n element vectors and */+/*  A is an n by n hermitian band matrix, with k super-diagonals. */++/*  Arguments */+/*  ========== */++/*  UPLO   - CHARACTER*1. */+/*           On entry, UPLO specifies whether the upper or lower */+/*           triangular part of the band matrix A is being supplied as */+/*           follows: */++/*              UPLO = 'U' or 'u'   The upper triangular part of A is */+/*                                  being supplied. */++/*              UPLO = 'L' or 'l'   The lower triangular part of A is */+/*                                  being supplied. */++/*           Unchanged on exit. */++/*  N      - INTEGER. */+/*           On entry, N specifies the order of the matrix A. */+/*           N must be at least zero. */+/*           Unchanged on exit. */++/*  K      - INTEGER. */+/*           On entry, K specifies the number of super-diagonals of the */+/*           matrix A. K must satisfy  0 .le. K. */+/*           Unchanged on exit. */++/*  ALPHA  - COMPLEX         . */+/*           On entry, ALPHA specifies the scalar alpha. */+/*           Unchanged on exit. */++/*  A      - COMPLEX          array of DIMENSION ( LDA, n ). */+/*           Before entry with UPLO = 'U' or 'u', the leading ( k + 1 ) */+/*           by n part of the array A must contain the upper triangular */+/*           band part of the hermitian matrix, supplied column by */+/*           column, with the leading diagonal of the matrix in row */+/*           ( k + 1 ) of the array, the first super-diagonal starting at */+/*           position 2 in row k, and so on. The top left k by k triangle */+/*           of the array A is not referenced. */+/*           The following program segment will transfer the upper */+/*           triangular part of a hermitian band matrix from conventional */+/*           full matrix storage to band storage: */++/*                 DO 20, J = 1, N */+/*                    M = K + 1 - J */+/*                    DO 10, I = MAX( 1, J - K ), J */+/*                       A( M + I, J ) = matrix( I, J ) */+/*              10    CONTINUE */+/*              20 CONTINUE */++/*           Before entry with UPLO = 'L' or 'l', the leading ( k + 1 ) */+/*           by n part of the array A must contain the lower triangular */+/*           band part of the hermitian matrix, supplied column by */+/*           column, with the leading diagonal of the matrix in row 1 of */+/*           the array, the first sub-diagonal starting at position 1 in */+/*           row 2, and so on. The bottom right k by k triangle of the */+/*           array A is not referenced. */+/*           The following program segment will transfer the lower */+/*           triangular part of a hermitian band matrix from conventional */+/*           full matrix storage to band storage: */++/*                 DO 20, J = 1, N */+/*                    M = 1 - J */+/*                    DO 10, I = J, MIN( N, J + K ) */+/*                       A( M + I, J ) = matrix( I, J ) */+/*              10    CONTINUE */+/*              20 CONTINUE */++/*           Note that the imaginary parts of the diagonal elements need */+/*           not be set and are assumed to be zero. */+/*           Unchanged on exit. */++/*  LDA    - INTEGER. */+/*           On entry, LDA specifies the first dimension of A as declared */+/*           in the calling (sub) program. LDA must be at least */+/*           ( k + 1 ). */+/*           Unchanged on exit. */++/*  X      - COMPLEX          array of DIMENSION at least */+/*           ( 1 + ( n - 1 )*abs( INCX ) ). */+/*           Before entry, the incremented array X must contain the */+/*           vector x. */+/*           Unchanged on exit. */++/*  INCX   - INTEGER. */+/*           On entry, INCX specifies the increment for the elements of */+/*           X. INCX must not be zero. */+/*           Unchanged on exit. */++/*  BETA   - COMPLEX         . */+/*           On entry, BETA specifies the scalar beta. */+/*           Unchanged on exit. */++/*  Y      - COMPLEX          array of DIMENSION at least */+/*           ( 1 + ( n - 1 )*abs( INCY ) ). */+/*           Before entry, the incremented array Y must contain the */+/*           vector y. On exit, Y is overwritten by the updated vector y. */++/*  INCY   - INTEGER. */+/*           On entry, INCY specifies the increment for the elements of */+/*           Y. INCY must not be zero. */+/*           Unchanged on exit. */++/*  Further Details */+/*  =============== */++/*  Level 2 Blas routine. */++/*  -- Written on 22-October-1986. */+/*     Jack Dongarra, Argonne National Lab. */+/*     Jeremy Du Croz, Nag Central Office. */+/*     Sven Hammarling, Nag Central Office. */+/*     Richard Hanson, Sandia National Labs. */++/*  ===================================================================== */++/*     .. Parameters .. */+/*     .. */+/*     .. Local Scalars .. */+/*     .. */+/*     .. External Functions .. */+/*     .. */+/*     .. External Subroutines .. */+/*     .. */+/*     .. Intrinsic Functions .. */+/*     .. */++/*     Test the input parameters. */++    /* Parameter adjustments */+    a_dim1 = *lda;+    a_offset = 1 + a_dim1;+    a -= a_offset;+    --x;+    --y;++    /* Function Body */+    info = 0;+    if (! lsame_(uplo, "U", (ftnlen)1, (ftnlen)1) && ! lsame_(uplo, "L", (+	    ftnlen)1, (ftnlen)1)) {+	info = 1;+    } else if (*n < 0) {+	info = 2;+    } else if (*k < 0) {+	info = 3;+    } else if (*lda < *k + 1) {+	info = 6;+    } else if (*incx == 0) {+	info = 8;+    } else if (*incy == 0) {+	info = 11;+    }+    if (info != 0) {+	xerbla_("CHBMV ", &info, (ftnlen)6);+	return 0;+    }++/*     Quick return if possible. */++    if (*n == 0 || (alpha->r == 0.f && alpha->i == 0.f && (beta->r == 1.f && +                                                           beta->i == 0.f))) {+	return 0;+    }++/*     Set up the start points in  X  and  Y. */++    if (*incx > 0) {+	kx = 1;+    } else {+	kx = 1 - (*n - 1) * *incx;+    }+    if (*incy > 0) {+	ky = 1;+    } else {+	ky = 1 - (*n - 1) * *incy;+    }++/*     Start the operations. In this version the elements of the array A */+/*     are accessed sequentially with one pass through A. */++/*     First form  y := beta*y. */++    if (beta->r != 1.f || beta->i != 0.f) {+	if (*incy == 1) {+	    if (beta->r == 0.f && beta->i == 0.f) {+		i__1 = *n;+		for (i__ = 1; i__ <= i__1; ++i__) {+		    i__2 = i__;+		    y[i__2].r = 0.f, y[i__2].i = 0.f;+/* L10: */+		}+	    } else {+		i__1 = *n;+		for (i__ = 1; i__ <= i__1; ++i__) {+		    i__2 = i__;+		    i__3 = i__;+		    q__1.r = beta->r * y[i__3].r - beta->i * y[i__3].i, +			    q__1.i = beta->r * y[i__3].i + beta->i * y[i__3]+			    .r;+		    y[i__2].r = q__1.r, y[i__2].i = q__1.i;+/* L20: */+		}+	    }+	} else {+	    iy = ky;+	    if (beta->r == 0.f && beta->i == 0.f) {+		i__1 = *n;+		for (i__ = 1; i__ <= i__1; ++i__) {+		    i__2 = iy;+		    y[i__2].r = 0.f, y[i__2].i = 0.f;+		    iy += *incy;+/* L30: */+		}+	    } else {+		i__1 = *n;+		for (i__ = 1; i__ <= i__1; ++i__) {+		    i__2 = iy;+		    i__3 = iy;+		    q__1.r = beta->r * y[i__3].r - beta->i * y[i__3].i, +			    q__1.i = beta->r * y[i__3].i + beta->i * y[i__3]+			    .r;+		    y[i__2].r = q__1.r, y[i__2].i = q__1.i;+		    iy += *incy;+/* L40: */+		}+	    }+	}+    }+    if (alpha->r == 0.f && alpha->i == 0.f) {+	return 0;+    }+    if (lsame_(uplo, "U", (ftnlen)1, (ftnlen)1)) {++/*        Form  y  when upper triangle of A is stored. */++	kplus1 = *k + 1;+	if (*incx == 1 && *incy == 1) {+	    i__1 = *n;+	    for (j = 1; j <= i__1; ++j) {+		i__2 = j;+		q__1.r = alpha->r * x[i__2].r - alpha->i * x[i__2].i, q__1.i =+			 alpha->r * x[i__2].i + alpha->i * x[i__2].r;+		temp1.r = q__1.r, temp1.i = q__1.i;+		temp2.r = 0.f, temp2.i = 0.f;+		l = kplus1 - j;+/* Computing MAX */+		i__2 = 1, i__3 = j - *k;+		i__4 = j - 1;+		for (i__ = max(i__2,i__3); i__ <= i__4; ++i__) {+		    i__2 = i__;+		    i__3 = i__;+		    i__5 = l + i__ + j * a_dim1;+		    q__2.r = temp1.r * a[i__5].r - temp1.i * a[i__5].i, +			    q__2.i = temp1.r * a[i__5].i + temp1.i * a[i__5]+			    .r;+		    q__1.r = y[i__3].r + q__2.r, q__1.i = y[i__3].i + q__2.i;+		    y[i__2].r = q__1.r, y[i__2].i = q__1.i;+		    r_cnjg(&q__3, &a[l + i__ + j * a_dim1]);+		    i__2 = i__;+		    q__2.r = q__3.r * x[i__2].r - q__3.i * x[i__2].i, q__2.i =+			     q__3.r * x[i__2].i + q__3.i * x[i__2].r;+		    q__1.r = temp2.r + q__2.r, q__1.i = temp2.i + q__2.i;+		    temp2.r = q__1.r, temp2.i = q__1.i;+/* L50: */+		}+		i__4 = j;+		i__2 = j;+		i__3 = kplus1 + j * a_dim1;+		r__1 = a[i__3].r;+		q__3.r = r__1 * temp1.r, q__3.i = r__1 * temp1.i;+		q__2.r = y[i__2].r + q__3.r, q__2.i = y[i__2].i + q__3.i;+		q__4.r = alpha->r * temp2.r - alpha->i * temp2.i, q__4.i = +			alpha->r * temp2.i + alpha->i * temp2.r;+		q__1.r = q__2.r + q__4.r, q__1.i = q__2.i + q__4.i;+		y[i__4].r = q__1.r, y[i__4].i = q__1.i;+/* L60: */+	    }+	} else {+	    jx = kx;+	    jy = ky;+	    i__1 = *n;+	    for (j = 1; j <= i__1; ++j) {+		i__4 = jx;+		q__1.r = alpha->r * x[i__4].r - alpha->i * x[i__4].i, q__1.i =+			 alpha->r * x[i__4].i + alpha->i * x[i__4].r;+		temp1.r = q__1.r, temp1.i = q__1.i;+		temp2.r = 0.f, temp2.i = 0.f;+		ix = kx;+		iy = ky;+		l = kplus1 - j;+/* Computing MAX */+		i__4 = 1, i__2 = j - *k;+		i__3 = j - 1;+		for (i__ = max(i__4,i__2); i__ <= i__3; ++i__) {+		    i__4 = iy;+		    i__2 = iy;+		    i__5 = l + i__ + j * a_dim1;+		    q__2.r = temp1.r * a[i__5].r - temp1.i * a[i__5].i, +			    q__2.i = temp1.r * a[i__5].i + temp1.i * a[i__5]+			    .r;+		    q__1.r = y[i__2].r + q__2.r, q__1.i = y[i__2].i + q__2.i;+		    y[i__4].r = q__1.r, y[i__4].i = q__1.i;+		    r_cnjg(&q__3, &a[l + i__ + j * a_dim1]);+		    i__4 = ix;+		    q__2.r = q__3.r * x[i__4].r - q__3.i * x[i__4].i, q__2.i =+			     q__3.r * x[i__4].i + q__3.i * x[i__4].r;+		    q__1.r = temp2.r + q__2.r, q__1.i = temp2.i + q__2.i;+		    temp2.r = q__1.r, temp2.i = q__1.i;+		    ix += *incx;+		    iy += *incy;+/* L70: */+		}+		i__3 = jy;+		i__4 = jy;+		i__2 = kplus1 + j * a_dim1;+		r__1 = a[i__2].r;+		q__3.r = r__1 * temp1.r, q__3.i = r__1 * temp1.i;+		q__2.r = y[i__4].r + q__3.r, q__2.i = y[i__4].i + q__3.i;+		q__4.r = alpha->r * temp2.r - alpha->i * temp2.i, q__4.i = +			alpha->r * temp2.i + alpha->i * temp2.r;+		q__1.r = q__2.r + q__4.r, q__1.i = q__2.i + q__4.i;+		y[i__3].r = q__1.r, y[i__3].i = q__1.i;+		jx += *incx;+		jy += *incy;+		if (j > *k) {+		    kx += *incx;+		    ky += *incy;+		}+/* L80: */+	    }+	}+    } else {++/*        Form  y  when lower triangle of A is stored. */++	if (*incx == 1 && *incy == 1) {+	    i__1 = *n;+	    for (j = 1; j <= i__1; ++j) {+		i__3 = j;+		q__1.r = alpha->r * x[i__3].r - alpha->i * x[i__3].i, q__1.i =+			 alpha->r * x[i__3].i + alpha->i * x[i__3].r;+		temp1.r = q__1.r, temp1.i = q__1.i;+		temp2.r = 0.f, temp2.i = 0.f;+		i__3 = j;+		i__4 = j;+		i__2 = j * a_dim1 + 1;+		r__1 = a[i__2].r;+		q__2.r = r__1 * temp1.r, q__2.i = r__1 * temp1.i;+		q__1.r = y[i__4].r + q__2.r, q__1.i = y[i__4].i + q__2.i;+		y[i__3].r = q__1.r, y[i__3].i = q__1.i;+		l = 1 - j;+/* Computing MIN */+		i__4 = *n, i__2 = j + *k;+		i__3 = min(i__4,i__2);+		for (i__ = j + 1; i__ <= i__3; ++i__) {+		    i__4 = i__;+		    i__2 = i__;+		    i__5 = l + i__ + j * a_dim1;+		    q__2.r = temp1.r * a[i__5].r - temp1.i * a[i__5].i, +			    q__2.i = temp1.r * a[i__5].i + temp1.i * a[i__5]+			    .r;+		    q__1.r = y[i__2].r + q__2.r, q__1.i = y[i__2].i + q__2.i;+		    y[i__4].r = q__1.r, y[i__4].i = q__1.i;+		    r_cnjg(&q__3, &a[l + i__ + j * a_dim1]);+		    i__4 = i__;+		    q__2.r = q__3.r * x[i__4].r - q__3.i * x[i__4].i, q__2.i =+			     q__3.r * x[i__4].i + q__3.i * x[i__4].r;+		    q__1.r = temp2.r + q__2.r, q__1.i = temp2.i + q__2.i;+		    temp2.r = q__1.r, temp2.i = q__1.i;+/* L90: */+		}+		i__3 = j;+		i__4 = j;+		q__2.r = alpha->r * temp2.r - alpha->i * temp2.i, q__2.i = +			alpha->r * temp2.i + alpha->i * temp2.r;+		q__1.r = y[i__4].r + q__2.r, q__1.i = y[i__4].i + q__2.i;+		y[i__3].r = q__1.r, y[i__3].i = q__1.i;+/* L100: */+	    }+	} else {+	    jx = kx;+	    jy = ky;+	    i__1 = *n;+	    for (j = 1; j <= i__1; ++j) {+		i__3 = jx;+		q__1.r = alpha->r * x[i__3].r - alpha->i * x[i__3].i, q__1.i =+			 alpha->r * x[i__3].i + alpha->i * x[i__3].r;+		temp1.r = q__1.r, temp1.i = q__1.i;+		temp2.r = 0.f, temp2.i = 0.f;+		i__3 = jy;+		i__4 = jy;+		i__2 = j * a_dim1 + 1;+		r__1 = a[i__2].r;+		q__2.r = r__1 * temp1.r, q__2.i = r__1 * temp1.i;+		q__1.r = y[i__4].r + q__2.r, q__1.i = y[i__4].i + q__2.i;+		y[i__3].r = q__1.r, y[i__3].i = q__1.i;+		l = 1 - j;+		ix = jx;+		iy = jy;+/* Computing MIN */+		i__4 = *n, i__2 = j + *k;+		i__3 = min(i__4,i__2);+		for (i__ = j + 1; i__ <= i__3; ++i__) {+		    ix += *incx;+		    iy += *incy;+		    i__4 = iy;+		    i__2 = iy;+		    i__5 = l + i__ + j * a_dim1;+		    q__2.r = temp1.r * a[i__5].r - temp1.i * a[i__5].i, +			    q__2.i = temp1.r * a[i__5].i + temp1.i * a[i__5]+			    .r;+		    q__1.r = y[i__2].r + q__2.r, q__1.i = y[i__2].i + q__2.i;+		    y[i__4].r = q__1.r, y[i__4].i = q__1.i;+		    r_cnjg(&q__3, &a[l + i__ + j * a_dim1]);+		    i__4 = ix;+		    q__2.r = q__3.r * x[i__4].r - q__3.i * x[i__4].i, q__2.i =+			     q__3.r * x[i__4].i + q__3.i * x[i__4].r;+		    q__1.r = temp2.r + q__2.r, q__1.i = temp2.i + q__2.i;+		    temp2.r = q__1.r, temp2.i = q__1.i;+/* L110: */+		}+		i__3 = jy;+		i__4 = jy;+		q__2.r = alpha->r * temp2.r - alpha->i * temp2.i, q__2.i = +			alpha->r * temp2.i + alpha->i * temp2.r;+		q__1.r = y[i__4].r + q__2.r, q__1.i = y[i__4].i + q__2.i;+		y[i__3].r = q__1.r, y[i__3].i = q__1.i;+		jx += *incx;+		jy += *incy;+/* L120: */+	    }+	}+    }++    return 0;++/*     End of CHBMV . */++} /* chbmv_ */+
+ eigen3/blas/f2c/chpmv.c view
@@ -0,0 +1,438 @@+/* chpmv.f -- translated by f2c (version 20100827).+   You must link the resulting object file with libf2c:+	on Microsoft Windows system, link with libf2c.lib;+	on Linux or Unix systems, link with .../path/to/libf2c.a -lm+	or, if you install libf2c.a in a standard place, with -lf2c -lm+	-- in that order, at the end of the command line, as in+		cc *.o -lf2c -lm+	Source for libf2c is in /netlib/f2c/libf2c.zip, e.g.,++		http://www.netlib.org/f2c/libf2c.zip+*/++#include "datatypes.h"++/* Subroutine */ int chpmv_(char *uplo, integer *n, complex *alpha, complex *+	ap, complex *x, integer *incx, complex *beta, complex *y, integer *+	incy, ftnlen uplo_len)+{+    /* System generated locals */+    integer i__1, i__2, i__3, i__4, i__5;+    real r__1;+    complex q__1, q__2, q__3, q__4;++    /* Builtin functions */+    void r_cnjg(complex *, complex *);++    /* Local variables */+    integer i__, j, k, kk, ix, iy, jx, jy, kx, ky, info;+    complex temp1, temp2;+    extern logical lsame_(char *, char *, ftnlen, ftnlen);+    extern /* Subroutine */ int xerbla_(char *, integer *, ftnlen);++/*     .. Scalar Arguments .. */+/*     .. */+/*     .. Array Arguments .. */+/*     .. */++/*  Purpose */+/*  ======= */++/*  CHPMV  performs the matrix-vector operation */++/*     y := alpha*A*x + beta*y, */++/*  where alpha and beta are scalars, x and y are n element vectors and */+/*  A is an n by n hermitian matrix, supplied in packed form. */++/*  Arguments */+/*  ========== */++/*  UPLO   - CHARACTER*1. */+/*           On entry, UPLO specifies whether the upper or lower */+/*           triangular part of the matrix A is supplied in the packed */+/*           array AP as follows: */++/*              UPLO = 'U' or 'u'   The upper triangular part of A is */+/*                                  supplied in AP. */++/*              UPLO = 'L' or 'l'   The lower triangular part of A is */+/*                                  supplied in AP. */++/*           Unchanged on exit. */++/*  N      - INTEGER. */+/*           On entry, N specifies the order of the matrix A. */+/*           N must be at least zero. */+/*           Unchanged on exit. */++/*  ALPHA  - COMPLEX         . */+/*           On entry, ALPHA specifies the scalar alpha. */+/*           Unchanged on exit. */++/*  AP     - COMPLEX          array of DIMENSION at least */+/*           ( ( n*( n + 1 ) )/2 ). */+/*           Before entry with UPLO = 'U' or 'u', the array AP must */+/*           contain the upper triangular part of the hermitian matrix */+/*           packed sequentially, column by column, so that AP( 1 ) */+/*           contains a( 1, 1 ), AP( 2 ) and AP( 3 ) contain a( 1, 2 ) */+/*           and a( 2, 2 ) respectively, and so on. */+/*           Before entry with UPLO = 'L' or 'l', the array AP must */+/*           contain the lower triangular part of the hermitian matrix */+/*           packed sequentially, column by column, so that AP( 1 ) */+/*           contains a( 1, 1 ), AP( 2 ) and AP( 3 ) contain a( 2, 1 ) */+/*           and a( 3, 1 ) respectively, and so on. */+/*           Note that the imaginary parts of the diagonal elements need */+/*           not be set and are assumed to be zero. */+/*           Unchanged on exit. */++/*  X      - COMPLEX          array of dimension at least */+/*           ( 1 + ( n - 1 )*abs( INCX ) ). */+/*           Before entry, the incremented array X must contain the n */+/*           element vector x. */+/*           Unchanged on exit. */++/*  INCX   - INTEGER. */+/*           On entry, INCX specifies the increment for the elements of */+/*           X. INCX must not be zero. */+/*           Unchanged on exit. */++/*  BETA   - COMPLEX         . */+/*           On entry, BETA specifies the scalar beta. When BETA is */+/*           supplied as zero then Y need not be set on input. */+/*           Unchanged on exit. */++/*  Y      - COMPLEX          array of dimension at least */+/*           ( 1 + ( n - 1 )*abs( INCY ) ). */+/*           Before entry, the incremented array Y must contain the n */+/*           element vector y. On exit, Y is overwritten by the updated */+/*           vector y. */++/*  INCY   - INTEGER. */+/*           On entry, INCY specifies the increment for the elements of */+/*           Y. INCY must not be zero. */+/*           Unchanged on exit. */++/*  Further Details */+/*  =============== */++/*  Level 2 Blas routine. */++/*  -- Written on 22-October-1986. */+/*     Jack Dongarra, Argonne National Lab. */+/*     Jeremy Du Croz, Nag Central Office. */+/*     Sven Hammarling, Nag Central Office. */+/*     Richard Hanson, Sandia National Labs. */++/*  ===================================================================== */++/*     .. Parameters .. */+/*     .. */+/*     .. Local Scalars .. */+/*     .. */+/*     .. External Functions .. */+/*     .. */+/*     .. External Subroutines .. */+/*     .. */+/*     .. Intrinsic Functions .. */+/*     .. */++/*     Test the input parameters. */++    /* Parameter adjustments */+    --y;+    --x;+    --ap;++    /* Function Body */+    info = 0;+    if (! lsame_(uplo, "U", (ftnlen)1, (ftnlen)1) && ! lsame_(uplo, "L", (+	    ftnlen)1, (ftnlen)1)) {+	info = 1;+    } else if (*n < 0) {+	info = 2;+    } else if (*incx == 0) {+	info = 6;+    } else if (*incy == 0) {+	info = 9;+    }+    if (info != 0) {+	xerbla_("CHPMV ", &info, (ftnlen)6);+	return 0;+    }++/*     Quick return if possible. */++    if (*n == 0 || (alpha->r == 0.f && alpha->i == 0.f && (beta->r == 1.f && +                                                           beta->i == 0.f))) {+	return 0;+    }++/*     Set up the start points in  X  and  Y. */++    if (*incx > 0) {+	kx = 1;+    } else {+	kx = 1 - (*n - 1) * *incx;+    }+    if (*incy > 0) {+	ky = 1;+    } else {+	ky = 1 - (*n - 1) * *incy;+    }++/*     Start the operations. In this version the elements of the array AP */+/*     are accessed sequentially with one pass through AP. */++/*     First form  y := beta*y. */++    if (beta->r != 1.f || beta->i != 0.f) {+	if (*incy == 1) {+	    if (beta->r == 0.f && beta->i == 0.f) {+		i__1 = *n;+		for (i__ = 1; i__ <= i__1; ++i__) {+		    i__2 = i__;+		    y[i__2].r = 0.f, y[i__2].i = 0.f;+/* L10: */+		}+	    } else {+		i__1 = *n;+		for (i__ = 1; i__ <= i__1; ++i__) {+		    i__2 = i__;+		    i__3 = i__;+		    q__1.r = beta->r * y[i__3].r - beta->i * y[i__3].i, +			    q__1.i = beta->r * y[i__3].i + beta->i * y[i__3]+			    .r;+		    y[i__2].r = q__1.r, y[i__2].i = q__1.i;+/* L20: */+		}+	    }+	} else {+	    iy = ky;+	    if (beta->r == 0.f && beta->i == 0.f) {+		i__1 = *n;+		for (i__ = 1; i__ <= i__1; ++i__) {+		    i__2 = iy;+		    y[i__2].r = 0.f, y[i__2].i = 0.f;+		    iy += *incy;+/* L30: */+		}+	    } else {+		i__1 = *n;+		for (i__ = 1; i__ <= i__1; ++i__) {+		    i__2 = iy;+		    i__3 = iy;+		    q__1.r = beta->r * y[i__3].r - beta->i * y[i__3].i, +			    q__1.i = beta->r * y[i__3].i + beta->i * y[i__3]+			    .r;+		    y[i__2].r = q__1.r, y[i__2].i = q__1.i;+		    iy += *incy;+/* L40: */+		}+	    }+	}+    }+    if (alpha->r == 0.f && alpha->i == 0.f) {+	return 0;+    }+    kk = 1;+    if (lsame_(uplo, "U", (ftnlen)1, (ftnlen)1)) {++/*        Form  y  when AP contains the upper triangle. */++	if (*incx == 1 && *incy == 1) {+	    i__1 = *n;+	    for (j = 1; j <= i__1; ++j) {+		i__2 = j;+		q__1.r = alpha->r * x[i__2].r - alpha->i * x[i__2].i, q__1.i =+			 alpha->r * x[i__2].i + alpha->i * x[i__2].r;+		temp1.r = q__1.r, temp1.i = q__1.i;+		temp2.r = 0.f, temp2.i = 0.f;+		k = kk;+		i__2 = j - 1;+		for (i__ = 1; i__ <= i__2; ++i__) {+		    i__3 = i__;+		    i__4 = i__;+		    i__5 = k;+		    q__2.r = temp1.r * ap[i__5].r - temp1.i * ap[i__5].i, +			    q__2.i = temp1.r * ap[i__5].i + temp1.i * ap[i__5]+			    .r;+		    q__1.r = y[i__4].r + q__2.r, q__1.i = y[i__4].i + q__2.i;+		    y[i__3].r = q__1.r, y[i__3].i = q__1.i;+		    r_cnjg(&q__3, &ap[k]);+		    i__3 = i__;+		    q__2.r = q__3.r * x[i__3].r - q__3.i * x[i__3].i, q__2.i =+			     q__3.r * x[i__3].i + q__3.i * x[i__3].r;+		    q__1.r = temp2.r + q__2.r, q__1.i = temp2.i + q__2.i;+		    temp2.r = q__1.r, temp2.i = q__1.i;+		    ++k;+/* L50: */+		}+		i__2 = j;+		i__3 = j;+		i__4 = kk + j - 1;+		r__1 = ap[i__4].r;+		q__3.r = r__1 * temp1.r, q__3.i = r__1 * temp1.i;+		q__2.r = y[i__3].r + q__3.r, q__2.i = y[i__3].i + q__3.i;+		q__4.r = alpha->r * temp2.r - alpha->i * temp2.i, q__4.i = +			alpha->r * temp2.i + alpha->i * temp2.r;+		q__1.r = q__2.r + q__4.r, q__1.i = q__2.i + q__4.i;+		y[i__2].r = q__1.r, y[i__2].i = q__1.i;+		kk += j;+/* L60: */+	    }+	} else {+	    jx = kx;+	    jy = ky;+	    i__1 = *n;+	    for (j = 1; j <= i__1; ++j) {+		i__2 = jx;+		q__1.r = alpha->r * x[i__2].r - alpha->i * x[i__2].i, q__1.i =+			 alpha->r * x[i__2].i + alpha->i * x[i__2].r;+		temp1.r = q__1.r, temp1.i = q__1.i;+		temp2.r = 0.f, temp2.i = 0.f;+		ix = kx;+		iy = ky;+		i__2 = kk + j - 2;+		for (k = kk; k <= i__2; ++k) {+		    i__3 = iy;+		    i__4 = iy;+		    i__5 = k;+		    q__2.r = temp1.r * ap[i__5].r - temp1.i * ap[i__5].i, +			    q__2.i = temp1.r * ap[i__5].i + temp1.i * ap[i__5]+			    .r;+		    q__1.r = y[i__4].r + q__2.r, q__1.i = y[i__4].i + q__2.i;+		    y[i__3].r = q__1.r, y[i__3].i = q__1.i;+		    r_cnjg(&q__3, &ap[k]);+		    i__3 = ix;+		    q__2.r = q__3.r * x[i__3].r - q__3.i * x[i__3].i, q__2.i =+			     q__3.r * x[i__3].i + q__3.i * x[i__3].r;+		    q__1.r = temp2.r + q__2.r, q__1.i = temp2.i + q__2.i;+		    temp2.r = q__1.r, temp2.i = q__1.i;+		    ix += *incx;+		    iy += *incy;+/* L70: */+		}+		i__2 = jy;+		i__3 = jy;+		i__4 = kk + j - 1;+		r__1 = ap[i__4].r;+		q__3.r = r__1 * temp1.r, q__3.i = r__1 * temp1.i;+		q__2.r = y[i__3].r + q__3.r, q__2.i = y[i__3].i + q__3.i;+		q__4.r = alpha->r * temp2.r - alpha->i * temp2.i, q__4.i = +			alpha->r * temp2.i + alpha->i * temp2.r;+		q__1.r = q__2.r + q__4.r, q__1.i = q__2.i + q__4.i;+		y[i__2].r = q__1.r, y[i__2].i = q__1.i;+		jx += *incx;+		jy += *incy;+		kk += j;+/* L80: */+	    }+	}+    } else {++/*        Form  y  when AP contains the lower triangle. */++	if (*incx == 1 && *incy == 1) {+	    i__1 = *n;+	    for (j = 1; j <= i__1; ++j) {+		i__2 = j;+		q__1.r = alpha->r * x[i__2].r - alpha->i * x[i__2].i, q__1.i =+			 alpha->r * x[i__2].i + alpha->i * x[i__2].r;+		temp1.r = q__1.r, temp1.i = q__1.i;+		temp2.r = 0.f, temp2.i = 0.f;+		i__2 = j;+		i__3 = j;+		i__4 = kk;+		r__1 = ap[i__4].r;+		q__2.r = r__1 * temp1.r, q__2.i = r__1 * temp1.i;+		q__1.r = y[i__3].r + q__2.r, q__1.i = y[i__3].i + q__2.i;+		y[i__2].r = q__1.r, y[i__2].i = q__1.i;+		k = kk + 1;+		i__2 = *n;+		for (i__ = j + 1; i__ <= i__2; ++i__) {+		    i__3 = i__;+		    i__4 = i__;+		    i__5 = k;+		    q__2.r = temp1.r * ap[i__5].r - temp1.i * ap[i__5].i, +			    q__2.i = temp1.r * ap[i__5].i + temp1.i * ap[i__5]+			    .r;+		    q__1.r = y[i__4].r + q__2.r, q__1.i = y[i__4].i + q__2.i;+		    y[i__3].r = q__1.r, y[i__3].i = q__1.i;+		    r_cnjg(&q__3, &ap[k]);+		    i__3 = i__;+		    q__2.r = q__3.r * x[i__3].r - q__3.i * x[i__3].i, q__2.i =+			     q__3.r * x[i__3].i + q__3.i * x[i__3].r;+		    q__1.r = temp2.r + q__2.r, q__1.i = temp2.i + q__2.i;+		    temp2.r = q__1.r, temp2.i = q__1.i;+		    ++k;+/* L90: */+		}+		i__2 = j;+		i__3 = j;+		q__2.r = alpha->r * temp2.r - alpha->i * temp2.i, q__2.i = +			alpha->r * temp2.i + alpha->i * temp2.r;+		q__1.r = y[i__3].r + q__2.r, q__1.i = y[i__3].i + q__2.i;+		y[i__2].r = q__1.r, y[i__2].i = q__1.i;+		kk += *n - j + 1;+/* L100: */+	    }+	} else {+	    jx = kx;+	    jy = ky;+	    i__1 = *n;+	    for (j = 1; j <= i__1; ++j) {+		i__2 = jx;+		q__1.r = alpha->r * x[i__2].r - alpha->i * x[i__2].i, q__1.i =+			 alpha->r * x[i__2].i + alpha->i * x[i__2].r;+		temp1.r = q__1.r, temp1.i = q__1.i;+		temp2.r = 0.f, temp2.i = 0.f;+		i__2 = jy;+		i__3 = jy;+		i__4 = kk;+		r__1 = ap[i__4].r;+		q__2.r = r__1 * temp1.r, q__2.i = r__1 * temp1.i;+		q__1.r = y[i__3].r + q__2.r, q__1.i = y[i__3].i + q__2.i;+		y[i__2].r = q__1.r, y[i__2].i = q__1.i;+		ix = jx;+		iy = jy;+		i__2 = kk + *n - j;+		for (k = kk + 1; k <= i__2; ++k) {+		    ix += *incx;+		    iy += *incy;+		    i__3 = iy;+		    i__4 = iy;+		    i__5 = k;+		    q__2.r = temp1.r * ap[i__5].r - temp1.i * ap[i__5].i, +			    q__2.i = temp1.r * ap[i__5].i + temp1.i * ap[i__5]+			    .r;+		    q__1.r = y[i__4].r + q__2.r, q__1.i = y[i__4].i + q__2.i;+		    y[i__3].r = q__1.r, y[i__3].i = q__1.i;+		    r_cnjg(&q__3, &ap[k]);+		    i__3 = ix;+		    q__2.r = q__3.r * x[i__3].r - q__3.i * x[i__3].i, q__2.i =+			     q__3.r * x[i__3].i + q__3.i * x[i__3].r;+		    q__1.r = temp2.r + q__2.r, q__1.i = temp2.i + q__2.i;+		    temp2.r = q__1.r, temp2.i = q__1.i;+/* L110: */+		}+		i__2 = jy;+		i__3 = jy;+		q__2.r = alpha->r * temp2.r - alpha->i * temp2.i, q__2.i = +			alpha->r * temp2.i + alpha->i * temp2.r;+		q__1.r = y[i__3].r + q__2.r, q__1.i = y[i__3].i + q__2.i;+		y[i__2].r = q__1.r, y[i__2].i = q__1.i;+		jx += *incx;+		jy += *incy;+		kk += *n - j + 1;+/* L120: */+	    }+	}+    }++    return 0;++/*     End of CHPMV . */++} /* chpmv_ */+
+ eigen3/blas/f2c/complexdots.c view
@@ -0,0 +1,84 @@+/* This file has been modified to use the standard gfortran calling+   convention, rather than the f2c calling convention.++   It does not require -ff2c when compiled with gfortran.+*/++/* complexdots.f -- translated by f2c (version 20100827).+   You must link the resulting object file with libf2c:+	on Microsoft Windows system, link with libf2c.lib;+	on Linux or Unix systems, link with .../path/to/libf2c.a -lm+	or, if you install libf2c.a in a standard place, with -lf2c -lm+	-- in that order, at the end of the command line, as in+		cc *.o -lf2c -lm+	Source for libf2c is in /netlib/f2c/libf2c.zip, e.g.,++		http://www.netlib.org/f2c/libf2c.zip+*/++#include "datatypes.h"++complex cdotc_(integer *n, complex *cx, integer +	*incx, complex *cy, integer *incy)+{+    complex res;+    extern /* Subroutine */ int cdotcw_(integer *, complex *, integer *, +	    complex *, integer *, complex *);++    /* Parameter adjustments */+    --cy;+    --cx;++    /* Function Body */+    cdotcw_(n, &cx[1], incx, &cy[1], incy, &res);+    return res;+} /* cdotc_ */++complex cdotu_(integer *n, complex *cx, integer +	*incx, complex *cy, integer *incy)+{+    complex res;+    extern /* Subroutine */ int cdotuw_(integer *, complex *, integer *, +	    complex *, integer *, complex *);++    /* Parameter adjustments */+    --cy;+    --cx;++    /* Function Body */+    cdotuw_(n, &cx[1], incx, &cy[1], incy, &res);+    return res;+} /* cdotu_ */++doublecomplex zdotc_(integer *n, doublecomplex *cx, integer *incx, +                     doublecomplex *cy, integer *incy)+{+    doublecomplex res;+    extern /* Subroutine */ int zdotcw_(integer *, doublecomplex *, integer *,+	     doublecomplex *, integer *, doublecomplex *);++    /* Parameter adjustments */+    --cy;+    --cx;++    /* Function Body */+    zdotcw_(n, &cx[1], incx, &cy[1], incy, &res);+    return res;+} /* zdotc_ */++doublecomplex zdotu_(integer *n, doublecomplex *cx, integer *incx, +                     doublecomplex *cy, integer *incy)+{+    doublecomplex res;+    extern /* Subroutine */ int zdotuw_(integer *, doublecomplex *, integer *,+	     doublecomplex *, integer *, doublecomplex *);++    /* Parameter adjustments */+    --cy;+    --cx;++    /* Function Body */+    zdotuw_(n, &cx[1], incx, &cy[1], incy, &res);+    return res;+} /* zdotu_ */+
+ eigen3/blas/f2c/ctbmv.c view
@@ -0,0 +1,647 @@+/* ctbmv.f -- translated by f2c (version 20100827).+   You must link the resulting object file with libf2c:+	on Microsoft Windows system, link with libf2c.lib;+	on Linux or Unix systems, link with .../path/to/libf2c.a -lm+	or, if you install libf2c.a in a standard place, with -lf2c -lm+	-- in that order, at the end of the command line, as in+		cc *.o -lf2c -lm+	Source for libf2c is in /netlib/f2c/libf2c.zip, e.g.,++		http://www.netlib.org/f2c/libf2c.zip+*/++#include "datatypes.h"++/* Subroutine */ int ctbmv_(char *uplo, char *trans, char *diag, integer *n, +	integer *k, complex *a, integer *lda, complex *x, integer *incx, +	ftnlen uplo_len, ftnlen trans_len, ftnlen diag_len)+{+    /* System generated locals */+    integer a_dim1, a_offset, i__1, i__2, i__3, i__4, i__5;+    complex q__1, q__2, q__3;++    /* Builtin functions */+    void r_cnjg(complex *, complex *);++    /* Local variables */+    integer i__, j, l, ix, jx, kx, info;+    complex temp;+    extern logical lsame_(char *, char *, ftnlen, ftnlen);+    integer kplus1;+    extern /* Subroutine */ int xerbla_(char *, integer *, ftnlen);+    logical noconj, nounit;++/*     .. Scalar Arguments .. */+/*     .. */+/*     .. Array Arguments .. */+/*     .. */++/*  Purpose */+/*  ======= */++/*  CTBMV  performs one of the matrix-vector operations */++/*     x := A*x,   or   x := A'*x,   or   x := conjg( A' )*x, */++/*  where x is an n element vector and  A is an n by n unit, or non-unit, */+/*  upper or lower triangular band matrix, with ( k + 1 ) diagonals. */++/*  Arguments */+/*  ========== */++/*  UPLO   - CHARACTER*1. */+/*           On entry, UPLO specifies whether the matrix is an upper or */+/*           lower triangular matrix as follows: */++/*              UPLO = 'U' or 'u'   A is an upper triangular matrix. */++/*              UPLO = 'L' or 'l'   A is a lower triangular matrix. */++/*           Unchanged on exit. */++/*  TRANS  - CHARACTER*1. */+/*           On entry, TRANS specifies the operation to be performed as */+/*           follows: */++/*              TRANS = 'N' or 'n'   x := A*x. */++/*              TRANS = 'T' or 't'   x := A'*x. */++/*              TRANS = 'C' or 'c'   x := conjg( A' )*x. */++/*           Unchanged on exit. */++/*  DIAG   - CHARACTER*1. */+/*           On entry, DIAG specifies whether or not A is unit */+/*           triangular as follows: */++/*              DIAG = 'U' or 'u'   A is assumed to be unit triangular. */++/*              DIAG = 'N' or 'n'   A is not assumed to be unit */+/*                                  triangular. */++/*           Unchanged on exit. */++/*  N      - INTEGER. */+/*           On entry, N specifies the order of the matrix A. */+/*           N must be at least zero. */+/*           Unchanged on exit. */++/*  K      - INTEGER. */+/*           On entry with UPLO = 'U' or 'u', K specifies the number of */+/*           super-diagonals of the matrix A. */+/*           On entry with UPLO = 'L' or 'l', K specifies the number of */+/*           sub-diagonals of the matrix A. */+/*           K must satisfy  0 .le. K. */+/*           Unchanged on exit. */++/*  A      - COMPLEX          array of DIMENSION ( LDA, n ). */+/*           Before entry with UPLO = 'U' or 'u', the leading ( k + 1 ) */+/*           by n part of the array A must contain the upper triangular */+/*           band part of the matrix of coefficients, supplied column by */+/*           column, with the leading diagonal of the matrix in row */+/*           ( k + 1 ) of the array, the first super-diagonal starting at */+/*           position 2 in row k, and so on. The top left k by k triangle */+/*           of the array A is not referenced. */+/*           The following program segment will transfer an upper */+/*           triangular band matrix from conventional full matrix storage */+/*           to band storage: */++/*                 DO 20, J = 1, N */+/*                    M = K + 1 - J */+/*                    DO 10, I = MAX( 1, J - K ), J */+/*                       A( M + I, J ) = matrix( I, J ) */+/*              10    CONTINUE */+/*              20 CONTINUE */++/*           Before entry with UPLO = 'L' or 'l', the leading ( k + 1 ) */+/*           by n part of the array A must contain the lower triangular */+/*           band part of the matrix of coefficients, supplied column by */+/*           column, with the leading diagonal of the matrix in row 1 of */+/*           the array, the first sub-diagonal starting at position 1 in */+/*           row 2, and so on. The bottom right k by k triangle of the */+/*           array A is not referenced. */+/*           The following program segment will transfer a lower */+/*           triangular band matrix from conventional full matrix storage */+/*           to band storage: */++/*                 DO 20, J = 1, N */+/*                    M = 1 - J */+/*                    DO 10, I = J, MIN( N, J + K ) */+/*                       A( M + I, J ) = matrix( I, J ) */+/*              10    CONTINUE */+/*              20 CONTINUE */++/*           Note that when DIAG = 'U' or 'u' the elements of the array A */+/*           corresponding to the diagonal elements of the matrix are not */+/*           referenced, but are assumed to be unity. */+/*           Unchanged on exit. */++/*  LDA    - INTEGER. */+/*           On entry, LDA specifies the first dimension of A as declared */+/*           in the calling (sub) program. LDA must be at least */+/*           ( k + 1 ). */+/*           Unchanged on exit. */++/*  X      - COMPLEX          array of dimension at least */+/*           ( 1 + ( n - 1 )*abs( INCX ) ). */+/*           Before entry, the incremented array X must contain the n */+/*           element vector x. On exit, X is overwritten with the */+/*           tranformed vector x. */++/*  INCX   - INTEGER. */+/*           On entry, INCX specifies the increment for the elements of */+/*           X. INCX must not be zero. */+/*           Unchanged on exit. */++/*  Further Details */+/*  =============== */++/*  Level 2 Blas routine. */++/*  -- Written on 22-October-1986. */+/*     Jack Dongarra, Argonne National Lab. */+/*     Jeremy Du Croz, Nag Central Office. */+/*     Sven Hammarling, Nag Central Office. */+/*     Richard Hanson, Sandia National Labs. */++/*  ===================================================================== */++/*     .. Parameters .. */+/*     .. */+/*     .. Local Scalars .. */+/*     .. */+/*     .. External Functions .. */+/*     .. */+/*     .. External Subroutines .. */+/*     .. */+/*     .. Intrinsic Functions .. */+/*     .. */++/*     Test the input parameters. */++    /* Parameter adjustments */+    a_dim1 = *lda;+    a_offset = 1 + a_dim1;+    a -= a_offset;+    --x;++    /* Function Body */+    info = 0;+    if (! lsame_(uplo, "U", (ftnlen)1, (ftnlen)1) && ! lsame_(uplo, "L", (+	    ftnlen)1, (ftnlen)1)) {+	info = 1;+    } else if (! lsame_(trans, "N", (ftnlen)1, (ftnlen)1) && ! lsame_(trans, +	    "T", (ftnlen)1, (ftnlen)1) && ! lsame_(trans, "C", (ftnlen)1, (+	    ftnlen)1)) {+	info = 2;+    } else if (! lsame_(diag, "U", (ftnlen)1, (ftnlen)1) && ! lsame_(diag, +	    "N", (ftnlen)1, (ftnlen)1)) {+	info = 3;+    } else if (*n < 0) {+	info = 4;+    } else if (*k < 0) {+	info = 5;+    } else if (*lda < *k + 1) {+	info = 7;+    } else if (*incx == 0) {+	info = 9;+    }+    if (info != 0) {+	xerbla_("CTBMV ", &info, (ftnlen)6);+	return 0;+    }++/*     Quick return if possible. */++    if (*n == 0) {+	return 0;+    }++    noconj = lsame_(trans, "T", (ftnlen)1, (ftnlen)1);+    nounit = lsame_(diag, "N", (ftnlen)1, (ftnlen)1);++/*     Set up the start point in X if the increment is not unity. This */+/*     will be  ( N - 1 )*INCX   too small for descending loops. */++    if (*incx <= 0) {+	kx = 1 - (*n - 1) * *incx;+    } else if (*incx != 1) {+	kx = 1;+    }++/*     Start the operations. In this version the elements of A are */+/*     accessed sequentially with one pass through A. */++    if (lsame_(trans, "N", (ftnlen)1, (ftnlen)1)) {++/*         Form  x := A*x. */++	if (lsame_(uplo, "U", (ftnlen)1, (ftnlen)1)) {+	    kplus1 = *k + 1;+	    if (*incx == 1) {+		i__1 = *n;+		for (j = 1; j <= i__1; ++j) {+		    i__2 = j;+		    if (x[i__2].r != 0.f || x[i__2].i != 0.f) {+			i__2 = j;+			temp.r = x[i__2].r, temp.i = x[i__2].i;+			l = kplus1 - j;+/* Computing MAX */+			i__2 = 1, i__3 = j - *k;+			i__4 = j - 1;+			for (i__ = max(i__2,i__3); i__ <= i__4; ++i__) {+			    i__2 = i__;+			    i__3 = i__;+			    i__5 = l + i__ + j * a_dim1;+			    q__2.r = temp.r * a[i__5].r - temp.i * a[i__5].i, +				    q__2.i = temp.r * a[i__5].i + temp.i * a[+				    i__5].r;+			    q__1.r = x[i__3].r + q__2.r, q__1.i = x[i__3].i + +				    q__2.i;+			    x[i__2].r = q__1.r, x[i__2].i = q__1.i;+/* L10: */+			}+			if (nounit) {+			    i__4 = j;+			    i__2 = j;+			    i__3 = kplus1 + j * a_dim1;+			    q__1.r = x[i__2].r * a[i__3].r - x[i__2].i * a[+				    i__3].i, q__1.i = x[i__2].r * a[i__3].i + +				    x[i__2].i * a[i__3].r;+			    x[i__4].r = q__1.r, x[i__4].i = q__1.i;+			}+		    }+/* L20: */+		}+	    } else {+		jx = kx;+		i__1 = *n;+		for (j = 1; j <= i__1; ++j) {+		    i__4 = jx;+		    if (x[i__4].r != 0.f || x[i__4].i != 0.f) {+			i__4 = jx;+			temp.r = x[i__4].r, temp.i = x[i__4].i;+			ix = kx;+			l = kplus1 - j;+/* Computing MAX */+			i__4 = 1, i__2 = j - *k;+			i__3 = j - 1;+			for (i__ = max(i__4,i__2); i__ <= i__3; ++i__) {+			    i__4 = ix;+			    i__2 = ix;+			    i__5 = l + i__ + j * a_dim1;+			    q__2.r = temp.r * a[i__5].r - temp.i * a[i__5].i, +				    q__2.i = temp.r * a[i__5].i + temp.i * a[+				    i__5].r;+			    q__1.r = x[i__2].r + q__2.r, q__1.i = x[i__2].i + +				    q__2.i;+			    x[i__4].r = q__1.r, x[i__4].i = q__1.i;+			    ix += *incx;+/* L30: */+			}+			if (nounit) {+			    i__3 = jx;+			    i__4 = jx;+			    i__2 = kplus1 + j * a_dim1;+			    q__1.r = x[i__4].r * a[i__2].r - x[i__4].i * a[+				    i__2].i, q__1.i = x[i__4].r * a[i__2].i + +				    x[i__4].i * a[i__2].r;+			    x[i__3].r = q__1.r, x[i__3].i = q__1.i;+			}+		    }+		    jx += *incx;+		    if (j > *k) {+			kx += *incx;+		    }+/* L40: */+		}+	    }+	} else {+	    if (*incx == 1) {+		for (j = *n; j >= 1; --j) {+		    i__1 = j;+		    if (x[i__1].r != 0.f || x[i__1].i != 0.f) {+			i__1 = j;+			temp.r = x[i__1].r, temp.i = x[i__1].i;+			l = 1 - j;+/* Computing MIN */+			i__1 = *n, i__3 = j + *k;+			i__4 = j + 1;+			for (i__ = min(i__1,i__3); i__ >= i__4; --i__) {+			    i__1 = i__;+			    i__3 = i__;+			    i__2 = l + i__ + j * a_dim1;+			    q__2.r = temp.r * a[i__2].r - temp.i * a[i__2].i, +				    q__2.i = temp.r * a[i__2].i + temp.i * a[+				    i__2].r;+			    q__1.r = x[i__3].r + q__2.r, q__1.i = x[i__3].i + +				    q__2.i;+			    x[i__1].r = q__1.r, x[i__1].i = q__1.i;+/* L50: */+			}+			if (nounit) {+			    i__4 = j;+			    i__1 = j;+			    i__3 = j * a_dim1 + 1;+			    q__1.r = x[i__1].r * a[i__3].r - x[i__1].i * a[+				    i__3].i, q__1.i = x[i__1].r * a[i__3].i + +				    x[i__1].i * a[i__3].r;+			    x[i__4].r = q__1.r, x[i__4].i = q__1.i;+			}+		    }+/* L60: */+		}+	    } else {+		kx += (*n - 1) * *incx;+		jx = kx;+		for (j = *n; j >= 1; --j) {+		    i__4 = jx;+		    if (x[i__4].r != 0.f || x[i__4].i != 0.f) {+			i__4 = jx;+			temp.r = x[i__4].r, temp.i = x[i__4].i;+			ix = kx;+			l = 1 - j;+/* Computing MIN */+			i__4 = *n, i__1 = j + *k;+			i__3 = j + 1;+			for (i__ = min(i__4,i__1); i__ >= i__3; --i__) {+			    i__4 = ix;+			    i__1 = ix;+			    i__2 = l + i__ + j * a_dim1;+			    q__2.r = temp.r * a[i__2].r - temp.i * a[i__2].i, +				    q__2.i = temp.r * a[i__2].i + temp.i * a[+				    i__2].r;+			    q__1.r = x[i__1].r + q__2.r, q__1.i = x[i__1].i + +				    q__2.i;+			    x[i__4].r = q__1.r, x[i__4].i = q__1.i;+			    ix -= *incx;+/* L70: */+			}+			if (nounit) {+			    i__3 = jx;+			    i__4 = jx;+			    i__1 = j * a_dim1 + 1;+			    q__1.r = x[i__4].r * a[i__1].r - x[i__4].i * a[+				    i__1].i, q__1.i = x[i__4].r * a[i__1].i + +				    x[i__4].i * a[i__1].r;+			    x[i__3].r = q__1.r, x[i__3].i = q__1.i;+			}+		    }+		    jx -= *incx;+		    if (*n - j >= *k) {+			kx -= *incx;+		    }+/* L80: */+		}+	    }+	}+    } else {++/*        Form  x := A'*x  or  x := conjg( A' )*x. */++	if (lsame_(uplo, "U", (ftnlen)1, (ftnlen)1)) {+	    kplus1 = *k + 1;+	    if (*incx == 1) {+		for (j = *n; j >= 1; --j) {+		    i__3 = j;+		    temp.r = x[i__3].r, temp.i = x[i__3].i;+		    l = kplus1 - j;+		    if (noconj) {+			if (nounit) {+			    i__3 = kplus1 + j * a_dim1;+			    q__1.r = temp.r * a[i__3].r - temp.i * a[i__3].i, +				    q__1.i = temp.r * a[i__3].i + temp.i * a[+				    i__3].r;+			    temp.r = q__1.r, temp.i = q__1.i;+			}+/* Computing MAX */+			i__4 = 1, i__1 = j - *k;+			i__3 = max(i__4,i__1);+			for (i__ = j - 1; i__ >= i__3; --i__) {+			    i__4 = l + i__ + j * a_dim1;+			    i__1 = i__;+			    q__2.r = a[i__4].r * x[i__1].r - a[i__4].i * x[+				    i__1].i, q__2.i = a[i__4].r * x[i__1].i + +				    a[i__4].i * x[i__1].r;+			    q__1.r = temp.r + q__2.r, q__1.i = temp.i + +				    q__2.i;+			    temp.r = q__1.r, temp.i = q__1.i;+/* L90: */+			}+		    } else {+			if (nounit) {+			    r_cnjg(&q__2, &a[kplus1 + j * a_dim1]);+			    q__1.r = temp.r * q__2.r - temp.i * q__2.i, +				    q__1.i = temp.r * q__2.i + temp.i * +				    q__2.r;+			    temp.r = q__1.r, temp.i = q__1.i;+			}+/* Computing MAX */+			i__4 = 1, i__1 = j - *k;+			i__3 = max(i__4,i__1);+			for (i__ = j - 1; i__ >= i__3; --i__) {+			    r_cnjg(&q__3, &a[l + i__ + j * a_dim1]);+			    i__4 = i__;+			    q__2.r = q__3.r * x[i__4].r - q__3.i * x[i__4].i, +				    q__2.i = q__3.r * x[i__4].i + q__3.i * x[+				    i__4].r;+			    q__1.r = temp.r + q__2.r, q__1.i = temp.i + +				    q__2.i;+			    temp.r = q__1.r, temp.i = q__1.i;+/* L100: */+			}+		    }+		    i__3 = j;+		    x[i__3].r = temp.r, x[i__3].i = temp.i;+/* L110: */+		}+	    } else {+		kx += (*n - 1) * *incx;+		jx = kx;+		for (j = *n; j >= 1; --j) {+		    i__3 = jx;+		    temp.r = x[i__3].r, temp.i = x[i__3].i;+		    kx -= *incx;+		    ix = kx;+		    l = kplus1 - j;+		    if (noconj) {+			if (nounit) {+			    i__3 = kplus1 + j * a_dim1;+			    q__1.r = temp.r * a[i__3].r - temp.i * a[i__3].i, +				    q__1.i = temp.r * a[i__3].i + temp.i * a[+				    i__3].r;+			    temp.r = q__1.r, temp.i = q__1.i;+			}+/* Computing MAX */+			i__4 = 1, i__1 = j - *k;+			i__3 = max(i__4,i__1);+			for (i__ = j - 1; i__ >= i__3; --i__) {+			    i__4 = l + i__ + j * a_dim1;+			    i__1 = ix;+			    q__2.r = a[i__4].r * x[i__1].r - a[i__4].i * x[+				    i__1].i, q__2.i = a[i__4].r * x[i__1].i + +				    a[i__4].i * x[i__1].r;+			    q__1.r = temp.r + q__2.r, q__1.i = temp.i + +				    q__2.i;+			    temp.r = q__1.r, temp.i = q__1.i;+			    ix -= *incx;+/* L120: */+			}+		    } else {+			if (nounit) {+			    r_cnjg(&q__2, &a[kplus1 + j * a_dim1]);+			    q__1.r = temp.r * q__2.r - temp.i * q__2.i, +				    q__1.i = temp.r * q__2.i + temp.i * +				    q__2.r;+			    temp.r = q__1.r, temp.i = q__1.i;+			}+/* Computing MAX */+			i__4 = 1, i__1 = j - *k;+			i__3 = max(i__4,i__1);+			for (i__ = j - 1; i__ >= i__3; --i__) {+			    r_cnjg(&q__3, &a[l + i__ + j * a_dim1]);+			    i__4 = ix;+			    q__2.r = q__3.r * x[i__4].r - q__3.i * x[i__4].i, +				    q__2.i = q__3.r * x[i__4].i + q__3.i * x[+				    i__4].r;+			    q__1.r = temp.r + q__2.r, q__1.i = temp.i + +				    q__2.i;+			    temp.r = q__1.r, temp.i = q__1.i;+			    ix -= *incx;+/* L130: */+			}+		    }+		    i__3 = jx;+		    x[i__3].r = temp.r, x[i__3].i = temp.i;+		    jx -= *incx;+/* L140: */+		}+	    }+	} else {+	    if (*incx == 1) {+		i__3 = *n;+		for (j = 1; j <= i__3; ++j) {+		    i__4 = j;+		    temp.r = x[i__4].r, temp.i = x[i__4].i;+		    l = 1 - j;+		    if (noconj) {+			if (nounit) {+			    i__4 = j * a_dim1 + 1;+			    q__1.r = temp.r * a[i__4].r - temp.i * a[i__4].i, +				    q__1.i = temp.r * a[i__4].i + temp.i * a[+				    i__4].r;+			    temp.r = q__1.r, temp.i = q__1.i;+			}+/* Computing MIN */+			i__1 = *n, i__2 = j + *k;+			i__4 = min(i__1,i__2);+			for (i__ = j + 1; i__ <= i__4; ++i__) {+			    i__1 = l + i__ + j * a_dim1;+			    i__2 = i__;+			    q__2.r = a[i__1].r * x[i__2].r - a[i__1].i * x[+				    i__2].i, q__2.i = a[i__1].r * x[i__2].i + +				    a[i__1].i * x[i__2].r;+			    q__1.r = temp.r + q__2.r, q__1.i = temp.i + +				    q__2.i;+			    temp.r = q__1.r, temp.i = q__1.i;+/* L150: */+			}+		    } else {+			if (nounit) {+			    r_cnjg(&q__2, &a[j * a_dim1 + 1]);+			    q__1.r = temp.r * q__2.r - temp.i * q__2.i, +				    q__1.i = temp.r * q__2.i + temp.i * +				    q__2.r;+			    temp.r = q__1.r, temp.i = q__1.i;+			}+/* Computing MIN */+			i__1 = *n, i__2 = j + *k;+			i__4 = min(i__1,i__2);+			for (i__ = j + 1; i__ <= i__4; ++i__) {+			    r_cnjg(&q__3, &a[l + i__ + j * a_dim1]);+			    i__1 = i__;+			    q__2.r = q__3.r * x[i__1].r - q__3.i * x[i__1].i, +				    q__2.i = q__3.r * x[i__1].i + q__3.i * x[+				    i__1].r;+			    q__1.r = temp.r + q__2.r, q__1.i = temp.i + +				    q__2.i;+			    temp.r = q__1.r, temp.i = q__1.i;+/* L160: */+			}+		    }+		    i__4 = j;+		    x[i__4].r = temp.r, x[i__4].i = temp.i;+/* L170: */+		}+	    } else {+		jx = kx;+		i__3 = *n;+		for (j = 1; j <= i__3; ++j) {+		    i__4 = jx;+		    temp.r = x[i__4].r, temp.i = x[i__4].i;+		    kx += *incx;+		    ix = kx;+		    l = 1 - j;+		    if (noconj) {+			if (nounit) {+			    i__4 = j * a_dim1 + 1;+			    q__1.r = temp.r * a[i__4].r - temp.i * a[i__4].i, +				    q__1.i = temp.r * a[i__4].i + temp.i * a[+				    i__4].r;+			    temp.r = q__1.r, temp.i = q__1.i;+			}+/* Computing MIN */+			i__1 = *n, i__2 = j + *k;+			i__4 = min(i__1,i__2);+			for (i__ = j + 1; i__ <= i__4; ++i__) {+			    i__1 = l + i__ + j * a_dim1;+			    i__2 = ix;+			    q__2.r = a[i__1].r * x[i__2].r - a[i__1].i * x[+				    i__2].i, q__2.i = a[i__1].r * x[i__2].i + +				    a[i__1].i * x[i__2].r;+			    q__1.r = temp.r + q__2.r, q__1.i = temp.i + +				    q__2.i;+			    temp.r = q__1.r, temp.i = q__1.i;+			    ix += *incx;+/* L180: */+			}+		    } else {+			if (nounit) {+			    r_cnjg(&q__2, &a[j * a_dim1 + 1]);+			    q__1.r = temp.r * q__2.r - temp.i * q__2.i, +				    q__1.i = temp.r * q__2.i + temp.i * +				    q__2.r;+			    temp.r = q__1.r, temp.i = q__1.i;+			}+/* Computing MIN */+			i__1 = *n, i__2 = j + *k;+			i__4 = min(i__1,i__2);+			for (i__ = j + 1; i__ <= i__4; ++i__) {+			    r_cnjg(&q__3, &a[l + i__ + j * a_dim1]);+			    i__1 = ix;+			    q__2.r = q__3.r * x[i__1].r - q__3.i * x[i__1].i, +				    q__2.i = q__3.r * x[i__1].i + q__3.i * x[+				    i__1].r;+			    q__1.r = temp.r + q__2.r, q__1.i = temp.i + +				    q__2.i;+			    temp.r = q__1.r, temp.i = q__1.i;+			    ix += *incx;+/* L190: */+			}+		    }+		    i__4 = jx;+		    x[i__4].r = temp.r, x[i__4].i = temp.i;+		    jx += *incx;+/* L200: */+		}+	    }+	}+    }++    return 0;++/*     End of CTBMV . */++} /* ctbmv_ */+
+ eigen3/blas/f2c/d_cnjg.c view
@@ -0,0 +1,6 @@+#include "datatypes.h"    ++void d_cnjg(doublecomplex *r, doublecomplex *z) {+    r->r = z->r;+    r->i = -(z->i);+}
+ eigen3/blas/f2c/datatypes.h view
@@ -0,0 +1,24 @@+/* This contains a limited subset of the typedefs exposed by f2c+   for use by the Eigen BLAS C-only implementation.+*/++#ifndef __EIGEN_DATATYPES_H__+#define __EIGEN_DATATYPES_H__++typedef int integer;+typedef unsigned int uinteger;+typedef float real;+typedef double doublereal;+typedef struct { real r, i; } complex;+typedef struct { doublereal r, i; } doublecomplex;+typedef int ftnlen;+typedef int logical;++#define abs(x) ((x) >= 0 ? (x) : -(x))+#define dabs(x) (doublereal)abs(x)+#define min(a,b) ((a) <= (b) ? (a) : (b))+#define max(a,b) ((a) >= (b) ? (a) : (b))+#define dmin(a,b) (doublereal)min(a,b)+#define dmax(a,b) (doublereal)max(a,b)++#endif
+ eigen3/blas/f2c/drotm.c view
@@ -0,0 +1,215 @@+/* drotm.f -- translated by f2c (version 20100827).+   You must link the resulting object file with libf2c:+	on Microsoft Windows system, link with libf2c.lib;+	on Linux or Unix systems, link with .../path/to/libf2c.a -lm+	or, if you install libf2c.a in a standard place, with -lf2c -lm+	-- in that order, at the end of the command line, as in+		cc *.o -lf2c -lm+	Source for libf2c is in /netlib/f2c/libf2c.zip, e.g.,++		http://www.netlib.org/f2c/libf2c.zip+*/++#include "datatypes.h"++/* Subroutine */ int drotm_(integer *n, doublereal *dx, integer *incx, +	doublereal *dy, integer *incy, doublereal *dparam)+{+    /* Initialized data */++    static doublereal zero = 0.;+    static doublereal two = 2.;++    /* System generated locals */+    integer i__1, i__2;++    /* Local variables */+    integer i__;+    doublereal w, z__;+    integer kx, ky;+    doublereal dh11, dh12, dh21, dh22, dflag;+    integer nsteps;++/*     .. Scalar Arguments .. */+/*     .. */+/*     .. Array Arguments .. */+/*     .. */++/*  Purpose */+/*  ======= */++/*     APPLY THE MODIFIED GIVENS TRANSFORMATION, H, TO THE 2 BY N MATRIX */++/*     (DX**T) , WHERE **T INDICATES TRANSPOSE. THE ELEMENTS OF DX ARE IN */+/*     (DY**T) */++/*     DX(LX+I*INCX), I = 0 TO N-1, WHERE LX = 1 IF INCX .GE. 0, ELSE */+/*     LX = (-INCX)*N, AND SIMILARLY FOR SY USING LY AND INCY. */+/*     WITH DPARAM(1)=DFLAG, H HAS ONE OF THE FOLLOWING FORMS.. */++/*     DFLAG=-1.D0     DFLAG=0.D0        DFLAG=1.D0     DFLAG=-2.D0 */++/*       (DH11  DH12)    (1.D0  DH12)    (DH11  1.D0)    (1.D0  0.D0) */+/*     H=(          )    (          )    (          )    (          ) */+/*       (DH21  DH22),   (DH21  1.D0),   (-1.D0 DH22),   (0.D0  1.D0). */+/*     SEE DROTMG FOR A DESCRIPTION OF DATA STORAGE IN DPARAM. */++/*  Arguments */+/*  ========= */++/*  N      (input) INTEGER */+/*         number of elements in input vector(s) */++/*  DX     (input/output) DOUBLE PRECISION array, dimension N */+/*         double precision vector with N elements */++/*  INCX   (input) INTEGER */+/*         storage spacing between elements of DX */++/*  DY     (input/output) DOUBLE PRECISION array, dimension N */+/*         double precision vector with N elements */++/*  INCY   (input) INTEGER */+/*         storage spacing between elements of DY */++/*  DPARAM (input/output)  DOUBLE PRECISION array, dimension 5 */+/*     DPARAM(1)=DFLAG */+/*     DPARAM(2)=DH11 */+/*     DPARAM(3)=DH21 */+/*     DPARAM(4)=DH12 */+/*     DPARAM(5)=DH22 */++/*  ===================================================================== */++/*     .. Local Scalars .. */+/*     .. */+/*     .. Data statements .. */+    /* Parameter adjustments */+    --dparam;+    --dy;+    --dx;++    /* Function Body */+/*     .. */++    dflag = dparam[1];+    if (*n <= 0 || dflag + two == zero) {+	goto L140;+    }+    if (! (*incx == *incy && *incx > 0)) {+	goto L70;+    }++    nsteps = *n * *incx;+    if (dflag < 0.) {+	goto L50;+    } else if (dflag == 0) {+	goto L10;+    } else {+	goto L30;+    }+L10:+    dh12 = dparam[4];+    dh21 = dparam[3];+    i__1 = nsteps;+    i__2 = *incx;+    for (i__ = 1; i__2 < 0 ? i__ >= i__1 : i__ <= i__1; i__ += i__2) {+	w = dx[i__];+	z__ = dy[i__];+	dx[i__] = w + z__ * dh12;+	dy[i__] = w * dh21 + z__;+/* L20: */+    }+    goto L140;+L30:+    dh11 = dparam[2];+    dh22 = dparam[5];+    i__2 = nsteps;+    i__1 = *incx;+    for (i__ = 1; i__1 < 0 ? i__ >= i__2 : i__ <= i__2; i__ += i__1) {+	w = dx[i__];+	z__ = dy[i__];+	dx[i__] = w * dh11 + z__;+	dy[i__] = -w + dh22 * z__;+/* L40: */+    }+    goto L140;+L50:+    dh11 = dparam[2];+    dh12 = dparam[4];+    dh21 = dparam[3];+    dh22 = dparam[5];+    i__1 = nsteps;+    i__2 = *incx;+    for (i__ = 1; i__2 < 0 ? i__ >= i__1 : i__ <= i__1; i__ += i__2) {+	w = dx[i__];+	z__ = dy[i__];+	dx[i__] = w * dh11 + z__ * dh12;+	dy[i__] = w * dh21 + z__ * dh22;+/* L60: */+    }+    goto L140;+L70:+    kx = 1;+    ky = 1;+    if (*incx < 0) {+	kx = (1 - *n) * *incx + 1;+    }+    if (*incy < 0) {+	ky = (1 - *n) * *incy + 1;+    }++    if (dflag < 0.) {+	goto L120;+    } else if (dflag == 0) {+	goto L80;+    } else {+	goto L100;+    }+L80:+    dh12 = dparam[4];+    dh21 = dparam[3];+    i__2 = *n;+    for (i__ = 1; i__ <= i__2; ++i__) {+	w = dx[kx];+	z__ = dy[ky];+	dx[kx] = w + z__ * dh12;+	dy[ky] = w * dh21 + z__;+	kx += *incx;+	ky += *incy;+/* L90: */+    }+    goto L140;+L100:+    dh11 = dparam[2];+    dh22 = dparam[5];+    i__2 = *n;+    for (i__ = 1; i__ <= i__2; ++i__) {+	w = dx[kx];+	z__ = dy[ky];+	dx[kx] = w * dh11 + z__;+	dy[ky] = -w + dh22 * z__;+	kx += *incx;+	ky += *incy;+/* L110: */+    }+    goto L140;+L120:+    dh11 = dparam[2];+    dh12 = dparam[4];+    dh21 = dparam[3];+    dh22 = dparam[5];+    i__2 = *n;+    for (i__ = 1; i__ <= i__2; ++i__) {+	w = dx[kx];+	z__ = dy[ky];+	dx[kx] = w * dh11 + z__ * dh12;+	dy[ky] = w * dh21 + z__ * dh22;+	kx += *incx;+	ky += *incy;+/* L130: */+    }+L140:+    return 0;+} /* drotm_ */+
+ eigen3/blas/f2c/drotmg.c view
@@ -0,0 +1,293 @@+/* drotmg.f -- translated by f2c (version 20100827).+   You must link the resulting object file with libf2c:+	on Microsoft Windows system, link with libf2c.lib;+	on Linux or Unix systems, link with .../path/to/libf2c.a -lm+	or, if you install libf2c.a in a standard place, with -lf2c -lm+	-- in that order, at the end of the command line, as in+		cc *.o -lf2c -lm+	Source for libf2c is in /netlib/f2c/libf2c.zip, e.g.,++		http://www.netlib.org/f2c/libf2c.zip+*/++#include "datatypes.h"++/* Subroutine */ int drotmg_(doublereal *dd1, doublereal *dd2, doublereal *+	dx1, doublereal *dy1, doublereal *dparam)+{+    /* Initialized data */++    static doublereal zero = 0.;+    static doublereal one = 1.;+    static doublereal two = 2.;+    static doublereal gam = 4096.;+    static doublereal gamsq = 16777216.;+    static doublereal rgamsq = 5.9604645e-8;++    /* Format strings */+    static char fmt_120[] = "";+    static char fmt_150[] = "";+    static char fmt_180[] = "";+    static char fmt_210[] = "";++    /* System generated locals */+    doublereal d__1;++    /* Local variables */+    doublereal du, dp1, dp2, dq1, dq2, dh11, dh12, dh21, dh22;+    integer igo;+    doublereal dflag, dtemp;++    /* Assigned format variables */+    static char *igo_fmt;++/*     .. Scalar Arguments .. */+/*     .. */+/*     .. Array Arguments .. */+/*     .. */++/*  Purpose */+/*  ======= */++/*     CONSTRUCT THE MODIFIED GIVENS TRANSFORMATION MATRIX H WHICH ZEROS */+/*     THE SECOND COMPONENT OF THE 2-VECTOR  (DSQRT(DD1)*DX1,DSQRT(DD2)* */+/*     DY2)**T. */+/*     WITH DPARAM(1)=DFLAG, H HAS ONE OF THE FOLLOWING FORMS.. */++/*     DFLAG=-1.D0     DFLAG=0.D0        DFLAG=1.D0     DFLAG=-2.D0 */++/*       (DH11  DH12)    (1.D0  DH12)    (DH11  1.D0)    (1.D0  0.D0) */+/*     H=(          )    (          )    (          )    (          ) */+/*       (DH21  DH22),   (DH21  1.D0),   (-1.D0 DH22),   (0.D0  1.D0). */+/*     LOCATIONS 2-4 OF DPARAM CONTAIN DH11, DH21, DH12, AND DH22 */+/*     RESPECTIVELY. (VALUES OF 1.D0, -1.D0, OR 0.D0 IMPLIED BY THE */+/*     VALUE OF DPARAM(1) ARE NOT STORED IN DPARAM.) */++/*     THE VALUES OF GAMSQ AND RGAMSQ SET IN THE DATA STATEMENT MAY BE */+/*     INEXACT.  THIS IS OK AS THEY ARE ONLY USED FOR TESTING THE SIZE */+/*     OF DD1 AND DD2.  ALL ACTUAL SCALING OF DATA IS DONE USING GAM. */+++/*  Arguments */+/*  ========= */++/*  DD1    (input/output) DOUBLE PRECISION */++/*  DD2    (input/output) DOUBLE PRECISION */++/*  DX1    (input/output) DOUBLE PRECISION */++/*  DY1    (input) DOUBLE PRECISION */++/*  DPARAM (input/output)  DOUBLE PRECISION array, dimension 5 */+/*     DPARAM(1)=DFLAG */+/*     DPARAM(2)=DH11 */+/*     DPARAM(3)=DH21 */+/*     DPARAM(4)=DH12 */+/*     DPARAM(5)=DH22 */++/*  ===================================================================== */++/*     .. Local Scalars .. */+/*     .. */+/*     .. Intrinsic Functions .. */+/*     .. */+/*     .. Data statements .. */++    /* Parameter adjustments */+    --dparam;++    /* Function Body */+/*     .. */+    if (! (*dd1 < zero)) {+	goto L10;+    }+/*       GO ZERO-H-D-AND-DX1.. */+    goto L60;+L10:+/*     CASE-DD1-NONNEGATIVE */+    dp2 = *dd2 * *dy1;+    if (! (dp2 == zero)) {+	goto L20;+    }+    dflag = -two;+    goto L260;+/*     REGULAR-CASE.. */+L20:+    dp1 = *dd1 * *dx1;+    dq2 = dp2 * *dy1;+    dq1 = dp1 * *dx1;++    if (! (abs(dq1) > abs(dq2))) {+	goto L40;+    }+    dh21 = -(*dy1) / *dx1;+    dh12 = dp2 / dp1;++    du = one - dh12 * dh21;++    if (! (du <= zero)) {+	goto L30;+    }+/*         GO ZERO-H-D-AND-DX1.. */+    goto L60;+L30:+    dflag = zero;+    *dd1 /= du;+    *dd2 /= du;+    *dx1 *= du;+/*         GO SCALE-CHECK.. */+    goto L100;+L40:+    if (! (dq2 < zero)) {+	goto L50;+    }+/*         GO ZERO-H-D-AND-DX1.. */+    goto L60;+L50:+    dflag = one;+    dh11 = dp1 / dp2;+    dh22 = *dx1 / *dy1;+    du = one + dh11 * dh22;+    dtemp = *dd2 / du;+    *dd2 = *dd1 / du;+    *dd1 = dtemp;+    *dx1 = *dy1 * du;+/*         GO SCALE-CHECK */+    goto L100;+/*     PROCEDURE..ZERO-H-D-AND-DX1.. */+L60:+    dflag = -one;+    dh11 = zero;+    dh12 = zero;+    dh21 = zero;+    dh22 = zero;++    *dd1 = zero;+    *dd2 = zero;+    *dx1 = zero;+/*         RETURN.. */+    goto L220;+/*     PROCEDURE..FIX-H.. */+L70:+    if (! (dflag >= zero)) {+	goto L90;+    }++    if (! (dflag == zero)) {+	goto L80;+    }+    dh11 = one;+    dh22 = one;+    dflag = -one;+    goto L90;+L80:+    dh21 = -one;+    dh12 = one;+    dflag = -one;+L90:+    switch (igo) {+	case 0: goto L120;+	case 1: goto L150;+	case 2: goto L180;+	case 3: goto L210;+    }+/*     PROCEDURE..SCALE-CHECK */+L100:+L110:+    if (! (*dd1 <= rgamsq)) {+	goto L130;+    }+    if (*dd1 == zero) {+	goto L160;+    }+    igo = 0;+    igo_fmt = fmt_120;+/*              FIX-H.. */+    goto L70;+L120:+/* Computing 2nd power */+    d__1 = gam;+    *dd1 *= d__1 * d__1;+    *dx1 /= gam;+    dh11 /= gam;+    dh12 /= gam;+    goto L110;+L130:+L140:+    if (! (*dd1 >= gamsq)) {+	goto L160;+    }+    igo = 1;+    igo_fmt = fmt_150;+/*              FIX-H.. */+    goto L70;+L150:+/* Computing 2nd power */+    d__1 = gam;+    *dd1 /= d__1 * d__1;+    *dx1 *= gam;+    dh11 *= gam;+    dh12 *= gam;+    goto L140;+L160:+L170:+    if (! (abs(*dd2) <= rgamsq)) {+	goto L190;+    }+    if (*dd2 == zero) {+	goto L220;+    }+    igo = 2;+    igo_fmt = fmt_180;+/*              FIX-H.. */+    goto L70;+L180:+/* Computing 2nd power */+    d__1 = gam;+    *dd2 *= d__1 * d__1;+    dh21 /= gam;+    dh22 /= gam;+    goto L170;+L190:+L200:+    if (! (abs(*dd2) >= gamsq)) {+	goto L220;+    }+    igo = 3;+    igo_fmt = fmt_210;+/*              FIX-H.. */+    goto L70;+L210:+/* Computing 2nd power */+    d__1 = gam;+    *dd2 /= d__1 * d__1;+    dh21 *= gam;+    dh22 *= gam;+    goto L200;+L220:+    if (dflag < 0.) {+	goto L250;+    } else if (dflag == 0) {+	goto L230;+    } else {+	goto L240;+    }+L230:+    dparam[3] = dh21;+    dparam[4] = dh12;+    goto L260;+L240:+    dparam[2] = dh11;+    dparam[5] = dh22;+    goto L260;+L250:+    dparam[2] = dh11;+    dparam[3] = dh21;+    dparam[4] = dh12;+    dparam[5] = dh22;+L260:+    dparam[1] = dflag;+    return 0;+} /* drotmg_ */+
+ eigen3/blas/f2c/dsbmv.c view
@@ -0,0 +1,366 @@+/* dsbmv.f -- translated by f2c (version 20100827).+   You must link the resulting object file with libf2c:+	on Microsoft Windows system, link with libf2c.lib;+	on Linux or Unix systems, link with .../path/to/libf2c.a -lm+	or, if you install libf2c.a in a standard place, with -lf2c -lm+	-- in that order, at the end of the command line, as in+		cc *.o -lf2c -lm+	Source for libf2c is in /netlib/f2c/libf2c.zip, e.g.,++		http://www.netlib.org/f2c/libf2c.zip+*/++#include "datatypes.h"++/* Subroutine */ int dsbmv_(char *uplo, integer *n, integer *k, doublereal *+	alpha, doublereal *a, integer *lda, doublereal *x, integer *incx, +	doublereal *beta, doublereal *y, integer *incy, ftnlen uplo_len)+{+    /* System generated locals */+    integer a_dim1, a_offset, i__1, i__2, i__3, i__4;++    /* Local variables */+    integer i__, j, l, ix, iy, jx, jy, kx, ky, info;+    doublereal temp1, temp2;+    extern logical lsame_(char *, char *, ftnlen, ftnlen);+    integer kplus1;+    extern /* Subroutine */ int xerbla_(char *, integer *, ftnlen);++/*     .. Scalar Arguments .. */+/*     .. */+/*     .. Array Arguments .. */+/*     .. */++/*  Purpose */+/*  ======= */++/*  DSBMV  performs the matrix-vector  operation */++/*     y := alpha*A*x + beta*y, */++/*  where alpha and beta are scalars, x and y are n element vectors and */+/*  A is an n by n symmetric band matrix, with k super-diagonals. */++/*  Arguments */+/*  ========== */++/*  UPLO   - CHARACTER*1. */+/*           On entry, UPLO specifies whether the upper or lower */+/*           triangular part of the band matrix A is being supplied as */+/*           follows: */++/*              UPLO = 'U' or 'u'   The upper triangular part of A is */+/*                                  being supplied. */++/*              UPLO = 'L' or 'l'   The lower triangular part of A is */+/*                                  being supplied. */++/*           Unchanged on exit. */++/*  N      - INTEGER. */+/*           On entry, N specifies the order of the matrix A. */+/*           N must be at least zero. */+/*           Unchanged on exit. */++/*  K      - INTEGER. */+/*           On entry, K specifies the number of super-diagonals of the */+/*           matrix A. K must satisfy  0 .le. K. */+/*           Unchanged on exit. */++/*  ALPHA  - DOUBLE PRECISION. */+/*           On entry, ALPHA specifies the scalar alpha. */+/*           Unchanged on exit. */++/*  A      - DOUBLE PRECISION array of DIMENSION ( LDA, n ). */+/*           Before entry with UPLO = 'U' or 'u', the leading ( k + 1 ) */+/*           by n part of the array A must contain the upper triangular */+/*           band part of the symmetric matrix, supplied column by */+/*           column, with the leading diagonal of the matrix in row */+/*           ( k + 1 ) of the array, the first super-diagonal starting at */+/*           position 2 in row k, and so on. The top left k by k triangle */+/*           of the array A is not referenced. */+/*           The following program segment will transfer the upper */+/*           triangular part of a symmetric band matrix from conventional */+/*           full matrix storage to band storage: */++/*                 DO 20, J = 1, N */+/*                    M = K + 1 - J */+/*                    DO 10, I = MAX( 1, J - K ), J */+/*                       A( M + I, J ) = matrix( I, J ) */+/*              10    CONTINUE */+/*              20 CONTINUE */++/*           Before entry with UPLO = 'L' or 'l', the leading ( k + 1 ) */+/*           by n part of the array A must contain the lower triangular */+/*           band part of the symmetric matrix, supplied column by */+/*           column, with the leading diagonal of the matrix in row 1 of */+/*           the array, the first sub-diagonal starting at position 1 in */+/*           row 2, and so on. The bottom right k by k triangle of the */+/*           array A is not referenced. */+/*           The following program segment will transfer the lower */+/*           triangular part of a symmetric band matrix from conventional */+/*           full matrix storage to band storage: */++/*                 DO 20, J = 1, N */+/*                    M = 1 - J */+/*                    DO 10, I = J, MIN( N, J + K ) */+/*                       A( M + I, J ) = matrix( I, J ) */+/*              10    CONTINUE */+/*              20 CONTINUE */++/*           Unchanged on exit. */++/*  LDA    - INTEGER. */+/*           On entry, LDA specifies the first dimension of A as declared */+/*           in the calling (sub) program. LDA must be at least */+/*           ( k + 1 ). */+/*           Unchanged on exit. */++/*  X      - DOUBLE PRECISION array of DIMENSION at least */+/*           ( 1 + ( n - 1 )*abs( INCX ) ). */+/*           Before entry, the incremented array X must contain the */+/*           vector x. */+/*           Unchanged on exit. */++/*  INCX   - INTEGER. */+/*           On entry, INCX specifies the increment for the elements of */+/*           X. INCX must not be zero. */+/*           Unchanged on exit. */++/*  BETA   - DOUBLE PRECISION. */+/*           On entry, BETA specifies the scalar beta. */+/*           Unchanged on exit. */++/*  Y      - DOUBLE PRECISION array of DIMENSION at least */+/*           ( 1 + ( n - 1 )*abs( INCY ) ). */+/*           Before entry, the incremented array Y must contain the */+/*           vector y. On exit, Y is overwritten by the updated vector y. */++/*  INCY   - INTEGER. */+/*           On entry, INCY specifies the increment for the elements of */+/*           Y. INCY must not be zero. */+/*           Unchanged on exit. */+++/*  Level 2 Blas routine. */++/*  -- Written on 22-October-1986. */+/*     Jack Dongarra, Argonne National Lab. */+/*     Jeremy Du Croz, Nag Central Office. */+/*     Sven Hammarling, Nag Central Office. */+/*     Richard Hanson, Sandia National Labs. */++/*  ===================================================================== */++/*     .. Parameters .. */+/*     .. */+/*     .. Local Scalars .. */+/*     .. */+/*     .. External Functions .. */+/*     .. */+/*     .. External Subroutines .. */+/*     .. */+/*     .. Intrinsic Functions .. */+/*     .. */++/*     Test the input parameters. */++    /* Parameter adjustments */+    a_dim1 = *lda;+    a_offset = 1 + a_dim1;+    a -= a_offset;+    --x;+    --y;++    /* Function Body */+    info = 0;+    if (! lsame_(uplo, "U", (ftnlen)1, (ftnlen)1) && ! lsame_(uplo, "L", (+	    ftnlen)1, (ftnlen)1)) {+	info = 1;+    } else if (*n < 0) {+	info = 2;+    } else if (*k < 0) {+	info = 3;+    } else if (*lda < *k + 1) {+	info = 6;+    } else if (*incx == 0) {+	info = 8;+    } else if (*incy == 0) {+	info = 11;+    }+    if (info != 0) {+	xerbla_("DSBMV ", &info, (ftnlen)6);+	return 0;+    }++/*     Quick return if possible. */++    if (*n == 0 || (*alpha == 0. && *beta == 1.)) {+	return 0;+    }++/*     Set up the start points in  X  and  Y. */++    if (*incx > 0) {+	kx = 1;+    } else {+	kx = 1 - (*n - 1) * *incx;+    }+    if (*incy > 0) {+	ky = 1;+    } else {+	ky = 1 - (*n - 1) * *incy;+    }++/*     Start the operations. In this version the elements of the array A */+/*     are accessed sequentially with one pass through A. */++/*     First form  y := beta*y. */++    if (*beta != 1.) {+	if (*incy == 1) {+	    if (*beta == 0.) {+		i__1 = *n;+		for (i__ = 1; i__ <= i__1; ++i__) {+		    y[i__] = 0.;+/* L10: */+		}+	    } else {+		i__1 = *n;+		for (i__ = 1; i__ <= i__1; ++i__) {+		    y[i__] = *beta * y[i__];+/* L20: */+		}+	    }+	} else {+	    iy = ky;+	    if (*beta == 0.) {+		i__1 = *n;+		for (i__ = 1; i__ <= i__1; ++i__) {+		    y[iy] = 0.;+		    iy += *incy;+/* L30: */+		}+	    } else {+		i__1 = *n;+		for (i__ = 1; i__ <= i__1; ++i__) {+		    y[iy] = *beta * y[iy];+		    iy += *incy;+/* L40: */+		}+	    }+	}+    }+    if (*alpha == 0.) {+	return 0;+    }+    if (lsame_(uplo, "U", (ftnlen)1, (ftnlen)1)) {++/*        Form  y  when upper triangle of A is stored. */++	kplus1 = *k + 1;+	if (*incx == 1 && *incy == 1) {+	    i__1 = *n;+	    for (j = 1; j <= i__1; ++j) {+		temp1 = *alpha * x[j];+		temp2 = 0.;+		l = kplus1 - j;+/* Computing MAX */+		i__2 = 1, i__3 = j - *k;+		i__4 = j - 1;+		for (i__ = max(i__2,i__3); i__ <= i__4; ++i__) {+		    y[i__] += temp1 * a[l + i__ + j * a_dim1];+		    temp2 += a[l + i__ + j * a_dim1] * x[i__];+/* L50: */+		}+		y[j] = y[j] + temp1 * a[kplus1 + j * a_dim1] + *alpha * temp2;+/* L60: */+	    }+	} else {+	    jx = kx;+	    jy = ky;+	    i__1 = *n;+	    for (j = 1; j <= i__1; ++j) {+		temp1 = *alpha * x[jx];+		temp2 = 0.;+		ix = kx;+		iy = ky;+		l = kplus1 - j;+/* Computing MAX */+		i__4 = 1, i__2 = j - *k;+		i__3 = j - 1;+		for (i__ = max(i__4,i__2); i__ <= i__3; ++i__) {+		    y[iy] += temp1 * a[l + i__ + j * a_dim1];+		    temp2 += a[l + i__ + j * a_dim1] * x[ix];+		    ix += *incx;+		    iy += *incy;+/* L70: */+		}+		y[jy] = y[jy] + temp1 * a[kplus1 + j * a_dim1] + *alpha * +			temp2;+		jx += *incx;+		jy += *incy;+		if (j > *k) {+		    kx += *incx;+		    ky += *incy;+		}+/* L80: */+	    }+	}+    } else {++/*        Form  y  when lower triangle of A is stored. */++	if (*incx == 1 && *incy == 1) {+	    i__1 = *n;+	    for (j = 1; j <= i__1; ++j) {+		temp1 = *alpha * x[j];+		temp2 = 0.;+		y[j] += temp1 * a[j * a_dim1 + 1];+		l = 1 - j;+/* Computing MIN */+		i__4 = *n, i__2 = j + *k;+		i__3 = min(i__4,i__2);+		for (i__ = j + 1; i__ <= i__3; ++i__) {+		    y[i__] += temp1 * a[l + i__ + j * a_dim1];+		    temp2 += a[l + i__ + j * a_dim1] * x[i__];+/* L90: */+		}+		y[j] += *alpha * temp2;+/* L100: */+	    }+	} else {+	    jx = kx;+	    jy = ky;+	    i__1 = *n;+	    for (j = 1; j <= i__1; ++j) {+		temp1 = *alpha * x[jx];+		temp2 = 0.;+		y[jy] += temp1 * a[j * a_dim1 + 1];+		l = 1 - j;+		ix = jx;+		iy = jy;+/* Computing MIN */+		i__4 = *n, i__2 = j + *k;+		i__3 = min(i__4,i__2);+		for (i__ = j + 1; i__ <= i__3; ++i__) {+		    ix += *incx;+		    iy += *incy;+		    y[iy] += temp1 * a[l + i__ + j * a_dim1];+		    temp2 += a[l + i__ + j * a_dim1] * x[ix];+/* L110: */+		}+		y[jy] += *alpha * temp2;+		jx += *incx;+		jy += *incy;+/* L120: */+	    }+	}+    }++    return 0;++/*     End of DSBMV . */++} /* dsbmv_ */+
+ eigen3/blas/f2c/dspmv.c view
@@ -0,0 +1,316 @@+/* dspmv.f -- translated by f2c (version 20100827).+   You must link the resulting object file with libf2c:+	on Microsoft Windows system, link with libf2c.lib;+	on Linux or Unix systems, link with .../path/to/libf2c.a -lm+	or, if you install libf2c.a in a standard place, with -lf2c -lm+	-- in that order, at the end of the command line, as in+		cc *.o -lf2c -lm+	Source for libf2c is in /netlib/f2c/libf2c.zip, e.g.,++		http://www.netlib.org/f2c/libf2c.zip+*/++#include "datatypes.h"++/* Subroutine */ int dspmv_(char *uplo, integer *n, doublereal *alpha, +	doublereal *ap, doublereal *x, integer *incx, doublereal *beta, +	doublereal *y, integer *incy, ftnlen uplo_len)+{+    /* System generated locals */+    integer i__1, i__2;++    /* Local variables */+    integer i__, j, k, kk, ix, iy, jx, jy, kx, ky, info;+    doublereal temp1, temp2;+    extern logical lsame_(char *, char *, ftnlen, ftnlen);+    extern /* Subroutine */ int xerbla_(char *, integer *, ftnlen);++/*     .. Scalar Arguments .. */+/*     .. */+/*     .. Array Arguments .. */+/*     .. */++/*  Purpose */+/*  ======= */++/*  DSPMV  performs the matrix-vector operation */++/*     y := alpha*A*x + beta*y, */++/*  where alpha and beta are scalars, x and y are n element vectors and */+/*  A is an n by n symmetric matrix, supplied in packed form. */++/*  Arguments */+/*  ========== */++/*  UPLO   - CHARACTER*1. */+/*           On entry, UPLO specifies whether the upper or lower */+/*           triangular part of the matrix A is supplied in the packed */+/*           array AP as follows: */++/*              UPLO = 'U' or 'u'   The upper triangular part of A is */+/*                                  supplied in AP. */++/*              UPLO = 'L' or 'l'   The lower triangular part of A is */+/*                                  supplied in AP. */++/*           Unchanged on exit. */++/*  N      - INTEGER. */+/*           On entry, N specifies the order of the matrix A. */+/*           N must be at least zero. */+/*           Unchanged on exit. */++/*  ALPHA  - DOUBLE PRECISION. */+/*           On entry, ALPHA specifies the scalar alpha. */+/*           Unchanged on exit. */++/*  AP     - DOUBLE PRECISION array of DIMENSION at least */+/*           ( ( n*( n + 1 ) )/2 ). */+/*           Before entry with UPLO = 'U' or 'u', the array AP must */+/*           contain the upper triangular part of the symmetric matrix */+/*           packed sequentially, column by column, so that AP( 1 ) */+/*           contains a( 1, 1 ), AP( 2 ) and AP( 3 ) contain a( 1, 2 ) */+/*           and a( 2, 2 ) respectively, and so on. */+/*           Before entry with UPLO = 'L' or 'l', the array AP must */+/*           contain the lower triangular part of the symmetric matrix */+/*           packed sequentially, column by column, so that AP( 1 ) */+/*           contains a( 1, 1 ), AP( 2 ) and AP( 3 ) contain a( 2, 1 ) */+/*           and a( 3, 1 ) respectively, and so on. */+/*           Unchanged on exit. */++/*  X      - DOUBLE PRECISION array of dimension at least */+/*           ( 1 + ( n - 1 )*abs( INCX ) ). */+/*           Before entry, the incremented array X must contain the n */+/*           element vector x. */+/*           Unchanged on exit. */++/*  INCX   - INTEGER. */+/*           On entry, INCX specifies the increment for the elements of */+/*           X. INCX must not be zero. */+/*           Unchanged on exit. */++/*  BETA   - DOUBLE PRECISION. */+/*           On entry, BETA specifies the scalar beta. When BETA is */+/*           supplied as zero then Y need not be set on input. */+/*           Unchanged on exit. */++/*  Y      - DOUBLE PRECISION array of dimension at least */+/*           ( 1 + ( n - 1 )*abs( INCY ) ). */+/*           Before entry, the incremented array Y must contain the n */+/*           element vector y. On exit, Y is overwritten by the updated */+/*           vector y. */++/*  INCY   - INTEGER. */+/*           On entry, INCY specifies the increment for the elements of */+/*           Y. INCY must not be zero. */+/*           Unchanged on exit. */++/*  Further Details */+/*  =============== */++/*  Level 2 Blas routine. */++/*  -- Written on 22-October-1986. */+/*     Jack Dongarra, Argonne National Lab. */+/*     Jeremy Du Croz, Nag Central Office. */+/*     Sven Hammarling, Nag Central Office. */+/*     Richard Hanson, Sandia National Labs. */++/*  ===================================================================== */++/*     .. Parameters .. */+/*     .. */+/*     .. Local Scalars .. */+/*     .. */+/*     .. External Functions .. */+/*     .. */+/*     .. External Subroutines .. */+/*     .. */++/*     Test the input parameters. */++    /* Parameter adjustments */+    --y;+    --x;+    --ap;++    /* Function Body */+    info = 0;+    if (! lsame_(uplo, "U", (ftnlen)1, (ftnlen)1) && ! lsame_(uplo, "L", (+	    ftnlen)1, (ftnlen)1)) {+	info = 1;+    } else if (*n < 0) {+	info = 2;+    } else if (*incx == 0) {+	info = 6;+    } else if (*incy == 0) {+	info = 9;+    }+    if (info != 0) {+	xerbla_("DSPMV ", &info, (ftnlen)6);+	return 0;+    }++/*     Quick return if possible. */++    if (*n == 0 || (*alpha == 0. && *beta == 1.)) {+	return 0;+    }++/*     Set up the start points in  X  and  Y. */++    if (*incx > 0) {+	kx = 1;+    } else {+	kx = 1 - (*n - 1) * *incx;+    }+    if (*incy > 0) {+	ky = 1;+    } else {+	ky = 1 - (*n - 1) * *incy;+    }++/*     Start the operations. In this version the elements of the array AP */+/*     are accessed sequentially with one pass through AP. */++/*     First form  y := beta*y. */++    if (*beta != 1.) {+	if (*incy == 1) {+	    if (*beta == 0.) {+		i__1 = *n;+		for (i__ = 1; i__ <= i__1; ++i__) {+		    y[i__] = 0.;+/* L10: */+		}+	    } else {+		i__1 = *n;+		for (i__ = 1; i__ <= i__1; ++i__) {+		    y[i__] = *beta * y[i__];+/* L20: */+		}+	    }+	} else {+	    iy = ky;+	    if (*beta == 0.) {+		i__1 = *n;+		for (i__ = 1; i__ <= i__1; ++i__) {+		    y[iy] = 0.;+		    iy += *incy;+/* L30: */+		}+	    } else {+		i__1 = *n;+		for (i__ = 1; i__ <= i__1; ++i__) {+		    y[iy] = *beta * y[iy];+		    iy += *incy;+/* L40: */+		}+	    }+	}+    }+    if (*alpha == 0.) {+	return 0;+    }+    kk = 1;+    if (lsame_(uplo, "U", (ftnlen)1, (ftnlen)1)) {++/*        Form  y  when AP contains the upper triangle. */++	if (*incx == 1 && *incy == 1) {+	    i__1 = *n;+	    for (j = 1; j <= i__1; ++j) {+		temp1 = *alpha * x[j];+		temp2 = 0.;+		k = kk;+		i__2 = j - 1;+		for (i__ = 1; i__ <= i__2; ++i__) {+		    y[i__] += temp1 * ap[k];+		    temp2 += ap[k] * x[i__];+		    ++k;+/* L50: */+		}+		y[j] = y[j] + temp1 * ap[kk + j - 1] + *alpha * temp2;+		kk += j;+/* L60: */+	    }+	} else {+	    jx = kx;+	    jy = ky;+	    i__1 = *n;+	    for (j = 1; j <= i__1; ++j) {+		temp1 = *alpha * x[jx];+		temp2 = 0.;+		ix = kx;+		iy = ky;+		i__2 = kk + j - 2;+		for (k = kk; k <= i__2; ++k) {+		    y[iy] += temp1 * ap[k];+		    temp2 += ap[k] * x[ix];+		    ix += *incx;+		    iy += *incy;+/* L70: */+		}+		y[jy] = y[jy] + temp1 * ap[kk + j - 1] + *alpha * temp2;+		jx += *incx;+		jy += *incy;+		kk += j;+/* L80: */+	    }+	}+    } else {++/*        Form  y  when AP contains the lower triangle. */++	if (*incx == 1 && *incy == 1) {+	    i__1 = *n;+	    for (j = 1; j <= i__1; ++j) {+		temp1 = *alpha * x[j];+		temp2 = 0.;+		y[j] += temp1 * ap[kk];+		k = kk + 1;+		i__2 = *n;+		for (i__ = j + 1; i__ <= i__2; ++i__) {+		    y[i__] += temp1 * ap[k];+		    temp2 += ap[k] * x[i__];+		    ++k;+/* L90: */+		}+		y[j] += *alpha * temp2;+		kk += *n - j + 1;+/* L100: */+	    }+	} else {+	    jx = kx;+	    jy = ky;+	    i__1 = *n;+	    for (j = 1; j <= i__1; ++j) {+		temp1 = *alpha * x[jx];+		temp2 = 0.;+		y[jy] += temp1 * ap[kk];+		ix = jx;+		iy = jy;+		i__2 = kk + *n - j;+		for (k = kk + 1; k <= i__2; ++k) {+		    ix += *incx;+		    iy += *incy;+		    y[iy] += temp1 * ap[k];+		    temp2 += ap[k] * x[ix];+/* L110: */+		}+		y[jy] += *alpha * temp2;+		jx += *incx;+		jy += *incy;+		kk += *n - j + 1;+/* L120: */+	    }+	}+    }++    return 0;++/*     End of DSPMV . */++} /* dspmv_ */+
+ eigen3/blas/f2c/dtbmv.c view
@@ -0,0 +1,428 @@+/* dtbmv.f -- translated by f2c (version 20100827).+   You must link the resulting object file with libf2c:+	on Microsoft Windows system, link with libf2c.lib;+	on Linux or Unix systems, link with .../path/to/libf2c.a -lm+	or, if you install libf2c.a in a standard place, with -lf2c -lm+	-- in that order, at the end of the command line, as in+		cc *.o -lf2c -lm+	Source for libf2c is in /netlib/f2c/libf2c.zip, e.g.,++		http://www.netlib.org/f2c/libf2c.zip+*/++#include "datatypes.h"++/* Subroutine */ int dtbmv_(char *uplo, char *trans, char *diag, integer *n, +	integer *k, doublereal *a, integer *lda, doublereal *x, integer *incx,+	 ftnlen uplo_len, ftnlen trans_len, ftnlen diag_len)+{+    /* System generated locals */+    integer a_dim1, a_offset, i__1, i__2, i__3, i__4;++    /* Local variables */+    integer i__, j, l, ix, jx, kx, info;+    doublereal temp;+    extern logical lsame_(char *, char *, ftnlen, ftnlen);+    integer kplus1;+    extern /* Subroutine */ int xerbla_(char *, integer *, ftnlen);+    logical nounit;++/*     .. Scalar Arguments .. */+/*     .. */+/*     .. Array Arguments .. */+/*     .. */++/*  Purpose */+/*  ======= */++/*  DTBMV  performs one of the matrix-vector operations */++/*     x := A*x,   or   x := A'*x, */++/*  where x is an n element vector and  A is an n by n unit, or non-unit, */+/*  upper or lower triangular band matrix, with ( k + 1 ) diagonals. */++/*  Arguments */+/*  ========== */++/*  UPLO   - CHARACTER*1. */+/*           On entry, UPLO specifies whether the matrix is an upper or */+/*           lower triangular matrix as follows: */++/*              UPLO = 'U' or 'u'   A is an upper triangular matrix. */++/*              UPLO = 'L' or 'l'   A is a lower triangular matrix. */++/*           Unchanged on exit. */++/*  TRANS  - CHARACTER*1. */+/*           On entry, TRANS specifies the operation to be performed as */+/*           follows: */++/*              TRANS = 'N' or 'n'   x := A*x. */++/*              TRANS = 'T' or 't'   x := A'*x. */++/*              TRANS = 'C' or 'c'   x := A'*x. */++/*           Unchanged on exit. */++/*  DIAG   - CHARACTER*1. */+/*           On entry, DIAG specifies whether or not A is unit */+/*           triangular as follows: */++/*              DIAG = 'U' or 'u'   A is assumed to be unit triangular. */++/*              DIAG = 'N' or 'n'   A is not assumed to be unit */+/*                                  triangular. */++/*           Unchanged on exit. */++/*  N      - INTEGER. */+/*           On entry, N specifies the order of the matrix A. */+/*           N must be at least zero. */+/*           Unchanged on exit. */++/*  K      - INTEGER. */+/*           On entry with UPLO = 'U' or 'u', K specifies the number of */+/*           super-diagonals of the matrix A. */+/*           On entry with UPLO = 'L' or 'l', K specifies the number of */+/*           sub-diagonals of the matrix A. */+/*           K must satisfy  0 .le. K. */+/*           Unchanged on exit. */++/*  A      - DOUBLE PRECISION array of DIMENSION ( LDA, n ). */+/*           Before entry with UPLO = 'U' or 'u', the leading ( k + 1 ) */+/*           by n part of the array A must contain the upper triangular */+/*           band part of the matrix of coefficients, supplied column by */+/*           column, with the leading diagonal of the matrix in row */+/*           ( k + 1 ) of the array, the first super-diagonal starting at */+/*           position 2 in row k, and so on. The top left k by k triangle */+/*           of the array A is not referenced. */+/*           The following program segment will transfer an upper */+/*           triangular band matrix from conventional full matrix storage */+/*           to band storage: */++/*                 DO 20, J = 1, N */+/*                    M = K + 1 - J */+/*                    DO 10, I = MAX( 1, J - K ), J */+/*                       A( M + I, J ) = matrix( I, J ) */+/*              10    CONTINUE */+/*              20 CONTINUE */++/*           Before entry with UPLO = 'L' or 'l', the leading ( k + 1 ) */+/*           by n part of the array A must contain the lower triangular */+/*           band part of the matrix of coefficients, supplied column by */+/*           column, with the leading diagonal of the matrix in row 1 of */+/*           the array, the first sub-diagonal starting at position 1 in */+/*           row 2, and so on. The bottom right k by k triangle of the */+/*           array A is not referenced. */+/*           The following program segment will transfer a lower */+/*           triangular band matrix from conventional full matrix storage */+/*           to band storage: */++/*                 DO 20, J = 1, N */+/*                    M = 1 - J */+/*                    DO 10, I = J, MIN( N, J + K ) */+/*                       A( M + I, J ) = matrix( I, J ) */+/*              10    CONTINUE */+/*              20 CONTINUE */++/*           Note that when DIAG = 'U' or 'u' the elements of the array A */+/*           corresponding to the diagonal elements of the matrix are not */+/*           referenced, but are assumed to be unity. */+/*           Unchanged on exit. */++/*  LDA    - INTEGER. */+/*           On entry, LDA specifies the first dimension of A as declared */+/*           in the calling (sub) program. LDA must be at least */+/*           ( k + 1 ). */+/*           Unchanged on exit. */++/*  X      - DOUBLE PRECISION array of dimension at least */+/*           ( 1 + ( n - 1 )*abs( INCX ) ). */+/*           Before entry, the incremented array X must contain the n */+/*           element vector x. On exit, X is overwritten with the */+/*           tranformed vector x. */++/*  INCX   - INTEGER. */+/*           On entry, INCX specifies the increment for the elements of */+/*           X. INCX must not be zero. */+/*           Unchanged on exit. */++/*  Further Details */+/*  =============== */++/*  Level 2 Blas routine. */++/*  -- Written on 22-October-1986. */+/*     Jack Dongarra, Argonne National Lab. */+/*     Jeremy Du Croz, Nag Central Office. */+/*     Sven Hammarling, Nag Central Office. */+/*     Richard Hanson, Sandia National Labs. */++/*  ===================================================================== */++/*     .. Parameters .. */+/*     .. */+/*     .. Local Scalars .. */+/*     .. */+/*     .. External Functions .. */+/*     .. */+/*     .. External Subroutines .. */+/*     .. */+/*     .. Intrinsic Functions .. */+/*     .. */++/*     Test the input parameters. */++    /* Parameter adjustments */+    a_dim1 = *lda;+    a_offset = 1 + a_dim1;+    a -= a_offset;+    --x;++    /* Function Body */+    info = 0;+    if (! lsame_(uplo, "U", (ftnlen)1, (ftnlen)1) && ! lsame_(uplo, "L", (+	    ftnlen)1, (ftnlen)1)) {+	info = 1;+    } else if (! lsame_(trans, "N", (ftnlen)1, (ftnlen)1) && ! lsame_(trans, +	    "T", (ftnlen)1, (ftnlen)1) && ! lsame_(trans, "C", (ftnlen)1, (+	    ftnlen)1)) {+	info = 2;+    } else if (! lsame_(diag, "U", (ftnlen)1, (ftnlen)1) && ! lsame_(diag, +	    "N", (ftnlen)1, (ftnlen)1)) {+	info = 3;+    } else if (*n < 0) {+	info = 4;+    } else if (*k < 0) {+	info = 5;+    } else if (*lda < *k + 1) {+	info = 7;+    } else if (*incx == 0) {+	info = 9;+    }+    if (info != 0) {+	xerbla_("DTBMV ", &info, (ftnlen)6);+	return 0;+    }++/*     Quick return if possible. */++    if (*n == 0) {+	return 0;+    }++    nounit = lsame_(diag, "N", (ftnlen)1, (ftnlen)1);++/*     Set up the start point in X if the increment is not unity. This */+/*     will be  ( N - 1 )*INCX   too small for descending loops. */++    if (*incx <= 0) {+	kx = 1 - (*n - 1) * *incx;+    } else if (*incx != 1) {+	kx = 1;+    }++/*     Start the operations. In this version the elements of A are */+/*     accessed sequentially with one pass through A. */++    if (lsame_(trans, "N", (ftnlen)1, (ftnlen)1)) {++/*         Form  x := A*x. */++	if (lsame_(uplo, "U", (ftnlen)1, (ftnlen)1)) {+	    kplus1 = *k + 1;+	    if (*incx == 1) {+		i__1 = *n;+		for (j = 1; j <= i__1; ++j) {+		    if (x[j] != 0.) {+			temp = x[j];+			l = kplus1 - j;+/* Computing MAX */+			i__2 = 1, i__3 = j - *k;+			i__4 = j - 1;+			for (i__ = max(i__2,i__3); i__ <= i__4; ++i__) {+			    x[i__] += temp * a[l + i__ + j * a_dim1];+/* L10: */+			}+			if (nounit) {+			    x[j] *= a[kplus1 + j * a_dim1];+			}+		    }+/* L20: */+		}+	    } else {+		jx = kx;+		i__1 = *n;+		for (j = 1; j <= i__1; ++j) {+		    if (x[jx] != 0.) {+			temp = x[jx];+			ix = kx;+			l = kplus1 - j;+/* Computing MAX */+			i__4 = 1, i__2 = j - *k;+			i__3 = j - 1;+			for (i__ = max(i__4,i__2); i__ <= i__3; ++i__) {+			    x[ix] += temp * a[l + i__ + j * a_dim1];+			    ix += *incx;+/* L30: */+			}+			if (nounit) {+			    x[jx] *= a[kplus1 + j * a_dim1];+			}+		    }+		    jx += *incx;+		    if (j > *k) {+			kx += *incx;+		    }+/* L40: */+		}+	    }+	} else {+	    if (*incx == 1) {+		for (j = *n; j >= 1; --j) {+		    if (x[j] != 0.) {+			temp = x[j];+			l = 1 - j;+/* Computing MIN */+			i__1 = *n, i__3 = j + *k;+			i__4 = j + 1;+			for (i__ = min(i__1,i__3); i__ >= i__4; --i__) {+			    x[i__] += temp * a[l + i__ + j * a_dim1];+/* L50: */+			}+			if (nounit) {+			    x[j] *= a[j * a_dim1 + 1];+			}+		    }+/* L60: */+		}+	    } else {+		kx += (*n - 1) * *incx;+		jx = kx;+		for (j = *n; j >= 1; --j) {+		    if (x[jx] != 0.) {+			temp = x[jx];+			ix = kx;+			l = 1 - j;+/* Computing MIN */+			i__4 = *n, i__1 = j + *k;+			i__3 = j + 1;+			for (i__ = min(i__4,i__1); i__ >= i__3; --i__) {+			    x[ix] += temp * a[l + i__ + j * a_dim1];+			    ix -= *incx;+/* L70: */+			}+			if (nounit) {+			    x[jx] *= a[j * a_dim1 + 1];+			}+		    }+		    jx -= *incx;+		    if (*n - j >= *k) {+			kx -= *incx;+		    }+/* L80: */+		}+	    }+	}+    } else {++/*        Form  x := A'*x. */++	if (lsame_(uplo, "U", (ftnlen)1, (ftnlen)1)) {+	    kplus1 = *k + 1;+	    if (*incx == 1) {+		for (j = *n; j >= 1; --j) {+		    temp = x[j];+		    l = kplus1 - j;+		    if (nounit) {+			temp *= a[kplus1 + j * a_dim1];+		    }+/* Computing MAX */+		    i__4 = 1, i__1 = j - *k;+		    i__3 = max(i__4,i__1);+		    for (i__ = j - 1; i__ >= i__3; --i__) {+			temp += a[l + i__ + j * a_dim1] * x[i__];+/* L90: */+		    }+		    x[j] = temp;+/* L100: */+		}+	    } else {+		kx += (*n - 1) * *incx;+		jx = kx;+		for (j = *n; j >= 1; --j) {+		    temp = x[jx];+		    kx -= *incx;+		    ix = kx;+		    l = kplus1 - j;+		    if (nounit) {+			temp *= a[kplus1 + j * a_dim1];+		    }+/* Computing MAX */+		    i__4 = 1, i__1 = j - *k;+		    i__3 = max(i__4,i__1);+		    for (i__ = j - 1; i__ >= i__3; --i__) {+			temp += a[l + i__ + j * a_dim1] * x[ix];+			ix -= *incx;+/* L110: */+		    }+		    x[jx] = temp;+		    jx -= *incx;+/* L120: */+		}+	    }+	} else {+	    if (*incx == 1) {+		i__3 = *n;+		for (j = 1; j <= i__3; ++j) {+		    temp = x[j];+		    l = 1 - j;+		    if (nounit) {+			temp *= a[j * a_dim1 + 1];+		    }+/* Computing MIN */+		    i__1 = *n, i__2 = j + *k;+		    i__4 = min(i__1,i__2);+		    for (i__ = j + 1; i__ <= i__4; ++i__) {+			temp += a[l + i__ + j * a_dim1] * x[i__];+/* L130: */+		    }+		    x[j] = temp;+/* L140: */+		}+	    } else {+		jx = kx;+		i__3 = *n;+		for (j = 1; j <= i__3; ++j) {+		    temp = x[jx];+		    kx += *incx;+		    ix = kx;+		    l = 1 - j;+		    if (nounit) {+			temp *= a[j * a_dim1 + 1];+		    }+/* Computing MIN */+		    i__1 = *n, i__2 = j + *k;+		    i__4 = min(i__1,i__2);+		    for (i__ = j + 1; i__ <= i__4; ++i__) {+			temp += a[l + i__ + j * a_dim1] * x[ix];+			ix += *incx;+/* L150: */+		    }+		    x[jx] = temp;+		    jx += *incx;+/* L160: */+		}+	    }+	}+    }++    return 0;++/*     End of DTBMV . */++} /* dtbmv_ */+
+ eigen3/blas/f2c/lsame.c view
@@ -0,0 +1,117 @@+/* lsame.f -- translated by f2c (version 20100827).+   You must link the resulting object file with libf2c:+	on Microsoft Windows system, link with libf2c.lib;+	on Linux or Unix systems, link with .../path/to/libf2c.a -lm+	or, if you install libf2c.a in a standard place, with -lf2c -lm+	-- in that order, at the end of the command line, as in+		cc *.o -lf2c -lm+	Source for libf2c is in /netlib/f2c/libf2c.zip, e.g.,++		http://www.netlib.org/f2c/libf2c.zip+*/++#include "datatypes.h"++logical lsame_(char *ca, char *cb, ftnlen ca_len, ftnlen cb_len)+{+    /* System generated locals */+    logical ret_val;++    /* Local variables */+    integer inta, intb, zcode;+++/*  -- LAPACK auxiliary routine (version 3.1) -- */+/*     Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. */+/*     November 2006 */++/*     .. Scalar Arguments .. */+/*     .. */++/*  Purpose */+/*  ======= */++/*  LSAME returns .TRUE. if CA is the same letter as CB regardless of */+/*  case. */++/*  Arguments */+/*  ========= */++/*  CA      (input) CHARACTER*1 */++/*  CB      (input) CHARACTER*1 */+/*          CA and CB specify the single characters to be compared. */++/* ===================================================================== */++/*     .. Intrinsic Functions .. */+/*     .. */+/*     .. Local Scalars .. */+/*     .. */++/*     Test if the characters are equal */++    ret_val = *(unsigned char *)ca == *(unsigned char *)cb;+    if (ret_val) {+	return ret_val;+    }++/*     Now test for equivalence if both characters are alphabetic. */++    zcode = 'Z';++/*     Use 'Z' rather than 'A' so that ASCII can be detected on Prime */+/*     machines, on which ICHAR returns a value with bit 8 set. */+/*     ICHAR('A') on Prime machines returns 193 which is the same as */+/*     ICHAR('A') on an EBCDIC machine. */++    inta = *(unsigned char *)ca;+    intb = *(unsigned char *)cb;++    if (zcode == 90 || zcode == 122) {++/*        ASCII is assumed - ZCODE is the ASCII code of either lower or */+/*        upper case 'Z'. */++	if (inta >= 97 && inta <= 122) {+	    inta += -32;+	}+	if (intb >= 97 && intb <= 122) {+	    intb += -32;+	}++    } else if (zcode == 233 || zcode == 169) {++/*        EBCDIC is assumed - ZCODE is the EBCDIC code of either lower or */+/*        upper case 'Z'. */++	if ((inta >= 129 && inta <= 137) || (inta >= 145 && inta <= 153) || +            (inta >= 162 && inta <= 169)) {+	    inta += 64;+	}+	if ((intb >= 129 && intb <= 137) || (intb >= 145 && intb <= 153) || +            (intb >= 162 && intb <= 169)) {+	    intb += 64;+	}++    } else if (zcode == 218 || zcode == 250) {++/*        ASCII is assumed, on Prime machines - ZCODE is the ASCII code */+/*        plus 128 of either lower or upper case 'Z'. */++	if (inta >= 225 && inta <= 250) {+	    inta += -32;+	}+	if (intb >= 225 && intb <= 250) {+	    intb += -32;+	}+    }+    ret_val = inta == intb;++/*     RETURN */++/*     End of LSAME */++    return ret_val;+} /* lsame_ */+
+ eigen3/blas/f2c/r_cnjg.c view
@@ -0,0 +1,6 @@+#include "datatypes.h"    ++void r_cnjg(complex *r, complex *z) {+    r->r = z->r;+    r->i = -(z->i);+}
+ eigen3/blas/f2c/srotm.c view
@@ -0,0 +1,216 @@+/* srotm.f -- translated by f2c (version 20100827).+   You must link the resulting object file with libf2c:+	on Microsoft Windows system, link with libf2c.lib;+	on Linux or Unix systems, link with .../path/to/libf2c.a -lm+	or, if you install libf2c.a in a standard place, with -lf2c -lm+	-- in that order, at the end of the command line, as in+		cc *.o -lf2c -lm+	Source for libf2c is in /netlib/f2c/libf2c.zip, e.g.,++		http://www.netlib.org/f2c/libf2c.zip+*/++#include "datatypes.h"++/* Subroutine */ int srotm_(integer *n, real *sx, integer *incx, real *sy, +	integer *incy, real *sparam)+{+    /* Initialized data */++    static real zero = 0.f;+    static real two = 2.f;++    /* System generated locals */+    integer i__1, i__2;++    /* Local variables */+    integer i__;+    real w, z__;+    integer kx, ky;+    real sh11, sh12, sh21, sh22, sflag;+    integer nsteps;++/*     .. Scalar Arguments .. */+/*     .. */+/*     .. Array Arguments .. */+/*     .. */++/*  Purpose */+/*  ======= */++/*     APPLY THE MODIFIED GIVENS TRANSFORMATION, H, TO THE 2 BY N MATRIX */++/*     (SX**T) , WHERE **T INDICATES TRANSPOSE. THE ELEMENTS OF SX ARE IN */+/*     (DX**T) */++/*     SX(LX+I*INCX), I = 0 TO N-1, WHERE LX = 1 IF INCX .GE. 0, ELSE */+/*     LX = (-INCX)*N, AND SIMILARLY FOR SY USING USING LY AND INCY. */+/*     WITH SPARAM(1)=SFLAG, H HAS ONE OF THE FOLLOWING FORMS.. */++/*     SFLAG=-1.E0     SFLAG=0.E0        SFLAG=1.E0     SFLAG=-2.E0 */++/*       (SH11  SH12)    (1.E0  SH12)    (SH11  1.E0)    (1.E0  0.E0) */+/*     H=(          )    (          )    (          )    (          ) */+/*       (SH21  SH22),   (SH21  1.E0),   (-1.E0 SH22),   (0.E0  1.E0). */+/*     SEE  SROTMG FOR A DESCRIPTION OF DATA STORAGE IN SPARAM. */+++/*  Arguments */+/*  ========= */++/*  N      (input) INTEGER */+/*         number of elements in input vector(s) */++/*  SX     (input/output) REAL array, dimension N */+/*         double precision vector with N elements */++/*  INCX   (input) INTEGER */+/*         storage spacing between elements of SX */++/*  SY     (input/output) REAL array, dimension N */+/*         double precision vector with N elements */++/*  INCY   (input) INTEGER */+/*         storage spacing between elements of SY */++/*  SPARAM (input/output)  REAL array, dimension 5 */+/*     SPARAM(1)=SFLAG */+/*     SPARAM(2)=SH11 */+/*     SPARAM(3)=SH21 */+/*     SPARAM(4)=SH12 */+/*     SPARAM(5)=SH22 */++/*  ===================================================================== */++/*     .. Local Scalars .. */+/*     .. */+/*     .. Data statements .. */+    /* Parameter adjustments */+    --sparam;+    --sy;+    --sx;++    /* Function Body */+/*     .. */++    sflag = sparam[1];+    if (*n <= 0 || sflag + two == zero) {+	goto L140;+    }+    if (! (*incx == *incy && *incx > 0)) {+	goto L70;+    }++    nsteps = *n * *incx;+    if (sflag < 0.f) {+	goto L50;+    } else if (sflag == 0) {+	goto L10;+    } else {+	goto L30;+    }+L10:+    sh12 = sparam[4];+    sh21 = sparam[3];+    i__1 = nsteps;+    i__2 = *incx;+    for (i__ = 1; i__2 < 0 ? i__ >= i__1 : i__ <= i__1; i__ += i__2) {+	w = sx[i__];+	z__ = sy[i__];+	sx[i__] = w + z__ * sh12;+	sy[i__] = w * sh21 + z__;+/* L20: */+    }+    goto L140;+L30:+    sh11 = sparam[2];+    sh22 = sparam[5];+    i__2 = nsteps;+    i__1 = *incx;+    for (i__ = 1; i__1 < 0 ? i__ >= i__2 : i__ <= i__2; i__ += i__1) {+	w = sx[i__];+	z__ = sy[i__];+	sx[i__] = w * sh11 + z__;+	sy[i__] = -w + sh22 * z__;+/* L40: */+    }+    goto L140;+L50:+    sh11 = sparam[2];+    sh12 = sparam[4];+    sh21 = sparam[3];+    sh22 = sparam[5];+    i__1 = nsteps;+    i__2 = *incx;+    for (i__ = 1; i__2 < 0 ? i__ >= i__1 : i__ <= i__1; i__ += i__2) {+	w = sx[i__];+	z__ = sy[i__];+	sx[i__] = w * sh11 + z__ * sh12;+	sy[i__] = w * sh21 + z__ * sh22;+/* L60: */+    }+    goto L140;+L70:+    kx = 1;+    ky = 1;+    if (*incx < 0) {+	kx = (1 - *n) * *incx + 1;+    }+    if (*incy < 0) {+	ky = (1 - *n) * *incy + 1;+    }++    if (sflag < 0.f) {+	goto L120;+    } else if (sflag == 0) {+	goto L80;+    } else {+	goto L100;+    }+L80:+    sh12 = sparam[4];+    sh21 = sparam[3];+    i__2 = *n;+    for (i__ = 1; i__ <= i__2; ++i__) {+	w = sx[kx];+	z__ = sy[ky];+	sx[kx] = w + z__ * sh12;+	sy[ky] = w * sh21 + z__;+	kx += *incx;+	ky += *incy;+/* L90: */+    }+    goto L140;+L100:+    sh11 = sparam[2];+    sh22 = sparam[5];+    i__2 = *n;+    for (i__ = 1; i__ <= i__2; ++i__) {+	w = sx[kx];+	z__ = sy[ky];+	sx[kx] = w * sh11 + z__;+	sy[ky] = -w + sh22 * z__;+	kx += *incx;+	ky += *incy;+/* L110: */+    }+    goto L140;+L120:+    sh11 = sparam[2];+    sh12 = sparam[4];+    sh21 = sparam[3];+    sh22 = sparam[5];+    i__2 = *n;+    for (i__ = 1; i__ <= i__2; ++i__) {+	w = sx[kx];+	z__ = sy[ky];+	sx[kx] = w * sh11 + z__ * sh12;+	sy[ky] = w * sh21 + z__ * sh22;+	kx += *incx;+	ky += *incy;+/* L130: */+    }+L140:+    return 0;+} /* srotm_ */+
+ eigen3/blas/f2c/srotmg.c view
@@ -0,0 +1,295 @@+/* srotmg.f -- translated by f2c (version 20100827).+   You must link the resulting object file with libf2c:+	on Microsoft Windows system, link with libf2c.lib;+	on Linux or Unix systems, link with .../path/to/libf2c.a -lm+	or, if you install libf2c.a in a standard place, with -lf2c -lm+	-- in that order, at the end of the command line, as in+		cc *.o -lf2c -lm+	Source for libf2c is in /netlib/f2c/libf2c.zip, e.g.,++		http://www.netlib.org/f2c/libf2c.zip+*/++#include "datatypes.h"++/* Subroutine */ int srotmg_(real *sd1, real *sd2, real *sx1, real *sy1, real +	*sparam)+{+    /* Initialized data */++    static real zero = 0.f;+    static real one = 1.f;+    static real two = 2.f;+    static real gam = 4096.f;+    static real gamsq = 16777200.f;+    static real rgamsq = 5.96046e-8f;++    /* Format strings */+    static char fmt_120[] = "";+    static char fmt_150[] = "";+    static char fmt_180[] = "";+    static char fmt_210[] = "";++    /* System generated locals */+    real r__1;++    /* Local variables */+    real su, sp1, sp2, sq1, sq2, sh11, sh12, sh21, sh22;+    integer igo;+    real sflag, stemp;++    /* Assigned format variables */+    static char *igo_fmt;++/*     .. Scalar Arguments .. */+/*     .. */+/*     .. Array Arguments .. */+/*     .. */++/*  Purpose */+/*  ======= */++/*     CONSTRUCT THE MODIFIED GIVENS TRANSFORMATION MATRIX H WHICH ZEROS */+/*     THE SECOND COMPONENT OF THE 2-VECTOR  (SQRT(SD1)*SX1,SQRT(SD2)* */+/*     SY2)**T. */+/*     WITH SPARAM(1)=SFLAG, H HAS ONE OF THE FOLLOWING FORMS.. */++/*     SFLAG=-1.E0     SFLAG=0.E0        SFLAG=1.E0     SFLAG=-2.E0 */++/*       (SH11  SH12)    (1.E0  SH12)    (SH11  1.E0)    (1.E0  0.E0) */+/*     H=(          )    (          )    (          )    (          ) */+/*       (SH21  SH22),   (SH21  1.E0),   (-1.E0 SH22),   (0.E0  1.E0). */+/*     LOCATIONS 2-4 OF SPARAM CONTAIN SH11,SH21,SH12, AND SH22 */+/*     RESPECTIVELY. (VALUES OF 1.E0, -1.E0, OR 0.E0 IMPLIED BY THE */+/*     VALUE OF SPARAM(1) ARE NOT STORED IN SPARAM.) */++/*     THE VALUES OF GAMSQ AND RGAMSQ SET IN THE DATA STATEMENT MAY BE */+/*     INEXACT.  THIS IS OK AS THEY ARE ONLY USED FOR TESTING THE SIZE */+/*     OF SD1 AND SD2.  ALL ACTUAL SCALING OF DATA IS DONE USING GAM. */+++/*  Arguments */+/*  ========= */+++/*  SD1    (input/output) REAL */++/*  SD2    (input/output) REAL */++/*  SX1    (input/output) REAL */++/*  SY1    (input) REAL */+++/*  SPARAM (input/output)  REAL array, dimension 5 */+/*     SPARAM(1)=SFLAG */+/*     SPARAM(2)=SH11 */+/*     SPARAM(3)=SH21 */+/*     SPARAM(4)=SH12 */+/*     SPARAM(5)=SH22 */++/*  ===================================================================== */++/*     .. Local Scalars .. */+/*     .. */+/*     .. Intrinsic Functions .. */+/*     .. */+/*     .. Data statements .. */++    /* Parameter adjustments */+    --sparam;++    /* Function Body */+/*     .. */+    if (! (*sd1 < zero)) {+	goto L10;+    }+/*       GO ZERO-H-D-AND-SX1.. */+    goto L60;+L10:+/*     CASE-SD1-NONNEGATIVE */+    sp2 = *sd2 * *sy1;+    if (! (sp2 == zero)) {+	goto L20;+    }+    sflag = -two;+    goto L260;+/*     REGULAR-CASE.. */+L20:+    sp1 = *sd1 * *sx1;+    sq2 = sp2 * *sy1;+    sq1 = sp1 * *sx1;++    if (! (dabs(sq1) > dabs(sq2))) {+	goto L40;+    }+    sh21 = -(*sy1) / *sx1;+    sh12 = sp2 / sp1;++    su = one - sh12 * sh21;++    if (! (su <= zero)) {+	goto L30;+    }+/*         GO ZERO-H-D-AND-SX1.. */+    goto L60;+L30:+    sflag = zero;+    *sd1 /= su;+    *sd2 /= su;+    *sx1 *= su;+/*         GO SCALE-CHECK.. */+    goto L100;+L40:+    if (! (sq2 < zero)) {+	goto L50;+    }+/*         GO ZERO-H-D-AND-SX1.. */+    goto L60;+L50:+    sflag = one;+    sh11 = sp1 / sp2;+    sh22 = *sx1 / *sy1;+    su = one + sh11 * sh22;+    stemp = *sd2 / su;+    *sd2 = *sd1 / su;+    *sd1 = stemp;+    *sx1 = *sy1 * su;+/*         GO SCALE-CHECK */+    goto L100;+/*     PROCEDURE..ZERO-H-D-AND-SX1.. */+L60:+    sflag = -one;+    sh11 = zero;+    sh12 = zero;+    sh21 = zero;+    sh22 = zero;++    *sd1 = zero;+    *sd2 = zero;+    *sx1 = zero;+/*         RETURN.. */+    goto L220;+/*     PROCEDURE..FIX-H.. */+L70:+    if (! (sflag >= zero)) {+	goto L90;+    }++    if (! (sflag == zero)) {+	goto L80;+    }+    sh11 = one;+    sh22 = one;+    sflag = -one;+    goto L90;+L80:+    sh21 = -one;+    sh12 = one;+    sflag = -one;+L90:+    switch (igo) {+	case 0: goto L120;+	case 1: goto L150;+	case 2: goto L180;+	case 3: goto L210;+    }+/*     PROCEDURE..SCALE-CHECK */+L100:+L110:+    if (! (*sd1 <= rgamsq)) {+	goto L130;+    }+    if (*sd1 == zero) {+	goto L160;+    }+    igo = 0;+    igo_fmt = fmt_120;+/*              FIX-H.. */+    goto L70;+L120:+/* Computing 2nd power */+    r__1 = gam;+    *sd1 *= r__1 * r__1;+    *sx1 /= gam;+    sh11 /= gam;+    sh12 /= gam;+    goto L110;+L130:+L140:+    if (! (*sd1 >= gamsq)) {+	goto L160;+    }+    igo = 1;+    igo_fmt = fmt_150;+/*              FIX-H.. */+    goto L70;+L150:+/* Computing 2nd power */+    r__1 = gam;+    *sd1 /= r__1 * r__1;+    *sx1 *= gam;+    sh11 *= gam;+    sh12 *= gam;+    goto L140;+L160:+L170:+    if (! (dabs(*sd2) <= rgamsq)) {+	goto L190;+    }+    if (*sd2 == zero) {+	goto L220;+    }+    igo = 2;+    igo_fmt = fmt_180;+/*              FIX-H.. */+    goto L70;+L180:+/* Computing 2nd power */+    r__1 = gam;+    *sd2 *= r__1 * r__1;+    sh21 /= gam;+    sh22 /= gam;+    goto L170;+L190:+L200:+    if (! (dabs(*sd2) >= gamsq)) {+	goto L220;+    }+    igo = 3;+    igo_fmt = fmt_210;+/*              FIX-H.. */+    goto L70;+L210:+/* Computing 2nd power */+    r__1 = gam;+    *sd2 /= r__1 * r__1;+    sh21 *= gam;+    sh22 *= gam;+    goto L200;+L220:+    if (sflag < 0.f) {+	goto L250;+    } else if (sflag == 0) {+	goto L230;+    } else {+	goto L240;+    }+L230:+    sparam[3] = sh21;+    sparam[4] = sh12;+    goto L260;+L240:+    sparam[2] = sh11;+    sparam[5] = sh22;+    goto L260;+L250:+    sparam[2] = sh11;+    sparam[3] = sh21;+    sparam[4] = sh12;+    sparam[5] = sh22;+L260:+    sparam[1] = sflag;+    return 0;+} /* srotmg_ */+
+ eigen3/blas/f2c/ssbmv.c view
@@ -0,0 +1,368 @@+/* ssbmv.f -- translated by f2c (version 20100827).+   You must link the resulting object file with libf2c:+	on Microsoft Windows system, link with libf2c.lib;+	on Linux or Unix systems, link with .../path/to/libf2c.a -lm+	or, if you install libf2c.a in a standard place, with -lf2c -lm+	-- in that order, at the end of the command line, as in+		cc *.o -lf2c -lm+	Source for libf2c is in /netlib/f2c/libf2c.zip, e.g.,++		http://www.netlib.org/f2c/libf2c.zip+*/++#include "datatypes.h"++/* Subroutine */ int ssbmv_(char *uplo, integer *n, integer *k, real *alpha, +	real *a, integer *lda, real *x, integer *incx, real *beta, real *y, +	integer *incy, ftnlen uplo_len)+{+    /* System generated locals */+    integer a_dim1, a_offset, i__1, i__2, i__3, i__4;++    /* Local variables */+    integer i__, j, l, ix, iy, jx, jy, kx, ky, info;+    real temp1, temp2;+    extern logical lsame_(char *, char *, ftnlen, ftnlen);+    integer kplus1;+    extern /* Subroutine */ int xerbla_(char *, integer *, ftnlen);++/*     .. Scalar Arguments .. */+/*     .. */+/*     .. Array Arguments .. */+/*     .. */++/*  Purpose */+/*  ======= */++/*  SSBMV  performs the matrix-vector  operation */++/*     y := alpha*A*x + beta*y, */++/*  where alpha and beta are scalars, x and y are n element vectors and */+/*  A is an n by n symmetric band matrix, with k super-diagonals. */++/*  Arguments */+/*  ========== */++/*  UPLO   - CHARACTER*1. */+/*           On entry, UPLO specifies whether the upper or lower */+/*           triangular part of the band matrix A is being supplied as */+/*           follows: */++/*              UPLO = 'U' or 'u'   The upper triangular part of A is */+/*                                  being supplied. */++/*              UPLO = 'L' or 'l'   The lower triangular part of A is */+/*                                  being supplied. */++/*           Unchanged on exit. */++/*  N      - INTEGER. */+/*           On entry, N specifies the order of the matrix A. */+/*           N must be at least zero. */+/*           Unchanged on exit. */++/*  K      - INTEGER. */+/*           On entry, K specifies the number of super-diagonals of the */+/*           matrix A. K must satisfy  0 .le. K. */+/*           Unchanged on exit. */++/*  ALPHA  - REAL            . */+/*           On entry, ALPHA specifies the scalar alpha. */+/*           Unchanged on exit. */++/*  A      - REAL             array of DIMENSION ( LDA, n ). */+/*           Before entry with UPLO = 'U' or 'u', the leading ( k + 1 ) */+/*           by n part of the array A must contain the upper triangular */+/*           band part of the symmetric matrix, supplied column by */+/*           column, with the leading diagonal of the matrix in row */+/*           ( k + 1 ) of the array, the first super-diagonal starting at */+/*           position 2 in row k, and so on. The top left k by k triangle */+/*           of the array A is not referenced. */+/*           The following program segment will transfer the upper */+/*           triangular part of a symmetric band matrix from conventional */+/*           full matrix storage to band storage: */++/*                 DO 20, J = 1, N */+/*                    M = K + 1 - J */+/*                    DO 10, I = MAX( 1, J - K ), J */+/*                       A( M + I, J ) = matrix( I, J ) */+/*              10    CONTINUE */+/*              20 CONTINUE */++/*           Before entry with UPLO = 'L' or 'l', the leading ( k + 1 ) */+/*           by n part of the array A must contain the lower triangular */+/*           band part of the symmetric matrix, supplied column by */+/*           column, with the leading diagonal of the matrix in row 1 of */+/*           the array, the first sub-diagonal starting at position 1 in */+/*           row 2, and so on. The bottom right k by k triangle of the */+/*           array A is not referenced. */+/*           The following program segment will transfer the lower */+/*           triangular part of a symmetric band matrix from conventional */+/*           full matrix storage to band storage: */++/*                 DO 20, J = 1, N */+/*                    M = 1 - J */+/*                    DO 10, I = J, MIN( N, J + K ) */+/*                       A( M + I, J ) = matrix( I, J ) */+/*              10    CONTINUE */+/*              20 CONTINUE */++/*           Unchanged on exit. */++/*  LDA    - INTEGER. */+/*           On entry, LDA specifies the first dimension of A as declared */+/*           in the calling (sub) program. LDA must be at least */+/*           ( k + 1 ). */+/*           Unchanged on exit. */++/*  X      - REAL             array of DIMENSION at least */+/*           ( 1 + ( n - 1 )*abs( INCX ) ). */+/*           Before entry, the incremented array X must contain the */+/*           vector x. */+/*           Unchanged on exit. */++/*  INCX   - INTEGER. */+/*           On entry, INCX specifies the increment for the elements of */+/*           X. INCX must not be zero. */+/*           Unchanged on exit. */++/*  BETA   - REAL            . */+/*           On entry, BETA specifies the scalar beta. */+/*           Unchanged on exit. */++/*  Y      - REAL             array of DIMENSION at least */+/*           ( 1 + ( n - 1 )*abs( INCY ) ). */+/*           Before entry, the incremented array Y must contain the */+/*           vector y. On exit, Y is overwritten by the updated vector y. */++/*  INCY   - INTEGER. */+/*           On entry, INCY specifies the increment for the elements of */+/*           Y. INCY must not be zero. */+/*           Unchanged on exit. */++/*  Further Details */+/*  =============== */++/*  Level 2 Blas routine. */++/*  -- Written on 22-October-1986. */+/*     Jack Dongarra, Argonne National Lab. */+/*     Jeremy Du Croz, Nag Central Office. */+/*     Sven Hammarling, Nag Central Office. */+/*     Richard Hanson, Sandia National Labs. */++/*  ===================================================================== */++/*     .. Parameters .. */+/*     .. */+/*     .. Local Scalars .. */+/*     .. */+/*     .. External Functions .. */+/*     .. */+/*     .. External Subroutines .. */+/*     .. */+/*     .. Intrinsic Functions .. */+/*     .. */++/*     Test the input parameters. */++    /* Parameter adjustments */+    a_dim1 = *lda;+    a_offset = 1 + a_dim1;+    a -= a_offset;+    --x;+    --y;++    /* Function Body */+    info = 0;+    if (! lsame_(uplo, "U", (ftnlen)1, (ftnlen)1) && ! lsame_(uplo, "L", (+	    ftnlen)1, (ftnlen)1)) {+	info = 1;+    } else if (*n < 0) {+	info = 2;+    } else if (*k < 0) {+	info = 3;+    } else if (*lda < *k + 1) {+	info = 6;+    } else if (*incx == 0) {+	info = 8;+    } else if (*incy == 0) {+	info = 11;+    }+    if (info != 0) {+	xerbla_("SSBMV ", &info, (ftnlen)6);+	return 0;+    }++/*     Quick return if possible. */++    if (*n == 0 || (*alpha == 0.f && *beta == 1.f)) {+	return 0;+    }++/*     Set up the start points in  X  and  Y. */++    if (*incx > 0) {+	kx = 1;+    } else {+	kx = 1 - (*n - 1) * *incx;+    }+    if (*incy > 0) {+	ky = 1;+    } else {+	ky = 1 - (*n - 1) * *incy;+    }++/*     Start the operations. In this version the elements of the array A */+/*     are accessed sequentially with one pass through A. */++/*     First form  y := beta*y. */++    if (*beta != 1.f) {+	if (*incy == 1) {+	    if (*beta == 0.f) {+		i__1 = *n;+		for (i__ = 1; i__ <= i__1; ++i__) {+		    y[i__] = 0.f;+/* L10: */+		}+	    } else {+		i__1 = *n;+		for (i__ = 1; i__ <= i__1; ++i__) {+		    y[i__] = *beta * y[i__];+/* L20: */+		}+	    }+	} else {+	    iy = ky;+	    if (*beta == 0.f) {+		i__1 = *n;+		for (i__ = 1; i__ <= i__1; ++i__) {+		    y[iy] = 0.f;+		    iy += *incy;+/* L30: */+		}+	    } else {+		i__1 = *n;+		for (i__ = 1; i__ <= i__1; ++i__) {+		    y[iy] = *beta * y[iy];+		    iy += *incy;+/* L40: */+		}+	    }+	}+    }+    if (*alpha == 0.f) {+	return 0;+    }+    if (lsame_(uplo, "U", (ftnlen)1, (ftnlen)1)) {++/*        Form  y  when upper triangle of A is stored. */++	kplus1 = *k + 1;+	if (*incx == 1 && *incy == 1) {+	    i__1 = *n;+	    for (j = 1; j <= i__1; ++j) {+		temp1 = *alpha * x[j];+		temp2 = 0.f;+		l = kplus1 - j;+/* Computing MAX */+		i__2 = 1, i__3 = j - *k;+		i__4 = j - 1;+		for (i__ = max(i__2,i__3); i__ <= i__4; ++i__) {+		    y[i__] += temp1 * a[l + i__ + j * a_dim1];+		    temp2 += a[l + i__ + j * a_dim1] * x[i__];+/* L50: */+		}+		y[j] = y[j] + temp1 * a[kplus1 + j * a_dim1] + *alpha * temp2;+/* L60: */+	    }+	} else {+	    jx = kx;+	    jy = ky;+	    i__1 = *n;+	    for (j = 1; j <= i__1; ++j) {+		temp1 = *alpha * x[jx];+		temp2 = 0.f;+		ix = kx;+		iy = ky;+		l = kplus1 - j;+/* Computing MAX */+		i__4 = 1, i__2 = j - *k;+		i__3 = j - 1;+		for (i__ = max(i__4,i__2); i__ <= i__3; ++i__) {+		    y[iy] += temp1 * a[l + i__ + j * a_dim1];+		    temp2 += a[l + i__ + j * a_dim1] * x[ix];+		    ix += *incx;+		    iy += *incy;+/* L70: */+		}+		y[jy] = y[jy] + temp1 * a[kplus1 + j * a_dim1] + *alpha * +			temp2;+		jx += *incx;+		jy += *incy;+		if (j > *k) {+		    kx += *incx;+		    ky += *incy;+		}+/* L80: */+	    }+	}+    } else {++/*        Form  y  when lower triangle of A is stored. */++	if (*incx == 1 && *incy == 1) {+	    i__1 = *n;+	    for (j = 1; j <= i__1; ++j) {+		temp1 = *alpha * x[j];+		temp2 = 0.f;+		y[j] += temp1 * a[j * a_dim1 + 1];+		l = 1 - j;+/* Computing MIN */+		i__4 = *n, i__2 = j + *k;+		i__3 = min(i__4,i__2);+		for (i__ = j + 1; i__ <= i__3; ++i__) {+		    y[i__] += temp1 * a[l + i__ + j * a_dim1];+		    temp2 += a[l + i__ + j * a_dim1] * x[i__];+/* L90: */+		}+		y[j] += *alpha * temp2;+/* L100: */+	    }+	} else {+	    jx = kx;+	    jy = ky;+	    i__1 = *n;+	    for (j = 1; j <= i__1; ++j) {+		temp1 = *alpha * x[jx];+		temp2 = 0.f;+		y[jy] += temp1 * a[j * a_dim1 + 1];+		l = 1 - j;+		ix = jx;+		iy = jy;+/* Computing MIN */+		i__4 = *n, i__2 = j + *k;+		i__3 = min(i__4,i__2);+		for (i__ = j + 1; i__ <= i__3; ++i__) {+		    ix += *incx;+		    iy += *incy;+		    y[iy] += temp1 * a[l + i__ + j * a_dim1];+		    temp2 += a[l + i__ + j * a_dim1] * x[ix];+/* L110: */+		}+		y[jy] += *alpha * temp2;+		jx += *incx;+		jy += *incy;+/* L120: */+	    }+	}+    }++    return 0;++/*     End of SSBMV . */++} /* ssbmv_ */+
+ eigen3/blas/f2c/sspmv.c view
@@ -0,0 +1,316 @@+/* sspmv.f -- translated by f2c (version 20100827).+   You must link the resulting object file with libf2c:+	on Microsoft Windows system, link with libf2c.lib;+	on Linux or Unix systems, link with .../path/to/libf2c.a -lm+	or, if you install libf2c.a in a standard place, with -lf2c -lm+	-- in that order, at the end of the command line, as in+		cc *.o -lf2c -lm+	Source for libf2c is in /netlib/f2c/libf2c.zip, e.g.,++		http://www.netlib.org/f2c/libf2c.zip+*/++#include "datatypes.h"++/* Subroutine */ int sspmv_(char *uplo, integer *n, real *alpha, real *ap, +	real *x, integer *incx, real *beta, real *y, integer *incy, ftnlen +	uplo_len)+{+    /* System generated locals */+    integer i__1, i__2;++    /* Local variables */+    integer i__, j, k, kk, ix, iy, jx, jy, kx, ky, info;+    real temp1, temp2;+    extern logical lsame_(char *, char *, ftnlen, ftnlen);+    extern /* Subroutine */ int xerbla_(char *, integer *, ftnlen);++/*     .. Scalar Arguments .. */+/*     .. */+/*     .. Array Arguments .. */+/*     .. */++/*  Purpose */+/*  ======= */++/*  SSPMV  performs the matrix-vector operation */++/*     y := alpha*A*x + beta*y, */++/*  where alpha and beta are scalars, x and y are n element vectors and */+/*  A is an n by n symmetric matrix, supplied in packed form. */++/*  Arguments */+/*  ========== */++/*  UPLO   - CHARACTER*1. */+/*           On entry, UPLO specifies whether the upper or lower */+/*           triangular part of the matrix A is supplied in the packed */+/*           array AP as follows: */++/*              UPLO = 'U' or 'u'   The upper triangular part of A is */+/*                                  supplied in AP. */++/*              UPLO = 'L' or 'l'   The lower triangular part of A is */+/*                                  supplied in AP. */++/*           Unchanged on exit. */++/*  N      - INTEGER. */+/*           On entry, N specifies the order of the matrix A. */+/*           N must be at least zero. */+/*           Unchanged on exit. */++/*  ALPHA  - REAL            . */+/*           On entry, ALPHA specifies the scalar alpha. */+/*           Unchanged on exit. */++/*  AP     - REAL             array of DIMENSION at least */+/*           ( ( n*( n + 1 ) )/2 ). */+/*           Before entry with UPLO = 'U' or 'u', the array AP must */+/*           contain the upper triangular part of the symmetric matrix */+/*           packed sequentially, column by column, so that AP( 1 ) */+/*           contains a( 1, 1 ), AP( 2 ) and AP( 3 ) contain a( 1, 2 ) */+/*           and a( 2, 2 ) respectively, and so on. */+/*           Before entry with UPLO = 'L' or 'l', the array AP must */+/*           contain the lower triangular part of the symmetric matrix */+/*           packed sequentially, column by column, so that AP( 1 ) */+/*           contains a( 1, 1 ), AP( 2 ) and AP( 3 ) contain a( 2, 1 ) */+/*           and a( 3, 1 ) respectively, and so on. */+/*           Unchanged on exit. */++/*  X      - REAL             array of dimension at least */+/*           ( 1 + ( n - 1 )*abs( INCX ) ). */+/*           Before entry, the incremented array X must contain the n */+/*           element vector x. */+/*           Unchanged on exit. */++/*  INCX   - INTEGER. */+/*           On entry, INCX specifies the increment for the elements of */+/*           X. INCX must not be zero. */+/*           Unchanged on exit. */++/*  BETA   - REAL            . */+/*           On entry, BETA specifies the scalar beta. When BETA is */+/*           supplied as zero then Y need not be set on input. */+/*           Unchanged on exit. */++/*  Y      - REAL             array of dimension at least */+/*           ( 1 + ( n - 1 )*abs( INCY ) ). */+/*           Before entry, the incremented array Y must contain the n */+/*           element vector y. On exit, Y is overwritten by the updated */+/*           vector y. */++/*  INCY   - INTEGER. */+/*           On entry, INCY specifies the increment for the elements of */+/*           Y. INCY must not be zero. */+/*           Unchanged on exit. */++/*  Further Details */+/*  =============== */++/*  Level 2 Blas routine. */++/*  -- Written on 22-October-1986. */+/*     Jack Dongarra, Argonne National Lab. */+/*     Jeremy Du Croz, Nag Central Office. */+/*     Sven Hammarling, Nag Central Office. */+/*     Richard Hanson, Sandia National Labs. */++/*  ===================================================================== */++/*     .. Parameters .. */+/*     .. */+/*     .. Local Scalars .. */+/*     .. */+/*     .. External Functions .. */+/*     .. */+/*     .. External Subroutines .. */+/*     .. */++/*     Test the input parameters. */++    /* Parameter adjustments */+    --y;+    --x;+    --ap;++    /* Function Body */+    info = 0;+    if (! lsame_(uplo, "U", (ftnlen)1, (ftnlen)1) && ! lsame_(uplo, "L", (+	    ftnlen)1, (ftnlen)1)) {+	info = 1;+    } else if (*n < 0) {+	info = 2;+    } else if (*incx == 0) {+	info = 6;+    } else if (*incy == 0) {+	info = 9;+    }+    if (info != 0) {+	xerbla_("SSPMV ", &info, (ftnlen)6);+	return 0;+    }++/*     Quick return if possible. */++    if (*n == 0 || (*alpha == 0.f && *beta == 1.f)) {+	return 0;+    }++/*     Set up the start points in  X  and  Y. */++    if (*incx > 0) {+	kx = 1;+    } else {+	kx = 1 - (*n - 1) * *incx;+    }+    if (*incy > 0) {+	ky = 1;+    } else {+	ky = 1 - (*n - 1) * *incy;+    }++/*     Start the operations. In this version the elements of the array AP */+/*     are accessed sequentially with one pass through AP. */++/*     First form  y := beta*y. */++    if (*beta != 1.f) {+	if (*incy == 1) {+	    if (*beta == 0.f) {+		i__1 = *n;+		for (i__ = 1; i__ <= i__1; ++i__) {+		    y[i__] = 0.f;+/* L10: */+		}+	    } else {+		i__1 = *n;+		for (i__ = 1; i__ <= i__1; ++i__) {+		    y[i__] = *beta * y[i__];+/* L20: */+		}+	    }+	} else {+	    iy = ky;+	    if (*beta == 0.f) {+		i__1 = *n;+		for (i__ = 1; i__ <= i__1; ++i__) {+		    y[iy] = 0.f;+		    iy += *incy;+/* L30: */+		}+	    } else {+		i__1 = *n;+		for (i__ = 1; i__ <= i__1; ++i__) {+		    y[iy] = *beta * y[iy];+		    iy += *incy;+/* L40: */+		}+	    }+	}+    }+    if (*alpha == 0.f) {+	return 0;+    }+    kk = 1;+    if (lsame_(uplo, "U", (ftnlen)1, (ftnlen)1)) {++/*        Form  y  when AP contains the upper triangle. */++	if (*incx == 1 && *incy == 1) {+	    i__1 = *n;+	    for (j = 1; j <= i__1; ++j) {+		temp1 = *alpha * x[j];+		temp2 = 0.f;+		k = kk;+		i__2 = j - 1;+		for (i__ = 1; i__ <= i__2; ++i__) {+		    y[i__] += temp1 * ap[k];+		    temp2 += ap[k] * x[i__];+		    ++k;+/* L50: */+		}+		y[j] = y[j] + temp1 * ap[kk + j - 1] + *alpha * temp2;+		kk += j;+/* L60: */+	    }+	} else {+	    jx = kx;+	    jy = ky;+	    i__1 = *n;+	    for (j = 1; j <= i__1; ++j) {+		temp1 = *alpha * x[jx];+		temp2 = 0.f;+		ix = kx;+		iy = ky;+		i__2 = kk + j - 2;+		for (k = kk; k <= i__2; ++k) {+		    y[iy] += temp1 * ap[k];+		    temp2 += ap[k] * x[ix];+		    ix += *incx;+		    iy += *incy;+/* L70: */+		}+		y[jy] = y[jy] + temp1 * ap[kk + j - 1] + *alpha * temp2;+		jx += *incx;+		jy += *incy;+		kk += j;+/* L80: */+	    }+	}+    } else {++/*        Form  y  when AP contains the lower triangle. */++	if (*incx == 1 && *incy == 1) {+	    i__1 = *n;+	    for (j = 1; j <= i__1; ++j) {+		temp1 = *alpha * x[j];+		temp2 = 0.f;+		y[j] += temp1 * ap[kk];+		k = kk + 1;+		i__2 = *n;+		for (i__ = j + 1; i__ <= i__2; ++i__) {+		    y[i__] += temp1 * ap[k];+		    temp2 += ap[k] * x[i__];+		    ++k;+/* L90: */+		}+		y[j] += *alpha * temp2;+		kk += *n - j + 1;+/* L100: */+	    }+	} else {+	    jx = kx;+	    jy = ky;+	    i__1 = *n;+	    for (j = 1; j <= i__1; ++j) {+		temp1 = *alpha * x[jx];+		temp2 = 0.f;+		y[jy] += temp1 * ap[kk];+		ix = jx;+		iy = jy;+		i__2 = kk + *n - j;+		for (k = kk + 1; k <= i__2; ++k) {+		    ix += *incx;+		    iy += *incy;+		    y[iy] += temp1 * ap[k];+		    temp2 += ap[k] * x[ix];+/* L110: */+		}+		y[jy] += *alpha * temp2;+		jx += *incx;+		jy += *incy;+		kk += *n - j + 1;+/* L120: */+	    }+	}+    }++    return 0;++/*     End of SSPMV . */++} /* sspmv_ */+
+ eigen3/blas/f2c/stbmv.c view
@@ -0,0 +1,428 @@+/* stbmv.f -- translated by f2c (version 20100827).+   You must link the resulting object file with libf2c:+	on Microsoft Windows system, link with libf2c.lib;+	on Linux or Unix systems, link with .../path/to/libf2c.a -lm+	or, if you install libf2c.a in a standard place, with -lf2c -lm+	-- in that order, at the end of the command line, as in+		cc *.o -lf2c -lm+	Source for libf2c is in /netlib/f2c/libf2c.zip, e.g.,++		http://www.netlib.org/f2c/libf2c.zip+*/++#include "datatypes.h"++/* Subroutine */ int stbmv_(char *uplo, char *trans, char *diag, integer *n, +	integer *k, real *a, integer *lda, real *x, integer *incx, ftnlen +	uplo_len, ftnlen trans_len, ftnlen diag_len)+{+    /* System generated locals */+    integer a_dim1, a_offset, i__1, i__2, i__3, i__4;++    /* Local variables */+    integer i__, j, l, ix, jx, kx, info;+    real temp;+    extern logical lsame_(char *, char *, ftnlen, ftnlen);+    integer kplus1;+    extern /* Subroutine */ int xerbla_(char *, integer *, ftnlen);+    logical nounit;++/*     .. Scalar Arguments .. */+/*     .. */+/*     .. Array Arguments .. */+/*     .. */++/*  Purpose */+/*  ======= */++/*  STBMV  performs one of the matrix-vector operations */++/*     x := A*x,   or   x := A'*x, */++/*  where x is an n element vector and  A is an n by n unit, or non-unit, */+/*  upper or lower triangular band matrix, with ( k + 1 ) diagonals. */++/*  Arguments */+/*  ========== */++/*  UPLO   - CHARACTER*1. */+/*           On entry, UPLO specifies whether the matrix is an upper or */+/*           lower triangular matrix as follows: */++/*              UPLO = 'U' or 'u'   A is an upper triangular matrix. */++/*              UPLO = 'L' or 'l'   A is a lower triangular matrix. */++/*           Unchanged on exit. */++/*  TRANS  - CHARACTER*1. */+/*           On entry, TRANS specifies the operation to be performed as */+/*           follows: */++/*              TRANS = 'N' or 'n'   x := A*x. */++/*              TRANS = 'T' or 't'   x := A'*x. */++/*              TRANS = 'C' or 'c'   x := A'*x. */++/*           Unchanged on exit. */++/*  DIAG   - CHARACTER*1. */+/*           On entry, DIAG specifies whether or not A is unit */+/*           triangular as follows: */++/*              DIAG = 'U' or 'u'   A is assumed to be unit triangular. */++/*              DIAG = 'N' or 'n'   A is not assumed to be unit */+/*                                  triangular. */++/*           Unchanged on exit. */++/*  N      - INTEGER. */+/*           On entry, N specifies the order of the matrix A. */+/*           N must be at least zero. */+/*           Unchanged on exit. */++/*  K      - INTEGER. */+/*           On entry with UPLO = 'U' or 'u', K specifies the number of */+/*           super-diagonals of the matrix A. */+/*           On entry with UPLO = 'L' or 'l', K specifies the number of */+/*           sub-diagonals of the matrix A. */+/*           K must satisfy  0 .le. K. */+/*           Unchanged on exit. */++/*  A      - REAL             array of DIMENSION ( LDA, n ). */+/*           Before entry with UPLO = 'U' or 'u', the leading ( k + 1 ) */+/*           by n part of the array A must contain the upper triangular */+/*           band part of the matrix of coefficients, supplied column by */+/*           column, with the leading diagonal of the matrix in row */+/*           ( k + 1 ) of the array, the first super-diagonal starting at */+/*           position 2 in row k, and so on. The top left k by k triangle */+/*           of the array A is not referenced. */+/*           The following program segment will transfer an upper */+/*           triangular band matrix from conventional full matrix storage */+/*           to band storage: */++/*                 DO 20, J = 1, N */+/*                    M = K + 1 - J */+/*                    DO 10, I = MAX( 1, J - K ), J */+/*                       A( M + I, J ) = matrix( I, J ) */+/*              10    CONTINUE */+/*              20 CONTINUE */++/*           Before entry with UPLO = 'L' or 'l', the leading ( k + 1 ) */+/*           by n part of the array A must contain the lower triangular */+/*           band part of the matrix of coefficients, supplied column by */+/*           column, with the leading diagonal of the matrix in row 1 of */+/*           the array, the first sub-diagonal starting at position 1 in */+/*           row 2, and so on. The bottom right k by k triangle of the */+/*           array A is not referenced. */+/*           The following program segment will transfer a lower */+/*           triangular band matrix from conventional full matrix storage */+/*           to band storage: */++/*                 DO 20, J = 1, N */+/*                    M = 1 - J */+/*                    DO 10, I = J, MIN( N, J + K ) */+/*                       A( M + I, J ) = matrix( I, J ) */+/*              10    CONTINUE */+/*              20 CONTINUE */++/*           Note that when DIAG = 'U' or 'u' the elements of the array A */+/*           corresponding to the diagonal elements of the matrix are not */+/*           referenced, but are assumed to be unity. */+/*           Unchanged on exit. */++/*  LDA    - INTEGER. */+/*           On entry, LDA specifies the first dimension of A as declared */+/*           in the calling (sub) program. LDA must be at least */+/*           ( k + 1 ). */+/*           Unchanged on exit. */++/*  X      - REAL             array of dimension at least */+/*           ( 1 + ( n - 1 )*abs( INCX ) ). */+/*           Before entry, the incremented array X must contain the n */+/*           element vector x. On exit, X is overwritten with the */+/*           tranformed vector x. */++/*  INCX   - INTEGER. */+/*           On entry, INCX specifies the increment for the elements of */+/*           X. INCX must not be zero. */+/*           Unchanged on exit. */++/*  Further Details */+/*  =============== */++/*  Level 2 Blas routine. */++/*  -- Written on 22-October-1986. */+/*     Jack Dongarra, Argonne National Lab. */+/*     Jeremy Du Croz, Nag Central Office. */+/*     Sven Hammarling, Nag Central Office. */+/*     Richard Hanson, Sandia National Labs. */++/*  ===================================================================== */++/*     .. Parameters .. */+/*     .. */+/*     .. Local Scalars .. */+/*     .. */+/*     .. External Functions .. */+/*     .. */+/*     .. External Subroutines .. */+/*     .. */+/*     .. Intrinsic Functions .. */+/*     .. */++/*     Test the input parameters. */++    /* Parameter adjustments */+    a_dim1 = *lda;+    a_offset = 1 + a_dim1;+    a -= a_offset;+    --x;++    /* Function Body */+    info = 0;+    if (! lsame_(uplo, "U", (ftnlen)1, (ftnlen)1) && ! lsame_(uplo, "L", (+	    ftnlen)1, (ftnlen)1)) {+	info = 1;+    } else if (! lsame_(trans, "N", (ftnlen)1, (ftnlen)1) && ! lsame_(trans, +	    "T", (ftnlen)1, (ftnlen)1) && ! lsame_(trans, "C", (ftnlen)1, (+	    ftnlen)1)) {+	info = 2;+    } else if (! lsame_(diag, "U", (ftnlen)1, (ftnlen)1) && ! lsame_(diag, +	    "N", (ftnlen)1, (ftnlen)1)) {+	info = 3;+    } else if (*n < 0) {+	info = 4;+    } else if (*k < 0) {+	info = 5;+    } else if (*lda < *k + 1) {+	info = 7;+    } else if (*incx == 0) {+	info = 9;+    }+    if (info != 0) {+	xerbla_("STBMV ", &info, (ftnlen)6);+	return 0;+    }++/*     Quick return if possible. */++    if (*n == 0) {+	return 0;+    }++    nounit = lsame_(diag, "N", (ftnlen)1, (ftnlen)1);++/*     Set up the start point in X if the increment is not unity. This */+/*     will be  ( N - 1 )*INCX   too small for descending loops. */++    if (*incx <= 0) {+	kx = 1 - (*n - 1) * *incx;+    } else if (*incx != 1) {+	kx = 1;+    }++/*     Start the operations. In this version the elements of A are */+/*     accessed sequentially with one pass through A. */++    if (lsame_(trans, "N", (ftnlen)1, (ftnlen)1)) {++/*         Form  x := A*x. */++	if (lsame_(uplo, "U", (ftnlen)1, (ftnlen)1)) {+	    kplus1 = *k + 1;+	    if (*incx == 1) {+		i__1 = *n;+		for (j = 1; j <= i__1; ++j) {+		    if (x[j] != 0.f) {+			temp = x[j];+			l = kplus1 - j;+/* Computing MAX */+			i__2 = 1, i__3 = j - *k;+			i__4 = j - 1;+			for (i__ = max(i__2,i__3); i__ <= i__4; ++i__) {+			    x[i__] += temp * a[l + i__ + j * a_dim1];+/* L10: */+			}+			if (nounit) {+			    x[j] *= a[kplus1 + j * a_dim1];+			}+		    }+/* L20: */+		}+	    } else {+		jx = kx;+		i__1 = *n;+		for (j = 1; j <= i__1; ++j) {+		    if (x[jx] != 0.f) {+			temp = x[jx];+			ix = kx;+			l = kplus1 - j;+/* Computing MAX */+			i__4 = 1, i__2 = j - *k;+			i__3 = j - 1;+			for (i__ = max(i__4,i__2); i__ <= i__3; ++i__) {+			    x[ix] += temp * a[l + i__ + j * a_dim1];+			    ix += *incx;+/* L30: */+			}+			if (nounit) {+			    x[jx] *= a[kplus1 + j * a_dim1];+			}+		    }+		    jx += *incx;+		    if (j > *k) {+			kx += *incx;+		    }+/* L40: */+		}+	    }+	} else {+	    if (*incx == 1) {+		for (j = *n; j >= 1; --j) {+		    if (x[j] != 0.f) {+			temp = x[j];+			l = 1 - j;+/* Computing MIN */+			i__1 = *n, i__3 = j + *k;+			i__4 = j + 1;+			for (i__ = min(i__1,i__3); i__ >= i__4; --i__) {+			    x[i__] += temp * a[l + i__ + j * a_dim1];+/* L50: */+			}+			if (nounit) {+			    x[j] *= a[j * a_dim1 + 1];+			}+		    }+/* L60: */+		}+	    } else {+		kx += (*n - 1) * *incx;+		jx = kx;+		for (j = *n; j >= 1; --j) {+		    if (x[jx] != 0.f) {+			temp = x[jx];+			ix = kx;+			l = 1 - j;+/* Computing MIN */+			i__4 = *n, i__1 = j + *k;+			i__3 = j + 1;+			for (i__ = min(i__4,i__1); i__ >= i__3; --i__) {+			    x[ix] += temp * a[l + i__ + j * a_dim1];+			    ix -= *incx;+/* L70: */+			}+			if (nounit) {+			    x[jx] *= a[j * a_dim1 + 1];+			}+		    }+		    jx -= *incx;+		    if (*n - j >= *k) {+			kx -= *incx;+		    }+/* L80: */+		}+	    }+	}+    } else {++/*        Form  x := A'*x. */++	if (lsame_(uplo, "U", (ftnlen)1, (ftnlen)1)) {+	    kplus1 = *k + 1;+	    if (*incx == 1) {+		for (j = *n; j >= 1; --j) {+		    temp = x[j];+		    l = kplus1 - j;+		    if (nounit) {+			temp *= a[kplus1 + j * a_dim1];+		    }+/* Computing MAX */+		    i__4 = 1, i__1 = j - *k;+		    i__3 = max(i__4,i__1);+		    for (i__ = j - 1; i__ >= i__3; --i__) {+			temp += a[l + i__ + j * a_dim1] * x[i__];+/* L90: */+		    }+		    x[j] = temp;+/* L100: */+		}+	    } else {+		kx += (*n - 1) * *incx;+		jx = kx;+		for (j = *n; j >= 1; --j) {+		    temp = x[jx];+		    kx -= *incx;+		    ix = kx;+		    l = kplus1 - j;+		    if (nounit) {+			temp *= a[kplus1 + j * a_dim1];+		    }+/* Computing MAX */+		    i__4 = 1, i__1 = j - *k;+		    i__3 = max(i__4,i__1);+		    for (i__ = j - 1; i__ >= i__3; --i__) {+			temp += a[l + i__ + j * a_dim1] * x[ix];+			ix -= *incx;+/* L110: */+		    }+		    x[jx] = temp;+		    jx -= *incx;+/* L120: */+		}+	    }+	} else {+	    if (*incx == 1) {+		i__3 = *n;+		for (j = 1; j <= i__3; ++j) {+		    temp = x[j];+		    l = 1 - j;+		    if (nounit) {+			temp *= a[j * a_dim1 + 1];+		    }+/* Computing MIN */+		    i__1 = *n, i__2 = j + *k;+		    i__4 = min(i__1,i__2);+		    for (i__ = j + 1; i__ <= i__4; ++i__) {+			temp += a[l + i__ + j * a_dim1] * x[i__];+/* L130: */+		    }+		    x[j] = temp;+/* L140: */+		}+	    } else {+		jx = kx;+		i__3 = *n;+		for (j = 1; j <= i__3; ++j) {+		    temp = x[jx];+		    kx += *incx;+		    ix = kx;+		    l = 1 - j;+		    if (nounit) {+			temp *= a[j * a_dim1 + 1];+		    }+/* Computing MIN */+		    i__1 = *n, i__2 = j + *k;+		    i__4 = min(i__1,i__2);+		    for (i__ = j + 1; i__ <= i__4; ++i__) {+			temp += a[l + i__ + j * a_dim1] * x[ix];+			ix += *incx;+/* L150: */+		    }+		    x[jx] = temp;+		    jx += *incx;+/* L160: */+		}+	    }+	}+    }++    return 0;++/*     End of STBMV . */++} /* stbmv_ */+
+ eigen3/blas/f2c/zhbmv.c view
@@ -0,0 +1,488 @@+/* zhbmv.f -- translated by f2c (version 20100827).+   You must link the resulting object file with libf2c:+	on Microsoft Windows system, link with libf2c.lib;+	on Linux or Unix systems, link with .../path/to/libf2c.a -lm+	or, if you install libf2c.a in a standard place, with -lf2c -lm+	-- in that order, at the end of the command line, as in+		cc *.o -lf2c -lm+	Source for libf2c is in /netlib/f2c/libf2c.zip, e.g.,++		http://www.netlib.org/f2c/libf2c.zip+*/++#include "datatypes.h"++/* Subroutine */ int zhbmv_(char *uplo, integer *n, integer *k, doublecomplex +	*alpha, doublecomplex *a, integer *lda, doublecomplex *x, integer *+	incx, doublecomplex *beta, doublecomplex *y, integer *incy, ftnlen +	uplo_len)+{+    /* System generated locals */+    integer a_dim1, a_offset, i__1, i__2, i__3, i__4, i__5;+    doublereal d__1;+    doublecomplex z__1, z__2, z__3, z__4;++    /* Builtin functions */+    void d_cnjg(doublecomplex *, doublecomplex *);++    /* Local variables */+    integer i__, j, l, ix, iy, jx, jy, kx, ky, info;+    doublecomplex temp1, temp2;+    extern logical lsame_(char *, char *, ftnlen, ftnlen);+    integer kplus1;+    extern /* Subroutine */ int xerbla_(char *, integer *, ftnlen);++/*     .. Scalar Arguments .. */+/*     .. */+/*     .. Array Arguments .. */+/*     .. */++/*  Purpose */+/*  ======= */++/*  ZHBMV  performs the matrix-vector  operation */++/*     y := alpha*A*x + beta*y, */++/*  where alpha and beta are scalars, x and y are n element vectors and */+/*  A is an n by n hermitian band matrix, with k super-diagonals. */++/*  Arguments */+/*  ========== */++/*  UPLO   - CHARACTER*1. */+/*           On entry, UPLO specifies whether the upper or lower */+/*           triangular part of the band matrix A is being supplied as */+/*           follows: */++/*              UPLO = 'U' or 'u'   The upper triangular part of A is */+/*                                  being supplied. */++/*              UPLO = 'L' or 'l'   The lower triangular part of A is */+/*                                  being supplied. */++/*           Unchanged on exit. */++/*  N      - INTEGER. */+/*           On entry, N specifies the order of the matrix A. */+/*           N must be at least zero. */+/*           Unchanged on exit. */++/*  K      - INTEGER. */+/*           On entry, K specifies the number of super-diagonals of the */+/*           matrix A. K must satisfy  0 .le. K. */+/*           Unchanged on exit. */++/*  ALPHA  - COMPLEX*16      . */+/*           On entry, ALPHA specifies the scalar alpha. */+/*           Unchanged on exit. */++/*  A      - COMPLEX*16       array of DIMENSION ( LDA, n ). */+/*           Before entry with UPLO = 'U' or 'u', the leading ( k + 1 ) */+/*           by n part of the array A must contain the upper triangular */+/*           band part of the hermitian matrix, supplied column by */+/*           column, with the leading diagonal of the matrix in row */+/*           ( k + 1 ) of the array, the first super-diagonal starting at */+/*           position 2 in row k, and so on. The top left k by k triangle */+/*           of the array A is not referenced. */+/*           The following program segment will transfer the upper */+/*           triangular part of a hermitian band matrix from conventional */+/*           full matrix storage to band storage: */++/*                 DO 20, J = 1, N */+/*                    M = K + 1 - J */+/*                    DO 10, I = MAX( 1, J - K ), J */+/*                       A( M + I, J ) = matrix( I, J ) */+/*              10    CONTINUE */+/*              20 CONTINUE */++/*           Before entry with UPLO = 'L' or 'l', the leading ( k + 1 ) */+/*           by n part of the array A must contain the lower triangular */+/*           band part of the hermitian matrix, supplied column by */+/*           column, with the leading diagonal of the matrix in row 1 of */+/*           the array, the first sub-diagonal starting at position 1 in */+/*           row 2, and so on. The bottom right k by k triangle of the */+/*           array A is not referenced. */+/*           The following program segment will transfer the lower */+/*           triangular part of a hermitian band matrix from conventional */+/*           full matrix storage to band storage: */++/*                 DO 20, J = 1, N */+/*                    M = 1 - J */+/*                    DO 10, I = J, MIN( N, J + K ) */+/*                       A( M + I, J ) = matrix( I, J ) */+/*              10    CONTINUE */+/*              20 CONTINUE */++/*           Note that the imaginary parts of the diagonal elements need */+/*           not be set and are assumed to be zero. */+/*           Unchanged on exit. */++/*  LDA    - INTEGER. */+/*           On entry, LDA specifies the first dimension of A as declared */+/*           in the calling (sub) program. LDA must be at least */+/*           ( k + 1 ). */+/*           Unchanged on exit. */++/*  X      - COMPLEX*16       array of DIMENSION at least */+/*           ( 1 + ( n - 1 )*abs( INCX ) ). */+/*           Before entry, the incremented array X must contain the */+/*           vector x. */+/*           Unchanged on exit. */++/*  INCX   - INTEGER. */+/*           On entry, INCX specifies the increment for the elements of */+/*           X. INCX must not be zero. */+/*           Unchanged on exit. */++/*  BETA   - COMPLEX*16      . */+/*           On entry, BETA specifies the scalar beta. */+/*           Unchanged on exit. */++/*  Y      - COMPLEX*16       array of DIMENSION at least */+/*           ( 1 + ( n - 1 )*abs( INCY ) ). */+/*           Before entry, the incremented array Y must contain the */+/*           vector y. On exit, Y is overwritten by the updated vector y. */++/*  INCY   - INTEGER. */+/*           On entry, INCY specifies the increment for the elements of */+/*           Y. INCY must not be zero. */+/*           Unchanged on exit. */++/*  Further Details */+/*  =============== */++/*  Level 2 Blas routine. */++/*  -- Written on 22-October-1986. */+/*     Jack Dongarra, Argonne National Lab. */+/*     Jeremy Du Croz, Nag Central Office. */+/*     Sven Hammarling, Nag Central Office. */+/*     Richard Hanson, Sandia National Labs. */++/*  ===================================================================== */++/*     .. Parameters .. */+/*     .. */+/*     .. Local Scalars .. */+/*     .. */+/*     .. External Functions .. */+/*     .. */+/*     .. External Subroutines .. */+/*     .. */+/*     .. Intrinsic Functions .. */+/*     .. */++/*     Test the input parameters. */++    /* Parameter adjustments */+    a_dim1 = *lda;+    a_offset = 1 + a_dim1;+    a -= a_offset;+    --x;+    --y;++    /* Function Body */+    info = 0;+    if (! lsame_(uplo, "U", (ftnlen)1, (ftnlen)1) && ! lsame_(uplo, "L", (+	    ftnlen)1, (ftnlen)1)) {+	info = 1;+    } else if (*n < 0) {+	info = 2;+    } else if (*k < 0) {+	info = 3;+    } else if (*lda < *k + 1) {+	info = 6;+    } else if (*incx == 0) {+	info = 8;+    } else if (*incy == 0) {+	info = 11;+    }+    if (info != 0) {+	xerbla_("ZHBMV ", &info, (ftnlen)6);+	return 0;+    }++/*     Quick return if possible. */++    if (*n == 0 || (alpha->r == 0. && alpha->i == 0. && (beta->r == 1. && +                                                         beta->i == 0.))) {+	return 0;+    }++/*     Set up the start points in  X  and  Y. */++    if (*incx > 0) {+	kx = 1;+    } else {+	kx = 1 - (*n - 1) * *incx;+    }+    if (*incy > 0) {+	ky = 1;+    } else {+	ky = 1 - (*n - 1) * *incy;+    }++/*     Start the operations. In this version the elements of the array A */+/*     are accessed sequentially with one pass through A. */++/*     First form  y := beta*y. */++    if (beta->r != 1. || beta->i != 0.) {+	if (*incy == 1) {+	    if (beta->r == 0. && beta->i == 0.) {+		i__1 = *n;+		for (i__ = 1; i__ <= i__1; ++i__) {+		    i__2 = i__;+		    y[i__2].r = 0., y[i__2].i = 0.;+/* L10: */+		}+	    } else {+		i__1 = *n;+		for (i__ = 1; i__ <= i__1; ++i__) {+		    i__2 = i__;+		    i__3 = i__;+		    z__1.r = beta->r * y[i__3].r - beta->i * y[i__3].i, +			    z__1.i = beta->r * y[i__3].i + beta->i * y[i__3]+			    .r;+		    y[i__2].r = z__1.r, y[i__2].i = z__1.i;+/* L20: */+		}+	    }+	} else {+	    iy = ky;+	    if (beta->r == 0. && beta->i == 0.) {+		i__1 = *n;+		for (i__ = 1; i__ <= i__1; ++i__) {+		    i__2 = iy;+		    y[i__2].r = 0., y[i__2].i = 0.;+		    iy += *incy;+/* L30: */+		}+	    } else {+		i__1 = *n;+		for (i__ = 1; i__ <= i__1; ++i__) {+		    i__2 = iy;+		    i__3 = iy;+		    z__1.r = beta->r * y[i__3].r - beta->i * y[i__3].i, +			    z__1.i = beta->r * y[i__3].i + beta->i * y[i__3]+			    .r;+		    y[i__2].r = z__1.r, y[i__2].i = z__1.i;+		    iy += *incy;+/* L40: */+		}+	    }+	}+    }+    if (alpha->r == 0. && alpha->i == 0.) {+	return 0;+    }+    if (lsame_(uplo, "U", (ftnlen)1, (ftnlen)1)) {++/*        Form  y  when upper triangle of A is stored. */++	kplus1 = *k + 1;+	if (*incx == 1 && *incy == 1) {+	    i__1 = *n;+	    for (j = 1; j <= i__1; ++j) {+		i__2 = j;+		z__1.r = alpha->r * x[i__2].r - alpha->i * x[i__2].i, z__1.i =+			 alpha->r * x[i__2].i + alpha->i * x[i__2].r;+		temp1.r = z__1.r, temp1.i = z__1.i;+		temp2.r = 0., temp2.i = 0.;+		l = kplus1 - j;+/* Computing MAX */+		i__2 = 1, i__3 = j - *k;+		i__4 = j - 1;+		for (i__ = max(i__2,i__3); i__ <= i__4; ++i__) {+		    i__2 = i__;+		    i__3 = i__;+		    i__5 = l + i__ + j * a_dim1;+		    z__2.r = temp1.r * a[i__5].r - temp1.i * a[i__5].i, +			    z__2.i = temp1.r * a[i__5].i + temp1.i * a[i__5]+			    .r;+		    z__1.r = y[i__3].r + z__2.r, z__1.i = y[i__3].i + z__2.i;+		    y[i__2].r = z__1.r, y[i__2].i = z__1.i;+		    d_cnjg(&z__3, &a[l + i__ + j * a_dim1]);+		    i__2 = i__;+		    z__2.r = z__3.r * x[i__2].r - z__3.i * x[i__2].i, z__2.i =+			     z__3.r * x[i__2].i + z__3.i * x[i__2].r;+		    z__1.r = temp2.r + z__2.r, z__1.i = temp2.i + z__2.i;+		    temp2.r = z__1.r, temp2.i = z__1.i;+/* L50: */+		}+		i__4 = j;+		i__2 = j;+		i__3 = kplus1 + j * a_dim1;+		d__1 = a[i__3].r;+		z__3.r = d__1 * temp1.r, z__3.i = d__1 * temp1.i;+		z__2.r = y[i__2].r + z__3.r, z__2.i = y[i__2].i + z__3.i;+		z__4.r = alpha->r * temp2.r - alpha->i * temp2.i, z__4.i = +			alpha->r * temp2.i + alpha->i * temp2.r;+		z__1.r = z__2.r + z__4.r, z__1.i = z__2.i + z__4.i;+		y[i__4].r = z__1.r, y[i__4].i = z__1.i;+/* L60: */+	    }+	} else {+	    jx = kx;+	    jy = ky;+	    i__1 = *n;+	    for (j = 1; j <= i__1; ++j) {+		i__4 = jx;+		z__1.r = alpha->r * x[i__4].r - alpha->i * x[i__4].i, z__1.i =+			 alpha->r * x[i__4].i + alpha->i * x[i__4].r;+		temp1.r = z__1.r, temp1.i = z__1.i;+		temp2.r = 0., temp2.i = 0.;+		ix = kx;+		iy = ky;+		l = kplus1 - j;+/* Computing MAX */+		i__4 = 1, i__2 = j - *k;+		i__3 = j - 1;+		for (i__ = max(i__4,i__2); i__ <= i__3; ++i__) {+		    i__4 = iy;+		    i__2 = iy;+		    i__5 = l + i__ + j * a_dim1;+		    z__2.r = temp1.r * a[i__5].r - temp1.i * a[i__5].i, +			    z__2.i = temp1.r * a[i__5].i + temp1.i * a[i__5]+			    .r;+		    z__1.r = y[i__2].r + z__2.r, z__1.i = y[i__2].i + z__2.i;+		    y[i__4].r = z__1.r, y[i__4].i = z__1.i;+		    d_cnjg(&z__3, &a[l + i__ + j * a_dim1]);+		    i__4 = ix;+		    z__2.r = z__3.r * x[i__4].r - z__3.i * x[i__4].i, z__2.i =+			     z__3.r * x[i__4].i + z__3.i * x[i__4].r;+		    z__1.r = temp2.r + z__2.r, z__1.i = temp2.i + z__2.i;+		    temp2.r = z__1.r, temp2.i = z__1.i;+		    ix += *incx;+		    iy += *incy;+/* L70: */+		}+		i__3 = jy;+		i__4 = jy;+		i__2 = kplus1 + j * a_dim1;+		d__1 = a[i__2].r;+		z__3.r = d__1 * temp1.r, z__3.i = d__1 * temp1.i;+		z__2.r = y[i__4].r + z__3.r, z__2.i = y[i__4].i + z__3.i;+		z__4.r = alpha->r * temp2.r - alpha->i * temp2.i, z__4.i = +			alpha->r * temp2.i + alpha->i * temp2.r;+		z__1.r = z__2.r + z__4.r, z__1.i = z__2.i + z__4.i;+		y[i__3].r = z__1.r, y[i__3].i = z__1.i;+		jx += *incx;+		jy += *incy;+		if (j > *k) {+		    kx += *incx;+		    ky += *incy;+		}+/* L80: */+	    }+	}+    } else {++/*        Form  y  when lower triangle of A is stored. */++	if (*incx == 1 && *incy == 1) {+	    i__1 = *n;+	    for (j = 1; j <= i__1; ++j) {+		i__3 = j;+		z__1.r = alpha->r * x[i__3].r - alpha->i * x[i__3].i, z__1.i =+			 alpha->r * x[i__3].i + alpha->i * x[i__3].r;+		temp1.r = z__1.r, temp1.i = z__1.i;+		temp2.r = 0., temp2.i = 0.;+		i__3 = j;+		i__4 = j;+		i__2 = j * a_dim1 + 1;+		d__1 = a[i__2].r;+		z__2.r = d__1 * temp1.r, z__2.i = d__1 * temp1.i;+		z__1.r = y[i__4].r + z__2.r, z__1.i = y[i__4].i + z__2.i;+		y[i__3].r = z__1.r, y[i__3].i = z__1.i;+		l = 1 - j;+/* Computing MIN */+		i__4 = *n, i__2 = j + *k;+		i__3 = min(i__4,i__2);+		for (i__ = j + 1; i__ <= i__3; ++i__) {+		    i__4 = i__;+		    i__2 = i__;+		    i__5 = l + i__ + j * a_dim1;+		    z__2.r = temp1.r * a[i__5].r - temp1.i * a[i__5].i, +			    z__2.i = temp1.r * a[i__5].i + temp1.i * a[i__5]+			    .r;+		    z__1.r = y[i__2].r + z__2.r, z__1.i = y[i__2].i + z__2.i;+		    y[i__4].r = z__1.r, y[i__4].i = z__1.i;+		    d_cnjg(&z__3, &a[l + i__ + j * a_dim1]);+		    i__4 = i__;+		    z__2.r = z__3.r * x[i__4].r - z__3.i * x[i__4].i, z__2.i =+			     z__3.r * x[i__4].i + z__3.i * x[i__4].r;+		    z__1.r = temp2.r + z__2.r, z__1.i = temp2.i + z__2.i;+		    temp2.r = z__1.r, temp2.i = z__1.i;+/* L90: */+		}+		i__3 = j;+		i__4 = j;+		z__2.r = alpha->r * temp2.r - alpha->i * temp2.i, z__2.i = +			alpha->r * temp2.i + alpha->i * temp2.r;+		z__1.r = y[i__4].r + z__2.r, z__1.i = y[i__4].i + z__2.i;+		y[i__3].r = z__1.r, y[i__3].i = z__1.i;+/* L100: */+	    }+	} else {+	    jx = kx;+	    jy = ky;+	    i__1 = *n;+	    for (j = 1; j <= i__1; ++j) {+		i__3 = jx;+		z__1.r = alpha->r * x[i__3].r - alpha->i * x[i__3].i, z__1.i =+			 alpha->r * x[i__3].i + alpha->i * x[i__3].r;+		temp1.r = z__1.r, temp1.i = z__1.i;+		temp2.r = 0., temp2.i = 0.;+		i__3 = jy;+		i__4 = jy;+		i__2 = j * a_dim1 + 1;+		d__1 = a[i__2].r;+		z__2.r = d__1 * temp1.r, z__2.i = d__1 * temp1.i;+		z__1.r = y[i__4].r + z__2.r, z__1.i = y[i__4].i + z__2.i;+		y[i__3].r = z__1.r, y[i__3].i = z__1.i;+		l = 1 - j;+		ix = jx;+		iy = jy;+/* Computing MIN */+		i__4 = *n, i__2 = j + *k;+		i__3 = min(i__4,i__2);+		for (i__ = j + 1; i__ <= i__3; ++i__) {+		    ix += *incx;+		    iy += *incy;+		    i__4 = iy;+		    i__2 = iy;+		    i__5 = l + i__ + j * a_dim1;+		    z__2.r = temp1.r * a[i__5].r - temp1.i * a[i__5].i, +			    z__2.i = temp1.r * a[i__5].i + temp1.i * a[i__5]+			    .r;+		    z__1.r = y[i__2].r + z__2.r, z__1.i = y[i__2].i + z__2.i;+		    y[i__4].r = z__1.r, y[i__4].i = z__1.i;+		    d_cnjg(&z__3, &a[l + i__ + j * a_dim1]);+		    i__4 = ix;+		    z__2.r = z__3.r * x[i__4].r - z__3.i * x[i__4].i, z__2.i =+			     z__3.r * x[i__4].i + z__3.i * x[i__4].r;+		    z__1.r = temp2.r + z__2.r, z__1.i = temp2.i + z__2.i;+		    temp2.r = z__1.r, temp2.i = z__1.i;+/* L110: */+		}+		i__3 = jy;+		i__4 = jy;+		z__2.r = alpha->r * temp2.r - alpha->i * temp2.i, z__2.i = +			alpha->r * temp2.i + alpha->i * temp2.r;+		z__1.r = y[i__4].r + z__2.r, z__1.i = y[i__4].i + z__2.i;+		y[i__3].r = z__1.r, y[i__3].i = z__1.i;+		jx += *incx;+		jy += *incy;+/* L120: */+	    }+	}+    }++    return 0;++/*     End of ZHBMV . */++} /* zhbmv_ */+
+ eigen3/blas/f2c/zhpmv.c view
@@ -0,0 +1,438 @@+/* zhpmv.f -- translated by f2c (version 20100827).+   You must link the resulting object file with libf2c:+	on Microsoft Windows system, link with libf2c.lib;+	on Linux or Unix systems, link with .../path/to/libf2c.a -lm+	or, if you install libf2c.a in a standard place, with -lf2c -lm+	-- in that order, at the end of the command line, as in+		cc *.o -lf2c -lm+	Source for libf2c is in /netlib/f2c/libf2c.zip, e.g.,++		http://www.netlib.org/f2c/libf2c.zip+*/++#include "datatypes.h"++/* Subroutine */ int zhpmv_(char *uplo, integer *n, doublecomplex *alpha, +	doublecomplex *ap, doublecomplex *x, integer *incx, doublecomplex *+	beta, doublecomplex *y, integer *incy, ftnlen uplo_len)+{+    /* System generated locals */+    integer i__1, i__2, i__3, i__4, i__5;+    doublereal d__1;+    doublecomplex z__1, z__2, z__3, z__4;++    /* Builtin functions */+    void d_cnjg(doublecomplex *, doublecomplex *);++    /* Local variables */+    integer i__, j, k, kk, ix, iy, jx, jy, kx, ky, info;+    doublecomplex temp1, temp2;+    extern logical lsame_(char *, char *, ftnlen, ftnlen);+    extern /* Subroutine */ int xerbla_(char *, integer *, ftnlen);++/*     .. Scalar Arguments .. */+/*     .. */+/*     .. Array Arguments .. */+/*     .. */++/*  Purpose */+/*  ======= */++/*  ZHPMV  performs the matrix-vector operation */++/*     y := alpha*A*x + beta*y, */++/*  where alpha and beta are scalars, x and y are n element vectors and */+/*  A is an n by n hermitian matrix, supplied in packed form. */++/*  Arguments */+/*  ========== */++/*  UPLO   - CHARACTER*1. */+/*           On entry, UPLO specifies whether the upper or lower */+/*           triangular part of the matrix A is supplied in the packed */+/*           array AP as follows: */++/*              UPLO = 'U' or 'u'   The upper triangular part of A is */+/*                                  supplied in AP. */++/*              UPLO = 'L' or 'l'   The lower triangular part of A is */+/*                                  supplied in AP. */++/*           Unchanged on exit. */++/*  N      - INTEGER. */+/*           On entry, N specifies the order of the matrix A. */+/*           N must be at least zero. */+/*           Unchanged on exit. */++/*  ALPHA  - COMPLEX*16      . */+/*           On entry, ALPHA specifies the scalar alpha. */+/*           Unchanged on exit. */++/*  AP     - COMPLEX*16       array of DIMENSION at least */+/*           ( ( n*( n + 1 ) )/2 ). */+/*           Before entry with UPLO = 'U' or 'u', the array AP must */+/*           contain the upper triangular part of the hermitian matrix */+/*           packed sequentially, column by column, so that AP( 1 ) */+/*           contains a( 1, 1 ), AP( 2 ) and AP( 3 ) contain a( 1, 2 ) */+/*           and a( 2, 2 ) respectively, and so on. */+/*           Before entry with UPLO = 'L' or 'l', the array AP must */+/*           contain the lower triangular part of the hermitian matrix */+/*           packed sequentially, column by column, so that AP( 1 ) */+/*           contains a( 1, 1 ), AP( 2 ) and AP( 3 ) contain a( 2, 1 ) */+/*           and a( 3, 1 ) respectively, and so on. */+/*           Note that the imaginary parts of the diagonal elements need */+/*           not be set and are assumed to be zero. */+/*           Unchanged on exit. */++/*  X      - COMPLEX*16       array of dimension at least */+/*           ( 1 + ( n - 1 )*abs( INCX ) ). */+/*           Before entry, the incremented array X must contain the n */+/*           element vector x. */+/*           Unchanged on exit. */++/*  INCX   - INTEGER. */+/*           On entry, INCX specifies the increment for the elements of */+/*           X. INCX must not be zero. */+/*           Unchanged on exit. */++/*  BETA   - COMPLEX*16      . */+/*           On entry, BETA specifies the scalar beta. When BETA is */+/*           supplied as zero then Y need not be set on input. */+/*           Unchanged on exit. */++/*  Y      - COMPLEX*16       array of dimension at least */+/*           ( 1 + ( n - 1 )*abs( INCY ) ). */+/*           Before entry, the incremented array Y must contain the n */+/*           element vector y. On exit, Y is overwritten by the updated */+/*           vector y. */++/*  INCY   - INTEGER. */+/*           On entry, INCY specifies the increment for the elements of */+/*           Y. INCY must not be zero. */+/*           Unchanged on exit. */++/*  Further Details */+/*  =============== */++/*  Level 2 Blas routine. */++/*  -- Written on 22-October-1986. */+/*     Jack Dongarra, Argonne National Lab. */+/*     Jeremy Du Croz, Nag Central Office. */+/*     Sven Hammarling, Nag Central Office. */+/*     Richard Hanson, Sandia National Labs. */++/*  ===================================================================== */++/*     .. Parameters .. */+/*     .. */+/*     .. Local Scalars .. */+/*     .. */+/*     .. External Functions .. */+/*     .. */+/*     .. External Subroutines .. */+/*     .. */+/*     .. Intrinsic Functions .. */+/*     .. */++/*     Test the input parameters. */++    /* Parameter adjustments */+    --y;+    --x;+    --ap;++    /* Function Body */+    info = 0;+    if (! lsame_(uplo, "U", (ftnlen)1, (ftnlen)1) && ! lsame_(uplo, "L", (+	    ftnlen)1, (ftnlen)1)) {+	info = 1;+    } else if (*n < 0) {+	info = 2;+    } else if (*incx == 0) {+	info = 6;+    } else if (*incy == 0) {+	info = 9;+    }+    if (info != 0) {+	xerbla_("ZHPMV ", &info, (ftnlen)6);+	return 0;+    }++/*     Quick return if possible. */++    if (*n == 0 || (alpha->r == 0. && alpha->i == 0. && (beta->r == 1. && +                                                         beta->i == 0.))) {+	return 0;+    }++/*     Set up the start points in  X  and  Y. */++    if (*incx > 0) {+	kx = 1;+    } else {+	kx = 1 - (*n - 1) * *incx;+    }+    if (*incy > 0) {+	ky = 1;+    } else {+	ky = 1 - (*n - 1) * *incy;+    }++/*     Start the operations. In this version the elements of the array AP */+/*     are accessed sequentially with one pass through AP. */++/*     First form  y := beta*y. */++    if (beta->r != 1. || beta->i != 0.) {+	if (*incy == 1) {+	    if (beta->r == 0. && beta->i == 0.) {+		i__1 = *n;+		for (i__ = 1; i__ <= i__1; ++i__) {+		    i__2 = i__;+		    y[i__2].r = 0., y[i__2].i = 0.;+/* L10: */+		}+	    } else {+		i__1 = *n;+		for (i__ = 1; i__ <= i__1; ++i__) {+		    i__2 = i__;+		    i__3 = i__;+		    z__1.r = beta->r * y[i__3].r - beta->i * y[i__3].i, +			    z__1.i = beta->r * y[i__3].i + beta->i * y[i__3]+			    .r;+		    y[i__2].r = z__1.r, y[i__2].i = z__1.i;+/* L20: */+		}+	    }+	} else {+	    iy = ky;+	    if (beta->r == 0. && beta->i == 0.) {+		i__1 = *n;+		for (i__ = 1; i__ <= i__1; ++i__) {+		    i__2 = iy;+		    y[i__2].r = 0., y[i__2].i = 0.;+		    iy += *incy;+/* L30: */+		}+	    } else {+		i__1 = *n;+		for (i__ = 1; i__ <= i__1; ++i__) {+		    i__2 = iy;+		    i__3 = iy;+		    z__1.r = beta->r * y[i__3].r - beta->i * y[i__3].i, +			    z__1.i = beta->r * y[i__3].i + beta->i * y[i__3]+			    .r;+		    y[i__2].r = z__1.r, y[i__2].i = z__1.i;+		    iy += *incy;+/* L40: */+		}+	    }+	}+    }+    if (alpha->r == 0. && alpha->i == 0.) {+	return 0;+    }+    kk = 1;+    if (lsame_(uplo, "U", (ftnlen)1, (ftnlen)1)) {++/*        Form  y  when AP contains the upper triangle. */++	if (*incx == 1 && *incy == 1) {+	    i__1 = *n;+	    for (j = 1; j <= i__1; ++j) {+		i__2 = j;+		z__1.r = alpha->r * x[i__2].r - alpha->i * x[i__2].i, z__1.i =+			 alpha->r * x[i__2].i + alpha->i * x[i__2].r;+		temp1.r = z__1.r, temp1.i = z__1.i;+		temp2.r = 0., temp2.i = 0.;+		k = kk;+		i__2 = j - 1;+		for (i__ = 1; i__ <= i__2; ++i__) {+		    i__3 = i__;+		    i__4 = i__;+		    i__5 = k;+		    z__2.r = temp1.r * ap[i__5].r - temp1.i * ap[i__5].i, +			    z__2.i = temp1.r * ap[i__5].i + temp1.i * ap[i__5]+			    .r;+		    z__1.r = y[i__4].r + z__2.r, z__1.i = y[i__4].i + z__2.i;+		    y[i__3].r = z__1.r, y[i__3].i = z__1.i;+		    d_cnjg(&z__3, &ap[k]);+		    i__3 = i__;+		    z__2.r = z__3.r * x[i__3].r - z__3.i * x[i__3].i, z__2.i =+			     z__3.r * x[i__3].i + z__3.i * x[i__3].r;+		    z__1.r = temp2.r + z__2.r, z__1.i = temp2.i + z__2.i;+		    temp2.r = z__1.r, temp2.i = z__1.i;+		    ++k;+/* L50: */+		}+		i__2 = j;+		i__3 = j;+		i__4 = kk + j - 1;+		d__1 = ap[i__4].r;+		z__3.r = d__1 * temp1.r, z__3.i = d__1 * temp1.i;+		z__2.r = y[i__3].r + z__3.r, z__2.i = y[i__3].i + z__3.i;+		z__4.r = alpha->r * temp2.r - alpha->i * temp2.i, z__4.i = +			alpha->r * temp2.i + alpha->i * temp2.r;+		z__1.r = z__2.r + z__4.r, z__1.i = z__2.i + z__4.i;+		y[i__2].r = z__1.r, y[i__2].i = z__1.i;+		kk += j;+/* L60: */+	    }+	} else {+	    jx = kx;+	    jy = ky;+	    i__1 = *n;+	    for (j = 1; j <= i__1; ++j) {+		i__2 = jx;+		z__1.r = alpha->r * x[i__2].r - alpha->i * x[i__2].i, z__1.i =+			 alpha->r * x[i__2].i + alpha->i * x[i__2].r;+		temp1.r = z__1.r, temp1.i = z__1.i;+		temp2.r = 0., temp2.i = 0.;+		ix = kx;+		iy = ky;+		i__2 = kk + j - 2;+		for (k = kk; k <= i__2; ++k) {+		    i__3 = iy;+		    i__4 = iy;+		    i__5 = k;+		    z__2.r = temp1.r * ap[i__5].r - temp1.i * ap[i__5].i, +			    z__2.i = temp1.r * ap[i__5].i + temp1.i * ap[i__5]+			    .r;+		    z__1.r = y[i__4].r + z__2.r, z__1.i = y[i__4].i + z__2.i;+		    y[i__3].r = z__1.r, y[i__3].i = z__1.i;+		    d_cnjg(&z__3, &ap[k]);+		    i__3 = ix;+		    z__2.r = z__3.r * x[i__3].r - z__3.i * x[i__3].i, z__2.i =+			     z__3.r * x[i__3].i + z__3.i * x[i__3].r;+		    z__1.r = temp2.r + z__2.r, z__1.i = temp2.i + z__2.i;+		    temp2.r = z__1.r, temp2.i = z__1.i;+		    ix += *incx;+		    iy += *incy;+/* L70: */+		}+		i__2 = jy;+		i__3 = jy;+		i__4 = kk + j - 1;+		d__1 = ap[i__4].r;+		z__3.r = d__1 * temp1.r, z__3.i = d__1 * temp1.i;+		z__2.r = y[i__3].r + z__3.r, z__2.i = y[i__3].i + z__3.i;+		z__4.r = alpha->r * temp2.r - alpha->i * temp2.i, z__4.i = +			alpha->r * temp2.i + alpha->i * temp2.r;+		z__1.r = z__2.r + z__4.r, z__1.i = z__2.i + z__4.i;+		y[i__2].r = z__1.r, y[i__2].i = z__1.i;+		jx += *incx;+		jy += *incy;+		kk += j;+/* L80: */+	    }+	}+    } else {++/*        Form  y  when AP contains the lower triangle. */++	if (*incx == 1 && *incy == 1) {+	    i__1 = *n;+	    for (j = 1; j <= i__1; ++j) {+		i__2 = j;+		z__1.r = alpha->r * x[i__2].r - alpha->i * x[i__2].i, z__1.i =+			 alpha->r * x[i__2].i + alpha->i * x[i__2].r;+		temp1.r = z__1.r, temp1.i = z__1.i;+		temp2.r = 0., temp2.i = 0.;+		i__2 = j;+		i__3 = j;+		i__4 = kk;+		d__1 = ap[i__4].r;+		z__2.r = d__1 * temp1.r, z__2.i = d__1 * temp1.i;+		z__1.r = y[i__3].r + z__2.r, z__1.i = y[i__3].i + z__2.i;+		y[i__2].r = z__1.r, y[i__2].i = z__1.i;+		k = kk + 1;+		i__2 = *n;+		for (i__ = j + 1; i__ <= i__2; ++i__) {+		    i__3 = i__;+		    i__4 = i__;+		    i__5 = k;+		    z__2.r = temp1.r * ap[i__5].r - temp1.i * ap[i__5].i, +			    z__2.i = temp1.r * ap[i__5].i + temp1.i * ap[i__5]+			    .r;+		    z__1.r = y[i__4].r + z__2.r, z__1.i = y[i__4].i + z__2.i;+		    y[i__3].r = z__1.r, y[i__3].i = z__1.i;+		    d_cnjg(&z__3, &ap[k]);+		    i__3 = i__;+		    z__2.r = z__3.r * x[i__3].r - z__3.i * x[i__3].i, z__2.i =+			     z__3.r * x[i__3].i + z__3.i * x[i__3].r;+		    z__1.r = temp2.r + z__2.r, z__1.i = temp2.i + z__2.i;+		    temp2.r = z__1.r, temp2.i = z__1.i;+		    ++k;+/* L90: */+		}+		i__2 = j;+		i__3 = j;+		z__2.r = alpha->r * temp2.r - alpha->i * temp2.i, z__2.i = +			alpha->r * temp2.i + alpha->i * temp2.r;+		z__1.r = y[i__3].r + z__2.r, z__1.i = y[i__3].i + z__2.i;+		y[i__2].r = z__1.r, y[i__2].i = z__1.i;+		kk += *n - j + 1;+/* L100: */+	    }+	} else {+	    jx = kx;+	    jy = ky;+	    i__1 = *n;+	    for (j = 1; j <= i__1; ++j) {+		i__2 = jx;+		z__1.r = alpha->r * x[i__2].r - alpha->i * x[i__2].i, z__1.i =+			 alpha->r * x[i__2].i + alpha->i * x[i__2].r;+		temp1.r = z__1.r, temp1.i = z__1.i;+		temp2.r = 0., temp2.i = 0.;+		i__2 = jy;+		i__3 = jy;+		i__4 = kk;+		d__1 = ap[i__4].r;+		z__2.r = d__1 * temp1.r, z__2.i = d__1 * temp1.i;+		z__1.r = y[i__3].r + z__2.r, z__1.i = y[i__3].i + z__2.i;+		y[i__2].r = z__1.r, y[i__2].i = z__1.i;+		ix = jx;+		iy = jy;+		i__2 = kk + *n - j;+		for (k = kk + 1; k <= i__2; ++k) {+		    ix += *incx;+		    iy += *incy;+		    i__3 = iy;+		    i__4 = iy;+		    i__5 = k;+		    z__2.r = temp1.r * ap[i__5].r - temp1.i * ap[i__5].i, +			    z__2.i = temp1.r * ap[i__5].i + temp1.i * ap[i__5]+			    .r;+		    z__1.r = y[i__4].r + z__2.r, z__1.i = y[i__4].i + z__2.i;+		    y[i__3].r = z__1.r, y[i__3].i = z__1.i;+		    d_cnjg(&z__3, &ap[k]);+		    i__3 = ix;+		    z__2.r = z__3.r * x[i__3].r - z__3.i * x[i__3].i, z__2.i =+			     z__3.r * x[i__3].i + z__3.i * x[i__3].r;+		    z__1.r = temp2.r + z__2.r, z__1.i = temp2.i + z__2.i;+		    temp2.r = z__1.r, temp2.i = z__1.i;+/* L110: */+		}+		i__2 = jy;+		i__3 = jy;+		z__2.r = alpha->r * temp2.r - alpha->i * temp2.i, z__2.i = +			alpha->r * temp2.i + alpha->i * temp2.r;+		z__1.r = y[i__3].r + z__2.r, z__1.i = y[i__3].i + z__2.i;+		y[i__2].r = z__1.r, y[i__2].i = z__1.i;+		jx += *incx;+		jy += *incy;+		kk += *n - j + 1;+/* L120: */+	    }+	}+    }++    return 0;++/*     End of ZHPMV . */++} /* zhpmv_ */+
+ eigen3/blas/f2c/ztbmv.c view
@@ -0,0 +1,647 @@+/* ztbmv.f -- translated by f2c (version 20100827).+   You must link the resulting object file with libf2c:+	on Microsoft Windows system, link with libf2c.lib;+	on Linux or Unix systems, link with .../path/to/libf2c.a -lm+	or, if you install libf2c.a in a standard place, with -lf2c -lm+	-- in that order, at the end of the command line, as in+		cc *.o -lf2c -lm+	Source for libf2c is in /netlib/f2c/libf2c.zip, e.g.,++		http://www.netlib.org/f2c/libf2c.zip+*/++#include "datatypes.h"++/* Subroutine */ int ztbmv_(char *uplo, char *trans, char *diag, integer *n, +	integer *k, doublecomplex *a, integer *lda, doublecomplex *x, integer +	*incx, ftnlen uplo_len, ftnlen trans_len, ftnlen diag_len)+{+    /* System generated locals */+    integer a_dim1, a_offset, i__1, i__2, i__3, i__4, i__5;+    doublecomplex z__1, z__2, z__3;++    /* Builtin functions */+    void d_cnjg(doublecomplex *, doublecomplex *);++    /* Local variables */+    integer i__, j, l, ix, jx, kx, info;+    doublecomplex temp;+    extern logical lsame_(char *, char *, ftnlen, ftnlen);+    integer kplus1;+    extern /* Subroutine */ int xerbla_(char *, integer *, ftnlen);+    logical noconj, nounit;++/*     .. Scalar Arguments .. */+/*     .. */+/*     .. Array Arguments .. */+/*     .. */++/*  Purpose */+/*  ======= */++/*  ZTBMV  performs one of the matrix-vector operations */++/*     x := A*x,   or   x := A'*x,   or   x := conjg( A' )*x, */++/*  where x is an n element vector and  A is an n by n unit, or non-unit, */+/*  upper or lower triangular band matrix, with ( k + 1 ) diagonals. */++/*  Arguments */+/*  ========== */++/*  UPLO   - CHARACTER*1. */+/*           On entry, UPLO specifies whether the matrix is an upper or */+/*           lower triangular matrix as follows: */++/*              UPLO = 'U' or 'u'   A is an upper triangular matrix. */++/*              UPLO = 'L' or 'l'   A is a lower triangular matrix. */++/*           Unchanged on exit. */++/*  TRANS  - CHARACTER*1. */+/*           On entry, TRANS specifies the operation to be performed as */+/*           follows: */++/*              TRANS = 'N' or 'n'   x := A*x. */++/*              TRANS = 'T' or 't'   x := A'*x. */++/*              TRANS = 'C' or 'c'   x := conjg( A' )*x. */++/*           Unchanged on exit. */++/*  DIAG   - CHARACTER*1. */+/*           On entry, DIAG specifies whether or not A is unit */+/*           triangular as follows: */++/*              DIAG = 'U' or 'u'   A is assumed to be unit triangular. */++/*              DIAG = 'N' or 'n'   A is not assumed to be unit */+/*                                  triangular. */++/*           Unchanged on exit. */++/*  N      - INTEGER. */+/*           On entry, N specifies the order of the matrix A. */+/*           N must be at least zero. */+/*           Unchanged on exit. */++/*  K      - INTEGER. */+/*           On entry with UPLO = 'U' or 'u', K specifies the number of */+/*           super-diagonals of the matrix A. */+/*           On entry with UPLO = 'L' or 'l', K specifies the number of */+/*           sub-diagonals of the matrix A. */+/*           K must satisfy  0 .le. K. */+/*           Unchanged on exit. */++/*  A      - COMPLEX*16       array of DIMENSION ( LDA, n ). */+/*           Before entry with UPLO = 'U' or 'u', the leading ( k + 1 ) */+/*           by n part of the array A must contain the upper triangular */+/*           band part of the matrix of coefficients, supplied column by */+/*           column, with the leading diagonal of the matrix in row */+/*           ( k + 1 ) of the array, the first super-diagonal starting at */+/*           position 2 in row k, and so on. The top left k by k triangle */+/*           of the array A is not referenced. */+/*           The following program segment will transfer an upper */+/*           triangular band matrix from conventional full matrix storage */+/*           to band storage: */++/*                 DO 20, J = 1, N */+/*                    M = K + 1 - J */+/*                    DO 10, I = MAX( 1, J - K ), J */+/*                       A( M + I, J ) = matrix( I, J ) */+/*              10    CONTINUE */+/*              20 CONTINUE */++/*           Before entry with UPLO = 'L' or 'l', the leading ( k + 1 ) */+/*           by n part of the array A must contain the lower triangular */+/*           band part of the matrix of coefficients, supplied column by */+/*           column, with the leading diagonal of the matrix in row 1 of */+/*           the array, the first sub-diagonal starting at position 1 in */+/*           row 2, and so on. The bottom right k by k triangle of the */+/*           array A is not referenced. */+/*           The following program segment will transfer a lower */+/*           triangular band matrix from conventional full matrix storage */+/*           to band storage: */++/*                 DO 20, J = 1, N */+/*                    M = 1 - J */+/*                    DO 10, I = J, MIN( N, J + K ) */+/*                       A( M + I, J ) = matrix( I, J ) */+/*              10    CONTINUE */+/*              20 CONTINUE */++/*           Note that when DIAG = 'U' or 'u' the elements of the array A */+/*           corresponding to the diagonal elements of the matrix are not */+/*           referenced, but are assumed to be unity. */+/*           Unchanged on exit. */++/*  LDA    - INTEGER. */+/*           On entry, LDA specifies the first dimension of A as declared */+/*           in the calling (sub) program. LDA must be at least */+/*           ( k + 1 ). */+/*           Unchanged on exit. */++/*  X      - COMPLEX*16       array of dimension at least */+/*           ( 1 + ( n - 1 )*abs( INCX ) ). */+/*           Before entry, the incremented array X must contain the n */+/*           element vector x. On exit, X is overwritten with the */+/*           tranformed vector x. */++/*  INCX   - INTEGER. */+/*           On entry, INCX specifies the increment for the elements of */+/*           X. INCX must not be zero. */+/*           Unchanged on exit. */++/*  Further Details */+/*  =============== */++/*  Level 2 Blas routine. */++/*  -- Written on 22-October-1986. */+/*     Jack Dongarra, Argonne National Lab. */+/*     Jeremy Du Croz, Nag Central Office. */+/*     Sven Hammarling, Nag Central Office. */+/*     Richard Hanson, Sandia National Labs. */++/*  ===================================================================== */++/*     .. Parameters .. */+/*     .. */+/*     .. Local Scalars .. */+/*     .. */+/*     .. External Functions .. */+/*     .. */+/*     .. External Subroutines .. */+/*     .. */+/*     .. Intrinsic Functions .. */+/*     .. */++/*     Test the input parameters. */++    /* Parameter adjustments */+    a_dim1 = *lda;+    a_offset = 1 + a_dim1;+    a -= a_offset;+    --x;++    /* Function Body */+    info = 0;+    if (! lsame_(uplo, "U", (ftnlen)1, (ftnlen)1) && ! lsame_(uplo, "L", (+	    ftnlen)1, (ftnlen)1)) {+	info = 1;+    } else if (! lsame_(trans, "N", (ftnlen)1, (ftnlen)1) && ! lsame_(trans, +	    "T", (ftnlen)1, (ftnlen)1) && ! lsame_(trans, "C", (ftnlen)1, (+	    ftnlen)1)) {+	info = 2;+    } else if (! lsame_(diag, "U", (ftnlen)1, (ftnlen)1) && ! lsame_(diag, +	    "N", (ftnlen)1, (ftnlen)1)) {+	info = 3;+    } else if (*n < 0) {+	info = 4;+    } else if (*k < 0) {+	info = 5;+    } else if (*lda < *k + 1) {+	info = 7;+    } else if (*incx == 0) {+	info = 9;+    }+    if (info != 0) {+	xerbla_("ZTBMV ", &info, (ftnlen)6);+	return 0;+    }++/*     Quick return if possible. */++    if (*n == 0) {+	return 0;+    }++    noconj = lsame_(trans, "T", (ftnlen)1, (ftnlen)1);+    nounit = lsame_(diag, "N", (ftnlen)1, (ftnlen)1);++/*     Set up the start point in X if the increment is not unity. This */+/*     will be  ( N - 1 )*INCX   too small for descending loops. */++    if (*incx <= 0) {+	kx = 1 - (*n - 1) * *incx;+    } else if (*incx != 1) {+	kx = 1;+    }++/*     Start the operations. In this version the elements of A are */+/*     accessed sequentially with one pass through A. */++    if (lsame_(trans, "N", (ftnlen)1, (ftnlen)1)) {++/*         Form  x := A*x. */++	if (lsame_(uplo, "U", (ftnlen)1, (ftnlen)1)) {+	    kplus1 = *k + 1;+	    if (*incx == 1) {+		i__1 = *n;+		for (j = 1; j <= i__1; ++j) {+		    i__2 = j;+		    if (x[i__2].r != 0. || x[i__2].i != 0.) {+			i__2 = j;+			temp.r = x[i__2].r, temp.i = x[i__2].i;+			l = kplus1 - j;+/* Computing MAX */+			i__2 = 1, i__3 = j - *k;+			i__4 = j - 1;+			for (i__ = max(i__2,i__3); i__ <= i__4; ++i__) {+			    i__2 = i__;+			    i__3 = i__;+			    i__5 = l + i__ + j * a_dim1;+			    z__2.r = temp.r * a[i__5].r - temp.i * a[i__5].i, +				    z__2.i = temp.r * a[i__5].i + temp.i * a[+				    i__5].r;+			    z__1.r = x[i__3].r + z__2.r, z__1.i = x[i__3].i + +				    z__2.i;+			    x[i__2].r = z__1.r, x[i__2].i = z__1.i;+/* L10: */+			}+			if (nounit) {+			    i__4 = j;+			    i__2 = j;+			    i__3 = kplus1 + j * a_dim1;+			    z__1.r = x[i__2].r * a[i__3].r - x[i__2].i * a[+				    i__3].i, z__1.i = x[i__2].r * a[i__3].i + +				    x[i__2].i * a[i__3].r;+			    x[i__4].r = z__1.r, x[i__4].i = z__1.i;+			}+		    }+/* L20: */+		}+	    } else {+		jx = kx;+		i__1 = *n;+		for (j = 1; j <= i__1; ++j) {+		    i__4 = jx;+		    if (x[i__4].r != 0. || x[i__4].i != 0.) {+			i__4 = jx;+			temp.r = x[i__4].r, temp.i = x[i__4].i;+			ix = kx;+			l = kplus1 - j;+/* Computing MAX */+			i__4 = 1, i__2 = j - *k;+			i__3 = j - 1;+			for (i__ = max(i__4,i__2); i__ <= i__3; ++i__) {+			    i__4 = ix;+			    i__2 = ix;+			    i__5 = l + i__ + j * a_dim1;+			    z__2.r = temp.r * a[i__5].r - temp.i * a[i__5].i, +				    z__2.i = temp.r * a[i__5].i + temp.i * a[+				    i__5].r;+			    z__1.r = x[i__2].r + z__2.r, z__1.i = x[i__2].i + +				    z__2.i;+			    x[i__4].r = z__1.r, x[i__4].i = z__1.i;+			    ix += *incx;+/* L30: */+			}+			if (nounit) {+			    i__3 = jx;+			    i__4 = jx;+			    i__2 = kplus1 + j * a_dim1;+			    z__1.r = x[i__4].r * a[i__2].r - x[i__4].i * a[+				    i__2].i, z__1.i = x[i__4].r * a[i__2].i + +				    x[i__4].i * a[i__2].r;+			    x[i__3].r = z__1.r, x[i__3].i = z__1.i;+			}+		    }+		    jx += *incx;+		    if (j > *k) {+			kx += *incx;+		    }+/* L40: */+		}+	    }+	} else {+	    if (*incx == 1) {+		for (j = *n; j >= 1; --j) {+		    i__1 = j;+		    if (x[i__1].r != 0. || x[i__1].i != 0.) {+			i__1 = j;+			temp.r = x[i__1].r, temp.i = x[i__1].i;+			l = 1 - j;+/* Computing MIN */+			i__1 = *n, i__3 = j + *k;+			i__4 = j + 1;+			for (i__ = min(i__1,i__3); i__ >= i__4; --i__) {+			    i__1 = i__;+			    i__3 = i__;+			    i__2 = l + i__ + j * a_dim1;+			    z__2.r = temp.r * a[i__2].r - temp.i * a[i__2].i, +				    z__2.i = temp.r * a[i__2].i + temp.i * a[+				    i__2].r;+			    z__1.r = x[i__3].r + z__2.r, z__1.i = x[i__3].i + +				    z__2.i;+			    x[i__1].r = z__1.r, x[i__1].i = z__1.i;+/* L50: */+			}+			if (nounit) {+			    i__4 = j;+			    i__1 = j;+			    i__3 = j * a_dim1 + 1;+			    z__1.r = x[i__1].r * a[i__3].r - x[i__1].i * a[+				    i__3].i, z__1.i = x[i__1].r * a[i__3].i + +				    x[i__1].i * a[i__3].r;+			    x[i__4].r = z__1.r, x[i__4].i = z__1.i;+			}+		    }+/* L60: */+		}+	    } else {+		kx += (*n - 1) * *incx;+		jx = kx;+		for (j = *n; j >= 1; --j) {+		    i__4 = jx;+		    if (x[i__4].r != 0. || x[i__4].i != 0.) {+			i__4 = jx;+			temp.r = x[i__4].r, temp.i = x[i__4].i;+			ix = kx;+			l = 1 - j;+/* Computing MIN */+			i__4 = *n, i__1 = j + *k;+			i__3 = j + 1;+			for (i__ = min(i__4,i__1); i__ >= i__3; --i__) {+			    i__4 = ix;+			    i__1 = ix;+			    i__2 = l + i__ + j * a_dim1;+			    z__2.r = temp.r * a[i__2].r - temp.i * a[i__2].i, +				    z__2.i = temp.r * a[i__2].i + temp.i * a[+				    i__2].r;+			    z__1.r = x[i__1].r + z__2.r, z__1.i = x[i__1].i + +				    z__2.i;+			    x[i__4].r = z__1.r, x[i__4].i = z__1.i;+			    ix -= *incx;+/* L70: */+			}+			if (nounit) {+			    i__3 = jx;+			    i__4 = jx;+			    i__1 = j * a_dim1 + 1;+			    z__1.r = x[i__4].r * a[i__1].r - x[i__4].i * a[+				    i__1].i, z__1.i = x[i__4].r * a[i__1].i + +				    x[i__4].i * a[i__1].r;+			    x[i__3].r = z__1.r, x[i__3].i = z__1.i;+			}+		    }+		    jx -= *incx;+		    if (*n - j >= *k) {+			kx -= *incx;+		    }+/* L80: */+		}+	    }+	}+    } else {++/*        Form  x := A'*x  or  x := conjg( A' )*x. */++	if (lsame_(uplo, "U", (ftnlen)1, (ftnlen)1)) {+	    kplus1 = *k + 1;+	    if (*incx == 1) {+		for (j = *n; j >= 1; --j) {+		    i__3 = j;+		    temp.r = x[i__3].r, temp.i = x[i__3].i;+		    l = kplus1 - j;+		    if (noconj) {+			if (nounit) {+			    i__3 = kplus1 + j * a_dim1;+			    z__1.r = temp.r * a[i__3].r - temp.i * a[i__3].i, +				    z__1.i = temp.r * a[i__3].i + temp.i * a[+				    i__3].r;+			    temp.r = z__1.r, temp.i = z__1.i;+			}+/* Computing MAX */+			i__4 = 1, i__1 = j - *k;+			i__3 = max(i__4,i__1);+			for (i__ = j - 1; i__ >= i__3; --i__) {+			    i__4 = l + i__ + j * a_dim1;+			    i__1 = i__;+			    z__2.r = a[i__4].r * x[i__1].r - a[i__4].i * x[+				    i__1].i, z__2.i = a[i__4].r * x[i__1].i + +				    a[i__4].i * x[i__1].r;+			    z__1.r = temp.r + z__2.r, z__1.i = temp.i + +				    z__2.i;+			    temp.r = z__1.r, temp.i = z__1.i;+/* L90: */+			}+		    } else {+			if (nounit) {+			    d_cnjg(&z__2, &a[kplus1 + j * a_dim1]);+			    z__1.r = temp.r * z__2.r - temp.i * z__2.i, +				    z__1.i = temp.r * z__2.i + temp.i * +				    z__2.r;+			    temp.r = z__1.r, temp.i = z__1.i;+			}+/* Computing MAX */+			i__4 = 1, i__1 = j - *k;+			i__3 = max(i__4,i__1);+			for (i__ = j - 1; i__ >= i__3; --i__) {+			    d_cnjg(&z__3, &a[l + i__ + j * a_dim1]);+			    i__4 = i__;+			    z__2.r = z__3.r * x[i__4].r - z__3.i * x[i__4].i, +				    z__2.i = z__3.r * x[i__4].i + z__3.i * x[+				    i__4].r;+			    z__1.r = temp.r + z__2.r, z__1.i = temp.i + +				    z__2.i;+			    temp.r = z__1.r, temp.i = z__1.i;+/* L100: */+			}+		    }+		    i__3 = j;+		    x[i__3].r = temp.r, x[i__3].i = temp.i;+/* L110: */+		}+	    } else {+		kx += (*n - 1) * *incx;+		jx = kx;+		for (j = *n; j >= 1; --j) {+		    i__3 = jx;+		    temp.r = x[i__3].r, temp.i = x[i__3].i;+		    kx -= *incx;+		    ix = kx;+		    l = kplus1 - j;+		    if (noconj) {+			if (nounit) {+			    i__3 = kplus1 + j * a_dim1;+			    z__1.r = temp.r * a[i__3].r - temp.i * a[i__3].i, +				    z__1.i = temp.r * a[i__3].i + temp.i * a[+				    i__3].r;+			    temp.r = z__1.r, temp.i = z__1.i;+			}+/* Computing MAX */+			i__4 = 1, i__1 = j - *k;+			i__3 = max(i__4,i__1);+			for (i__ = j - 1; i__ >= i__3; --i__) {+			    i__4 = l + i__ + j * a_dim1;+			    i__1 = ix;+			    z__2.r = a[i__4].r * x[i__1].r - a[i__4].i * x[+				    i__1].i, z__2.i = a[i__4].r * x[i__1].i + +				    a[i__4].i * x[i__1].r;+			    z__1.r = temp.r + z__2.r, z__1.i = temp.i + +				    z__2.i;+			    temp.r = z__1.r, temp.i = z__1.i;+			    ix -= *incx;+/* L120: */+			}+		    } else {+			if (nounit) {+			    d_cnjg(&z__2, &a[kplus1 + j * a_dim1]);+			    z__1.r = temp.r * z__2.r - temp.i * z__2.i, +				    z__1.i = temp.r * z__2.i + temp.i * +				    z__2.r;+			    temp.r = z__1.r, temp.i = z__1.i;+			}+/* Computing MAX */+			i__4 = 1, i__1 = j - *k;+			i__3 = max(i__4,i__1);+			for (i__ = j - 1; i__ >= i__3; --i__) {+			    d_cnjg(&z__3, &a[l + i__ + j * a_dim1]);+			    i__4 = ix;+			    z__2.r = z__3.r * x[i__4].r - z__3.i * x[i__4].i, +				    z__2.i = z__3.r * x[i__4].i + z__3.i * x[+				    i__4].r;+			    z__1.r = temp.r + z__2.r, z__1.i = temp.i + +				    z__2.i;+			    temp.r = z__1.r, temp.i = z__1.i;+			    ix -= *incx;+/* L130: */+			}+		    }+		    i__3 = jx;+		    x[i__3].r = temp.r, x[i__3].i = temp.i;+		    jx -= *incx;+/* L140: */+		}+	    }+	} else {+	    if (*incx == 1) {+		i__3 = *n;+		for (j = 1; j <= i__3; ++j) {+		    i__4 = j;+		    temp.r = x[i__4].r, temp.i = x[i__4].i;+		    l = 1 - j;+		    if (noconj) {+			if (nounit) {+			    i__4 = j * a_dim1 + 1;+			    z__1.r = temp.r * a[i__4].r - temp.i * a[i__4].i, +				    z__1.i = temp.r * a[i__4].i + temp.i * a[+				    i__4].r;+			    temp.r = z__1.r, temp.i = z__1.i;+			}+/* Computing MIN */+			i__1 = *n, i__2 = j + *k;+			i__4 = min(i__1,i__2);+			for (i__ = j + 1; i__ <= i__4; ++i__) {+			    i__1 = l + i__ + j * a_dim1;+			    i__2 = i__;+			    z__2.r = a[i__1].r * x[i__2].r - a[i__1].i * x[+				    i__2].i, z__2.i = a[i__1].r * x[i__2].i + +				    a[i__1].i * x[i__2].r;+			    z__1.r = temp.r + z__2.r, z__1.i = temp.i + +				    z__2.i;+			    temp.r = z__1.r, temp.i = z__1.i;+/* L150: */+			}+		    } else {+			if (nounit) {+			    d_cnjg(&z__2, &a[j * a_dim1 + 1]);+			    z__1.r = temp.r * z__2.r - temp.i * z__2.i, +				    z__1.i = temp.r * z__2.i + temp.i * +				    z__2.r;+			    temp.r = z__1.r, temp.i = z__1.i;+			}+/* Computing MIN */+			i__1 = *n, i__2 = j + *k;+			i__4 = min(i__1,i__2);+			for (i__ = j + 1; i__ <= i__4; ++i__) {+			    d_cnjg(&z__3, &a[l + i__ + j * a_dim1]);+			    i__1 = i__;+			    z__2.r = z__3.r * x[i__1].r - z__3.i * x[i__1].i, +				    z__2.i = z__3.r * x[i__1].i + z__3.i * x[+				    i__1].r;+			    z__1.r = temp.r + z__2.r, z__1.i = temp.i + +				    z__2.i;+			    temp.r = z__1.r, temp.i = z__1.i;+/* L160: */+			}+		    }+		    i__4 = j;+		    x[i__4].r = temp.r, x[i__4].i = temp.i;+/* L170: */+		}+	    } else {+		jx = kx;+		i__3 = *n;+		for (j = 1; j <= i__3; ++j) {+		    i__4 = jx;+		    temp.r = x[i__4].r, temp.i = x[i__4].i;+		    kx += *incx;+		    ix = kx;+		    l = 1 - j;+		    if (noconj) {+			if (nounit) {+			    i__4 = j * a_dim1 + 1;+			    z__1.r = temp.r * a[i__4].r - temp.i * a[i__4].i, +				    z__1.i = temp.r * a[i__4].i + temp.i * a[+				    i__4].r;+			    temp.r = z__1.r, temp.i = z__1.i;+			}+/* Computing MIN */+			i__1 = *n, i__2 = j + *k;+			i__4 = min(i__1,i__2);+			for (i__ = j + 1; i__ <= i__4; ++i__) {+			    i__1 = l + i__ + j * a_dim1;+			    i__2 = ix;+			    z__2.r = a[i__1].r * x[i__2].r - a[i__1].i * x[+				    i__2].i, z__2.i = a[i__1].r * x[i__2].i + +				    a[i__1].i * x[i__2].r;+			    z__1.r = temp.r + z__2.r, z__1.i = temp.i + +				    z__2.i;+			    temp.r = z__1.r, temp.i = z__1.i;+			    ix += *incx;+/* L180: */+			}+		    } else {+			if (nounit) {+			    d_cnjg(&z__2, &a[j * a_dim1 + 1]);+			    z__1.r = temp.r * z__2.r - temp.i * z__2.i, +				    z__1.i = temp.r * z__2.i + temp.i * +				    z__2.r;+			    temp.r = z__1.r, temp.i = z__1.i;+			}+/* Computing MIN */+			i__1 = *n, i__2 = j + *k;+			i__4 = min(i__1,i__2);+			for (i__ = j + 1; i__ <= i__4; ++i__) {+			    d_cnjg(&z__3, &a[l + i__ + j * a_dim1]);+			    i__1 = ix;+			    z__2.r = z__3.r * x[i__1].r - z__3.i * x[i__1].i, +				    z__2.i = z__3.r * x[i__1].i + z__3.i * x[+				    i__1].r;+			    z__1.r = temp.r + z__2.r, z__1.i = temp.i + +				    z__2.i;+			    temp.r = z__1.r, temp.i = z__1.i;+			    ix += *incx;+/* L190: */+			}+		    }+		    i__4 = jx;+		    x[i__4].r = temp.r, x[i__4].i = temp.i;+		    jx += *incx;+/* L200: */+		}+	    }+	}+    }++    return 0;++/*     End of ZTBMV . */++} /* ztbmv_ */+
+ eigen3/blas/fortran/complexdots.f view
@@ -0,0 +1,43 @@+      COMPLEX FUNCTION CDOTC(N,CX,INCX,CY,INCY)+      INTEGER INCX,INCY,N+      COMPLEX CX(*),CY(*)+      COMPLEX RES+      EXTERNAL CDOTCW+      +      CALL CDOTCW(N,CX,INCX,CY,INCY,RES)+      CDOTC = RES+      RETURN+      END+      +      COMPLEX FUNCTION CDOTU(N,CX,INCX,CY,INCY)+      INTEGER INCX,INCY,N+      COMPLEX CX(*),CY(*)+      COMPLEX RES+      EXTERNAL CDOTUW+      +      CALL CDOTUW(N,CX,INCX,CY,INCY,RES)+      CDOTU = RES+      RETURN+      END+      +      DOUBLE COMPLEX FUNCTION ZDOTC(N,CX,INCX,CY,INCY)+      INTEGER INCX,INCY,N+      DOUBLE COMPLEX CX(*),CY(*)+      DOUBLE COMPLEX RES+      EXTERNAL ZDOTCW+      +      CALL ZDOTCW(N,CX,INCX,CY,INCY,RES)+      ZDOTC = RES+      RETURN+      END+      +      DOUBLE COMPLEX FUNCTION ZDOTU(N,CX,INCX,CY,INCY)+      INTEGER INCX,INCY,N+      DOUBLE COMPLEX CX(*),CY(*)+      DOUBLE COMPLEX RES+      EXTERNAL ZDOTUW+      +      CALL ZDOTUW(N,CX,INCX,CY,INCY,RES)+      ZDOTU = RES+      RETURN+      END
+ eigen3/blas/level1_cplx_impl.h view
@@ -0,0 +1,133 @@+// This file is part of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2009-2010 Gael Guennebaud <gael.guennebaud@inria.fr>+//+// 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"++struct scalar_norm1_op {+  typedef RealScalar result_type;+  EIGEN_EMPTY_STRUCT_CTOR(scalar_norm1_op)+  inline RealScalar operator() (const Scalar& a) const { return numext::norm1(a); }+};+namespace Eigen {+  namespace internal {+    template<> struct functor_traits<scalar_norm1_op >+    {+      enum { Cost = 3 * NumTraits<Scalar>::AddCost, PacketAccess = 0 };+    };+  }+}++// computes the sum of magnitudes of all vector elements or, for a complex vector x, the sum+// res = |Rex1| + |Imx1| + |Rex2| + |Imx2| + ... + |Rexn| + |Imxn|, where x is a vector of order n+RealScalar EIGEN_CAT(EIGEN_CAT(REAL_SCALAR_SUFFIX,SCALAR_SUFFIX),asum_)(int *n, RealScalar *px, int *incx)+{+//   std::cerr << "__asum " << *n << " " << *incx << "\n";+  Complex* x = reinterpret_cast<Complex*>(px);++  if(*n<=0) return 0;++  if(*incx==1)  return make_vector(x,*n).unaryExpr<scalar_norm1_op>().sum();+  else          return make_vector(x,*n,std::abs(*incx)).unaryExpr<scalar_norm1_op>().sum();+}++// computes a dot product of a conjugated vector with another vector.+int EIGEN_BLAS_FUNC(dotcw)(int *n, RealScalar *px, int *incx, RealScalar *py, int *incy, RealScalar* pres)+{+//   std::cerr << "_dotc " << *n << " " << *incx << " " << *incy << "\n";+  Scalar* res = reinterpret_cast<Scalar*>(pres);++  if(*n<=0)+  {+    *res = Scalar(0);+    return 0;+  }++  Scalar* x = reinterpret_cast<Scalar*>(px);+  Scalar* y = reinterpret_cast<Scalar*>(py);++  if(*incx==1 && *incy==1)    *res = (make_vector(x,*n).dot(make_vector(y,*n)));+  else if(*incx>0 && *incy>0) *res = (make_vector(x,*n,*incx).dot(make_vector(y,*n,*incy)));+  else if(*incx<0 && *incy>0) *res = (make_vector(x,*n,-*incx).reverse().dot(make_vector(y,*n,*incy)));+  else if(*incx>0 && *incy<0) *res = (make_vector(x,*n,*incx).dot(make_vector(y,*n,-*incy).reverse()));+  else if(*incx<0 && *incy<0) *res = (make_vector(x,*n,-*incx).reverse().dot(make_vector(y,*n,-*incy).reverse()));+  return 0;+}++// computes a vector-vector dot product without complex conjugation.+int EIGEN_BLAS_FUNC(dotuw)(int *n, RealScalar *px, int *incx, RealScalar *py, int *incy, RealScalar* pres)+{+  Scalar* res = reinterpret_cast<Scalar*>(pres);++  if(*n<=0)+  {+    *res = Scalar(0);+    return 0;+  }++  Scalar* x = reinterpret_cast<Scalar*>(px);+  Scalar* y = reinterpret_cast<Scalar*>(py);++  if(*incx==1 && *incy==1)    *res = (make_vector(x,*n).cwiseProduct(make_vector(y,*n))).sum();+  else if(*incx>0 && *incy>0) *res = (make_vector(x,*n,*incx).cwiseProduct(make_vector(y,*n,*incy))).sum();+  else if(*incx<0 && *incy>0) *res = (make_vector(x,*n,-*incx).reverse().cwiseProduct(make_vector(y,*n,*incy))).sum();+  else if(*incx>0 && *incy<0) *res = (make_vector(x,*n,*incx).cwiseProduct(make_vector(y,*n,-*incy).reverse())).sum();+  else if(*incx<0 && *incy<0) *res = (make_vector(x,*n,-*incx).reverse().cwiseProduct(make_vector(y,*n,-*incy).reverse())).sum();+  return 0;+}++RealScalar EIGEN_CAT(EIGEN_CAT(REAL_SCALAR_SUFFIX,SCALAR_SUFFIX),nrm2_)(int *n, RealScalar *px, int *incx)+{+//   std::cerr << "__nrm2 " << *n << " " << *incx << "\n";+  if(*n<=0) return 0;++  Scalar* x = reinterpret_cast<Scalar*>(px);++  if(*incx==1)+    return make_vector(x,*n).stableNorm();++  return make_vector(x,*n,*incx).stableNorm();+}++int EIGEN_CAT(EIGEN_CAT(SCALAR_SUFFIX,REAL_SCALAR_SUFFIX),rot_)(int *n, RealScalar *px, int *incx, RealScalar *py, int *incy, RealScalar *pc, RealScalar *ps)+{+  if(*n<=0) return 0;++  Scalar* x = reinterpret_cast<Scalar*>(px);+  Scalar* y = reinterpret_cast<Scalar*>(py);+  RealScalar c = *pc;+  RealScalar s = *ps;++  StridedVectorType vx(make_vector(x,*n,std::abs(*incx)));+  StridedVectorType vy(make_vector(y,*n,std::abs(*incy)));++  Reverse<StridedVectorType> rvx(vx);+  Reverse<StridedVectorType> rvy(vy);++  // TODO implement mixed real-scalar rotations+       if(*incx<0 && *incy>0) internal::apply_rotation_in_the_plane(rvx, vy, JacobiRotation<Scalar>(c,s));+  else if(*incx>0 && *incy<0) internal::apply_rotation_in_the_plane(vx, rvy, JacobiRotation<Scalar>(c,s));+  else                        internal::apply_rotation_in_the_plane(vx, vy,  JacobiRotation<Scalar>(c,s));++  return 0;+}++int EIGEN_CAT(EIGEN_CAT(SCALAR_SUFFIX,REAL_SCALAR_SUFFIX),scal_)(int *n, RealScalar *palpha, RealScalar *px, int *incx)+{+  if(*n<=0) return 0;++  Scalar* x = reinterpret_cast<Scalar*>(px);+  RealScalar alpha = *palpha;++//   std::cerr << "__scal " << *n << " " << alpha << " " << *incx << "\n";++  if(*incx==1)  make_vector(x,*n) *= alpha;+  else          make_vector(x,*n,std::abs(*incx)) *= alpha;++  return 0;+}
+ eigen3/blas/level1_impl.h view
@@ -0,0 +1,166 @@+// This file is part of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2009-2010 Gael Guennebaud <gael.guennebaud@inria.fr>+//+// 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"++int EIGEN_BLAS_FUNC(axpy)(const int *n, const RealScalar *palpha, const RealScalar *px, const int *incx, RealScalar *py, const int *incy)+{+  const Scalar* x = reinterpret_cast<const Scalar*>(px);+  Scalar* y = reinterpret_cast<Scalar*>(py);+  Scalar alpha  = *reinterpret_cast<const Scalar*>(palpha);++  if(*n<=0) return 0;++  if(*incx==1 && *incy==1)    make_vector(y,*n) += alpha * make_vector(x,*n);+  else if(*incx>0 && *incy>0) make_vector(y,*n,*incy) += alpha * make_vector(x,*n,*incx);+  else if(*incx>0 && *incy<0) make_vector(y,*n,-*incy).reverse() += alpha * make_vector(x,*n,*incx);+  else if(*incx<0 && *incy>0) make_vector(y,*n,*incy) += alpha * make_vector(x,*n,-*incx).reverse();+  else if(*incx<0 && *incy<0) make_vector(y,*n,-*incy).reverse() += alpha * make_vector(x,*n,-*incx).reverse();++  return 0;+}++int EIGEN_BLAS_FUNC(copy)(int *n, RealScalar *px, int *incx, RealScalar *py, int *incy)+{+  if(*n<=0) return 0;++  Scalar* x = reinterpret_cast<Scalar*>(px);+  Scalar* y = reinterpret_cast<Scalar*>(py);++  // be carefull, *incx==0 is allowed !!+  if(*incx==1 && *incy==1)+    make_vector(y,*n) = make_vector(x,*n);+  else+  {+    if(*incx<0) x = x - (*n-1)*(*incx);+    if(*incy<0) y = y - (*n-1)*(*incy);+    for(int i=0;i<*n;++i)+    {+      *y = *x;+      x += *incx;+      y += *incy;+    }+  }++  return 0;+}++int EIGEN_CAT(EIGEN_CAT(i,SCALAR_SUFFIX),amax_)(int *n, RealScalar *px, int *incx)+{+  if(*n<=0) return 0;+  Scalar* x = reinterpret_cast<Scalar*>(px);++  DenseIndex ret;+  if(*incx==1)  make_vector(x,*n).cwiseAbs().maxCoeff(&ret);+  else          make_vector(x,*n,std::abs(*incx)).cwiseAbs().maxCoeff(&ret);+  return int(ret)+1;+}++int EIGEN_CAT(EIGEN_CAT(i,SCALAR_SUFFIX),amin_)(int *n, RealScalar *px, int *incx)+{+  if(*n<=0) return 0;+  Scalar* x = reinterpret_cast<Scalar*>(px);++  DenseIndex ret;+  if(*incx==1)  make_vector(x,*n).cwiseAbs().minCoeff(&ret);+  else          make_vector(x,*n,std::abs(*incx)).cwiseAbs().minCoeff(&ret);+  return int(ret)+1;+}++int EIGEN_BLAS_FUNC(rotg)(RealScalar *pa, RealScalar *pb, RealScalar *pc, RealScalar *ps)+{+  using std::sqrt;+  using std::abs;++  Scalar& a = *reinterpret_cast<Scalar*>(pa);+  Scalar& b = *reinterpret_cast<Scalar*>(pb);+  RealScalar* c = pc;+  Scalar* s = reinterpret_cast<Scalar*>(ps);++  #if !ISCOMPLEX+  Scalar r,z;+  Scalar aa = abs(a);+  Scalar ab = abs(b);+  if((aa+ab)==Scalar(0))+  {+    *c = 1;+    *s = 0;+    r = 0;+    z = 0;+  }+  else+  {+    r = sqrt(a*a + b*b);+    Scalar amax = aa>ab ? a : b;+    r = amax>0 ? r : -r;+    *c = a/r;+    *s = b/r;+    z = 1;+    if (aa > ab) z = *s;+    if (ab > aa && *c!=RealScalar(0))+      z = Scalar(1)/ *c;+  }+  *pa = r;+  *pb = z;+  #else+  Scalar alpha;+  RealScalar norm,scale;+  if(abs(a)==RealScalar(0))+  {+    *c = RealScalar(0);+    *s = Scalar(1);+    a = b;+  }+  else+  {+    scale = abs(a) + abs(b);+    norm = scale*sqrt((numext::abs2(a/scale)) + (numext::abs2(b/scale)));+    alpha = a/abs(a);+    *c = abs(a)/norm;+    *s = alpha*numext::conj(b)/norm;+    a = alpha*norm;+  }+  #endif++//   JacobiRotation<Scalar> r;+//   r.makeGivens(a,b);+//   *c = r.c();+//   *s = r.s();++  return 0;+}++int EIGEN_BLAS_FUNC(scal)(int *n, RealScalar *palpha, RealScalar *px, int *incx)+{+  if(*n<=0) return 0;++  Scalar* x = reinterpret_cast<Scalar*>(px);+  Scalar alpha = *reinterpret_cast<Scalar*>(palpha);++  if(*incx==1)  make_vector(x,*n) *= alpha;+  else          make_vector(x,*n,std::abs(*incx)) *= alpha;++  return 0;+}++int EIGEN_BLAS_FUNC(swap)(int *n, RealScalar *px, int *incx, RealScalar *py, int *incy)+{+  if(*n<=0) return 0;++  Scalar* x = reinterpret_cast<Scalar*>(px);+  Scalar* y = reinterpret_cast<Scalar*>(py);++  if(*incx==1 && *incy==1)    make_vector(y,*n).swap(make_vector(x,*n));+  else if(*incx>0 && *incy>0) make_vector(y,*n,*incy).swap(make_vector(x,*n,*incx));+  else if(*incx>0 && *incy<0) make_vector(y,*n,-*incy).reverse().swap(make_vector(x,*n,*incx));+  else if(*incx<0 && *incy>0) make_vector(y,*n,*incy).swap(make_vector(x,*n,-*incx).reverse());+  else if(*incx<0 && *incy<0) make_vector(y,*n,-*incy).reverse().swap(make_vector(x,*n,-*incx).reverse());++  return 1;+}
+ eigen3/blas/level1_real_impl.h view
@@ -0,0 +1,100 @@+// This file is part of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2009-2010 Gael Guennebaud <gael.guennebaud@inria.fr>+//+// 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"++// computes the sum of magnitudes of all vector elements or, for a complex vector x, the sum+// res = |Rex1| + |Imx1| + |Rex2| + |Imx2| + ... + |Rexn| + |Imxn|, where x is a vector of order n+RealScalar EIGEN_BLAS_FUNC(asum)(int *n, RealScalar *px, int *incx)+{+//   std::cerr << "_asum " << *n << " " << *incx << "\n";++  Scalar* x = reinterpret_cast<Scalar*>(px);++  if(*n<=0) return 0;++  if(*incx==1)  return make_vector(x,*n).cwiseAbs().sum();+  else          return make_vector(x,*n,std::abs(*incx)).cwiseAbs().sum();+}++// computes a vector-vector dot product.+Scalar EIGEN_BLAS_FUNC(dot)(int *n, RealScalar *px, int *incx, RealScalar *py, int *incy)+{+//   std::cerr << "_dot " << *n << " " << *incx << " " << *incy << "\n";++  if(*n<=0) return 0;++  Scalar* x = reinterpret_cast<Scalar*>(px);+  Scalar* y = reinterpret_cast<Scalar*>(py);++  if(*incx==1 && *incy==1)    return (make_vector(x,*n).cwiseProduct(make_vector(y,*n))).sum();+  else if(*incx>0 && *incy>0) return (make_vector(x,*n,*incx).cwiseProduct(make_vector(y,*n,*incy))).sum();+  else if(*incx<0 && *incy>0) return (make_vector(x,*n,-*incx).reverse().cwiseProduct(make_vector(y,*n,*incy))).sum();+  else if(*incx>0 && *incy<0) return (make_vector(x,*n,*incx).cwiseProduct(make_vector(y,*n,-*incy).reverse())).sum();+  else if(*incx<0 && *incy<0) return (make_vector(x,*n,-*incx).reverse().cwiseProduct(make_vector(y,*n,-*incy).reverse())).sum();+  else return 0;+}++// computes the Euclidean norm of a vector.+// FIXME+Scalar EIGEN_BLAS_FUNC(nrm2)(int *n, RealScalar *px, int *incx)+{+//   std::cerr << "_nrm2 " << *n << " " << *incx << "\n";+  if(*n<=0) return 0;++  Scalar* x = reinterpret_cast<Scalar*>(px);++  if(*incx==1)  return make_vector(x,*n).stableNorm();+  else          return make_vector(x,*n,std::abs(*incx)).stableNorm();+}++int EIGEN_BLAS_FUNC(rot)(int *n, RealScalar *px, int *incx, RealScalar *py, int *incy, RealScalar *pc, RealScalar *ps)+{+//   std::cerr << "_rot " << *n << " " << *incx << " " << *incy << "\n";+  if(*n<=0) return 0;++  Scalar* x = reinterpret_cast<Scalar*>(px);+  Scalar* y = reinterpret_cast<Scalar*>(py);+  Scalar c = *reinterpret_cast<Scalar*>(pc);+  Scalar s = *reinterpret_cast<Scalar*>(ps);++  StridedVectorType vx(make_vector(x,*n,std::abs(*incx)));+  StridedVectorType vy(make_vector(y,*n,std::abs(*incy)));++  Reverse<StridedVectorType> rvx(vx);+  Reverse<StridedVectorType> rvy(vy);++       if(*incx<0 && *incy>0) internal::apply_rotation_in_the_plane(rvx, vy, JacobiRotation<Scalar>(c,s));+  else if(*incx>0 && *incy<0) internal::apply_rotation_in_the_plane(vx, rvy, JacobiRotation<Scalar>(c,s));+  else                        internal::apply_rotation_in_the_plane(vx, vy,  JacobiRotation<Scalar>(c,s));+++  return 0;+}++/*+// performs rotation of points in the modified plane.+int EIGEN_BLAS_FUNC(rotm)(int *n, RealScalar *px, int *incx, RealScalar *py, int *incy, RealScalar *param)+{+  Scalar* x = reinterpret_cast<Scalar*>(px);+  Scalar* y = reinterpret_cast<Scalar*>(py);++  // TODO++  return 0;+}++// computes the modified parameters for a Givens rotation.+int EIGEN_BLAS_FUNC(rotmg)(RealScalar *d1, RealScalar *d2, RealScalar *x1, RealScalar *x2, RealScalar *param)+{+  // TODO++  return 0;+}+*/
+ eigen3/blas/level2_cplx_impl.h view
@@ -0,0 +1,360 @@+// This file is part of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2009-2010 Gael Guennebaud <gael.guennebaud@inria.fr>+//+// 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"++/**  ZHEMV  performs the matrix-vector  operation+  *+  *     y := alpha*A*x + beta*y,+  *+  *  where alpha and beta are scalars, x and y are n element vectors and+  *  A is an n by n hermitian matrix.+  */+int EIGEN_BLAS_FUNC(hemv)(const char *uplo, const int *n, const RealScalar *palpha, const RealScalar *pa, const int *lda,+                          const RealScalar *px, const int *incx, const RealScalar *pbeta, RealScalar *py, const int *incy)+{+  typedef void (*functype)(int, const Scalar*, int, const Scalar*, Scalar*, Scalar);+  static const functype func[2] = {+    // array index: UP+    (internal::selfadjoint_matrix_vector_product<Scalar,int,ColMajor,Upper,false,false>::run),+    // array index: LO+    (internal::selfadjoint_matrix_vector_product<Scalar,int,ColMajor,Lower,false,false>::run),+  };++  const Scalar* a = reinterpret_cast<const Scalar*>(pa);+  const Scalar* x = reinterpret_cast<const Scalar*>(px);+  Scalar* y = reinterpret_cast<Scalar*>(py);+  Scalar alpha  = *reinterpret_cast<const Scalar*>(palpha);+  Scalar beta   = *reinterpret_cast<const Scalar*>(pbeta);++  // check arguments+  int info = 0;+  if(UPLO(*uplo)==INVALID)        info = 1;+  else if(*n<0)                   info = 2;+  else if(*lda<std::max(1,*n))    info = 5;+  else if(*incx==0)               info = 7;+  else if(*incy==0)               info = 10;+  if(info)+    return xerbla_(SCALAR_SUFFIX_UP"HEMV ",&info,6);++  if(*n==0)+    return 1;++  const Scalar* actual_x = get_compact_vector(x,*n,*incx);+  Scalar* actual_y = get_compact_vector(y,*n,*incy);++  if(beta!=Scalar(1))+  {+    if(beta==Scalar(0)) make_vector(actual_y, *n).setZero();+    else                make_vector(actual_y, *n) *= beta;+  }++  if(alpha!=Scalar(0))+  {+    int code = UPLO(*uplo);+    if(code>=2 || func[code]==0)+      return 0;++    func[code](*n, a, *lda, actual_x, actual_y, alpha);+  }++  if(actual_x!=x) delete[] actual_x;+  if(actual_y!=y) delete[] copy_back(actual_y,y,*n,*incy);++  return 1;+}++/**  ZHBMV  performs the matrix-vector  operation+  *+  *     y := alpha*A*x + beta*y,+  *+  *  where alpha and beta are scalars, x and y are n element vectors and+  *  A is an n by n hermitian band matrix, with k super-diagonals.+  */+// int EIGEN_BLAS_FUNC(hbmv)(char *uplo, int *n, int *k, RealScalar *alpha, RealScalar *a, int *lda,+//                           RealScalar *x, int *incx, RealScalar *beta, RealScalar *y, int *incy)+// {+//   return 1;+// }++/**  ZHPMV  performs the matrix-vector operation+  *+  *     y := alpha*A*x + beta*y,+  *+  *  where alpha and beta are scalars, x and y are n element vectors and+  *  A is an n by n hermitian matrix, supplied in packed form.+  */+// int EIGEN_BLAS_FUNC(hpmv)(char *uplo, int *n, RealScalar *alpha, RealScalar *ap, RealScalar *x, int *incx, RealScalar *beta, RealScalar *y, int *incy)+// {+//   return 1;+// }++/**  ZHPR    performs the hermitian rank 1 operation+  *+  *     A := alpha*x*conjg( x' ) + A,+  *+  *  where alpha is a real scalar, x is an n element vector and A is an+  *  n by n hermitian matrix, supplied in packed form.+  */+int EIGEN_BLAS_FUNC(hpr)(char *uplo, int *n, RealScalar *palpha, RealScalar *px, int *incx, RealScalar *pap)+{+  typedef void (*functype)(int, Scalar*, const Scalar*, RealScalar);+  static const functype func[2] = {+    // array index: UP+    (internal::selfadjoint_packed_rank1_update<Scalar,int,ColMajor,Upper,false,Conj>::run),+    // array index: LO+    (internal::selfadjoint_packed_rank1_update<Scalar,int,ColMajor,Lower,false,Conj>::run),+  };++  Scalar* x = reinterpret_cast<Scalar*>(px);+  Scalar* ap = reinterpret_cast<Scalar*>(pap);+  RealScalar alpha = *palpha;++  int info = 0;+  if(UPLO(*uplo)==INVALID)                                            info = 1;+  else if(*n<0)                                                       info = 2;+  else if(*incx==0)                                                   info = 5;+  if(info)+    return xerbla_(SCALAR_SUFFIX_UP"HPR  ",&info,6);++  if(alpha==Scalar(0))+    return 1;++  Scalar* x_cpy = get_compact_vector(x, *n, *incx);++  int code = UPLO(*uplo);+  if(code>=2 || func[code]==0)+    return 0;++  func[code](*n, ap, x_cpy, alpha);++  if(x_cpy!=x)  delete[] x_cpy;++  return 1;+}++/**  ZHPR2  performs the hermitian rank 2 operation+  *+  *     A := alpha*x*conjg( y' ) + conjg( alpha )*y*conjg( x' ) + A,+  *+  *  where alpha is a scalar, x and y are n element vectors and A is an+  *  n by n hermitian matrix, supplied in packed form.+  */+int EIGEN_BLAS_FUNC(hpr2)(char *uplo, int *n, RealScalar *palpha, RealScalar *px, int *incx, RealScalar *py, int *incy, RealScalar *pap)+{+  typedef void (*functype)(int, Scalar*, const Scalar*, const Scalar*, Scalar);+  static const functype func[2] = {+    // array index: UP+    (internal::packed_rank2_update_selector<Scalar,int,Upper>::run),+    // array index: LO+    (internal::packed_rank2_update_selector<Scalar,int,Lower>::run),+  };++  Scalar* x = reinterpret_cast<Scalar*>(px);+  Scalar* y = reinterpret_cast<Scalar*>(py);+  Scalar* ap = reinterpret_cast<Scalar*>(pap);+  Scalar alpha = *reinterpret_cast<Scalar*>(palpha);++  int info = 0;+  if(UPLO(*uplo)==INVALID)                                            info = 1;+  else if(*n<0)                                                       info = 2;+  else if(*incx==0)                                                   info = 5;+  else if(*incy==0)                                                   info = 7;+  if(info)+    return xerbla_(SCALAR_SUFFIX_UP"HPR2 ",&info,6);++  if(alpha==Scalar(0))+    return 1;++  Scalar* x_cpy = get_compact_vector(x, *n, *incx);+  Scalar* y_cpy = get_compact_vector(y, *n, *incy);++  int code = UPLO(*uplo);+  if(code>=2 || func[code]==0)+    return 0;++  func[code](*n, ap, x_cpy, y_cpy, alpha);++  if(x_cpy!=x)  delete[] x_cpy;+  if(y_cpy!=y)  delete[] y_cpy;++  return 1;+}++/**  ZHER   performs the hermitian rank 1 operation+  *+  *     A := alpha*x*conjg( x' ) + A,+  *+  *  where alpha is a real scalar, x is an n element vector and A is an+  *  n by n hermitian matrix.+  */+int EIGEN_BLAS_FUNC(her)(char *uplo, int *n, RealScalar *palpha, RealScalar *px, int *incx, RealScalar *pa, int *lda)+{+  typedef void (*functype)(int, Scalar*, int, const Scalar*, const Scalar*, const Scalar&);+  static const functype func[2] = {+    // array index: UP+    (selfadjoint_rank1_update<Scalar,int,ColMajor,Upper,false,Conj>::run),+    // array index: LO+    (selfadjoint_rank1_update<Scalar,int,ColMajor,Lower,false,Conj>::run),+  };++  Scalar* x = reinterpret_cast<Scalar*>(px);+  Scalar* a = reinterpret_cast<Scalar*>(pa);+  RealScalar alpha = *reinterpret_cast<RealScalar*>(palpha);++  int info = 0;+  if(UPLO(*uplo)==INVALID)                                            info = 1;+  else if(*n<0)                                                       info = 2;+  else if(*incx==0)                                                   info = 5;+  else if(*lda<std::max(1,*n))                                        info = 7;+  if(info)+    return xerbla_(SCALAR_SUFFIX_UP"HER  ",&info,6);++  if(alpha==RealScalar(0))+    return 1;++  Scalar* x_cpy = get_compact_vector(x, *n, *incx);++  int code = UPLO(*uplo);+  if(code>=2 || func[code]==0)+    return 0;++  func[code](*n, a, *lda, x_cpy, x_cpy, alpha);++  matrix(a,*n,*n,*lda).diagonal().imag().setZero();++  if(x_cpy!=x)  delete[] x_cpy;++  return 1;+}++/**  ZHER2  performs the hermitian rank 2 operation+  *+  *     A := alpha*x*conjg( y' ) + conjg( alpha )*y*conjg( x' ) + A,+  *+  *  where alpha is a scalar, x and y are n element vectors and A is an n+  *  by n hermitian matrix.+  */+int EIGEN_BLAS_FUNC(her2)(char *uplo, int *n, RealScalar *palpha, RealScalar *px, int *incx, RealScalar *py, int *incy, RealScalar *pa, int *lda)+{+  typedef void (*functype)(int, Scalar*, int, const Scalar*, const Scalar*, Scalar);+  static const functype func[2] = {+    // array index: UP+    (internal::rank2_update_selector<Scalar,int,Upper>::run),+    // array index: LO+    (internal::rank2_update_selector<Scalar,int,Lower>::run),+  };++  Scalar* x = reinterpret_cast<Scalar*>(px);+  Scalar* y = reinterpret_cast<Scalar*>(py);+  Scalar* a = reinterpret_cast<Scalar*>(pa);+  Scalar alpha = *reinterpret_cast<Scalar*>(palpha);++  int info = 0;+  if(UPLO(*uplo)==INVALID)                                            info = 1;+  else if(*n<0)                                                       info = 2;+  else if(*incx==0)                                                   info = 5;+  else if(*incy==0)                                                   info = 7;+  else if(*lda<std::max(1,*n))                                        info = 9;+  if(info)+    return xerbla_(SCALAR_SUFFIX_UP"HER2 ",&info,6);++  if(alpha==Scalar(0))+    return 1;++  Scalar* x_cpy = get_compact_vector(x, *n, *incx);+  Scalar* y_cpy = get_compact_vector(y, *n, *incy);++  int code = UPLO(*uplo);+  if(code>=2 || func[code]==0)+    return 0;++  func[code](*n, a, *lda, x_cpy, y_cpy, alpha);++  matrix(a,*n,*n,*lda).diagonal().imag().setZero();++  if(x_cpy!=x)  delete[] x_cpy;+  if(y_cpy!=y)  delete[] y_cpy;++  return 1;+}++/**  ZGERU  performs the rank 1 operation+  *+  *     A := alpha*x*y' + A,+  *+  *  where alpha is a scalar, x is an m element vector, y is an n element+  *  vector and A is an m by n matrix.+  */+int EIGEN_BLAS_FUNC(geru)(int *m, int *n, RealScalar *palpha, RealScalar *px, int *incx, RealScalar *py, int *incy, RealScalar *pa, int *lda)+{+  Scalar* x = reinterpret_cast<Scalar*>(px);+  Scalar* y = reinterpret_cast<Scalar*>(py);+  Scalar* a = reinterpret_cast<Scalar*>(pa);+  Scalar alpha = *reinterpret_cast<Scalar*>(palpha);++  int info = 0;+       if(*m<0)                                                       info = 1;+  else if(*n<0)                                                       info = 2;+  else if(*incx==0)                                                   info = 5;+  else if(*incy==0)                                                   info = 7;+  else if(*lda<std::max(1,*m))                                        info = 9;+  if(info)+    return xerbla_(SCALAR_SUFFIX_UP"GERU ",&info,6);++  if(alpha==Scalar(0))+    return 1;++  Scalar* x_cpy = get_compact_vector(x,*m,*incx);+  Scalar* y_cpy = get_compact_vector(y,*n,*incy);++  internal::general_rank1_update<Scalar,int,ColMajor,false,false>::run(*m, *n, a, *lda, x_cpy, y_cpy, alpha);++  if(x_cpy!=x)  delete[] x_cpy;+  if(y_cpy!=y)  delete[] y_cpy;++  return 1;+}++/**  ZGERC  performs the rank 1 operation+  *+  *     A := alpha*x*conjg( y' ) + A,+  *+  *  where alpha is a scalar, x is an m element vector, y is an n element+  *  vector and A is an m by n matrix.+  */+int EIGEN_BLAS_FUNC(gerc)(int *m, int *n, RealScalar *palpha, RealScalar *px, int *incx, RealScalar *py, int *incy, RealScalar *pa, int *lda)+{+  Scalar* x = reinterpret_cast<Scalar*>(px);+  Scalar* y = reinterpret_cast<Scalar*>(py);+  Scalar* a = reinterpret_cast<Scalar*>(pa);+  Scalar alpha = *reinterpret_cast<Scalar*>(palpha);++  int info = 0;+       if(*m<0)                                                       info = 1;+  else if(*n<0)                                                       info = 2;+  else if(*incx==0)                                                   info = 5;+  else if(*incy==0)                                                   info = 7;+  else if(*lda<std::max(1,*m))                                        info = 9;+  if(info)+    return xerbla_(SCALAR_SUFFIX_UP"GERC ",&info,6);++  if(alpha==Scalar(0))+    return 1;++  Scalar* x_cpy = get_compact_vector(x,*m,*incx);+  Scalar* y_cpy = get_compact_vector(y,*n,*incy);++  internal::general_rank1_update<Scalar,int,ColMajor,false,Conj>::run(*m, *n, a, *lda, x_cpy, y_cpy, alpha);++  if(x_cpy!=x)  delete[] x_cpy;+  if(y_cpy!=y)  delete[] y_cpy;++  return 1;+}
+ eigen3/blas/level2_impl.h view
@@ -0,0 +1,553 @@+// This file is part of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2009-2010 Gael Guennebaud <gael.guennebaud@inria.fr>+//+// 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"++template<typename Index, typename Scalar, int StorageOrder, bool ConjugateLhs, bool ConjugateRhs>+struct general_matrix_vector_product_wrapper+{+  static void run(Index rows, Index cols,const Scalar *lhs, Index lhsStride, const Scalar *rhs, Index rhsIncr, Scalar* res, Index resIncr, Scalar alpha)+  {+    typedef internal::const_blas_data_mapper<Scalar,Index,StorageOrder> LhsMapper;+    typedef internal::const_blas_data_mapper<Scalar,Index,RowMajor> RhsMapper;+    +    internal::general_matrix_vector_product+        <Index,Scalar,LhsMapper,StorageOrder,ConjugateLhs,Scalar,RhsMapper,ConjugateRhs>::run(+        rows, cols, LhsMapper(lhs, lhsStride), RhsMapper(rhs, rhsIncr), res, resIncr, alpha);+  }+};++int EIGEN_BLAS_FUNC(gemv)(const char *opa, const int *m, const int *n, const RealScalar *palpha,+                          const RealScalar *pa, const int *lda, const RealScalar *pb, const int *incb, const RealScalar *pbeta, RealScalar *pc, const int *incc)+{+  typedef void (*functype)(int, int, const Scalar *, int, const Scalar *, int , Scalar *, int, Scalar);+  static const functype func[4] = {+    // array index: NOTR+    (general_matrix_vector_product_wrapper<int,Scalar,ColMajor,false,false>::run),+    // array index: TR  +    (general_matrix_vector_product_wrapper<int,Scalar,RowMajor,false,false>::run),+    // array index: ADJ +    (general_matrix_vector_product_wrapper<int,Scalar,RowMajor,Conj ,false>::run),+    0+  };++  const Scalar* a = reinterpret_cast<const Scalar*>(pa);+  const Scalar* b = reinterpret_cast<const Scalar*>(pb);+  Scalar* c = reinterpret_cast<Scalar*>(pc);+  Scalar alpha  = *reinterpret_cast<const Scalar*>(palpha);+  Scalar beta   = *reinterpret_cast<const Scalar*>(pbeta);++  // check arguments+  int info = 0;+  if(OP(*opa)==INVALID)           info = 1;+  else if(*m<0)                   info = 2;+  else if(*n<0)                   info = 3;+  else if(*lda<std::max(1,*m))    info = 6;+  else if(*incb==0)               info = 8;+  else if(*incc==0)               info = 11;+  if(info)+    return xerbla_(SCALAR_SUFFIX_UP"GEMV ",&info,6);++  if(*m==0 || *n==0 || (alpha==Scalar(0) && beta==Scalar(1)))+    return 0;++  int actual_m = *m;+  int actual_n = *n;+  int code = OP(*opa);+  if(code!=NOTR)+    std::swap(actual_m,actual_n);++  const Scalar* actual_b = get_compact_vector(b,actual_n,*incb);+  Scalar* actual_c = get_compact_vector(c,actual_m,*incc);++  if(beta!=Scalar(1))+  {+    if(beta==Scalar(0)) make_vector(actual_c, actual_m).setZero();+    else                make_vector(actual_c, actual_m) *= beta;+  }++  if(code>=4 || func[code]==0)+    return 0;++  func[code](actual_m, actual_n, a, *lda, actual_b, 1, actual_c, 1, alpha);++  if(actual_b!=b) delete[] actual_b;+  if(actual_c!=c) delete[] copy_back(actual_c,c,actual_m,*incc);++  return 1;+}++int EIGEN_BLAS_FUNC(trsv)(const char *uplo, const char *opa, const char *diag, const int *n, const RealScalar *pa, const int *lda, RealScalar *pb, const int *incb)+{+  typedef void (*functype)(int, const Scalar *, int, Scalar *);+  static const functype func[16] = {+    // array index: NOTR  | (UP << 2) | (NUNIT << 3)+    (internal::triangular_solve_vector<Scalar,Scalar,int,OnTheLeft, Upper|0,       false,ColMajor>::run),+    // array index: TR    | (UP << 2) | (NUNIT << 3)+    (internal::triangular_solve_vector<Scalar,Scalar,int,OnTheLeft, Lower|0,       false,RowMajor>::run),+    // array index: ADJ   | (UP << 2) | (NUNIT << 3)+    (internal::triangular_solve_vector<Scalar,Scalar,int,OnTheLeft, Lower|0,       Conj, RowMajor>::run),+    0,+    // array index: NOTR  | (LO << 2) | (NUNIT << 3)+    (internal::triangular_solve_vector<Scalar,Scalar,int,OnTheLeft, Lower|0,       false,ColMajor>::run),+    // array index: TR    | (LO << 2) | (NUNIT << 3)+    (internal::triangular_solve_vector<Scalar,Scalar,int,OnTheLeft, Upper|0,       false,RowMajor>::run),+    // array index: ADJ   | (LO << 2) | (NUNIT << 3)+    (internal::triangular_solve_vector<Scalar,Scalar,int,OnTheLeft, Upper|0,       Conj, RowMajor>::run),+    0,+    // array index: NOTR  | (UP << 2) | (UNIT  << 3)+    (internal::triangular_solve_vector<Scalar,Scalar,int,OnTheLeft, Upper|UnitDiag,false,ColMajor>::run),+    // array index: TR    | (UP << 2) | (UNIT  << 3)+    (internal::triangular_solve_vector<Scalar,Scalar,int,OnTheLeft, Lower|UnitDiag,false,RowMajor>::run),+    // array index: ADJ   | (UP << 2) | (UNIT  << 3)+    (internal::triangular_solve_vector<Scalar,Scalar,int,OnTheLeft, Lower|UnitDiag,Conj, RowMajor>::run),+    0,+    // array index: NOTR  | (LO << 2) | (UNIT  << 3)+    (internal::triangular_solve_vector<Scalar,Scalar,int,OnTheLeft, Lower|UnitDiag,false,ColMajor>::run),+    // array index: TR    | (LO << 2) | (UNIT  << 3)+    (internal::triangular_solve_vector<Scalar,Scalar,int,OnTheLeft, Upper|UnitDiag,false,RowMajor>::run),+    // array index: ADJ   | (LO << 2) | (UNIT  << 3)+    (internal::triangular_solve_vector<Scalar,Scalar,int,OnTheLeft, Upper|UnitDiag,Conj, RowMajor>::run),+    0+  };++  const Scalar* a = reinterpret_cast<const Scalar*>(pa);+  Scalar* b = reinterpret_cast<Scalar*>(pb);++  int info = 0;+  if(UPLO(*uplo)==INVALID)                                            info = 1;+  else if(OP(*opa)==INVALID)                                          info = 2;+  else if(DIAG(*diag)==INVALID)                                       info = 3;+  else if(*n<0)                                                       info = 4;+  else if(*lda<std::max(1,*n))                                        info = 6;+  else if(*incb==0)                                                   info = 8;+  if(info)+    return xerbla_(SCALAR_SUFFIX_UP"TRSV ",&info,6);++  Scalar* actual_b = get_compact_vector(b,*n,*incb);++  int code = OP(*opa) | (UPLO(*uplo) << 2) | (DIAG(*diag) << 3);+  func[code](*n, a, *lda, actual_b);++  if(actual_b!=b) delete[] copy_back(actual_b,b,*n,*incb);++  return 0;+}++++int EIGEN_BLAS_FUNC(trmv)(const char *uplo, const char *opa, const char *diag, const int *n, const RealScalar *pa, const int *lda, RealScalar *pb, const int *incb)+{+  typedef void (*functype)(int, int, const Scalar *, int, const Scalar *, int, Scalar *, int, const Scalar&);+  static const functype func[16] = {+    // array index: NOTR  | (UP << 2) | (NUNIT << 3)+    (internal::triangular_matrix_vector_product<int,Upper|0,       Scalar,false,Scalar,false,ColMajor>::run),+    // array index: TR    | (UP << 2) | (NUNIT << 3)+    (internal::triangular_matrix_vector_product<int,Lower|0,       Scalar,false,Scalar,false,RowMajor>::run),+    // array index: ADJ   | (UP << 2) | (NUNIT << 3)+    (internal::triangular_matrix_vector_product<int,Lower|0,       Scalar,Conj, Scalar,false,RowMajor>::run),+    0,+    // array index: NOTR  | (LO << 2) | (NUNIT << 3)+    (internal::triangular_matrix_vector_product<int,Lower|0,       Scalar,false,Scalar,false,ColMajor>::run),+    // array index: TR    | (LO << 2) | (NUNIT << 3)+    (internal::triangular_matrix_vector_product<int,Upper|0,       Scalar,false,Scalar,false,RowMajor>::run),+    // array index: ADJ   | (LO << 2) | (NUNIT << 3)+    (internal::triangular_matrix_vector_product<int,Upper|0,       Scalar,Conj, Scalar,false,RowMajor>::run),+    0,+    // array index: NOTR  | (UP << 2) | (UNIT  << 3)+    (internal::triangular_matrix_vector_product<int,Upper|UnitDiag,Scalar,false,Scalar,false,ColMajor>::run),+    // array index: TR    | (UP << 2) | (UNIT  << 3)+    (internal::triangular_matrix_vector_product<int,Lower|UnitDiag,Scalar,false,Scalar,false,RowMajor>::run),+    // array index: ADJ   | (UP << 2) | (UNIT  << 3)+    (internal::triangular_matrix_vector_product<int,Lower|UnitDiag,Scalar,Conj, Scalar,false,RowMajor>::run),+    0,+    // array index: NOTR  | (LO << 2) | (UNIT  << 3)+    (internal::triangular_matrix_vector_product<int,Lower|UnitDiag,Scalar,false,Scalar,false,ColMajor>::run),+    // array index: TR    | (LO << 2) | (UNIT  << 3)+    (internal::triangular_matrix_vector_product<int,Upper|UnitDiag,Scalar,false,Scalar,false,RowMajor>::run),+    // array index: ADJ   | (LO << 2) | (UNIT  << 3)+    (internal::triangular_matrix_vector_product<int,Upper|UnitDiag,Scalar,Conj, Scalar,false,RowMajor>::run),+    0+  };++  const Scalar* a = reinterpret_cast<const Scalar*>(pa);+  Scalar* b = reinterpret_cast<Scalar*>(pb);++  int info = 0;+  if(UPLO(*uplo)==INVALID)                                            info = 1;+  else if(OP(*opa)==INVALID)                                          info = 2;+  else if(DIAG(*diag)==INVALID)                                       info = 3;+  else if(*n<0)                                                       info = 4;+  else if(*lda<std::max(1,*n))                                        info = 6;+  else if(*incb==0)                                                   info = 8;+  if(info)+    return xerbla_(SCALAR_SUFFIX_UP"TRMV ",&info,6);++  if(*n==0)+    return 1;++  Scalar* actual_b = get_compact_vector(b,*n,*incb);+  Matrix<Scalar,Dynamic,1> res(*n);+  res.setZero();++  int code = OP(*opa) | (UPLO(*uplo) << 2) | (DIAG(*diag) << 3);+  if(code>=16 || func[code]==0)+    return 0;++  func[code](*n, *n, a, *lda, actual_b, 1, res.data(), 1, Scalar(1));++  copy_back(res.data(),b,*n,*incb);+  if(actual_b!=b) delete[] actual_b;++  return 1;+}++/**  GBMV  performs one of the matrix-vector operations+  *+  *     y := alpha*A*x + beta*y,   or   y := alpha*A'*x + beta*y,+  *+  *  where alpha and beta are scalars, x and y are vectors and A is an+  *  m by n band matrix, with kl sub-diagonals and ku super-diagonals.+  */+int EIGEN_BLAS_FUNC(gbmv)(char *trans, int *m, int *n, int *kl, int *ku, RealScalar *palpha, RealScalar *pa, int *lda,+                          RealScalar *px, int *incx, RealScalar *pbeta, RealScalar *py, int *incy)+{+  const Scalar* a = reinterpret_cast<const Scalar*>(pa);+  const Scalar* x = reinterpret_cast<const Scalar*>(px);+  Scalar* y = reinterpret_cast<Scalar*>(py);+  Scalar alpha = *reinterpret_cast<const Scalar*>(palpha);+  Scalar beta = *reinterpret_cast<const Scalar*>(pbeta);+  int coeff_rows = *kl+*ku+1;++  int info = 0;+       if(OP(*trans)==INVALID)                                        info = 1;+  else if(*m<0)                                                       info = 2;+  else if(*n<0)                                                       info = 3;+  else if(*kl<0)                                                      info = 4;+  else if(*ku<0)                                                      info = 5;+  else if(*lda<coeff_rows)                                            info = 8;+  else if(*incx==0)                                                   info = 10;+  else if(*incy==0)                                                   info = 13;+  if(info)+    return xerbla_(SCALAR_SUFFIX_UP"GBMV ",&info,6);++  if(*m==0 || *n==0 || (alpha==Scalar(0) && beta==Scalar(1)))+    return 0;++  int actual_m = *m;+  int actual_n = *n;+  if(OP(*trans)!=NOTR)+    std::swap(actual_m,actual_n);++  const Scalar* actual_x = get_compact_vector(x,actual_n,*incx);+  Scalar* actual_y = get_compact_vector(y,actual_m,*incy);++  if(beta!=Scalar(1))+  {+    if(beta==Scalar(0)) make_vector(actual_y, actual_m).setZero();+    else                make_vector(actual_y, actual_m) *= beta;+  }++  ConstMatrixType mat_coeffs(a,coeff_rows,*n,*lda);++  int nb = std::min(*n,(*m)+(*ku));+  for(int j=0; j<nb; ++j)+  {+    int start = std::max(0,j - *ku);+    int end = std::min((*m)-1,j + *kl);+    int len = end - start + 1;+    int offset = (*ku) - j + start;+    if(OP(*trans)==NOTR)+      make_vector(actual_y+start,len) += (alpha*actual_x[j]) * mat_coeffs.col(j).segment(offset,len);+    else if(OP(*trans)==TR)+      actual_y[j] += alpha * ( mat_coeffs.col(j).segment(offset,len).transpose() * make_vector(actual_x+start,len) ).value();+    else+      actual_y[j] += alpha * ( mat_coeffs.col(j).segment(offset,len).adjoint()   * make_vector(actual_x+start,len) ).value();+  }++  if(actual_x!=x) delete[] actual_x;+  if(actual_y!=y) delete[] copy_back(actual_y,y,actual_m,*incy);++  return 0;+}++#if 0+/**  TBMV  performs one of the matrix-vector operations+  *+  *     x := A*x,   or   x := A'*x,+  *+  *  where x is an n element vector and  A is an n by n unit, or non-unit,+  *  upper or lower triangular band matrix, with ( k + 1 ) diagonals.+  */+int EIGEN_BLAS_FUNC(tbmv)(char *uplo, char *opa, char *diag, int *n, int *k, RealScalar *pa, int *lda, RealScalar *px, int *incx)+{+  Scalar* a = reinterpret_cast<Scalar*>(pa);+  Scalar* x = reinterpret_cast<Scalar*>(px);+  int coeff_rows = *k + 1;++  int info = 0;+       if(UPLO(*uplo)==INVALID)                                       info = 1;+  else if(OP(*opa)==INVALID)                                          info = 2;+  else if(DIAG(*diag)==INVALID)                                       info = 3;+  else if(*n<0)                                                       info = 4;+  else if(*k<0)                                                       info = 5;+  else if(*lda<coeff_rows)                                            info = 7;+  else if(*incx==0)                                                   info = 9;+  if(info)+    return xerbla_(SCALAR_SUFFIX_UP"TBMV ",&info,6);++  if(*n==0)+    return 0;++  int actual_n = *n;++  Scalar* actual_x = get_compact_vector(x,actual_n,*incx);++  MatrixType mat_coeffs(a,coeff_rows,*n,*lda);++  int ku = UPLO(*uplo)==UPPER ? *k : 0;+  int kl = UPLO(*uplo)==LOWER ? *k : 0;++  for(int j=0; j<*n; ++j)+  {+    int start = std::max(0,j - ku);+    int end = std::min((*m)-1,j + kl);+    int len = end - start + 1;+    int offset = (ku) - j + start;++    if(OP(*trans)==NOTR)+      make_vector(actual_y+start,len) += (alpha*actual_x[j]) * mat_coeffs.col(j).segment(offset,len);+    else if(OP(*trans)==TR)+      actual_y[j] += alpha * ( mat_coeffs.col(j).segment(offset,len).transpose() * make_vector(actual_x+start,len) ).value();+    else+      actual_y[j] += alpha * ( mat_coeffs.col(j).segment(offset,len).adjoint()   * make_vector(actual_x+start,len) ).value();+  }++  if(actual_x!=x) delete[] actual_x;+  if(actual_y!=y) delete[] copy_back(actual_y,y,actual_m,*incy);++  return 0;+}+#endif++/**  DTBSV  solves one of the systems of equations+  *+  *     A*x = b,   or   A'*x = b,+  *+  *  where b and x are n element vectors and A is an n by n unit, or+  *  non-unit, upper or lower triangular band matrix, with ( k + 1 )+  *  diagonals.+  *+  *  No test for singularity or near-singularity is included in this+  *  routine. Such tests must be performed before calling this routine.+  */+int EIGEN_BLAS_FUNC(tbsv)(char *uplo, char *op, char *diag, int *n, int *k, RealScalar *pa, int *lda, RealScalar *px, int *incx)+{+  typedef void (*functype)(int, int, const Scalar *, int, Scalar *);+  static const functype func[16] = {+    // array index: NOTR  | (UP << 2) | (NUNIT << 3)+    (internal::band_solve_triangular_selector<int,Upper|0,       Scalar,false,Scalar,ColMajor>::run),+    // array index: TR    | (UP << 2) | (NUNIT << 3)+    (internal::band_solve_triangular_selector<int,Lower|0,       Scalar,false,Scalar,RowMajor>::run),+    // array index: ADJ   | (UP << 2) | (NUNIT << 3)+    (internal::band_solve_triangular_selector<int,Lower|0,       Scalar,Conj, Scalar,RowMajor>::run),+    0,+    // array index: NOTR  | (LO << 2) | (NUNIT << 3)+    (internal::band_solve_triangular_selector<int,Lower|0,       Scalar,false,Scalar,ColMajor>::run),+    // array index: TR    | (LO << 2) | (NUNIT << 3)+    (internal::band_solve_triangular_selector<int,Upper|0,       Scalar,false,Scalar,RowMajor>::run),+    // array index: ADJ   | (LO << 2) | (NUNIT << 3)+    (internal::band_solve_triangular_selector<int,Upper|0,       Scalar,Conj, Scalar,RowMajor>::run),+    0,+    // array index: NOTR  | (UP << 2) | (UNIT  << 3)+    (internal::band_solve_triangular_selector<int,Upper|UnitDiag,Scalar,false,Scalar,ColMajor>::run),+    // array index: TR    | (UP << 2) | (UNIT  << 3)+    (internal::band_solve_triangular_selector<int,Lower|UnitDiag,Scalar,false,Scalar,RowMajor>::run),+    // array index: ADJ   | (UP << 2) | (UNIT  << 3)+    (internal::band_solve_triangular_selector<int,Lower|UnitDiag,Scalar,Conj, Scalar,RowMajor>::run),+    0,+    // array index: NOTR  | (LO << 2) | (UNIT  << 3)+    (internal::band_solve_triangular_selector<int,Lower|UnitDiag,Scalar,false,Scalar,ColMajor>::run),+    // array index: TR    | (LO << 2) | (UNIT  << 3)+    (internal::band_solve_triangular_selector<int,Upper|UnitDiag,Scalar,false,Scalar,RowMajor>::run),+    // array index: ADJ   | (LO << 2) | (UNIT  << 3)+    (internal::band_solve_triangular_selector<int,Upper|UnitDiag,Scalar,Conj, Scalar,RowMajor>::run),+    0,+  };++  Scalar* a = reinterpret_cast<Scalar*>(pa);+  Scalar* x = reinterpret_cast<Scalar*>(px);+  int coeff_rows = *k+1;++  int info = 0;+       if(UPLO(*uplo)==INVALID)                                       info = 1;+  else if(OP(*op)==INVALID)                                           info = 2;+  else if(DIAG(*diag)==INVALID)                                       info = 3;+  else if(*n<0)                                                       info = 4;+  else if(*k<0)                                                       info = 5;+  else if(*lda<coeff_rows)                                            info = 7;+  else if(*incx==0)                                                   info = 9;+  if(info)+    return xerbla_(SCALAR_SUFFIX_UP"TBSV ",&info,6);++  if(*n==0 || (*k==0 && DIAG(*diag)==UNIT))+    return 0;++  int actual_n = *n;++  Scalar* actual_x = get_compact_vector(x,actual_n,*incx);++  int code = OP(*op) | (UPLO(*uplo) << 2) | (DIAG(*diag) << 3);+  if(code>=16 || func[code]==0)+    return 0;++  func[code](*n, *k, a, *lda, actual_x);++  if(actual_x!=x) delete[] copy_back(actual_x,x,actual_n,*incx);++  return 0;+}++/**  DTPMV  performs one of the matrix-vector operations+  *+  *     x := A*x,   or   x := A'*x,+  *+  *  where x is an n element vector and  A is an n by n unit, or non-unit,+  *  upper or lower triangular matrix, supplied in packed form.+  */+int EIGEN_BLAS_FUNC(tpmv)(char *uplo, char *opa, char *diag, int *n, RealScalar *pap, RealScalar *px, int *incx)+{+  typedef void (*functype)(int, const Scalar*, const Scalar*, Scalar*, Scalar);+  static const functype func[16] = {+    // array index: NOTR  | (UP << 2) | (NUNIT << 3)+    (internal::packed_triangular_matrix_vector_product<int,Upper|0,       Scalar,false,Scalar,false,ColMajor>::run),+    // array index: TR    | (UP << 2) | (NUNIT << 3)+    (internal::packed_triangular_matrix_vector_product<int,Lower|0,       Scalar,false,Scalar,false,RowMajor>::run),+    // array index: ADJ   | (UP << 2) | (NUNIT << 3)+    (internal::packed_triangular_matrix_vector_product<int,Lower|0,       Scalar,Conj, Scalar,false,RowMajor>::run),+    0,+    // array index: NOTR  | (LO << 2) | (NUNIT << 3)+    (internal::packed_triangular_matrix_vector_product<int,Lower|0,       Scalar,false,Scalar,false,ColMajor>::run),+    // array index: TR    | (LO << 2) | (NUNIT << 3)+    (internal::packed_triangular_matrix_vector_product<int,Upper|0,       Scalar,false,Scalar,false,RowMajor>::run),+    // array index: ADJ   | (LO << 2) | (NUNIT << 3)+    (internal::packed_triangular_matrix_vector_product<int,Upper|0,       Scalar,Conj, Scalar,false,RowMajor>::run),+    0,+    // array index: NOTR  | (UP << 2) | (UNIT  << 3)+    (internal::packed_triangular_matrix_vector_product<int,Upper|UnitDiag,Scalar,false,Scalar,false,ColMajor>::run),+    // array index: TR    | (UP << 2) | (UNIT  << 3)+    (internal::packed_triangular_matrix_vector_product<int,Lower|UnitDiag,Scalar,false,Scalar,false,RowMajor>::run),+    // array index: ADJ   | (UP << 2) | (UNIT  << 3)+    (internal::packed_triangular_matrix_vector_product<int,Lower|UnitDiag,Scalar,Conj, Scalar,false,RowMajor>::run),+    0,+    // array index: NOTR  | (LO << 2) | (UNIT  << 3)+    (internal::packed_triangular_matrix_vector_product<int,Lower|UnitDiag,Scalar,false,Scalar,false,ColMajor>::run),+    // array index: TR    | (LO << 2) | (UNIT  << 3)+    (internal::packed_triangular_matrix_vector_product<int,Upper|UnitDiag,Scalar,false,Scalar,false,RowMajor>::run),+    // array index: ADJ   | (LO << 2) | (UNIT  << 3)+    (internal::packed_triangular_matrix_vector_product<int,Upper|UnitDiag,Scalar,Conj, Scalar,false,RowMajor>::run),+    0+  };++  Scalar* ap = reinterpret_cast<Scalar*>(pap);+  Scalar* x = reinterpret_cast<Scalar*>(px);++  int info = 0;+  if(UPLO(*uplo)==INVALID)                                            info = 1;+  else if(OP(*opa)==INVALID)                                          info = 2;+  else if(DIAG(*diag)==INVALID)                                       info = 3;+  else if(*n<0)                                                       info = 4;+  else if(*incx==0)                                                   info = 7;+  if(info)+    return xerbla_(SCALAR_SUFFIX_UP"TPMV ",&info,6);++  if(*n==0)+    return 1;++  Scalar* actual_x = get_compact_vector(x,*n,*incx);+  Matrix<Scalar,Dynamic,1> res(*n);+  res.setZero();++  int code = OP(*opa) | (UPLO(*uplo) << 2) | (DIAG(*diag) << 3);+  if(code>=16 || func[code]==0)+    return 0;++  func[code](*n, ap, actual_x, res.data(), Scalar(1));++  copy_back(res.data(),x,*n,*incx);+  if(actual_x!=x) delete[] actual_x;++  return 1;+}++/**  DTPSV  solves one of the systems of equations+  *+  *     A*x = b,   or   A'*x = b,+  *+  *  where b and x are n element vectors and A is an n by n unit, or+  *  non-unit, upper or lower triangular matrix, supplied in packed form.+  *+  *  No test for singularity or near-singularity is included in this+  *  routine. Such tests must be performed before calling this routine.+  */+int EIGEN_BLAS_FUNC(tpsv)(char *uplo, char *opa, char *diag, int *n, RealScalar *pap, RealScalar *px, int *incx)+{+  typedef void (*functype)(int, const Scalar*, Scalar*);+  static const functype func[16] = {+    // array index: NOTR  | (UP << 2) | (NUNIT << 3)+    (internal::packed_triangular_solve_vector<Scalar,Scalar,int,OnTheLeft, Upper|0,       false,ColMajor>::run),+    // array index: TR    | (UP << 2) | (NUNIT << 3)+    (internal::packed_triangular_solve_vector<Scalar,Scalar,int,OnTheLeft, Lower|0,       false,RowMajor>::run),+    // array index: ADJ   | (UP << 2) | (NUNIT << 3)+    (internal::packed_triangular_solve_vector<Scalar,Scalar,int,OnTheLeft, Lower|0,       Conj, RowMajor>::run),+    0,+    // array index: NOTR  | (LO << 2) | (NUNIT << 3)+    (internal::packed_triangular_solve_vector<Scalar,Scalar,int,OnTheLeft, Lower|0,       false,ColMajor>::run),+    // array index: TR    | (LO << 2) | (NUNIT << 3)+    (internal::packed_triangular_solve_vector<Scalar,Scalar,int,OnTheLeft, Upper|0,       false,RowMajor>::run),+    // array index: ADJ   | (LO << 2) | (NUNIT << 3)+    (internal::packed_triangular_solve_vector<Scalar,Scalar,int,OnTheLeft, Upper|0,       Conj, RowMajor>::run),+    0,+    // array index: NOTR  | (UP << 2) | (UNIT  << 3)+    (internal::packed_triangular_solve_vector<Scalar,Scalar,int,OnTheLeft, Upper|UnitDiag,false,ColMajor>::run),+    // array index: TR    | (UP << 2) | (UNIT  << 3)+    (internal::packed_triangular_solve_vector<Scalar,Scalar,int,OnTheLeft, Lower|UnitDiag,false,RowMajor>::run),+    // array index: ADJ   | (UP << 2) | (UNIT  << 3)+    (internal::packed_triangular_solve_vector<Scalar,Scalar,int,OnTheLeft, Lower|UnitDiag,Conj, RowMajor>::run),+    0,+    // array index: NOTR  | (LO << 2) | (UNIT  << 3)+    (internal::packed_triangular_solve_vector<Scalar,Scalar,int,OnTheLeft, Lower|UnitDiag,false,ColMajor>::run),+    // array index: TR    | (LO << 2) | (UNIT  << 3)+    (internal::packed_triangular_solve_vector<Scalar,Scalar,int,OnTheLeft, Upper|UnitDiag,false,RowMajor>::run),+    // array index: ADJ   | (LO << 2) | (UNIT  << 3)+    (internal::packed_triangular_solve_vector<Scalar,Scalar,int,OnTheLeft, Upper|UnitDiag,Conj, RowMajor>::run),+    0+  };++  Scalar* ap = reinterpret_cast<Scalar*>(pap);+  Scalar* x = reinterpret_cast<Scalar*>(px);++  int info = 0;+  if(UPLO(*uplo)==INVALID)                                            info = 1;+  else if(OP(*opa)==INVALID)                                          info = 2;+  else if(DIAG(*diag)==INVALID)                                       info = 3;+  else if(*n<0)                                                       info = 4;+  else if(*incx==0)                                                   info = 7;+  if(info)+    return xerbla_(SCALAR_SUFFIX_UP"TPSV ",&info,6);++  Scalar* actual_x = get_compact_vector(x,*n,*incx);++  int code = OP(*opa) | (UPLO(*uplo) << 2) | (DIAG(*diag) << 3);+  func[code](*n, ap, actual_x);++  if(actual_x!=x) delete[] copy_back(actual_x,x,*n,*incx);++  return 1;+}
+ eigen3/blas/level2_real_impl.h view
@@ -0,0 +1,306 @@+// This file is part of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2009-2010 Gael Guennebaud <gael.guennebaud@inria.fr>+//+// 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"++// y = alpha*A*x + beta*y+int EIGEN_BLAS_FUNC(symv) (const char *uplo, const int *n, const RealScalar *palpha, const RealScalar *pa, const int *lda,+                           const RealScalar *px, const int *incx, const RealScalar *pbeta, RealScalar *py, const int *incy)+{+  typedef void (*functype)(int, const Scalar*, int, const Scalar*, Scalar*, Scalar);+  static const functype func[2] = {+    // array index: UP+    (internal::selfadjoint_matrix_vector_product<Scalar,int,ColMajor,Upper,false,false>::run),+    // array index: LO+    (internal::selfadjoint_matrix_vector_product<Scalar,int,ColMajor,Lower,false,false>::run),+  };++  const Scalar* a = reinterpret_cast<const Scalar*>(pa);+  const Scalar* x = reinterpret_cast<const Scalar*>(px);+  Scalar* y = reinterpret_cast<Scalar*>(py);+  Scalar alpha  = *reinterpret_cast<const Scalar*>(palpha);+  Scalar beta   = *reinterpret_cast<const Scalar*>(pbeta);++  // check arguments+  int info = 0;+  if(UPLO(*uplo)==INVALID)        info = 1;+  else if(*n<0)                   info = 2;+  else if(*lda<std::max(1,*n))    info = 5;+  else if(*incx==0)               info = 7;+  else if(*incy==0)               info = 10;+  if(info)+    return xerbla_(SCALAR_SUFFIX_UP"SYMV ",&info,6);++  if(*n==0)+    return 0;++  const Scalar* actual_x = get_compact_vector(x,*n,*incx);+  Scalar* actual_y = get_compact_vector(y,*n,*incy);++  if(beta!=Scalar(1))+  {+    if(beta==Scalar(0)) make_vector(actual_y, *n).setZero();+    else                make_vector(actual_y, *n) *= beta;+  }++  int code = UPLO(*uplo);+  if(code>=2 || func[code]==0)+    return 0;++  func[code](*n, a, *lda, actual_x, actual_y, alpha);++  if(actual_x!=x) delete[] actual_x;+  if(actual_y!=y) delete[] copy_back(actual_y,y,*n,*incy);++  return 1;+}++// C := alpha*x*x' + C+int EIGEN_BLAS_FUNC(syr)(const char *uplo, const int *n, const RealScalar *palpha, const RealScalar *px, const int *incx, RealScalar *pc, const int *ldc)+{++  typedef void (*functype)(int, Scalar*, int, const Scalar*, const Scalar*, const Scalar&);+  static const functype func[2] = {+    // array index: UP+    (selfadjoint_rank1_update<Scalar,int,ColMajor,Upper,false,Conj>::run),+    // array index: LO+    (selfadjoint_rank1_update<Scalar,int,ColMajor,Lower,false,Conj>::run),+  };++  const Scalar* x = reinterpret_cast<const Scalar*>(px);+  Scalar* c = reinterpret_cast<Scalar*>(pc);+  Scalar alpha = *reinterpret_cast<const Scalar*>(palpha);++  int info = 0;+  if(UPLO(*uplo)==INVALID)                                            info = 1;+  else if(*n<0)                                                       info = 2;+  else if(*incx==0)                                                   info = 5;+  else if(*ldc<std::max(1,*n))                                        info = 7;+  if(info)+    return xerbla_(SCALAR_SUFFIX_UP"SYR  ",&info,6);++  if(*n==0 || alpha==Scalar(0)) return 1;++  // if the increment is not 1, let's copy it to a temporary vector to enable vectorization+  const Scalar* x_cpy = get_compact_vector(x,*n,*incx);++  int code = UPLO(*uplo);+  if(code>=2 || func[code]==0)+    return 0;++  func[code](*n, c, *ldc, x_cpy, x_cpy, alpha);++  if(x_cpy!=x)  delete[] x_cpy;++  return 1;+}++// C := alpha*x*y' + alpha*y*x' + C+int EIGEN_BLAS_FUNC(syr2)(const char *uplo, const int *n, const RealScalar *palpha, const RealScalar *px, const int *incx, const RealScalar *py, const int *incy, RealScalar *pc, const int *ldc)+{+  typedef void (*functype)(int, Scalar*, int, const Scalar*, const Scalar*, Scalar);+  static const functype func[2] = {+    // array index: UP+    (internal::rank2_update_selector<Scalar,int,Upper>::run),+    // array index: LO+    (internal::rank2_update_selector<Scalar,int,Lower>::run),+  };++  const Scalar* x = reinterpret_cast<const Scalar*>(px);+  const Scalar* y = reinterpret_cast<const Scalar*>(py);+  Scalar* c = reinterpret_cast<Scalar*>(pc);+  Scalar alpha = *reinterpret_cast<const Scalar*>(palpha);++  int info = 0;+  if(UPLO(*uplo)==INVALID)                                            info = 1;+  else if(*n<0)                                                       info = 2;+  else if(*incx==0)                                                   info = 5;+  else if(*incy==0)                                                   info = 7;+  else if(*ldc<std::max(1,*n))                                        info = 9;+  if(info)+    return xerbla_(SCALAR_SUFFIX_UP"SYR2 ",&info,6);++  if(alpha==Scalar(0))+    return 1;++  const Scalar* x_cpy = get_compact_vector(x,*n,*incx);+  const Scalar* y_cpy = get_compact_vector(y,*n,*incy);++  int code = UPLO(*uplo);+  if(code>=2 || func[code]==0)+    return 0;++  func[code](*n, c, *ldc, x_cpy, y_cpy, alpha);++  if(x_cpy!=x)  delete[] x_cpy;+  if(y_cpy!=y)  delete[] y_cpy;++//   int code = UPLO(*uplo);+//   if(code>=2 || func[code]==0)+//     return 0;++//   func[code](*n, a, *inca, b, *incb, c, *ldc, alpha);+  return 1;+}++/**  DSBMV  performs the matrix-vector  operation+  *+  *     y := alpha*A*x + beta*y,+  *+  *  where alpha and beta are scalars, x and y are n element vectors and+  *  A is an n by n symmetric band matrix, with k super-diagonals.+  */+// int EIGEN_BLAS_FUNC(sbmv)( char *uplo, int *n, int *k, RealScalar *alpha, RealScalar *a, int *lda,+//                            RealScalar *x, int *incx, RealScalar *beta, RealScalar *y, int *incy)+// {+//   return 1;+// }+++/**  DSPMV  performs the matrix-vector operation+  *+  *     y := alpha*A*x + beta*y,+  *+  *  where alpha and beta are scalars, x and y are n element vectors and+  *  A is an n by n symmetric matrix, supplied in packed form.+  *+  */+// int EIGEN_BLAS_FUNC(spmv)(char *uplo, int *n, RealScalar *alpha, RealScalar *ap, RealScalar *x, int *incx, RealScalar *beta, RealScalar *y, int *incy)+// {+//   return 1;+// }++/**  DSPR    performs the symmetric rank 1 operation+  *+  *     A := alpha*x*x' + A,+  *+  *  where alpha is a real scalar, x is an n element vector and A is an+  *  n by n symmetric matrix, supplied in packed form.+  */+int EIGEN_BLAS_FUNC(spr)(char *uplo, int *n, Scalar *palpha, Scalar *px, int *incx, Scalar *pap)+{+  typedef void (*functype)(int, Scalar*, const Scalar*, Scalar);+  static const functype func[2] = {+    // array index: UP+    (internal::selfadjoint_packed_rank1_update<Scalar,int,ColMajor,Upper,false,false>::run),+    // array index: LO+    (internal::selfadjoint_packed_rank1_update<Scalar,int,ColMajor,Lower,false,false>::run),+  };++  Scalar* x = reinterpret_cast<Scalar*>(px);+  Scalar* ap = reinterpret_cast<Scalar*>(pap);+  Scalar alpha = *reinterpret_cast<Scalar*>(palpha);++  int info = 0;+  if(UPLO(*uplo)==INVALID)                                            info = 1;+  else if(*n<0)                                                       info = 2;+  else if(*incx==0)                                                   info = 5;+  if(info)+    return xerbla_(SCALAR_SUFFIX_UP"SPR  ",&info,6);++  if(alpha==Scalar(0))+    return 1;++  Scalar* x_cpy = get_compact_vector(x, *n, *incx);++  int code = UPLO(*uplo);+  if(code>=2 || func[code]==0)+    return 0;++  func[code](*n, ap, x_cpy, alpha);++  if(x_cpy!=x)  delete[] x_cpy;++  return 1;+}++/**  DSPR2  performs the symmetric rank 2 operation+  *+  *     A := alpha*x*y' + alpha*y*x' + A,+  *+  *  where alpha is a scalar, x and y are n element vectors and A is an+  *  n by n symmetric matrix, supplied in packed form.+  */+int EIGEN_BLAS_FUNC(spr2)(char *uplo, int *n, RealScalar *palpha, RealScalar *px, int *incx, RealScalar *py, int *incy, RealScalar *pap)+{+  typedef void (*functype)(int, Scalar*, const Scalar*, const Scalar*, Scalar);+  static const functype func[2] = {+    // array index: UP+    (internal::packed_rank2_update_selector<Scalar,int,Upper>::run),+    // array index: LO+    (internal::packed_rank2_update_selector<Scalar,int,Lower>::run),+  };++  Scalar* x = reinterpret_cast<Scalar*>(px);+  Scalar* y = reinterpret_cast<Scalar*>(py);+  Scalar* ap = reinterpret_cast<Scalar*>(pap);+  Scalar alpha = *reinterpret_cast<Scalar*>(palpha);++  int info = 0;+  if(UPLO(*uplo)==INVALID)                                            info = 1;+  else if(*n<0)                                                       info = 2;+  else if(*incx==0)                                                   info = 5;+  else if(*incy==0)                                                   info = 7;+  if(info)+    return xerbla_(SCALAR_SUFFIX_UP"SPR2 ",&info,6);++  if(alpha==Scalar(0))+    return 1;++  Scalar* x_cpy = get_compact_vector(x, *n, *incx);+  Scalar* y_cpy = get_compact_vector(y, *n, *incy);++  int code = UPLO(*uplo);+  if(code>=2 || func[code]==0)+    return 0;++  func[code](*n, ap, x_cpy, y_cpy, alpha);++  if(x_cpy!=x)  delete[] x_cpy;+  if(y_cpy!=y)  delete[] y_cpy;++  return 1;+}++/**  DGER   performs the rank 1 operation+  *+  *     A := alpha*x*y' + A,+  *+  *  where alpha is a scalar, x is an m element vector, y is an n element+  *  vector and A is an m by n matrix.+  */+int EIGEN_BLAS_FUNC(ger)(int *m, int *n, Scalar *palpha, Scalar *px, int *incx, Scalar *py, int *incy, Scalar *pa, int *lda)+{+  Scalar* x = reinterpret_cast<Scalar*>(px);+  Scalar* y = reinterpret_cast<Scalar*>(py);+  Scalar* a = reinterpret_cast<Scalar*>(pa);+  Scalar alpha = *reinterpret_cast<Scalar*>(palpha);++  int info = 0;+       if(*m<0)                                                       info = 1;+  else if(*n<0)                                                       info = 2;+  else if(*incx==0)                                                   info = 5;+  else if(*incy==0)                                                   info = 7;+  else if(*lda<std::max(1,*m))                                        info = 9;+  if(info)+    return xerbla_(SCALAR_SUFFIX_UP"GER  ",&info,6);++  if(alpha==Scalar(0))+    return 1;++  Scalar* x_cpy = get_compact_vector(x,*m,*incx);+  Scalar* y_cpy = get_compact_vector(y,*n,*incy);++  internal::general_rank1_update<Scalar,int,ColMajor,false,false>::run(*m, *n, a, *lda, x_cpy, y_cpy, alpha);++  if(x_cpy!=x)  delete[] x_cpy;+  if(y_cpy!=y)  delete[] y_cpy;++  return 1;+}
+ eigen3/blas/level3_impl.h view
@@ -0,0 +1,702 @@+// This file is part of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2009-2010 Gael Guennebaud <gael.guennebaud@inria.fr>+//+// 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 <iostream>+#include "common.h"++int EIGEN_BLAS_FUNC(gemm)(const char *opa, const char *opb, const int *m, const int *n, const int *k, const RealScalar *palpha,+                          const RealScalar *pa, const int *lda, const RealScalar *pb, const int *ldb, const RealScalar *pbeta, RealScalar *pc, const int *ldc)+{+//   std::cerr << "in gemm " << *opa << " " << *opb << " " << *m << " " << *n << " " << *k << " " << *lda << " " << *ldb << " " << *ldc << " " << *palpha << " " << *pbeta << "\n";+  typedef void (*functype)(DenseIndex, DenseIndex, DenseIndex, const Scalar *, DenseIndex, const Scalar *, DenseIndex, Scalar *, DenseIndex, Scalar, internal::level3_blocking<Scalar,Scalar>&, Eigen::internal::GemmParallelInfo<DenseIndex>*);+  static const functype func[12] = {+    // array index: NOTR  | (NOTR << 2)+    (internal::general_matrix_matrix_product<DenseIndex,Scalar,ColMajor,false,Scalar,ColMajor,false,ColMajor>::run),+    // array index: TR    | (NOTR << 2)+    (internal::general_matrix_matrix_product<DenseIndex,Scalar,RowMajor,false,Scalar,ColMajor,false,ColMajor>::run),+    // array index: ADJ   | (NOTR << 2)+    (internal::general_matrix_matrix_product<DenseIndex,Scalar,RowMajor,Conj, Scalar,ColMajor,false,ColMajor>::run),+    0,+    // array index: NOTR  | (TR   << 2)+    (internal::general_matrix_matrix_product<DenseIndex,Scalar,ColMajor,false,Scalar,RowMajor,false,ColMajor>::run),+    // array index: TR    | (TR   << 2)+    (internal::general_matrix_matrix_product<DenseIndex,Scalar,RowMajor,false,Scalar,RowMajor,false,ColMajor>::run),+    // array index: ADJ   | (TR   << 2)+    (internal::general_matrix_matrix_product<DenseIndex,Scalar,RowMajor,Conj, Scalar,RowMajor,false,ColMajor>::run),+    0,+    // array index: NOTR  | (ADJ  << 2)+    (internal::general_matrix_matrix_product<DenseIndex,Scalar,ColMajor,false,Scalar,RowMajor,Conj, ColMajor>::run),+    // array index: TR    | (ADJ  << 2)+    (internal::general_matrix_matrix_product<DenseIndex,Scalar,RowMajor,false,Scalar,RowMajor,Conj, ColMajor>::run),+    // array index: ADJ   | (ADJ  << 2)+    (internal::general_matrix_matrix_product<DenseIndex,Scalar,RowMajor,Conj, Scalar,RowMajor,Conj, ColMajor>::run),+    0+  };++  const Scalar* a = reinterpret_cast<const Scalar*>(pa);+  const Scalar* b = reinterpret_cast<const Scalar*>(pb);+  Scalar* c = reinterpret_cast<Scalar*>(pc);+  Scalar alpha  = *reinterpret_cast<const Scalar*>(palpha);+  Scalar beta   = *reinterpret_cast<const Scalar*>(pbeta);++  int info = 0;+  if(OP(*opa)==INVALID)                                               info = 1;+  else if(OP(*opb)==INVALID)                                          info = 2;+  else if(*m<0)                                                       info = 3;+  else if(*n<0)                                                       info = 4;+  else if(*k<0)                                                       info = 5;+  else if(*lda<std::max(1,(OP(*opa)==NOTR)?*m:*k))                    info = 8;+  else if(*ldb<std::max(1,(OP(*opb)==NOTR)?*k:*n))                    info = 10;+  else if(*ldc<std::max(1,*m))                                        info = 13;+  if(info)+    return xerbla_(SCALAR_SUFFIX_UP"GEMM ",&info,6);++  if (*m == 0 || *n == 0)+    return 0;++  if(beta!=Scalar(1))+  {+    if(beta==Scalar(0)) matrix(c, *m, *n, *ldc).setZero();+    else                matrix(c, *m, *n, *ldc) *= beta;+  }++  if(*k == 0)+    return 0;++  internal::gemm_blocking_space<ColMajor,Scalar,Scalar,Dynamic,Dynamic,Dynamic> blocking(*m,*n,*k,1,true);++  int code = OP(*opa) | (OP(*opb) << 2);+  func[code](*m, *n, *k, a, *lda, b, *ldb, c, *ldc, alpha, blocking, 0);+  return 0;+}++int EIGEN_BLAS_FUNC(trsm)(const char *side, const char *uplo, const char *opa, const char *diag, const int *m, const int *n,+                          const RealScalar *palpha,  const RealScalar *pa, const int *lda, RealScalar *pb, const int *ldb)+{+//   std::cerr << "in trsm " << *side << " " << *uplo << " " << *opa << " " << *diag << " " << *m << "," << *n << " " << *palpha << " " << *lda << " " << *ldb<< "\n";+  typedef void (*functype)(DenseIndex, DenseIndex, const Scalar *, DenseIndex, Scalar *, DenseIndex, internal::level3_blocking<Scalar,Scalar>&);+  static const functype func[32] = {+    // array index: NOTR  | (LEFT  << 2) | (UP << 3) | (NUNIT << 4)+    (internal::triangular_solve_matrix<Scalar,DenseIndex,OnTheLeft, Upper|0,          false,ColMajor,ColMajor>::run),+    // array index: TR    | (LEFT  << 2) | (UP << 3) | (NUNIT << 4)+    (internal::triangular_solve_matrix<Scalar,DenseIndex,OnTheLeft, Lower|0,          false,RowMajor,ColMajor>::run),+    // array index: ADJ   | (LEFT  << 2) | (UP << 3) | (NUNIT << 4)+    (internal::triangular_solve_matrix<Scalar,DenseIndex,OnTheLeft, Lower|0,          Conj, RowMajor,ColMajor>::run),\+    0,+    // array index: NOTR  | (RIGHT << 2) | (UP << 3) | (NUNIT << 4)+    (internal::triangular_solve_matrix<Scalar,DenseIndex,OnTheRight,Upper|0,          false,ColMajor,ColMajor>::run),+    // array index: TR    | (RIGHT << 2) | (UP << 3) | (NUNIT << 4)+    (internal::triangular_solve_matrix<Scalar,DenseIndex,OnTheRight,Lower|0,          false,RowMajor,ColMajor>::run),+    // array index: ADJ   | (RIGHT << 2) | (UP << 3) | (NUNIT << 4)+    (internal::triangular_solve_matrix<Scalar,DenseIndex,OnTheRight,Lower|0,          Conj, RowMajor,ColMajor>::run),+    0,+    // array index: NOTR  | (LEFT  << 2) | (LO << 3) | (NUNIT << 4)+    (internal::triangular_solve_matrix<Scalar,DenseIndex,OnTheLeft, Lower|0,          false,ColMajor,ColMajor>::run),+    // array index: TR    | (LEFT  << 2) | (LO << 3) | (NUNIT << 4)+    (internal::triangular_solve_matrix<Scalar,DenseIndex,OnTheLeft, Upper|0,          false,RowMajor,ColMajor>::run),+    // array index: ADJ   | (LEFT  << 2) | (LO << 3) | (NUNIT << 4)+    (internal::triangular_solve_matrix<Scalar,DenseIndex,OnTheLeft, Upper|0,          Conj, RowMajor,ColMajor>::run),+    0,+    // array index: NOTR  | (RIGHT << 2) | (LO << 3) | (NUNIT << 4)+    (internal::triangular_solve_matrix<Scalar,DenseIndex,OnTheRight,Lower|0,          false,ColMajor,ColMajor>::run),+    // array index: TR    | (RIGHT << 2) | (LO << 3) | (NUNIT << 4)+    (internal::triangular_solve_matrix<Scalar,DenseIndex,OnTheRight,Upper|0,          false,RowMajor,ColMajor>::run),+    // array index: ADJ   | (RIGHT << 2) | (LO << 3) | (NUNIT << 4)+    (internal::triangular_solve_matrix<Scalar,DenseIndex,OnTheRight,Upper|0,          Conj, RowMajor,ColMajor>::run),+    0,+    // array index: NOTR  | (LEFT  << 2) | (UP << 3) | (UNIT  << 4)+    (internal::triangular_solve_matrix<Scalar,DenseIndex,OnTheLeft, Upper|UnitDiag,false,ColMajor,ColMajor>::run),+    // array index: TR    | (LEFT  << 2) | (UP << 3) | (UNIT  << 4)+    (internal::triangular_solve_matrix<Scalar,DenseIndex,OnTheLeft, Lower|UnitDiag,false,RowMajor,ColMajor>::run),+    // array index: ADJ   | (LEFT  << 2) | (UP << 3) | (UNIT  << 4)+    (internal::triangular_solve_matrix<Scalar,DenseIndex,OnTheLeft, Lower|UnitDiag,Conj, RowMajor,ColMajor>::run),+    0,+    // array index: NOTR  | (RIGHT << 2) | (UP << 3) | (UNIT  << 4)+    (internal::triangular_solve_matrix<Scalar,DenseIndex,OnTheRight,Upper|UnitDiag,false,ColMajor,ColMajor>::run),+    // array index: TR    | (RIGHT << 2) | (UP << 3) | (UNIT  << 4)+    (internal::triangular_solve_matrix<Scalar,DenseIndex,OnTheRight,Lower|UnitDiag,false,RowMajor,ColMajor>::run),+    // array index: ADJ   | (RIGHT << 2) | (UP << 3) | (UNIT  << 4)+    (internal::triangular_solve_matrix<Scalar,DenseIndex,OnTheRight,Lower|UnitDiag,Conj, RowMajor,ColMajor>::run),+    0,+    // array index: NOTR  | (LEFT  << 2) | (LO << 3) | (UNIT  << 4)+    (internal::triangular_solve_matrix<Scalar,DenseIndex,OnTheLeft, Lower|UnitDiag,false,ColMajor,ColMajor>::run),+    // array index: TR    | (LEFT  << 2) | (LO << 3) | (UNIT  << 4)+    (internal::triangular_solve_matrix<Scalar,DenseIndex,OnTheLeft, Upper|UnitDiag,false,RowMajor,ColMajor>::run),+    // array index: ADJ   | (LEFT  << 2) | (LO << 3) | (UNIT  << 4)+    (internal::triangular_solve_matrix<Scalar,DenseIndex,OnTheLeft, Upper|UnitDiag,Conj, RowMajor,ColMajor>::run),+    0,+    // array index: NOTR  | (RIGHT << 2) | (LO << 3) | (UNIT  << 4)+    (internal::triangular_solve_matrix<Scalar,DenseIndex,OnTheRight,Lower|UnitDiag,false,ColMajor,ColMajor>::run),+    // array index: TR    | (RIGHT << 2) | (LO << 3) | (UNIT  << 4)+    (internal::triangular_solve_matrix<Scalar,DenseIndex,OnTheRight,Upper|UnitDiag,false,RowMajor,ColMajor>::run),+    // array index: ADJ   | (RIGHT << 2) | (LO << 3) | (UNIT  << 4)+    (internal::triangular_solve_matrix<Scalar,DenseIndex,OnTheRight,Upper|UnitDiag,Conj, RowMajor,ColMajor>::run),+    0+  };++  const Scalar* a = reinterpret_cast<const Scalar*>(pa);+  Scalar* b = reinterpret_cast<Scalar*>(pb);+  Scalar  alpha = *reinterpret_cast<const Scalar*>(palpha);++  int info = 0;+  if(SIDE(*side)==INVALID)                                            info = 1;+  else if(UPLO(*uplo)==INVALID)                                       info = 2;+  else if(OP(*opa)==INVALID)                                          info = 3;+  else if(DIAG(*diag)==INVALID)                                       info = 4;+  else if(*m<0)                                                       info = 5;+  else if(*n<0)                                                       info = 6;+  else if(*lda<std::max(1,(SIDE(*side)==LEFT)?*m:*n))                 info = 9;+  else if(*ldb<std::max(1,*m))                                        info = 11;+  if(info)+    return xerbla_(SCALAR_SUFFIX_UP"TRSM ",&info,6);++  if(*m==0 || *n==0)+    return 0;++  int code = OP(*opa) | (SIDE(*side) << 2) | (UPLO(*uplo) << 3) | (DIAG(*diag) << 4);++  if(SIDE(*side)==LEFT)+  {+    internal::gemm_blocking_space<ColMajor,Scalar,Scalar,Dynamic,Dynamic,Dynamic,4> blocking(*m,*n,*m,1,false);+    func[code](*m, *n, a, *lda, b, *ldb, blocking);+  }+  else+  {+    internal::gemm_blocking_space<ColMajor,Scalar,Scalar,Dynamic,Dynamic,Dynamic,4> blocking(*m,*n,*n,1,false);+    func[code](*n, *m, a, *lda, b, *ldb, blocking);+  }++  if(alpha!=Scalar(1))+    matrix(b,*m,*n,*ldb) *= alpha;++  return 0;+}+++// b = alpha*op(a)*b  for side = 'L'or'l'+// b = alpha*b*op(a)  for side = 'R'or'r'+int EIGEN_BLAS_FUNC(trmm)(const char *side, const char *uplo, const char *opa, const char *diag, const int *m, const int *n,+                          const RealScalar *palpha, const RealScalar *pa, const int *lda, RealScalar *pb, const int *ldb)+{+//   std::cerr << "in trmm " << *side << " " << *uplo << " " << *opa << " " << *diag << " " << *m << " " << *n << " " << *lda << " " << *ldb << " " << *palpha << "\n";+  typedef void (*functype)(DenseIndex, DenseIndex, DenseIndex, const Scalar *, DenseIndex, const Scalar *, DenseIndex, Scalar *, DenseIndex, const Scalar&, internal::level3_blocking<Scalar,Scalar>&);+  static const functype func[32] = {+    // array index: NOTR  | (LEFT  << 2) | (UP << 3) | (NUNIT << 4)+    (internal::product_triangular_matrix_matrix<Scalar,DenseIndex,Upper|0,          true, ColMajor,false,ColMajor,false,ColMajor>::run),+    // array index: TR    | (LEFT  << 2) | (UP << 3) | (NUNIT << 4)+    (internal::product_triangular_matrix_matrix<Scalar,DenseIndex,Lower|0,          true, RowMajor,false,ColMajor,false,ColMajor>::run),+    // array index: ADJ   | (LEFT  << 2) | (UP << 3) | (NUNIT << 4)+    (internal::product_triangular_matrix_matrix<Scalar,DenseIndex,Lower|0,          true, RowMajor,Conj, ColMajor,false,ColMajor>::run),+    0,+    // array index: NOTR  | (RIGHT << 2) | (UP << 3) | (NUNIT << 4)+    (internal::product_triangular_matrix_matrix<Scalar,DenseIndex,Upper|0,          false,ColMajor,false,ColMajor,false,ColMajor>::run),+    // array index: TR    | (RIGHT << 2) | (UP << 3) | (NUNIT << 4)+    (internal::product_triangular_matrix_matrix<Scalar,DenseIndex,Lower|0,          false,ColMajor,false,RowMajor,false,ColMajor>::run),+    // array index: ADJ   | (RIGHT << 2) | (UP << 3) | (NUNIT << 4)+    (internal::product_triangular_matrix_matrix<Scalar,DenseIndex,Lower|0,          false,ColMajor,false,RowMajor,Conj, ColMajor>::run),+    0,+    // array index: NOTR  | (LEFT  << 2) | (LO << 3) | (NUNIT << 4)+    (internal::product_triangular_matrix_matrix<Scalar,DenseIndex,Lower|0,          true, ColMajor,false,ColMajor,false,ColMajor>::run),+    // array index: TR    | (LEFT  << 2) | (LO << 3) | (NUNIT << 4)+    (internal::product_triangular_matrix_matrix<Scalar,DenseIndex,Upper|0,          true, RowMajor,false,ColMajor,false,ColMajor>::run),+    // array index: ADJ   | (LEFT  << 2) | (LO << 3) | (NUNIT << 4)+    (internal::product_triangular_matrix_matrix<Scalar,DenseIndex,Upper|0,          true, RowMajor,Conj, ColMajor,false,ColMajor>::run),+    0,+    // array index: NOTR  | (RIGHT << 2) | (LO << 3) | (NUNIT << 4)+    (internal::product_triangular_matrix_matrix<Scalar,DenseIndex,Lower|0,          false,ColMajor,false,ColMajor,false,ColMajor>::run),+    // array index: TR    | (RIGHT << 2) | (LO << 3) | (NUNIT << 4)+    (internal::product_triangular_matrix_matrix<Scalar,DenseIndex,Upper|0,          false,ColMajor,false,RowMajor,false,ColMajor>::run),+    // array index: ADJ   | (RIGHT << 2) | (LO << 3) | (NUNIT << 4)+    (internal::product_triangular_matrix_matrix<Scalar,DenseIndex,Upper|0,          false,ColMajor,false,RowMajor,Conj, ColMajor>::run),+    0,+    // array index: NOTR  | (LEFT  << 2) | (UP << 3) | (UNIT  << 4)+    (internal::product_triangular_matrix_matrix<Scalar,DenseIndex,Upper|UnitDiag,true, ColMajor,false,ColMajor,false,ColMajor>::run),+    // array index: TR    | (LEFT  << 2) | (UP << 3) | (UNIT  << 4)+    (internal::product_triangular_matrix_matrix<Scalar,DenseIndex,Lower|UnitDiag,true, RowMajor,false,ColMajor,false,ColMajor>::run),+    // array index: ADJ   | (LEFT  << 2) | (UP << 3) | (UNIT  << 4)+    (internal::product_triangular_matrix_matrix<Scalar,DenseIndex,Lower|UnitDiag,true, RowMajor,Conj, ColMajor,false,ColMajor>::run),+    0,+    // array index: NOTR  | (RIGHT << 2) | (UP << 3) | (UNIT  << 4)+    (internal::product_triangular_matrix_matrix<Scalar,DenseIndex,Upper|UnitDiag,false,ColMajor,false,ColMajor,false,ColMajor>::run),+    // array index: TR    | (RIGHT << 2) | (UP << 3) | (UNIT  << 4)+    (internal::product_triangular_matrix_matrix<Scalar,DenseIndex,Lower|UnitDiag,false,ColMajor,false,RowMajor,false,ColMajor>::run),+    // array index: ADJ   | (RIGHT << 2) | (UP << 3) | (UNIT  << 4)+    (internal::product_triangular_matrix_matrix<Scalar,DenseIndex,Lower|UnitDiag,false,ColMajor,false,RowMajor,Conj, ColMajor>::run),+    0,+    // array index: NOTR  | (LEFT  << 2) | (LO << 3) | (UNIT  << 4)+    (internal::product_triangular_matrix_matrix<Scalar,DenseIndex,Lower|UnitDiag,true, ColMajor,false,ColMajor,false,ColMajor>::run),+    // array index: TR    | (LEFT  << 2) | (LO << 3) | (UNIT  << 4)+    (internal::product_triangular_matrix_matrix<Scalar,DenseIndex,Upper|UnitDiag,true, RowMajor,false,ColMajor,false,ColMajor>::run),+    // array index: ADJ   | (LEFT  << 2) | (LO << 3) | (UNIT  << 4)+    (internal::product_triangular_matrix_matrix<Scalar,DenseIndex,Upper|UnitDiag,true, RowMajor,Conj, ColMajor,false,ColMajor>::run),+    0,+    // array index: NOTR  | (RIGHT << 2) | (LO << 3) | (UNIT  << 4)+    (internal::product_triangular_matrix_matrix<Scalar,DenseIndex,Lower|UnitDiag,false,ColMajor,false,ColMajor,false,ColMajor>::run),+    // array index: TR    | (RIGHT << 2) | (LO << 3) | (UNIT  << 4)+    (internal::product_triangular_matrix_matrix<Scalar,DenseIndex,Upper|UnitDiag,false,ColMajor,false,RowMajor,false,ColMajor>::run),+    // array index: ADJ   | (RIGHT << 2) | (LO << 3) | (UNIT  << 4)+    (internal::product_triangular_matrix_matrix<Scalar,DenseIndex,Upper|UnitDiag,false,ColMajor,false,RowMajor,Conj, ColMajor>::run),+    0+  };++  const Scalar* a = reinterpret_cast<const Scalar*>(pa);+  Scalar* b = reinterpret_cast<Scalar*>(pb);+  Scalar  alpha = *reinterpret_cast<const Scalar*>(palpha);++  int info = 0;+  if(SIDE(*side)==INVALID)                                            info = 1;+  else if(UPLO(*uplo)==INVALID)                                       info = 2;+  else if(OP(*opa)==INVALID)                                          info = 3;+  else if(DIAG(*diag)==INVALID)                                       info = 4;+  else if(*m<0)                                                       info = 5;+  else if(*n<0)                                                       info = 6;+  else if(*lda<std::max(1,(SIDE(*side)==LEFT)?*m:*n))                 info = 9;+  else if(*ldb<std::max(1,*m))                                        info = 11;+  if(info)+    return xerbla_(SCALAR_SUFFIX_UP"TRMM ",&info,6);++  int code = OP(*opa) | (SIDE(*side) << 2) | (UPLO(*uplo) << 3) | (DIAG(*diag) << 4);++  if(*m==0 || *n==0)+    return 1;++  // FIXME find a way to avoid this copy+  Matrix<Scalar,Dynamic,Dynamic,ColMajor> tmp = matrix(b,*m,*n,*ldb);+  matrix(b,*m,*n,*ldb).setZero();++  if(SIDE(*side)==LEFT)+  {+    internal::gemm_blocking_space<ColMajor,Scalar,Scalar,Dynamic,Dynamic,Dynamic,4> blocking(*m,*n,*m,1,false);+    func[code](*m, *n, *m, a, *lda, tmp.data(), tmp.outerStride(), b, *ldb, alpha, blocking);+  }+  else+  {+    internal::gemm_blocking_space<ColMajor,Scalar,Scalar,Dynamic,Dynamic,Dynamic,4> blocking(*m,*n,*n,1,false);+    func[code](*m, *n, *n, tmp.data(), tmp.outerStride(), a, *lda, b, *ldb, alpha, blocking);+  }+  return 1;+}++// c = alpha*a*b + beta*c  for side = 'L'or'l'+// c = alpha*b*a + beta*c  for side = 'R'or'r+int EIGEN_BLAS_FUNC(symm)(const char *side, const char *uplo, const int *m, const int *n, const RealScalar *palpha,+                          const RealScalar *pa, const int *lda, const RealScalar *pb, const int *ldb, const RealScalar *pbeta, RealScalar *pc, const int *ldc)+{+//   std::cerr << "in symm " << *side << " " << *uplo << " " << *m << "x" << *n << " lda:" << *lda << " ldb:" << *ldb << " ldc:" << *ldc << " alpha:" << *palpha << " beta:" << *pbeta << "\n";+  const Scalar* a = reinterpret_cast<const Scalar*>(pa);+  const Scalar* b = reinterpret_cast<const Scalar*>(pb);+  Scalar* c = reinterpret_cast<Scalar*>(pc);+  Scalar alpha = *reinterpret_cast<const Scalar*>(palpha);+  Scalar beta  = *reinterpret_cast<const Scalar*>(pbeta);++  int info = 0;+  if(SIDE(*side)==INVALID)                                            info = 1;+  else if(UPLO(*uplo)==INVALID)                                       info = 2;+  else if(*m<0)                                                       info = 3;+  else if(*n<0)                                                       info = 4;+  else if(*lda<std::max(1,(SIDE(*side)==LEFT)?*m:*n))                 info = 7;+  else if(*ldb<std::max(1,*m))                                        info = 9;+  else if(*ldc<std::max(1,*m))                                        info = 12;+  if(info)+    return xerbla_(SCALAR_SUFFIX_UP"SYMM ",&info,6);++  if(beta!=Scalar(1))+  {+    if(beta==Scalar(0)) matrix(c, *m, *n, *ldc).setZero();+    else                matrix(c, *m, *n, *ldc) *= beta;+  }++  if(*m==0 || *n==0)+  {+    return 1;+  }++  int size = (SIDE(*side)==LEFT) ? (*m) : (*n);+  #if ISCOMPLEX+  // FIXME add support for symmetric complex matrix+  Matrix<Scalar,Dynamic,Dynamic,ColMajor> matA(size,size);+  if(UPLO(*uplo)==UP)+  {+    matA.triangularView<Upper>() = matrix(a,size,size,*lda);+    matA.triangularView<Lower>() = matrix(a,size,size,*lda).transpose();+  }+  else if(UPLO(*uplo)==LO)+  {+    matA.triangularView<Lower>() = matrix(a,size,size,*lda);+    matA.triangularView<Upper>() = matrix(a,size,size,*lda).transpose();+  }+  if(SIDE(*side)==LEFT)+    matrix(c, *m, *n, *ldc) += alpha * matA * matrix(b, *m, *n, *ldb);+  else if(SIDE(*side)==RIGHT)+    matrix(c, *m, *n, *ldc) += alpha * matrix(b, *m, *n, *ldb) * matA;+  #else+  internal::gemm_blocking_space<ColMajor,Scalar,Scalar,Dynamic,Dynamic,Dynamic> blocking(*m,*n,size,1,false);++  if(SIDE(*side)==LEFT)+    if(UPLO(*uplo)==UP)       internal::product_selfadjoint_matrix<Scalar, DenseIndex, RowMajor,true,false, ColMajor,false,false, ColMajor>::run(*m, *n, a, *lda, b, *ldb, c, *ldc, alpha, blocking);+    else if(UPLO(*uplo)==LO)  internal::product_selfadjoint_matrix<Scalar, DenseIndex, ColMajor,true,false, ColMajor,false,false, ColMajor>::run(*m, *n, a, *lda, b, *ldb, c, *ldc, alpha, blocking);+    else                      return 0;+  else if(SIDE(*side)==RIGHT)+    if(UPLO(*uplo)==UP)       internal::product_selfadjoint_matrix<Scalar, DenseIndex, ColMajor,false,false, RowMajor,true,false, ColMajor>::run(*m, *n, b, *ldb, a, *lda, c, *ldc, alpha, blocking);+    else if(UPLO(*uplo)==LO)  internal::product_selfadjoint_matrix<Scalar, DenseIndex, ColMajor,false,false, ColMajor,true,false, ColMajor>::run(*m, *n, b, *ldb, a, *lda, c, *ldc, alpha, blocking);+    else                      return 0;+  else+    return 0;+  #endif++  return 0;+}++// c = alpha*a*a' + beta*c  for op = 'N'or'n'+// c = alpha*a'*a + beta*c  for op = 'T'or't','C'or'c'+int EIGEN_BLAS_FUNC(syrk)(const char *uplo, const char *op, const int *n, const int *k,+                          const RealScalar *palpha, const RealScalar *pa, const int *lda, const RealScalar *pbeta, RealScalar *pc, const int *ldc)+{+//   std::cerr << "in syrk " << *uplo << " " << *op << " " << *n << " " << *k << " " << *palpha << " " << *lda << " " << *pbeta << " " << *ldc << "\n";+  #if !ISCOMPLEX+  typedef void (*functype)(DenseIndex, DenseIndex, const Scalar *, DenseIndex, const Scalar *, DenseIndex, Scalar *, DenseIndex, const Scalar&, internal::level3_blocking<Scalar,Scalar>&);+  static const functype func[8] = {+    // array index: NOTR  | (UP << 2)+    (internal::general_matrix_matrix_triangular_product<DenseIndex,Scalar,ColMajor,false,Scalar,RowMajor,ColMajor,Conj, Upper>::run),+    // array index: TR    | (UP << 2)+    (internal::general_matrix_matrix_triangular_product<DenseIndex,Scalar,RowMajor,false,Scalar,ColMajor,ColMajor,Conj, Upper>::run),+    // array index: ADJ   | (UP << 2)+    (internal::general_matrix_matrix_triangular_product<DenseIndex,Scalar,RowMajor,Conj, Scalar,ColMajor,ColMajor,false,Upper>::run),+    0,+    // array index: NOTR  | (LO << 2)+    (internal::general_matrix_matrix_triangular_product<DenseIndex,Scalar,ColMajor,false,Scalar,RowMajor,ColMajor,Conj, Lower>::run),+    // array index: TR    | (LO << 2)+    (internal::general_matrix_matrix_triangular_product<DenseIndex,Scalar,RowMajor,false,Scalar,ColMajor,ColMajor,Conj, Lower>::run),+    // array index: ADJ   | (LO << 2)+    (internal::general_matrix_matrix_triangular_product<DenseIndex,Scalar,RowMajor,Conj, Scalar,ColMajor,ColMajor,false,Lower>::run),+    0+  };+  #endif++  const Scalar* a = reinterpret_cast<const Scalar*>(pa);+  Scalar* c = reinterpret_cast<Scalar*>(pc);+  Scalar alpha = *reinterpret_cast<const Scalar*>(palpha);+  Scalar beta  = *reinterpret_cast<const Scalar*>(pbeta);++  int info = 0;+  if(UPLO(*uplo)==INVALID)                                            info = 1;+  else if(OP(*op)==INVALID || (ISCOMPLEX && OP(*op)==ADJ) )           info = 2;+  else if(*n<0)                                                       info = 3;+  else if(*k<0)                                                       info = 4;+  else if(*lda<std::max(1,(OP(*op)==NOTR)?*n:*k))                     info = 7;+  else if(*ldc<std::max(1,*n))                                        info = 10;+  if(info)+    return xerbla_(SCALAR_SUFFIX_UP"SYRK ",&info,6);++  if(beta!=Scalar(1))+  {+    if(UPLO(*uplo)==UP)+      if(beta==Scalar(0)) matrix(c, *n, *n, *ldc).triangularView<Upper>().setZero();+      else                matrix(c, *n, *n, *ldc).triangularView<Upper>() *= beta;+    else+      if(beta==Scalar(0)) matrix(c, *n, *n, *ldc).triangularView<Lower>().setZero();+      else                matrix(c, *n, *n, *ldc).triangularView<Lower>() *= beta;+  }++  if(*n==0 || *k==0)+    return 0;++  #if ISCOMPLEX+  // FIXME add support for symmetric complex matrix+  if(UPLO(*uplo)==UP)+  {+    if(OP(*op)==NOTR)+      matrix(c, *n, *n, *ldc).triangularView<Upper>() += alpha * matrix(a,*n,*k,*lda) * matrix(a,*n,*k,*lda).transpose();+    else+      matrix(c, *n, *n, *ldc).triangularView<Upper>() += alpha * matrix(a,*k,*n,*lda).transpose() * matrix(a,*k,*n,*lda);+  }+  else+  {+    if(OP(*op)==NOTR)+      matrix(c, *n, *n, *ldc).triangularView<Lower>() += alpha * matrix(a,*n,*k,*lda) * matrix(a,*n,*k,*lda).transpose();+    else+      matrix(c, *n, *n, *ldc).triangularView<Lower>() += alpha * matrix(a,*k,*n,*lda).transpose() * matrix(a,*k,*n,*lda);+  }+  #else+  internal::gemm_blocking_space<ColMajor,Scalar,Scalar,Dynamic,Dynamic,Dynamic> blocking(*n,*n,*k,1,false);++  int code = OP(*op) | (UPLO(*uplo) << 2);+  func[code](*n, *k, a, *lda, a, *lda, c, *ldc, alpha, blocking);+  #endif++  return 0;+}++// c = alpha*a*b' + alpha*b*a' + beta*c  for op = 'N'or'n'+// c = alpha*a'*b + alpha*b'*a + beta*c  for op = 'T'or't'+int EIGEN_BLAS_FUNC(syr2k)(const char *uplo, const char *op, const int *n, const int *k, const RealScalar *palpha,+                           const RealScalar *pa, const int *lda, const RealScalar *pb, const int *ldb, const RealScalar *pbeta, RealScalar *pc, const int *ldc)+{+  const Scalar* a = reinterpret_cast<const Scalar*>(pa);+  const Scalar* b = reinterpret_cast<const Scalar*>(pb);+  Scalar* c = reinterpret_cast<Scalar*>(pc);+  Scalar alpha = *reinterpret_cast<const Scalar*>(palpha);+  Scalar beta  = *reinterpret_cast<const Scalar*>(pbeta);++//   std::cerr << "in syr2k " << *uplo << " " << *op << " " << *n << " " << *k << " " << alpha << " " << *lda << " " << *ldb << " " << beta << " " << *ldc << "\n";++  int info = 0;+  if(UPLO(*uplo)==INVALID)                                            info = 1;+  else if(OP(*op)==INVALID || (ISCOMPLEX && OP(*op)==ADJ) )           info = 2;+  else if(*n<0)                                                       info = 3;+  else if(*k<0)                                                       info = 4;+  else if(*lda<std::max(1,(OP(*op)==NOTR)?*n:*k))                     info = 7;+  else if(*ldb<std::max(1,(OP(*op)==NOTR)?*n:*k))                     info = 9;+  else if(*ldc<std::max(1,*n))                                        info = 12;+  if(info)+    return xerbla_(SCALAR_SUFFIX_UP"SYR2K",&info,6);++  if(beta!=Scalar(1))+  {+    if(UPLO(*uplo)==UP)+      if(beta==Scalar(0)) matrix(c, *n, *n, *ldc).triangularView<Upper>().setZero();+      else                matrix(c, *n, *n, *ldc).triangularView<Upper>() *= beta;+    else+      if(beta==Scalar(0)) matrix(c, *n, *n, *ldc).triangularView<Lower>().setZero();+      else                matrix(c, *n, *n, *ldc).triangularView<Lower>() *= beta;+  }++  if(*k==0)+    return 1;++  if(OP(*op)==NOTR)+  {+    if(UPLO(*uplo)==UP)+    {+      matrix(c, *n, *n, *ldc).triangularView<Upper>()+        += alpha *matrix(a, *n, *k, *lda)*matrix(b, *n, *k, *ldb).transpose()+        +  alpha*matrix(b, *n, *k, *ldb)*matrix(a, *n, *k, *lda).transpose();+    }+    else if(UPLO(*uplo)==LO)+      matrix(c, *n, *n, *ldc).triangularView<Lower>()+        += alpha*matrix(a, *n, *k, *lda)*matrix(b, *n, *k, *ldb).transpose()+        +  alpha*matrix(b, *n, *k, *ldb)*matrix(a, *n, *k, *lda).transpose();+  }+  else if(OP(*op)==TR || OP(*op)==ADJ)+  {+    if(UPLO(*uplo)==UP)+      matrix(c, *n, *n, *ldc).triangularView<Upper>()+        += alpha*matrix(a, *k, *n, *lda).transpose()*matrix(b, *k, *n, *ldb)+        +  alpha*matrix(b, *k, *n, *ldb).transpose()*matrix(a, *k, *n, *lda);+    else if(UPLO(*uplo)==LO)+      matrix(c, *n, *n, *ldc).triangularView<Lower>()+        += alpha*matrix(a, *k, *n, *lda).transpose()*matrix(b, *k, *n, *ldb)+        +  alpha*matrix(b, *k, *n, *ldb).transpose()*matrix(a, *k, *n, *lda);+  }++  return 0;+}+++#if ISCOMPLEX++// c = alpha*a*b + beta*c  for side = 'L'or'l'+// c = alpha*b*a + beta*c  for side = 'R'or'r+int EIGEN_BLAS_FUNC(hemm)(const char *side, const char *uplo, const int *m, const int *n, const RealScalar *palpha,+                          const RealScalar *pa, const int *lda, const RealScalar *pb, const int *ldb, const RealScalar *pbeta, RealScalar *pc, const int *ldc)+{+  const Scalar* a = reinterpret_cast<const Scalar*>(pa);+  const Scalar* b = reinterpret_cast<const Scalar*>(pb);+  Scalar* c = reinterpret_cast<Scalar*>(pc);+  Scalar alpha = *reinterpret_cast<const Scalar*>(palpha);+  Scalar beta  = *reinterpret_cast<const Scalar*>(pbeta);++//   std::cerr << "in hemm " << *side << " " << *uplo << " " << *m << " " << *n << " " << alpha << " " << *lda << " " << beta << " " << *ldc << "\n";++  int info = 0;+  if(SIDE(*side)==INVALID)                                            info = 1;+  else if(UPLO(*uplo)==INVALID)                                       info = 2;+  else if(*m<0)                                                       info = 3;+  else if(*n<0)                                                       info = 4;+  else if(*lda<std::max(1,(SIDE(*side)==LEFT)?*m:*n))                 info = 7;+  else if(*ldb<std::max(1,*m))                                        info = 9;+  else if(*ldc<std::max(1,*m))                                        info = 12;+  if(info)+    return xerbla_(SCALAR_SUFFIX_UP"HEMM ",&info,6);++  if(beta==Scalar(0))       matrix(c, *m, *n, *ldc).setZero();+  else if(beta!=Scalar(1))  matrix(c, *m, *n, *ldc) *= beta;++  if(*m==0 || *n==0)+  {+    return 1;+  }++  int size = (SIDE(*side)==LEFT) ? (*m) : (*n);+  internal::gemm_blocking_space<ColMajor,Scalar,Scalar,Dynamic,Dynamic,Dynamic> blocking(*m,*n,size,1,false);++  if(SIDE(*side)==LEFT)+  {+    if(UPLO(*uplo)==UP)       internal::product_selfadjoint_matrix<Scalar,DenseIndex,RowMajor,true,Conj,  ColMajor,false,false, ColMajor>+                                ::run(*m, *n, a, *lda, b, *ldb, c, *ldc, alpha, blocking);+    else if(UPLO(*uplo)==LO)  internal::product_selfadjoint_matrix<Scalar,DenseIndex,ColMajor,true,false, ColMajor,false,false, ColMajor>+                                ::run(*m, *n, a, *lda, b, *ldb, c, *ldc, alpha, blocking);+    else                      return 0;+  }+  else if(SIDE(*side)==RIGHT)+  {+    if(UPLO(*uplo)==UP)       matrix(c,*m,*n,*ldc) += alpha * matrix(b,*m,*n,*ldb) * matrix(a,*n,*n,*lda).selfadjointView<Upper>();/*internal::product_selfadjoint_matrix<Scalar,DenseIndex,ColMajor,false,false, RowMajor,true,Conj,  ColMajor>+                                ::run(*m, *n, b, *ldb, a, *lda, c, *ldc, alpha, blocking);*/+    else if(UPLO(*uplo)==LO)  internal::product_selfadjoint_matrix<Scalar,DenseIndex,ColMajor,false,false, ColMajor,true,false, ColMajor>+                                ::run(*m, *n, b, *ldb, a, *lda, c, *ldc, alpha, blocking);+    else                      return 0;+  }+  else+  {+    return 0;+  }++  return 0;+}++// c = alpha*a*conj(a') + beta*c  for op = 'N'or'n'+// c = alpha*conj(a')*a + beta*c  for op  = 'C'or'c'+int EIGEN_BLAS_FUNC(herk)(const char *uplo, const char *op, const int *n, const int *k,+                          const RealScalar *palpha, const RealScalar *pa, const int *lda, const RealScalar *pbeta, RealScalar *pc, const int *ldc)+{+//   std::cerr << "in herk " << *uplo << " " << *op << " " << *n << " " << *k << " " << *palpha << " " << *lda << " " << *pbeta << " " << *ldc << "\n";++  typedef void (*functype)(DenseIndex, DenseIndex, const Scalar *, DenseIndex, const Scalar *, DenseIndex, Scalar *, DenseIndex, const Scalar&, internal::level3_blocking<Scalar,Scalar>&);+  static const functype func[8] = {+    // array index: NOTR  | (UP << 2)+    (internal::general_matrix_matrix_triangular_product<DenseIndex,Scalar,ColMajor,false,Scalar,RowMajor,Conj, ColMajor,Upper>::run),+    0,+    // array index: ADJ   | (UP << 2)+    (internal::general_matrix_matrix_triangular_product<DenseIndex,Scalar,RowMajor,Conj, Scalar,ColMajor,false,ColMajor,Upper>::run),+    0,+    // array index: NOTR  | (LO << 2)+    (internal::general_matrix_matrix_triangular_product<DenseIndex,Scalar,ColMajor,false,Scalar,RowMajor,Conj, ColMajor,Lower>::run),+    0,+    // array index: ADJ   | (LO << 2)+    (internal::general_matrix_matrix_triangular_product<DenseIndex,Scalar,RowMajor,Conj, Scalar,ColMajor,false,ColMajor,Lower>::run),+    0+  };++  const Scalar* a = reinterpret_cast<const Scalar*>(pa);+  Scalar* c = reinterpret_cast<Scalar*>(pc);+  RealScalar alpha = *palpha;+  RealScalar beta  = *pbeta;++//   std::cerr << "in herk " << *uplo << " " << *op << " " << *n << " " << *k << " " << alpha << " " << *lda << " " << beta << " " << *ldc << "\n";++  int info = 0;+  if(UPLO(*uplo)==INVALID)                                            info = 1;+  else if((OP(*op)==INVALID) || (OP(*op)==TR))                        info = 2;+  else if(*n<0)                                                       info = 3;+  else if(*k<0)                                                       info = 4;+  else if(*lda<std::max(1,(OP(*op)==NOTR)?*n:*k))                     info = 7;+  else if(*ldc<std::max(1,*n))                                        info = 10;+  if(info)+    return xerbla_(SCALAR_SUFFIX_UP"HERK ",&info,6);++  int code = OP(*op) | (UPLO(*uplo) << 2);++  if(beta!=RealScalar(1))+  {+    if(UPLO(*uplo)==UP)+      if(beta==Scalar(0)) matrix(c, *n, *n, *ldc).triangularView<Upper>().setZero();+      else                matrix(c, *n, *n, *ldc).triangularView<StrictlyUpper>() *= beta;+    else+      if(beta==Scalar(0)) matrix(c, *n, *n, *ldc).triangularView<Lower>().setZero();+      else                matrix(c, *n, *n, *ldc).triangularView<StrictlyLower>() *= beta;++    if(beta!=Scalar(0))+    {+      matrix(c, *n, *n, *ldc).diagonal().real() *= beta;+      matrix(c, *n, *n, *ldc).diagonal().imag().setZero();+    }+  }++  if(*k>0 && alpha!=RealScalar(0))+  {+    internal::gemm_blocking_space<ColMajor,Scalar,Scalar,Dynamic,Dynamic,Dynamic> blocking(*n,*n,*k,1,false);+    func[code](*n, *k, a, *lda, a, *lda, c, *ldc, alpha, blocking);+    matrix(c, *n, *n, *ldc).diagonal().imag().setZero();+  }+  return 0;+}++// c = alpha*a*conj(b') + conj(alpha)*b*conj(a') + beta*c,  for op = 'N'or'n'+// c = alpha*conj(a')*b + conj(alpha)*conj(b')*a + beta*c,  for op = 'C'or'c'+int EIGEN_BLAS_FUNC(her2k)(const char *uplo, const char *op, const int *n, const int *k,+                           const RealScalar *palpha, const RealScalar *pa, const int *lda, const RealScalar *pb, const int *ldb, const RealScalar *pbeta, RealScalar *pc, const int *ldc)+{+  const Scalar* a = reinterpret_cast<const Scalar*>(pa);+  const Scalar* b = reinterpret_cast<const Scalar*>(pb);+  Scalar* c = reinterpret_cast<Scalar*>(pc);+  Scalar alpha = *reinterpret_cast<const Scalar*>(palpha);+  RealScalar beta  = *pbeta;++//   std::cerr << "in her2k " << *uplo << " " << *op << " " << *n << " " << *k << " " << alpha << " " << *lda << " " << *ldb << " " << beta << " " << *ldc << "\n";++  int info = 0;+  if(UPLO(*uplo)==INVALID)                                            info = 1;+  else if((OP(*op)==INVALID) || (OP(*op)==TR))                        info = 2;+  else if(*n<0)                                                       info = 3;+  else if(*k<0)                                                       info = 4;+  else if(*lda<std::max(1,(OP(*op)==NOTR)?*n:*k))                     info = 7;+  else if(*ldb<std::max(1,(OP(*op)==NOTR)?*n:*k))                     info = 9;+  else if(*ldc<std::max(1,*n))                                        info = 12;+  if(info)+    return xerbla_(SCALAR_SUFFIX_UP"HER2K",&info,6);++  if(beta!=RealScalar(1))+  {+    if(UPLO(*uplo)==UP)+      if(beta==Scalar(0)) matrix(c, *n, *n, *ldc).triangularView<Upper>().setZero();+      else                matrix(c, *n, *n, *ldc).triangularView<StrictlyUpper>() *= beta;+    else+      if(beta==Scalar(0)) matrix(c, *n, *n, *ldc).triangularView<Lower>().setZero();+      else                matrix(c, *n, *n, *ldc).triangularView<StrictlyLower>() *= beta;++    if(beta!=Scalar(0))+    {+      matrix(c, *n, *n, *ldc).diagonal().real() *= beta;+      matrix(c, *n, *n, *ldc).diagonal().imag().setZero();+    }+  }+  else if(*k>0 && alpha!=Scalar(0))+    matrix(c, *n, *n, *ldc).diagonal().imag().setZero();++  if(*k==0)+    return 1;++  if(OP(*op)==NOTR)+  {+    if(UPLO(*uplo)==UP)+    {+      matrix(c, *n, *n, *ldc).triangularView<Upper>()+        +=            alpha *matrix(a, *n, *k, *lda)*matrix(b, *n, *k, *ldb).adjoint()+        +  numext::conj(alpha)*matrix(b, *n, *k, *ldb)*matrix(a, *n, *k, *lda).adjoint();+    }+    else if(UPLO(*uplo)==LO)+      matrix(c, *n, *n, *ldc).triangularView<Lower>()+        += alpha*matrix(a, *n, *k, *lda)*matrix(b, *n, *k, *ldb).adjoint()+        +  numext::conj(alpha)*matrix(b, *n, *k, *ldb)*matrix(a, *n, *k, *lda).adjoint();+  }+  else if(OP(*op)==ADJ)+  {+    if(UPLO(*uplo)==UP)+      matrix(c, *n, *n, *ldc).triangularView<Upper>()+        +=             alpha*matrix(a, *k, *n, *lda).adjoint()*matrix(b, *k, *n, *ldb)+        +  numext::conj(alpha)*matrix(b, *k, *n, *ldb).adjoint()*matrix(a, *k, *n, *lda);+    else if(UPLO(*uplo)==LO)+      matrix(c, *n, *n, *ldc).triangularView<Lower>()+        +=             alpha*matrix(a, *k, *n, *lda).adjoint()*matrix(b, *k, *n, *ldb)+        +  numext::conj(alpha)*matrix(b, *k, *n, *ldb).adjoint()*matrix(a, *k, *n, *lda);+  }++  return 1;+}++#endif // ISCOMPLEX
+ eigen3/blas/single.cpp view
@@ -0,0 +1,22 @@+// This file is part of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2009 Gael Guennebaud <gael.guennebaud@inria.fr>+//+// 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 "level1_impl.h"+#include "level1_real_impl.h"+#include "level2_impl.h"+#include "level2_real_impl.h"+#include "level3_impl.h"++float BLASFUNC(sdsdot)(int* n, float* alpha, float* x, int* incx, float* y, int* incy)+{ return double(*alpha) + BLASFUNC(dsdot)(n, x, incx, y, incy); }
+ eigen3/blas/testing/CMakeLists.txt view
@@ -0,0 +1,40 @@++macro(ei_add_blas_test testname)++  set(targetname ${testname})++  set(filename ${testname}.f)+  add_executable(${targetname} ${filename})++  target_link_libraries(${targetname} eigen_blas)++  if(EIGEN_STANDARD_LIBRARIES_TO_LINK_TO)+    target_link_libraries(${targetname} ${EIGEN_STANDARD_LIBRARIES_TO_LINK_TO})+  endif()++  target_link_libraries(${targetname} ${EXTERNAL_LIBS})++  add_test(${testname} "${Eigen_SOURCE_DIR}/blas/testing/runblastest.sh" "${testname}" "${Eigen_SOURCE_DIR}/blas/testing/${testname}.dat")+  add_dependencies(buildtests ${targetname})+  +endmacro(ei_add_blas_test)++ei_add_blas_test(sblat1)+ei_add_blas_test(sblat2)+ei_add_blas_test(sblat3)++ei_add_blas_test(dblat1)+ei_add_blas_test(dblat2)+ei_add_blas_test(dblat3)++ei_add_blas_test(cblat1)+ei_add_blas_test(cblat2)+ei_add_blas_test(cblat3)++ei_add_blas_test(zblat1)+ei_add_blas_test(zblat2)+ei_add_blas_test(zblat3)++# add_custom_target(level1)+# add_dependencies(level1 sblat1)+
+ eigen3/blas/testing/cblat1.f view
@@ -0,0 +1,724 @@+*> \brief \b CBLAT1+*+*  =========== DOCUMENTATION ===========+*+* Online html documentation available at +*            http://www.netlib.org/lapack/explore-html/ +*+*  Definition:+*  ===========+*+*       PROGRAM CBLAT1+* +*+*> \par Purpose:+*  =============+*>+*> \verbatim+*>+*>    Test program for the COMPLEX Level 1 BLAS.+*>    Based upon the original BLAS test routine together with:+*>+*>    F06GAF Example Program Text+*> \endverbatim+*+*  Authors:+*  ========+*+*> \author Univ. of Tennessee +*> \author Univ. of California Berkeley +*> \author Univ. of Colorado Denver +*> \author NAG Ltd. +*+*> \date April 2012+*+*> \ingroup complex_blas_testing+*+*  =====================================================================+      PROGRAM CBLAT1+*+*  -- Reference BLAS test routine (version 3.4.1) --+*  -- Reference BLAS is a software package provided by Univ. of Tennessee,    --+*  -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--+*     April 2012+*+*  =====================================================================+*+*     .. Parameters ..+      INTEGER          NOUT+      PARAMETER        (NOUT=6)+*     .. Scalars in Common ..+      INTEGER          ICASE, INCX, INCY, MODE, N+      LOGICAL          PASS+*     .. Local Scalars ..+      REAL             SFAC+      INTEGER          IC+*     .. External Subroutines ..+      EXTERNAL         CHECK1, CHECK2, HEADER+*     .. Common blocks ..+      COMMON           /COMBLA/ICASE, N, INCX, INCY, MODE, PASS+*     .. Data statements ..+      DATA             SFAC/9.765625E-4/+*     .. Executable Statements ..+      WRITE (NOUT,99999)+      DO 20 IC = 1, 10+         ICASE = IC+         CALL HEADER+*+*        Initialize PASS, INCX, INCY, and MODE for a new case.+*        The value 9999 for INCX, INCY or MODE will appear in the+*        detailed  output, if any, for cases that do not involve+*        these parameters.+*+         PASS = .TRUE.+         INCX = 9999+         INCY = 9999+         MODE = 9999+         IF (ICASE.LE.5) THEN+            CALL CHECK2(SFAC)+         ELSE IF (ICASE.GE.6) THEN+            CALL CHECK1(SFAC)+         END IF+*        -- Print+         IF (PASS) WRITE (NOUT,99998)+   20 CONTINUE+      STOP+*+99999 FORMAT (' Complex BLAS Test Program Results',/1X)+99998 FORMAT ('                                    ----- PASS -----')+      END+      SUBROUTINE HEADER+*     .. Parameters ..+      INTEGER          NOUT+      PARAMETER        (NOUT=6)+*     .. Scalars in Common ..+      INTEGER          ICASE, INCX, INCY, MODE, N+      LOGICAL          PASS+*     .. Local Arrays ..+      CHARACTER*6      L(10)+*     .. Common blocks ..+      COMMON           /COMBLA/ICASE, N, INCX, INCY, MODE, PASS+*     .. Data statements ..+      DATA             L(1)/'CDOTC '/+      DATA             L(2)/'CDOTU '/+      DATA             L(3)/'CAXPY '/+      DATA             L(4)/'CCOPY '/+      DATA             L(5)/'CSWAP '/+      DATA             L(6)/'SCNRM2'/+      DATA             L(7)/'SCASUM'/+      DATA             L(8)/'CSCAL '/+      DATA             L(9)/'CSSCAL'/+      DATA             L(10)/'ICAMAX'/+*     .. Executable Statements ..+      WRITE (NOUT,99999) ICASE, L(ICASE)+      RETURN+*+99999 FORMAT (/' Test of subprogram number',I3,12X,A6)+      END+      SUBROUTINE CHECK1(SFAC)+*     .. Parameters ..+      INTEGER           NOUT+      PARAMETER         (NOUT=6)+*     .. Scalar Arguments ..+      REAL              SFAC+*     .. Scalars in Common ..+      INTEGER           ICASE, INCX, INCY, MODE, N+      LOGICAL           PASS+*     .. Local Scalars ..+      COMPLEX           CA+      REAL              SA+      INTEGER           I, J, LEN, NP1+*     .. Local Arrays ..+      COMPLEX           CTRUE5(8,5,2), CTRUE6(8,5,2), CV(8,5,2), CX(8),+     +                  MWPCS(5), MWPCT(5)+      REAL              STRUE2(5), STRUE4(5)+      INTEGER           ITRUE3(5)+*     .. External Functions ..+      REAL              SCASUM, SCNRM2+      INTEGER           ICAMAX+      EXTERNAL          SCASUM, SCNRM2, ICAMAX+*     .. External Subroutines ..+      EXTERNAL          CSCAL, CSSCAL, CTEST, ITEST1, STEST1+*     .. Intrinsic Functions ..+      INTRINSIC         MAX+*     .. Common blocks ..+      COMMON            /COMBLA/ICASE, N, INCX, INCY, MODE, PASS+*     .. Data statements ..+      DATA              SA, CA/0.3E0, (0.4E0,-0.7E0)/+      DATA              ((CV(I,J,1),I=1,8),J=1,5)/(0.1E0,0.1E0),+     +                  (1.0E0,2.0E0), (1.0E0,2.0E0), (1.0E0,2.0E0),+     +                  (1.0E0,2.0E0), (1.0E0,2.0E0), (1.0E0,2.0E0),+     +                  (1.0E0,2.0E0), (0.3E0,-0.4E0), (3.0E0,4.0E0),+     +                  (3.0E0,4.0E0), (3.0E0,4.0E0), (3.0E0,4.0E0),+     +                  (3.0E0,4.0E0), (3.0E0,4.0E0), (3.0E0,4.0E0),+     +                  (0.1E0,-0.3E0), (0.5E0,-0.1E0), (5.0E0,6.0E0),+     +                  (5.0E0,6.0E0), (5.0E0,6.0E0), (5.0E0,6.0E0),+     +                  (5.0E0,6.0E0), (5.0E0,6.0E0), (0.1E0,0.1E0),+     +                  (-0.6E0,0.1E0), (0.1E0,-0.3E0), (7.0E0,8.0E0),+     +                  (7.0E0,8.0E0), (7.0E0,8.0E0), (7.0E0,8.0E0),+     +                  (7.0E0,8.0E0), (0.3E0,0.1E0), (0.5E0,0.0E0),+     +                  (0.0E0,0.5E0), (0.0E0,0.2E0), (2.0E0,3.0E0),+     +                  (2.0E0,3.0E0), (2.0E0,3.0E0), (2.0E0,3.0E0)/+      DATA              ((CV(I,J,2),I=1,8),J=1,5)/(0.1E0,0.1E0),+     +                  (4.0E0,5.0E0), (4.0E0,5.0E0), (4.0E0,5.0E0),+     +                  (4.0E0,5.0E0), (4.0E0,5.0E0), (4.0E0,5.0E0),+     +                  (4.0E0,5.0E0), (0.3E0,-0.4E0), (6.0E0,7.0E0),+     +                  (6.0E0,7.0E0), (6.0E0,7.0E0), (6.0E0,7.0E0),+     +                  (6.0E0,7.0E0), (6.0E0,7.0E0), (6.0E0,7.0E0),+     +                  (0.1E0,-0.3E0), (8.0E0,9.0E0), (0.5E0,-0.1E0),+     +                  (2.0E0,5.0E0), (2.0E0,5.0E0), (2.0E0,5.0E0),+     +                  (2.0E0,5.0E0), (2.0E0,5.0E0), (0.1E0,0.1E0),+     +                  (3.0E0,6.0E0), (-0.6E0,0.1E0), (4.0E0,7.0E0),+     +                  (0.1E0,-0.3E0), (7.0E0,2.0E0), (7.0E0,2.0E0),+     +                  (7.0E0,2.0E0), (0.3E0,0.1E0), (5.0E0,8.0E0),+     +                  (0.5E0,0.0E0), (6.0E0,9.0E0), (0.0E0,0.5E0),+     +                  (8.0E0,3.0E0), (0.0E0,0.2E0), (9.0E0,4.0E0)/+      DATA              STRUE2/0.0E0, 0.5E0, 0.6E0, 0.7E0, 0.8E0/+      DATA              STRUE4/0.0E0, 0.7E0, 1.0E0, 1.3E0, 1.6E0/+      DATA              ((CTRUE5(I,J,1),I=1,8),J=1,5)/(0.1E0,0.1E0),+     +                  (1.0E0,2.0E0), (1.0E0,2.0E0), (1.0E0,2.0E0),+     +                  (1.0E0,2.0E0), (1.0E0,2.0E0), (1.0E0,2.0E0),+     +                  (1.0E0,2.0E0), (-0.16E0,-0.37E0), (3.0E0,4.0E0),+     +                  (3.0E0,4.0E0), (3.0E0,4.0E0), (3.0E0,4.0E0),+     +                  (3.0E0,4.0E0), (3.0E0,4.0E0), (3.0E0,4.0E0),+     +                  (-0.17E0,-0.19E0), (0.13E0,-0.39E0),+     +                  (5.0E0,6.0E0), (5.0E0,6.0E0), (5.0E0,6.0E0),+     +                  (5.0E0,6.0E0), (5.0E0,6.0E0), (5.0E0,6.0E0),+     +                  (0.11E0,-0.03E0), (-0.17E0,0.46E0),+     +                  (-0.17E0,-0.19E0), (7.0E0,8.0E0), (7.0E0,8.0E0),+     +                  (7.0E0,8.0E0), (7.0E0,8.0E0), (7.0E0,8.0E0),+     +                  (0.19E0,-0.17E0), (0.20E0,-0.35E0),+     +                  (0.35E0,0.20E0), (0.14E0,0.08E0),+     +                  (2.0E0,3.0E0), (2.0E0,3.0E0), (2.0E0,3.0E0),+     +                  (2.0E0,3.0E0)/+      DATA              ((CTRUE5(I,J,2),I=1,8),J=1,5)/(0.1E0,0.1E0),+     +                  (4.0E0,5.0E0), (4.0E0,5.0E0), (4.0E0,5.0E0),+     +                  (4.0E0,5.0E0), (4.0E0,5.0E0), (4.0E0,5.0E0),+     +                  (4.0E0,5.0E0), (-0.16E0,-0.37E0), (6.0E0,7.0E0),+     +                  (6.0E0,7.0E0), (6.0E0,7.0E0), (6.0E0,7.0E0),+     +                  (6.0E0,7.0E0), (6.0E0,7.0E0), (6.0E0,7.0E0),+     +                  (-0.17E0,-0.19E0), (8.0E0,9.0E0),+     +                  (0.13E0,-0.39E0), (2.0E0,5.0E0), (2.0E0,5.0E0),+     +                  (2.0E0,5.0E0), (2.0E0,5.0E0), (2.0E0,5.0E0),+     +                  (0.11E0,-0.03E0), (3.0E0,6.0E0),+     +                  (-0.17E0,0.46E0), (4.0E0,7.0E0),+     +                  (-0.17E0,-0.19E0), (7.0E0,2.0E0), (7.0E0,2.0E0),+     +                  (7.0E0,2.0E0), (0.19E0,-0.17E0), (5.0E0,8.0E0),+     +                  (0.20E0,-0.35E0), (6.0E0,9.0E0),+     +                  (0.35E0,0.20E0), (8.0E0,3.0E0),+     +                  (0.14E0,0.08E0), (9.0E0,4.0E0)/+      DATA              ((CTRUE6(I,J,1),I=1,8),J=1,5)/(0.1E0,0.1E0),+     +                  (1.0E0,2.0E0), (1.0E0,2.0E0), (1.0E0,2.0E0),+     +                  (1.0E0,2.0E0), (1.0E0,2.0E0), (1.0E0,2.0E0),+     +                  (1.0E0,2.0E0), (0.09E0,-0.12E0), (3.0E0,4.0E0),+     +                  (3.0E0,4.0E0), (3.0E0,4.0E0), (3.0E0,4.0E0),+     +                  (3.0E0,4.0E0), (3.0E0,4.0E0), (3.0E0,4.0E0),+     +                  (0.03E0,-0.09E0), (0.15E0,-0.03E0),+     +                  (5.0E0,6.0E0), (5.0E0,6.0E0), (5.0E0,6.0E0),+     +                  (5.0E0,6.0E0), (5.0E0,6.0E0), (5.0E0,6.0E0),+     +                  (0.03E0,0.03E0), (-0.18E0,0.03E0),+     +                  (0.03E0,-0.09E0), (7.0E0,8.0E0), (7.0E0,8.0E0),+     +                  (7.0E0,8.0E0), (7.0E0,8.0E0), (7.0E0,8.0E0),+     +                  (0.09E0,0.03E0), (0.15E0,0.00E0),+     +                  (0.00E0,0.15E0), (0.00E0,0.06E0), (2.0E0,3.0E0),+     +                  (2.0E0,3.0E0), (2.0E0,3.0E0), (2.0E0,3.0E0)/+      DATA              ((CTRUE6(I,J,2),I=1,8),J=1,5)/(0.1E0,0.1E0),+     +                  (4.0E0,5.0E0), (4.0E0,5.0E0), (4.0E0,5.0E0),+     +                  (4.0E0,5.0E0), (4.0E0,5.0E0), (4.0E0,5.0E0),+     +                  (4.0E0,5.0E0), (0.09E0,-0.12E0), (6.0E0,7.0E0),+     +                  (6.0E0,7.0E0), (6.0E0,7.0E0), (6.0E0,7.0E0),+     +                  (6.0E0,7.0E0), (6.0E0,7.0E0), (6.0E0,7.0E0),+     +                  (0.03E0,-0.09E0), (8.0E0,9.0E0),+     +                  (0.15E0,-0.03E0), (2.0E0,5.0E0), (2.0E0,5.0E0),+     +                  (2.0E0,5.0E0), (2.0E0,5.0E0), (2.0E0,5.0E0),+     +                  (0.03E0,0.03E0), (3.0E0,6.0E0),+     +                  (-0.18E0,0.03E0), (4.0E0,7.0E0),+     +                  (0.03E0,-0.09E0), (7.0E0,2.0E0), (7.0E0,2.0E0),+     +                  (7.0E0,2.0E0), (0.09E0,0.03E0), (5.0E0,8.0E0),+     +                  (0.15E0,0.00E0), (6.0E0,9.0E0), (0.00E0,0.15E0),+     +                  (8.0E0,3.0E0), (0.00E0,0.06E0), (9.0E0,4.0E0)/+      DATA              ITRUE3/0, 1, 2, 2, 2/+*     .. Executable Statements ..+      DO 60 INCX = 1, 2+         DO 40 NP1 = 1, 5+            N = NP1 - 1+            LEN = 2*MAX(N,1)+*           .. Set vector arguments ..+            DO 20 I = 1, LEN+               CX(I) = CV(I,NP1,INCX)+   20       CONTINUE+            IF (ICASE.EQ.6) THEN+*              .. SCNRM2 ..+               CALL STEST1(SCNRM2(N,CX,INCX),STRUE2(NP1),STRUE2(NP1),+     +                     SFAC)+            ELSE IF (ICASE.EQ.7) THEN+*              .. SCASUM ..+               CALL STEST1(SCASUM(N,CX,INCX),STRUE4(NP1),STRUE4(NP1),+     +                     SFAC)+            ELSE IF (ICASE.EQ.8) THEN+*              .. CSCAL ..+               CALL CSCAL(N,CA,CX,INCX)+               CALL CTEST(LEN,CX,CTRUE5(1,NP1,INCX),CTRUE5(1,NP1,INCX),+     +                    SFAC)+            ELSE IF (ICASE.EQ.9) THEN+*              .. CSSCAL ..+               CALL CSSCAL(N,SA,CX,INCX)+               CALL CTEST(LEN,CX,CTRUE6(1,NP1,INCX),CTRUE6(1,NP1,INCX),+     +                    SFAC)+            ELSE IF (ICASE.EQ.10) THEN+*              .. ICAMAX ..+               CALL ITEST1(ICAMAX(N,CX,INCX),ITRUE3(NP1))+            ELSE+               WRITE (NOUT,*) ' Shouldn''t be here in CHECK1'+               STOP+            END IF+*+   40    CONTINUE+   60 CONTINUE+*+      INCX = 1+      IF (ICASE.EQ.8) THEN+*        CSCAL+*        Add a test for alpha equal to zero.+         CA = (0.0E0,0.0E0)+         DO 80 I = 1, 5+            MWPCT(I) = (0.0E0,0.0E0)+            MWPCS(I) = (1.0E0,1.0E0)+   80    CONTINUE+         CALL CSCAL(5,CA,CX,INCX)+         CALL CTEST(5,CX,MWPCT,MWPCS,SFAC)+      ELSE IF (ICASE.EQ.9) THEN+*        CSSCAL+*        Add a test for alpha equal to zero.+         SA = 0.0E0+         DO 100 I = 1, 5+            MWPCT(I) = (0.0E0,0.0E0)+            MWPCS(I) = (1.0E0,1.0E0)+  100    CONTINUE+         CALL CSSCAL(5,SA,CX,INCX)+         CALL CTEST(5,CX,MWPCT,MWPCS,SFAC)+*        Add a test for alpha equal to one.+         SA = 1.0E0+         DO 120 I = 1, 5+            MWPCT(I) = CX(I)+            MWPCS(I) = CX(I)+  120    CONTINUE+         CALL CSSCAL(5,SA,CX,INCX)+         CALL CTEST(5,CX,MWPCT,MWPCS,SFAC)+*        Add a test for alpha equal to minus one.+         SA = -1.0E0+         DO 140 I = 1, 5+            MWPCT(I) = -CX(I)+            MWPCS(I) = -CX(I)+  140    CONTINUE+         CALL CSSCAL(5,SA,CX,INCX)+         CALL CTEST(5,CX,MWPCT,MWPCS,SFAC)+      END IF+      RETURN+      END+      SUBROUTINE CHECK2(SFAC)+*     .. Parameters ..+      INTEGER           NOUT+      PARAMETER         (NOUT=6)+*     .. Scalar Arguments ..+      REAL              SFAC+*     .. Scalars in Common ..+      INTEGER           ICASE, INCX, INCY, MODE, N+      LOGICAL           PASS+*     .. Local Scalars ..+      COMPLEX           CA+      INTEGER           I, J, KI, KN, KSIZE, LENX, LENY, MX, MY+*     .. Local Arrays ..+      COMPLEX           CDOT(1), CSIZE1(4), CSIZE2(7,2), CSIZE3(14),+     +                  CT10X(7,4,4), CT10Y(7,4,4), CT6(4,4), CT7(4,4),+     +                  CT8(7,4,4), CX(7), CX1(7), CY(7), CY1(7)+      INTEGER           INCXS(4), INCYS(4), LENS(4,2), NS(4)+*     .. External Functions ..+      COMPLEX           CDOTC, CDOTU+      EXTERNAL          CDOTC, CDOTU+*     .. External Subroutines ..+      EXTERNAL          CAXPY, CCOPY, CSWAP, CTEST+*     .. Intrinsic Functions ..+      INTRINSIC         ABS, MIN+*     .. Common blocks ..+      COMMON            /COMBLA/ICASE, N, INCX, INCY, MODE, PASS+*     .. Data statements ..+      DATA              CA/(0.4E0,-0.7E0)/+      DATA              INCXS/1, 2, -2, -1/+      DATA              INCYS/1, -2, 1, -2/+      DATA              LENS/1, 1, 2, 4, 1, 1, 3, 7/+      DATA              NS/0, 1, 2, 4/+      DATA              CX1/(0.7E0,-0.8E0), (-0.4E0,-0.7E0),+     +                  (-0.1E0,-0.9E0), (0.2E0,-0.8E0),+     +                  (-0.9E0,-0.4E0), (0.1E0,0.4E0), (-0.6E0,0.6E0)/+      DATA              CY1/(0.6E0,-0.6E0), (-0.9E0,0.5E0),+     +                  (0.7E0,-0.6E0), (0.1E0,-0.5E0), (-0.1E0,-0.2E0),+     +                  (-0.5E0,-0.3E0), (0.8E0,-0.7E0)/+      DATA              ((CT8(I,J,1),I=1,7),J=1,4)/(0.6E0,-0.6E0),+     +                  (0.0E0,0.0E0), (0.0E0,0.0E0), (0.0E0,0.0E0),+     +                  (0.0E0,0.0E0), (0.0E0,0.0E0), (0.0E0,0.0E0),+     +                  (0.32E0,-1.41E0), (0.0E0,0.0E0), (0.0E0,0.0E0),+     +                  (0.0E0,0.0E0), (0.0E0,0.0E0), (0.0E0,0.0E0),+     +                  (0.0E0,0.0E0), (0.32E0,-1.41E0),+     +                  (-1.55E0,0.5E0), (0.0E0,0.0E0), (0.0E0,0.0E0),+     +                  (0.0E0,0.0E0), (0.0E0,0.0E0), (0.0E0,0.0E0),+     +                  (0.32E0,-1.41E0), (-1.55E0,0.5E0),+     +                  (0.03E0,-0.89E0), (-0.38E0,-0.96E0),+     +                  (0.0E0,0.0E0), (0.0E0,0.0E0), (0.0E0,0.0E0)/+      DATA              ((CT8(I,J,2),I=1,7),J=1,4)/(0.6E0,-0.6E0),+     +                  (0.0E0,0.0E0), (0.0E0,0.0E0), (0.0E0,0.0E0),+     +                  (0.0E0,0.0E0), (0.0E0,0.0E0), (0.0E0,0.0E0),+     +                  (0.32E0,-1.41E0), (0.0E0,0.0E0), (0.0E0,0.0E0),+     +                  (0.0E0,0.0E0), (0.0E0,0.0E0), (0.0E0,0.0E0),+     +                  (0.0E0,0.0E0), (-0.07E0,-0.89E0),+     +                  (-0.9E0,0.5E0), (0.42E0,-1.41E0), (0.0E0,0.0E0),+     +                  (0.0E0,0.0E0), (0.0E0,0.0E0), (0.0E0,0.0E0),+     +                  (0.78E0,0.06E0), (-0.9E0,0.5E0),+     +                  (0.06E0,-0.13E0), (0.1E0,-0.5E0),+     +                  (-0.77E0,-0.49E0), (-0.5E0,-0.3E0),+     +                  (0.52E0,-1.51E0)/+      DATA              ((CT8(I,J,3),I=1,7),J=1,4)/(0.6E0,-0.6E0),+     +                  (0.0E0,0.0E0), (0.0E0,0.0E0), (0.0E0,0.0E0),+     +                  (0.0E0,0.0E0), (0.0E0,0.0E0), (0.0E0,0.0E0),+     +                  (0.32E0,-1.41E0), (0.0E0,0.0E0), (0.0E0,0.0E0),+     +                  (0.0E0,0.0E0), (0.0E0,0.0E0), (0.0E0,0.0E0),+     +                  (0.0E0,0.0E0), (-0.07E0,-0.89E0),+     +                  (-1.18E0,-0.31E0), (0.0E0,0.0E0), (0.0E0,0.0E0),+     +                  (0.0E0,0.0E0), (0.0E0,0.0E0), (0.0E0,0.0E0),+     +                  (0.78E0,0.06E0), (-1.54E0,0.97E0),+     +                  (0.03E0,-0.89E0), (-0.18E0,-1.31E0),+     +                  (0.0E0,0.0E0), (0.0E0,0.0E0), (0.0E0,0.0E0)/+      DATA              ((CT8(I,J,4),I=1,7),J=1,4)/(0.6E0,-0.6E0),+     +                  (0.0E0,0.0E0), (0.0E0,0.0E0), (0.0E0,0.0E0),+     +                  (0.0E0,0.0E0), (0.0E0,0.0E0), (0.0E0,0.0E0),+     +                  (0.32E0,-1.41E0), (0.0E0,0.0E0), (0.0E0,0.0E0),+     +                  (0.0E0,0.0E0), (0.0E0,0.0E0), (0.0E0,0.0E0),+     +                  (0.0E0,0.0E0), (0.32E0,-1.41E0), (-0.9E0,0.5E0),+     +                  (0.05E0,-0.6E0), (0.0E0,0.0E0), (0.0E0,0.0E0),+     +                  (0.0E0,0.0E0), (0.0E0,0.0E0), (0.32E0,-1.41E0),+     +                  (-0.9E0,0.5E0), (0.05E0,-0.6E0), (0.1E0,-0.5E0),+     +                  (-0.77E0,-0.49E0), (-0.5E0,-0.3E0),+     +                  (0.32E0,-1.16E0)/+      DATA              CT7/(0.0E0,0.0E0), (-0.06E0,-0.90E0),+     +                  (0.65E0,-0.47E0), (-0.34E0,-1.22E0),+     +                  (0.0E0,0.0E0), (-0.06E0,-0.90E0),+     +                  (-0.59E0,-1.46E0), (-1.04E0,-0.04E0),+     +                  (0.0E0,0.0E0), (-0.06E0,-0.90E0),+     +                  (-0.83E0,0.59E0), (0.07E0,-0.37E0),+     +                  (0.0E0,0.0E0), (-0.06E0,-0.90E0),+     +                  (-0.76E0,-1.15E0), (-1.33E0,-1.82E0)/+      DATA              CT6/(0.0E0,0.0E0), (0.90E0,0.06E0),+     +                  (0.91E0,-0.77E0), (1.80E0,-0.10E0),+     +                  (0.0E0,0.0E0), (0.90E0,0.06E0), (1.45E0,0.74E0),+     +                  (0.20E0,0.90E0), (0.0E0,0.0E0), (0.90E0,0.06E0),+     +                  (-0.55E0,0.23E0), (0.83E0,-0.39E0),+     +                  (0.0E0,0.0E0), (0.90E0,0.06E0), (1.04E0,0.79E0),+     +                  (1.95E0,1.22E0)/+      DATA              ((CT10X(I,J,1),I=1,7),J=1,4)/(0.7E0,-0.8E0),+     +                  (0.0E0,0.0E0), (0.0E0,0.0E0), (0.0E0,0.0E0),+     +                  (0.0E0,0.0E0), (0.0E0,0.0E0), (0.0E0,0.0E0),+     +                  (0.6E0,-0.6E0), (0.0E0,0.0E0), (0.0E0,0.0E0),+     +                  (0.0E0,0.0E0), (0.0E0,0.0E0), (0.0E0,0.0E0),+     +                  (0.0E0,0.0E0), (0.6E0,-0.6E0), (-0.9E0,0.5E0),+     +                  (0.0E0,0.0E0), (0.0E0,0.0E0), (0.0E0,0.0E0),+     +                  (0.0E0,0.0E0), (0.0E0,0.0E0), (0.6E0,-0.6E0),+     +                  (-0.9E0,0.5E0), (0.7E0,-0.6E0), (0.1E0,-0.5E0),+     +                  (0.0E0,0.0E0), (0.0E0,0.0E0), (0.0E0,0.0E0)/+      DATA              ((CT10X(I,J,2),I=1,7),J=1,4)/(0.7E0,-0.8E0),+     +                  (0.0E0,0.0E0), (0.0E0,0.0E0), (0.0E0,0.0E0),+     +                  (0.0E0,0.0E0), (0.0E0,0.0E0), (0.0E0,0.0E0),+     +                  (0.6E0,-0.6E0), (0.0E0,0.0E0), (0.0E0,0.0E0),+     +                  (0.0E0,0.0E0), (0.0E0,0.0E0), (0.0E0,0.0E0),+     +                  (0.0E0,0.0E0), (0.7E0,-0.6E0), (-0.4E0,-0.7E0),+     +                  (0.6E0,-0.6E0), (0.0E0,0.0E0), (0.0E0,0.0E0),+     +                  (0.0E0,0.0E0), (0.0E0,0.0E0), (0.8E0,-0.7E0),+     +                  (-0.4E0,-0.7E0), (-0.1E0,-0.2E0),+     +                  (0.2E0,-0.8E0), (0.7E0,-0.6E0), (0.1E0,0.4E0),+     +                  (0.6E0,-0.6E0)/+      DATA              ((CT10X(I,J,3),I=1,7),J=1,4)/(0.7E0,-0.8E0),+     +                  (0.0E0,0.0E0), (0.0E0,0.0E0), (0.0E0,0.0E0),+     +                  (0.0E0,0.0E0), (0.0E0,0.0E0), (0.0E0,0.0E0),+     +                  (0.6E0,-0.6E0), (0.0E0,0.0E0), (0.0E0,0.0E0),+     +                  (0.0E0,0.0E0), (0.0E0,0.0E0), (0.0E0,0.0E0),+     +                  (0.0E0,0.0E0), (-0.9E0,0.5E0), (-0.4E0,-0.7E0),+     +                  (0.6E0,-0.6E0), (0.0E0,0.0E0), (0.0E0,0.0E0),+     +                  (0.0E0,0.0E0), (0.0E0,0.0E0), (0.1E0,-0.5E0),+     +                  (-0.4E0,-0.7E0), (0.7E0,-0.6E0), (0.2E0,-0.8E0),+     +                  (-0.9E0,0.5E0), (0.1E0,0.4E0), (0.6E0,-0.6E0)/+      DATA              ((CT10X(I,J,4),I=1,7),J=1,4)/(0.7E0,-0.8E0),+     +                  (0.0E0,0.0E0), (0.0E0,0.0E0), (0.0E0,0.0E0),+     +                  (0.0E0,0.0E0), (0.0E0,0.0E0), (0.0E0,0.0E0),+     +                  (0.6E0,-0.6E0), (0.0E0,0.0E0), (0.0E0,0.0E0),+     +                  (0.0E0,0.0E0), (0.0E0,0.0E0), (0.0E0,0.0E0),+     +                  (0.0E0,0.0E0), (0.6E0,-0.6E0), (0.7E0,-0.6E0),+     +                  (0.0E0,0.0E0), (0.0E0,0.0E0), (0.0E0,0.0E0),+     +                  (0.0E0,0.0E0), (0.0E0,0.0E0), (0.6E0,-0.6E0),+     +                  (0.7E0,-0.6E0), (-0.1E0,-0.2E0), (0.8E0,-0.7E0),+     +                  (0.0E0,0.0E0), (0.0E0,0.0E0), (0.0E0,0.0E0)/+      DATA              ((CT10Y(I,J,1),I=1,7),J=1,4)/(0.6E0,-0.6E0),+     +                  (0.0E0,0.0E0), (0.0E0,0.0E0), (0.0E0,0.0E0),+     +                  (0.0E0,0.0E0), (0.0E0,0.0E0), (0.0E0,0.0E0),+     +                  (0.7E0,-0.8E0), (0.0E0,0.0E0), (0.0E0,0.0E0),+     +                  (0.0E0,0.0E0), (0.0E0,0.0E0), (0.0E0,0.0E0),+     +                  (0.0E0,0.0E0), (0.7E0,-0.8E0), (-0.4E0,-0.7E0),+     +                  (0.0E0,0.0E0), (0.0E0,0.0E0), (0.0E0,0.0E0),+     +                  (0.0E0,0.0E0), (0.0E0,0.0E0), (0.7E0,-0.8E0),+     +                  (-0.4E0,-0.7E0), (-0.1E0,-0.9E0),+     +                  (0.2E0,-0.8E0), (0.0E0,0.0E0), (0.0E0,0.0E0),+     +                  (0.0E0,0.0E0)/+      DATA              ((CT10Y(I,J,2),I=1,7),J=1,4)/(0.6E0,-0.6E0),+     +                  (0.0E0,0.0E0), (0.0E0,0.0E0), (0.0E0,0.0E0),+     +                  (0.0E0,0.0E0), (0.0E0,0.0E0), (0.0E0,0.0E0),+     +                  (0.7E0,-0.8E0), (0.0E0,0.0E0), (0.0E0,0.0E0),+     +                  (0.0E0,0.0E0), (0.0E0,0.0E0), (0.0E0,0.0E0),+     +                  (0.0E0,0.0E0), (-0.1E0,-0.9E0), (-0.9E0,0.5E0),+     +                  (0.7E0,-0.8E0), (0.0E0,0.0E0), (0.0E0,0.0E0),+     +                  (0.0E0,0.0E0), (0.0E0,0.0E0), (-0.6E0,0.6E0),+     +                  (-0.9E0,0.5E0), (-0.9E0,-0.4E0), (0.1E0,-0.5E0),+     +                  (-0.1E0,-0.9E0), (-0.5E0,-0.3E0),+     +                  (0.7E0,-0.8E0)/+      DATA              ((CT10Y(I,J,3),I=1,7),J=1,4)/(0.6E0,-0.6E0),+     +                  (0.0E0,0.0E0), (0.0E0,0.0E0), (0.0E0,0.0E0),+     +                  (0.0E0,0.0E0), (0.0E0,0.0E0), (0.0E0,0.0E0),+     +                  (0.7E0,-0.8E0), (0.0E0,0.0E0), (0.0E0,0.0E0),+     +                  (0.0E0,0.0E0), (0.0E0,0.0E0), (0.0E0,0.0E0),+     +                  (0.0E0,0.0E0), (-0.1E0,-0.9E0), (0.7E0,-0.8E0),+     +                  (0.0E0,0.0E0), (0.0E0,0.0E0), (0.0E0,0.0E0),+     +                  (0.0E0,0.0E0), (0.0E0,0.0E0), (-0.6E0,0.6E0),+     +                  (-0.9E0,-0.4E0), (-0.1E0,-0.9E0),+     +                  (0.7E0,-0.8E0), (0.0E0,0.0E0), (0.0E0,0.0E0),+     +                  (0.0E0,0.0E0)/+      DATA              ((CT10Y(I,J,4),I=1,7),J=1,4)/(0.6E0,-0.6E0),+     +                  (0.0E0,0.0E0), (0.0E0,0.0E0), (0.0E0,0.0E0),+     +                  (0.0E0,0.0E0), (0.0E0,0.0E0), (0.0E0,0.0E0),+     +                  (0.7E0,-0.8E0), (0.0E0,0.0E0), (0.0E0,0.0E0),+     +                  (0.0E0,0.0E0), (0.0E0,0.0E0), (0.0E0,0.0E0),+     +                  (0.0E0,0.0E0), (0.7E0,-0.8E0), (-0.9E0,0.5E0),+     +                  (-0.4E0,-0.7E0), (0.0E0,0.0E0), (0.0E0,0.0E0),+     +                  (0.0E0,0.0E0), (0.0E0,0.0E0), (0.7E0,-0.8E0),+     +                  (-0.9E0,0.5E0), (-0.4E0,-0.7E0), (0.1E0,-0.5E0),+     +                  (-0.1E0,-0.9E0), (-0.5E0,-0.3E0),+     +                  (0.2E0,-0.8E0)/+      DATA              CSIZE1/(0.0E0,0.0E0), (0.9E0,0.9E0),+     +                  (1.63E0,1.73E0), (2.90E0,2.78E0)/+      DATA              CSIZE3/(0.0E0,0.0E0), (0.0E0,0.0E0),+     +                  (0.0E0,0.0E0), (0.0E0,0.0E0), (0.0E0,0.0E0),+     +                  (0.0E0,0.0E0), (0.0E0,0.0E0), (1.17E0,1.17E0),+     +                  (1.17E0,1.17E0), (1.17E0,1.17E0),+     +                  (1.17E0,1.17E0), (1.17E0,1.17E0),+     +                  (1.17E0,1.17E0), (1.17E0,1.17E0)/+      DATA              CSIZE2/(0.0E0,0.0E0), (0.0E0,0.0E0),+     +                  (0.0E0,0.0E0), (0.0E0,0.0E0), (0.0E0,0.0E0),+     +                  (0.0E0,0.0E0), (0.0E0,0.0E0), (1.54E0,1.54E0),+     +                  (1.54E0,1.54E0), (1.54E0,1.54E0),+     +                  (1.54E0,1.54E0), (1.54E0,1.54E0),+     +                  (1.54E0,1.54E0), (1.54E0,1.54E0)/+*     .. Executable Statements ..+      DO 60 KI = 1, 4+         INCX = INCXS(KI)+         INCY = INCYS(KI)+         MX = ABS(INCX)+         MY = ABS(INCY)+*+         DO 40 KN = 1, 4+            N = NS(KN)+            KSIZE = MIN(2,KN)+            LENX = LENS(KN,MX)+            LENY = LENS(KN,MY)+*           .. initialize all argument arrays ..+            DO 20 I = 1, 7+               CX(I) = CX1(I)+               CY(I) = CY1(I)+   20       CONTINUE+            IF (ICASE.EQ.1) THEN+*              .. CDOTC ..+               CDOT(1) = CDOTC(N,CX,INCX,CY,INCY)+               CALL CTEST(1,CDOT,CT6(KN,KI),CSIZE1(KN),SFAC)+            ELSE IF (ICASE.EQ.2) THEN+*              .. CDOTU ..+               CDOT(1) = CDOTU(N,CX,INCX,CY,INCY)+               CALL CTEST(1,CDOT,CT7(KN,KI),CSIZE1(KN),SFAC)+            ELSE IF (ICASE.EQ.3) THEN+*              .. CAXPY ..+               CALL CAXPY(N,CA,CX,INCX,CY,INCY)+               CALL CTEST(LENY,CY,CT8(1,KN,KI),CSIZE2(1,KSIZE),SFAC)+            ELSE IF (ICASE.EQ.4) THEN+*              .. CCOPY ..+               CALL CCOPY(N,CX,INCX,CY,INCY)+               CALL CTEST(LENY,CY,CT10Y(1,KN,KI),CSIZE3,1.0E0)+            ELSE IF (ICASE.EQ.5) THEN+*              .. CSWAP ..+               CALL CSWAP(N,CX,INCX,CY,INCY)+               CALL CTEST(LENX,CX,CT10X(1,KN,KI),CSIZE3,1.0E0)+               CALL CTEST(LENY,CY,CT10Y(1,KN,KI),CSIZE3,1.0E0)+            ELSE+               WRITE (NOUT,*) ' Shouldn''t be here in CHECK2'+               STOP+            END IF+*+   40    CONTINUE+   60 CONTINUE+      RETURN+      END+      SUBROUTINE STEST(LEN,SCOMP,STRUE,SSIZE,SFAC)+*     ********************************* STEST **************************+*+*     THIS SUBR COMPARES ARRAYS  SCOMP() AND STRUE() OF LENGTH LEN TO+*     SEE IF THE TERM BY TERM DIFFERENCES, MULTIPLIED BY SFAC, ARE+*     NEGLIGIBLE.+*+*     C. L. LAWSON, JPL, 1974 DEC 10+*+*     .. Parameters ..+      INTEGER          NOUT+      REAL             ZERO+      PARAMETER        (NOUT=6, ZERO=0.0E0)+*     .. Scalar Arguments ..+      REAL             SFAC+      INTEGER          LEN+*     .. Array Arguments ..+      REAL             SCOMP(LEN), SSIZE(LEN), STRUE(LEN)+*     .. Scalars in Common ..+      INTEGER          ICASE, INCX, INCY, MODE, N+      LOGICAL          PASS+*     .. Local Scalars ..+      REAL             SD+      INTEGER          I+*     .. External Functions ..+      REAL             SDIFF+      EXTERNAL         SDIFF+*     .. Intrinsic Functions ..+      INTRINSIC        ABS+*     .. Common blocks ..+      COMMON           /COMBLA/ICASE, N, INCX, INCY, MODE, PASS+*     .. Executable Statements ..+*+      DO 40 I = 1, LEN+         SD = SCOMP(I) - STRUE(I)+         IF (ABS(SFAC*SD) .LE. ABS(SSIZE(I))*EPSILON(ZERO))+     +       GO TO 40+*+*                             HERE    SCOMP(I) IS NOT CLOSE TO STRUE(I).+*+         IF ( .NOT. PASS) GO TO 20+*                             PRINT FAIL MESSAGE AND HEADER.+         PASS = .FALSE.+         WRITE (NOUT,99999)+         WRITE (NOUT,99998)+   20    WRITE (NOUT,99997) ICASE, N, INCX, INCY, MODE, I, SCOMP(I),+     +     STRUE(I), SD, SSIZE(I)+   40 CONTINUE+      RETURN+*+99999 FORMAT ('                                       FAIL')+99998 FORMAT (/' CASE  N INCX INCY MODE  I                            ',+     +       ' COMP(I)                             TRUE(I)  DIFFERENCE',+     +       '     SIZE(I)',/1X)+99997 FORMAT (1X,I4,I3,3I5,I3,2E36.8,2E12.4)+      END+      SUBROUTINE STEST1(SCOMP1,STRUE1,SSIZE,SFAC)+*     ************************* STEST1 *****************************+*+*     THIS IS AN INTERFACE SUBROUTINE TO ACCOMODATE THE FORTRAN+*     REQUIREMENT THAT WHEN A DUMMY ARGUMENT IS AN ARRAY, THE+*     ACTUAL ARGUMENT MUST ALSO BE AN ARRAY OR AN ARRAY ELEMENT.+*+*     C.L. LAWSON, JPL, 1978 DEC 6+*+*     .. Scalar Arguments ..+      REAL              SCOMP1, SFAC, STRUE1+*     .. Array Arguments ..+      REAL              SSIZE(*)+*     .. Local Arrays ..+      REAL              SCOMP(1), STRUE(1)+*     .. External Subroutines ..+      EXTERNAL          STEST+*     .. Executable Statements ..+*+      SCOMP(1) = SCOMP1+      STRUE(1) = STRUE1+      CALL STEST(1,SCOMP,STRUE,SSIZE,SFAC)+*+      RETURN+      END+      REAL             FUNCTION SDIFF(SA,SB)+*     ********************************* SDIFF **************************+*     COMPUTES DIFFERENCE OF TWO NUMBERS.  C. L. LAWSON, JPL 1974 FEB 15+*+*     .. Scalar Arguments ..+      REAL                            SA, SB+*     .. Executable Statements ..+      SDIFF = SA - SB+      RETURN+      END+      SUBROUTINE CTEST(LEN,CCOMP,CTRUE,CSIZE,SFAC)+*     **************************** CTEST *****************************+*+*     C.L. LAWSON, JPL, 1978 DEC 6+*+*     .. Scalar Arguments ..+      REAL             SFAC+      INTEGER          LEN+*     .. Array Arguments ..+      COMPLEX          CCOMP(LEN), CSIZE(LEN), CTRUE(LEN)+*     .. Local Scalars ..+      INTEGER          I+*     .. Local Arrays ..+      REAL             SCOMP(20), SSIZE(20), STRUE(20)+*     .. External Subroutines ..+      EXTERNAL         STEST+*     .. Intrinsic Functions ..+      INTRINSIC        AIMAG, REAL+*     .. Executable Statements ..+      DO 20 I = 1, LEN+         SCOMP(2*I-1) = REAL(CCOMP(I))+         SCOMP(2*I) = AIMAG(CCOMP(I))+         STRUE(2*I-1) = REAL(CTRUE(I))+         STRUE(2*I) = AIMAG(CTRUE(I))+         SSIZE(2*I-1) = REAL(CSIZE(I))+         SSIZE(2*I) = AIMAG(CSIZE(I))+   20 CONTINUE+*+      CALL STEST(2*LEN,SCOMP,STRUE,SSIZE,SFAC)+      RETURN+      END+      SUBROUTINE ITEST1(ICOMP,ITRUE)+*     ********************************* ITEST1 *************************+*+*     THIS SUBROUTINE COMPARES THE VARIABLES ICOMP AND ITRUE FOR+*     EQUALITY.+*     C. L. LAWSON, JPL, 1974 DEC 10+*+*     .. Parameters ..+      INTEGER           NOUT+      PARAMETER         (NOUT=6)+*     .. Scalar Arguments ..+      INTEGER           ICOMP, ITRUE+*     .. Scalars in Common ..+      INTEGER           ICASE, INCX, INCY, MODE, N+      LOGICAL           PASS+*     .. Local Scalars ..+      INTEGER           ID+*     .. Common blocks ..+      COMMON            /COMBLA/ICASE, N, INCX, INCY, MODE, PASS+*     .. Executable Statements ..+      IF (ICOMP.EQ.ITRUE) GO TO 40+*+*                            HERE ICOMP IS NOT EQUAL TO ITRUE.+*+      IF ( .NOT. PASS) GO TO 20+*                             PRINT FAIL MESSAGE AND HEADER.+      PASS = .FALSE.+      WRITE (NOUT,99999)+      WRITE (NOUT,99998)+   20 ID = ICOMP - ITRUE+      WRITE (NOUT,99997) ICASE, N, INCX, INCY, MODE, ICOMP, ITRUE, ID+   40 CONTINUE+      RETURN+*+99999 FORMAT ('                                       FAIL')+99998 FORMAT (/' CASE  N INCX INCY MODE                               ',+     +       ' COMP                                TRUE     DIFFERENCE',+     +       /1X)+99997 FORMAT (1X,I4,I3,3I5,2I36,I12)+      END
+ eigen3/blas/testing/cblat2.dat view
@@ -0,0 +1,35 @@+'cblat2.summ'     NAME OF SUMMARY OUTPUT FILE+6                 UNIT NUMBER OF SUMMARY FILE+'cblat2.snap'     NAME OF SNAPSHOT OUTPUT FILE+-1                UNIT NUMBER OF SNAPSHOT FILE (NOT USED IF .LT. 0)+F        LOGICAL FLAG, T TO REWIND SNAPSHOT FILE AFTER EACH RECORD.+F        LOGICAL FLAG, T TO STOP ON FAILURES.+T        LOGICAL FLAG, T TO TEST ERROR EXITS.+16.0     THRESHOLD VALUE OF TEST RATIO+6                 NUMBER OF VALUES OF N+0 1 2 3 5 9       VALUES OF N+4                 NUMBER OF VALUES OF K+0 1 2 4           VALUES OF K+4                 NUMBER OF VALUES OF INCX AND INCY+1 2 -1 -2         VALUES OF INCX AND INCY+3                 NUMBER OF VALUES OF ALPHA+(0.0,0.0) (1.0,0.0) (0.7,-0.9)       VALUES OF ALPHA+3                 NUMBER OF VALUES OF BETA+(0.0,0.0) (1.0,0.0) (1.3,-1.1)       VALUES OF BETA+CGEMV  T PUT F FOR NO TEST. SAME COLUMNS.+CGBMV  T PUT F FOR NO TEST. SAME COLUMNS.+CHEMV  T PUT F FOR NO TEST. SAME COLUMNS.+CHBMV  T PUT F FOR NO TEST. SAME COLUMNS.+CHPMV  T PUT F FOR NO TEST. SAME COLUMNS.+CTRMV  T PUT F FOR NO TEST. SAME COLUMNS.+CTBMV  T PUT F FOR NO TEST. SAME COLUMNS.+CTPMV  T PUT F FOR NO TEST. SAME COLUMNS.+CTRSV  T PUT F FOR NO TEST. SAME COLUMNS.+CTBSV  T PUT F FOR NO TEST. SAME COLUMNS.+CTPSV  T PUT F FOR NO TEST. SAME COLUMNS.+CGERC  T PUT F FOR NO TEST. SAME COLUMNS.+CGERU  T PUT F FOR NO TEST. SAME COLUMNS.+CHER   T PUT F FOR NO TEST. SAME COLUMNS.+CHPR   T PUT F FOR NO TEST. SAME COLUMNS.+CHER2  T PUT F FOR NO TEST. SAME COLUMNS.+CHPR2  T PUT F FOR NO TEST. SAME COLUMNS.
+ eigen3/blas/testing/cblat2.f view
@@ -0,0 +1,3279 @@+*> \brief \b CBLAT2+*+*  =========== DOCUMENTATION ===========+*+* Online html documentation available at +*            http://www.netlib.org/lapack/explore-html/ +*+*  Definition:+*  ===========+*+*       PROGRAM CBLAT2+* +*+*> \par Purpose:+*  =============+*>+*> \verbatim+*>+*> Test program for the COMPLEX          Level 2 Blas.+*>+*> The program must be driven by a short data file. The first 18 records+*> of the file are read using list-directed input, the last 17 records+*> are read using the format ( A6, L2 ). An annotated example of a data+*> file can be obtained by deleting the first 3 characters from the+*> following 35 lines:+*> 'cblat2.out'      NAME OF SUMMARY OUTPUT FILE+*> 6                 UNIT NUMBER OF SUMMARY FILE+*> 'CBLA2T.SNAP'     NAME OF SNAPSHOT OUTPUT FILE+*> -1                UNIT NUMBER OF SNAPSHOT FILE (NOT USED IF .LT. 0)+*> F        LOGICAL FLAG, T TO REWIND SNAPSHOT FILE AFTER EACH RECORD.+*> F        LOGICAL FLAG, T TO STOP ON FAILURES.+*> T        LOGICAL FLAG, T TO TEST ERROR EXITS.+*> 16.0     THRESHOLD VALUE OF TEST RATIO+*> 6                 NUMBER OF VALUES OF N+*> 0 1 2 3 5 9       VALUES OF N+*> 4                 NUMBER OF VALUES OF K+*> 0 1 2 4           VALUES OF K+*> 4                 NUMBER OF VALUES OF INCX AND INCY+*> 1 2 -1 -2         VALUES OF INCX AND INCY+*> 3                 NUMBER OF VALUES OF ALPHA+*> (0.0,0.0) (1.0,0.0) (0.7,-0.9)       VALUES OF ALPHA+*> 3                 NUMBER OF VALUES OF BETA+*> (0.0,0.0) (1.0,0.0) (1.3,-1.1)       VALUES OF BETA+*> CGEMV  T PUT F FOR NO TEST. SAME COLUMNS.+*> CGBMV  T PUT F FOR NO TEST. SAME COLUMNS.+*> CHEMV  T PUT F FOR NO TEST. SAME COLUMNS.+*> CHBMV  T PUT F FOR NO TEST. SAME COLUMNS.+*> CHPMV  T PUT F FOR NO TEST. SAME COLUMNS.+*> CTRMV  T PUT F FOR NO TEST. SAME COLUMNS.+*> CTBMV  T PUT F FOR NO TEST. SAME COLUMNS.+*> CTPMV  T PUT F FOR NO TEST. SAME COLUMNS.+*> CTRSV  T PUT F FOR NO TEST. SAME COLUMNS.+*> CTBSV  T PUT F FOR NO TEST. SAME COLUMNS.+*> CTPSV  T PUT F FOR NO TEST. SAME COLUMNS.+*> CGERC  T PUT F FOR NO TEST. SAME COLUMNS.+*> CGERU  T PUT F FOR NO TEST. SAME COLUMNS.+*> CHER   T PUT F FOR NO TEST. SAME COLUMNS.+*> CHPR   T PUT F FOR NO TEST. SAME COLUMNS.+*> CHER2  T PUT F FOR NO TEST. SAME COLUMNS.+*> CHPR2  T PUT F FOR NO TEST. SAME COLUMNS.+*>+*> Further Details+*> ===============+*>+*>    See:+*>+*>       Dongarra J. J., Du Croz J. J., Hammarling S.  and Hanson R. J..+*>       An  extended  set of Fortran  Basic Linear Algebra Subprograms.+*>+*>       Technical  Memoranda  Nos. 41 (revision 3) and 81,  Mathematics+*>       and  Computer Science  Division,  Argonne  National Laboratory,+*>       9700 South Cass Avenue, Argonne, Illinois 60439, US.+*>+*>       Or+*>+*>       NAG  Technical Reports TR3/87 and TR4/87,  Numerical Algorithms+*>       Group  Ltd.,  NAG  Central  Office,  256  Banbury  Road, Oxford+*>       OX2 7DE, UK,  and  Numerical Algorithms Group Inc.,  1101  31st+*>       Street,  Suite 100,  Downers Grove,  Illinois 60515-1263,  USA.+*>+*>+*> -- Written on 10-August-1987.+*>    Richard Hanson, Sandia National Labs.+*>    Jeremy Du Croz, NAG Central Office.+*>+*>    10-9-00:  Change STATUS='NEW' to 'UNKNOWN' so that the testers+*>              can be run multiple times without deleting generated+*>              output files (susan)+*> \endverbatim+*+*  Authors:+*  ========+*+*> \author Univ. of Tennessee +*> \author Univ. of California Berkeley +*> \author Univ. of Colorado Denver +*> \author NAG Ltd. +*+*> \date April 2012+*+*> \ingroup complex_blas_testing+*+*  =====================================================================+      PROGRAM CBLAT2+*+*  -- Reference BLAS test routine (version 3.4.1) --+*  -- Reference BLAS is a software package provided by Univ. of Tennessee,    --+*  -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--+*     April 2012+*+*  =====================================================================+*+*     .. Parameters ..+      INTEGER            NIN+      PARAMETER          ( NIN = 5 )+      INTEGER            NSUBS+      PARAMETER          ( NSUBS = 17 )+      COMPLEX            ZERO, ONE+      PARAMETER          ( ZERO = ( 0.0, 0.0 ), ONE = ( 1.0, 0.0 ) )+      REAL               RZERO+      PARAMETER          ( RZERO = 0.0 )+      INTEGER            NMAX, INCMAX+      PARAMETER          ( NMAX = 65, INCMAX = 2 )+      INTEGER            NINMAX, NIDMAX, NKBMAX, NALMAX, NBEMAX+      PARAMETER          ( NINMAX = 7, NIDMAX = 9, NKBMAX = 7,+     $                   NALMAX = 7, NBEMAX = 7 )+*     .. Local Scalars ..+      REAL               EPS, ERR, THRESH+      INTEGER            I, ISNUM, J, N, NALF, NBET, NIDIM, NINC, NKB,+     $                   NOUT, NTRA+      LOGICAL            FATAL, LTESTT, REWI, SAME, SFATAL, TRACE,+     $                   TSTERR+      CHARACTER*1        TRANS+      CHARACTER*6        SNAMET+      CHARACTER*32       SNAPS, SUMMRY+*     .. Local Arrays ..+      COMPLEX            A( NMAX, NMAX ), AA( NMAX*NMAX ),+     $                   ALF( NALMAX ), AS( NMAX*NMAX ), BET( NBEMAX ),+     $                   X( NMAX ), XS( NMAX*INCMAX ),+     $                   XX( NMAX*INCMAX ), Y( NMAX ),+     $                   YS( NMAX*INCMAX ), YT( NMAX ),+     $                   YY( NMAX*INCMAX ), Z( 2*NMAX )+      REAL               G( NMAX )+      INTEGER            IDIM( NIDMAX ), INC( NINMAX ), KB( NKBMAX )+      LOGICAL            LTEST( NSUBS )+      CHARACTER*6        SNAMES( NSUBS )+*     .. External Functions ..+      REAL               SDIFF+      LOGICAL            LCE+      EXTERNAL           SDIFF, LCE+*     .. External Subroutines ..+      EXTERNAL           CCHK1, CCHK2, CCHK3, CCHK4, CCHK5, CCHK6,+     $                   CCHKE, CMVCH+*     .. Intrinsic Functions ..+      INTRINSIC          ABS, MAX, MIN+*     .. Scalars in Common ..+      INTEGER            INFOT, NOUTC+      LOGICAL            LERR, OK+      CHARACTER*6        SRNAMT+*     .. Common blocks ..+      COMMON             /INFOC/INFOT, NOUTC, OK, LERR+      COMMON             /SRNAMC/SRNAMT+*     .. Data statements ..+      DATA               SNAMES/'CGEMV ', 'CGBMV ', 'CHEMV ', 'CHBMV ',+     $                   'CHPMV ', 'CTRMV ', 'CTBMV ', 'CTPMV ',+     $                   'CTRSV ', 'CTBSV ', 'CTPSV ', 'CGERC ',+     $                   'CGERU ', 'CHER  ', 'CHPR  ', 'CHER2 ',+     $                   'CHPR2 '/+*     .. Executable Statements ..+*+*     Read name and unit number for summary output file and open file.+*+      READ( NIN, FMT = * )SUMMRY+      READ( NIN, FMT = * )NOUT+      OPEN( NOUT, FILE = SUMMRY, STATUS = 'UNKNOWN' )+      NOUTC = NOUT+*+*     Read name and unit number for snapshot output file and open file.+*+      READ( NIN, FMT = * )SNAPS+      READ( NIN, FMT = * )NTRA+      TRACE = NTRA.GE.0+      IF( TRACE )THEN+         OPEN( NTRA, FILE = SNAPS, STATUS = 'UNKNOWN' )+      END IF+*     Read the flag that directs rewinding of the snapshot file.+      READ( NIN, FMT = * )REWI+      REWI = REWI.AND.TRACE+*     Read the flag that directs stopping on any failure.+      READ( NIN, FMT = * )SFATAL+*     Read the flag that indicates whether error exits are to be tested.+      READ( NIN, FMT = * )TSTERR+*     Read the threshold value of the test ratio+      READ( NIN, FMT = * )THRESH+*+*     Read and check the parameter values for the tests.+*+*     Values of N+      READ( NIN, FMT = * )NIDIM+      IF( NIDIM.LT.1.OR.NIDIM.GT.NIDMAX )THEN+         WRITE( NOUT, FMT = 9997 )'N', NIDMAX+         GO TO 230+      END IF+      READ( NIN, FMT = * )( IDIM( I ), I = 1, NIDIM )+      DO 10 I = 1, NIDIM+         IF( IDIM( I ).LT.0.OR.IDIM( I ).GT.NMAX )THEN+            WRITE( NOUT, FMT = 9996 )NMAX+            GO TO 230+         END IF+   10 CONTINUE+*     Values of K+      READ( NIN, FMT = * )NKB+      IF( NKB.LT.1.OR.NKB.GT.NKBMAX )THEN+         WRITE( NOUT, FMT = 9997 )'K', NKBMAX+         GO TO 230+      END IF+      READ( NIN, FMT = * )( KB( I ), I = 1, NKB )+      DO 20 I = 1, NKB+         IF( KB( I ).LT.0 )THEN+            WRITE( NOUT, FMT = 9995 )+            GO TO 230+         END IF+   20 CONTINUE+*     Values of INCX and INCY+      READ( NIN, FMT = * )NINC+      IF( NINC.LT.1.OR.NINC.GT.NINMAX )THEN+         WRITE( NOUT, FMT = 9997 )'INCX AND INCY', NINMAX+         GO TO 230+      END IF+      READ( NIN, FMT = * )( INC( I ), I = 1, NINC )+      DO 30 I = 1, NINC+         IF( INC( I ).EQ.0.OR.ABS( INC( I ) ).GT.INCMAX )THEN+            WRITE( NOUT, FMT = 9994 )INCMAX+            GO TO 230+         END IF+   30 CONTINUE+*     Values of ALPHA+      READ( NIN, FMT = * )NALF+      IF( NALF.LT.1.OR.NALF.GT.NALMAX )THEN+         WRITE( NOUT, FMT = 9997 )'ALPHA', NALMAX+         GO TO 230+      END IF+      READ( NIN, FMT = * )( ALF( I ), I = 1, NALF )+*     Values of BETA+      READ( NIN, FMT = * )NBET+      IF( NBET.LT.1.OR.NBET.GT.NBEMAX )THEN+         WRITE( NOUT, FMT = 9997 )'BETA', NBEMAX+         GO TO 230+      END IF+      READ( NIN, FMT = * )( BET( I ), I = 1, NBET )+*+*     Report values of parameters.+*+      WRITE( NOUT, FMT = 9993 )+      WRITE( NOUT, FMT = 9992 )( IDIM( I ), I = 1, NIDIM )+      WRITE( NOUT, FMT = 9991 )( KB( I ), I = 1, NKB )+      WRITE( NOUT, FMT = 9990 )( INC( I ), I = 1, NINC )+      WRITE( NOUT, FMT = 9989 )( ALF( I ), I = 1, NALF )+      WRITE( NOUT, FMT = 9988 )( BET( I ), I = 1, NBET )+      IF( .NOT.TSTERR )THEN+         WRITE( NOUT, FMT = * )+         WRITE( NOUT, FMT = 9980 )+      END IF+      WRITE( NOUT, FMT = * )+      WRITE( NOUT, FMT = 9999 )THRESH+      WRITE( NOUT, FMT = * )+*+*     Read names of subroutines and flags which indicate+*     whether they are to be tested.+*+      DO 40 I = 1, NSUBS+         LTEST( I ) = .FALSE.+   40 CONTINUE+   50 READ( NIN, FMT = 9984, END = 80 )SNAMET, LTESTT+      DO 60 I = 1, NSUBS+         IF( SNAMET.EQ.SNAMES( I ) )+     $      GO TO 70+   60 CONTINUE+      WRITE( NOUT, FMT = 9986 )SNAMET+      STOP+   70 LTEST( I ) = LTESTT+      GO TO 50+*+   80 CONTINUE+      CLOSE ( NIN )+*+*     Compute EPS (the machine precision).+*+      EPS = EPSILON(RZERO)+      WRITE( NOUT, FMT = 9998 )EPS+*+*     Check the reliability of CMVCH using exact data.+*+      N = MIN( 32, NMAX )+      DO 120 J = 1, N+         DO 110 I = 1, N+            A( I, J ) = MAX( I - J + 1, 0 )+  110    CONTINUE+         X( J ) = J+         Y( J ) = ZERO+  120 CONTINUE+      DO 130 J = 1, N+         YY( J ) = J*( ( J + 1 )*J )/2 - ( ( J + 1 )*J*( J - 1 ) )/3+  130 CONTINUE+*     YY holds the exact result. On exit from CMVCH YT holds+*     the result computed by CMVCH.+      TRANS = 'N'+      CALL CMVCH( TRANS, N, N, ONE, A, NMAX, X, 1, ZERO, Y, 1, YT, G,+     $            YY, EPS, ERR, FATAL, NOUT, .TRUE. )+      SAME = LCE( YY, YT, N )+      IF( .NOT.SAME.OR.ERR.NE.RZERO )THEN+         WRITE( NOUT, FMT = 9985 )TRANS, SAME, ERR+         STOP+      END IF+      TRANS = 'T'+      CALL CMVCH( TRANS, N, N, ONE, A, NMAX, X, -1, ZERO, Y, -1, YT, G,+     $            YY, EPS, ERR, FATAL, NOUT, .TRUE. )+      SAME = LCE( YY, YT, N )+      IF( .NOT.SAME.OR.ERR.NE.RZERO )THEN+         WRITE( NOUT, FMT = 9985 )TRANS, SAME, ERR+         STOP+      END IF+*+*     Test each subroutine in turn.+*+      DO 210 ISNUM = 1, NSUBS+         WRITE( NOUT, FMT = * )+         IF( .NOT.LTEST( ISNUM ) )THEN+*           Subprogram is not to be tested.+            WRITE( NOUT, FMT = 9983 )SNAMES( ISNUM )+         ELSE+            SRNAMT = SNAMES( ISNUM )+*           Test error exits.+            IF( TSTERR )THEN+               CALL CCHKE( ISNUM, SNAMES( ISNUM ), NOUT )+               WRITE( NOUT, FMT = * )+            END IF+*           Test computations.+            INFOT = 0+            OK = .TRUE.+            FATAL = .FALSE.+            GO TO ( 140, 140, 150, 150, 150, 160, 160,+     $              160, 160, 160, 160, 170, 170, 180,+     $              180, 190, 190 )ISNUM+*           Test CGEMV, 01, and CGBMV, 02.+  140       CALL CCHK1( SNAMES( ISNUM ), EPS, THRESH, NOUT, NTRA, TRACE,+     $                  REWI, FATAL, NIDIM, IDIM, NKB, KB, NALF, ALF,+     $                  NBET, BET, NINC, INC, NMAX, INCMAX, A, AA, AS,+     $                  X, XX, XS, Y, YY, YS, YT, G )+            GO TO 200+*           Test CHEMV, 03, CHBMV, 04, and CHPMV, 05.+  150       CALL CCHK2( SNAMES( ISNUM ), EPS, THRESH, NOUT, NTRA, TRACE,+     $                  REWI, FATAL, NIDIM, IDIM, NKB, KB, NALF, ALF,+     $                  NBET, BET, NINC, INC, NMAX, INCMAX, A, AA, AS,+     $                  X, XX, XS, Y, YY, YS, YT, G )+            GO TO 200+*           Test CTRMV, 06, CTBMV, 07, CTPMV, 08,+*           CTRSV, 09, CTBSV, 10, and CTPSV, 11.+  160       CALL CCHK3( SNAMES( ISNUM ), EPS, THRESH, NOUT, NTRA, TRACE,+     $                  REWI, FATAL, NIDIM, IDIM, NKB, KB, NINC, INC,+     $                  NMAX, INCMAX, A, AA, AS, Y, YY, YS, YT, G, Z )+            GO TO 200+*           Test CGERC, 12, CGERU, 13.+  170       CALL CCHK4( SNAMES( ISNUM ), EPS, THRESH, NOUT, NTRA, TRACE,+     $                  REWI, FATAL, NIDIM, IDIM, NALF, ALF, NINC, INC,+     $                  NMAX, INCMAX, A, AA, AS, X, XX, XS, Y, YY, YS,+     $                  YT, G, Z )+            GO TO 200+*           Test CHER, 14, and CHPR, 15.+  180       CALL CCHK5( SNAMES( ISNUM ), EPS, THRESH, NOUT, NTRA, TRACE,+     $                  REWI, FATAL, NIDIM, IDIM, NALF, ALF, NINC, INC,+     $                  NMAX, INCMAX, A, AA, AS, X, XX, XS, Y, YY, YS,+     $                  YT, G, Z )+            GO TO 200+*           Test CHER2, 16, and CHPR2, 17.+  190       CALL CCHK6( SNAMES( ISNUM ), EPS, THRESH, NOUT, NTRA, TRACE,+     $                  REWI, FATAL, NIDIM, IDIM, NALF, ALF, NINC, INC,+     $                  NMAX, INCMAX, A, AA, AS, X, XX, XS, Y, YY, YS,+     $                  YT, G, Z )+*+  200       IF( FATAL.AND.SFATAL )+     $         GO TO 220+         END IF+  210 CONTINUE+      WRITE( NOUT, FMT = 9982 )+      GO TO 240+*+  220 CONTINUE+      WRITE( NOUT, FMT = 9981 )+      GO TO 240+*+  230 CONTINUE+      WRITE( NOUT, FMT = 9987 )+*+  240 CONTINUE+      IF( TRACE )+     $   CLOSE ( NTRA )+      CLOSE ( NOUT )+      STOP+*+ 9999 FORMAT( ' ROUTINES PASS COMPUTATIONAL TESTS IF TEST RATIO IS LES',+     $      'S THAN', F8.2 )+ 9998 FORMAT( ' RELATIVE MACHINE PRECISION IS TAKEN TO BE', 1P, E9.1 )+ 9997 FORMAT( ' NUMBER OF VALUES OF ', A, ' IS LESS THAN 1 OR GREATER ',+     $      'THAN ', I2 )+ 9996 FORMAT( ' VALUE OF N IS LESS THAN 0 OR GREATER THAN ', I2 )+ 9995 FORMAT( ' VALUE OF K IS LESS THAN 0' )+ 9994 FORMAT( ' ABSOLUTE VALUE OF INCX OR INCY IS 0 OR GREATER THAN ',+     $      I2 )+ 9993 FORMAT( ' TESTS OF THE COMPLEX          LEVEL 2 BLAS', //' THE F',+     $      'OLLOWING PARAMETER VALUES WILL BE USED:' )+ 9992 FORMAT( '   FOR N              ', 9I6 )+ 9991 FORMAT( '   FOR K              ', 7I6 )+ 9990 FORMAT( '   FOR INCX AND INCY  ', 7I6 )+ 9989 FORMAT( '   FOR ALPHA          ',+     $      7( '(', F4.1, ',', F4.1, ')  ', : ) )+ 9988 FORMAT( '   FOR BETA           ',+     $      7( '(', F4.1, ',', F4.1, ')  ', : ) )+ 9987 FORMAT( ' AMEND DATA FILE OR INCREASE ARRAY SIZES IN PROGRAM',+     $      /' ******* TESTS ABANDONED *******' )+ 9986 FORMAT( ' SUBPROGRAM NAME ', A6, ' NOT RECOGNIZED', /' ******* T',+     $      'ESTS ABANDONED *******' )+ 9985 FORMAT( ' ERROR IN CMVCH -  IN-LINE DOT PRODUCTS ARE BEING EVALU',+     $      'ATED WRONGLY.', /' CMVCH WAS CALLED WITH TRANS = ', A1,+     $      ' AND RETURNED SAME = ', L1, ' AND ERR = ', F12.3, '.', /+     $   ' THIS MAY BE DUE TO FAULTS IN THE ARITHMETIC OR THE COMPILER.'+     $      , /' ******* TESTS ABANDONED *******' )+ 9984 FORMAT( A6, L2 )+ 9983 FORMAT( 1X, A6, ' WAS NOT TESTED' )+ 9982 FORMAT( /' END OF TESTS' )+ 9981 FORMAT( /' ******* FATAL ERROR - TESTS ABANDONED *******' )+ 9980 FORMAT( ' ERROR-EXITS WILL NOT BE TESTED' )+*+*     End of CBLAT2.+*+      END+      SUBROUTINE CCHK1( SNAME, EPS, THRESH, NOUT, NTRA, TRACE, REWI,+     $                  FATAL, NIDIM, IDIM, NKB, KB, NALF, ALF, NBET,+     $                  BET, NINC, INC, NMAX, INCMAX, A, AA, AS, X, XX,+     $                  XS, Y, YY, YS, YT, G )+*+*  Tests CGEMV and CGBMV.+*+*  Auxiliary routine for test program for Level 2 Blas.+*+*  -- Written on 10-August-1987.+*     Richard Hanson, Sandia National Labs.+*     Jeremy Du Croz, NAG Central Office.+*+*     .. Parameters ..+      COMPLEX            ZERO, HALF+      PARAMETER          ( ZERO = ( 0.0, 0.0 ), HALF = ( 0.5, 0.0 ) )+      REAL               RZERO+      PARAMETER          ( RZERO = 0.0 )+*     .. Scalar Arguments ..+      REAL               EPS, THRESH+      INTEGER            INCMAX, NALF, NBET, NIDIM, NINC, NKB, NMAX,+     $                   NOUT, NTRA+      LOGICAL            FATAL, REWI, TRACE+      CHARACTER*6        SNAME+*     .. Array Arguments ..+      COMPLEX            A( NMAX, NMAX ), AA( NMAX*NMAX ), ALF( NALF ),+     $                   AS( NMAX*NMAX ), BET( NBET ), X( NMAX ),+     $                   XS( NMAX*INCMAX ), XX( NMAX*INCMAX ),+     $                   Y( NMAX ), YS( NMAX*INCMAX ), YT( NMAX ),+     $                   YY( NMAX*INCMAX )+      REAL               G( NMAX )+      INTEGER            IDIM( NIDIM ), INC( NINC ), KB( NKB )+*     .. Local Scalars ..+      COMPLEX            ALPHA, ALS, BETA, BLS, TRANSL+      REAL               ERR, ERRMAX+      INTEGER            I, IA, IB, IC, IKU, IM, IN, INCX, INCXS, INCY,+     $                   INCYS, IX, IY, KL, KLS, KU, KUS, LAA, LDA,+     $                   LDAS, LX, LY, M, ML, MS, N, NARGS, NC, ND, NK,+     $                   NL, NS+      LOGICAL            BANDED, FULL, NULL, RESET, SAME, TRAN+      CHARACTER*1        TRANS, TRANSS+      CHARACTER*3        ICH+*     .. Local Arrays ..+      LOGICAL            ISAME( 13 )+*     .. External Functions ..+      LOGICAL            LCE, LCERES+      EXTERNAL           LCE, LCERES+*     .. External Subroutines ..+      EXTERNAL           CGBMV, CGEMV, CMAKE, CMVCH+*     .. Intrinsic Functions ..+      INTRINSIC          ABS, MAX, MIN+*     .. Scalars in Common ..+      INTEGER            INFOT, NOUTC+      LOGICAL            LERR, OK+*     .. Common blocks ..+      COMMON             /INFOC/INFOT, NOUTC, OK, LERR+*     .. Data statements ..+      DATA               ICH/'NTC'/+*     .. Executable Statements ..+      FULL = SNAME( 3: 3 ).EQ.'E'+      BANDED = SNAME( 3: 3 ).EQ.'B'+*     Define the number of arguments.+      IF( FULL )THEN+         NARGS = 11+      ELSE IF( BANDED )THEN+         NARGS = 13+      END IF+*+      NC = 0+      RESET = .TRUE.+      ERRMAX = RZERO+*+      DO 120 IN = 1, NIDIM+         N = IDIM( IN )+         ND = N/2 + 1+*+         DO 110 IM = 1, 2+            IF( IM.EQ.1 )+     $         M = MAX( N - ND, 0 )+            IF( IM.EQ.2 )+     $         M = MIN( N + ND, NMAX )+*+            IF( BANDED )THEN+               NK = NKB+            ELSE+               NK = 1+            END IF+            DO 100 IKU = 1, NK+               IF( BANDED )THEN+                  KU = KB( IKU )+                  KL = MAX( KU - 1, 0 )+               ELSE+                  KU = N - 1+                  KL = M - 1+               END IF+*              Set LDA to 1 more than minimum value if room.+               IF( BANDED )THEN+                  LDA = KL + KU + 1+               ELSE+                  LDA = M+               END IF+               IF( LDA.LT.NMAX )+     $            LDA = LDA + 1+*              Skip tests if not enough room.+               IF( LDA.GT.NMAX )+     $            GO TO 100+               LAA = LDA*N+               NULL = N.LE.0.OR.M.LE.0+*+*              Generate the matrix A.+*+               TRANSL = ZERO+               CALL CMAKE( SNAME( 2: 3 ), ' ', ' ', M, N, A, NMAX, AA,+     $                     LDA, KL, KU, RESET, TRANSL )+*+               DO 90 IC = 1, 3+                  TRANS = ICH( IC: IC )+                  TRAN = TRANS.EQ.'T'.OR.TRANS.EQ.'C'+*+                  IF( TRAN )THEN+                     ML = N+                     NL = M+                  ELSE+                     ML = M+                     NL = N+                  END IF+*+                  DO 80 IX = 1, NINC+                     INCX = INC( IX )+                     LX = ABS( INCX )*NL+*+*                    Generate the vector X.+*+                     TRANSL = HALF+                     CALL CMAKE( 'GE', ' ', ' ', 1, NL, X, 1, XX,+     $                           ABS( INCX ), 0, NL - 1, RESET, TRANSL )+                     IF( NL.GT.1 )THEN+                        X( NL/2 ) = ZERO+                        XX( 1 + ABS( INCX )*( NL/2 - 1 ) ) = ZERO+                     END IF+*+                     DO 70 IY = 1, NINC+                        INCY = INC( IY )+                        LY = ABS( INCY )*ML+*+                        DO 60 IA = 1, NALF+                           ALPHA = ALF( IA )+*+                           DO 50 IB = 1, NBET+                              BETA = BET( IB )+*+*                             Generate the vector Y.+*+                              TRANSL = ZERO+                              CALL CMAKE( 'GE', ' ', ' ', 1, ML, Y, 1,+     $                                    YY, ABS( INCY ), 0, ML - 1,+     $                                    RESET, TRANSL )+*+                              NC = NC + 1+*+*                             Save every datum before calling the+*                             subroutine.+*+                              TRANSS = TRANS+                              MS = M+                              NS = N+                              KLS = KL+                              KUS = KU+                              ALS = ALPHA+                              DO 10 I = 1, LAA+                                 AS( I ) = AA( I )+   10                         CONTINUE+                              LDAS = LDA+                              DO 20 I = 1, LX+                                 XS( I ) = XX( I )+   20                         CONTINUE+                              INCXS = INCX+                              BLS = BETA+                              DO 30 I = 1, LY+                                 YS( I ) = YY( I )+   30                         CONTINUE+                              INCYS = INCY+*+*                             Call the subroutine.+*+                              IF( FULL )THEN+                                 IF( TRACE )+     $                              WRITE( NTRA, FMT = 9994 )NC, SNAME,+     $                              TRANS, M, N, ALPHA, LDA, INCX, BETA,+     $                              INCY+                                 IF( REWI )+     $                              REWIND NTRA+                                 CALL CGEMV( TRANS, M, N, ALPHA, AA,+     $                                       LDA, XX, INCX, BETA, YY,+     $                                       INCY )+                              ELSE IF( BANDED )THEN+                                 IF( TRACE )+     $                              WRITE( NTRA, FMT = 9995 )NC, SNAME,+     $                              TRANS, M, N, KL, KU, ALPHA, LDA,+     $                              INCX, BETA, INCY+                                 IF( REWI )+     $                              REWIND NTRA+                                 CALL CGBMV( TRANS, M, N, KL, KU, ALPHA,+     $                                       AA, LDA, XX, INCX, BETA,+     $                                       YY, INCY )+                              END IF+*+*                             Check if error-exit was taken incorrectly.+*+                              IF( .NOT.OK )THEN+                                 WRITE( NOUT, FMT = 9993 )+                                 FATAL = .TRUE.+                                 GO TO 130+                              END IF+*+*                             See what data changed inside subroutines.+*+                              ISAME( 1 ) = TRANS.EQ.TRANSS+                              ISAME( 2 ) = MS.EQ.M+                              ISAME( 3 ) = NS.EQ.N+                              IF( FULL )THEN+                                 ISAME( 4 ) = ALS.EQ.ALPHA+                                 ISAME( 5 ) = LCE( AS, AA, LAA )+                                 ISAME( 6 ) = LDAS.EQ.LDA+                                 ISAME( 7 ) = LCE( XS, XX, LX )+                                 ISAME( 8 ) = INCXS.EQ.INCX+                                 ISAME( 9 ) = BLS.EQ.BETA+                                 IF( NULL )THEN+                                    ISAME( 10 ) = LCE( YS, YY, LY )+                                 ELSE+                                    ISAME( 10 ) = LCERES( 'GE', ' ', 1,+     $                                            ML, YS, YY,+     $                                            ABS( INCY ) )+                                 END IF+                                 ISAME( 11 ) = INCYS.EQ.INCY+                              ELSE IF( BANDED )THEN+                                 ISAME( 4 ) = KLS.EQ.KL+                                 ISAME( 5 ) = KUS.EQ.KU+                                 ISAME( 6 ) = ALS.EQ.ALPHA+                                 ISAME( 7 ) = LCE( AS, AA, LAA )+                                 ISAME( 8 ) = LDAS.EQ.LDA+                                 ISAME( 9 ) = LCE( XS, XX, LX )+                                 ISAME( 10 ) = INCXS.EQ.INCX+                                 ISAME( 11 ) = BLS.EQ.BETA+                                 IF( NULL )THEN+                                    ISAME( 12 ) = LCE( YS, YY, LY )+                                 ELSE+                                    ISAME( 12 ) = LCERES( 'GE', ' ', 1,+     $                                            ML, YS, YY,+     $                                            ABS( INCY ) )+                                 END IF+                                 ISAME( 13 ) = INCYS.EQ.INCY+                              END IF+*+*                             If data was incorrectly changed, report+*                             and return.+*+                              SAME = .TRUE.+                              DO 40 I = 1, NARGS+                                 SAME = SAME.AND.ISAME( I )+                                 IF( .NOT.ISAME( I ) )+     $                              WRITE( NOUT, FMT = 9998 )I+   40                         CONTINUE+                              IF( .NOT.SAME )THEN+                                 FATAL = .TRUE.+                                 GO TO 130+                              END IF+*+                              IF( .NOT.NULL )THEN+*+*                                Check the result.+*+                                 CALL CMVCH( TRANS, M, N, ALPHA, A,+     $                                       NMAX, X, INCX, BETA, Y,+     $                                       INCY, YT, G, YY, EPS, ERR,+     $                                       FATAL, NOUT, .TRUE. )+                                 ERRMAX = MAX( ERRMAX, ERR )+*                                If got really bad answer, report and+*                                return.+                                 IF( FATAL )+     $                              GO TO 130+                              ELSE+*                                Avoid repeating tests with M.le.0 or+*                                N.le.0.+                                 GO TO 110+                              END IF+*+   50                      CONTINUE+*+   60                   CONTINUE+*+   70                CONTINUE+*+   80             CONTINUE+*+   90          CONTINUE+*+  100       CONTINUE+*+  110    CONTINUE+*+  120 CONTINUE+*+*     Report result.+*+      IF( ERRMAX.LT.THRESH )THEN+         WRITE( NOUT, FMT = 9999 )SNAME, NC+      ELSE+         WRITE( NOUT, FMT = 9997 )SNAME, NC, ERRMAX+      END IF+      GO TO 140+*+  130 CONTINUE+      WRITE( NOUT, FMT = 9996 )SNAME+      IF( FULL )THEN+         WRITE( NOUT, FMT = 9994 )NC, SNAME, TRANS, M, N, ALPHA, LDA,+     $      INCX, BETA, INCY+      ELSE IF( BANDED )THEN+         WRITE( NOUT, FMT = 9995 )NC, SNAME, TRANS, M, N, KL, KU,+     $      ALPHA, LDA, INCX, BETA, INCY+      END IF+*+  140 CONTINUE+      RETURN+*+ 9999 FORMAT( ' ', A6, ' PASSED THE COMPUTATIONAL TESTS (', I6, ' CALL',+     $      'S)' )+ 9998 FORMAT( ' ******* FATAL ERROR - PARAMETER NUMBER ', I2, ' WAS CH',+     $      'ANGED INCORRECTLY *******' )+ 9997 FORMAT( ' ', A6, ' COMPLETED THE COMPUTATIONAL TESTS (', I6, ' C',+     $      'ALLS)', /' ******* BUT WITH MAXIMUM TEST RATIO', F8.2,+     $      ' - SUSPECT *******' )+ 9996 FORMAT( ' ******* ', A6, ' FAILED ON CALL NUMBER:' )+ 9995 FORMAT( 1X, I6, ': ', A6, '(''', A1, ''',', 4( I3, ',' ), '(',+     $      F4.1, ',', F4.1, '), A,', I3, ', X,', I2, ',(', F4.1, ',',+     $      F4.1, '), Y,', I2, ') .' )+ 9994 FORMAT( 1X, I6, ': ', A6, '(''', A1, ''',', 2( I3, ',' ), '(',+     $      F4.1, ',', F4.1, '), A,', I3, ', X,', I2, ',(', F4.1, ',',+     $      F4.1, '), Y,', I2, ')         .' )+ 9993 FORMAT( ' ******* FATAL ERROR - ERROR-EXIT TAKEN ON VALID CALL *',+     $      '******' )+*+*     End of CCHK1.+*+      END+      SUBROUTINE CCHK2( SNAME, EPS, THRESH, NOUT, NTRA, TRACE, REWI,+     $                  FATAL, NIDIM, IDIM, NKB, KB, NALF, ALF, NBET,+     $                  BET, NINC, INC, NMAX, INCMAX, A, AA, AS, X, XX,+     $                  XS, Y, YY, YS, YT, G )+*+*  Tests CHEMV, CHBMV and CHPMV.+*+*  Auxiliary routine for test program for Level 2 Blas.+*+*  -- Written on 10-August-1987.+*     Richard Hanson, Sandia National Labs.+*     Jeremy Du Croz, NAG Central Office.+*+*     .. Parameters ..+      COMPLEX            ZERO, HALF+      PARAMETER          ( ZERO = ( 0.0, 0.0 ), HALF = ( 0.5, 0.0 ) )+      REAL               RZERO+      PARAMETER          ( RZERO = 0.0 )+*     .. Scalar Arguments ..+      REAL               EPS, THRESH+      INTEGER            INCMAX, NALF, NBET, NIDIM, NINC, NKB, NMAX,+     $                   NOUT, NTRA+      LOGICAL            FATAL, REWI, TRACE+      CHARACTER*6        SNAME+*     .. Array Arguments ..+      COMPLEX            A( NMAX, NMAX ), AA( NMAX*NMAX ), ALF( NALF ),+     $                   AS( NMAX*NMAX ), BET( NBET ), X( NMAX ),+     $                   XS( NMAX*INCMAX ), XX( NMAX*INCMAX ),+     $                   Y( NMAX ), YS( NMAX*INCMAX ), YT( NMAX ),+     $                   YY( NMAX*INCMAX )+      REAL               G( NMAX )+      INTEGER            IDIM( NIDIM ), INC( NINC ), KB( NKB )+*     .. Local Scalars ..+      COMPLEX            ALPHA, ALS, BETA, BLS, TRANSL+      REAL               ERR, ERRMAX+      INTEGER            I, IA, IB, IC, IK, IN, INCX, INCXS, INCY,+     $                   INCYS, IX, IY, K, KS, LAA, LDA, LDAS, LX, LY,+     $                   N, NARGS, NC, NK, NS+      LOGICAL            BANDED, FULL, NULL, PACKED, RESET, SAME+      CHARACTER*1        UPLO, UPLOS+      CHARACTER*2        ICH+*     .. Local Arrays ..+      LOGICAL            ISAME( 13 )+*     .. External Functions ..+      LOGICAL            LCE, LCERES+      EXTERNAL           LCE, LCERES+*     .. External Subroutines ..+      EXTERNAL           CHBMV, CHEMV, CHPMV, CMAKE, CMVCH+*     .. Intrinsic Functions ..+      INTRINSIC          ABS, MAX+*     .. Scalars in Common ..+      INTEGER            INFOT, NOUTC+      LOGICAL            LERR, OK+*     .. Common blocks ..+      COMMON             /INFOC/INFOT, NOUTC, OK, LERR+*     .. Data statements ..+      DATA               ICH/'UL'/+*     .. Executable Statements ..+      FULL = SNAME( 3: 3 ).EQ.'E'+      BANDED = SNAME( 3: 3 ).EQ.'B'+      PACKED = SNAME( 3: 3 ).EQ.'P'+*     Define the number of arguments.+      IF( FULL )THEN+         NARGS = 10+      ELSE IF( BANDED )THEN+         NARGS = 11+      ELSE IF( PACKED )THEN+         NARGS = 9+      END IF+*+      NC = 0+      RESET = .TRUE.+      ERRMAX = RZERO+*+      DO 110 IN = 1, NIDIM+         N = IDIM( IN )+*+         IF( BANDED )THEN+            NK = NKB+         ELSE+            NK = 1+         END IF+         DO 100 IK = 1, NK+            IF( BANDED )THEN+               K = KB( IK )+            ELSE+               K = N - 1+            END IF+*           Set LDA to 1 more than minimum value if room.+            IF( BANDED )THEN+               LDA = K + 1+            ELSE+               LDA = N+            END IF+            IF( LDA.LT.NMAX )+     $         LDA = LDA + 1+*           Skip tests if not enough room.+            IF( LDA.GT.NMAX )+     $         GO TO 100+            IF( PACKED )THEN+               LAA = ( N*( N + 1 ) )/2+            ELSE+               LAA = LDA*N+            END IF+            NULL = N.LE.0+*+            DO 90 IC = 1, 2+               UPLO = ICH( IC: IC )+*+*              Generate the matrix A.+*+               TRANSL = ZERO+               CALL CMAKE( SNAME( 2: 3 ), UPLO, ' ', N, N, A, NMAX, AA,+     $                     LDA, K, K, RESET, TRANSL )+*+               DO 80 IX = 1, NINC+                  INCX = INC( IX )+                  LX = ABS( INCX )*N+*+*                 Generate the vector X.+*+                  TRANSL = HALF+                  CALL CMAKE( 'GE', ' ', ' ', 1, N, X, 1, XX,+     $                        ABS( INCX ), 0, N - 1, RESET, TRANSL )+                  IF( N.GT.1 )THEN+                     X( N/2 ) = ZERO+                     XX( 1 + ABS( INCX )*( N/2 - 1 ) ) = ZERO+                  END IF+*+                  DO 70 IY = 1, NINC+                     INCY = INC( IY )+                     LY = ABS( INCY )*N+*+                     DO 60 IA = 1, NALF+                        ALPHA = ALF( IA )+*+                        DO 50 IB = 1, NBET+                           BETA = BET( IB )+*+*                          Generate the vector Y.+*+                           TRANSL = ZERO+                           CALL CMAKE( 'GE', ' ', ' ', 1, N, Y, 1, YY,+     $                                 ABS( INCY ), 0, N - 1, RESET,+     $                                 TRANSL )+*+                           NC = NC + 1+*+*                          Save every datum before calling the+*                          subroutine.+*+                           UPLOS = UPLO+                           NS = N+                           KS = K+                           ALS = ALPHA+                           DO 10 I = 1, LAA+                              AS( I ) = AA( I )+   10                      CONTINUE+                           LDAS = LDA+                           DO 20 I = 1, LX+                              XS( I ) = XX( I )+   20                      CONTINUE+                           INCXS = INCX+                           BLS = BETA+                           DO 30 I = 1, LY+                              YS( I ) = YY( I )+   30                      CONTINUE+                           INCYS = INCY+*+*                          Call the subroutine.+*+                           IF( FULL )THEN+                              IF( TRACE )+     $                           WRITE( NTRA, FMT = 9993 )NC, SNAME,+     $                           UPLO, N, ALPHA, LDA, INCX, BETA, INCY+                              IF( REWI )+     $                           REWIND NTRA+                              CALL CHEMV( UPLO, N, ALPHA, AA, LDA, XX,+     $                                    INCX, BETA, YY, INCY )+                           ELSE IF( BANDED )THEN+                              IF( TRACE )+     $                           WRITE( NTRA, FMT = 9994 )NC, SNAME,+     $                           UPLO, N, K, ALPHA, LDA, INCX, BETA,+     $                           INCY+                              IF( REWI )+     $                           REWIND NTRA+                              CALL CHBMV( UPLO, N, K, ALPHA, AA, LDA,+     $                                    XX, INCX, BETA, YY, INCY )+                           ELSE IF( PACKED )THEN+                              IF( TRACE )+     $                           WRITE( NTRA, FMT = 9995 )NC, SNAME,+     $                           UPLO, N, ALPHA, INCX, BETA, INCY+                              IF( REWI )+     $                           REWIND NTRA+                              CALL CHPMV( UPLO, N, ALPHA, AA, XX, INCX,+     $                                    BETA, YY, INCY )+                           END IF+*+*                          Check if error-exit was taken incorrectly.+*+                           IF( .NOT.OK )THEN+                              WRITE( NOUT, FMT = 9992 )+                              FATAL = .TRUE.+                              GO TO 120+                           END IF+*+*                          See what data changed inside subroutines.+*+                           ISAME( 1 ) = UPLO.EQ.UPLOS+                           ISAME( 2 ) = NS.EQ.N+                           IF( FULL )THEN+                              ISAME( 3 ) = ALS.EQ.ALPHA+                              ISAME( 4 ) = LCE( AS, AA, LAA )+                              ISAME( 5 ) = LDAS.EQ.LDA+                              ISAME( 6 ) = LCE( XS, XX, LX )+                              ISAME( 7 ) = INCXS.EQ.INCX+                              ISAME( 8 ) = BLS.EQ.BETA+                              IF( NULL )THEN+                                 ISAME( 9 ) = LCE( YS, YY, LY )+                              ELSE+                                 ISAME( 9 ) = LCERES( 'GE', ' ', 1, N,+     $                                        YS, YY, ABS( INCY ) )+                              END IF+                              ISAME( 10 ) = INCYS.EQ.INCY+                           ELSE IF( BANDED )THEN+                              ISAME( 3 ) = KS.EQ.K+                              ISAME( 4 ) = ALS.EQ.ALPHA+                              ISAME( 5 ) = LCE( AS, AA, LAA )+                              ISAME( 6 ) = LDAS.EQ.LDA+                              ISAME( 7 ) = LCE( XS, XX, LX )+                              ISAME( 8 ) = INCXS.EQ.INCX+                              ISAME( 9 ) = BLS.EQ.BETA+                              IF( NULL )THEN+                                 ISAME( 10 ) = LCE( YS, YY, LY )+                              ELSE+                                 ISAME( 10 ) = LCERES( 'GE', ' ', 1, N,+     $                                         YS, YY, ABS( INCY ) )+                              END IF+                              ISAME( 11 ) = INCYS.EQ.INCY+                           ELSE IF( PACKED )THEN+                              ISAME( 3 ) = ALS.EQ.ALPHA+                              ISAME( 4 ) = LCE( AS, AA, LAA )+                              ISAME( 5 ) = LCE( XS, XX, LX )+                              ISAME( 6 ) = INCXS.EQ.INCX+                              ISAME( 7 ) = BLS.EQ.BETA+                              IF( NULL )THEN+                                 ISAME( 8 ) = LCE( YS, YY, LY )+                              ELSE+                                 ISAME( 8 ) = LCERES( 'GE', ' ', 1, N,+     $                                        YS, YY, ABS( INCY ) )+                              END IF+                              ISAME( 9 ) = INCYS.EQ.INCY+                           END IF+*+*                          If data was incorrectly changed, report and+*                          return.+*+                           SAME = .TRUE.+                           DO 40 I = 1, NARGS+                              SAME = SAME.AND.ISAME( I )+                              IF( .NOT.ISAME( I ) )+     $                           WRITE( NOUT, FMT = 9998 )I+   40                      CONTINUE+                           IF( .NOT.SAME )THEN+                              FATAL = .TRUE.+                              GO TO 120+                           END IF+*+                           IF( .NOT.NULL )THEN+*+*                             Check the result.+*+                              CALL CMVCH( 'N', N, N, ALPHA, A, NMAX, X,+     $                                    INCX, BETA, Y, INCY, YT, G,+     $                                    YY, EPS, ERR, FATAL, NOUT,+     $                                    .TRUE. )+                              ERRMAX = MAX( ERRMAX, ERR )+*                             If got really bad answer, report and+*                             return.+                              IF( FATAL )+     $                           GO TO 120+                           ELSE+*                             Avoid repeating tests with N.le.0+                              GO TO 110+                           END IF+*+   50                   CONTINUE+*+   60                CONTINUE+*+   70             CONTINUE+*+   80          CONTINUE+*+   90       CONTINUE+*+  100    CONTINUE+*+  110 CONTINUE+*+*     Report result.+*+      IF( ERRMAX.LT.THRESH )THEN+         WRITE( NOUT, FMT = 9999 )SNAME, NC+      ELSE+         WRITE( NOUT, FMT = 9997 )SNAME, NC, ERRMAX+      END IF+      GO TO 130+*+  120 CONTINUE+      WRITE( NOUT, FMT = 9996 )SNAME+      IF( FULL )THEN+         WRITE( NOUT, FMT = 9993 )NC, SNAME, UPLO, N, ALPHA, LDA, INCX,+     $      BETA, INCY+      ELSE IF( BANDED )THEN+         WRITE( NOUT, FMT = 9994 )NC, SNAME, UPLO, N, K, ALPHA, LDA,+     $      INCX, BETA, INCY+      ELSE IF( PACKED )THEN+         WRITE( NOUT, FMT = 9995 )NC, SNAME, UPLO, N, ALPHA, INCX,+     $      BETA, INCY+      END IF+*+  130 CONTINUE+      RETURN+*+ 9999 FORMAT( ' ', A6, ' PASSED THE COMPUTATIONAL TESTS (', I6, ' CALL',+     $      'S)' )+ 9998 FORMAT( ' ******* FATAL ERROR - PARAMETER NUMBER ', I2, ' WAS CH',+     $      'ANGED INCORRECTLY *******' )+ 9997 FORMAT( ' ', A6, ' COMPLETED THE COMPUTATIONAL TESTS (', I6, ' C',+     $      'ALLS)', /' ******* BUT WITH MAXIMUM TEST RATIO', F8.2,+     $      ' - SUSPECT *******' )+ 9996 FORMAT( ' ******* ', A6, ' FAILED ON CALL NUMBER:' )+ 9995 FORMAT( 1X, I6, ': ', A6, '(''', A1, ''',', I3, ',(', F4.1, ',',+     $      F4.1, '), AP, X,', I2, ',(', F4.1, ',', F4.1, '), Y,', I2,+     $      ')                .' )+ 9994 FORMAT( 1X, I6, ': ', A6, '(''', A1, ''',', 2( I3, ',' ), '(',+     $      F4.1, ',', F4.1, '), A,', I3, ', X,', I2, ',(', F4.1, ',',+     $      F4.1, '), Y,', I2, ')         .' )+ 9993 FORMAT( 1X, I6, ': ', A6, '(''', A1, ''',', I3, ',(', F4.1, ',',+     $      F4.1, '), A,', I3, ', X,', I2, ',(', F4.1, ',', F4.1, '), ',+     $      'Y,', I2, ')             .' )+ 9992 FORMAT( ' ******* FATAL ERROR - ERROR-EXIT TAKEN ON VALID CALL *',+     $      '******' )+*+*     End of CCHK2.+*+      END+      SUBROUTINE CCHK3( SNAME, EPS, THRESH, NOUT, NTRA, TRACE, REWI,+     $                  FATAL, NIDIM, IDIM, NKB, KB, NINC, INC, NMAX,+     $                  INCMAX, A, AA, AS, X, XX, XS, XT, G, Z )+*+*  Tests CTRMV, CTBMV, CTPMV, CTRSV, CTBSV and CTPSV.+*+*  Auxiliary routine for test program for Level 2 Blas.+*+*  -- Written on 10-August-1987.+*     Richard Hanson, Sandia National Labs.+*     Jeremy Du Croz, NAG Central Office.+*+*     .. Parameters ..+      COMPLEX            ZERO, HALF, ONE+      PARAMETER          ( ZERO = ( 0.0, 0.0 ), HALF = ( 0.5, 0.0 ),+     $                   ONE = ( 1.0, 0.0 ) )+      REAL               RZERO+      PARAMETER          ( RZERO = 0.0 )+*     .. Scalar Arguments ..+      REAL               EPS, THRESH+      INTEGER            INCMAX, NIDIM, NINC, NKB, NMAX, NOUT, NTRA+      LOGICAL            FATAL, REWI, TRACE+      CHARACTER*6        SNAME+*     .. Array Arguments ..+      COMPLEX            A( NMAX, NMAX ), AA( NMAX*NMAX ),+     $                   AS( NMAX*NMAX ), X( NMAX ), XS( NMAX*INCMAX ),+     $                   XT( NMAX ), XX( NMAX*INCMAX ), Z( NMAX )+      REAL               G( NMAX )+      INTEGER            IDIM( NIDIM ), INC( NINC ), KB( NKB )+*     .. Local Scalars ..+      COMPLEX            TRANSL+      REAL               ERR, ERRMAX+      INTEGER            I, ICD, ICT, ICU, IK, IN, INCX, INCXS, IX, K,+     $                   KS, LAA, LDA, LDAS, LX, N, NARGS, NC, NK, NS+      LOGICAL            BANDED, FULL, NULL, PACKED, RESET, SAME+      CHARACTER*1        DIAG, DIAGS, TRANS, TRANSS, UPLO, UPLOS+      CHARACTER*2        ICHD, ICHU+      CHARACTER*3        ICHT+*     .. Local Arrays ..+      LOGICAL            ISAME( 13 )+*     .. External Functions ..+      LOGICAL            LCE, LCERES+      EXTERNAL           LCE, LCERES+*     .. External Subroutines ..+      EXTERNAL           CMAKE, CMVCH, CTBMV, CTBSV, CTPMV, CTPSV,+     $                   CTRMV, CTRSV+*     .. Intrinsic Functions ..+      INTRINSIC          ABS, MAX+*     .. Scalars in Common ..+      INTEGER            INFOT, NOUTC+      LOGICAL            LERR, OK+*     .. Common blocks ..+      COMMON             /INFOC/INFOT, NOUTC, OK, LERR+*     .. Data statements ..+      DATA               ICHU/'UL'/, ICHT/'NTC'/, ICHD/'UN'/+*     .. Executable Statements ..+      FULL = SNAME( 3: 3 ).EQ.'R'+      BANDED = SNAME( 3: 3 ).EQ.'B'+      PACKED = SNAME( 3: 3 ).EQ.'P'+*     Define the number of arguments.+      IF( FULL )THEN+         NARGS = 8+      ELSE IF( BANDED )THEN+         NARGS = 9+      ELSE IF( PACKED )THEN+         NARGS = 7+      END IF+*+      NC = 0+      RESET = .TRUE.+      ERRMAX = RZERO+*     Set up zero vector for CMVCH.+      DO 10 I = 1, NMAX+         Z( I ) = ZERO+   10 CONTINUE+*+      DO 110 IN = 1, NIDIM+         N = IDIM( IN )+*+         IF( BANDED )THEN+            NK = NKB+         ELSE+            NK = 1+         END IF+         DO 100 IK = 1, NK+            IF( BANDED )THEN+               K = KB( IK )+            ELSE+               K = N - 1+            END IF+*           Set LDA to 1 more than minimum value if room.+            IF( BANDED )THEN+               LDA = K + 1+            ELSE+               LDA = N+            END IF+            IF( LDA.LT.NMAX )+     $         LDA = LDA + 1+*           Skip tests if not enough room.+            IF( LDA.GT.NMAX )+     $         GO TO 100+            IF( PACKED )THEN+               LAA = ( N*( N + 1 ) )/2+            ELSE+               LAA = LDA*N+            END IF+            NULL = N.LE.0+*+            DO 90 ICU = 1, 2+               UPLO = ICHU( ICU: ICU )+*+               DO 80 ICT = 1, 3+                  TRANS = ICHT( ICT: ICT )+*+                  DO 70 ICD = 1, 2+                     DIAG = ICHD( ICD: ICD )+*+*                    Generate the matrix A.+*+                     TRANSL = ZERO+                     CALL CMAKE( SNAME( 2: 3 ), UPLO, DIAG, N, N, A,+     $                           NMAX, AA, LDA, K, K, RESET, TRANSL )+*+                     DO 60 IX = 1, NINC+                        INCX = INC( IX )+                        LX = ABS( INCX )*N+*+*                       Generate the vector X.+*+                        TRANSL = HALF+                        CALL CMAKE( 'GE', ' ', ' ', 1, N, X, 1, XX,+     $                              ABS( INCX ), 0, N - 1, RESET,+     $                              TRANSL )+                        IF( N.GT.1 )THEN+                           X( N/2 ) = ZERO+                           XX( 1 + ABS( INCX )*( N/2 - 1 ) ) = ZERO+                        END IF+*+                        NC = NC + 1+*+*                       Save every datum before calling the subroutine.+*+                        UPLOS = UPLO+                        TRANSS = TRANS+                        DIAGS = DIAG+                        NS = N+                        KS = K+                        DO 20 I = 1, LAA+                           AS( I ) = AA( I )+   20                   CONTINUE+                        LDAS = LDA+                        DO 30 I = 1, LX+                           XS( I ) = XX( I )+   30                   CONTINUE+                        INCXS = INCX+*+*                       Call the subroutine.+*+                        IF( SNAME( 4: 5 ).EQ.'MV' )THEN+                           IF( FULL )THEN+                              IF( TRACE )+     $                           WRITE( NTRA, FMT = 9993 )NC, SNAME,+     $                           UPLO, TRANS, DIAG, N, LDA, INCX+                              IF( REWI )+     $                           REWIND NTRA+                              CALL CTRMV( UPLO, TRANS, DIAG, N, AA, LDA,+     $                                    XX, INCX )+                           ELSE IF( BANDED )THEN+                              IF( TRACE )+     $                           WRITE( NTRA, FMT = 9994 )NC, SNAME,+     $                           UPLO, TRANS, DIAG, N, K, LDA, INCX+                              IF( REWI )+     $                           REWIND NTRA+                              CALL CTBMV( UPLO, TRANS, DIAG, N, K, AA,+     $                                    LDA, XX, INCX )+                           ELSE IF( PACKED )THEN+                              IF( TRACE )+     $                           WRITE( NTRA, FMT = 9995 )NC, SNAME,+     $                           UPLO, TRANS, DIAG, N, INCX+                              IF( REWI )+     $                           REWIND NTRA+                              CALL CTPMV( UPLO, TRANS, DIAG, N, AA, XX,+     $                                    INCX )+                           END IF+                        ELSE IF( SNAME( 4: 5 ).EQ.'SV' )THEN+                           IF( FULL )THEN+                              IF( TRACE )+     $                           WRITE( NTRA, FMT = 9993 )NC, SNAME,+     $                           UPLO, TRANS, DIAG, N, LDA, INCX+                              IF( REWI )+     $                           REWIND NTRA+                              CALL CTRSV( UPLO, TRANS, DIAG, N, AA, LDA,+     $                                    XX, INCX )+                           ELSE IF( BANDED )THEN+                              IF( TRACE )+     $                           WRITE( NTRA, FMT = 9994 )NC, SNAME,+     $                           UPLO, TRANS, DIAG, N, K, LDA, INCX+                              IF( REWI )+     $                           REWIND NTRA+                              CALL CTBSV( UPLO, TRANS, DIAG, N, K, AA,+     $                                    LDA, XX, INCX )+                           ELSE IF( PACKED )THEN+                              IF( TRACE )+     $                           WRITE( NTRA, FMT = 9995 )NC, SNAME,+     $                           UPLO, TRANS, DIAG, N, INCX+                              IF( REWI )+     $                           REWIND NTRA+                              CALL CTPSV( UPLO, TRANS, DIAG, N, AA, XX,+     $                                    INCX )+                           END IF+                        END IF+*+*                       Check if error-exit was taken incorrectly.+*+                        IF( .NOT.OK )THEN+                           WRITE( NOUT, FMT = 9992 )+                           FATAL = .TRUE.+                           GO TO 120+                        END IF+*+*                       See what data changed inside subroutines.+*+                        ISAME( 1 ) = UPLO.EQ.UPLOS+                        ISAME( 2 ) = TRANS.EQ.TRANSS+                        ISAME( 3 ) = DIAG.EQ.DIAGS+                        ISAME( 4 ) = NS.EQ.N+                        IF( FULL )THEN+                           ISAME( 5 ) = LCE( AS, AA, LAA )+                           ISAME( 6 ) = LDAS.EQ.LDA+                           IF( NULL )THEN+                              ISAME( 7 ) = LCE( XS, XX, LX )+                           ELSE+                              ISAME( 7 ) = LCERES( 'GE', ' ', 1, N, XS,+     $                                     XX, ABS( INCX ) )+                           END IF+                           ISAME( 8 ) = INCXS.EQ.INCX+                        ELSE IF( BANDED )THEN+                           ISAME( 5 ) = KS.EQ.K+                           ISAME( 6 ) = LCE( AS, AA, LAA )+                           ISAME( 7 ) = LDAS.EQ.LDA+                           IF( NULL )THEN+                              ISAME( 8 ) = LCE( XS, XX, LX )+                           ELSE+                              ISAME( 8 ) = LCERES( 'GE', ' ', 1, N, XS,+     $                                     XX, ABS( INCX ) )+                           END IF+                           ISAME( 9 ) = INCXS.EQ.INCX+                        ELSE IF( PACKED )THEN+                           ISAME( 5 ) = LCE( AS, AA, LAA )+                           IF( NULL )THEN+                              ISAME( 6 ) = LCE( XS, XX, LX )+                           ELSE+                              ISAME( 6 ) = LCERES( 'GE', ' ', 1, N, XS,+     $                                     XX, ABS( INCX ) )+                           END IF+                           ISAME( 7 ) = INCXS.EQ.INCX+                        END IF+*+*                       If data was incorrectly changed, report and+*                       return.+*+                        SAME = .TRUE.+                        DO 40 I = 1, NARGS+                           SAME = SAME.AND.ISAME( I )+                           IF( .NOT.ISAME( I ) )+     $                        WRITE( NOUT, FMT = 9998 )I+   40                   CONTINUE+                        IF( .NOT.SAME )THEN+                           FATAL = .TRUE.+                           GO TO 120+                        END IF+*+                        IF( .NOT.NULL )THEN+                           IF( SNAME( 4: 5 ).EQ.'MV' )THEN+*+*                             Check the result.+*+                              CALL CMVCH( TRANS, N, N, ONE, A, NMAX, X,+     $                                    INCX, ZERO, Z, INCX, XT, G,+     $                                    XX, EPS, ERR, FATAL, NOUT,+     $                                    .TRUE. )+                           ELSE IF( SNAME( 4: 5 ).EQ.'SV' )THEN+*+*                             Compute approximation to original vector.+*+                              DO 50 I = 1, N+                                 Z( I ) = XX( 1 + ( I - 1 )*+     $                                    ABS( INCX ) )+                                 XX( 1 + ( I - 1 )*ABS( INCX ) )+     $                              = X( I )+   50                         CONTINUE+                              CALL CMVCH( TRANS, N, N, ONE, A, NMAX, Z,+     $                                    INCX, ZERO, X, INCX, XT, G,+     $                                    XX, EPS, ERR, FATAL, NOUT,+     $                                    .FALSE. )+                           END IF+                           ERRMAX = MAX( ERRMAX, ERR )+*                          If got really bad answer, report and return.+                           IF( FATAL )+     $                        GO TO 120+                        ELSE+*                          Avoid repeating tests with N.le.0.+                           GO TO 110+                        END IF+*+   60                CONTINUE+*+   70             CONTINUE+*+   80          CONTINUE+*+   90       CONTINUE+*+  100    CONTINUE+*+  110 CONTINUE+*+*     Report result.+*+      IF( ERRMAX.LT.THRESH )THEN+         WRITE( NOUT, FMT = 9999 )SNAME, NC+      ELSE+         WRITE( NOUT, FMT = 9997 )SNAME, NC, ERRMAX+      END IF+      GO TO 130+*+  120 CONTINUE+      WRITE( NOUT, FMT = 9996 )SNAME+      IF( FULL )THEN+         WRITE( NOUT, FMT = 9993 )NC, SNAME, UPLO, TRANS, DIAG, N, LDA,+     $      INCX+      ELSE IF( BANDED )THEN+         WRITE( NOUT, FMT = 9994 )NC, SNAME, UPLO, TRANS, DIAG, N, K,+     $      LDA, INCX+      ELSE IF( PACKED )THEN+         WRITE( NOUT, FMT = 9995 )NC, SNAME, UPLO, TRANS, DIAG, N, INCX+      END IF+*+  130 CONTINUE+      RETURN+*+ 9999 FORMAT( ' ', A6, ' PASSED THE COMPUTATIONAL TESTS (', I6, ' CALL',+     $      'S)' )+ 9998 FORMAT( ' ******* FATAL ERROR - PARAMETER NUMBER ', I2, ' WAS CH',+     $      'ANGED INCORRECTLY *******' )+ 9997 FORMAT( ' ', A6, ' COMPLETED THE COMPUTATIONAL TESTS (', I6, ' C',+     $      'ALLS)', /' ******* BUT WITH MAXIMUM TEST RATIO', F8.2,+     $      ' - SUSPECT *******' )+ 9996 FORMAT( ' ******* ', A6, ' FAILED ON CALL NUMBER:' )+ 9995 FORMAT( 1X, I6, ': ', A6, '(', 3( '''', A1, ''',' ), I3, ', AP, ',+     $      'X,', I2, ')                                      .' )+ 9994 FORMAT( 1X, I6, ': ', A6, '(', 3( '''', A1, ''',' ), 2( I3, ',' ),+     $      ' A,', I3, ', X,', I2, ')                               .' )+ 9993 FORMAT( 1X, I6, ': ', A6, '(', 3( '''', A1, ''',' ), I3, ', A,',+     $      I3, ', X,', I2, ')                                   .' )+ 9992 FORMAT( ' ******* FATAL ERROR - ERROR-EXIT TAKEN ON VALID CALL *',+     $      '******' )+*+*     End of CCHK3.+*+      END+      SUBROUTINE CCHK4( SNAME, EPS, THRESH, NOUT, NTRA, TRACE, REWI,+     $                  FATAL, NIDIM, IDIM, NALF, ALF, NINC, INC, NMAX,+     $                  INCMAX, A, AA, AS, X, XX, XS, Y, YY, YS, YT, G,+     $                  Z )+*+*  Tests CGERC and CGERU.+*+*  Auxiliary routine for test program for Level 2 Blas.+*+*  -- Written on 10-August-1987.+*     Richard Hanson, Sandia National Labs.+*     Jeremy Du Croz, NAG Central Office.+*+*     .. Parameters ..+      COMPLEX            ZERO, HALF, ONE+      PARAMETER          ( ZERO = ( 0.0, 0.0 ), HALF = ( 0.5, 0.0 ),+     $                   ONE = ( 1.0, 0.0 ) )+      REAL               RZERO+      PARAMETER          ( RZERO = 0.0 )+*     .. Scalar Arguments ..+      REAL               EPS, THRESH+      INTEGER            INCMAX, NALF, NIDIM, NINC, NMAX, NOUT, NTRA+      LOGICAL            FATAL, REWI, TRACE+      CHARACTER*6        SNAME+*     .. Array Arguments ..+      COMPLEX            A( NMAX, NMAX ), AA( NMAX*NMAX ), ALF( NALF ),+     $                   AS( NMAX*NMAX ), X( NMAX ), XS( NMAX*INCMAX ),+     $                   XX( NMAX*INCMAX ), Y( NMAX ),+     $                   YS( NMAX*INCMAX ), YT( NMAX ),+     $                   YY( NMAX*INCMAX ), Z( NMAX )+      REAL               G( NMAX )+      INTEGER            IDIM( NIDIM ), INC( NINC )+*     .. Local Scalars ..+      COMPLEX            ALPHA, ALS, TRANSL+      REAL               ERR, ERRMAX+      INTEGER            I, IA, IM, IN, INCX, INCXS, INCY, INCYS, IX,+     $                   IY, J, LAA, LDA, LDAS, LX, LY, M, MS, N, NARGS,+     $                   NC, ND, NS+      LOGICAL            CONJ, NULL, RESET, SAME+*     .. Local Arrays ..+      COMPLEX            W( 1 )+      LOGICAL            ISAME( 13 )+*     .. External Functions ..+      LOGICAL            LCE, LCERES+      EXTERNAL           LCE, LCERES+*     .. External Subroutines ..+      EXTERNAL           CGERC, CGERU, CMAKE, CMVCH+*     .. Intrinsic Functions ..+      INTRINSIC          ABS, CONJG, MAX, MIN+*     .. Scalars in Common ..+      INTEGER            INFOT, NOUTC+      LOGICAL            LERR, OK+*     .. Common blocks ..+      COMMON             /INFOC/INFOT, NOUTC, OK, LERR+*     .. Executable Statements ..+      CONJ = SNAME( 5: 5 ).EQ.'C'+*     Define the number of arguments.+      NARGS = 9+*+      NC = 0+      RESET = .TRUE.+      ERRMAX = RZERO+*+      DO 120 IN = 1, NIDIM+         N = IDIM( IN )+         ND = N/2 + 1+*+         DO 110 IM = 1, 2+            IF( IM.EQ.1 )+     $         M = MAX( N - ND, 0 )+            IF( IM.EQ.2 )+     $         M = MIN( N + ND, NMAX )+*+*           Set LDA to 1 more than minimum value if room.+            LDA = M+            IF( LDA.LT.NMAX )+     $         LDA = LDA + 1+*           Skip tests if not enough room.+            IF( LDA.GT.NMAX )+     $         GO TO 110+            LAA = LDA*N+            NULL = N.LE.0.OR.M.LE.0+*+            DO 100 IX = 1, NINC+               INCX = INC( IX )+               LX = ABS( INCX )*M+*+*              Generate the vector X.+*+               TRANSL = HALF+               CALL CMAKE( 'GE', ' ', ' ', 1, M, X, 1, XX, ABS( INCX ),+     $                     0, M - 1, RESET, TRANSL )+               IF( M.GT.1 )THEN+                  X( M/2 ) = ZERO+                  XX( 1 + ABS( INCX )*( M/2 - 1 ) ) = ZERO+               END IF+*+               DO 90 IY = 1, NINC+                  INCY = INC( IY )+                  LY = ABS( INCY )*N+*+*                 Generate the vector Y.+*+                  TRANSL = ZERO+                  CALL CMAKE( 'GE', ' ', ' ', 1, N, Y, 1, YY,+     $                        ABS( INCY ), 0, N - 1, RESET, TRANSL )+                  IF( N.GT.1 )THEN+                     Y( N/2 ) = ZERO+                     YY( 1 + ABS( INCY )*( N/2 - 1 ) ) = ZERO+                  END IF+*+                  DO 80 IA = 1, NALF+                     ALPHA = ALF( IA )+*+*                    Generate the matrix A.+*+                     TRANSL = ZERO+                     CALL CMAKE( SNAME( 2: 3 ), ' ', ' ', M, N, A, NMAX,+     $                           AA, LDA, M - 1, N - 1, RESET, TRANSL )+*+                     NC = NC + 1+*+*                    Save every datum before calling the subroutine.+*+                     MS = M+                     NS = N+                     ALS = ALPHA+                     DO 10 I = 1, LAA+                        AS( I ) = AA( I )+   10                CONTINUE+                     LDAS = LDA+                     DO 20 I = 1, LX+                        XS( I ) = XX( I )+   20                CONTINUE+                     INCXS = INCX+                     DO 30 I = 1, LY+                        YS( I ) = YY( I )+   30                CONTINUE+                     INCYS = INCY+*+*                    Call the subroutine.+*+                     IF( TRACE )+     $                  WRITE( NTRA, FMT = 9994 )NC, SNAME, M, N,+     $                  ALPHA, INCX, INCY, LDA+                     IF( CONJ )THEN+                        IF( REWI )+     $                     REWIND NTRA+                        CALL CGERC( M, N, ALPHA, XX, INCX, YY, INCY, AA,+     $                              LDA )+                     ELSE+                        IF( REWI )+     $                     REWIND NTRA+                        CALL CGERU( M, N, ALPHA, XX, INCX, YY, INCY, AA,+     $                              LDA )+                     END IF+*+*                    Check if error-exit was taken incorrectly.+*+                     IF( .NOT.OK )THEN+                        WRITE( NOUT, FMT = 9993 )+                        FATAL = .TRUE.+                        GO TO 140+                     END IF+*+*                    See what data changed inside subroutine.+*+                     ISAME( 1 ) = MS.EQ.M+                     ISAME( 2 ) = NS.EQ.N+                     ISAME( 3 ) = ALS.EQ.ALPHA+                     ISAME( 4 ) = LCE( XS, XX, LX )+                     ISAME( 5 ) = INCXS.EQ.INCX+                     ISAME( 6 ) = LCE( YS, YY, LY )+                     ISAME( 7 ) = INCYS.EQ.INCY+                     IF( NULL )THEN+                        ISAME( 8 ) = LCE( AS, AA, LAA )+                     ELSE+                        ISAME( 8 ) = LCERES( 'GE', ' ', M, N, AS, AA,+     $                               LDA )+                     END IF+                     ISAME( 9 ) = LDAS.EQ.LDA+*+*                    If data was incorrectly changed, report and return.+*+                     SAME = .TRUE.+                     DO 40 I = 1, NARGS+                        SAME = SAME.AND.ISAME( I )+                        IF( .NOT.ISAME( I ) )+     $                     WRITE( NOUT, FMT = 9998 )I+   40                CONTINUE+                     IF( .NOT.SAME )THEN+                        FATAL = .TRUE.+                        GO TO 140+                     END IF+*+                     IF( .NOT.NULL )THEN+*+*                       Check the result column by column.+*+                        IF( INCX.GT.0 )THEN+                           DO 50 I = 1, M+                              Z( I ) = X( I )+   50                      CONTINUE+                        ELSE+                           DO 60 I = 1, M+                              Z( I ) = X( M - I + 1 )+   60                      CONTINUE+                        END IF+                        DO 70 J = 1, N+                           IF( INCY.GT.0 )THEN+                              W( 1 ) = Y( J )+                           ELSE+                              W( 1 ) = Y( N - J + 1 )+                           END IF+                           IF( CONJ )+     $                        W( 1 ) = CONJG( W( 1 ) )+                           CALL CMVCH( 'N', M, 1, ALPHA, Z, NMAX, W, 1,+     $                                 ONE, A( 1, J ), 1, YT, G,+     $                                 AA( 1 + ( J - 1 )*LDA ), EPS,+     $                                 ERR, FATAL, NOUT, .TRUE. )+                           ERRMAX = MAX( ERRMAX, ERR )+*                          If got really bad answer, report and return.+                           IF( FATAL )+     $                        GO TO 130+   70                   CONTINUE+                     ELSE+*                       Avoid repeating tests with M.le.0 or N.le.0.+                        GO TO 110+                     END IF+*+   80             CONTINUE+*+   90          CONTINUE+*+  100       CONTINUE+*+  110    CONTINUE+*+  120 CONTINUE+*+*     Report result.+*+      IF( ERRMAX.LT.THRESH )THEN+         WRITE( NOUT, FMT = 9999 )SNAME, NC+      ELSE+         WRITE( NOUT, FMT = 9997 )SNAME, NC, ERRMAX+      END IF+      GO TO 150+*+  130 CONTINUE+      WRITE( NOUT, FMT = 9995 )J+*+  140 CONTINUE+      WRITE( NOUT, FMT = 9996 )SNAME+      WRITE( NOUT, FMT = 9994 )NC, SNAME, M, N, ALPHA, INCX, INCY, LDA+*+  150 CONTINUE+      RETURN+*+ 9999 FORMAT( ' ', A6, ' PASSED THE COMPUTATIONAL TESTS (', I6, ' CALL',+     $      'S)' )+ 9998 FORMAT( ' ******* FATAL ERROR - PARAMETER NUMBER ', I2, ' WAS CH',+     $      'ANGED INCORRECTLY *******' )+ 9997 FORMAT( ' ', A6, ' COMPLETED THE COMPUTATIONAL TESTS (', I6, ' C',+     $      'ALLS)', /' ******* BUT WITH MAXIMUM TEST RATIO', F8.2,+     $      ' - SUSPECT *******' )+ 9996 FORMAT( ' ******* ', A6, ' FAILED ON CALL NUMBER:' )+ 9995 FORMAT( '      THESE ARE THE RESULTS FOR COLUMN ', I3 )+ 9994 FORMAT( 1X, I6, ': ', A6, '(', 2( I3, ',' ), '(', F4.1, ',', F4.1,+     $      '), X,', I2, ', Y,', I2, ', A,', I3, ')                   ',+     $      '      .' )+ 9993 FORMAT( ' ******* FATAL ERROR - ERROR-EXIT TAKEN ON VALID CALL *',+     $      '******' )+*+*     End of CCHK4.+*+      END+      SUBROUTINE CCHK5( SNAME, EPS, THRESH, NOUT, NTRA, TRACE, REWI,+     $                  FATAL, NIDIM, IDIM, NALF, ALF, NINC, INC, NMAX,+     $                  INCMAX, A, AA, AS, X, XX, XS, Y, YY, YS, YT, G,+     $                  Z )+*+*  Tests CHER and CHPR.+*+*  Auxiliary routine for test program for Level 2 Blas.+*+*  -- Written on 10-August-1987.+*     Richard Hanson, Sandia National Labs.+*     Jeremy Du Croz, NAG Central Office.+*+*     .. Parameters ..+      COMPLEX            ZERO, HALF, ONE+      PARAMETER          ( ZERO = ( 0.0, 0.0 ), HALF = ( 0.5, 0.0 ),+     $                   ONE = ( 1.0, 0.0 ) )+      REAL               RZERO+      PARAMETER          ( RZERO = 0.0 )+*     .. Scalar Arguments ..+      REAL               EPS, THRESH+      INTEGER            INCMAX, NALF, NIDIM, NINC, NMAX, NOUT, NTRA+      LOGICAL            FATAL, REWI, TRACE+      CHARACTER*6        SNAME+*     .. Array Arguments ..+      COMPLEX            A( NMAX, NMAX ), AA( NMAX*NMAX ), ALF( NALF ),+     $                   AS( NMAX*NMAX ), X( NMAX ), XS( NMAX*INCMAX ),+     $                   XX( NMAX*INCMAX ), Y( NMAX ),+     $                   YS( NMAX*INCMAX ), YT( NMAX ),+     $                   YY( NMAX*INCMAX ), Z( NMAX )+      REAL               G( NMAX )+      INTEGER            IDIM( NIDIM ), INC( NINC )+*     .. Local Scalars ..+      COMPLEX            ALPHA, TRANSL+      REAL               ERR, ERRMAX, RALPHA, RALS+      INTEGER            I, IA, IC, IN, INCX, INCXS, IX, J, JA, JJ, LAA,+     $                   LDA, LDAS, LJ, LX, N, NARGS, NC, NS+      LOGICAL            FULL, NULL, PACKED, RESET, SAME, UPPER+      CHARACTER*1        UPLO, UPLOS+      CHARACTER*2        ICH+*     .. Local Arrays ..+      COMPLEX            W( 1 )+      LOGICAL            ISAME( 13 )+*     .. External Functions ..+      LOGICAL            LCE, LCERES+      EXTERNAL           LCE, LCERES+*     .. External Subroutines ..+      EXTERNAL           CHER, CHPR, CMAKE, CMVCH+*     .. Intrinsic Functions ..+      INTRINSIC          ABS, CMPLX, CONJG, MAX, REAL+*     .. Scalars in Common ..+      INTEGER            INFOT, NOUTC+      LOGICAL            LERR, OK+*     .. Common blocks ..+      COMMON             /INFOC/INFOT, NOUTC, OK, LERR+*     .. Data statements ..+      DATA               ICH/'UL'/+*     .. Executable Statements ..+      FULL = SNAME( 3: 3 ).EQ.'E'+      PACKED = SNAME( 3: 3 ).EQ.'P'+*     Define the number of arguments.+      IF( FULL )THEN+         NARGS = 7+      ELSE IF( PACKED )THEN+         NARGS = 6+      END IF+*+      NC = 0+      RESET = .TRUE.+      ERRMAX = RZERO+*+      DO 100 IN = 1, NIDIM+         N = IDIM( IN )+*        Set LDA to 1 more than minimum value if room.+         LDA = N+         IF( LDA.LT.NMAX )+     $      LDA = LDA + 1+*        Skip tests if not enough room.+         IF( LDA.GT.NMAX )+     $      GO TO 100+         IF( PACKED )THEN+            LAA = ( N*( N + 1 ) )/2+         ELSE+            LAA = LDA*N+         END IF+*+         DO 90 IC = 1, 2+            UPLO = ICH( IC: IC )+            UPPER = UPLO.EQ.'U'+*+            DO 80 IX = 1, NINC+               INCX = INC( IX )+               LX = ABS( INCX )*N+*+*              Generate the vector X.+*+               TRANSL = HALF+               CALL CMAKE( 'GE', ' ', ' ', 1, N, X, 1, XX, ABS( INCX ),+     $                     0, N - 1, RESET, TRANSL )+               IF( N.GT.1 )THEN+                  X( N/2 ) = ZERO+                  XX( 1 + ABS( INCX )*( N/2 - 1 ) ) = ZERO+               END IF+*+               DO 70 IA = 1, NALF+                  RALPHA = REAL( ALF( IA ) )+                  ALPHA = CMPLX( RALPHA, RZERO )+                  NULL = N.LE.0.OR.RALPHA.EQ.RZERO+*+*                 Generate the matrix A.+*+                  TRANSL = ZERO+                  CALL CMAKE( SNAME( 2: 3 ), UPLO, ' ', N, N, A, NMAX,+     $                        AA, LDA, N - 1, N - 1, RESET, TRANSL )+*+                  NC = NC + 1+*+*                 Save every datum before calling the subroutine.+*+                  UPLOS = UPLO+                  NS = N+                  RALS = RALPHA+                  DO 10 I = 1, LAA+                     AS( I ) = AA( I )+   10             CONTINUE+                  LDAS = LDA+                  DO 20 I = 1, LX+                     XS( I ) = XX( I )+   20             CONTINUE+                  INCXS = INCX+*+*                 Call the subroutine.+*+                  IF( FULL )THEN+                     IF( TRACE )+     $                  WRITE( NTRA, FMT = 9993 )NC, SNAME, UPLO, N,+     $                  RALPHA, INCX, LDA+                     IF( REWI )+     $                  REWIND NTRA+                     CALL CHER( UPLO, N, RALPHA, XX, INCX, AA, LDA )+                  ELSE IF( PACKED )THEN+                     IF( TRACE )+     $                  WRITE( NTRA, FMT = 9994 )NC, SNAME, UPLO, N,+     $                  RALPHA, INCX+                     IF( REWI )+     $                  REWIND NTRA+                     CALL CHPR( UPLO, N, RALPHA, XX, INCX, AA )+                  END IF+*+*                 Check if error-exit was taken incorrectly.+*+                  IF( .NOT.OK )THEN+                     WRITE( NOUT, FMT = 9992 )+                     FATAL = .TRUE.+                     GO TO 120+                  END IF+*+*                 See what data changed inside subroutines.+*+                  ISAME( 1 ) = UPLO.EQ.UPLOS+                  ISAME( 2 ) = NS.EQ.N+                  ISAME( 3 ) = RALS.EQ.RALPHA+                  ISAME( 4 ) = LCE( XS, XX, LX )+                  ISAME( 5 ) = INCXS.EQ.INCX+                  IF( NULL )THEN+                     ISAME( 6 ) = LCE( AS, AA, LAA )+                  ELSE+                     ISAME( 6 ) = LCERES( SNAME( 2: 3 ), UPLO, N, N, AS,+     $                            AA, LDA )+                  END IF+                  IF( .NOT.PACKED )THEN+                     ISAME( 7 ) = LDAS.EQ.LDA+                  END IF+*+*                 If data was incorrectly changed, report and return.+*+                  SAME = .TRUE.+                  DO 30 I = 1, NARGS+                     SAME = SAME.AND.ISAME( I )+                     IF( .NOT.ISAME( I ) )+     $                  WRITE( NOUT, FMT = 9998 )I+   30             CONTINUE+                  IF( .NOT.SAME )THEN+                     FATAL = .TRUE.+                     GO TO 120+                  END IF+*+                  IF( .NOT.NULL )THEN+*+*                    Check the result column by column.+*+                     IF( INCX.GT.0 )THEN+                        DO 40 I = 1, N+                           Z( I ) = X( I )+   40                   CONTINUE+                     ELSE+                        DO 50 I = 1, N+                           Z( I ) = X( N - I + 1 )+   50                   CONTINUE+                     END IF+                     JA = 1+                     DO 60 J = 1, N+                        W( 1 ) = CONJG( Z( J ) )+                        IF( UPPER )THEN+                           JJ = 1+                           LJ = J+                        ELSE+                           JJ = J+                           LJ = N - J + 1+                        END IF+                        CALL CMVCH( 'N', LJ, 1, ALPHA, Z( JJ ), LJ, W,+     $                              1, ONE, A( JJ, J ), 1, YT, G,+     $                              AA( JA ), EPS, ERR, FATAL, NOUT,+     $                              .TRUE. )+                        IF( FULL )THEN+                           IF( UPPER )THEN+                              JA = JA + LDA+                           ELSE+                              JA = JA + LDA + 1+                           END IF+                        ELSE+                           JA = JA + LJ+                        END IF+                        ERRMAX = MAX( ERRMAX, ERR )+*                       If got really bad answer, report and return.+                        IF( FATAL )+     $                     GO TO 110+   60                CONTINUE+                  ELSE+*                    Avoid repeating tests if N.le.0.+                     IF( N.LE.0 )+     $                  GO TO 100+                  END IF+*+   70          CONTINUE+*+   80       CONTINUE+*+   90    CONTINUE+*+  100 CONTINUE+*+*     Report result.+*+      IF( ERRMAX.LT.THRESH )THEN+         WRITE( NOUT, FMT = 9999 )SNAME, NC+      ELSE+         WRITE( NOUT, FMT = 9997 )SNAME, NC, ERRMAX+      END IF+      GO TO 130+*+  110 CONTINUE+      WRITE( NOUT, FMT = 9995 )J+*+  120 CONTINUE+      WRITE( NOUT, FMT = 9996 )SNAME+      IF( FULL )THEN+         WRITE( NOUT, FMT = 9993 )NC, SNAME, UPLO, N, RALPHA, INCX, LDA+      ELSE IF( PACKED )THEN+         WRITE( NOUT, FMT = 9994 )NC, SNAME, UPLO, N, RALPHA, INCX+      END IF+*+  130 CONTINUE+      RETURN+*+ 9999 FORMAT( ' ', A6, ' PASSED THE COMPUTATIONAL TESTS (', I6, ' CALL',+     $      'S)' )+ 9998 FORMAT( ' ******* FATAL ERROR - PARAMETER NUMBER ', I2, ' WAS CH',+     $      'ANGED INCORRECTLY *******' )+ 9997 FORMAT( ' ', A6, ' COMPLETED THE COMPUTATIONAL TESTS (', I6, ' C',+     $      'ALLS)', /' ******* BUT WITH MAXIMUM TEST RATIO', F8.2,+     $      ' - SUSPECT *******' )+ 9996 FORMAT( ' ******* ', A6, ' FAILED ON CALL NUMBER:' )+ 9995 FORMAT( '      THESE ARE THE RESULTS FOR COLUMN ', I3 )+ 9994 FORMAT( 1X, I6, ': ', A6, '(''', A1, ''',', I3, ',', F4.1, ', X,',+     $      I2, ', AP)                                         .' )+ 9993 FORMAT( 1X, I6, ': ', A6, '(''', A1, ''',', I3, ',', F4.1, ', X,',+     $      I2, ', A,', I3, ')                                      .' )+ 9992 FORMAT( ' ******* FATAL ERROR - ERROR-EXIT TAKEN ON VALID CALL *',+     $      '******' )+*+*     End of CCHK5.+*+      END+      SUBROUTINE CCHK6( SNAME, EPS, THRESH, NOUT, NTRA, TRACE, REWI,+     $                  FATAL, NIDIM, IDIM, NALF, ALF, NINC, INC, NMAX,+     $                  INCMAX, A, AA, AS, X, XX, XS, Y, YY, YS, YT, G,+     $                  Z )+*+*  Tests CHER2 and CHPR2.+*+*  Auxiliary routine for test program for Level 2 Blas.+*+*  -- Written on 10-August-1987.+*     Richard Hanson, Sandia National Labs.+*     Jeremy Du Croz, NAG Central Office.+*+*     .. Parameters ..+      COMPLEX            ZERO, HALF, ONE+      PARAMETER          ( ZERO = ( 0.0, 0.0 ), HALF = ( 0.5, 0.0 ),+     $                   ONE = ( 1.0, 0.0 ) )+      REAL               RZERO+      PARAMETER          ( RZERO = 0.0 )+*     .. Scalar Arguments ..+      REAL               EPS, THRESH+      INTEGER            INCMAX, NALF, NIDIM, NINC, NMAX, NOUT, NTRA+      LOGICAL            FATAL, REWI, TRACE+      CHARACTER*6        SNAME+*     .. Array Arguments ..+      COMPLEX            A( NMAX, NMAX ), AA( NMAX*NMAX ), ALF( NALF ),+     $                   AS( NMAX*NMAX ), X( NMAX ), XS( NMAX*INCMAX ),+     $                   XX( NMAX*INCMAX ), Y( NMAX ),+     $                   YS( NMAX*INCMAX ), YT( NMAX ),+     $                   YY( NMAX*INCMAX ), Z( NMAX, 2 )+      REAL               G( NMAX )+      INTEGER            IDIM( NIDIM ), INC( NINC )+*     .. Local Scalars ..+      COMPLEX            ALPHA, ALS, TRANSL+      REAL               ERR, ERRMAX+      INTEGER            I, IA, IC, IN, INCX, INCXS, INCY, INCYS, IX,+     $                   IY, J, JA, JJ, LAA, LDA, LDAS, LJ, LX, LY, N,+     $                   NARGS, NC, NS+      LOGICAL            FULL, NULL, PACKED, RESET, SAME, UPPER+      CHARACTER*1        UPLO, UPLOS+      CHARACTER*2        ICH+*     .. Local Arrays ..+      COMPLEX            W( 2 )+      LOGICAL            ISAME( 13 )+*     .. External Functions ..+      LOGICAL            LCE, LCERES+      EXTERNAL           LCE, LCERES+*     .. External Subroutines ..+      EXTERNAL           CHER2, CHPR2, CMAKE, CMVCH+*     .. Intrinsic Functions ..+      INTRINSIC          ABS, CONJG, MAX+*     .. Scalars in Common ..+      INTEGER            INFOT, NOUTC+      LOGICAL            LERR, OK+*     .. Common blocks ..+      COMMON             /INFOC/INFOT, NOUTC, OK, LERR+*     .. Data statements ..+      DATA               ICH/'UL'/+*     .. Executable Statements ..+      FULL = SNAME( 3: 3 ).EQ.'E'+      PACKED = SNAME( 3: 3 ).EQ.'P'+*     Define the number of arguments.+      IF( FULL )THEN+         NARGS = 9+      ELSE IF( PACKED )THEN+         NARGS = 8+      END IF+*+      NC = 0+      RESET = .TRUE.+      ERRMAX = RZERO+*+      DO 140 IN = 1, NIDIM+         N = IDIM( IN )+*        Set LDA to 1 more than minimum value if room.+         LDA = N+         IF( LDA.LT.NMAX )+     $      LDA = LDA + 1+*        Skip tests if not enough room.+         IF( LDA.GT.NMAX )+     $      GO TO 140+         IF( PACKED )THEN+            LAA = ( N*( N + 1 ) )/2+         ELSE+            LAA = LDA*N+         END IF+*+         DO 130 IC = 1, 2+            UPLO = ICH( IC: IC )+            UPPER = UPLO.EQ.'U'+*+            DO 120 IX = 1, NINC+               INCX = INC( IX )+               LX = ABS( INCX )*N+*+*              Generate the vector X.+*+               TRANSL = HALF+               CALL CMAKE( 'GE', ' ', ' ', 1, N, X, 1, XX, ABS( INCX ),+     $                     0, N - 1, RESET, TRANSL )+               IF( N.GT.1 )THEN+                  X( N/2 ) = ZERO+                  XX( 1 + ABS( INCX )*( N/2 - 1 ) ) = ZERO+               END IF+*+               DO 110 IY = 1, NINC+                  INCY = INC( IY )+                  LY = ABS( INCY )*N+*+*                 Generate the vector Y.+*+                  TRANSL = ZERO+                  CALL CMAKE( 'GE', ' ', ' ', 1, N, Y, 1, YY,+     $                        ABS( INCY ), 0, N - 1, RESET, TRANSL )+                  IF( N.GT.1 )THEN+                     Y( N/2 ) = ZERO+                     YY( 1 + ABS( INCY )*( N/2 - 1 ) ) = ZERO+                  END IF+*+                  DO 100 IA = 1, NALF+                     ALPHA = ALF( IA )+                     NULL = N.LE.0.OR.ALPHA.EQ.ZERO+*+*                    Generate the matrix A.+*+                     TRANSL = ZERO+                     CALL CMAKE( SNAME( 2: 3 ), UPLO, ' ', N, N, A,+     $                           NMAX, AA, LDA, N - 1, N - 1, RESET,+     $                           TRANSL )+*+                     NC = NC + 1+*+*                    Save every datum before calling the subroutine.+*+                     UPLOS = UPLO+                     NS = N+                     ALS = ALPHA+                     DO 10 I = 1, LAA+                        AS( I ) = AA( I )+   10                CONTINUE+                     LDAS = LDA+                     DO 20 I = 1, LX+                        XS( I ) = XX( I )+   20                CONTINUE+                     INCXS = INCX+                     DO 30 I = 1, LY+                        YS( I ) = YY( I )+   30                CONTINUE+                     INCYS = INCY+*+*                    Call the subroutine.+*+                     IF( FULL )THEN+                        IF( TRACE )+     $                     WRITE( NTRA, FMT = 9993 )NC, SNAME, UPLO, N,+     $                     ALPHA, INCX, INCY, LDA+                        IF( REWI )+     $                     REWIND NTRA+                        CALL CHER2( UPLO, N, ALPHA, XX, INCX, YY, INCY,+     $                              AA, LDA )+                     ELSE IF( PACKED )THEN+                        IF( TRACE )+     $                     WRITE( NTRA, FMT = 9994 )NC, SNAME, UPLO, N,+     $                     ALPHA, INCX, INCY+                        IF( REWI )+     $                     REWIND NTRA+                        CALL CHPR2( UPLO, N, ALPHA, XX, INCX, YY, INCY,+     $                              AA )+                     END IF+*+*                    Check if error-exit was taken incorrectly.+*+                     IF( .NOT.OK )THEN+                        WRITE( NOUT, FMT = 9992 )+                        FATAL = .TRUE.+                        GO TO 160+                     END IF+*+*                    See what data changed inside subroutines.+*+                     ISAME( 1 ) = UPLO.EQ.UPLOS+                     ISAME( 2 ) = NS.EQ.N+                     ISAME( 3 ) = ALS.EQ.ALPHA+                     ISAME( 4 ) = LCE( XS, XX, LX )+                     ISAME( 5 ) = INCXS.EQ.INCX+                     ISAME( 6 ) = LCE( YS, YY, LY )+                     ISAME( 7 ) = INCYS.EQ.INCY+                     IF( NULL )THEN+                        ISAME( 8 ) = LCE( AS, AA, LAA )+                     ELSE+                        ISAME( 8 ) = LCERES( SNAME( 2: 3 ), UPLO, N, N,+     $                               AS, AA, LDA )+                     END IF+                     IF( .NOT.PACKED )THEN+                        ISAME( 9 ) = LDAS.EQ.LDA+                     END IF+*+*                    If data was incorrectly changed, report and return.+*+                     SAME = .TRUE.+                     DO 40 I = 1, NARGS+                        SAME = SAME.AND.ISAME( I )+                        IF( .NOT.ISAME( I ) )+     $                     WRITE( NOUT, FMT = 9998 )I+   40                CONTINUE+                     IF( .NOT.SAME )THEN+                        FATAL = .TRUE.+                        GO TO 160+                     END IF+*+                     IF( .NOT.NULL )THEN+*+*                       Check the result column by column.+*+                        IF( INCX.GT.0 )THEN+                           DO 50 I = 1, N+                              Z( I, 1 ) = X( I )+   50                      CONTINUE+                        ELSE+                           DO 60 I = 1, N+                              Z( I, 1 ) = X( N - I + 1 )+   60                      CONTINUE+                        END IF+                        IF( INCY.GT.0 )THEN+                           DO 70 I = 1, N+                              Z( I, 2 ) = Y( I )+   70                      CONTINUE+                        ELSE+                           DO 80 I = 1, N+                              Z( I, 2 ) = Y( N - I + 1 )+   80                      CONTINUE+                        END IF+                        JA = 1+                        DO 90 J = 1, N+                           W( 1 ) = ALPHA*CONJG( Z( J, 2 ) )+                           W( 2 ) = CONJG( ALPHA )*CONJG( Z( J, 1 ) )+                           IF( UPPER )THEN+                              JJ = 1+                              LJ = J+                           ELSE+                              JJ = J+                              LJ = N - J + 1+                           END IF+                           CALL CMVCH( 'N', LJ, 2, ONE, Z( JJ, 1 ),+     $                                 NMAX, W, 1, ONE, A( JJ, J ), 1,+     $                                 YT, G, AA( JA ), EPS, ERR, FATAL,+     $                                 NOUT, .TRUE. )+                           IF( FULL )THEN+                              IF( UPPER )THEN+                                 JA = JA + LDA+                              ELSE+                                 JA = JA + LDA + 1+                              END IF+                           ELSE+                              JA = JA + LJ+                           END IF+                           ERRMAX = MAX( ERRMAX, ERR )+*                          If got really bad answer, report and return.+                           IF( FATAL )+     $                        GO TO 150+   90                   CONTINUE+                     ELSE+*                       Avoid repeating tests with N.le.0.+                        IF( N.LE.0 )+     $                     GO TO 140+                     END IF+*+  100             CONTINUE+*+  110          CONTINUE+*+  120       CONTINUE+*+  130    CONTINUE+*+  140 CONTINUE+*+*     Report result.+*+      IF( ERRMAX.LT.THRESH )THEN+         WRITE( NOUT, FMT = 9999 )SNAME, NC+      ELSE+         WRITE( NOUT, FMT = 9997 )SNAME, NC, ERRMAX+      END IF+      GO TO 170+*+  150 CONTINUE+      WRITE( NOUT, FMT = 9995 )J+*+  160 CONTINUE+      WRITE( NOUT, FMT = 9996 )SNAME+      IF( FULL )THEN+         WRITE( NOUT, FMT = 9993 )NC, SNAME, UPLO, N, ALPHA, INCX,+     $      INCY, LDA+      ELSE IF( PACKED )THEN+         WRITE( NOUT, FMT = 9994 )NC, SNAME, UPLO, N, ALPHA, INCX, INCY+      END IF+*+  170 CONTINUE+      RETURN+*+ 9999 FORMAT( ' ', A6, ' PASSED THE COMPUTATIONAL TESTS (', I6, ' CALL',+     $      'S)' )+ 9998 FORMAT( ' ******* FATAL ERROR - PARAMETER NUMBER ', I2, ' WAS CH',+     $      'ANGED INCORRECTLY *******' )+ 9997 FORMAT( ' ', A6, ' COMPLETED THE COMPUTATIONAL TESTS (', I6, ' C',+     $      'ALLS)', /' ******* BUT WITH MAXIMUM TEST RATIO', F8.2,+     $      ' - SUSPECT *******' )+ 9996 FORMAT( ' ******* ', A6, ' FAILED ON CALL NUMBER:' )+ 9995 FORMAT( '      THESE ARE THE RESULTS FOR COLUMN ', I3 )+ 9994 FORMAT( 1X, I6, ': ', A6, '(''', A1, ''',', I3, ',(', F4.1, ',',+     $      F4.1, '), X,', I2, ', Y,', I2, ', AP)                     ',+     $      '       .' )+ 9993 FORMAT( 1X, I6, ': ', A6, '(''', A1, ''',', I3, ',(', F4.1, ',',+     $      F4.1, '), X,', I2, ', Y,', I2, ', A,', I3, ')             ',+     $      '            .' )+ 9992 FORMAT( ' ******* FATAL ERROR - ERROR-EXIT TAKEN ON VALID CALL *',+     $      '******' )+*+*     End of CCHK6.+*+      END+      SUBROUTINE CCHKE( ISNUM, SRNAMT, NOUT )+*+*  Tests the error exits from the Level 2 Blas.+*  Requires a special version of the error-handling routine XERBLA.+*  ALPHA, RALPHA, BETA, A, X and Y should not need to be defined.+*+*  Auxiliary routine for test program for Level 2 Blas.+*+*  -- Written on 10-August-1987.+*     Richard Hanson, Sandia National Labs.+*     Jeremy Du Croz, NAG Central Office.+*+*     .. Scalar Arguments ..+      INTEGER            ISNUM, NOUT+      CHARACTER*6        SRNAMT+*     .. Scalars in Common ..+      INTEGER            INFOT, NOUTC+      LOGICAL            LERR, OK+*     .. Local Scalars ..+      COMPLEX            ALPHA, BETA+      REAL               RALPHA+*     .. Local Arrays ..+      COMPLEX            A( 1, 1 ), X( 1 ), Y( 1 )+*     .. External Subroutines ..+      EXTERNAL           CGBMV, CGEMV, CGERC, CGERU, CHBMV, CHEMV, CHER,+     $                   CHER2, CHKXER, CHPMV, CHPR, CHPR2, CTBMV,+     $                   CTBSV, CTPMV, CTPSV, CTRMV, CTRSV+*     .. Common blocks ..+      COMMON             /INFOC/INFOT, NOUTC, OK, LERR+*     .. Executable Statements ..+*     OK is set to .FALSE. by the special version of XERBLA or by CHKXER+*     if anything is wrong.+      OK = .TRUE.+*     LERR is set to .TRUE. by the special version of XERBLA each time+*     it is called, and is then tested and re-set by CHKXER.+      LERR = .FALSE.+      GO TO ( 10, 20, 30, 40, 50, 60, 70, 80,+     $        90, 100, 110, 120, 130, 140, 150, 160,+     $        170 )ISNUM+   10 INFOT = 1+      CALL CGEMV( '/', 0, 0, ALPHA, A, 1, X, 1, BETA, Y, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 2+      CALL CGEMV( 'N', -1, 0, ALPHA, A, 1, X, 1, BETA, Y, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 3+      CALL CGEMV( 'N', 0, -1, ALPHA, A, 1, X, 1, BETA, Y, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 6+      CALL CGEMV( 'N', 2, 0, ALPHA, A, 1, X, 1, BETA, Y, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 8+      CALL CGEMV( 'N', 0, 0, ALPHA, A, 1, X, 0, BETA, Y, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 11+      CALL CGEMV( 'N', 0, 0, ALPHA, A, 1, X, 1, BETA, Y, 0 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      GO TO 180+   20 INFOT = 1+      CALL CGBMV( '/', 0, 0, 0, 0, ALPHA, A, 1, X, 1, BETA, Y, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 2+      CALL CGBMV( 'N', -1, 0, 0, 0, ALPHA, A, 1, X, 1, BETA, Y, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 3+      CALL CGBMV( 'N', 0, -1, 0, 0, ALPHA, A, 1, X, 1, BETA, Y, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 4+      CALL CGBMV( 'N', 0, 0, -1, 0, ALPHA, A, 1, X, 1, BETA, Y, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 5+      CALL CGBMV( 'N', 2, 0, 0, -1, ALPHA, A, 1, X, 1, BETA, Y, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 8+      CALL CGBMV( 'N', 0, 0, 1, 0, ALPHA, A, 1, X, 1, BETA, Y, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 10+      CALL CGBMV( 'N', 0, 0, 0, 0, ALPHA, A, 1, X, 0, BETA, Y, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 13+      CALL CGBMV( 'N', 0, 0, 0, 0, ALPHA, A, 1, X, 1, BETA, Y, 0 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      GO TO 180+   30 INFOT = 1+      CALL CHEMV( '/', 0, ALPHA, A, 1, X, 1, BETA, Y, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 2+      CALL CHEMV( 'U', -1, ALPHA, A, 1, X, 1, BETA, Y, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 5+      CALL CHEMV( 'U', 2, ALPHA, A, 1, X, 1, BETA, Y, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 7+      CALL CHEMV( 'U', 0, ALPHA, A, 1, X, 0, BETA, Y, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 10+      CALL CHEMV( 'U', 0, ALPHA, A, 1, X, 1, BETA, Y, 0 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      GO TO 180+   40 INFOT = 1+      CALL CHBMV( '/', 0, 0, ALPHA, A, 1, X, 1, BETA, Y, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 2+      CALL CHBMV( 'U', -1, 0, ALPHA, A, 1, X, 1, BETA, Y, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 3+      CALL CHBMV( 'U', 0, -1, ALPHA, A, 1, X, 1, BETA, Y, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 6+      CALL CHBMV( 'U', 0, 1, ALPHA, A, 1, X, 1, BETA, Y, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 8+      CALL CHBMV( 'U', 0, 0, ALPHA, A, 1, X, 0, BETA, Y, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 11+      CALL CHBMV( 'U', 0, 0, ALPHA, A, 1, X, 1, BETA, Y, 0 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      GO TO 180+   50 INFOT = 1+      CALL CHPMV( '/', 0, ALPHA, A, X, 1, BETA, Y, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 2+      CALL CHPMV( 'U', -1, ALPHA, A, X, 1, BETA, Y, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 6+      CALL CHPMV( 'U', 0, ALPHA, A, X, 0, BETA, Y, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 9+      CALL CHPMV( 'U', 0, ALPHA, A, X, 1, BETA, Y, 0 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      GO TO 180+   60 INFOT = 1+      CALL CTRMV( '/', 'N', 'N', 0, A, 1, X, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 2+      CALL CTRMV( 'U', '/', 'N', 0, A, 1, X, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 3+      CALL CTRMV( 'U', 'N', '/', 0, A, 1, X, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 4+      CALL CTRMV( 'U', 'N', 'N', -1, A, 1, X, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 6+      CALL CTRMV( 'U', 'N', 'N', 2, A, 1, X, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 8+      CALL CTRMV( 'U', 'N', 'N', 0, A, 1, X, 0 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      GO TO 180+   70 INFOT = 1+      CALL CTBMV( '/', 'N', 'N', 0, 0, A, 1, X, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 2+      CALL CTBMV( 'U', '/', 'N', 0, 0, A, 1, X, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 3+      CALL CTBMV( 'U', 'N', '/', 0, 0, A, 1, X, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 4+      CALL CTBMV( 'U', 'N', 'N', -1, 0, A, 1, X, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 5+      CALL CTBMV( 'U', 'N', 'N', 0, -1, A, 1, X, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 7+      CALL CTBMV( 'U', 'N', 'N', 0, 1, A, 1, X, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 9+      CALL CTBMV( 'U', 'N', 'N', 0, 0, A, 1, X, 0 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      GO TO 180+   80 INFOT = 1+      CALL CTPMV( '/', 'N', 'N', 0, A, X, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 2+      CALL CTPMV( 'U', '/', 'N', 0, A, X, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 3+      CALL CTPMV( 'U', 'N', '/', 0, A, X, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 4+      CALL CTPMV( 'U', 'N', 'N', -1, A, X, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 7+      CALL CTPMV( 'U', 'N', 'N', 0, A, X, 0 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      GO TO 180+   90 INFOT = 1+      CALL CTRSV( '/', 'N', 'N', 0, A, 1, X, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 2+      CALL CTRSV( 'U', '/', 'N', 0, A, 1, X, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 3+      CALL CTRSV( 'U', 'N', '/', 0, A, 1, X, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 4+      CALL CTRSV( 'U', 'N', 'N', -1, A, 1, X, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 6+      CALL CTRSV( 'U', 'N', 'N', 2, A, 1, X, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 8+      CALL CTRSV( 'U', 'N', 'N', 0, A, 1, X, 0 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      GO TO 180+  100 INFOT = 1+      CALL CTBSV( '/', 'N', 'N', 0, 0, A, 1, X, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 2+      CALL CTBSV( 'U', '/', 'N', 0, 0, A, 1, X, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 3+      CALL CTBSV( 'U', 'N', '/', 0, 0, A, 1, X, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 4+      CALL CTBSV( 'U', 'N', 'N', -1, 0, A, 1, X, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 5+      CALL CTBSV( 'U', 'N', 'N', 0, -1, A, 1, X, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 7+      CALL CTBSV( 'U', 'N', 'N', 0, 1, A, 1, X, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 9+      CALL CTBSV( 'U', 'N', 'N', 0, 0, A, 1, X, 0 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      GO TO 180+  110 INFOT = 1+      CALL CTPSV( '/', 'N', 'N', 0, A, X, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 2+      CALL CTPSV( 'U', '/', 'N', 0, A, X, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 3+      CALL CTPSV( 'U', 'N', '/', 0, A, X, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 4+      CALL CTPSV( 'U', 'N', 'N', -1, A, X, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 7+      CALL CTPSV( 'U', 'N', 'N', 0, A, X, 0 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      GO TO 180+  120 INFOT = 1+      CALL CGERC( -1, 0, ALPHA, X, 1, Y, 1, A, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 2+      CALL CGERC( 0, -1, ALPHA, X, 1, Y, 1, A, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 5+      CALL CGERC( 0, 0, ALPHA, X, 0, Y, 1, A, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 7+      CALL CGERC( 0, 0, ALPHA, X, 1, Y, 0, A, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 9+      CALL CGERC( 2, 0, ALPHA, X, 1, Y, 1, A, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      GO TO 180+  130 INFOT = 1+      CALL CGERU( -1, 0, ALPHA, X, 1, Y, 1, A, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 2+      CALL CGERU( 0, -1, ALPHA, X, 1, Y, 1, A, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 5+      CALL CGERU( 0, 0, ALPHA, X, 0, Y, 1, A, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 7+      CALL CGERU( 0, 0, ALPHA, X, 1, Y, 0, A, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 9+      CALL CGERU( 2, 0, ALPHA, X, 1, Y, 1, A, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      GO TO 180+  140 INFOT = 1+      CALL CHER( '/', 0, RALPHA, X, 1, A, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 2+      CALL CHER( 'U', -1, RALPHA, X, 1, A, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 5+      CALL CHER( 'U', 0, RALPHA, X, 0, A, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 7+      CALL CHER( 'U', 2, RALPHA, X, 1, A, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      GO TO 180+  150 INFOT = 1+      CALL CHPR( '/', 0, RALPHA, X, 1, A )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 2+      CALL CHPR( 'U', -1, RALPHA, X, 1, A )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 5+      CALL CHPR( 'U', 0, RALPHA, X, 0, A )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      GO TO 180+  160 INFOT = 1+      CALL CHER2( '/', 0, ALPHA, X, 1, Y, 1, A, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 2+      CALL CHER2( 'U', -1, ALPHA, X, 1, Y, 1, A, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 5+      CALL CHER2( 'U', 0, ALPHA, X, 0, Y, 1, A, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 7+      CALL CHER2( 'U', 0, ALPHA, X, 1, Y, 0, A, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 9+      CALL CHER2( 'U', 2, ALPHA, X, 1, Y, 1, A, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      GO TO 180+  170 INFOT = 1+      CALL CHPR2( '/', 0, ALPHA, X, 1, Y, 1, A )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 2+      CALL CHPR2( 'U', -1, ALPHA, X, 1, Y, 1, A )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 5+      CALL CHPR2( 'U', 0, ALPHA, X, 0, Y, 1, A )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 7+      CALL CHPR2( 'U', 0, ALPHA, X, 1, Y, 0, A )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+*+  180 IF( OK )THEN+         WRITE( NOUT, FMT = 9999 )SRNAMT+      ELSE+         WRITE( NOUT, FMT = 9998 )SRNAMT+      END IF+      RETURN+*+ 9999 FORMAT( ' ', A6, ' PASSED THE TESTS OF ERROR-EXITS' )+ 9998 FORMAT( ' ******* ', A6, ' FAILED THE TESTS OF ERROR-EXITS *****',+     $      '**' )+*+*     End of CCHKE.+*+      END+      SUBROUTINE CMAKE( TYPE, UPLO, DIAG, M, N, A, NMAX, AA, LDA, KL,+     $                  KU, RESET, TRANSL )+*+*  Generates values for an M by N matrix A within the bandwidth+*  defined by KL and KU.+*  Stores the values in the array AA in the data structure required+*  by the routine, with unwanted elements set to rogue value.+*+*  TYPE is 'GE', 'GB', 'HE', 'HB', 'HP', 'TR', 'TB' OR 'TP'.+*+*  Auxiliary routine for test program for Level 2 Blas.+*+*  -- Written on 10-August-1987.+*     Richard Hanson, Sandia National Labs.+*     Jeremy Du Croz, NAG Central Office.+*+*     .. Parameters ..+      COMPLEX            ZERO, ONE+      PARAMETER          ( ZERO = ( 0.0, 0.0 ), ONE = ( 1.0, 0.0 ) )+      COMPLEX            ROGUE+      PARAMETER          ( ROGUE = ( -1.0E10, 1.0E10 ) )+      REAL               RZERO+      PARAMETER          ( RZERO = 0.0 )+      REAL               RROGUE+      PARAMETER          ( RROGUE = -1.0E10 )+*     .. Scalar Arguments ..+      COMPLEX            TRANSL+      INTEGER            KL, KU, LDA, M, N, NMAX+      LOGICAL            RESET+      CHARACTER*1        DIAG, UPLO+      CHARACTER*2        TYPE+*     .. Array Arguments ..+      COMPLEX            A( NMAX, * ), AA( * )+*     .. Local Scalars ..+      INTEGER            I, I1, I2, I3, IBEG, IEND, IOFF, J, JJ, KK+      LOGICAL            GEN, LOWER, SYM, TRI, UNIT, UPPER+*     .. External Functions ..+      COMPLEX            CBEG+      EXTERNAL           CBEG+*     .. Intrinsic Functions ..+      INTRINSIC          CMPLX, CONJG, MAX, MIN, REAL+*     .. Executable Statements ..+      GEN = TYPE( 1: 1 ).EQ.'G'+      SYM = TYPE( 1: 1 ).EQ.'H'+      TRI = TYPE( 1: 1 ).EQ.'T'+      UPPER = ( SYM.OR.TRI ).AND.UPLO.EQ.'U'+      LOWER = ( SYM.OR.TRI ).AND.UPLO.EQ.'L'+      UNIT = TRI.AND.DIAG.EQ.'U'+*+*     Generate data in array A.+*+      DO 20 J = 1, N+         DO 10 I = 1, M+            IF( GEN.OR.( UPPER.AND.I.LE.J ).OR.( LOWER.AND.I.GE.J ) )+     $          THEN+               IF( ( I.LE.J.AND.J - I.LE.KU ).OR.+     $             ( I.GE.J.AND.I - J.LE.KL ) )THEN+                  A( I, J ) = CBEG( RESET ) + TRANSL+               ELSE+                  A( I, J ) = ZERO+               END IF+               IF( I.NE.J )THEN+                  IF( SYM )THEN+                     A( J, I ) = CONJG( A( I, J ) )+                  ELSE IF( TRI )THEN+                     A( J, I ) = ZERO+                  END IF+               END IF+            END IF+   10    CONTINUE+         IF( SYM )+     $      A( J, J ) = CMPLX( REAL( A( J, J ) ), RZERO )+         IF( TRI )+     $      A( J, J ) = A( J, J ) + ONE+         IF( UNIT )+     $      A( J, J ) = ONE+   20 CONTINUE+*+*     Store elements in array AS in data structure required by routine.+*+      IF( TYPE.EQ.'GE' )THEN+         DO 50 J = 1, N+            DO 30 I = 1, M+               AA( I + ( J - 1 )*LDA ) = A( I, J )+   30       CONTINUE+            DO 40 I = M + 1, LDA+               AA( I + ( J - 1 )*LDA ) = ROGUE+   40       CONTINUE+   50    CONTINUE+      ELSE IF( TYPE.EQ.'GB' )THEN+         DO 90 J = 1, N+            DO 60 I1 = 1, KU + 1 - J+               AA( I1 + ( J - 1 )*LDA ) = ROGUE+   60       CONTINUE+            DO 70 I2 = I1, MIN( KL + KU + 1, KU + 1 + M - J )+               AA( I2 + ( J - 1 )*LDA ) = A( I2 + J - KU - 1, J )+   70       CONTINUE+            DO 80 I3 = I2, LDA+               AA( I3 + ( J - 1 )*LDA ) = ROGUE+   80       CONTINUE+   90    CONTINUE+      ELSE IF( TYPE.EQ.'HE'.OR.TYPE.EQ.'TR' )THEN+         DO 130 J = 1, N+            IF( UPPER )THEN+               IBEG = 1+               IF( UNIT )THEN+                  IEND = J - 1+               ELSE+                  IEND = J+               END IF+            ELSE+               IF( UNIT )THEN+                  IBEG = J + 1+               ELSE+                  IBEG = J+               END IF+               IEND = N+            END IF+            DO 100 I = 1, IBEG - 1+               AA( I + ( J - 1 )*LDA ) = ROGUE+  100       CONTINUE+            DO 110 I = IBEG, IEND+               AA( I + ( J - 1 )*LDA ) = A( I, J )+  110       CONTINUE+            DO 120 I = IEND + 1, LDA+               AA( I + ( J - 1 )*LDA ) = ROGUE+  120       CONTINUE+            IF( SYM )THEN+               JJ = J + ( J - 1 )*LDA+               AA( JJ ) = CMPLX( REAL( AA( JJ ) ), RROGUE )+            END IF+  130    CONTINUE+      ELSE IF( TYPE.EQ.'HB'.OR.TYPE.EQ.'TB' )THEN+         DO 170 J = 1, N+            IF( UPPER )THEN+               KK = KL + 1+               IBEG = MAX( 1, KL + 2 - J )+               IF( UNIT )THEN+                  IEND = KL+               ELSE+                  IEND = KL + 1+               END IF+            ELSE+               KK = 1+               IF( UNIT )THEN+                  IBEG = 2+               ELSE+                  IBEG = 1+               END IF+               IEND = MIN( KL + 1, 1 + M - J )+            END IF+            DO 140 I = 1, IBEG - 1+               AA( I + ( J - 1 )*LDA ) = ROGUE+  140       CONTINUE+            DO 150 I = IBEG, IEND+               AA( I + ( J - 1 )*LDA ) = A( I + J - KK, J )+  150       CONTINUE+            DO 160 I = IEND + 1, LDA+               AA( I + ( J - 1 )*LDA ) = ROGUE+  160       CONTINUE+            IF( SYM )THEN+               JJ = KK + ( J - 1 )*LDA+               AA( JJ ) = CMPLX( REAL( AA( JJ ) ), RROGUE )+            END IF+  170    CONTINUE+      ELSE IF( TYPE.EQ.'HP'.OR.TYPE.EQ.'TP' )THEN+         IOFF = 0+         DO 190 J = 1, N+            IF( UPPER )THEN+               IBEG = 1+               IEND = J+            ELSE+               IBEG = J+               IEND = N+            END IF+            DO 180 I = IBEG, IEND+               IOFF = IOFF + 1+               AA( IOFF ) = A( I, J )+               IF( I.EQ.J )THEN+                  IF( UNIT )+     $               AA( IOFF ) = ROGUE+                  IF( SYM )+     $               AA( IOFF ) = CMPLX( REAL( AA( IOFF ) ), RROGUE )+               END IF+  180       CONTINUE+  190    CONTINUE+      END IF+      RETURN+*+*     End of CMAKE.+*+      END+      SUBROUTINE CMVCH( TRANS, M, N, ALPHA, A, NMAX, X, INCX, BETA, Y,+     $                  INCY, YT, G, YY, EPS, ERR, FATAL, NOUT, MV )+*+*  Checks the results of the computational tests.+*+*  Auxiliary routine for test program for Level 2 Blas.+*+*  -- Written on 10-August-1987.+*     Richard Hanson, Sandia National Labs.+*     Jeremy Du Croz, NAG Central Office.+*+*     .. Parameters ..+      COMPLEX            ZERO+      PARAMETER          ( ZERO = ( 0.0, 0.0 ) )+      REAL               RZERO, RONE+      PARAMETER          ( RZERO = 0.0, RONE = 1.0 )+*     .. Scalar Arguments ..+      COMPLEX            ALPHA, BETA+      REAL               EPS, ERR+      INTEGER            INCX, INCY, M, N, NMAX, NOUT+      LOGICAL            FATAL, MV+      CHARACTER*1        TRANS+*     .. Array Arguments ..+      COMPLEX            A( NMAX, * ), X( * ), Y( * ), YT( * ), YY( * )+      REAL               G( * )+*     .. Local Scalars ..+      COMPLEX            C+      REAL               ERRI+      INTEGER            I, INCXL, INCYL, IY, J, JX, KX, KY, ML, NL+      LOGICAL            CTRAN, TRAN+*     .. Intrinsic Functions ..+      INTRINSIC          ABS, AIMAG, CONJG, MAX, REAL, SQRT+*     .. Statement Functions ..+      REAL               ABS1+*     .. Statement Function definitions ..+      ABS1( C ) = ABS( REAL( C ) ) + ABS( AIMAG( C ) )+*     .. Executable Statements ..+      TRAN = TRANS.EQ.'T'+      CTRAN = TRANS.EQ.'C'+      IF( TRAN.OR.CTRAN )THEN+         ML = N+         NL = M+      ELSE+         ML = M+         NL = N+      END IF+      IF( INCX.LT.0 )THEN+         KX = NL+         INCXL = -1+      ELSE+         KX = 1+         INCXL = 1+      END IF+      IF( INCY.LT.0 )THEN+         KY = ML+         INCYL = -1+      ELSE+         KY = 1+         INCYL = 1+      END IF+*+*     Compute expected result in YT using data in A, X and Y.+*     Compute gauges in G.+*+      IY = KY+      DO 40 I = 1, ML+         YT( IY ) = ZERO+         G( IY ) = RZERO+         JX = KX+         IF( TRAN )THEN+            DO 10 J = 1, NL+               YT( IY ) = YT( IY ) + A( J, I )*X( JX )+               G( IY ) = G( IY ) + ABS1( A( J, I ) )*ABS1( X( JX ) )+               JX = JX + INCXL+   10       CONTINUE+         ELSE IF( CTRAN )THEN+            DO 20 J = 1, NL+               YT( IY ) = YT( IY ) + CONJG( A( J, I ) )*X( JX )+               G( IY ) = G( IY ) + ABS1( A( J, I ) )*ABS1( X( JX ) )+               JX = JX + INCXL+   20       CONTINUE+         ELSE+            DO 30 J = 1, NL+               YT( IY ) = YT( IY ) + A( I, J )*X( JX )+               G( IY ) = G( IY ) + ABS1( A( I, J ) )*ABS1( X( JX ) )+               JX = JX + INCXL+   30       CONTINUE+         END IF+         YT( IY ) = ALPHA*YT( IY ) + BETA*Y( IY )+         G( IY ) = ABS1( ALPHA )*G( IY ) + ABS1( BETA )*ABS1( Y( IY ) )+         IY = IY + INCYL+   40 CONTINUE+*+*     Compute the error ratio for this result.+*+      ERR = ZERO+      DO 50 I = 1, ML+         ERRI = ABS( YT( I ) - YY( 1 + ( I - 1 )*ABS( INCY ) ) )/EPS+         IF( G( I ).NE.RZERO )+     $      ERRI = ERRI/G( I )+         ERR = MAX( ERR, ERRI )+         IF( ERR*SQRT( EPS ).GE.RONE )+     $      GO TO 60+   50 CONTINUE+*     If the loop completes, all results are at least half accurate.+      GO TO 80+*+*     Report fatal error.+*+   60 FATAL = .TRUE.+      WRITE( NOUT, FMT = 9999 )+      DO 70 I = 1, ML+         IF( MV )THEN+            WRITE( NOUT, FMT = 9998 )I, YT( I ),+     $         YY( 1 + ( I - 1 )*ABS( INCY ) )+         ELSE+            WRITE( NOUT, FMT = 9998 )I,+     $         YY( 1 + ( I - 1 )*ABS( INCY ) ), YT( I )+         END IF+   70 CONTINUE+*+   80 CONTINUE+      RETURN+*+ 9999 FORMAT( ' ******* FATAL ERROR - COMPUTED RESULT IS LESS THAN HAL',+     $      'F ACCURATE *******', /'                       EXPECTED RE',+     $      'SULT                    COMPUTED RESULT' )+ 9998 FORMAT( 1X, I7, 2( '  (', G15.6, ',', G15.6, ')' ) )+*+*     End of CMVCH.+*+      END+      LOGICAL FUNCTION LCE( RI, RJ, LR )+*+*  Tests if two arrays are identical.+*+*  Auxiliary routine for test program for Level 2 Blas.+*+*  -- Written on 10-August-1987.+*     Richard Hanson, Sandia National Labs.+*     Jeremy Du Croz, NAG Central Office.+*+*     .. Scalar Arguments ..+      INTEGER            LR+*     .. Array Arguments ..+      COMPLEX            RI( * ), RJ( * )+*     .. Local Scalars ..+      INTEGER            I+*     .. Executable Statements ..+      DO 10 I = 1, LR+         IF( RI( I ).NE.RJ( I ) )+     $      GO TO 20+   10 CONTINUE+      LCE = .TRUE.+      GO TO 30+   20 CONTINUE+      LCE = .FALSE.+   30 RETURN+*+*     End of LCE.+*+      END+      LOGICAL FUNCTION LCERES( TYPE, UPLO, M, N, AA, AS, LDA )+*+*  Tests if selected elements in two arrays are equal.+*+*  TYPE is 'GE', 'HE' or 'HP'.+*+*  Auxiliary routine for test program for Level 2 Blas.+*+*  -- Written on 10-August-1987.+*     Richard Hanson, Sandia National Labs.+*     Jeremy Du Croz, NAG Central Office.+*+*     .. Scalar Arguments ..+      INTEGER            LDA, M, N+      CHARACTER*1        UPLO+      CHARACTER*2        TYPE+*     .. Array Arguments ..+      COMPLEX            AA( LDA, * ), AS( LDA, * )+*     .. Local Scalars ..+      INTEGER            I, IBEG, IEND, J+      LOGICAL            UPPER+*     .. Executable Statements ..+      UPPER = UPLO.EQ.'U'+      IF( TYPE.EQ.'GE' )THEN+         DO 20 J = 1, N+            DO 10 I = M + 1, LDA+               IF( AA( I, J ).NE.AS( I, J ) )+     $            GO TO 70+   10       CONTINUE+   20    CONTINUE+      ELSE IF( TYPE.EQ.'HE' )THEN+         DO 50 J = 1, N+            IF( UPPER )THEN+               IBEG = 1+               IEND = J+            ELSE+               IBEG = J+               IEND = N+            END IF+            DO 30 I = 1, IBEG - 1+               IF( AA( I, J ).NE.AS( I, J ) )+     $            GO TO 70+   30       CONTINUE+            DO 40 I = IEND + 1, LDA+               IF( AA( I, J ).NE.AS( I, J ) )+     $            GO TO 70+   40       CONTINUE+   50    CONTINUE+      END IF+*+      LCERES = .TRUE.+      GO TO 80+   70 CONTINUE+      LCERES = .FALSE.+   80 RETURN+*+*     End of LCERES.+*+      END+      COMPLEX FUNCTION CBEG( RESET )+*+*  Generates complex numbers as pairs of random numbers uniformly+*  distributed between -0.5 and 0.5.+*+*  Auxiliary routine for test program for Level 2 Blas.+*+*  -- Written on 10-August-1987.+*     Richard Hanson, Sandia National Labs.+*     Jeremy Du Croz, NAG Central Office.+*+*     .. Scalar Arguments ..+      LOGICAL            RESET+*     .. Local Scalars ..+      INTEGER            I, IC, J, MI, MJ+*     .. Save statement ..+      SAVE               I, IC, J, MI, MJ+*     .. Intrinsic Functions ..+      INTRINSIC          CMPLX+*     .. Executable Statements ..+      IF( RESET )THEN+*        Initialize local variables.+         MI = 891+         MJ = 457+         I = 7+         J = 7+         IC = 0+         RESET = .FALSE.+      END IF+*+*     The sequence of values of I or J is bounded between 1 and 999.+*     If initial I or J = 1,2,3,6,7 or 9, the period will be 50.+*     If initial I or J = 4 or 8, the period will be 25.+*     If initial I or J = 5, the period will be 10.+*     IC is used to break up the period by skipping 1 value of I or J+*     in 6.+*+      IC = IC + 1+   10 I = I*MI+      J = J*MJ+      I = I - 1000*( I/1000 )+      J = J - 1000*( J/1000 )+      IF( IC.GE.5 )THEN+         IC = 0+         GO TO 10+      END IF+      CBEG = CMPLX( ( I - 500 )/1001.0, ( J - 500 )/1001.0 )+      RETURN+*+*     End of CBEG.+*+      END+      REAL FUNCTION SDIFF( X, Y )+*+*  Auxiliary routine for test program for Level 2 Blas.+*+*  -- Written on 10-August-1987.+*     Richard Hanson, Sandia National Labs.+*+*     .. Scalar Arguments ..+      REAL               X, Y+*     .. Executable Statements ..+      SDIFF = X - Y+      RETURN+*+*     End of SDIFF.+*+      END+      SUBROUTINE CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+*+*  Tests whether XERBLA has detected an error when it should.+*+*  Auxiliary routine for test program for Level 2 Blas.+*+*  -- Written on 10-August-1987.+*     Richard Hanson, Sandia National Labs.+*     Jeremy Du Croz, NAG Central Office.+*+*     .. Scalar Arguments ..+      INTEGER            INFOT, NOUT+      LOGICAL            LERR, OK+      CHARACTER*6        SRNAMT+*     .. Executable Statements ..+      IF( .NOT.LERR )THEN+         WRITE( NOUT, FMT = 9999 )INFOT, SRNAMT+         OK = .FALSE.+      END IF+      LERR = .FALSE.+      RETURN+*+ 9999 FORMAT( ' ***** ILLEGAL VALUE OF PARAMETER NUMBER ', I2, ' NOT D',+     $      'ETECTED BY ', A6, ' *****' )+*+*     End of CHKXER.+*+      END+      SUBROUTINE XERBLA( SRNAME, INFO )+*+*  This is a special version of XERBLA to be used only as part of+*  the test program for testing error exits from the Level 2 BLAS+*  routines.+*+*  XERBLA  is an error handler for the Level 2 BLAS routines.+*+*  It is called by the Level 2 BLAS routines if an input parameter is+*  invalid.+*+*  Auxiliary routine for test program for Level 2 Blas.+*+*  -- Written on 10-August-1987.+*     Richard Hanson, Sandia National Labs.+*     Jeremy Du Croz, NAG Central Office.+*+*     .. Scalar Arguments ..+      INTEGER            INFO+      CHARACTER*6        SRNAME+*     .. Scalars in Common ..+      INTEGER            INFOT, NOUT+      LOGICAL            LERR, OK+      CHARACTER*6        SRNAMT+*     .. Common blocks ..+      COMMON             /INFOC/INFOT, NOUT, OK, LERR+      COMMON             /SRNAMC/SRNAMT+*     .. Executable Statements ..+      LERR = .TRUE.+      IF( INFO.NE.INFOT )THEN+         IF( INFOT.NE.0 )THEN+            WRITE( NOUT, FMT = 9999 )INFO, INFOT+         ELSE+            WRITE( NOUT, FMT = 9997 )INFO+         END IF+         OK = .FALSE.+      END IF+      IF( SRNAME.NE.SRNAMT )THEN+         WRITE( NOUT, FMT = 9998 )SRNAME, SRNAMT+         OK = .FALSE.+      END IF+      RETURN+*+ 9999 FORMAT( ' ******* XERBLA WAS CALLED WITH INFO = ', I6, ' INSTEAD',+     $      ' OF ', I2, ' *******' )+ 9998 FORMAT( ' ******* XERBLA WAS CALLED WITH SRNAME = ', A6, ' INSTE',+     $      'AD OF ', A6, ' *******' )+ 9997 FORMAT( ' ******* XERBLA WAS CALLED WITH INFO = ', I6,+     $      ' *******' )+*+*     End of XERBLA+*+      END+
+ eigen3/blas/testing/cblat3.dat view
@@ -0,0 +1,23 @@+'cblat3.summ'     NAME OF SUMMARY OUTPUT FILE+6                 UNIT NUMBER OF SUMMARY FILE+'cblat3.snap'     NAME OF SNAPSHOT OUTPUT FILE+-1                UNIT NUMBER OF SNAPSHOT FILE (NOT USED IF .LT. 0)+F        LOGICAL FLAG, T TO REWIND SNAPSHOT FILE AFTER EACH RECORD.+F        LOGICAL FLAG, T TO STOP ON FAILURES.+F        LOGICAL FLAG, T TO TEST ERROR EXITS.+16.0     THRESHOLD VALUE OF TEST RATIO+6                 NUMBER OF VALUES OF N+0 1 2 3 5 9       VALUES OF N+3                 NUMBER OF VALUES OF ALPHA+(0.0,0.0) (1.0,0.0) (0.7,-0.9)       VALUES OF ALPHA+3                 NUMBER OF VALUES OF BETA+(0.0,0.0) (1.0,0.0) (1.3,-1.1)       VALUES OF BETA+CGEMM  T PUT F FOR NO TEST. SAME COLUMNS.+CHEMM  T PUT F FOR NO TEST. SAME COLUMNS.+CSYMM  T PUT F FOR NO TEST. SAME COLUMNS.+CTRMM  T PUT F FOR NO TEST. SAME COLUMNS.+CTRSM  T PUT F FOR NO TEST. SAME COLUMNS.+CHERK  T PUT F FOR NO TEST. SAME COLUMNS.+CSYRK  T PUT F FOR NO TEST. SAME COLUMNS.+CHER2K T PUT F FOR NO TEST. SAME COLUMNS.+CSYR2K T PUT F FOR NO TEST. SAME COLUMNS.
+ eigen3/blas/testing/cblat3.f view
@@ -0,0 +1,3492 @@+*> \brief \b CBLAT3+*+*  =========== DOCUMENTATION ===========+*+* Online html documentation available at +*            http://www.netlib.org/lapack/explore-html/ +*+*  Definition:+*  ===========+*+*       PROGRAM CBLAT3+* +*+*> \par Purpose:+*  =============+*>+*> \verbatim+*>+*> Test program for the COMPLEX          Level 3 Blas.+*>+*> The program must be driven by a short data file. The first 14 records+*> of the file are read using list-directed input, the last 9 records+*> are read using the format ( A6, L2 ). An annotated example of a data+*> file can be obtained by deleting the first 3 characters from the+*> following 23 lines:+*> 'cblat3.out'      NAME OF SUMMARY OUTPUT FILE+*> 6                 UNIT NUMBER OF SUMMARY FILE+*> 'CBLAT3.SNAP'     NAME OF SNAPSHOT OUTPUT FILE+*> -1                UNIT NUMBER OF SNAPSHOT FILE (NOT USED IF .LT. 0)+*> F        LOGICAL FLAG, T TO REWIND SNAPSHOT FILE AFTER EACH RECORD.+*> F        LOGICAL FLAG, T TO STOP ON FAILURES.+*> T        LOGICAL FLAG, T TO TEST ERROR EXITS.+*> 16.0     THRESHOLD VALUE OF TEST RATIO+*> 6                 NUMBER OF VALUES OF N+*> 0 1 2 3 5 9       VALUES OF N+*> 3                 NUMBER OF VALUES OF ALPHA+*> (0.0,0.0) (1.0,0.0) (0.7,-0.9)       VALUES OF ALPHA+*> 3                 NUMBER OF VALUES OF BETA+*> (0.0,0.0) (1.0,0.0) (1.3,-1.1)       VALUES OF BETA+*> CGEMM  T PUT F FOR NO TEST. SAME COLUMNS.+*> CHEMM  T PUT F FOR NO TEST. SAME COLUMNS.+*> CSYMM  T PUT F FOR NO TEST. SAME COLUMNS.+*> CTRMM  T PUT F FOR NO TEST. SAME COLUMNS.+*> CTRSM  T PUT F FOR NO TEST. SAME COLUMNS.+*> CHERK  T PUT F FOR NO TEST. SAME COLUMNS.+*> CSYRK  T PUT F FOR NO TEST. SAME COLUMNS.+*> CHER2K T PUT F FOR NO TEST. SAME COLUMNS.+*> CSYR2K T PUT F FOR NO TEST. SAME COLUMNS.+*>+*> Further Details+*> ===============+*>+*> See:+*>+*>    Dongarra J. J., Du Croz J. J., Duff I. S. and Hammarling S.+*>    A Set of Level 3 Basic Linear Algebra Subprograms.+*>+*>    Technical Memorandum No.88 (Revision 1), Mathematics and+*>    Computer Science Division, Argonne National Laboratory, 9700+*>    South Cass Avenue, Argonne, Illinois 60439, US.+*>+*> -- Written on 8-February-1989.+*>    Jack Dongarra, Argonne National Laboratory.+*>    Iain Duff, AERE Harwell.+*>    Jeremy Du Croz, Numerical Algorithms Group Ltd.+*>    Sven Hammarling, Numerical Algorithms Group Ltd.+*>+*>    10-9-00:  Change STATUS='NEW' to 'UNKNOWN' so that the testers+*>              can be run multiple times without deleting generated+*>              output files (susan)+*> \endverbatim+*+*  Authors:+*  ========+*+*> \author Univ. of Tennessee +*> \author Univ. of California Berkeley +*> \author Univ. of Colorado Denver +*> \author NAG Ltd. +*+*> \date April 2012+*+*> \ingroup complex_blas_testing+*+*  =====================================================================+      PROGRAM CBLAT3+*+*  -- Reference BLAS test routine (version 3.4.1) --+*  -- Reference BLAS is a software package provided by Univ. of Tennessee,    --+*  -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--+*     April 2012+*+*  =====================================================================+*+*     .. Parameters ..+      INTEGER            NIN+      PARAMETER          ( NIN = 5 )+      INTEGER            NSUBS+      PARAMETER          ( NSUBS = 9 )+      COMPLEX            ZERO, ONE+      PARAMETER          ( ZERO = ( 0.0, 0.0 ), ONE = ( 1.0, 0.0 ) )+      REAL               RZERO+      PARAMETER          ( RZERO = 0.0 )+      INTEGER            NMAX+      PARAMETER          ( NMAX = 65 )+      INTEGER            NIDMAX, NALMAX, NBEMAX+      PARAMETER          ( NIDMAX = 9, NALMAX = 7, NBEMAX = 7 )+*     .. Local Scalars ..+      REAL               EPS, ERR, THRESH+      INTEGER            I, ISNUM, J, N, NALF, NBET, NIDIM, NOUT, NTRA+      LOGICAL            FATAL, LTESTT, REWI, SAME, SFATAL, TRACE,+     $                   TSTERR+      CHARACTER*1        TRANSA, TRANSB+      CHARACTER*6        SNAMET+      CHARACTER*32       SNAPS, SUMMRY+*     .. Local Arrays ..+      COMPLEX            AA( NMAX*NMAX ), AB( NMAX, 2*NMAX ),+     $                   ALF( NALMAX ), AS( NMAX*NMAX ),+     $                   BB( NMAX*NMAX ), BET( NBEMAX ),+     $                   BS( NMAX*NMAX ), C( NMAX, NMAX ),+     $                   CC( NMAX*NMAX ), CS( NMAX*NMAX ), CT( NMAX ),+     $                   W( 2*NMAX )+      REAL               G( NMAX )+      INTEGER            IDIM( NIDMAX )+      LOGICAL            LTEST( NSUBS )+      CHARACTER*6        SNAMES( NSUBS )+*     .. External Functions ..+      REAL               SDIFF+      LOGICAL            LCE+      EXTERNAL           SDIFF, LCE+*     .. External Subroutines ..+      EXTERNAL           CCHK1, CCHK2, CCHK3, CCHK4, CCHK5, CCHKE, CMMCH+*     .. Intrinsic Functions ..+      INTRINSIC          MAX, MIN+*     .. Scalars in Common ..+      INTEGER            INFOT, NOUTC+      LOGICAL            LERR, OK+      CHARACTER*6        SRNAMT+*     .. Common blocks ..+      COMMON             /INFOC/INFOT, NOUTC, OK, LERR+      COMMON             /SRNAMC/SRNAMT+*     .. Data statements ..+      DATA               SNAMES/'CGEMM ', 'CHEMM ', 'CSYMM ', 'CTRMM ',+     $                   'CTRSM ', 'CHERK ', 'CSYRK ', 'CHER2K',+     $                   'CSYR2K'/+*     .. Executable Statements ..+*+*     Read name and unit number for summary output file and open file.+*+      READ( NIN, FMT = * )SUMMRY+      READ( NIN, FMT = * )NOUT+      OPEN( NOUT, FILE = SUMMRY )+      NOUTC = NOUT+*+*     Read name and unit number for snapshot output file and open file.+*+      READ( NIN, FMT = * )SNAPS+      READ( NIN, FMT = * )NTRA+      TRACE = NTRA.GE.0+      IF( TRACE )THEN+         OPEN( NTRA, FILE = SNAPS )+      END IF+*     Read the flag that directs rewinding of the snapshot file.+      READ( NIN, FMT = * )REWI+      REWI = REWI.AND.TRACE+*     Read the flag that directs stopping on any failure.+      READ( NIN, FMT = * )SFATAL+*     Read the flag that indicates whether error exits are to be tested.+      READ( NIN, FMT = * )TSTERR+*     Read the threshold value of the test ratio+      READ( NIN, FMT = * )THRESH+*+*     Read and check the parameter values for the tests.+*+*     Values of N+      READ( NIN, FMT = * )NIDIM+      IF( NIDIM.LT.1.OR.NIDIM.GT.NIDMAX )THEN+         WRITE( NOUT, FMT = 9997 )'N', NIDMAX+         GO TO 220+      END IF+      READ( NIN, FMT = * )( IDIM( I ), I = 1, NIDIM )+      DO 10 I = 1, NIDIM+         IF( IDIM( I ).LT.0.OR.IDIM( I ).GT.NMAX )THEN+            WRITE( NOUT, FMT = 9996 )NMAX+            GO TO 220+         END IF+   10 CONTINUE+*     Values of ALPHA+      READ( NIN, FMT = * )NALF+      IF( NALF.LT.1.OR.NALF.GT.NALMAX )THEN+         WRITE( NOUT, FMT = 9997 )'ALPHA', NALMAX+         GO TO 220+      END IF+      READ( NIN, FMT = * )( ALF( I ), I = 1, NALF )+*     Values of BETA+      READ( NIN, FMT = * )NBET+      IF( NBET.LT.1.OR.NBET.GT.NBEMAX )THEN+         WRITE( NOUT, FMT = 9997 )'BETA', NBEMAX+         GO TO 220+      END IF+      READ( NIN, FMT = * )( BET( I ), I = 1, NBET )+*+*     Report values of parameters.+*+      WRITE( NOUT, FMT = 9995 )+      WRITE( NOUT, FMT = 9994 )( IDIM( I ), I = 1, NIDIM )+      WRITE( NOUT, FMT = 9993 )( ALF( I ), I = 1, NALF )+      WRITE( NOUT, FMT = 9992 )( BET( I ), I = 1, NBET )+      IF( .NOT.TSTERR )THEN+         WRITE( NOUT, FMT = * )+         WRITE( NOUT, FMT = 9984 )+      END IF+      WRITE( NOUT, FMT = * )+      WRITE( NOUT, FMT = 9999 )THRESH+      WRITE( NOUT, FMT = * )+*+*     Read names of subroutines and flags which indicate+*     whether they are to be tested.+*+      DO 20 I = 1, NSUBS+         LTEST( I ) = .FALSE.+   20 CONTINUE+   30 READ( NIN, FMT = 9988, END = 60 )SNAMET, LTESTT+      DO 40 I = 1, NSUBS+         IF( SNAMET.EQ.SNAMES( I ) )+     $      GO TO 50+   40 CONTINUE+      WRITE( NOUT, FMT = 9990 )SNAMET+      STOP+   50 LTEST( I ) = LTESTT+      GO TO 30+*+   60 CONTINUE+      CLOSE ( NIN )+*+*     Compute EPS (the machine precision).+*+      EPS = EPSILON(RZERO)+      WRITE( NOUT, FMT = 9998 )EPS+*+*     Check the reliability of CMMCH using exact data.+*+      N = MIN( 32, NMAX )+      DO 100 J = 1, N+         DO 90 I = 1, N+            AB( I, J ) = MAX( I - J + 1, 0 )+   90    CONTINUE+         AB( J, NMAX + 1 ) = J+         AB( 1, NMAX + J ) = J+         C( J, 1 ) = ZERO+  100 CONTINUE+      DO 110 J = 1, N+         CC( J ) = J*( ( J + 1 )*J )/2 - ( ( J + 1 )*J*( J - 1 ) )/3+  110 CONTINUE+*     CC holds the exact result. On exit from CMMCH CT holds+*     the result computed by CMMCH.+      TRANSA = 'N'+      TRANSB = 'N'+      CALL CMMCH( TRANSA, TRANSB, N, 1, N, ONE, AB, NMAX,+     $            AB( 1, NMAX + 1 ), NMAX, ZERO, C, NMAX, CT, G, CC,+     $            NMAX, EPS, ERR, FATAL, NOUT, .TRUE. )+      SAME = LCE( CC, CT, N )+      IF( .NOT.SAME.OR.ERR.NE.RZERO )THEN+         WRITE( NOUT, FMT = 9989 )TRANSA, TRANSB, SAME, ERR+         STOP+      END IF+      TRANSB = 'C'+      CALL CMMCH( TRANSA, TRANSB, N, 1, N, ONE, AB, NMAX,+     $            AB( 1, NMAX + 1 ), NMAX, ZERO, C, NMAX, CT, G, CC,+     $            NMAX, EPS, ERR, FATAL, NOUT, .TRUE. )+      SAME = LCE( CC, CT, N )+      IF( .NOT.SAME.OR.ERR.NE.RZERO )THEN+         WRITE( NOUT, FMT = 9989 )TRANSA, TRANSB, SAME, ERR+         STOP+      END IF+      DO 120 J = 1, N+         AB( J, NMAX + 1 ) = N - J + 1+         AB( 1, NMAX + J ) = N - J + 1+  120 CONTINUE+      DO 130 J = 1, N+         CC( N - J + 1 ) = J*( ( J + 1 )*J )/2 -+     $                     ( ( J + 1 )*J*( J - 1 ) )/3+  130 CONTINUE+      TRANSA = 'C'+      TRANSB = 'N'+      CALL CMMCH( TRANSA, TRANSB, N, 1, N, ONE, AB, NMAX,+     $            AB( 1, NMAX + 1 ), NMAX, ZERO, C, NMAX, CT, G, CC,+     $            NMAX, EPS, ERR, FATAL, NOUT, .TRUE. )+      SAME = LCE( CC, CT, N )+      IF( .NOT.SAME.OR.ERR.NE.RZERO )THEN+         WRITE( NOUT, FMT = 9989 )TRANSA, TRANSB, SAME, ERR+         STOP+      END IF+      TRANSB = 'C'+      CALL CMMCH( TRANSA, TRANSB, N, 1, N, ONE, AB, NMAX,+     $            AB( 1, NMAX + 1 ), NMAX, ZERO, C, NMAX, CT, G, CC,+     $            NMAX, EPS, ERR, FATAL, NOUT, .TRUE. )+      SAME = LCE( CC, CT, N )+      IF( .NOT.SAME.OR.ERR.NE.RZERO )THEN+         WRITE( NOUT, FMT = 9989 )TRANSA, TRANSB, SAME, ERR+         STOP+      END IF+*+*     Test each subroutine in turn.+*+      DO 200 ISNUM = 1, NSUBS+         WRITE( NOUT, FMT = * )+         IF( .NOT.LTEST( ISNUM ) )THEN+*           Subprogram is not to be tested.+            WRITE( NOUT, FMT = 9987 )SNAMES( ISNUM )+         ELSE+            SRNAMT = SNAMES( ISNUM )+*           Test error exits.+            IF( TSTERR )THEN+               CALL CCHKE( ISNUM, SNAMES( ISNUM ), NOUT )+               WRITE( NOUT, FMT = * )+            END IF+*           Test computations.+            INFOT = 0+            OK = .TRUE.+            FATAL = .FALSE.+            GO TO ( 140, 150, 150, 160, 160, 170, 170,+     $              180, 180 )ISNUM+*           Test CGEMM, 01.+  140       CALL CCHK1( SNAMES( ISNUM ), EPS, THRESH, NOUT, NTRA, TRACE,+     $                  REWI, FATAL, NIDIM, IDIM, NALF, ALF, NBET, BET,+     $                  NMAX, AB, AA, AS, AB( 1, NMAX + 1 ), BB, BS, C,+     $                  CC, CS, CT, G )+            GO TO 190+*           Test CHEMM, 02, CSYMM, 03.+  150       CALL CCHK2( SNAMES( ISNUM ), EPS, THRESH, NOUT, NTRA, TRACE,+     $                  REWI, FATAL, NIDIM, IDIM, NALF, ALF, NBET, BET,+     $                  NMAX, AB, AA, AS, AB( 1, NMAX + 1 ), BB, BS, C,+     $                  CC, CS, CT, G )+            GO TO 190+*           Test CTRMM, 04, CTRSM, 05.+  160       CALL CCHK3( SNAMES( ISNUM ), EPS, THRESH, NOUT, NTRA, TRACE,+     $                  REWI, FATAL, NIDIM, IDIM, NALF, ALF, NMAX, AB,+     $                  AA, AS, AB( 1, NMAX + 1 ), BB, BS, CT, G, C )+            GO TO 190+*           Test CHERK, 06, CSYRK, 07.+  170       CALL CCHK4( SNAMES( ISNUM ), EPS, THRESH, NOUT, NTRA, TRACE,+     $                  REWI, FATAL, NIDIM, IDIM, NALF, ALF, NBET, BET,+     $                  NMAX, AB, AA, AS, AB( 1, NMAX + 1 ), BB, BS, C,+     $                  CC, CS, CT, G )+            GO TO 190+*           Test CHER2K, 08, CSYR2K, 09.+  180       CALL CCHK5( SNAMES( ISNUM ), EPS, THRESH, NOUT, NTRA, TRACE,+     $                  REWI, FATAL, NIDIM, IDIM, NALF, ALF, NBET, BET,+     $                  NMAX, AB, AA, AS, BB, BS, C, CC, CS, CT, G, W )+            GO TO 190+*+  190       IF( FATAL.AND.SFATAL )+     $         GO TO 210+         END IF+  200 CONTINUE+      WRITE( NOUT, FMT = 9986 )+      GO TO 230+*+  210 CONTINUE+      WRITE( NOUT, FMT = 9985 )+      GO TO 230+*+  220 CONTINUE+      WRITE( NOUT, FMT = 9991 )+*+  230 CONTINUE+      IF( TRACE )+     $   CLOSE ( NTRA )+      CLOSE ( NOUT )+      STOP+*+ 9999 FORMAT( ' ROUTINES PASS COMPUTATIONAL TESTS IF TEST RATIO IS LES',+     $      'S THAN', F8.2 )+ 9998 FORMAT( ' RELATIVE MACHINE PRECISION IS TAKEN TO BE', 1P, E9.1 )+ 9997 FORMAT( ' NUMBER OF VALUES OF ', A, ' IS LESS THAN 1 OR GREATER ',+     $      'THAN ', I2 )+ 9996 FORMAT( ' VALUE OF N IS LESS THAN 0 OR GREATER THAN ', I2 )+ 9995 FORMAT( ' TESTS OF THE COMPLEX          LEVEL 3 BLAS', //' THE F',+     $      'OLLOWING PARAMETER VALUES WILL BE USED:' )+ 9994 FORMAT( '   FOR N              ', 9I6 )+ 9993 FORMAT( '   FOR ALPHA          ',+     $      7( '(', F4.1, ',', F4.1, ')  ', : ) )+ 9992 FORMAT( '   FOR BETA           ',+     $      7( '(', F4.1, ',', F4.1, ')  ', : ) )+ 9991 FORMAT( ' AMEND DATA FILE OR INCREASE ARRAY SIZES IN PROGRAM',+     $      /' ******* TESTS ABANDONED *******' )+ 9990 FORMAT( ' SUBPROGRAM NAME ', A6, ' NOT RECOGNIZED', /' ******* T',+     $      'ESTS ABANDONED *******' )+ 9989 FORMAT( ' ERROR IN CMMCH -  IN-LINE DOT PRODUCTS ARE BEING EVALU',+     $      'ATED WRONGLY.', /' CMMCH WAS CALLED WITH TRANSA = ', A1,+     $      ' AND TRANSB = ', A1, /' AND RETURNED SAME = ', L1, ' AND ',+     $      'ERR = ', F12.3, '.', /' THIS MAY BE DUE TO FAULTS IN THE ',+     $      'ARITHMETIC OR THE COMPILER.', /' ******* TESTS ABANDONED ',+     $      '*******' )+ 9988 FORMAT( A6, L2 )+ 9987 FORMAT( 1X, A6, ' WAS NOT TESTED' )+ 9986 FORMAT( /' END OF TESTS' )+ 9985 FORMAT( /' ******* FATAL ERROR - TESTS ABANDONED *******' )+ 9984 FORMAT( ' ERROR-EXITS WILL NOT BE TESTED' )+*+*     End of CBLAT3.+*+      END+      SUBROUTINE CCHK1( SNAME, EPS, THRESH, NOUT, NTRA, TRACE, REWI,+     $                  FATAL, NIDIM, IDIM, NALF, ALF, NBET, BET, NMAX,+     $                  A, AA, AS, B, BB, BS, C, CC, CS, CT, G )+*+*  Tests CGEMM.+*+*  Auxiliary routine for test program for Level 3 Blas.+*+*  -- Written on 8-February-1989.+*     Jack Dongarra, Argonne National Laboratory.+*     Iain Duff, AERE Harwell.+*     Jeremy Du Croz, Numerical Algorithms Group Ltd.+*     Sven Hammarling, Numerical Algorithms Group Ltd.+*+*     .. Parameters ..+      COMPLEX            ZERO+      PARAMETER          ( ZERO = ( 0.0, 0.0 ) )+      REAL               RZERO+      PARAMETER          ( RZERO = 0.0 )+*     .. Scalar Arguments ..+      REAL               EPS, THRESH+      INTEGER            NALF, NBET, NIDIM, NMAX, NOUT, NTRA+      LOGICAL            FATAL, REWI, TRACE+      CHARACTER*6        SNAME+*     .. Array Arguments ..+      COMPLEX            A( NMAX, NMAX ), AA( NMAX*NMAX ), ALF( NALF ),+     $                   AS( NMAX*NMAX ), B( NMAX, NMAX ),+     $                   BB( NMAX*NMAX ), BET( NBET ), BS( NMAX*NMAX ),+     $                   C( NMAX, NMAX ), CC( NMAX*NMAX ),+     $                   CS( NMAX*NMAX ), CT( NMAX )+      REAL               G( NMAX )+      INTEGER            IDIM( NIDIM )+*     .. Local Scalars ..+      COMPLEX            ALPHA, ALS, BETA, BLS+      REAL               ERR, ERRMAX+      INTEGER            I, IA, IB, ICA, ICB, IK, IM, IN, K, KS, LAA,+     $                   LBB, LCC, LDA, LDAS, LDB, LDBS, LDC, LDCS, M,+     $                   MA, MB, MS, N, NA, NARGS, NB, NC, NS+      LOGICAL            NULL, RESET, SAME, TRANA, TRANB+      CHARACTER*1        TRANAS, TRANBS, TRANSA, TRANSB+      CHARACTER*3        ICH+*     .. Local Arrays ..+      LOGICAL            ISAME( 13 )+*     .. External Functions ..+      LOGICAL            LCE, LCERES+      EXTERNAL           LCE, LCERES+*     .. External Subroutines ..+      EXTERNAL           CGEMM, CMAKE, CMMCH+*     .. Intrinsic Functions ..+      INTRINSIC          MAX+*     .. Scalars in Common ..+      INTEGER            INFOT, NOUTC+      LOGICAL            LERR, OK+*     .. Common blocks ..+      COMMON             /INFOC/INFOT, NOUTC, OK, LERR+*     .. Data statements ..+      DATA               ICH/'NTC'/+*     .. Executable Statements ..+*+      NARGS = 13+      NC = 0+      RESET = .TRUE.+      ERRMAX = RZERO+*+      DO 110 IM = 1, NIDIM+         M = IDIM( IM )+*+         DO 100 IN = 1, NIDIM+            N = IDIM( IN )+*           Set LDC to 1 more than minimum value if room.+            LDC = M+            IF( LDC.LT.NMAX )+     $         LDC = LDC + 1+*           Skip tests if not enough room.+            IF( LDC.GT.NMAX )+     $         GO TO 100+            LCC = LDC*N+            NULL = N.LE.0.OR.M.LE.0+*+            DO 90 IK = 1, NIDIM+               K = IDIM( IK )+*+               DO 80 ICA = 1, 3+                  TRANSA = ICH( ICA: ICA )+                  TRANA = TRANSA.EQ.'T'.OR.TRANSA.EQ.'C'+*+                  IF( TRANA )THEN+                     MA = K+                     NA = M+                  ELSE+                     MA = M+                     NA = K+                  END IF+*                 Set LDA to 1 more than minimum value if room.+                  LDA = MA+                  IF( LDA.LT.NMAX )+     $               LDA = LDA + 1+*                 Skip tests if not enough room.+                  IF( LDA.GT.NMAX )+     $               GO TO 80+                  LAA = LDA*NA+*+*                 Generate the matrix A.+*+                  CALL CMAKE( 'GE', ' ', ' ', MA, NA, A, NMAX, AA, LDA,+     $                        RESET, ZERO )+*+                  DO 70 ICB = 1, 3+                     TRANSB = ICH( ICB: ICB )+                     TRANB = TRANSB.EQ.'T'.OR.TRANSB.EQ.'C'+*+                     IF( TRANB )THEN+                        MB = N+                        NB = K+                     ELSE+                        MB = K+                        NB = N+                     END IF+*                    Set LDB to 1 more than minimum value if room.+                     LDB = MB+                     IF( LDB.LT.NMAX )+     $                  LDB = LDB + 1+*                    Skip tests if not enough room.+                     IF( LDB.GT.NMAX )+     $                  GO TO 70+                     LBB = LDB*NB+*+*                    Generate the matrix B.+*+                     CALL CMAKE( 'GE', ' ', ' ', MB, NB, B, NMAX, BB,+     $                           LDB, RESET, ZERO )+*+                     DO 60 IA = 1, NALF+                        ALPHA = ALF( IA )+*+                        DO 50 IB = 1, NBET+                           BETA = BET( IB )+*+*                          Generate the matrix C.+*+                           CALL CMAKE( 'GE', ' ', ' ', M, N, C, NMAX,+     $                                 CC, LDC, RESET, ZERO )+*+                           NC = NC + 1+*+*                          Save every datum before calling the+*                          subroutine.+*+                           TRANAS = TRANSA+                           TRANBS = TRANSB+                           MS = M+                           NS = N+                           KS = K+                           ALS = ALPHA+                           DO 10 I = 1, LAA+                              AS( I ) = AA( I )+   10                      CONTINUE+                           LDAS = LDA+                           DO 20 I = 1, LBB+                              BS( I ) = BB( I )+   20                      CONTINUE+                           LDBS = LDB+                           BLS = BETA+                           DO 30 I = 1, LCC+                              CS( I ) = CC( I )+   30                      CONTINUE+                           LDCS = LDC+*+*                          Call the subroutine.+*+                           IF( TRACE )+     $                        WRITE( NTRA, FMT = 9995 )NC, SNAME,+     $                        TRANSA, TRANSB, M, N, K, ALPHA, LDA, LDB,+     $                        BETA, LDC+                           IF( REWI )+     $                        REWIND NTRA+                           CALL CGEMM( TRANSA, TRANSB, M, N, K, ALPHA,+     $                                 AA, LDA, BB, LDB, BETA, CC, LDC )+*+*                          Check if error-exit was taken incorrectly.+*+                           IF( .NOT.OK )THEN+                              WRITE( NOUT, FMT = 9994 )+                              FATAL = .TRUE.+                              GO TO 120+                           END IF+*+*                          See what data changed inside subroutines.+*+                           ISAME( 1 ) = TRANSA.EQ.TRANAS+                           ISAME( 2 ) = TRANSB.EQ.TRANBS+                           ISAME( 3 ) = MS.EQ.M+                           ISAME( 4 ) = NS.EQ.N+                           ISAME( 5 ) = KS.EQ.K+                           ISAME( 6 ) = ALS.EQ.ALPHA+                           ISAME( 7 ) = LCE( AS, AA, LAA )+                           ISAME( 8 ) = LDAS.EQ.LDA+                           ISAME( 9 ) = LCE( BS, BB, LBB )+                           ISAME( 10 ) = LDBS.EQ.LDB+                           ISAME( 11 ) = BLS.EQ.BETA+                           IF( NULL )THEN+                              ISAME( 12 ) = LCE( CS, CC, LCC )+                           ELSE+                              ISAME( 12 ) = LCERES( 'GE', ' ', M, N, CS,+     $                                      CC, LDC )+                           END IF+                           ISAME( 13 ) = LDCS.EQ.LDC+*+*                          If data was incorrectly changed, report+*                          and return.+*+                           SAME = .TRUE.+                           DO 40 I = 1, NARGS+                              SAME = SAME.AND.ISAME( I )+                              IF( .NOT.ISAME( I ) )+     $                           WRITE( NOUT, FMT = 9998 )I+   40                      CONTINUE+                           IF( .NOT.SAME )THEN+                              FATAL = .TRUE.+                              GO TO 120+                           END IF+*+                           IF( .NOT.NULL )THEN+*+*                             Check the result.+*+                              CALL CMMCH( TRANSA, TRANSB, M, N, K,+     $                                    ALPHA, A, NMAX, B, NMAX, BETA,+     $                                    C, NMAX, CT, G, CC, LDC, EPS,+     $                                    ERR, FATAL, NOUT, .TRUE. )+                              ERRMAX = MAX( ERRMAX, ERR )+*                             If got really bad answer, report and+*                             return.+                              IF( FATAL )+     $                           GO TO 120+                           END IF+*+   50                   CONTINUE+*+   60                CONTINUE+*+   70             CONTINUE+*+   80          CONTINUE+*+   90       CONTINUE+*+  100    CONTINUE+*+  110 CONTINUE+*+*     Report result.+*+      IF( ERRMAX.LT.THRESH )THEN+         WRITE( NOUT, FMT = 9999 )SNAME, NC+      ELSE+         WRITE( NOUT, FMT = 9997 )SNAME, NC, ERRMAX+      END IF+      GO TO 130+*+  120 CONTINUE+      WRITE( NOUT, FMT = 9996 )SNAME+      WRITE( NOUT, FMT = 9995 )NC, SNAME, TRANSA, TRANSB, M, N, K,+     $   ALPHA, LDA, LDB, BETA, LDC+*+  130 CONTINUE+      RETURN+*+ 9999 FORMAT( ' ', A6, ' PASSED THE COMPUTATIONAL TESTS (', I6, ' CALL',+     $      'S)' )+ 9998 FORMAT( ' ******* FATAL ERROR - PARAMETER NUMBER ', I2, ' WAS CH',+     $      'ANGED INCORRECTLY *******' )+ 9997 FORMAT( ' ', A6, ' COMPLETED THE COMPUTATIONAL TESTS (', I6, ' C',+     $      'ALLS)', /' ******* BUT WITH MAXIMUM TEST RATIO', F8.2,+     $      ' - SUSPECT *******' )+ 9996 FORMAT( ' ******* ', A6, ' FAILED ON CALL NUMBER:' )+ 9995 FORMAT( 1X, I6, ': ', A6, '(''', A1, ''',''', A1, ''',',+     $      3( I3, ',' ), '(', F4.1, ',', F4.1, '), A,', I3, ', B,', I3,+     $      ',(', F4.1, ',', F4.1, '), C,', I3, ').' )+ 9994 FORMAT( ' ******* FATAL ERROR - ERROR-EXIT TAKEN ON VALID CALL *',+     $      '******' )+*+*     End of CCHK1.+*+      END+      SUBROUTINE CCHK2( SNAME, EPS, THRESH, NOUT, NTRA, TRACE, REWI,+     $                  FATAL, NIDIM, IDIM, NALF, ALF, NBET, BET, NMAX,+     $                  A, AA, AS, B, BB, BS, C, CC, CS, CT, G )+*+*  Tests CHEMM and CSYMM.+*+*  Auxiliary routine for test program for Level 3 Blas.+*+*  -- Written on 8-February-1989.+*     Jack Dongarra, Argonne National Laboratory.+*     Iain Duff, AERE Harwell.+*     Jeremy Du Croz, Numerical Algorithms Group Ltd.+*     Sven Hammarling, Numerical Algorithms Group Ltd.+*+*     .. Parameters ..+      COMPLEX            ZERO+      PARAMETER          ( ZERO = ( 0.0, 0.0 ) )+      REAL               RZERO+      PARAMETER          ( RZERO = 0.0 )+*     .. Scalar Arguments ..+      REAL               EPS, THRESH+      INTEGER            NALF, NBET, NIDIM, NMAX, NOUT, NTRA+      LOGICAL            FATAL, REWI, TRACE+      CHARACTER*6        SNAME+*     .. Array Arguments ..+      COMPLEX            A( NMAX, NMAX ), AA( NMAX*NMAX ), ALF( NALF ),+     $                   AS( NMAX*NMAX ), B( NMAX, NMAX ),+     $                   BB( NMAX*NMAX ), BET( NBET ), BS( NMAX*NMAX ),+     $                   C( NMAX, NMAX ), CC( NMAX*NMAX ),+     $                   CS( NMAX*NMAX ), CT( NMAX )+      REAL               G( NMAX )+      INTEGER            IDIM( NIDIM )+*     .. Local Scalars ..+      COMPLEX            ALPHA, ALS, BETA, BLS+      REAL               ERR, ERRMAX+      INTEGER            I, IA, IB, ICS, ICU, IM, IN, LAA, LBB, LCC,+     $                   LDA, LDAS, LDB, LDBS, LDC, LDCS, M, MS, N, NA,+     $                   NARGS, NC, NS+      LOGICAL            CONJ, LEFT, NULL, RESET, SAME+      CHARACTER*1        SIDE, SIDES, UPLO, UPLOS+      CHARACTER*2        ICHS, ICHU+*     .. Local Arrays ..+      LOGICAL            ISAME( 13 )+*     .. External Functions ..+      LOGICAL            LCE, LCERES+      EXTERNAL           LCE, LCERES+*     .. External Subroutines ..+      EXTERNAL           CHEMM, CMAKE, CMMCH, CSYMM+*     .. Intrinsic Functions ..+      INTRINSIC          MAX+*     .. Scalars in Common ..+      INTEGER            INFOT, NOUTC+      LOGICAL            LERR, OK+*     .. Common blocks ..+      COMMON             /INFOC/INFOT, NOUTC, OK, LERR+*     .. Data statements ..+      DATA               ICHS/'LR'/, ICHU/'UL'/+*     .. Executable Statements ..+      CONJ = SNAME( 2: 3 ).EQ.'HE'+*+      NARGS = 12+      NC = 0+      RESET = .TRUE.+      ERRMAX = RZERO+*+      DO 100 IM = 1, NIDIM+         M = IDIM( IM )+*+         DO 90 IN = 1, NIDIM+            N = IDIM( IN )+*           Set LDC to 1 more than minimum value if room.+            LDC = M+            IF( LDC.LT.NMAX )+     $         LDC = LDC + 1+*           Skip tests if not enough room.+            IF( LDC.GT.NMAX )+     $         GO TO 90+            LCC = LDC*N+            NULL = N.LE.0.OR.M.LE.0+*           Set LDB to 1 more than minimum value if room.+            LDB = M+            IF( LDB.LT.NMAX )+     $         LDB = LDB + 1+*           Skip tests if not enough room.+            IF( LDB.GT.NMAX )+     $         GO TO 90+            LBB = LDB*N+*+*           Generate the matrix B.+*+            CALL CMAKE( 'GE', ' ', ' ', M, N, B, NMAX, BB, LDB, RESET,+     $                  ZERO )+*+            DO 80 ICS = 1, 2+               SIDE = ICHS( ICS: ICS )+               LEFT = SIDE.EQ.'L'+*+               IF( LEFT )THEN+                  NA = M+               ELSE+                  NA = N+               END IF+*              Set LDA to 1 more than minimum value if room.+               LDA = NA+               IF( LDA.LT.NMAX )+     $            LDA = LDA + 1+*              Skip tests if not enough room.+               IF( LDA.GT.NMAX )+     $            GO TO 80+               LAA = LDA*NA+*+               DO 70 ICU = 1, 2+                  UPLO = ICHU( ICU: ICU )+*+*                 Generate the hermitian or symmetric matrix A.+*+                  CALL CMAKE( SNAME( 2: 3 ), UPLO, ' ', NA, NA, A, NMAX,+     $                        AA, LDA, RESET, ZERO )+*+                  DO 60 IA = 1, NALF+                     ALPHA = ALF( IA )+*+                     DO 50 IB = 1, NBET+                        BETA = BET( IB )+*+*                       Generate the matrix C.+*+                        CALL CMAKE( 'GE', ' ', ' ', M, N, C, NMAX, CC,+     $                              LDC, RESET, ZERO )+*+                        NC = NC + 1+*+*                       Save every datum before calling the+*                       subroutine.+*+                        SIDES = SIDE+                        UPLOS = UPLO+                        MS = M+                        NS = N+                        ALS = ALPHA+                        DO 10 I = 1, LAA+                           AS( I ) = AA( I )+   10                   CONTINUE+                        LDAS = LDA+                        DO 20 I = 1, LBB+                           BS( I ) = BB( I )+   20                   CONTINUE+                        LDBS = LDB+                        BLS = BETA+                        DO 30 I = 1, LCC+                           CS( I ) = CC( I )+   30                   CONTINUE+                        LDCS = LDC+*+*                       Call the subroutine.+*+                        IF( TRACE )+     $                     WRITE( NTRA, FMT = 9995 )NC, SNAME, SIDE,+     $                     UPLO, M, N, ALPHA, LDA, LDB, BETA, LDC+                        IF( REWI )+     $                     REWIND NTRA+                        IF( CONJ )THEN+                           CALL CHEMM( SIDE, UPLO, M, N, ALPHA, AA, LDA,+     $                                 BB, LDB, BETA, CC, LDC )+                        ELSE+                           CALL CSYMM( SIDE, UPLO, M, N, ALPHA, AA, LDA,+     $                                 BB, LDB, BETA, CC, LDC )+                        END IF+*+*                       Check if error-exit was taken incorrectly.+*+                        IF( .NOT.OK )THEN+                           WRITE( NOUT, FMT = 9994 )+                           FATAL = .TRUE.+                           GO TO 110+                        END IF+*+*                       See what data changed inside subroutines.+*+                        ISAME( 1 ) = SIDES.EQ.SIDE+                        ISAME( 2 ) = UPLOS.EQ.UPLO+                        ISAME( 3 ) = MS.EQ.M+                        ISAME( 4 ) = NS.EQ.N+                        ISAME( 5 ) = ALS.EQ.ALPHA+                        ISAME( 6 ) = LCE( AS, AA, LAA )+                        ISAME( 7 ) = LDAS.EQ.LDA+                        ISAME( 8 ) = LCE( BS, BB, LBB )+                        ISAME( 9 ) = LDBS.EQ.LDB+                        ISAME( 10 ) = BLS.EQ.BETA+                        IF( NULL )THEN+                           ISAME( 11 ) = LCE( CS, CC, LCC )+                        ELSE+                           ISAME( 11 ) = LCERES( 'GE', ' ', M, N, CS,+     $                                   CC, LDC )+                        END IF+                        ISAME( 12 ) = LDCS.EQ.LDC+*+*                       If data was incorrectly changed, report and+*                       return.+*+                        SAME = .TRUE.+                        DO 40 I = 1, NARGS+                           SAME = SAME.AND.ISAME( I )+                           IF( .NOT.ISAME( I ) )+     $                        WRITE( NOUT, FMT = 9998 )I+   40                   CONTINUE+                        IF( .NOT.SAME )THEN+                           FATAL = .TRUE.+                           GO TO 110+                        END IF+*+                        IF( .NOT.NULL )THEN+*+*                          Check the result.+*+                           IF( LEFT )THEN+                              CALL CMMCH( 'N', 'N', M, N, M, ALPHA, A,+     $                                    NMAX, B, NMAX, BETA, C, NMAX,+     $                                    CT, G, CC, LDC, EPS, ERR,+     $                                    FATAL, NOUT, .TRUE. )+                           ELSE+                              CALL CMMCH( 'N', 'N', M, N, N, ALPHA, B,+     $                                    NMAX, A, NMAX, BETA, C, NMAX,+     $                                    CT, G, CC, LDC, EPS, ERR,+     $                                    FATAL, NOUT, .TRUE. )+                           END IF+                           ERRMAX = MAX( ERRMAX, ERR )+*                          If got really bad answer, report and+*                          return.+                           IF( FATAL )+     $                        GO TO 110+                        END IF+*+   50                CONTINUE+*+   60             CONTINUE+*+   70          CONTINUE+*+   80       CONTINUE+*+   90    CONTINUE+*+  100 CONTINUE+*+*     Report result.+*+      IF( ERRMAX.LT.THRESH )THEN+         WRITE( NOUT, FMT = 9999 )SNAME, NC+      ELSE+         WRITE( NOUT, FMT = 9997 )SNAME, NC, ERRMAX+      END IF+      GO TO 120+*+  110 CONTINUE+      WRITE( NOUT, FMT = 9996 )SNAME+      WRITE( NOUT, FMT = 9995 )NC, SNAME, SIDE, UPLO, M, N, ALPHA, LDA,+     $   LDB, BETA, LDC+*+  120 CONTINUE+      RETURN+*+ 9999 FORMAT( ' ', A6, ' PASSED THE COMPUTATIONAL TESTS (', I6, ' CALL',+     $      'S)' )+ 9998 FORMAT( ' ******* FATAL ERROR - PARAMETER NUMBER ', I2, ' WAS CH',+     $      'ANGED INCORRECTLY *******' )+ 9997 FORMAT( ' ', A6, ' COMPLETED THE COMPUTATIONAL TESTS (', I6, ' C',+     $      'ALLS)', /' ******* BUT WITH MAXIMUM TEST RATIO', F8.2,+     $      ' - SUSPECT *******' )+ 9996 FORMAT( ' ******* ', A6, ' FAILED ON CALL NUMBER:' )+ 9995 FORMAT( 1X, I6, ': ', A6, '(', 2( '''', A1, ''',' ), 2( I3, ',' ),+     $      '(', F4.1, ',', F4.1, '), A,', I3, ', B,', I3, ',(', F4.1,+     $      ',', F4.1, '), C,', I3, ')    .' )+ 9994 FORMAT( ' ******* FATAL ERROR - ERROR-EXIT TAKEN ON VALID CALL *',+     $      '******' )+*+*     End of CCHK2.+*+      END+      SUBROUTINE CCHK3( SNAME, EPS, THRESH, NOUT, NTRA, TRACE, REWI,+     $                  FATAL, NIDIM, IDIM, NALF, ALF, NMAX, A, AA, AS,+     $                  B, BB, BS, CT, G, C )+*+*  Tests CTRMM and CTRSM.+*+*  Auxiliary routine for test program for Level 3 Blas.+*+*  -- Written on 8-February-1989.+*     Jack Dongarra, Argonne National Laboratory.+*     Iain Duff, AERE Harwell.+*     Jeremy Du Croz, Numerical Algorithms Group Ltd.+*     Sven Hammarling, Numerical Algorithms Group Ltd.+*+*     .. Parameters ..+      COMPLEX            ZERO, ONE+      PARAMETER          ( ZERO = ( 0.0, 0.0 ), ONE = ( 1.0, 0.0 ) )+      REAL               RZERO+      PARAMETER          ( RZERO = 0.0 )+*     .. Scalar Arguments ..+      REAL               EPS, THRESH+      INTEGER            NALF, NIDIM, NMAX, NOUT, NTRA+      LOGICAL            FATAL, REWI, TRACE+      CHARACTER*6        SNAME+*     .. Array Arguments ..+      COMPLEX            A( NMAX, NMAX ), AA( NMAX*NMAX ), ALF( NALF ),+     $                   AS( NMAX*NMAX ), B( NMAX, NMAX ),+     $                   BB( NMAX*NMAX ), BS( NMAX*NMAX ),+     $                   C( NMAX, NMAX ), CT( NMAX )+      REAL               G( NMAX )+      INTEGER            IDIM( NIDIM )+*     .. Local Scalars ..+      COMPLEX            ALPHA, ALS+      REAL               ERR, ERRMAX+      INTEGER            I, IA, ICD, ICS, ICT, ICU, IM, IN, J, LAA, LBB,+     $                   LDA, LDAS, LDB, LDBS, M, MS, N, NA, NARGS, NC,+     $                   NS+      LOGICAL            LEFT, NULL, RESET, SAME+      CHARACTER*1        DIAG, DIAGS, SIDE, SIDES, TRANAS, TRANSA, UPLO,+     $                   UPLOS+      CHARACTER*2        ICHD, ICHS, ICHU+      CHARACTER*3        ICHT+*     .. Local Arrays ..+      LOGICAL            ISAME( 13 )+*     .. External Functions ..+      LOGICAL            LCE, LCERES+      EXTERNAL           LCE, LCERES+*     .. External Subroutines ..+      EXTERNAL           CMAKE, CMMCH, CTRMM, CTRSM+*     .. Intrinsic Functions ..+      INTRINSIC          MAX+*     .. Scalars in Common ..+      INTEGER            INFOT, NOUTC+      LOGICAL            LERR, OK+*     .. Common blocks ..+      COMMON             /INFOC/INFOT, NOUTC, OK, LERR+*     .. Data statements ..+      DATA               ICHU/'UL'/, ICHT/'NTC'/, ICHD/'UN'/, ICHS/'LR'/+*     .. Executable Statements ..+*+      NARGS = 11+      NC = 0+      RESET = .TRUE.+      ERRMAX = RZERO+*     Set up zero matrix for CMMCH.+      DO 20 J = 1, NMAX+         DO 10 I = 1, NMAX+            C( I, J ) = ZERO+   10    CONTINUE+   20 CONTINUE+*+      DO 140 IM = 1, NIDIM+         M = IDIM( IM )+*+         DO 130 IN = 1, NIDIM+            N = IDIM( IN )+*           Set LDB to 1 more than minimum value if room.+            LDB = M+            IF( LDB.LT.NMAX )+     $         LDB = LDB + 1+*           Skip tests if not enough room.+            IF( LDB.GT.NMAX )+     $         GO TO 130+            LBB = LDB*N+            NULL = M.LE.0.OR.N.LE.0+*+            DO 120 ICS = 1, 2+               SIDE = ICHS( ICS: ICS )+               LEFT = SIDE.EQ.'L'+               IF( LEFT )THEN+                  NA = M+               ELSE+                  NA = N+               END IF+*              Set LDA to 1 more than minimum value if room.+               LDA = NA+               IF( LDA.LT.NMAX )+     $            LDA = LDA + 1+*              Skip tests if not enough room.+               IF( LDA.GT.NMAX )+     $            GO TO 130+               LAA = LDA*NA+*+               DO 110 ICU = 1, 2+                  UPLO = ICHU( ICU: ICU )+*+                  DO 100 ICT = 1, 3+                     TRANSA = ICHT( ICT: ICT )+*+                     DO 90 ICD = 1, 2+                        DIAG = ICHD( ICD: ICD )+*+                        DO 80 IA = 1, NALF+                           ALPHA = ALF( IA )+*+*                          Generate the matrix A.+*+                           CALL CMAKE( 'TR', UPLO, DIAG, NA, NA, A,+     $                                 NMAX, AA, LDA, RESET, ZERO )+*+*                          Generate the matrix B.+*+                           CALL CMAKE( 'GE', ' ', ' ', M, N, B, NMAX,+     $                                 BB, LDB, RESET, ZERO )+*+                           NC = NC + 1+*+*                          Save every datum before calling the+*                          subroutine.+*+                           SIDES = SIDE+                           UPLOS = UPLO+                           TRANAS = TRANSA+                           DIAGS = DIAG+                           MS = M+                           NS = N+                           ALS = ALPHA+                           DO 30 I = 1, LAA+                              AS( I ) = AA( I )+   30                      CONTINUE+                           LDAS = LDA+                           DO 40 I = 1, LBB+                              BS( I ) = BB( I )+   40                      CONTINUE+                           LDBS = LDB+*+*                          Call the subroutine.+*+                           IF( SNAME( 4: 5 ).EQ.'MM' )THEN+                              IF( TRACE )+     $                           WRITE( NTRA, FMT = 9995 )NC, SNAME,+     $                           SIDE, UPLO, TRANSA, DIAG, M, N, ALPHA,+     $                           LDA, LDB+                              IF( REWI )+     $                           REWIND NTRA+                              CALL CTRMM( SIDE, UPLO, TRANSA, DIAG, M,+     $                                    N, ALPHA, AA, LDA, BB, LDB )+                           ELSE IF( SNAME( 4: 5 ).EQ.'SM' )THEN+                              IF( TRACE )+     $                           WRITE( NTRA, FMT = 9995 )NC, SNAME,+     $                           SIDE, UPLO, TRANSA, DIAG, M, N, ALPHA,+     $                           LDA, LDB+                              IF( REWI )+     $                           REWIND NTRA+                              CALL CTRSM( SIDE, UPLO, TRANSA, DIAG, M,+     $                                    N, ALPHA, AA, LDA, BB, LDB )+                           END IF+*+*                          Check if error-exit was taken incorrectly.+*+                           IF( .NOT.OK )THEN+                              WRITE( NOUT, FMT = 9994 )+                              FATAL = .TRUE.+                              GO TO 150+                           END IF+*+*                          See what data changed inside subroutines.+*+                           ISAME( 1 ) = SIDES.EQ.SIDE+                           ISAME( 2 ) = UPLOS.EQ.UPLO+                           ISAME( 3 ) = TRANAS.EQ.TRANSA+                           ISAME( 4 ) = DIAGS.EQ.DIAG+                           ISAME( 5 ) = MS.EQ.M+                           ISAME( 6 ) = NS.EQ.N+                           ISAME( 7 ) = ALS.EQ.ALPHA+                           ISAME( 8 ) = LCE( AS, AA, LAA )+                           ISAME( 9 ) = LDAS.EQ.LDA+                           IF( NULL )THEN+                              ISAME( 10 ) = LCE( BS, BB, LBB )+                           ELSE+                              ISAME( 10 ) = LCERES( 'GE', ' ', M, N, BS,+     $                                      BB, LDB )+                           END IF+                           ISAME( 11 ) = LDBS.EQ.LDB+*+*                          If data was incorrectly changed, report and+*                          return.+*+                           SAME = .TRUE.+                           DO 50 I = 1, NARGS+                              SAME = SAME.AND.ISAME( I )+                              IF( .NOT.ISAME( I ) )+     $                           WRITE( NOUT, FMT = 9998 )I+   50                      CONTINUE+                           IF( .NOT.SAME )THEN+                              FATAL = .TRUE.+                              GO TO 150+                           END IF+*+                           IF( .NOT.NULL )THEN+                              IF( SNAME( 4: 5 ).EQ.'MM' )THEN+*+*                                Check the result.+*+                                 IF( LEFT )THEN+                                    CALL CMMCH( TRANSA, 'N', M, N, M,+     $                                          ALPHA, A, NMAX, B, NMAX,+     $                                          ZERO, C, NMAX, CT, G,+     $                                          BB, LDB, EPS, ERR,+     $                                          FATAL, NOUT, .TRUE. )+                                 ELSE+                                    CALL CMMCH( 'N', TRANSA, M, N, N,+     $                                          ALPHA, B, NMAX, A, NMAX,+     $                                          ZERO, C, NMAX, CT, G,+     $                                          BB, LDB, EPS, ERR,+     $                                          FATAL, NOUT, .TRUE. )+                                 END IF+                              ELSE IF( SNAME( 4: 5 ).EQ.'SM' )THEN+*+*                                Compute approximation to original+*                                matrix.+*+                                 DO 70 J = 1, N+                                    DO 60 I = 1, M+                                       C( I, J ) = BB( I + ( J - 1 )*+     $                                             LDB )+                                       BB( I + ( J - 1 )*LDB ) = ALPHA*+     $                                    B( I, J )+   60                               CONTINUE+   70                            CONTINUE+*+                                 IF( LEFT )THEN+                                    CALL CMMCH( TRANSA, 'N', M, N, M,+     $                                          ONE, A, NMAX, C, NMAX,+     $                                          ZERO, B, NMAX, CT, G,+     $                                          BB, LDB, EPS, ERR,+     $                                          FATAL, NOUT, .FALSE. )+                                 ELSE+                                    CALL CMMCH( 'N', TRANSA, M, N, N,+     $                                          ONE, C, NMAX, A, NMAX,+     $                                          ZERO, B, NMAX, CT, G,+     $                                          BB, LDB, EPS, ERR,+     $                                          FATAL, NOUT, .FALSE. )+                                 END IF+                              END IF+                              ERRMAX = MAX( ERRMAX, ERR )+*                             If got really bad answer, report and+*                             return.+                              IF( FATAL )+     $                           GO TO 150+                           END IF+*+   80                   CONTINUE+*+   90                CONTINUE+*+  100             CONTINUE+*+  110          CONTINUE+*+  120       CONTINUE+*+  130    CONTINUE+*+  140 CONTINUE+*+*     Report result.+*+      IF( ERRMAX.LT.THRESH )THEN+         WRITE( NOUT, FMT = 9999 )SNAME, NC+      ELSE+         WRITE( NOUT, FMT = 9997 )SNAME, NC, ERRMAX+      END IF+      GO TO 160+*+  150 CONTINUE+      WRITE( NOUT, FMT = 9996 )SNAME+      WRITE( NOUT, FMT = 9995 )NC, SNAME, SIDE, UPLO, TRANSA, DIAG, M,+     $   N, ALPHA, LDA, LDB+*+  160 CONTINUE+      RETURN+*+ 9999 FORMAT( ' ', A6, ' PASSED THE COMPUTATIONAL TESTS (', I6, ' CALL',+     $      'S)' )+ 9998 FORMAT( ' ******* FATAL ERROR - PARAMETER NUMBER ', I2, ' WAS CH',+     $      'ANGED INCORRECTLY *******' )+ 9997 FORMAT( ' ', A6, ' COMPLETED THE COMPUTATIONAL TESTS (', I6, ' C',+     $      'ALLS)', /' ******* BUT WITH MAXIMUM TEST RATIO', F8.2,+     $      ' - SUSPECT *******' )+ 9996 FORMAT( ' ******* ', A6, ' FAILED ON CALL NUMBER:' )+ 9995 FORMAT( 1X, I6, ': ', A6, '(', 4( '''', A1, ''',' ), 2( I3, ',' ),+     $      '(', F4.1, ',', F4.1, '), A,', I3, ', B,', I3, ')         ',+     $      '      .' )+ 9994 FORMAT( ' ******* FATAL ERROR - ERROR-EXIT TAKEN ON VALID CALL *',+     $      '******' )+*+*     End of CCHK3.+*+      END+      SUBROUTINE CCHK4( SNAME, EPS, THRESH, NOUT, NTRA, TRACE, REWI,+     $                  FATAL, NIDIM, IDIM, NALF, ALF, NBET, BET, NMAX,+     $                  A, AA, AS, B, BB, BS, C, CC, CS, CT, G )+*+*  Tests CHERK and CSYRK.+*+*  Auxiliary routine for test program for Level 3 Blas.+*+*  -- Written on 8-February-1989.+*     Jack Dongarra, Argonne National Laboratory.+*     Iain Duff, AERE Harwell.+*     Jeremy Du Croz, Numerical Algorithms Group Ltd.+*     Sven Hammarling, Numerical Algorithms Group Ltd.+*+*     .. Parameters ..+      COMPLEX            ZERO+      PARAMETER          ( ZERO = ( 0.0, 0.0 ) )+      REAL               RONE, RZERO+      PARAMETER          ( RONE = 1.0, RZERO = 0.0 )+*     .. Scalar Arguments ..+      REAL               EPS, THRESH+      INTEGER            NALF, NBET, NIDIM, NMAX, NOUT, NTRA+      LOGICAL            FATAL, REWI, TRACE+      CHARACTER*6        SNAME+*     .. Array Arguments ..+      COMPLEX            A( NMAX, NMAX ), AA( NMAX*NMAX ), ALF( NALF ),+     $                   AS( NMAX*NMAX ), B( NMAX, NMAX ),+     $                   BB( NMAX*NMAX ), BET( NBET ), BS( NMAX*NMAX ),+     $                   C( NMAX, NMAX ), CC( NMAX*NMAX ),+     $                   CS( NMAX*NMAX ), CT( NMAX )+      REAL               G( NMAX )+      INTEGER            IDIM( NIDIM )+*     .. Local Scalars ..+      COMPLEX            ALPHA, ALS, BETA, BETS+      REAL               ERR, ERRMAX, RALPHA, RALS, RBETA, RBETS+      INTEGER            I, IA, IB, ICT, ICU, IK, IN, J, JC, JJ, K, KS,+     $                   LAA, LCC, LDA, LDAS, LDC, LDCS, LJ, MA, N, NA,+     $                   NARGS, NC, NS+      LOGICAL            CONJ, NULL, RESET, SAME, TRAN, UPPER+      CHARACTER*1        TRANS, TRANSS, TRANST, UPLO, UPLOS+      CHARACTER*2        ICHT, ICHU+*     .. Local Arrays ..+      LOGICAL            ISAME( 13 )+*     .. External Functions ..+      LOGICAL            LCE, LCERES+      EXTERNAL           LCE, LCERES+*     .. External Subroutines ..+      EXTERNAL           CHERK, CMAKE, CMMCH, CSYRK+*     .. Intrinsic Functions ..+      INTRINSIC          CMPLX, MAX, REAL+*     .. Scalars in Common ..+      INTEGER            INFOT, NOUTC+      LOGICAL            LERR, OK+*     .. Common blocks ..+      COMMON             /INFOC/INFOT, NOUTC, OK, LERR+*     .. Data statements ..+      DATA               ICHT/'NC'/, ICHU/'UL'/+*     .. Executable Statements ..+      CONJ = SNAME( 2: 3 ).EQ.'HE'+*+      NARGS = 10+      NC = 0+      RESET = .TRUE.+      ERRMAX = RZERO+*+      DO 100 IN = 1, NIDIM+         N = IDIM( IN )+*        Set LDC to 1 more than minimum value if room.+         LDC = N+         IF( LDC.LT.NMAX )+     $      LDC = LDC + 1+*        Skip tests if not enough room.+         IF( LDC.GT.NMAX )+     $      GO TO 100+         LCC = LDC*N+*+         DO 90 IK = 1, NIDIM+            K = IDIM( IK )+*+            DO 80 ICT = 1, 2+               TRANS = ICHT( ICT: ICT )+               TRAN = TRANS.EQ.'C'+               IF( TRAN.AND..NOT.CONJ )+     $            TRANS = 'T'+               IF( TRAN )THEN+                  MA = K+                  NA = N+               ELSE+                  MA = N+                  NA = K+               END IF+*              Set LDA to 1 more than minimum value if room.+               LDA = MA+               IF( LDA.LT.NMAX )+     $            LDA = LDA + 1+*              Skip tests if not enough room.+               IF( LDA.GT.NMAX )+     $            GO TO 80+               LAA = LDA*NA+*+*              Generate the matrix A.+*+               CALL CMAKE( 'GE', ' ', ' ', MA, NA, A, NMAX, AA, LDA,+     $                     RESET, ZERO )+*+               DO 70 ICU = 1, 2+                  UPLO = ICHU( ICU: ICU )+                  UPPER = UPLO.EQ.'U'+*+                  DO 60 IA = 1, NALF+                     ALPHA = ALF( IA )+                     IF( CONJ )THEN+                        RALPHA = REAL( ALPHA )+                        ALPHA = CMPLX( RALPHA, RZERO )+                     END IF+*+                     DO 50 IB = 1, NBET+                        BETA = BET( IB )+                        IF( CONJ )THEN+                           RBETA = REAL( BETA )+                           BETA = CMPLX( RBETA, RZERO )+                        END IF+                        NULL = N.LE.0+                        IF( CONJ )+     $                     NULL = NULL.OR.( ( K.LE.0.OR.RALPHA.EQ.+     $                            RZERO ).AND.RBETA.EQ.RONE )+*+*                       Generate the matrix C.+*+                        CALL CMAKE( SNAME( 2: 3 ), UPLO, ' ', N, N, C,+     $                              NMAX, CC, LDC, RESET, ZERO )+*+                        NC = NC + 1+*+*                       Save every datum before calling the subroutine.+*+                        UPLOS = UPLO+                        TRANSS = TRANS+                        NS = N+                        KS = K+                        IF( CONJ )THEN+                           RALS = RALPHA+                        ELSE+                           ALS = ALPHA+                        END IF+                        DO 10 I = 1, LAA+                           AS( I ) = AA( I )+   10                   CONTINUE+                        LDAS = LDA+                        IF( CONJ )THEN+                           RBETS = RBETA+                        ELSE+                           BETS = BETA+                        END IF+                        DO 20 I = 1, LCC+                           CS( I ) = CC( I )+   20                   CONTINUE+                        LDCS = LDC+*+*                       Call the subroutine.+*+                        IF( CONJ )THEN+                           IF( TRACE )+     $                        WRITE( NTRA, FMT = 9994 )NC, SNAME, UPLO,+     $                        TRANS, N, K, RALPHA, LDA, RBETA, LDC+                           IF( REWI )+     $                        REWIND NTRA+                           CALL CHERK( UPLO, TRANS, N, K, RALPHA, AA,+     $                                 LDA, RBETA, CC, LDC )+                        ELSE+                           IF( TRACE )+     $                        WRITE( NTRA, FMT = 9993 )NC, SNAME, UPLO,+     $                        TRANS, N, K, ALPHA, LDA, BETA, LDC+                           IF( REWI )+     $                        REWIND NTRA+                           CALL CSYRK( UPLO, TRANS, N, K, ALPHA, AA,+     $                                 LDA, BETA, CC, LDC )+                        END IF+*+*                       Check if error-exit was taken incorrectly.+*+                        IF( .NOT.OK )THEN+                           WRITE( NOUT, FMT = 9992 )+                           FATAL = .TRUE.+                           GO TO 120+                        END IF+*+*                       See what data changed inside subroutines.+*+                        ISAME( 1 ) = UPLOS.EQ.UPLO+                        ISAME( 2 ) = TRANSS.EQ.TRANS+                        ISAME( 3 ) = NS.EQ.N+                        ISAME( 4 ) = KS.EQ.K+                        IF( CONJ )THEN+                           ISAME( 5 ) = RALS.EQ.RALPHA+                        ELSE+                           ISAME( 5 ) = ALS.EQ.ALPHA+                        END IF+                        ISAME( 6 ) = LCE( AS, AA, LAA )+                        ISAME( 7 ) = LDAS.EQ.LDA+                        IF( CONJ )THEN+                           ISAME( 8 ) = RBETS.EQ.RBETA+                        ELSE+                           ISAME( 8 ) = BETS.EQ.BETA+                        END IF+                        IF( NULL )THEN+                           ISAME( 9 ) = LCE( CS, CC, LCC )+                        ELSE+                           ISAME( 9 ) = LCERES( SNAME( 2: 3 ), UPLO, N,+     $                                  N, CS, CC, LDC )+                        END IF+                        ISAME( 10 ) = LDCS.EQ.LDC+*+*                       If data was incorrectly changed, report and+*                       return.+*+                        SAME = .TRUE.+                        DO 30 I = 1, NARGS+                           SAME = SAME.AND.ISAME( I )+                           IF( .NOT.ISAME( I ) )+     $                        WRITE( NOUT, FMT = 9998 )I+   30                   CONTINUE+                        IF( .NOT.SAME )THEN+                           FATAL = .TRUE.+                           GO TO 120+                        END IF+*+                        IF( .NOT.NULL )THEN+*+*                          Check the result column by column.+*+                           IF( CONJ )THEN+                              TRANST = 'C'+                           ELSE+                              TRANST = 'T'+                           END IF+                           JC = 1+                           DO 40 J = 1, N+                              IF( UPPER )THEN+                                 JJ = 1+                                 LJ = J+                              ELSE+                                 JJ = J+                                 LJ = N - J + 1+                              END IF+                              IF( TRAN )THEN+                                 CALL CMMCH( TRANST, 'N', LJ, 1, K,+     $                                       ALPHA, A( 1, JJ ), NMAX,+     $                                       A( 1, J ), NMAX, BETA,+     $                                       C( JJ, J ), NMAX, CT, G,+     $                                       CC( JC ), LDC, EPS, ERR,+     $                                       FATAL, NOUT, .TRUE. )+                              ELSE+                                 CALL CMMCH( 'N', TRANST, LJ, 1, K,+     $                                       ALPHA, A( JJ, 1 ), NMAX,+     $                                       A( J, 1 ), NMAX, BETA,+     $                                       C( JJ, J ), NMAX, CT, G,+     $                                       CC( JC ), LDC, EPS, ERR,+     $                                       FATAL, NOUT, .TRUE. )+                              END IF+                              IF( UPPER )THEN+                                 JC = JC + LDC+                              ELSE+                                 JC = JC + LDC + 1+                              END IF+                              ERRMAX = MAX( ERRMAX, ERR )+*                             If got really bad answer, report and+*                             return.+                              IF( FATAL )+     $                           GO TO 110+   40                      CONTINUE+                        END IF+*+   50                CONTINUE+*+   60             CONTINUE+*+   70          CONTINUE+*+   80       CONTINUE+*+   90    CONTINUE+*+  100 CONTINUE+*+*     Report result.+*+      IF( ERRMAX.LT.THRESH )THEN+         WRITE( NOUT, FMT = 9999 )SNAME, NC+      ELSE+         WRITE( NOUT, FMT = 9997 )SNAME, NC, ERRMAX+      END IF+      GO TO 130+*+  110 CONTINUE+      IF( N.GT.1 )+     $   WRITE( NOUT, FMT = 9995 )J+*+  120 CONTINUE+      WRITE( NOUT, FMT = 9996 )SNAME+      IF( CONJ )THEN+         WRITE( NOUT, FMT = 9994 )NC, SNAME, UPLO, TRANS, N, K, RALPHA,+     $      LDA, RBETA, LDC+      ELSE+         WRITE( NOUT, FMT = 9993 )NC, SNAME, UPLO, TRANS, N, K, ALPHA,+     $      LDA, BETA, LDC+      END IF+*+  130 CONTINUE+      RETURN+*+ 9999 FORMAT( ' ', A6, ' PASSED THE COMPUTATIONAL TESTS (', I6, ' CALL',+     $      'S)' )+ 9998 FORMAT( ' ******* FATAL ERROR - PARAMETER NUMBER ', I2, ' WAS CH',+     $      'ANGED INCORRECTLY *******' )+ 9997 FORMAT( ' ', A6, ' COMPLETED THE COMPUTATIONAL TESTS (', I6, ' C',+     $      'ALLS)', /' ******* BUT WITH MAXIMUM TEST RATIO', F8.2,+     $      ' - SUSPECT *******' )+ 9996 FORMAT( ' ******* ', A6, ' FAILED ON CALL NUMBER:' )+ 9995 FORMAT( '      THESE ARE THE RESULTS FOR COLUMN ', I3 )+ 9994 FORMAT( 1X, I6, ': ', A6, '(', 2( '''', A1, ''',' ), 2( I3, ',' ),+     $      F4.1, ', A,', I3, ',', F4.1, ', C,', I3, ')               ',+     $      '          .' )+ 9993 FORMAT( 1X, I6, ': ', A6, '(', 2( '''', A1, ''',' ), 2( I3, ',' ),+     $      '(', F4.1, ',', F4.1, ') , A,', I3, ',(', F4.1, ',', F4.1,+     $      '), C,', I3, ')          .' )+ 9992 FORMAT( ' ******* FATAL ERROR - ERROR-EXIT TAKEN ON VALID CALL *',+     $      '******' )+*+*     End of CCHK4.+*+      END+      SUBROUTINE CCHK5( SNAME, EPS, THRESH, NOUT, NTRA, TRACE, REWI,+     $                  FATAL, NIDIM, IDIM, NALF, ALF, NBET, BET, NMAX,+     $                  AB, AA, AS, BB, BS, C, CC, CS, CT, G, W )+*+*  Tests CHER2K and CSYR2K.+*+*  Auxiliary routine for test program for Level 3 Blas.+*+*  -- Written on 8-February-1989.+*     Jack Dongarra, Argonne National Laboratory.+*     Iain Duff, AERE Harwell.+*     Jeremy Du Croz, Numerical Algorithms Group Ltd.+*     Sven Hammarling, Numerical Algorithms Group Ltd.+*+*     .. Parameters ..+      COMPLEX            ZERO, ONE+      PARAMETER          ( ZERO = ( 0.0, 0.0 ), ONE = ( 1.0, 0.0 ) )+      REAL               RONE, RZERO+      PARAMETER          ( RONE = 1.0, RZERO = 0.0 )+*     .. Scalar Arguments ..+      REAL               EPS, THRESH+      INTEGER            NALF, NBET, NIDIM, NMAX, NOUT, NTRA+      LOGICAL            FATAL, REWI, TRACE+      CHARACTER*6        SNAME+*     .. Array Arguments ..+      COMPLEX            AA( NMAX*NMAX ), AB( 2*NMAX*NMAX ),+     $                   ALF( NALF ), AS( NMAX*NMAX ), BB( NMAX*NMAX ),+     $                   BET( NBET ), BS( NMAX*NMAX ), C( NMAX, NMAX ),+     $                   CC( NMAX*NMAX ), CS( NMAX*NMAX ), CT( NMAX ),+     $                   W( 2*NMAX )+      REAL               G( NMAX )+      INTEGER            IDIM( NIDIM )+*     .. Local Scalars ..+      COMPLEX            ALPHA, ALS, BETA, BETS+      REAL               ERR, ERRMAX, RBETA, RBETS+      INTEGER            I, IA, IB, ICT, ICU, IK, IN, J, JC, JJ, JJAB,+     $                   K, KS, LAA, LBB, LCC, LDA, LDAS, LDB, LDBS,+     $                   LDC, LDCS, LJ, MA, N, NA, NARGS, NC, NS+      LOGICAL            CONJ, NULL, RESET, SAME, TRAN, UPPER+      CHARACTER*1        TRANS, TRANSS, TRANST, UPLO, UPLOS+      CHARACTER*2        ICHT, ICHU+*     .. Local Arrays ..+      LOGICAL            ISAME( 13 )+*     .. External Functions ..+      LOGICAL            LCE, LCERES+      EXTERNAL           LCE, LCERES+*     .. External Subroutines ..+      EXTERNAL           CHER2K, CMAKE, CMMCH, CSYR2K+*     .. Intrinsic Functions ..+      INTRINSIC          CMPLX, CONJG, MAX, REAL+*     .. Scalars in Common ..+      INTEGER            INFOT, NOUTC+      LOGICAL            LERR, OK+*     .. Common blocks ..+      COMMON             /INFOC/INFOT, NOUTC, OK, LERR+*     .. Data statements ..+      DATA               ICHT/'NC'/, ICHU/'UL'/+*     .. Executable Statements ..+      CONJ = SNAME( 2: 3 ).EQ.'HE'+*+      NARGS = 12+      NC = 0+      RESET = .TRUE.+      ERRMAX = RZERO+*+      DO 130 IN = 1, NIDIM+         N = IDIM( IN )+*        Set LDC to 1 more than minimum value if room.+         LDC = N+         IF( LDC.LT.NMAX )+     $      LDC = LDC + 1+*        Skip tests if not enough room.+         IF( LDC.GT.NMAX )+     $      GO TO 130+         LCC = LDC*N+*+         DO 120 IK = 1, NIDIM+            K = IDIM( IK )+*+            DO 110 ICT = 1, 2+               TRANS = ICHT( ICT: ICT )+               TRAN = TRANS.EQ.'C'+               IF( TRAN.AND..NOT.CONJ )+     $            TRANS = 'T'+               IF( TRAN )THEN+                  MA = K+                  NA = N+               ELSE+                  MA = N+                  NA = K+               END IF+*              Set LDA to 1 more than minimum value if room.+               LDA = MA+               IF( LDA.LT.NMAX )+     $            LDA = LDA + 1+*              Skip tests if not enough room.+               IF( LDA.GT.NMAX )+     $            GO TO 110+               LAA = LDA*NA+*+*              Generate the matrix A.+*+               IF( TRAN )THEN+                  CALL CMAKE( 'GE', ' ', ' ', MA, NA, AB, 2*NMAX, AA,+     $                        LDA, RESET, ZERO )+               ELSE+                  CALL CMAKE( 'GE', ' ', ' ', MA, NA, AB, NMAX, AA, LDA,+     $                        RESET, ZERO )+               END IF+*+*              Generate the matrix B.+*+               LDB = LDA+               LBB = LAA+               IF( TRAN )THEN+                  CALL CMAKE( 'GE', ' ', ' ', MA, NA, AB( K + 1 ),+     $                        2*NMAX, BB, LDB, RESET, ZERO )+               ELSE+                  CALL CMAKE( 'GE', ' ', ' ', MA, NA, AB( K*NMAX + 1 ),+     $                        NMAX, BB, LDB, RESET, ZERO )+               END IF+*+               DO 100 ICU = 1, 2+                  UPLO = ICHU( ICU: ICU )+                  UPPER = UPLO.EQ.'U'+*+                  DO 90 IA = 1, NALF+                     ALPHA = ALF( IA )+*+                     DO 80 IB = 1, NBET+                        BETA = BET( IB )+                        IF( CONJ )THEN+                           RBETA = REAL( BETA )+                           BETA = CMPLX( RBETA, RZERO )+                        END IF+                        NULL = N.LE.0+                        IF( CONJ )+     $                     NULL = NULL.OR.( ( K.LE.0.OR.ALPHA.EQ.+     $                            ZERO ).AND.RBETA.EQ.RONE )+*+*                       Generate the matrix C.+*+                        CALL CMAKE( SNAME( 2: 3 ), UPLO, ' ', N, N, C,+     $                              NMAX, CC, LDC, RESET, ZERO )+*+                        NC = NC + 1+*+*                       Save every datum before calling the subroutine.+*+                        UPLOS = UPLO+                        TRANSS = TRANS+                        NS = N+                        KS = K+                        ALS = ALPHA+                        DO 10 I = 1, LAA+                           AS( I ) = AA( I )+   10                   CONTINUE+                        LDAS = LDA+                        DO 20 I = 1, LBB+                           BS( I ) = BB( I )+   20                   CONTINUE+                        LDBS = LDB+                        IF( CONJ )THEN+                           RBETS = RBETA+                        ELSE+                           BETS = BETA+                        END IF+                        DO 30 I = 1, LCC+                           CS( I ) = CC( I )+   30                   CONTINUE+                        LDCS = LDC+*+*                       Call the subroutine.+*+                        IF( CONJ )THEN+                           IF( TRACE )+     $                        WRITE( NTRA, FMT = 9994 )NC, SNAME, UPLO,+     $                        TRANS, N, K, ALPHA, LDA, LDB, RBETA, LDC+                           IF( REWI )+     $                        REWIND NTRA+                           CALL CHER2K( UPLO, TRANS, N, K, ALPHA, AA,+     $                                  LDA, BB, LDB, RBETA, CC, LDC )+                        ELSE+                           IF( TRACE )+     $                        WRITE( NTRA, FMT = 9993 )NC, SNAME, UPLO,+     $                        TRANS, N, K, ALPHA, LDA, LDB, BETA, LDC+                           IF( REWI )+     $                        REWIND NTRA+                           CALL CSYR2K( UPLO, TRANS, N, K, ALPHA, AA,+     $                                  LDA, BB, LDB, BETA, CC, LDC )+                        END IF+*+*                       Check if error-exit was taken incorrectly.+*+                        IF( .NOT.OK )THEN+                           WRITE( NOUT, FMT = 9992 )+                           FATAL = .TRUE.+                           GO TO 150+                        END IF+*+*                       See what data changed inside subroutines.+*+                        ISAME( 1 ) = UPLOS.EQ.UPLO+                        ISAME( 2 ) = TRANSS.EQ.TRANS+                        ISAME( 3 ) = NS.EQ.N+                        ISAME( 4 ) = KS.EQ.K+                        ISAME( 5 ) = ALS.EQ.ALPHA+                        ISAME( 6 ) = LCE( AS, AA, LAA )+                        ISAME( 7 ) = LDAS.EQ.LDA+                        ISAME( 8 ) = LCE( BS, BB, LBB )+                        ISAME( 9 ) = LDBS.EQ.LDB+                        IF( CONJ )THEN+                           ISAME( 10 ) = RBETS.EQ.RBETA+                        ELSE+                           ISAME( 10 ) = BETS.EQ.BETA+                        END IF+                        IF( NULL )THEN+                           ISAME( 11 ) = LCE( CS, CC, LCC )+                        ELSE+                           ISAME( 11 ) = LCERES( 'HE', UPLO, N, N, CS,+     $                                   CC, LDC )+                        END IF+                        ISAME( 12 ) = LDCS.EQ.LDC+*+*                       If data was incorrectly changed, report and+*                       return.+*+                        SAME = .TRUE.+                        DO 40 I = 1, NARGS+                           SAME = SAME.AND.ISAME( I )+                           IF( .NOT.ISAME( I ) )+     $                        WRITE( NOUT, FMT = 9998 )I+   40                   CONTINUE+                        IF( .NOT.SAME )THEN+                           FATAL = .TRUE.+                           GO TO 150+                        END IF+*+                        IF( .NOT.NULL )THEN+*+*                          Check the result column by column.+*+                           IF( CONJ )THEN+                              TRANST = 'C'+                           ELSE+                              TRANST = 'T'+                           END IF+                           JJAB = 1+                           JC = 1+                           DO 70 J = 1, N+                              IF( UPPER )THEN+                                 JJ = 1+                                 LJ = J+                              ELSE+                                 JJ = J+                                 LJ = N - J + 1+                              END IF+                              IF( TRAN )THEN+                                 DO 50 I = 1, K+                                    W( I ) = ALPHA*AB( ( J - 1 )*2*+     $                                       NMAX + K + I )+                                    IF( CONJ )THEN+                                       W( K + I ) = CONJG( ALPHA )*+     $                                              AB( ( J - 1 )*2*+     $                                              NMAX + I )+                                    ELSE+                                       W( K + I ) = ALPHA*+     $                                              AB( ( J - 1 )*2*+     $                                              NMAX + I )+                                    END IF+   50                            CONTINUE+                                 CALL CMMCH( TRANST, 'N', LJ, 1, 2*K,+     $                                       ONE, AB( JJAB ), 2*NMAX, W,+     $                                       2*NMAX, BETA, C( JJ, J ),+     $                                       NMAX, CT, G, CC( JC ), LDC,+     $                                       EPS, ERR, FATAL, NOUT,+     $                                       .TRUE. )+                              ELSE+                                 DO 60 I = 1, K+                                    IF( CONJ )THEN+                                       W( I ) = ALPHA*CONJG( AB( ( K ++     $                                          I - 1 )*NMAX + J ) )+                                       W( K + I ) = CONJG( ALPHA*+     $                                              AB( ( I - 1 )*NMAX ++     $                                              J ) )+                                    ELSE+                                       W( I ) = ALPHA*AB( ( K + I - 1 )*+     $                                          NMAX + J )+                                       W( K + I ) = ALPHA*+     $                                              AB( ( I - 1 )*NMAX ++     $                                              J )+                                    END IF+   60                            CONTINUE+                                 CALL CMMCH( 'N', 'N', LJ, 1, 2*K, ONE,+     $                                       AB( JJ ), NMAX, W, 2*NMAX,+     $                                       BETA, C( JJ, J ), NMAX, CT,+     $                                       G, CC( JC ), LDC, EPS, ERR,+     $                                       FATAL, NOUT, .TRUE. )+                              END IF+                              IF( UPPER )THEN+                                 JC = JC + LDC+                              ELSE+                                 JC = JC + LDC + 1+                                 IF( TRAN )+     $                              JJAB = JJAB + 2*NMAX+                              END IF+                              ERRMAX = MAX( ERRMAX, ERR )+*                             If got really bad answer, report and+*                             return.+                              IF( FATAL )+     $                           GO TO 140+   70                      CONTINUE+                        END IF+*+   80                CONTINUE+*+   90             CONTINUE+*+  100          CONTINUE+*+  110       CONTINUE+*+  120    CONTINUE+*+  130 CONTINUE+*+*     Report result.+*+      IF( ERRMAX.LT.THRESH )THEN+         WRITE( NOUT, FMT = 9999 )SNAME, NC+      ELSE+         WRITE( NOUT, FMT = 9997 )SNAME, NC, ERRMAX+      END IF+      GO TO 160+*+  140 CONTINUE+      IF( N.GT.1 )+     $   WRITE( NOUT, FMT = 9995 )J+*+  150 CONTINUE+      WRITE( NOUT, FMT = 9996 )SNAME+      IF( CONJ )THEN+         WRITE( NOUT, FMT = 9994 )NC, SNAME, UPLO, TRANS, N, K, ALPHA,+     $      LDA, LDB, RBETA, LDC+      ELSE+         WRITE( NOUT, FMT = 9993 )NC, SNAME, UPLO, TRANS, N, K, ALPHA,+     $      LDA, LDB, BETA, LDC+      END IF+*+  160 CONTINUE+      RETURN+*+ 9999 FORMAT( ' ', A6, ' PASSED THE COMPUTATIONAL TESTS (', I6, ' CALL',+     $      'S)' )+ 9998 FORMAT( ' ******* FATAL ERROR - PARAMETER NUMBER ', I2, ' WAS CH',+     $      'ANGED INCORRECTLY *******' )+ 9997 FORMAT( ' ', A6, ' COMPLETED THE COMPUTATIONAL TESTS (', I6, ' C',+     $      'ALLS)', /' ******* BUT WITH MAXIMUM TEST RATIO', F8.2,+     $      ' - SUSPECT *******' )+ 9996 FORMAT( ' ******* ', A6, ' FAILED ON CALL NUMBER:' )+ 9995 FORMAT( '      THESE ARE THE RESULTS FOR COLUMN ', I3 )+ 9994 FORMAT( 1X, I6, ': ', A6, '(', 2( '''', A1, ''',' ), 2( I3, ',' ),+     $      '(', F4.1, ',', F4.1, '), A,', I3, ', B,', I3, ',', F4.1,+     $      ', C,', I3, ')           .' )+ 9993 FORMAT( 1X, I6, ': ', A6, '(', 2( '''', A1, ''',' ), 2( I3, ',' ),+     $      '(', F4.1, ',', F4.1, '), A,', I3, ', B,', I3, ',(', F4.1,+     $      ',', F4.1, '), C,', I3, ')    .' )+ 9992 FORMAT( ' ******* FATAL ERROR - ERROR-EXIT TAKEN ON VALID CALL *',+     $      '******' )+*+*     End of CCHK5.+*+      END+      SUBROUTINE CCHKE( ISNUM, SRNAMT, NOUT )+*+*  Tests the error exits from the Level 3 Blas.+*  Requires a special version of the error-handling routine XERBLA.+*  A, B and C should not need to be defined.+*+*  Auxiliary routine for test program for Level 3 Blas.+*+*  -- Written on 8-February-1989.+*     Jack Dongarra, Argonne National Laboratory.+*     Iain Duff, AERE Harwell.+*     Jeremy Du Croz, Numerical Algorithms Group Ltd.+*     Sven Hammarling, Numerical Algorithms Group Ltd.+*+*  3-19-92:  Initialize ALPHA, BETA, RALPHA, and RBETA  (eca)+*  3-19-92:  Fix argument 12 in calls to CSYMM and CHEMM+*            with INFOT = 9  (eca)+*+*     .. Scalar Arguments ..+      INTEGER            ISNUM, NOUT+      CHARACTER*6        SRNAMT+*     .. Scalars in Common ..+      INTEGER            INFOT, NOUTC+      LOGICAL            LERR, OK+*     .. Parameters ..+      REAL               ONE, TWO+      PARAMETER          ( ONE = 1.0E0, TWO = 2.0E0 )+*     .. Local Scalars ..+      COMPLEX            ALPHA, BETA+      REAL               RALPHA, RBETA+*     .. Local Arrays ..+      COMPLEX            A( 2, 1 ), B( 2, 1 ), C( 2, 1 )+*     .. External Subroutines ..+      EXTERNAL           CGEMM, CHEMM, CHER2K, CHERK, CHKXER, CSYMM,+     $                   CSYR2K, CSYRK, CTRMM, CTRSM+*     .. Common blocks ..+      COMMON             /INFOC/INFOT, NOUTC, OK, LERR+*     .. Executable Statements ..+*     OK is set to .FALSE. by the special version of XERBLA or by CHKXER+*     if anything is wrong.+      OK = .TRUE.+*     LERR is set to .TRUE. by the special version of XERBLA each time+*     it is called, and is then tested and re-set by CHKXER.+      LERR = .FALSE.+*+*     Initialize ALPHA, BETA, RALPHA, and RBETA.+*+      ALPHA = CMPLX( ONE, -ONE )+      BETA = CMPLX( TWO, -TWO )+      RALPHA = ONE+      RBETA = TWO+*+      GO TO ( 10, 20, 30, 40, 50, 60, 70, 80,+     $        90 )ISNUM+   10 INFOT = 1+      CALL CGEMM( '/', 'N', 0, 0, 0, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 1+      CALL CGEMM( '/', 'C', 0, 0, 0, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 1+      CALL CGEMM( '/', 'T', 0, 0, 0, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 2+      CALL CGEMM( 'N', '/', 0, 0, 0, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 2+      CALL CGEMM( 'C', '/', 0, 0, 0, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 2+      CALL CGEMM( 'T', '/', 0, 0, 0, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 3+      CALL CGEMM( 'N', 'N', -1, 0, 0, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 3+      CALL CGEMM( 'N', 'C', -1, 0, 0, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 3+      CALL CGEMM( 'N', 'T', -1, 0, 0, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 3+      CALL CGEMM( 'C', 'N', -1, 0, 0, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 3+      CALL CGEMM( 'C', 'C', -1, 0, 0, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 3+      CALL CGEMM( 'C', 'T', -1, 0, 0, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 3+      CALL CGEMM( 'T', 'N', -1, 0, 0, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 3+      CALL CGEMM( 'T', 'C', -1, 0, 0, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 3+      CALL CGEMM( 'T', 'T', -1, 0, 0, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 4+      CALL CGEMM( 'N', 'N', 0, -1, 0, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 4+      CALL CGEMM( 'N', 'C', 0, -1, 0, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 4+      CALL CGEMM( 'N', 'T', 0, -1, 0, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 4+      CALL CGEMM( 'C', 'N', 0, -1, 0, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 4+      CALL CGEMM( 'C', 'C', 0, -1, 0, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 4+      CALL CGEMM( 'C', 'T', 0, -1, 0, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 4+      CALL CGEMM( 'T', 'N', 0, -1, 0, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 4+      CALL CGEMM( 'T', 'C', 0, -1, 0, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 4+      CALL CGEMM( 'T', 'T', 0, -1, 0, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 5+      CALL CGEMM( 'N', 'N', 0, 0, -1, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 5+      CALL CGEMM( 'N', 'C', 0, 0, -1, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 5+      CALL CGEMM( 'N', 'T', 0, 0, -1, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 5+      CALL CGEMM( 'C', 'N', 0, 0, -1, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 5+      CALL CGEMM( 'C', 'C', 0, 0, -1, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 5+      CALL CGEMM( 'C', 'T', 0, 0, -1, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 5+      CALL CGEMM( 'T', 'N', 0, 0, -1, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 5+      CALL CGEMM( 'T', 'C', 0, 0, -1, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 5+      CALL CGEMM( 'T', 'T', 0, 0, -1, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 8+      CALL CGEMM( 'N', 'N', 2, 0, 0, ALPHA, A, 1, B, 1, BETA, C, 2 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 8+      CALL CGEMM( 'N', 'C', 2, 0, 0, ALPHA, A, 1, B, 1, BETA, C, 2 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 8+      CALL CGEMM( 'N', 'T', 2, 0, 0, ALPHA, A, 1, B, 1, BETA, C, 2 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 8+      CALL CGEMM( 'C', 'N', 0, 0, 2, ALPHA, A, 1, B, 2, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 8+      CALL CGEMM( 'C', 'C', 0, 0, 2, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 8+      CALL CGEMM( 'C', 'T', 0, 0, 2, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 8+      CALL CGEMM( 'T', 'N', 0, 0, 2, ALPHA, A, 1, B, 2, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 8+      CALL CGEMM( 'T', 'C', 0, 0, 2, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 8+      CALL CGEMM( 'T', 'T', 0, 0, 2, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 10+      CALL CGEMM( 'N', 'N', 0, 0, 2, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 10+      CALL CGEMM( 'C', 'N', 0, 0, 2, ALPHA, A, 2, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 10+      CALL CGEMM( 'T', 'N', 0, 0, 2, ALPHA, A, 2, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 10+      CALL CGEMM( 'N', 'C', 0, 2, 0, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 10+      CALL CGEMM( 'C', 'C', 0, 2, 0, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 10+      CALL CGEMM( 'T', 'C', 0, 2, 0, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 10+      CALL CGEMM( 'N', 'T', 0, 2, 0, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 10+      CALL CGEMM( 'C', 'T', 0, 2, 0, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 10+      CALL CGEMM( 'T', 'T', 0, 2, 0, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 13+      CALL CGEMM( 'N', 'N', 2, 0, 0, ALPHA, A, 2, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 13+      CALL CGEMM( 'N', 'C', 2, 0, 0, ALPHA, A, 2, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 13+      CALL CGEMM( 'N', 'T', 2, 0, 0, ALPHA, A, 2, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 13+      CALL CGEMM( 'C', 'N', 2, 0, 0, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 13+      CALL CGEMM( 'C', 'C', 2, 0, 0, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 13+      CALL CGEMM( 'C', 'T', 2, 0, 0, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 13+      CALL CGEMM( 'T', 'N', 2, 0, 0, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 13+      CALL CGEMM( 'T', 'C', 2, 0, 0, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 13+      CALL CGEMM( 'T', 'T', 2, 0, 0, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      GO TO 100+   20 INFOT = 1+      CALL CHEMM( '/', 'U', 0, 0, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 2+      CALL CHEMM( 'L', '/', 0, 0, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 3+      CALL CHEMM( 'L', 'U', -1, 0, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 3+      CALL CHEMM( 'R', 'U', -1, 0, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 3+      CALL CHEMM( 'L', 'L', -1, 0, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 3+      CALL CHEMM( 'R', 'L', -1, 0, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 4+      CALL CHEMM( 'L', 'U', 0, -1, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 4+      CALL CHEMM( 'R', 'U', 0, -1, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 4+      CALL CHEMM( 'L', 'L', 0, -1, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 4+      CALL CHEMM( 'R', 'L', 0, -1, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 7+      CALL CHEMM( 'L', 'U', 2, 0, ALPHA, A, 1, B, 2, BETA, C, 2 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 7+      CALL CHEMM( 'R', 'U', 0, 2, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 7+      CALL CHEMM( 'L', 'L', 2, 0, ALPHA, A, 1, B, 2, BETA, C, 2 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 7+      CALL CHEMM( 'R', 'L', 0, 2, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 9+      CALL CHEMM( 'L', 'U', 2, 0, ALPHA, A, 2, B, 1, BETA, C, 2 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 9+      CALL CHEMM( 'R', 'U', 2, 0, ALPHA, A, 1, B, 1, BETA, C, 2 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 9+      CALL CHEMM( 'L', 'L', 2, 0, ALPHA, A, 2, B, 1, BETA, C, 2 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 9+      CALL CHEMM( 'R', 'L', 2, 0, ALPHA, A, 1, B, 1, BETA, C, 2 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 12+      CALL CHEMM( 'L', 'U', 2, 0, ALPHA, A, 2, B, 2, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 12+      CALL CHEMM( 'R', 'U', 2, 0, ALPHA, A, 1, B, 2, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 12+      CALL CHEMM( 'L', 'L', 2, 0, ALPHA, A, 2, B, 2, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 12+      CALL CHEMM( 'R', 'L', 2, 0, ALPHA, A, 1, B, 2, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      GO TO 100+   30 INFOT = 1+      CALL CSYMM( '/', 'U', 0, 0, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 2+      CALL CSYMM( 'L', '/', 0, 0, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 3+      CALL CSYMM( 'L', 'U', -1, 0, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 3+      CALL CSYMM( 'R', 'U', -1, 0, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 3+      CALL CSYMM( 'L', 'L', -1, 0, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 3+      CALL CSYMM( 'R', 'L', -1, 0, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 4+      CALL CSYMM( 'L', 'U', 0, -1, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 4+      CALL CSYMM( 'R', 'U', 0, -1, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 4+      CALL CSYMM( 'L', 'L', 0, -1, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 4+      CALL CSYMM( 'R', 'L', 0, -1, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 7+      CALL CSYMM( 'L', 'U', 2, 0, ALPHA, A, 1, B, 2, BETA, C, 2 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 7+      CALL CSYMM( 'R', 'U', 0, 2, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 7+      CALL CSYMM( 'L', 'L', 2, 0, ALPHA, A, 1, B, 2, BETA, C, 2 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 7+      CALL CSYMM( 'R', 'L', 0, 2, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 9+      CALL CSYMM( 'L', 'U', 2, 0, ALPHA, A, 2, B, 1, BETA, C, 2 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 9+      CALL CSYMM( 'R', 'U', 2, 0, ALPHA, A, 1, B, 1, BETA, C, 2 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 9+      CALL CSYMM( 'L', 'L', 2, 0, ALPHA, A, 2, B, 1, BETA, C, 2 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 9+      CALL CSYMM( 'R', 'L', 2, 0, ALPHA, A, 1, B, 1, BETA, C, 2 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 12+      CALL CSYMM( 'L', 'U', 2, 0, ALPHA, A, 2, B, 2, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 12+      CALL CSYMM( 'R', 'U', 2, 0, ALPHA, A, 1, B, 2, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 12+      CALL CSYMM( 'L', 'L', 2, 0, ALPHA, A, 2, B, 2, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 12+      CALL CSYMM( 'R', 'L', 2, 0, ALPHA, A, 1, B, 2, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      GO TO 100+   40 INFOT = 1+      CALL CTRMM( '/', 'U', 'N', 'N', 0, 0, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 2+      CALL CTRMM( 'L', '/', 'N', 'N', 0, 0, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 3+      CALL CTRMM( 'L', 'U', '/', 'N', 0, 0, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 4+      CALL CTRMM( 'L', 'U', 'N', '/', 0, 0, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 5+      CALL CTRMM( 'L', 'U', 'N', 'N', -1, 0, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 5+      CALL CTRMM( 'L', 'U', 'C', 'N', -1, 0, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 5+      CALL CTRMM( 'L', 'U', 'T', 'N', -1, 0, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 5+      CALL CTRMM( 'R', 'U', 'N', 'N', -1, 0, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 5+      CALL CTRMM( 'R', 'U', 'C', 'N', -1, 0, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 5+      CALL CTRMM( 'R', 'U', 'T', 'N', -1, 0, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 5+      CALL CTRMM( 'L', 'L', 'N', 'N', -1, 0, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 5+      CALL CTRMM( 'L', 'L', 'C', 'N', -1, 0, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 5+      CALL CTRMM( 'L', 'L', 'T', 'N', -1, 0, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 5+      CALL CTRMM( 'R', 'L', 'N', 'N', -1, 0, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 5+      CALL CTRMM( 'R', 'L', 'C', 'N', -1, 0, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 5+      CALL CTRMM( 'R', 'L', 'T', 'N', -1, 0, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 6+      CALL CTRMM( 'L', 'U', 'N', 'N', 0, -1, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 6+      CALL CTRMM( 'L', 'U', 'C', 'N', 0, -1, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 6+      CALL CTRMM( 'L', 'U', 'T', 'N', 0, -1, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 6+      CALL CTRMM( 'R', 'U', 'N', 'N', 0, -1, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 6+      CALL CTRMM( 'R', 'U', 'C', 'N', 0, -1, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 6+      CALL CTRMM( 'R', 'U', 'T', 'N', 0, -1, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 6+      CALL CTRMM( 'L', 'L', 'N', 'N', 0, -1, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 6+      CALL CTRMM( 'L', 'L', 'C', 'N', 0, -1, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 6+      CALL CTRMM( 'L', 'L', 'T', 'N', 0, -1, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 6+      CALL CTRMM( 'R', 'L', 'N', 'N', 0, -1, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 6+      CALL CTRMM( 'R', 'L', 'C', 'N', 0, -1, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 6+      CALL CTRMM( 'R', 'L', 'T', 'N', 0, -1, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 9+      CALL CTRMM( 'L', 'U', 'N', 'N', 2, 0, ALPHA, A, 1, B, 2 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 9+      CALL CTRMM( 'L', 'U', 'C', 'N', 2, 0, ALPHA, A, 1, B, 2 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 9+      CALL CTRMM( 'L', 'U', 'T', 'N', 2, 0, ALPHA, A, 1, B, 2 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 9+      CALL CTRMM( 'R', 'U', 'N', 'N', 0, 2, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 9+      CALL CTRMM( 'R', 'U', 'C', 'N', 0, 2, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 9+      CALL CTRMM( 'R', 'U', 'T', 'N', 0, 2, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 9+      CALL CTRMM( 'L', 'L', 'N', 'N', 2, 0, ALPHA, A, 1, B, 2 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 9+      CALL CTRMM( 'L', 'L', 'C', 'N', 2, 0, ALPHA, A, 1, B, 2 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 9+      CALL CTRMM( 'L', 'L', 'T', 'N', 2, 0, ALPHA, A, 1, B, 2 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 9+      CALL CTRMM( 'R', 'L', 'N', 'N', 0, 2, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 9+      CALL CTRMM( 'R', 'L', 'C', 'N', 0, 2, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 9+      CALL CTRMM( 'R', 'L', 'T', 'N', 0, 2, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 11+      CALL CTRMM( 'L', 'U', 'N', 'N', 2, 0, ALPHA, A, 2, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 11+      CALL CTRMM( 'L', 'U', 'C', 'N', 2, 0, ALPHA, A, 2, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 11+      CALL CTRMM( 'L', 'U', 'T', 'N', 2, 0, ALPHA, A, 2, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 11+      CALL CTRMM( 'R', 'U', 'N', 'N', 2, 0, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 11+      CALL CTRMM( 'R', 'U', 'C', 'N', 2, 0, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 11+      CALL CTRMM( 'R', 'U', 'T', 'N', 2, 0, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 11+      CALL CTRMM( 'L', 'L', 'N', 'N', 2, 0, ALPHA, A, 2, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 11+      CALL CTRMM( 'L', 'L', 'C', 'N', 2, 0, ALPHA, A, 2, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 11+      CALL CTRMM( 'L', 'L', 'T', 'N', 2, 0, ALPHA, A, 2, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 11+      CALL CTRMM( 'R', 'L', 'N', 'N', 2, 0, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 11+      CALL CTRMM( 'R', 'L', 'C', 'N', 2, 0, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 11+      CALL CTRMM( 'R', 'L', 'T', 'N', 2, 0, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      GO TO 100+   50 INFOT = 1+      CALL CTRSM( '/', 'U', 'N', 'N', 0, 0, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 2+      CALL CTRSM( 'L', '/', 'N', 'N', 0, 0, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 3+      CALL CTRSM( 'L', 'U', '/', 'N', 0, 0, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 4+      CALL CTRSM( 'L', 'U', 'N', '/', 0, 0, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 5+      CALL CTRSM( 'L', 'U', 'N', 'N', -1, 0, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 5+      CALL CTRSM( 'L', 'U', 'C', 'N', -1, 0, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 5+      CALL CTRSM( 'L', 'U', 'T', 'N', -1, 0, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 5+      CALL CTRSM( 'R', 'U', 'N', 'N', -1, 0, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 5+      CALL CTRSM( 'R', 'U', 'C', 'N', -1, 0, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 5+      CALL CTRSM( 'R', 'U', 'T', 'N', -1, 0, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 5+      CALL CTRSM( 'L', 'L', 'N', 'N', -1, 0, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 5+      CALL CTRSM( 'L', 'L', 'C', 'N', -1, 0, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 5+      CALL CTRSM( 'L', 'L', 'T', 'N', -1, 0, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 5+      CALL CTRSM( 'R', 'L', 'N', 'N', -1, 0, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 5+      CALL CTRSM( 'R', 'L', 'C', 'N', -1, 0, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 5+      CALL CTRSM( 'R', 'L', 'T', 'N', -1, 0, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 6+      CALL CTRSM( 'L', 'U', 'N', 'N', 0, -1, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 6+      CALL CTRSM( 'L', 'U', 'C', 'N', 0, -1, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 6+      CALL CTRSM( 'L', 'U', 'T', 'N', 0, -1, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 6+      CALL CTRSM( 'R', 'U', 'N', 'N', 0, -1, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 6+      CALL CTRSM( 'R', 'U', 'C', 'N', 0, -1, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 6+      CALL CTRSM( 'R', 'U', 'T', 'N', 0, -1, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 6+      CALL CTRSM( 'L', 'L', 'N', 'N', 0, -1, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 6+      CALL CTRSM( 'L', 'L', 'C', 'N', 0, -1, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 6+      CALL CTRSM( 'L', 'L', 'T', 'N', 0, -1, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 6+      CALL CTRSM( 'R', 'L', 'N', 'N', 0, -1, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 6+      CALL CTRSM( 'R', 'L', 'C', 'N', 0, -1, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 6+      CALL CTRSM( 'R', 'L', 'T', 'N', 0, -1, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 9+      CALL CTRSM( 'L', 'U', 'N', 'N', 2, 0, ALPHA, A, 1, B, 2 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 9+      CALL CTRSM( 'L', 'U', 'C', 'N', 2, 0, ALPHA, A, 1, B, 2 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 9+      CALL CTRSM( 'L', 'U', 'T', 'N', 2, 0, ALPHA, A, 1, B, 2 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 9+      CALL CTRSM( 'R', 'U', 'N', 'N', 0, 2, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 9+      CALL CTRSM( 'R', 'U', 'C', 'N', 0, 2, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 9+      CALL CTRSM( 'R', 'U', 'T', 'N', 0, 2, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 9+      CALL CTRSM( 'L', 'L', 'N', 'N', 2, 0, ALPHA, A, 1, B, 2 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 9+      CALL CTRSM( 'L', 'L', 'C', 'N', 2, 0, ALPHA, A, 1, B, 2 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 9+      CALL CTRSM( 'L', 'L', 'T', 'N', 2, 0, ALPHA, A, 1, B, 2 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 9+      CALL CTRSM( 'R', 'L', 'N', 'N', 0, 2, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 9+      CALL CTRSM( 'R', 'L', 'C', 'N', 0, 2, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 9+      CALL CTRSM( 'R', 'L', 'T', 'N', 0, 2, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 11+      CALL CTRSM( 'L', 'U', 'N', 'N', 2, 0, ALPHA, A, 2, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 11+      CALL CTRSM( 'L', 'U', 'C', 'N', 2, 0, ALPHA, A, 2, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 11+      CALL CTRSM( 'L', 'U', 'T', 'N', 2, 0, ALPHA, A, 2, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 11+      CALL CTRSM( 'R', 'U', 'N', 'N', 2, 0, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 11+      CALL CTRSM( 'R', 'U', 'C', 'N', 2, 0, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 11+      CALL CTRSM( 'R', 'U', 'T', 'N', 2, 0, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 11+      CALL CTRSM( 'L', 'L', 'N', 'N', 2, 0, ALPHA, A, 2, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 11+      CALL CTRSM( 'L', 'L', 'C', 'N', 2, 0, ALPHA, A, 2, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 11+      CALL CTRSM( 'L', 'L', 'T', 'N', 2, 0, ALPHA, A, 2, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 11+      CALL CTRSM( 'R', 'L', 'N', 'N', 2, 0, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 11+      CALL CTRSM( 'R', 'L', 'C', 'N', 2, 0, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 11+      CALL CTRSM( 'R', 'L', 'T', 'N', 2, 0, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      GO TO 100+   60 INFOT = 1+      CALL CHERK( '/', 'N', 0, 0, RALPHA, A, 1, RBETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 2+      CALL CHERK( 'U', 'T', 0, 0, RALPHA, A, 1, RBETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 3+      CALL CHERK( 'U', 'N', -1, 0, RALPHA, A, 1, RBETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 3+      CALL CHERK( 'U', 'C', -1, 0, RALPHA, A, 1, RBETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 3+      CALL CHERK( 'L', 'N', -1, 0, RALPHA, A, 1, RBETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 3+      CALL CHERK( 'L', 'C', -1, 0, RALPHA, A, 1, RBETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 4+      CALL CHERK( 'U', 'N', 0, -1, RALPHA, A, 1, RBETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 4+      CALL CHERK( 'U', 'C', 0, -1, RALPHA, A, 1, RBETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 4+      CALL CHERK( 'L', 'N', 0, -1, RALPHA, A, 1, RBETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 4+      CALL CHERK( 'L', 'C', 0, -1, RALPHA, A, 1, RBETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 7+      CALL CHERK( 'U', 'N', 2, 0, RALPHA, A, 1, RBETA, C, 2 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 7+      CALL CHERK( 'U', 'C', 0, 2, RALPHA, A, 1, RBETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 7+      CALL CHERK( 'L', 'N', 2, 0, RALPHA, A, 1, RBETA, C, 2 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 7+      CALL CHERK( 'L', 'C', 0, 2, RALPHA, A, 1, RBETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 10+      CALL CHERK( 'U', 'N', 2, 0, RALPHA, A, 2, RBETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 10+      CALL CHERK( 'U', 'C', 2, 0, RALPHA, A, 1, RBETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 10+      CALL CHERK( 'L', 'N', 2, 0, RALPHA, A, 2, RBETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 10+      CALL CHERK( 'L', 'C', 2, 0, RALPHA, A, 1, RBETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      GO TO 100+   70 INFOT = 1+      CALL CSYRK( '/', 'N', 0, 0, ALPHA, A, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 2+      CALL CSYRK( 'U', 'C', 0, 0, ALPHA, A, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 3+      CALL CSYRK( 'U', 'N', -1, 0, ALPHA, A, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 3+      CALL CSYRK( 'U', 'T', -1, 0, ALPHA, A, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 3+      CALL CSYRK( 'L', 'N', -1, 0, ALPHA, A, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 3+      CALL CSYRK( 'L', 'T', -1, 0, ALPHA, A, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 4+      CALL CSYRK( 'U', 'N', 0, -1, ALPHA, A, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 4+      CALL CSYRK( 'U', 'T', 0, -1, ALPHA, A, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 4+      CALL CSYRK( 'L', 'N', 0, -1, ALPHA, A, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 4+      CALL CSYRK( 'L', 'T', 0, -1, ALPHA, A, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 7+      CALL CSYRK( 'U', 'N', 2, 0, ALPHA, A, 1, BETA, C, 2 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 7+      CALL CSYRK( 'U', 'T', 0, 2, ALPHA, A, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 7+      CALL CSYRK( 'L', 'N', 2, 0, ALPHA, A, 1, BETA, C, 2 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 7+      CALL CSYRK( 'L', 'T', 0, 2, ALPHA, A, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 10+      CALL CSYRK( 'U', 'N', 2, 0, ALPHA, A, 2, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 10+      CALL CSYRK( 'U', 'T', 2, 0, ALPHA, A, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 10+      CALL CSYRK( 'L', 'N', 2, 0, ALPHA, A, 2, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 10+      CALL CSYRK( 'L', 'T', 2, 0, ALPHA, A, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      GO TO 100+   80 INFOT = 1+      CALL CHER2K( '/', 'N', 0, 0, ALPHA, A, 1, B, 1, RBETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 2+      CALL CHER2K( 'U', 'T', 0, 0, ALPHA, A, 1, B, 1, RBETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 3+      CALL CHER2K( 'U', 'N', -1, 0, ALPHA, A, 1, B, 1, RBETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 3+      CALL CHER2K( 'U', 'C', -1, 0, ALPHA, A, 1, B, 1, RBETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 3+      CALL CHER2K( 'L', 'N', -1, 0, ALPHA, A, 1, B, 1, RBETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 3+      CALL CHER2K( 'L', 'C', -1, 0, ALPHA, A, 1, B, 1, RBETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 4+      CALL CHER2K( 'U', 'N', 0, -1, ALPHA, A, 1, B, 1, RBETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 4+      CALL CHER2K( 'U', 'C', 0, -1, ALPHA, A, 1, B, 1, RBETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 4+      CALL CHER2K( 'L', 'N', 0, -1, ALPHA, A, 1, B, 1, RBETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 4+      CALL CHER2K( 'L', 'C', 0, -1, ALPHA, A, 1, B, 1, RBETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 7+      CALL CHER2K( 'U', 'N', 2, 0, ALPHA, A, 1, B, 1, RBETA, C, 2 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 7+      CALL CHER2K( 'U', 'C', 0, 2, ALPHA, A, 1, B, 1, RBETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 7+      CALL CHER2K( 'L', 'N', 2, 0, ALPHA, A, 1, B, 1, RBETA, C, 2 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 7+      CALL CHER2K( 'L', 'C', 0, 2, ALPHA, A, 1, B, 1, RBETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 9+      CALL CHER2K( 'U', 'N', 2, 0, ALPHA, A, 2, B, 1, RBETA, C, 2 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 9+      CALL CHER2K( 'U', 'C', 0, 2, ALPHA, A, 2, B, 1, RBETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 9+      CALL CHER2K( 'L', 'N', 2, 0, ALPHA, A, 2, B, 1, RBETA, C, 2 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 9+      CALL CHER2K( 'L', 'C', 0, 2, ALPHA, A, 2, B, 1, RBETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 12+      CALL CHER2K( 'U', 'N', 2, 0, ALPHA, A, 2, B, 2, RBETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 12+      CALL CHER2K( 'U', 'C', 2, 0, ALPHA, A, 1, B, 1, RBETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 12+      CALL CHER2K( 'L', 'N', 2, 0, ALPHA, A, 2, B, 2, RBETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 12+      CALL CHER2K( 'L', 'C', 2, 0, ALPHA, A, 1, B, 1, RBETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      GO TO 100+   90 INFOT = 1+      CALL CSYR2K( '/', 'N', 0, 0, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 2+      CALL CSYR2K( 'U', 'C', 0, 0, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 3+      CALL CSYR2K( 'U', 'N', -1, 0, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 3+      CALL CSYR2K( 'U', 'T', -1, 0, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 3+      CALL CSYR2K( 'L', 'N', -1, 0, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 3+      CALL CSYR2K( 'L', 'T', -1, 0, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 4+      CALL CSYR2K( 'U', 'N', 0, -1, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 4+      CALL CSYR2K( 'U', 'T', 0, -1, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 4+      CALL CSYR2K( 'L', 'N', 0, -1, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 4+      CALL CSYR2K( 'L', 'T', 0, -1, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 7+      CALL CSYR2K( 'U', 'N', 2, 0, ALPHA, A, 1, B, 1, BETA, C, 2 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 7+      CALL CSYR2K( 'U', 'T', 0, 2, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 7+      CALL CSYR2K( 'L', 'N', 2, 0, ALPHA, A, 1, B, 1, BETA, C, 2 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 7+      CALL CSYR2K( 'L', 'T', 0, 2, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 9+      CALL CSYR2K( 'U', 'N', 2, 0, ALPHA, A, 2, B, 1, BETA, C, 2 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 9+      CALL CSYR2K( 'U', 'T', 0, 2, ALPHA, A, 2, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 9+      CALL CSYR2K( 'L', 'N', 2, 0, ALPHA, A, 2, B, 1, BETA, C, 2 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 9+      CALL CSYR2K( 'L', 'T', 0, 2, ALPHA, A, 2, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 12+      CALL CSYR2K( 'U', 'N', 2, 0, ALPHA, A, 2, B, 2, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 12+      CALL CSYR2K( 'U', 'T', 2, 0, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 12+      CALL CSYR2K( 'L', 'N', 2, 0, ALPHA, A, 2, B, 2, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 12+      CALL CSYR2K( 'L', 'T', 2, 0, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+*+  100 IF( OK )THEN+         WRITE( NOUT, FMT = 9999 )SRNAMT+      ELSE+         WRITE( NOUT, FMT = 9998 )SRNAMT+      END IF+      RETURN+*+ 9999 FORMAT( ' ', A6, ' PASSED THE TESTS OF ERROR-EXITS' )+ 9998 FORMAT( ' ******* ', A6, ' FAILED THE TESTS OF ERROR-EXITS *****',+     $      '**' )+*+*     End of CCHKE.+*+      END+      SUBROUTINE CMAKE( TYPE, UPLO, DIAG, M, N, A, NMAX, AA, LDA, RESET,+     $                  TRANSL )+*+*  Generates values for an M by N matrix A.+*  Stores the values in the array AA in the data structure required+*  by the routine, with unwanted elements set to rogue value.+*+*  TYPE is 'GE', 'HE', 'SY' or 'TR'.+*+*  Auxiliary routine for test program for Level 3 Blas.+*+*  -- Written on 8-February-1989.+*     Jack Dongarra, Argonne National Laboratory.+*     Iain Duff, AERE Harwell.+*     Jeremy Du Croz, Numerical Algorithms Group Ltd.+*     Sven Hammarling, Numerical Algorithms Group Ltd.+*+*     .. Parameters ..+      COMPLEX            ZERO, ONE+      PARAMETER          ( ZERO = ( 0.0, 0.0 ), ONE = ( 1.0, 0.0 ) )+      COMPLEX            ROGUE+      PARAMETER          ( ROGUE = ( -1.0E10, 1.0E10 ) )+      REAL               RZERO+      PARAMETER          ( RZERO = 0.0 )+      REAL               RROGUE+      PARAMETER          ( RROGUE = -1.0E10 )+*     .. Scalar Arguments ..+      COMPLEX            TRANSL+      INTEGER            LDA, M, N, NMAX+      LOGICAL            RESET+      CHARACTER*1        DIAG, UPLO+      CHARACTER*2        TYPE+*     .. Array Arguments ..+      COMPLEX            A( NMAX, * ), AA( * )+*     .. Local Scalars ..+      INTEGER            I, IBEG, IEND, J, JJ+      LOGICAL            GEN, HER, LOWER, SYM, TRI, UNIT, UPPER+*     .. External Functions ..+      COMPLEX            CBEG+      EXTERNAL           CBEG+*     .. Intrinsic Functions ..+      INTRINSIC          CMPLX, CONJG, REAL+*     .. Executable Statements ..+      GEN = TYPE.EQ.'GE'+      HER = TYPE.EQ.'HE'+      SYM = TYPE.EQ.'SY'+      TRI = TYPE.EQ.'TR'+      UPPER = ( HER.OR.SYM.OR.TRI ).AND.UPLO.EQ.'U'+      LOWER = ( HER.OR.SYM.OR.TRI ).AND.UPLO.EQ.'L'+      UNIT = TRI.AND.DIAG.EQ.'U'+*+*     Generate data in array A.+*+      DO 20 J = 1, N+         DO 10 I = 1, M+            IF( GEN.OR.( UPPER.AND.I.LE.J ).OR.( LOWER.AND.I.GE.J ) )+     $          THEN+               A( I, J ) = CBEG( RESET ) + TRANSL+               IF( I.NE.J )THEN+*                 Set some elements to zero+                  IF( N.GT.3.AND.J.EQ.N/2 )+     $               A( I, J ) = ZERO+                  IF( HER )THEN+                     A( J, I ) = CONJG( A( I, J ) )+                  ELSE IF( SYM )THEN+                     A( J, I ) = A( I, J )+                  ELSE IF( TRI )THEN+                     A( J, I ) = ZERO+                  END IF+               END IF+            END IF+   10    CONTINUE+         IF( HER )+     $      A( J, J ) = CMPLX( REAL( A( J, J ) ), RZERO )+         IF( TRI )+     $      A( J, J ) = A( J, J ) + ONE+         IF( UNIT )+     $      A( J, J ) = ONE+   20 CONTINUE+*+*     Store elements in array AS in data structure required by routine.+*+      IF( TYPE.EQ.'GE' )THEN+         DO 50 J = 1, N+            DO 30 I = 1, M+               AA( I + ( J - 1 )*LDA ) = A( I, J )+   30       CONTINUE+            DO 40 I = M + 1, LDA+               AA( I + ( J - 1 )*LDA ) = ROGUE+   40       CONTINUE+   50    CONTINUE+      ELSE IF( TYPE.EQ.'HE'.OR.TYPE.EQ.'SY'.OR.TYPE.EQ.'TR' )THEN+         DO 90 J = 1, N+            IF( UPPER )THEN+               IBEG = 1+               IF( UNIT )THEN+                  IEND = J - 1+               ELSE+                  IEND = J+               END IF+            ELSE+               IF( UNIT )THEN+                  IBEG = J + 1+               ELSE+                  IBEG = J+               END IF+               IEND = N+            END IF+            DO 60 I = 1, IBEG - 1+               AA( I + ( J - 1 )*LDA ) = ROGUE+   60       CONTINUE+            DO 70 I = IBEG, IEND+               AA( I + ( J - 1 )*LDA ) = A( I, J )+   70       CONTINUE+            DO 80 I = IEND + 1, LDA+               AA( I + ( J - 1 )*LDA ) = ROGUE+   80       CONTINUE+            IF( HER )THEN+               JJ = J + ( J - 1 )*LDA+               AA( JJ ) = CMPLX( REAL( AA( JJ ) ), RROGUE )+            END IF+   90    CONTINUE+      END IF+      RETURN+*+*     End of CMAKE.+*+      END+      SUBROUTINE CMMCH( TRANSA, TRANSB, M, N, KK, ALPHA, A, LDA, B, LDB,+     $                  BETA, C, LDC, CT, G, CC, LDCC, EPS, ERR, FATAL,+     $                  NOUT, MV )+*+*  Checks the results of the computational tests.+*+*  Auxiliary routine for test program for Level 3 Blas.+*+*  -- Written on 8-February-1989.+*     Jack Dongarra, Argonne National Laboratory.+*     Iain Duff, AERE Harwell.+*     Jeremy Du Croz, Numerical Algorithms Group Ltd.+*     Sven Hammarling, Numerical Algorithms Group Ltd.+*+*     .. Parameters ..+      COMPLEX            ZERO+      PARAMETER          ( ZERO = ( 0.0, 0.0 ) )+      REAL               RZERO, RONE+      PARAMETER          ( RZERO = 0.0, RONE = 1.0 )+*     .. Scalar Arguments ..+      COMPLEX            ALPHA, BETA+      REAL               EPS, ERR+      INTEGER            KK, LDA, LDB, LDC, LDCC, M, N, NOUT+      LOGICAL            FATAL, MV+      CHARACTER*1        TRANSA, TRANSB+*     .. Array Arguments ..+      COMPLEX            A( LDA, * ), B( LDB, * ), C( LDC, * ),+     $                   CC( LDCC, * ), CT( * )+      REAL               G( * )+*     .. Local Scalars ..+      COMPLEX            CL+      REAL               ERRI+      INTEGER            I, J, K+      LOGICAL            CTRANA, CTRANB, TRANA, TRANB+*     .. Intrinsic Functions ..+      INTRINSIC          ABS, AIMAG, CONJG, MAX, REAL, SQRT+*     .. Statement Functions ..+      REAL               ABS1+*     .. Statement Function definitions ..+      ABS1( CL ) = ABS( REAL( CL ) ) + ABS( AIMAG( CL ) )+*     .. Executable Statements ..+      TRANA = TRANSA.EQ.'T'.OR.TRANSA.EQ.'C'+      TRANB = TRANSB.EQ.'T'.OR.TRANSB.EQ.'C'+      CTRANA = TRANSA.EQ.'C'+      CTRANB = TRANSB.EQ.'C'+*+*     Compute expected result, one column at a time, in CT using data+*     in A, B and C.+*     Compute gauges in G.+*+      DO 220 J = 1, N+*+         DO 10 I = 1, M+            CT( I ) = ZERO+            G( I ) = RZERO+   10    CONTINUE+         IF( .NOT.TRANA.AND..NOT.TRANB )THEN+            DO 30 K = 1, KK+               DO 20 I = 1, M+                  CT( I ) = CT( I ) + A( I, K )*B( K, J )+                  G( I ) = G( I ) + ABS1( A( I, K ) )*ABS1( B( K, J ) )+   20          CONTINUE+   30       CONTINUE+         ELSE IF( TRANA.AND..NOT.TRANB )THEN+            IF( CTRANA )THEN+               DO 50 K = 1, KK+                  DO 40 I = 1, M+                     CT( I ) = CT( I ) + CONJG( A( K, I ) )*B( K, J )+                     G( I ) = G( I ) + ABS1( A( K, I ) )*+     $                        ABS1( B( K, J ) )+   40             CONTINUE+   50          CONTINUE+            ELSE+               DO 70 K = 1, KK+                  DO 60 I = 1, M+                     CT( I ) = CT( I ) + A( K, I )*B( K, J )+                     G( I ) = G( I ) + ABS1( A( K, I ) )*+     $                        ABS1( B( K, J ) )+   60             CONTINUE+   70          CONTINUE+            END IF+         ELSE IF( .NOT.TRANA.AND.TRANB )THEN+            IF( CTRANB )THEN+               DO 90 K = 1, KK+                  DO 80 I = 1, M+                     CT( I ) = CT( I ) + A( I, K )*CONJG( B( J, K ) )+                     G( I ) = G( I ) + ABS1( A( I, K ) )*+     $                        ABS1( B( J, K ) )+   80             CONTINUE+   90          CONTINUE+            ELSE+               DO 110 K = 1, KK+                  DO 100 I = 1, M+                     CT( I ) = CT( I ) + A( I, K )*B( J, K )+                     G( I ) = G( I ) + ABS1( A( I, K ) )*+     $                        ABS1( B( J, K ) )+  100             CONTINUE+  110          CONTINUE+            END IF+         ELSE IF( TRANA.AND.TRANB )THEN+            IF( CTRANA )THEN+               IF( CTRANB )THEN+                  DO 130 K = 1, KK+                     DO 120 I = 1, M+                        CT( I ) = CT( I ) + CONJG( A( K, I ) )*+     $                            CONJG( B( J, K ) )+                        G( I ) = G( I ) + ABS1( A( K, I ) )*+     $                           ABS1( B( J, K ) )+  120                CONTINUE+  130             CONTINUE+               ELSE+                  DO 150 K = 1, KK+                     DO 140 I = 1, M+                        CT( I ) = CT( I ) + CONJG( A( K, I ) )*B( J, K )+                        G( I ) = G( I ) + ABS1( A( K, I ) )*+     $                           ABS1( B( J, K ) )+  140                CONTINUE+  150             CONTINUE+               END IF+            ELSE+               IF( CTRANB )THEN+                  DO 170 K = 1, KK+                     DO 160 I = 1, M+                        CT( I ) = CT( I ) + A( K, I )*CONJG( B( J, K ) )+                        G( I ) = G( I ) + ABS1( A( K, I ) )*+     $                           ABS1( B( J, K ) )+  160                CONTINUE+  170             CONTINUE+               ELSE+                  DO 190 K = 1, KK+                     DO 180 I = 1, M+                        CT( I ) = CT( I ) + A( K, I )*B( J, K )+                        G( I ) = G( I ) + ABS1( A( K, I ) )*+     $                           ABS1( B( J, K ) )+  180                CONTINUE+  190             CONTINUE+               END IF+            END IF+         END IF+         DO 200 I = 1, M+            CT( I ) = ALPHA*CT( I ) + BETA*C( I, J )+            G( I ) = ABS1( ALPHA )*G( I ) ++     $               ABS1( BETA )*ABS1( C( I, J ) )+  200    CONTINUE+*+*        Compute the error ratio for this result.+*+         ERR = ZERO+         DO 210 I = 1, M+            ERRI = ABS1( CT( I ) - CC( I, J ) )/EPS+            IF( G( I ).NE.RZERO )+     $         ERRI = ERRI/G( I )+            ERR = MAX( ERR, ERRI )+            IF( ERR*SQRT( EPS ).GE.RONE )+     $         GO TO 230+  210    CONTINUE+*+  220 CONTINUE+*+*     If the loop completes, all results are at least half accurate.+      GO TO 250+*+*     Report fatal error.+*+  230 FATAL = .TRUE.+      WRITE( NOUT, FMT = 9999 )+      DO 240 I = 1, M+         IF( MV )THEN+            WRITE( NOUT, FMT = 9998 )I, CT( I ), CC( I, J )+         ELSE+            WRITE( NOUT, FMT = 9998 )I, CC( I, J ), CT( I )+         END IF+  240 CONTINUE+      IF( N.GT.1 )+     $   WRITE( NOUT, FMT = 9997 )J+*+  250 CONTINUE+      RETURN+*+ 9999 FORMAT( ' ******* FATAL ERROR - COMPUTED RESULT IS LESS THAN HAL',+     $      'F ACCURATE *******', /'                       EXPECTED RE',+     $      'SULT                    COMPUTED RESULT' )+ 9998 FORMAT( 1X, I7, 2( '  (', G15.6, ',', G15.6, ')' ) )+ 9997 FORMAT( '      THESE ARE THE RESULTS FOR COLUMN ', I3 )+*+*     End of CMMCH.+*+      END+      LOGICAL FUNCTION LCE( RI, RJ, LR )+*+*  Tests if two arrays are identical.+*+*  Auxiliary routine for test program for Level 3 Blas.+*+*  -- Written on 8-February-1989.+*     Jack Dongarra, Argonne National Laboratory.+*     Iain Duff, AERE Harwell.+*     Jeremy Du Croz, Numerical Algorithms Group Ltd.+*     Sven Hammarling, Numerical Algorithms Group Ltd.+*+*     .. Scalar Arguments ..+      INTEGER            LR+*     .. Array Arguments ..+      COMPLEX            RI( * ), RJ( * )+*     .. Local Scalars ..+      INTEGER            I+*     .. Executable Statements ..+      DO 10 I = 1, LR+         IF( RI( I ).NE.RJ( I ) )+     $      GO TO 20+   10 CONTINUE+      LCE = .TRUE.+      GO TO 30+   20 CONTINUE+      LCE = .FALSE.+   30 RETURN+*+*     End of LCE.+*+      END+      LOGICAL FUNCTION LCERES( TYPE, UPLO, M, N, AA, AS, LDA )+*+*  Tests if selected elements in two arrays are equal.+*+*  TYPE is 'GE' or 'HE' or 'SY'.+*+*  Auxiliary routine for test program for Level 3 Blas.+*+*  -- Written on 8-February-1989.+*     Jack Dongarra, Argonne National Laboratory.+*     Iain Duff, AERE Harwell.+*     Jeremy Du Croz, Numerical Algorithms Group Ltd.+*     Sven Hammarling, Numerical Algorithms Group Ltd.+*+*     .. Scalar Arguments ..+      INTEGER            LDA, M, N+      CHARACTER*1        UPLO+      CHARACTER*2        TYPE+*     .. Array Arguments ..+      COMPLEX            AA( LDA, * ), AS( LDA, * )+*     .. Local Scalars ..+      INTEGER            I, IBEG, IEND, J+      LOGICAL            UPPER+*     .. Executable Statements ..+      UPPER = UPLO.EQ.'U'+      IF( TYPE.EQ.'GE' )THEN+         DO 20 J = 1, N+            DO 10 I = M + 1, LDA+               IF( AA( I, J ).NE.AS( I, J ) )+     $            GO TO 70+   10       CONTINUE+   20    CONTINUE+      ELSE IF( TYPE.EQ.'HE'.OR.TYPE.EQ.'SY' )THEN+         DO 50 J = 1, N+            IF( UPPER )THEN+               IBEG = 1+               IEND = J+            ELSE+               IBEG = J+               IEND = N+            END IF+            DO 30 I = 1, IBEG - 1+               IF( AA( I, J ).NE.AS( I, J ) )+     $            GO TO 70+   30       CONTINUE+            DO 40 I = IEND + 1, LDA+               IF( AA( I, J ).NE.AS( I, J ) )+     $            GO TO 70+   40       CONTINUE+   50    CONTINUE+      END IF+*+      LCERES = .TRUE.+      GO TO 80+   70 CONTINUE+      LCERES = .FALSE.+   80 RETURN+*+*     End of LCERES.+*+      END+      COMPLEX FUNCTION CBEG( RESET )+*+*  Generates complex numbers as pairs of random numbers uniformly+*  distributed between -0.5 and 0.5.+*+*  Auxiliary routine for test program for Level 3 Blas.+*+*  -- Written on 8-February-1989.+*     Jack Dongarra, Argonne National Laboratory.+*     Iain Duff, AERE Harwell.+*     Jeremy Du Croz, Numerical Algorithms Group Ltd.+*     Sven Hammarling, Numerical Algorithms Group Ltd.+*+*     .. Scalar Arguments ..+      LOGICAL            RESET+*     .. Local Scalars ..+      INTEGER            I, IC, J, MI, MJ+*     .. Save statement ..+      SAVE               I, IC, J, MI, MJ+*     .. Intrinsic Functions ..+      INTRINSIC          CMPLX+*     .. Executable Statements ..+      IF( RESET )THEN+*        Initialize local variables.+         MI = 891+         MJ = 457+         I = 7+         J = 7+         IC = 0+         RESET = .FALSE.+      END IF+*+*     The sequence of values of I or J is bounded between 1 and 999.+*     If initial I or J = 1,2,3,6,7 or 9, the period will be 50.+*     If initial I or J = 4 or 8, the period will be 25.+*     If initial I or J = 5, the period will be 10.+*     IC is used to break up the period by skipping 1 value of I or J+*     in 6.+*+      IC = IC + 1+   10 I = I*MI+      J = J*MJ+      I = I - 1000*( I/1000 )+      J = J - 1000*( J/1000 )+      IF( IC.GE.5 )THEN+         IC = 0+         GO TO 10+      END IF+      CBEG = CMPLX( ( I - 500 )/1001.0, ( J - 500 )/1001.0 )+      RETURN+*+*     End of CBEG.+*+      END+      REAL FUNCTION SDIFF( X, Y )+*+*  Auxiliary routine for test program for Level 3 Blas.+*+*  -- Written on 8-February-1989.+*     Jack Dongarra, Argonne National Laboratory.+*     Iain Duff, AERE Harwell.+*     Jeremy Du Croz, Numerical Algorithms Group Ltd.+*     Sven Hammarling, Numerical Algorithms Group Ltd.+*+*     .. Scalar Arguments ..+      REAL               X, Y+*     .. Executable Statements ..+      SDIFF = X - Y+      RETURN+*+*     End of SDIFF.+*+      END+      SUBROUTINE CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+*+*  Tests whether XERBLA has detected an error when it should.+*+*  Auxiliary routine for test program for Level 3 Blas.+*+*  -- Written on 8-February-1989.+*     Jack Dongarra, Argonne National Laboratory.+*     Iain Duff, AERE Harwell.+*     Jeremy Du Croz, Numerical Algorithms Group Ltd.+*     Sven Hammarling, Numerical Algorithms Group Ltd.+*+*     .. Scalar Arguments ..+      INTEGER            INFOT, NOUT+      LOGICAL            LERR, OK+      CHARACTER*6        SRNAMT+*     .. Executable Statements ..+      IF( .NOT.LERR )THEN+         WRITE( NOUT, FMT = 9999 )INFOT, SRNAMT+         OK = .FALSE.+      END IF+      LERR = .FALSE.+      RETURN+*+ 9999 FORMAT( ' ***** ILLEGAL VALUE OF PARAMETER NUMBER ', I2, ' NOT D',+     $      'ETECTED BY ', A6, ' *****' )+*+*     End of CHKXER.+*+      END+      SUBROUTINE XERBLA( SRNAME, INFO )+*+*  This is a special version of XERBLA to be used only as part of+*  the test program for testing error exits from the Level 3 BLAS+*  routines.+*+*  XERBLA  is an error handler for the Level 3 BLAS routines.+*+*  It is called by the Level 3 BLAS routines if an input parameter is+*  invalid.+*+*  Auxiliary routine for test program for Level 3 Blas.+*+*  -- Written on 8-February-1989.+*     Jack Dongarra, Argonne National Laboratory.+*     Iain Duff, AERE Harwell.+*     Jeremy Du Croz, Numerical Algorithms Group Ltd.+*     Sven Hammarling, Numerical Algorithms Group Ltd.+*+*     .. Scalar Arguments ..+      INTEGER            INFO+      CHARACTER*6        SRNAME+*     .. Scalars in Common ..+      INTEGER            INFOT, NOUT+      LOGICAL            LERR, OK+      CHARACTER*6        SRNAMT+*     .. Common blocks ..+      COMMON             /INFOC/INFOT, NOUT, OK, LERR+      COMMON             /SRNAMC/SRNAMT+*     .. Executable Statements ..+      LERR = .TRUE.+      IF( INFO.NE.INFOT )THEN+         IF( INFOT.NE.0 )THEN+            WRITE( NOUT, FMT = 9999 )INFO, INFOT+         ELSE+            WRITE( NOUT, FMT = 9997 )INFO+         END IF+         OK = .FALSE.+      END IF+      IF( SRNAME.NE.SRNAMT )THEN+         WRITE( NOUT, FMT = 9998 )SRNAME, SRNAMT+         OK = .FALSE.+      END IF+      RETURN+*+ 9999 FORMAT( ' ******* XERBLA WAS CALLED WITH INFO = ', I6, ' INSTEAD',+     $      ' OF ', I2, ' *******' )+ 9998 FORMAT( ' ******* XERBLA WAS CALLED WITH SRNAME = ', A6, ' INSTE',+     $      'AD OF ', A6, ' *******' )+ 9997 FORMAT( ' ******* XERBLA WAS CALLED WITH INFO = ', I6,+     $      ' *******' )+*+*     End of XERBLA+*+      END+
+ eigen3/blas/testing/dblat1.f view
@@ -0,0 +1,1065 @@+*> \brief \b DBLAT1+*+*  =========== DOCUMENTATION ===========+*+* Online html documentation available at +*            http://www.netlib.org/lapack/explore-html/ +*+*  Definition:+*  ===========+*+*       PROGRAM DBLAT1+* +*+*> \par Purpose:+*  =============+*>+*> \verbatim+*>+*>    Test program for the DOUBLE PRECISION Level 1 BLAS.+*>+*>    Based upon the original BLAS test routine together with:+*>    F06EAF Example Program Text+*> \endverbatim+*+*  Authors:+*  ========+*+*> \author Univ. of Tennessee +*> \author Univ. of California Berkeley +*> \author Univ. of Colorado Denver +*> \author NAG Ltd. +*+*> \date April 2012+*+*> \ingroup double_blas_testing+*+*  =====================================================================+      PROGRAM DBLAT1+*+*  -- Reference BLAS test routine (version 3.4.1) --+*  -- Reference BLAS is a software package provided by Univ. of Tennessee,    --+*  -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--+*     April 2012+*+*  =====================================================================+*+*     .. Parameters ..+      INTEGER          NOUT+      PARAMETER        (NOUT=6)+*     .. Scalars in Common ..+      INTEGER          ICASE, INCX, INCY, N+      LOGICAL          PASS+*     .. Local Scalars ..+      DOUBLE PRECISION SFAC+      INTEGER          IC+*     .. External Subroutines ..+      EXTERNAL         CHECK0, CHECK1, CHECK2, CHECK3, HEADER+*     .. Common blocks ..+      COMMON           /COMBLA/ICASE, N, INCX, INCY, PASS+*     .. Data statements ..+      DATA             SFAC/9.765625D-4/+*     .. Executable Statements ..+      WRITE (NOUT,99999)+      DO 20 IC = 1, 13+         ICASE = IC+         CALL HEADER+*+*        .. Initialize  PASS,  INCX,  and INCY for a new case. ..+*        .. the value 9999 for INCX or INCY will appear in the ..+*        .. detailed  output, if any, for cases  that do not involve ..+*        .. these parameters ..+*+         PASS = .TRUE.+         INCX = 9999+         INCY = 9999+         IF (ICASE.EQ.3 .OR. ICASE.EQ.11) THEN+            CALL CHECK0(SFAC)+         ELSE IF (ICASE.EQ.7 .OR. ICASE.EQ.8 .OR. ICASE.EQ.9 .OR.+     +            ICASE.EQ.10) THEN+            CALL CHECK1(SFAC)+         ELSE IF (ICASE.EQ.1 .OR. ICASE.EQ.2 .OR. ICASE.EQ.5 .OR.+     +            ICASE.EQ.6 .OR. ICASE.EQ.12 .OR. ICASE.EQ.13) THEN+            CALL CHECK2(SFAC)+         ELSE IF (ICASE.EQ.4) THEN+            CALL CHECK3(SFAC)+         END IF+*        -- Print+         IF (PASS) WRITE (NOUT,99998)+   20 CONTINUE+      STOP+*+99999 FORMAT (' Real BLAS Test Program Results',/1X)+99998 FORMAT ('                                    ----- PASS -----')+      END+      SUBROUTINE HEADER+*     .. Parameters ..+      INTEGER          NOUT+      PARAMETER        (NOUT=6)+*     .. Scalars in Common ..+      INTEGER          ICASE, INCX, INCY, N+      LOGICAL          PASS+*     .. Local Arrays ..+      CHARACTER*6      L(13)+*     .. Common blocks ..+      COMMON           /COMBLA/ICASE, N, INCX, INCY, PASS+*     .. Data statements ..+      DATA             L(1)/' DDOT '/+      DATA             L(2)/'DAXPY '/+      DATA             L(3)/'DROTG '/+      DATA             L(4)/' DROT '/+      DATA             L(5)/'DCOPY '/+      DATA             L(6)/'DSWAP '/+      DATA             L(7)/'DNRM2 '/+      DATA             L(8)/'DASUM '/+      DATA             L(9)/'DSCAL '/+      DATA             L(10)/'IDAMAX'/+      DATA             L(11)/'DROTMG'/+      DATA             L(12)/'DROTM '/+      DATA             L(13)/'DSDOT '/+*     .. Executable Statements ..+      WRITE (NOUT,99999) ICASE, L(ICASE)+      RETURN+*+99999 FORMAT (/' Test of subprogram number',I3,12X,A6)+      END+      SUBROUTINE CHECK0(SFAC)+*     .. Parameters ..+      INTEGER           NOUT+      PARAMETER         (NOUT=6)+*     .. Scalar Arguments ..+      DOUBLE PRECISION  SFAC+*     .. Scalars in Common ..+      INTEGER           ICASE, INCX, INCY, N+      LOGICAL           PASS+*     .. Local Scalars ..+      DOUBLE PRECISION  SA, SB, SC, SS, D12+      INTEGER           I, K+*     .. Local Arrays ..+      DOUBLE PRECISION  DA1(8), DATRUE(8), DB1(8), DBTRUE(8), DC1(8),+     $                  DS1(8), DAB(4,9), DTEMP(9), DTRUE(9,9)+*     .. External Subroutines ..+      EXTERNAL          DROTG, DROTMG, STEST1+*     .. Common blocks ..+      COMMON            /COMBLA/ICASE, N, INCX, INCY, PASS+*     .. Data statements ..+      DATA              DA1/0.3D0, 0.4D0, -0.3D0, -0.4D0, -0.3D0, 0.0D0,+     +                  0.0D0, 1.0D0/+      DATA              DB1/0.4D0, 0.3D0, 0.4D0, 0.3D0, -0.4D0, 0.0D0,+     +                  1.0D0, 0.0D0/+      DATA              DC1/0.6D0, 0.8D0, -0.6D0, 0.8D0, 0.6D0, 1.0D0,+     +                  0.0D0, 1.0D0/+      DATA              DS1/0.8D0, 0.6D0, 0.8D0, -0.6D0, 0.8D0, 0.0D0,+     +                  1.0D0, 0.0D0/+      DATA              DATRUE/0.5D0, 0.5D0, 0.5D0, -0.5D0, -0.5D0,+     +                  0.0D0, 1.0D0, 1.0D0/+      DATA              DBTRUE/0.0D0, 0.6D0, 0.0D0, -0.6D0, 0.0D0,+     +                  0.0D0, 1.0D0, 0.0D0/+*     INPUT FOR MODIFIED GIVENS+      DATA DAB/ .1D0,.3D0,1.2D0,.2D0,+     A          .7D0, .2D0, .6D0, 4.2D0,+     B          0.D0,0.D0,0.D0,0.D0,+     C          4.D0, -1.D0, 2.D0, 4.D0,+     D          6.D-10, 2.D-2, 1.D5, 10.D0,+     E          4.D10, 2.D-2, 1.D-5, 10.D0,+     F          2.D-10, 4.D-2, 1.D5, 10.D0,+     G          2.D10, 4.D-2, 1.D-5, 10.D0,+     H          4.D0, -2.D0, 8.D0, 4.D0    /+*    TRUE RESULTS FOR MODIFIED GIVENS+      DATA DTRUE/0.D0,0.D0, 1.3D0, .2D0, 0.D0,0.D0,0.D0, .5D0, 0.D0,+     A           0.D0,0.D0, 4.5D0, 4.2D0, 1.D0, .5D0, 0.D0,0.D0,0.D0,+     B           0.D0,0.D0,0.D0,0.D0, -2.D0, 0.D0,0.D0,0.D0,0.D0,+     C           0.D0,0.D0,0.D0, 4.D0, -1.D0, 0.D0,0.D0,0.D0,0.D0,+     D           0.D0, 15.D-3, 0.D0, 10.D0, -1.D0, 0.D0, -1.D-4,+     E           0.D0, 1.D0,+     F           0.D0,0.D0, 6144.D-5, 10.D0, -1.D0, 4096.D0, -1.D6,+     G           0.D0, 1.D0,+     H           0.D0,0.D0,15.D0,10.D0,-1.D0, 5.D-5, 0.D0,1.D0,0.D0,+     I           0.D0,0.D0, 15.D0, 10.D0, -1. D0, 5.D5, -4096.D0,+     J           1.D0, 4096.D-6,+     K           0.D0,0.D0, 7.D0, 4.D0, 0.D0,0.D0, -.5D0, -.25D0, 0.D0/+*                   4096 = 2 ** 12+      DATA D12  /4096.D0/+      DTRUE(1,1) = 12.D0 / 130.D0+      DTRUE(2,1) = 36.D0 / 130.D0+      DTRUE(7,1) = -1.D0 / 6.D0+      DTRUE(1,2) = 14.D0 / 75.D0+      DTRUE(2,2) = 49.D0 / 75.D0+      DTRUE(9,2) = 1.D0 / 7.D0+      DTRUE(1,5) = 45.D-11 * (D12 * D12)+      DTRUE(3,5) = 4.D5 / (3.D0 * D12)+      DTRUE(6,5) = 1.D0 / D12+      DTRUE(8,5) = 1.D4 / (3.D0 * D12)+      DTRUE(1,6) = 4.D10 / (1.5D0 * D12 * D12)+      DTRUE(2,6) = 2.D-2 / 1.5D0+      DTRUE(8,6) = 5.D-7 * D12+      DTRUE(1,7) = 4.D0 / 150.D0+      DTRUE(2,7) = (2.D-10 / 1.5D0) * (D12 * D12)+      DTRUE(7,7) = -DTRUE(6,5)+      DTRUE(9,7) = 1.D4 / D12+      DTRUE(1,8) = DTRUE(1,7)+      DTRUE(2,8) = 2.D10 / (1.5D0 * D12 * D12)+      DTRUE(1,9) = 32.D0 / 7.D0+      DTRUE(2,9) = -16.D0 / 7.D0+*     .. Executable Statements ..+*+*     Compute true values which cannot be prestored+*     in decimal notation+*+      DBTRUE(1) = 1.0D0/0.6D0+      DBTRUE(3) = -1.0D0/0.6D0+      DBTRUE(5) = 1.0D0/0.6D0+*+      DO 20 K = 1, 8+*        .. Set N=K for identification in output if any ..+         N = K+         IF (ICASE.EQ.3) THEN+*           .. DROTG ..+            IF (K.GT.8) GO TO 40+            SA = DA1(K)+            SB = DB1(K)+            CALL DROTG(SA,SB,SC,SS)+            CALL STEST1(SA,DATRUE(K),DATRUE(K),SFAC)+            CALL STEST1(SB,DBTRUE(K),DBTRUE(K),SFAC)+            CALL STEST1(SC,DC1(K),DC1(K),SFAC)+            CALL STEST1(SS,DS1(K),DS1(K),SFAC)+         ELSEIF (ICASE.EQ.11) THEN+*           .. DROTMG ..+            DO I=1,4+               DTEMP(I)= DAB(I,K)+               DTEMP(I+4) = 0.0+            END DO+            DTEMP(9) = 0.0+            CALL DROTMG(DTEMP(1),DTEMP(2),DTEMP(3),DTEMP(4),DTEMP(5))+            CALL STEST(9,DTEMP,DTRUE(1,K),DTRUE(1,K),SFAC)+         ELSE+            WRITE (NOUT,*) ' Shouldn''t be here in CHECK0'+            STOP+         END IF+   20 CONTINUE+   40 RETURN+      END+      SUBROUTINE CHECK1(SFAC)+*     .. Parameters ..+      INTEGER           NOUT+      PARAMETER         (NOUT=6)+*     .. Scalar Arguments ..+      DOUBLE PRECISION  SFAC+*     .. Scalars in Common ..+      INTEGER           ICASE, INCX, INCY, N+      LOGICAL           PASS+*     .. Local Scalars ..+      INTEGER           I, LEN, NP1+*     .. Local Arrays ..+      DOUBLE PRECISION  DTRUE1(5), DTRUE3(5), DTRUE5(8,5,2), DV(8,5,2),+     +                  SA(10), STEMP(1), STRUE(8), SX(8)+      INTEGER           ITRUE2(5)+*     .. External Functions ..+      DOUBLE PRECISION  DASUM, DNRM2+      INTEGER           IDAMAX+      EXTERNAL          DASUM, DNRM2, IDAMAX+*     .. External Subroutines ..+      EXTERNAL          ITEST1, DSCAL, STEST, STEST1+*     .. Intrinsic Functions ..+      INTRINSIC         MAX+*     .. Common blocks ..+      COMMON            /COMBLA/ICASE, N, INCX, INCY, PASS+*     .. Data statements ..+      DATA              SA/0.3D0, -1.0D0, 0.0D0, 1.0D0, 0.3D0, 0.3D0,+     +                  0.3D0, 0.3D0, 0.3D0, 0.3D0/+      DATA              DV/0.1D0, 2.0D0, 2.0D0, 2.0D0, 2.0D0, 2.0D0,+     +                  2.0D0, 2.0D0, 0.3D0, 3.0D0, 3.0D0, 3.0D0, 3.0D0,+     +                  3.0D0, 3.0D0, 3.0D0, 0.3D0, -0.4D0, 4.0D0,+     +                  4.0D0, 4.0D0, 4.0D0, 4.0D0, 4.0D0, 0.2D0,+     +                  -0.6D0, 0.3D0, 5.0D0, 5.0D0, 5.0D0, 5.0D0,+     +                  5.0D0, 0.1D0, -0.3D0, 0.5D0, -0.1D0, 6.0D0,+     +                  6.0D0, 6.0D0, 6.0D0, 0.1D0, 8.0D0, 8.0D0, 8.0D0,+     +                  8.0D0, 8.0D0, 8.0D0, 8.0D0, 0.3D0, 9.0D0, 9.0D0,+     +                  9.0D0, 9.0D0, 9.0D0, 9.0D0, 9.0D0, 0.3D0, 2.0D0,+     +                  -0.4D0, 2.0D0, 2.0D0, 2.0D0, 2.0D0, 2.0D0,+     +                  0.2D0, 3.0D0, -0.6D0, 5.0D0, 0.3D0, 2.0D0,+     +                  2.0D0, 2.0D0, 0.1D0, 4.0D0, -0.3D0, 6.0D0,+     +                  -0.5D0, 7.0D0, -0.1D0, 3.0D0/+      DATA              DTRUE1/0.0D0, 0.3D0, 0.5D0, 0.7D0, 0.6D0/+      DATA              DTRUE3/0.0D0, 0.3D0, 0.7D0, 1.1D0, 1.0D0/+      DATA              DTRUE5/0.10D0, 2.0D0, 2.0D0, 2.0D0, 2.0D0,+     +                  2.0D0, 2.0D0, 2.0D0, -0.3D0, 3.0D0, 3.0D0,+     +                  3.0D0, 3.0D0, 3.0D0, 3.0D0, 3.0D0, 0.0D0, 0.0D0,+     +                  4.0D0, 4.0D0, 4.0D0, 4.0D0, 4.0D0, 4.0D0,+     +                  0.20D0, -0.60D0, 0.30D0, 5.0D0, 5.0D0, 5.0D0,+     +                  5.0D0, 5.0D0, 0.03D0, -0.09D0, 0.15D0, -0.03D0,+     +                  6.0D0, 6.0D0, 6.0D0, 6.0D0, 0.10D0, 8.0D0,+     +                  8.0D0, 8.0D0, 8.0D0, 8.0D0, 8.0D0, 8.0D0,+     +                  0.09D0, 9.0D0, 9.0D0, 9.0D0, 9.0D0, 9.0D0,+     +                  9.0D0, 9.0D0, 0.09D0, 2.0D0, -0.12D0, 2.0D0,+     +                  2.0D0, 2.0D0, 2.0D0, 2.0D0, 0.06D0, 3.0D0,+     +                  -0.18D0, 5.0D0, 0.09D0, 2.0D0, 2.0D0, 2.0D0,+     +                  0.03D0, 4.0D0, -0.09D0, 6.0D0, -0.15D0, 7.0D0,+     +                  -0.03D0, 3.0D0/+      DATA              ITRUE2/0, 1, 2, 2, 3/+*     .. Executable Statements ..+      DO 80 INCX = 1, 2+         DO 60 NP1 = 1, 5+            N = NP1 - 1+            LEN = 2*MAX(N,1)+*           .. Set vector arguments ..+            DO 20 I = 1, LEN+               SX(I) = DV(I,NP1,INCX)+   20       CONTINUE+*+            IF (ICASE.EQ.7) THEN+*              .. DNRM2 ..+               STEMP(1) = DTRUE1(NP1)+               CALL STEST1(DNRM2(N,SX,INCX),STEMP(1),STEMP,SFAC)+            ELSE IF (ICASE.EQ.8) THEN+*              .. DASUM ..+               STEMP(1) = DTRUE3(NP1)+               CALL STEST1(DASUM(N,SX,INCX),STEMP(1),STEMP,SFAC)+            ELSE IF (ICASE.EQ.9) THEN+*              .. DSCAL ..+               CALL DSCAL(N,SA((INCX-1)*5+NP1),SX,INCX)+               DO 40 I = 1, LEN+                  STRUE(I) = DTRUE5(I,NP1,INCX)+   40          CONTINUE+               CALL STEST(LEN,SX,STRUE,STRUE,SFAC)+            ELSE IF (ICASE.EQ.10) THEN+*              .. IDAMAX ..+               CALL ITEST1(IDAMAX(N,SX,INCX),ITRUE2(NP1))+            ELSE+               WRITE (NOUT,*) ' Shouldn''t be here in CHECK1'+               STOP+            END IF+   60    CONTINUE+   80 CONTINUE+      RETURN+      END+      SUBROUTINE CHECK2(SFAC)+*     .. Parameters ..+      INTEGER           NOUT+      PARAMETER         (NOUT=6)+*     .. Scalar Arguments ..+      DOUBLE PRECISION  SFAC+*     .. Scalars in Common ..+      INTEGER           ICASE, INCX, INCY, N+      LOGICAL           PASS+*     .. Local Scalars ..+      DOUBLE PRECISION  SA+      INTEGER           I, J, KI, KN, KNI, KPAR, KSIZE, LENX, LENY,+     $                  MX, MY +*     .. Local Arrays ..+      DOUBLE PRECISION  DT10X(7,4,4), DT10Y(7,4,4), DT7(4,4),+     $                  DT8(7,4,4), DX1(7),+     $                  DY1(7), SSIZE1(4), SSIZE2(14,2), SSIZE(7),+     $                  STX(7), STY(7), SX(7), SY(7),+     $                  DPAR(5,4), DT19X(7,4,16),DT19XA(7,4,4),+     $                  DT19XB(7,4,4), DT19XC(7,4,4),DT19XD(7,4,4),+     $                  DT19Y(7,4,16), DT19YA(7,4,4),DT19YB(7,4,4),+     $                  DT19YC(7,4,4), DT19YD(7,4,4), DTEMP(5)+      INTEGER           INCXS(4), INCYS(4), LENS(4,2), NS(4)+*     .. External Functions ..+      DOUBLE PRECISION  DDOT, DSDOT+      EXTERNAL          DDOT, DSDOT+*     .. External Subroutines ..+      EXTERNAL          DAXPY, DCOPY, DROTM, DSWAP, STEST, STEST1+*     .. Intrinsic Functions ..+      INTRINSIC         ABS, MIN+*     .. Common blocks ..+      COMMON            /COMBLA/ICASE, N, INCX, INCY, PASS+*     .. Data statements ..+      EQUIVALENCE (DT19X(1,1,1),DT19XA(1,1,1)),(DT19X(1,1,5),+     A   DT19XB(1,1,1)),(DT19X(1,1,9),DT19XC(1,1,1)),+     B   (DT19X(1,1,13),DT19XD(1,1,1))+      EQUIVALENCE (DT19Y(1,1,1),DT19YA(1,1,1)),(DT19Y(1,1,5),+     A   DT19YB(1,1,1)),(DT19Y(1,1,9),DT19YC(1,1,1)),+     B   (DT19Y(1,1,13),DT19YD(1,1,1))++      DATA              SA/0.3D0/+      DATA              INCXS/1, 2, -2, -1/+      DATA              INCYS/1, -2, 1, -2/+      DATA              LENS/1, 1, 2, 4, 1, 1, 3, 7/+      DATA              NS/0, 1, 2, 4/+      DATA              DX1/0.6D0, 0.1D0, -0.5D0, 0.8D0, 0.9D0, -0.3D0,+     +                  -0.4D0/+      DATA              DY1/0.5D0, -0.9D0, 0.3D0, 0.7D0, -0.6D0, 0.2D0,+     +                  0.8D0/+      DATA              DT7/0.0D0, 0.30D0, 0.21D0, 0.62D0, 0.0D0,+     +                  0.30D0, -0.07D0, 0.85D0, 0.0D0, 0.30D0, -0.79D0,+     +                  -0.74D0, 0.0D0, 0.30D0, 0.33D0, 1.27D0/+      DATA              DT8/0.5D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0,+     +                  0.0D0, 0.68D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0,+     +                  0.0D0, 0.0D0, 0.68D0, -0.87D0, 0.0D0, 0.0D0,+     +                  0.0D0, 0.0D0, 0.0D0, 0.68D0, -0.87D0, 0.15D0,+     +                  0.94D0, 0.0D0, 0.0D0, 0.0D0, 0.5D0, 0.0D0,+     +                  0.0D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0, 0.68D0,+     +                  0.0D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0,+     +                  0.35D0, -0.9D0, 0.48D0, 0.0D0, 0.0D0, 0.0D0,+     +                  0.0D0, 0.38D0, -0.9D0, 0.57D0, 0.7D0, -0.75D0,+     +                  0.2D0, 0.98D0, 0.5D0, 0.0D0, 0.0D0, 0.0D0,+     +                  0.0D0, 0.0D0, 0.0D0, 0.68D0, 0.0D0, 0.0D0,+     +                  0.0D0, 0.0D0, 0.0D0, 0.0D0, 0.35D0, -0.72D0,+     +                  0.0D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0, 0.38D0,+     +                  -0.63D0, 0.15D0, 0.88D0, 0.0D0, 0.0D0, 0.0D0,+     +                  0.5D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0,+     +                  0.68D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0,+     +                  0.0D0, 0.68D0, -0.9D0, 0.33D0, 0.0D0, 0.0D0,+     +                  0.0D0, 0.0D0, 0.68D0, -0.9D0, 0.33D0, 0.7D0,+     +                  -0.75D0, 0.2D0, 1.04D0/+      DATA              DT10X/0.6D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0,+     +                  0.0D0, 0.5D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0,+     +                  0.0D0, 0.5D0, -0.9D0, 0.0D0, 0.0D0, 0.0D0,+     +                  0.0D0, 0.0D0, 0.5D0, -0.9D0, 0.3D0, 0.7D0,+     +                  0.0D0, 0.0D0, 0.0D0, 0.6D0, 0.0D0, 0.0D0, 0.0D0,+     +                  0.0D0, 0.0D0, 0.0D0, 0.5D0, 0.0D0, 0.0D0, 0.0D0,+     +                  0.0D0, 0.0D0, 0.0D0, 0.3D0, 0.1D0, 0.5D0, 0.0D0,+     +                  0.0D0, 0.0D0, 0.0D0, 0.8D0, 0.1D0, -0.6D0,+     +                  0.8D0, 0.3D0, -0.3D0, 0.5D0, 0.6D0, 0.0D0,+     +                  0.0D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0, 0.5D0, 0.0D0,+     +                  0.0D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0, -0.9D0,+     +                  0.1D0, 0.5D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0, 0.7D0,+     +                  0.1D0, 0.3D0, 0.8D0, -0.9D0, -0.3D0, 0.5D0,+     +                  0.6D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0,+     +                  0.5D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0,+     +                  0.5D0, 0.3D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0,+     +                  0.5D0, 0.3D0, -0.6D0, 0.8D0, 0.0D0, 0.0D0,+     +                  0.0D0/+      DATA              DT10Y/0.5D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0,+     +                  0.0D0, 0.6D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0,+     +                  0.0D0, 0.6D0, 0.1D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0,+     +                  0.0D0, 0.6D0, 0.1D0, -0.5D0, 0.8D0, 0.0D0,+     +                  0.0D0, 0.0D0, 0.5D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0,+     +                  0.0D0, 0.0D0, 0.6D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0,+     +                  0.0D0, 0.0D0, -0.5D0, -0.9D0, 0.6D0, 0.0D0,+     +                  0.0D0, 0.0D0, 0.0D0, -0.4D0, -0.9D0, 0.9D0,+     +                  0.7D0, -0.5D0, 0.2D0, 0.6D0, 0.5D0, 0.0D0,+     +                  0.0D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0, 0.6D0, 0.0D0,+     +                  0.0D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0, -0.5D0,+     +                  0.6D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0,+     +                  -0.4D0, 0.9D0, -0.5D0, 0.6D0, 0.0D0, 0.0D0,+     +                  0.0D0, 0.5D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0,+     +                  0.0D0, 0.6D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0,+     +                  0.0D0, 0.6D0, -0.9D0, 0.1D0, 0.0D0, 0.0D0,+     +                  0.0D0, 0.0D0, 0.6D0, -0.9D0, 0.1D0, 0.7D0,+     +                  -0.5D0, 0.2D0, 0.8D0/+      DATA              SSIZE1/0.0D0, 0.3D0, 1.6D0, 3.2D0/+      DATA              SSIZE2/0.0D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0,+     +                  0.0D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0,+     +                  0.0D0, 1.17D0, 1.17D0, 1.17D0, 1.17D0, 1.17D0,+     +                  1.17D0, 1.17D0, 1.17D0, 1.17D0, 1.17D0, 1.17D0,+     +                  1.17D0, 1.17D0, 1.17D0/+*+*                         FOR DROTM+*+      DATA DPAR/-2.D0,  0.D0,0.D0,0.D0,0.D0,+     A          -1.D0,  2.D0, -3.D0, -4.D0,  5.D0,+     B           0.D0,  0.D0,  2.D0, -3.D0,  0.D0,+     C           1.D0,  5.D0,  2.D0,  0.D0, -4.D0/+*                        TRUE X RESULTS F0R ROTATIONS DROTM+      DATA DT19XA/.6D0,                  0.D0,0.D0,0.D0,0.D0,0.D0,0.D0,+     A            .6D0,                  0.D0,0.D0,0.D0,0.D0,0.D0,0.D0,+     B            .6D0,                  0.D0,0.D0,0.D0,0.D0,0.D0,0.D0,+     C            .6D0,                  0.D0,0.D0,0.D0,0.D0,0.D0,0.D0,+     D            .6D0,                  0.D0,0.D0,0.D0,0.D0,0.D0,0.D0,+     E           -.8D0,                  0.D0,0.D0,0.D0,0.D0,0.D0,0.D0,+     F           -.9D0,                  0.D0,0.D0,0.D0,0.D0,0.D0,0.D0,+     G           3.5D0,                  0.D0,0.D0,0.D0,0.D0,0.D0,0.D0,+     H            .6D0,   .1D0,             0.D0,0.D0,0.D0,0.D0,0.D0,+     I           -.8D0,  3.8D0,             0.D0,0.D0,0.D0,0.D0,0.D0,+     J           -.9D0,  2.8D0,             0.D0,0.D0,0.D0,0.D0,0.D0,+     K           3.5D0,  -.4D0,             0.D0,0.D0,0.D0,0.D0,0.D0,+     L            .6D0,   .1D0,  -.5D0,   .8D0,          0.D0,0.D0,0.D0,+     M           -.8D0,  3.8D0, -2.2D0, -1.2D0,          0.D0,0.D0,0.D0,+     N           -.9D0,  2.8D0, -1.4D0, -1.3D0,          0.D0,0.D0,0.D0,+     O           3.5D0,  -.4D0, -2.2D0,  4.7D0,          0.D0,0.D0,0.D0/+*+      DATA DT19XB/.6D0,                  0.D0,0.D0,0.D0,0.D0,0.D0,0.D0,+     A            .6D0,                  0.D0,0.D0,0.D0,0.D0,0.D0,0.D0,+     B            .6D0,                  0.D0,0.D0,0.D0,0.D0,0.D0,0.D0,+     C            .6D0,                  0.D0,0.D0,0.D0,0.D0,0.D0,0.D0,+     D            .6D0,                  0.D0,0.D0,0.D0,0.D0,0.D0,0.D0,+     E           -.8D0,                  0.D0,0.D0,0.D0,0.D0,0.D0,0.D0,+     F           -.9D0,                  0.D0,0.D0,0.D0,0.D0,0.D0,0.D0,+     G           3.5D0,                  0.D0,0.D0,0.D0,0.D0,0.D0,0.D0,+     H            .6D0,   .1D0,  -.5D0,             0.D0,0.D0,0.D0,0.D0,+     I           0.D0,    .1D0, -3.0D0,             0.D0,0.D0,0.D0,0.D0,+     J           -.3D0,   .1D0, -2.0D0,             0.D0,0.D0,0.D0,0.D0,+     K           3.3D0,   .1D0, -2.0D0,             0.D0,0.D0,0.D0,0.D0,+     L            .6D0,   .1D0,  -.5D0,   .8D0,   .9D0,  -.3D0,  -.4D0,+     M          -2.0D0,   .1D0,  1.4D0,   .8D0,   .6D0,  -.3D0, -2.8D0,+     N          -1.8D0,   .1D0,  1.3D0,   .8D0,  0.D0,   -.3D0, -1.9D0,+     O           3.8D0,   .1D0, -3.1D0,   .8D0,  4.8D0,  -.3D0, -1.5D0 /+*+      DATA DT19XC/.6D0,                  0.D0,0.D0,0.D0,0.D0,0.D0,0.D0,+     A            .6D0,                  0.D0,0.D0,0.D0,0.D0,0.D0,0.D0,+     B            .6D0,                  0.D0,0.D0,0.D0,0.D0,0.D0,0.D0,+     C            .6D0,                  0.D0,0.D0,0.D0,0.D0,0.D0,0.D0,+     D            .6D0,                  0.D0,0.D0,0.D0,0.D0,0.D0,0.D0,+     E           -.8D0,                  0.D0,0.D0,0.D0,0.D0,0.D0,0.D0,+     F           -.9D0,                  0.D0,0.D0,0.D0,0.D0,0.D0,0.D0,+     G           3.5D0,                  0.D0,0.D0,0.D0,0.D0,0.D0,0.D0,+     H            .6D0,   .1D0,  -.5D0,             0.D0,0.D0,0.D0,0.D0,+     I           4.8D0,   .1D0, -3.0D0,             0.D0,0.D0,0.D0,0.D0,+     J           3.3D0,   .1D0, -2.0D0,             0.D0,0.D0,0.D0,0.D0,+     K           2.1D0,   .1D0, -2.0D0,             0.D0,0.D0,0.D0,0.D0,+     L            .6D0,   .1D0,  -.5D0,   .8D0,   .9D0,  -.3D0,  -.4D0,+     M          -1.6D0,   .1D0, -2.2D0,   .8D0,  5.4D0,  -.3D0, -2.8D0,+     N          -1.5D0,   .1D0, -1.4D0,   .8D0,  3.6D0,  -.3D0, -1.9D0,+     O           3.7D0,   .1D0, -2.2D0,   .8D0,  3.6D0,  -.3D0, -1.5D0 /+*+      DATA DT19XD/.6D0,                  0.D0,0.D0,0.D0,0.D0,0.D0,0.D0,+     A            .6D0,                  0.D0,0.D0,0.D0,0.D0,0.D0,0.D0,+     B            .6D0,                  0.D0,0.D0,0.D0,0.D0,0.D0,0.D0,+     C            .6D0,                  0.D0,0.D0,0.D0,0.D0,0.D0,0.D0,+     D            .6D0,                  0.D0,0.D0,0.D0,0.D0,0.D0,0.D0,+     E           -.8D0,                  0.D0,0.D0,0.D0,0.D0,0.D0,0.D0,+     F           -.9D0,                  0.D0,0.D0,0.D0,0.D0,0.D0,0.D0,+     G           3.5D0,                  0.D0,0.D0,0.D0,0.D0,0.D0,0.D0,+     H            .6D0,   .1D0,             0.D0,0.D0,0.D0,0.D0,0.D0,+     I           -.8D0, -1.0D0,             0.D0,0.D0,0.D0,0.D0,0.D0,+     J           -.9D0,  -.8D0,             0.D0,0.D0,0.D0,0.D0,0.D0,+     K           3.5D0,   .8D0,             0.D0,0.D0,0.D0,0.D0,0.D0,+     L            .6D0,   .1D0,  -.5D0,   .8D0,          0.D0,0.D0,0.D0,+     M           -.8D0, -1.0D0,  1.4D0, -1.6D0,          0.D0,0.D0,0.D0,+     N           -.9D0,  -.8D0,  1.3D0, -1.6D0,          0.D0,0.D0,0.D0,+     O           3.5D0,   .8D0, -3.1D0,  4.8D0,          0.D0,0.D0,0.D0/+*                        TRUE Y RESULTS FOR ROTATIONS DROTM+      DATA DT19YA/.5D0,                  0.D0,0.D0,0.D0,0.D0,0.D0,0.D0,+     A            .5D0,                  0.D0,0.D0,0.D0,0.D0,0.D0,0.D0,+     B            .5D0,                  0.D0,0.D0,0.D0,0.D0,0.D0,0.D0,+     C            .5D0,                  0.D0,0.D0,0.D0,0.D0,0.D0,0.D0,+     D            .5D0,                  0.D0,0.D0,0.D0,0.D0,0.D0,0.D0,+     E            .7D0,                  0.D0,0.D0,0.D0,0.D0,0.D0,0.D0,+     F           1.7D0,                  0.D0,0.D0,0.D0,0.D0,0.D0,0.D0,+     G          -2.6D0,                  0.D0,0.D0,0.D0,0.D0,0.D0,0.D0,+     H            .5D0,  -.9D0,             0.D0,0.D0,0.D0,0.D0,0.D0,+     I            .7D0, -4.8D0,             0.D0,0.D0,0.D0,0.D0,0.D0,+     J           1.7D0,  -.7D0,             0.D0,0.D0,0.D0,0.D0,0.D0,+     K          -2.6D0,  3.5D0,             0.D0,0.D0,0.D0,0.D0,0.D0,+     L            .5D0,  -.9D0,   .3D0,   .7D0,          0.D0,0.D0,0.D0,+     M            .7D0, -4.8D0,  3.0D0,  1.1D0,          0.D0,0.D0,0.D0,+     N           1.7D0,  -.7D0,  -.7D0,  2.3D0,          0.D0,0.D0,0.D0,+     O          -2.6D0,  3.5D0,  -.7D0, -3.6D0,          0.D0,0.D0,0.D0/+*+      DATA DT19YB/.5D0,                  0.D0,0.D0,0.D0,0.D0,0.D0,0.D0,+     A            .5D0,                  0.D0,0.D0,0.D0,0.D0,0.D0,0.D0,+     B            .5D0,                  0.D0,0.D0,0.D0,0.D0,0.D0,0.D0,+     C            .5D0,                  0.D0,0.D0,0.D0,0.D0,0.D0,0.D0,+     D            .5D0,                  0.D0,0.D0,0.D0,0.D0,0.D0,0.D0,+     E            .7D0,                  0.D0,0.D0,0.D0,0.D0,0.D0,0.D0,+     F           1.7D0,                  0.D0,0.D0,0.D0,0.D0,0.D0,0.D0,+     G          -2.6D0,                  0.D0,0.D0,0.D0,0.D0,0.D0,0.D0,+     H            .5D0,  -.9D0,   .3D0,             0.D0,0.D0,0.D0,0.D0,+     I           4.0D0,  -.9D0,  -.3D0,             0.D0,0.D0,0.D0,0.D0,+     J           -.5D0,  -.9D0,  1.5D0,             0.D0,0.D0,0.D0,0.D0,+     K          -1.5D0,  -.9D0, -1.8D0,             0.D0,0.D0,0.D0,0.D0,+     L            .5D0,  -.9D0,   .3D0,   .7D0,  -.6D0,   .2D0,   .8D0,+     M           3.7D0,  -.9D0, -1.2D0,   .7D0, -1.5D0,   .2D0,  2.2D0,+     N           -.3D0,  -.9D0,  2.1D0,   .7D0, -1.6D0,   .2D0,  2.0D0,+     O          -1.6D0,  -.9D0, -2.1D0,   .7D0,  2.9D0,   .2D0, -3.8D0 /+*+      DATA DT19YC/.5D0,                  0.D0,0.D0,0.D0,0.D0,0.D0,0.D0,+     A            .5D0,                  0.D0,0.D0,0.D0,0.D0,0.D0,0.D0,+     B            .5D0,                  0.D0,0.D0,0.D0,0.D0,0.D0,0.D0,+     C            .5D0,                  0.D0,0.D0,0.D0,0.D0,0.D0,0.D0,+     D            .5D0,                  0.D0,0.D0,0.D0,0.D0,0.D0,0.D0,+     E            .7D0,                  0.D0,0.D0,0.D0,0.D0,0.D0,0.D0,+     F           1.7D0,                  0.D0,0.D0,0.D0,0.D0,0.D0,0.D0,+     G          -2.6D0,                  0.D0,0.D0,0.D0,0.D0,0.D0,0.D0,+     H            .5D0,  -.9D0,             0.D0,0.D0,0.D0,0.D0,0.D0,+     I           4.0D0, -6.3D0,             0.D0,0.D0,0.D0,0.D0,0.D0,+     J           -.5D0,   .3D0,             0.D0,0.D0,0.D0,0.D0,0.D0,+     K          -1.5D0,  3.0D0,             0.D0,0.D0,0.D0,0.D0,0.D0,+     L            .5D0,  -.9D0,   .3D0,   .7D0,          0.D0,0.D0,0.D0,+     M           3.7D0, -7.2D0,  3.0D0,  1.7D0,          0.D0,0.D0,0.D0,+     N           -.3D0,   .9D0,  -.7D0,  1.9D0,          0.D0,0.D0,0.D0,+     O          -1.6D0,  2.7D0,  -.7D0, -3.4D0,          0.D0,0.D0,0.D0/+*+      DATA DT19YD/.5D0,                  0.D0,0.D0,0.D0,0.D0,0.D0,0.D0,+     A            .5D0,                  0.D0,0.D0,0.D0,0.D0,0.D0,0.D0,+     B            .5D0,                  0.D0,0.D0,0.D0,0.D0,0.D0,0.D0,+     C            .5D0,                  0.D0,0.D0,0.D0,0.D0,0.D0,0.D0,+     D            .5D0,                  0.D0,0.D0,0.D0,0.D0,0.D0,0.D0,+     E            .7D0,                  0.D0,0.D0,0.D0,0.D0,0.D0,0.D0,+     F           1.7D0,                  0.D0,0.D0,0.D0,0.D0,0.D0,0.D0,+     G          -2.6D0,                  0.D0,0.D0,0.D0,0.D0,0.D0,0.D0,+     H            .5D0,  -.9D0,   .3D0,             0.D0,0.D0,0.D0,0.D0,+     I            .7D0,  -.9D0,  1.2D0,             0.D0,0.D0,0.D0,0.D0,+     J           1.7D0,  -.9D0,   .5D0,             0.D0,0.D0,0.D0,0.D0,+     K          -2.6D0,  -.9D0, -1.3D0,             0.D0,0.D0,0.D0,0.D0,+     L            .5D0,  -.9D0,   .3D0,   .7D0,  -.6D0,   .2D0,   .8D0,+     M            .7D0,  -.9D0,  1.2D0,   .7D0, -1.5D0,   .2D0,  1.6D0,+     N           1.7D0,  -.9D0,   .5D0,   .7D0, -1.6D0,   .2D0,  2.4D0,+     O          -2.6D0,  -.9D0, -1.3D0,   .7D0,  2.9D0,   .2D0, -4.0D0 /+*    +*     .. Executable Statements ..+*+      DO 120 KI = 1, 4+         INCX = INCXS(KI)+         INCY = INCYS(KI)+         MX = ABS(INCX)+         MY = ABS(INCY)+*+         DO 100 KN = 1, 4+            N = NS(KN)+            KSIZE = MIN(2,KN)+            LENX = LENS(KN,MX)+            LENY = LENS(KN,MY)+*           .. Initialize all argument arrays ..+            DO 20 I = 1, 7+               SX(I) = DX1(I)+               SY(I) = DY1(I)+   20       CONTINUE+*+            IF (ICASE.EQ.1) THEN+*              .. DDOT ..+               CALL STEST1(DDOT(N,SX,INCX,SY,INCY),DT7(KN,KI),SSIZE1(KN)+     +                     ,SFAC)+            ELSE IF (ICASE.EQ.2) THEN+*              .. DAXPY ..+               CALL DAXPY(N,SA,SX,INCX,SY,INCY)+               DO 40 J = 1, LENY+                  STY(J) = DT8(J,KN,KI)+   40          CONTINUE+               CALL STEST(LENY,SY,STY,SSIZE2(1,KSIZE),SFAC)+            ELSE IF (ICASE.EQ.5) THEN+*              .. DCOPY ..+               DO 60 I = 1, 7+                  STY(I) = DT10Y(I,KN,KI)+   60          CONTINUE+               CALL DCOPY(N,SX,INCX,SY,INCY)+               CALL STEST(LENY,SY,STY,SSIZE2(1,1),1.0D0)+            ELSE IF (ICASE.EQ.6) THEN+*              .. DSWAP ..+               CALL DSWAP(N,SX,INCX,SY,INCY)+               DO 80 I = 1, 7+                  STX(I) = DT10X(I,KN,KI)+                  STY(I) = DT10Y(I,KN,KI)+   80          CONTINUE+               CALL STEST(LENX,SX,STX,SSIZE2(1,1),1.0D0)+               CALL STEST(LENY,SY,STY,SSIZE2(1,1),1.0D0)+            ELSE IF (ICASE.EQ.12) THEN+*              .. DROTM ..+               KNI=KN+4*(KI-1)+               DO KPAR=1,4+                  DO I=1,7+                     SX(I) = DX1(I)+                     SY(I) = DY1(I)+                     STX(I)= DT19X(I,KPAR,KNI)+                     STY(I)= DT19Y(I,KPAR,KNI)+                  END DO+*+                  DO I=1,5+                     DTEMP(I) = DPAR(I,KPAR)+                  END DO+*+                  DO  I=1,LENX+                     SSIZE(I)=STX(I)+                  END DO+*                   SEE REMARK ABOVE ABOUT DT11X(1,2,7)+*                       AND DT11X(5,3,8).+                  IF ((KPAR .EQ. 2) .AND. (KNI .EQ. 7))+     $               SSIZE(1) = 2.4D0+                  IF ((KPAR .EQ. 3) .AND. (KNI .EQ. 8))+     $               SSIZE(5) = 1.8D0+*+                  CALL   DROTM(N,SX,INCX,SY,INCY,DTEMP)+                  CALL   STEST(LENX,SX,STX,SSIZE,SFAC)+                  CALL   STEST(LENY,SY,STY,STY,SFAC)+               END DO+            ELSE IF (ICASE.EQ.13) THEN+*              .. DSDOT ..+            CALL TESTDSDOT(REAL(DSDOT(N,REAL(SX),INCX,REAL(SY),INCY)),+     $                 REAL(DT7(KN,KI)),REAL(SSIZE1(KN)), .3125E-1)+            ELSE+               WRITE (NOUT,*) ' Shouldn''t be here in CHECK2'+               STOP+            END IF+  100    CONTINUE+  120 CONTINUE+      RETURN+      END+      SUBROUTINE CHECK3(SFAC)+*     .. Parameters ..+      INTEGER           NOUT+      PARAMETER         (NOUT=6)+*     .. Scalar Arguments ..+      DOUBLE PRECISION  SFAC+*     .. Scalars in Common ..+      INTEGER           ICASE, INCX, INCY, N+      LOGICAL           PASS+*     .. Local Scalars ..+      DOUBLE PRECISION  SC, SS+      INTEGER           I, K, KI, KN, KSIZE, LENX, LENY, MX, MY+*     .. Local Arrays ..+      DOUBLE PRECISION  COPYX(5), COPYY(5), DT9X(7,4,4), DT9Y(7,4,4),+     +                  DX1(7), DY1(7), MWPC(11), MWPS(11), MWPSTX(5),+     +                  MWPSTY(5), MWPTX(11,5), MWPTY(11,5), MWPX(5),+     +                  MWPY(5), SSIZE2(14,2), STX(7), STY(7), SX(7),+     +                  SY(7)+      INTEGER           INCXS(4), INCYS(4), LENS(4,2), MWPINX(11),+     +                  MWPINY(11), MWPN(11), NS(4)+*     .. External Subroutines ..+      EXTERNAL          DROT, STEST+*     .. Intrinsic Functions ..+      INTRINSIC         ABS, MIN+*     .. Common blocks ..+      COMMON            /COMBLA/ICASE, N, INCX, INCY, PASS+*     .. Data statements ..+      DATA              INCXS/1, 2, -2, -1/+      DATA              INCYS/1, -2, 1, -2/+      DATA              LENS/1, 1, 2, 4, 1, 1, 3, 7/+      DATA              NS/0, 1, 2, 4/+      DATA              DX1/0.6D0, 0.1D0, -0.5D0, 0.8D0, 0.9D0, -0.3D0,+     +                  -0.4D0/+      DATA              DY1/0.5D0, -0.9D0, 0.3D0, 0.7D0, -0.6D0, 0.2D0,+     +                  0.8D0/+      DATA              SC, SS/0.8D0, 0.6D0/+      DATA              DT9X/0.6D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0,+     +                  0.0D0, 0.78D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0,+     +                  0.0D0, 0.0D0, 0.78D0, -0.46D0, 0.0D0, 0.0D0,+     +                  0.0D0, 0.0D0, 0.0D0, 0.78D0, -0.46D0, -0.22D0,+     +                  1.06D0, 0.0D0, 0.0D0, 0.0D0, 0.6D0, 0.0D0,+     +                  0.0D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0, 0.78D0,+     +                  0.0D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0,+     +                  0.66D0, 0.1D0, -0.1D0, 0.0D0, 0.0D0, 0.0D0,+     +                  0.0D0, 0.96D0, 0.1D0, -0.76D0, 0.8D0, 0.90D0,+     +                  -0.3D0, -0.02D0, 0.6D0, 0.0D0, 0.0D0, 0.0D0,+     +                  0.0D0, 0.0D0, 0.0D0, 0.78D0, 0.0D0, 0.0D0,+     +                  0.0D0, 0.0D0, 0.0D0, 0.0D0, -0.06D0, 0.1D0,+     +                  -0.1D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0, 0.90D0,+     +                  0.1D0, -0.22D0, 0.8D0, 0.18D0, -0.3D0, -0.02D0,+     +                  0.6D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0,+     +                  0.78D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0,+     +                  0.0D0, 0.78D0, 0.26D0, 0.0D0, 0.0D0, 0.0D0,+     +                  0.0D0, 0.0D0, 0.78D0, 0.26D0, -0.76D0, 1.12D0,+     +                  0.0D0, 0.0D0, 0.0D0/+      DATA              DT9Y/0.5D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0,+     +                  0.0D0, 0.04D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0,+     +                  0.0D0, 0.0D0, 0.04D0, -0.78D0, 0.0D0, 0.0D0,+     +                  0.0D0, 0.0D0, 0.0D0, 0.04D0, -0.78D0, 0.54D0,+     +                  0.08D0, 0.0D0, 0.0D0, 0.0D0, 0.5D0, 0.0D0,+     +                  0.0D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0, 0.04D0,+     +                  0.0D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0, 0.7D0,+     +                  -0.9D0, -0.12D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0,+     +                  0.64D0, -0.9D0, -0.30D0, 0.7D0, -0.18D0, 0.2D0,+     +                  0.28D0, 0.5D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0,+     +                  0.0D0, 0.0D0, 0.04D0, 0.0D0, 0.0D0, 0.0D0,+     +                  0.0D0, 0.0D0, 0.0D0, 0.7D0, -1.08D0, 0.0D0,+     +                  0.0D0, 0.0D0, 0.0D0, 0.0D0, 0.64D0, -1.26D0,+     +                  0.54D0, 0.20D0, 0.0D0, 0.0D0, 0.0D0, 0.5D0,+     +                  0.0D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0,+     +                  0.04D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0,+     +                  0.0D0, 0.04D0, -0.9D0, 0.18D0, 0.0D0, 0.0D0,+     +                  0.0D0, 0.0D0, 0.04D0, -0.9D0, 0.18D0, 0.7D0,+     +                  -0.18D0, 0.2D0, 0.16D0/+      DATA              SSIZE2/0.0D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0,+     +                  0.0D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0, 0.0D0,+     +                  0.0D0, 1.17D0, 1.17D0, 1.17D0, 1.17D0, 1.17D0,+     +                  1.17D0, 1.17D0, 1.17D0, 1.17D0, 1.17D0, 1.17D0,+     +                  1.17D0, 1.17D0, 1.17D0/+*     .. Executable Statements ..+*+      DO 60 KI = 1, 4+         INCX = INCXS(KI)+         INCY = INCYS(KI)+         MX = ABS(INCX)+         MY = ABS(INCY)+*+         DO 40 KN = 1, 4+            N = NS(KN)+            KSIZE = MIN(2,KN)+            LENX = LENS(KN,MX)+            LENY = LENS(KN,MY)+*+            IF (ICASE.EQ.4) THEN+*              .. DROT ..+               DO 20 I = 1, 7+                  SX(I) = DX1(I)+                  SY(I) = DY1(I)+                  STX(I) = DT9X(I,KN,KI)+                  STY(I) = DT9Y(I,KN,KI)+   20          CONTINUE+               CALL DROT(N,SX,INCX,SY,INCY,SC,SS)+               CALL STEST(LENX,SX,STX,SSIZE2(1,KSIZE),SFAC)+               CALL STEST(LENY,SY,STY,SSIZE2(1,KSIZE),SFAC)+            ELSE+               WRITE (NOUT,*) ' Shouldn''t be here in CHECK3'+               STOP+            END IF+   40    CONTINUE+   60 CONTINUE+*+      MWPC(1) = 1+      DO 80 I = 2, 11+         MWPC(I) = 0+   80 CONTINUE+      MWPS(1) = 0+      DO 100 I = 2, 6+         MWPS(I) = 1+  100 CONTINUE+      DO 120 I = 7, 11+         MWPS(I) = -1+  120 CONTINUE+      MWPINX(1) = 1+      MWPINX(2) = 1+      MWPINX(3) = 1+      MWPINX(4) = -1+      MWPINX(5) = 1+      MWPINX(6) = -1+      MWPINX(7) = 1+      MWPINX(8) = 1+      MWPINX(9) = -1+      MWPINX(10) = 1+      MWPINX(11) = -1+      MWPINY(1) = 1+      MWPINY(2) = 1+      MWPINY(3) = -1+      MWPINY(4) = -1+      MWPINY(5) = 2+      MWPINY(6) = 1+      MWPINY(7) = 1+      MWPINY(8) = -1+      MWPINY(9) = -1+      MWPINY(10) = 2+      MWPINY(11) = 1+      DO 140 I = 1, 11+         MWPN(I) = 5+  140 CONTINUE+      MWPN(5) = 3+      MWPN(10) = 3+      DO 160 I = 1, 5+         MWPX(I) = I+         MWPY(I) = I+         MWPTX(1,I) = I+         MWPTY(1,I) = I+         MWPTX(2,I) = I+         MWPTY(2,I) = -I+         MWPTX(3,I) = 6 - I+         MWPTY(3,I) = I - 6+         MWPTX(4,I) = I+         MWPTY(4,I) = -I+         MWPTX(6,I) = 6 - I+         MWPTY(6,I) = I - 6+         MWPTX(7,I) = -I+         MWPTY(7,I) = I+         MWPTX(8,I) = I - 6+         MWPTY(8,I) = 6 - I+         MWPTX(9,I) = -I+         MWPTY(9,I) = I+         MWPTX(11,I) = I - 6+         MWPTY(11,I) = 6 - I+  160 CONTINUE+      MWPTX(5,1) = 1+      MWPTX(5,2) = 3+      MWPTX(5,3) = 5+      MWPTX(5,4) = 4+      MWPTX(5,5) = 5+      MWPTY(5,1) = -1+      MWPTY(5,2) = 2+      MWPTY(5,3) = -2+      MWPTY(5,4) = 4+      MWPTY(5,5) = -3+      MWPTX(10,1) = -1+      MWPTX(10,2) = -3+      MWPTX(10,3) = -5+      MWPTX(10,4) = 4+      MWPTX(10,5) = 5+      MWPTY(10,1) = 1+      MWPTY(10,2) = 2+      MWPTY(10,3) = 2+      MWPTY(10,4) = 4+      MWPTY(10,5) = 3+      DO 200 I = 1, 11+         INCX = MWPINX(I)+         INCY = MWPINY(I)+         DO 180 K = 1, 5+            COPYX(K) = MWPX(K)+            COPYY(K) = MWPY(K)+            MWPSTX(K) = MWPTX(I,K)+            MWPSTY(K) = MWPTY(I,K)+  180    CONTINUE+         CALL DROT(MWPN(I),COPYX,INCX,COPYY,INCY,MWPC(I),MWPS(I))+         CALL STEST(5,COPYX,MWPSTX,MWPSTX,SFAC)+         CALL STEST(5,COPYY,MWPSTY,MWPSTY,SFAC)+  200 CONTINUE+      RETURN+      END+      SUBROUTINE STEST(LEN,SCOMP,STRUE,SSIZE,SFAC)+*     ********************************* STEST **************************+*+*     THIS SUBR COMPARES ARRAYS  SCOMP() AND STRUE() OF LENGTH LEN TO+*     SEE IF THE TERM BY TERM DIFFERENCES, MULTIPLIED BY SFAC, ARE+*     NEGLIGIBLE.+*+*     C. L. LAWSON, JPL, 1974 DEC 10+*+*     .. Parameters ..+      INTEGER          NOUT+      DOUBLE PRECISION ZERO+      PARAMETER        (NOUT=6, ZERO=0.0D0)+*     .. Scalar Arguments ..+      DOUBLE PRECISION SFAC+      INTEGER          LEN+*     .. Array Arguments ..+      DOUBLE PRECISION SCOMP(LEN), SSIZE(LEN), STRUE(LEN)+*     .. Scalars in Common ..+      INTEGER          ICASE, INCX, INCY, N+      LOGICAL          PASS+*     .. Local Scalars ..+      DOUBLE PRECISION SD+      INTEGER          I+*     .. External Functions ..+      DOUBLE PRECISION SDIFF+      EXTERNAL         SDIFF+*     .. Intrinsic Functions ..+      INTRINSIC        ABS+*     .. Common blocks ..+      COMMON           /COMBLA/ICASE, N, INCX, INCY, PASS+*     .. Executable Statements ..+*+      DO 40 I = 1, LEN+         SD = SCOMP(I) - STRUE(I)+         IF (ABS(SFAC*SD) .LE. ABS(SSIZE(I))*EPSILON(ZERO))+     +       GO TO 40+*+*                             HERE    SCOMP(I) IS NOT CLOSE TO STRUE(I).+*+         IF ( .NOT. PASS) GO TO 20+*                             PRINT FAIL MESSAGE AND HEADER.+         PASS = .FALSE.+         WRITE (NOUT,99999)+         WRITE (NOUT,99998)+   20    WRITE (NOUT,99997) ICASE, N, INCX, INCY, I, SCOMP(I),+     +     STRUE(I), SD, SSIZE(I)+   40 CONTINUE+      RETURN+*+99999 FORMAT ('                                       FAIL')+99998 FORMAT (/' CASE  N INCX INCY  I                            ',+     +       ' COMP(I)                             TRUE(I)  DIFFERENCE',+     +       '     SIZE(I)',/1X)+99997 FORMAT (1X,I4,I3,2I5,I3,2D36.8,2D12.4)+      END+      SUBROUTINE TESTDSDOT(SCOMP,STRUE,SSIZE,SFAC)+*     ********************************* STEST **************************+*+*     THIS SUBR COMPARES ARRAYS  SCOMP() AND STRUE() OF LENGTH LEN TO+*     SEE IF THE TERM BY TERM DIFFERENCES, MULTIPLIED BY SFAC, ARE+*     NEGLIGIBLE.+*+*     C. L. LAWSON, JPL, 1974 DEC 10+*+*     .. Parameters ..+      INTEGER          NOUT+      REAL             ZERO+      PARAMETER        (NOUT=6, ZERO=0.0E0)+*     .. Scalar Arguments ..+      REAL             SFAC, SCOMP, SSIZE, STRUE+*     .. Scalars in Common ..+      INTEGER          ICASE, INCX, INCY, N+      LOGICAL          PASS+*     .. Local Scalars ..+      REAL             SD+*     .. Intrinsic Functions ..+      INTRINSIC        ABS+*     .. Common blocks ..+      COMMON           /COMBLA/ICASE, N, INCX, INCY, PASS+*     .. Executable Statements ..+*+         SD = SCOMP - STRUE+         IF (ABS(SFAC*SD) .LE. ABS(SSIZE) * EPSILON(ZERO))+     +       GO TO 40+*+*                             HERE    SCOMP(I) IS NOT CLOSE TO STRUE(I).+*+         IF ( .NOT. PASS) GO TO 20+*                             PRINT FAIL MESSAGE AND HEADER.+         PASS = .FALSE.+         WRITE (NOUT,99999)+         WRITE (NOUT,99998)+   20    WRITE (NOUT,99997) ICASE, N, INCX, INCY, SCOMP,+     +     STRUE, SD, SSIZE+   40 CONTINUE+      RETURN+*+99999 FORMAT ('                                       FAIL')+99998 FORMAT (/' CASE  N INCX INCY                           ',+     +       ' COMP(I)                             TRUE(I)  DIFFERENCE',+     +       '     SIZE(I)',/1X)+99997 FORMAT (1X,I4,I3,1I5,I3,2E36.8,2E12.4)+      END+      SUBROUTINE STEST1(SCOMP1,STRUE1,SSIZE,SFAC)+*     ************************* STEST1 *****************************+*+*     THIS IS AN INTERFACE SUBROUTINE TO ACCOMODATE THE FORTRAN+*     REQUIREMENT THAT WHEN A DUMMY ARGUMENT IS AN ARRAY, THE+*     ACTUAL ARGUMENT MUST ALSO BE AN ARRAY OR AN ARRAY ELEMENT.+*+*     C.L. LAWSON, JPL, 1978 DEC 6+*+*     .. Scalar Arguments ..+      DOUBLE PRECISION  SCOMP1, SFAC, STRUE1+*     .. Array Arguments ..+      DOUBLE PRECISION  SSIZE(*)+*     .. Local Arrays ..+      DOUBLE PRECISION  SCOMP(1), STRUE(1)+*     .. External Subroutines ..+      EXTERNAL          STEST+*     .. Executable Statements ..+*+      SCOMP(1) = SCOMP1+      STRUE(1) = STRUE1+      CALL STEST(1,SCOMP,STRUE,SSIZE,SFAC)+*+      RETURN+      END+      DOUBLE PRECISION FUNCTION SDIFF(SA,SB)+*     ********************************* SDIFF **************************+*     COMPUTES DIFFERENCE OF TWO NUMBERS.  C. L. LAWSON, JPL 1974 FEB 15+*+*     .. Scalar Arguments ..+      DOUBLE PRECISION                SA, SB+*     .. Executable Statements ..+      SDIFF = SA - SB+      RETURN+      END+      SUBROUTINE ITEST1(ICOMP,ITRUE)+*     ********************************* ITEST1 *************************+*+*     THIS SUBROUTINE COMPARES THE VARIABLES ICOMP AND ITRUE FOR+*     EQUALITY.+*     C. L. LAWSON, JPL, 1974 DEC 10+*+*     .. Parameters ..+      INTEGER           NOUT+      PARAMETER         (NOUT=6)+*     .. Scalar Arguments ..+      INTEGER           ICOMP, ITRUE+*     .. Scalars in Common ..+      INTEGER           ICASE, INCX, INCY, N+      LOGICAL           PASS+*     .. Local Scalars ..+      INTEGER           ID+*     .. Common blocks ..+      COMMON            /COMBLA/ICASE, N, INCX, INCY, PASS+*     .. Executable Statements ..+*+      IF (ICOMP.EQ.ITRUE) GO TO 40+*+*                            HERE ICOMP IS NOT EQUAL TO ITRUE.+*+      IF ( .NOT. PASS) GO TO 20+*                             PRINT FAIL MESSAGE AND HEADER.+      PASS = .FALSE.+      WRITE (NOUT,99999)+      WRITE (NOUT,99998)+   20 ID = ICOMP - ITRUE+      WRITE (NOUT,99997) ICASE, N, INCX, INCY, ICOMP, ITRUE, ID+   40 CONTINUE+      RETURN+*+99999 FORMAT ('                                       FAIL')+99998 FORMAT (/' CASE  N INCX INCY                               ',+     +       ' COMP                                TRUE     DIFFERENCE',+     +       /1X)+99997 FORMAT (1X,I4,I3,2I5,2I36,I12)+      END
+ eigen3/blas/testing/dblat2.dat view
@@ -0,0 +1,34 @@+'dblat2.summ'     NAME OF SUMMARY OUTPUT FILE+6                 UNIT NUMBER OF SUMMARY FILE+'dblat2.snap'     NAME OF SNAPSHOT OUTPUT FILE+-1                UNIT NUMBER OF SNAPSHOT FILE (NOT USED IF .LT. 0)+F        LOGICAL FLAG, T TO REWIND SNAPSHOT FILE AFTER EACH RECORD.+F        LOGICAL FLAG, T TO STOP ON FAILURES.+T        LOGICAL FLAG, T TO TEST ERROR EXITS.+16.0     THRESHOLD VALUE OF TEST RATIO+6                 NUMBER OF VALUES OF N+0 1 2 3 5 9       VALUES OF N+4                 NUMBER OF VALUES OF K+0 1 2 4           VALUES OF K+4                 NUMBER OF VALUES OF INCX AND INCY+1 2 -1 -2         VALUES OF INCX AND INCY+3                 NUMBER OF VALUES OF ALPHA+0.0 1.0 0.7       VALUES OF ALPHA+3                 NUMBER OF VALUES OF BETA+0.0 1.0 0.9       VALUES OF BETA+DGEMV  T PUT F FOR NO TEST. SAME COLUMNS.+DGBMV  T PUT F FOR NO TEST. SAME COLUMNS.+DSYMV  T PUT F FOR NO TEST. SAME COLUMNS.+DSBMV  T PUT F FOR NO TEST. SAME COLUMNS.+DSPMV  T PUT F FOR NO TEST. SAME COLUMNS.+DTRMV  T PUT F FOR NO TEST. SAME COLUMNS.+DTBMV  T PUT F FOR NO TEST. SAME COLUMNS.+DTPMV  T PUT F FOR NO TEST. SAME COLUMNS.+DTRSV  T PUT F FOR NO TEST. SAME COLUMNS.+DTBSV  T PUT F FOR NO TEST. SAME COLUMNS.+DTPSV  T PUT F FOR NO TEST. SAME COLUMNS.+DGER   T PUT F FOR NO TEST. SAME COLUMNS.+DSYR   T PUT F FOR NO TEST. SAME COLUMNS.+DSPR   T PUT F FOR NO TEST. SAME COLUMNS.+DSYR2  T PUT F FOR NO TEST. SAME COLUMNS.+DSPR2  T PUT F FOR NO TEST. SAME COLUMNS.
+ eigen3/blas/testing/dblat2.f view
@@ -0,0 +1,3176 @@+*> \brief \b DBLAT2+*+*  =========== DOCUMENTATION ===========+*+* Online html documentation available at +*            http://www.netlib.org/lapack/explore-html/ +*+*  Definition:+*  ===========+*+*       PROGRAM DBLAT2+* +*+*> \par Purpose:+*  =============+*>+*> \verbatim+*>+*> Test program for the DOUBLE PRECISION Level 2 Blas.+*>+*> The program must be driven by a short data file. The first 18 records+*> of the file are read using list-directed input, the last 16 records+*> are read using the format ( A6, L2 ). An annotated example of a data+*> file can be obtained by deleting the first 3 characters from the+*> following 34 lines:+*> 'dblat2.out'      NAME OF SUMMARY OUTPUT FILE+*> 6                 UNIT NUMBER OF SUMMARY FILE+*> 'DBLAT2.SNAP'     NAME OF SNAPSHOT OUTPUT FILE+*> -1                UNIT NUMBER OF SNAPSHOT FILE (NOT USED IF .LT. 0)+*> F        LOGICAL FLAG, T TO REWIND SNAPSHOT FILE AFTER EACH RECORD.+*> F        LOGICAL FLAG, T TO STOP ON FAILURES.+*> T        LOGICAL FLAG, T TO TEST ERROR EXITS.+*> 16.0     THRESHOLD VALUE OF TEST RATIO+*> 6                 NUMBER OF VALUES OF N+*> 0 1 2 3 5 9       VALUES OF N+*> 4                 NUMBER OF VALUES OF K+*> 0 1 2 4           VALUES OF K+*> 4                 NUMBER OF VALUES OF INCX AND INCY+*> 1 2 -1 -2         VALUES OF INCX AND INCY+*> 3                 NUMBER OF VALUES OF ALPHA+*> 0.0 1.0 0.7       VALUES OF ALPHA+*> 3                 NUMBER OF VALUES OF BETA+*> 0.0 1.0 0.9       VALUES OF BETAC+*> DGEMV  T PUT F FOR NO TEST. SAME COLUMNS.+*> DGBMV  T PUT F FOR NO TEST. SAME COLUMNS.+*> DSYMV  T PUT F FOR NO TEST. SAME COLUMNS.+*> DSBMV  T PUT F FOR NO TEST. SAME COLUMNS.+*> DSPMV  T PUT F FOR NO TEST. SAME COLUMNS.+*> DTRMV  T PUT F FOR NO TEST. SAME COLUMNS.+*> DTBMV  T PUT F FOR NO TEST. SAME COLUMNS.+*> DTPMV  T PUT F FOR NO TEST. SAME COLUMNS.+*> DTRSV  T PUT F FOR NO TEST. SAME COLUMNS.+*> DTBSV  T PUT F FOR NO TEST. SAME COLUMNS.+*> DTPSV  T PUT F FOR NO TEST. SAME COLUMNS.+*> DGER   T PUT F FOR NO TEST. SAME COLUMNS.+*> DSYR   T PUT F FOR NO TEST. SAME COLUMNS.+*> DSPR   T PUT F FOR NO TEST. SAME COLUMNS.+*> DSYR2  T PUT F FOR NO TEST. SAME COLUMNS.+*> DSPR2  T PUT F FOR NO TEST. SAME COLUMNS.+*>+*> Further Details+*> ===============+*>+*>    See:+*>+*>       Dongarra J. J., Du Croz J. J., Hammarling S.  and Hanson R. J..+*>       An  extended  set of Fortran  Basic Linear Algebra Subprograms.+*>+*>       Technical  Memoranda  Nos. 41 (revision 3) and 81,  Mathematics+*>       and  Computer Science  Division,  Argonne  National Laboratory,+*>       9700 South Cass Avenue, Argonne, Illinois 60439, US.+*>+*>       Or+*>+*>       NAG  Technical Reports TR3/87 and TR4/87,  Numerical Algorithms+*>       Group  Ltd.,  NAG  Central  Office,  256  Banbury  Road, Oxford+*>       OX2 7DE, UK,  and  Numerical Algorithms Group Inc.,  1101  31st+*>       Street,  Suite 100,  Downers Grove,  Illinois 60515-1263,  USA.+*>+*>+*> -- Written on 10-August-1987.+*>    Richard Hanson, Sandia National Labs.+*>    Jeremy Du Croz, NAG Central Office.+*>+*>    10-9-00:  Change STATUS='NEW' to 'UNKNOWN' so that the testers+*>              can be run multiple times without deleting generated+*>              output files (susan)+*> \endverbatim+*+*  Authors:+*  ========+*+*> \author Univ. of Tennessee +*> \author Univ. of California Berkeley +*> \author Univ. of Colorado Denver +*> \author NAG Ltd. +*+*> \date April 2012+*+*> \ingroup double_blas_testing+*+*  =====================================================================+      PROGRAM DBLAT2+*+*  -- Reference BLAS test routine (version 3.4.1) --+*  -- Reference BLAS is a software package provided by Univ. of Tennessee,    --+*  -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--+*     April 2012+*+*  =====================================================================+*+*     .. Parameters ..+      INTEGER            NIN+      PARAMETER          ( NIN = 5 )+      INTEGER            NSUBS+      PARAMETER          ( NSUBS = 16 )+      DOUBLE PRECISION   ZERO, ONE+      PARAMETER          ( ZERO = 0.0D0, ONE = 1.0D0 )+      INTEGER            NMAX, INCMAX+      PARAMETER          ( NMAX = 65, INCMAX = 2 )+      INTEGER            NINMAX, NIDMAX, NKBMAX, NALMAX, NBEMAX+      PARAMETER          ( NINMAX = 7, NIDMAX = 9, NKBMAX = 7,+     $                   NALMAX = 7, NBEMAX = 7 )+*     .. Local Scalars ..+      DOUBLE PRECISION   EPS, ERR, THRESH+      INTEGER            I, ISNUM, J, N, NALF, NBET, NIDIM, NINC, NKB,+     $                   NOUT, NTRA+      LOGICAL            FATAL, LTESTT, REWI, SAME, SFATAL, TRACE,+     $                   TSTERR+      CHARACTER*1        TRANS+      CHARACTER*6        SNAMET+      CHARACTER*32       SNAPS, SUMMRY+*     .. Local Arrays ..+      DOUBLE PRECISION   A( NMAX, NMAX ), AA( NMAX*NMAX ),+     $                   ALF( NALMAX ), AS( NMAX*NMAX ), BET( NBEMAX ),+     $                   G( NMAX ), X( NMAX ), XS( NMAX*INCMAX ),+     $                   XX( NMAX*INCMAX ), Y( NMAX ),+     $                   YS( NMAX*INCMAX ), YT( NMAX ),+     $                   YY( NMAX*INCMAX ), Z( 2*NMAX )+      INTEGER            IDIM( NIDMAX ), INC( NINMAX ), KB( NKBMAX )+      LOGICAL            LTEST( NSUBS )+      CHARACTER*6        SNAMES( NSUBS )+*     .. External Functions ..+      DOUBLE PRECISION   DDIFF+      LOGICAL            LDE+      EXTERNAL           DDIFF, LDE+*     .. External Subroutines ..+      EXTERNAL           DCHK1, DCHK2, DCHK3, DCHK4, DCHK5, DCHK6,+     $                   DCHKE, DMVCH+*     .. Intrinsic Functions ..+      INTRINSIC          ABS, MAX, MIN+*     .. Scalars in Common ..+      INTEGER            INFOT, NOUTC+      LOGICAL            LERR, OK+      CHARACTER*6        SRNAMT+*     .. Common blocks ..+      COMMON             /INFOC/INFOT, NOUTC, OK, LERR+      COMMON             /SRNAMC/SRNAMT+*     .. Data statements ..+      DATA               SNAMES/'DGEMV ', 'DGBMV ', 'DSYMV ', 'DSBMV ',+     $                   'DSPMV ', 'DTRMV ', 'DTBMV ', 'DTPMV ',+     $                   'DTRSV ', 'DTBSV ', 'DTPSV ', 'DGER  ',+     $                   'DSYR  ', 'DSPR  ', 'DSYR2 ', 'DSPR2 '/+*     .. Executable Statements ..+*+*     Read name and unit number for summary output file and open file.+*+      READ( NIN, FMT = * )SUMMRY+      READ( NIN, FMT = * )NOUT+      OPEN( NOUT, FILE = SUMMRY, STATUS = 'UNKNOWN' )+      NOUTC = NOUT+*+*     Read name and unit number for snapshot output file and open file.+*+      READ( NIN, FMT = * )SNAPS+      READ( NIN, FMT = * )NTRA+      TRACE = NTRA.GE.0+      IF( TRACE )THEN+         OPEN( NTRA, FILE = SNAPS, STATUS = 'UNKNOWN' )+      END IF+*     Read the flag that directs rewinding of the snapshot file.+      READ( NIN, FMT = * )REWI+      REWI = REWI.AND.TRACE+*     Read the flag that directs stopping on any failure.+      READ( NIN, FMT = * )SFATAL+*     Read the flag that indicates whether error exits are to be tested.+      READ( NIN, FMT = * )TSTERR+*     Read the threshold value of the test ratio+      READ( NIN, FMT = * )THRESH+*+*     Read and check the parameter values for the tests.+*+*     Values of N+      READ( NIN, FMT = * )NIDIM+      IF( NIDIM.LT.1.OR.NIDIM.GT.NIDMAX )THEN+         WRITE( NOUT, FMT = 9997 )'N', NIDMAX+         GO TO 230+      END IF+      READ( NIN, FMT = * )( IDIM( I ), I = 1, NIDIM )+      DO 10 I = 1, NIDIM+         IF( IDIM( I ).LT.0.OR.IDIM( I ).GT.NMAX )THEN+            WRITE( NOUT, FMT = 9996 )NMAX+            GO TO 230+         END IF+   10 CONTINUE+*     Values of K+      READ( NIN, FMT = * )NKB+      IF( NKB.LT.1.OR.NKB.GT.NKBMAX )THEN+         WRITE( NOUT, FMT = 9997 )'K', NKBMAX+         GO TO 230+      END IF+      READ( NIN, FMT = * )( KB( I ), I = 1, NKB )+      DO 20 I = 1, NKB+         IF( KB( I ).LT.0 )THEN+            WRITE( NOUT, FMT = 9995 )+            GO TO 230+         END IF+   20 CONTINUE+*     Values of INCX and INCY+      READ( NIN, FMT = * )NINC+      IF( NINC.LT.1.OR.NINC.GT.NINMAX )THEN+         WRITE( NOUT, FMT = 9997 )'INCX AND INCY', NINMAX+         GO TO 230+      END IF+      READ( NIN, FMT = * )( INC( I ), I = 1, NINC )+      DO 30 I = 1, NINC+         IF( INC( I ).EQ.0.OR.ABS( INC( I ) ).GT.INCMAX )THEN+            WRITE( NOUT, FMT = 9994 )INCMAX+            GO TO 230+         END IF+   30 CONTINUE+*     Values of ALPHA+      READ( NIN, FMT = * )NALF+      IF( NALF.LT.1.OR.NALF.GT.NALMAX )THEN+         WRITE( NOUT, FMT = 9997 )'ALPHA', NALMAX+         GO TO 230+      END IF+      READ( NIN, FMT = * )( ALF( I ), I = 1, NALF )+*     Values of BETA+      READ( NIN, FMT = * )NBET+      IF( NBET.LT.1.OR.NBET.GT.NBEMAX )THEN+         WRITE( NOUT, FMT = 9997 )'BETA', NBEMAX+         GO TO 230+      END IF+      READ( NIN, FMT = * )( BET( I ), I = 1, NBET )+*+*     Report values of parameters.+*+      WRITE( NOUT, FMT = 9993 )+      WRITE( NOUT, FMT = 9992 )( IDIM( I ), I = 1, NIDIM )+      WRITE( NOUT, FMT = 9991 )( KB( I ), I = 1, NKB )+      WRITE( NOUT, FMT = 9990 )( INC( I ), I = 1, NINC )+      WRITE( NOUT, FMT = 9989 )( ALF( I ), I = 1, NALF )+      WRITE( NOUT, FMT = 9988 )( BET( I ), I = 1, NBET )+      IF( .NOT.TSTERR )THEN+         WRITE( NOUT, FMT = * )+         WRITE( NOUT, FMT = 9980 )+      END IF+      WRITE( NOUT, FMT = * )+      WRITE( NOUT, FMT = 9999 )THRESH+      WRITE( NOUT, FMT = * )+*+*     Read names of subroutines and flags which indicate+*     whether they are to be tested.+*+      DO 40 I = 1, NSUBS+         LTEST( I ) = .FALSE.+   40 CONTINUE+   50 READ( NIN, FMT = 9984, END = 80 )SNAMET, LTESTT+      DO 60 I = 1, NSUBS+         IF( SNAMET.EQ.SNAMES( I ) )+     $      GO TO 70+   60 CONTINUE+      WRITE( NOUT, FMT = 9986 )SNAMET+      STOP+   70 LTEST( I ) = LTESTT+      GO TO 50+*+   80 CONTINUE+      CLOSE ( NIN )+*+*     Compute EPS (the machine precision).+*+      EPS = EPSILON(ZERO)+      WRITE( NOUT, FMT = 9998 )EPS+*+*     Check the reliability of DMVCH using exact data.+*+      N = MIN( 32, NMAX )+      DO 120 J = 1, N+         DO 110 I = 1, N+            A( I, J ) = MAX( I - J + 1, 0 )+  110    CONTINUE+         X( J ) = J+         Y( J ) = ZERO+  120 CONTINUE+      DO 130 J = 1, N+         YY( J ) = J*( ( J + 1 )*J )/2 - ( ( J + 1 )*J*( J - 1 ) )/3+  130 CONTINUE+*     YY holds the exact result. On exit from DMVCH YT holds+*     the result computed by DMVCH.+      TRANS = 'N'+      CALL DMVCH( TRANS, N, N, ONE, A, NMAX, X, 1, ZERO, Y, 1, YT, G,+     $            YY, EPS, ERR, FATAL, NOUT, .TRUE. )+      SAME = LDE( YY, YT, N )+      IF( .NOT.SAME.OR.ERR.NE.ZERO )THEN+         WRITE( NOUT, FMT = 9985 )TRANS, SAME, ERR+         STOP+      END IF+      TRANS = 'T'+      CALL DMVCH( TRANS, N, N, ONE, A, NMAX, X, -1, ZERO, Y, -1, YT, G,+     $            YY, EPS, ERR, FATAL, NOUT, .TRUE. )+      SAME = LDE( YY, YT, N )+      IF( .NOT.SAME.OR.ERR.NE.ZERO )THEN+         WRITE( NOUT, FMT = 9985 )TRANS, SAME, ERR+         STOP+      END IF+*+*     Test each subroutine in turn.+*+      DO 210 ISNUM = 1, NSUBS+         WRITE( NOUT, FMT = * )+         IF( .NOT.LTEST( ISNUM ) )THEN+*           Subprogram is not to be tested.+            WRITE( NOUT, FMT = 9983 )SNAMES( ISNUM )+         ELSE+            SRNAMT = SNAMES( ISNUM )+*           Test error exits.+            IF( TSTERR )THEN+               CALL DCHKE( ISNUM, SNAMES( ISNUM ), NOUT )+               WRITE( NOUT, FMT = * )+            END IF+*           Test computations.+            INFOT = 0+            OK = .TRUE.+            FATAL = .FALSE.+            GO TO ( 140, 140, 150, 150, 150, 160, 160,+     $              160, 160, 160, 160, 170, 180, 180,+     $              190, 190 )ISNUM+*           Test DGEMV, 01, and DGBMV, 02.+  140       CALL DCHK1( SNAMES( ISNUM ), EPS, THRESH, NOUT, NTRA, TRACE,+     $                  REWI, FATAL, NIDIM, IDIM, NKB, KB, NALF, ALF,+     $                  NBET, BET, NINC, INC, NMAX, INCMAX, A, AA, AS,+     $                  X, XX, XS, Y, YY, YS, YT, G )+            GO TO 200+*           Test DSYMV, 03, DSBMV, 04, and DSPMV, 05.+  150       CALL DCHK2( SNAMES( ISNUM ), EPS, THRESH, NOUT, NTRA, TRACE,+     $                  REWI, FATAL, NIDIM, IDIM, NKB, KB, NALF, ALF,+     $                  NBET, BET, NINC, INC, NMAX, INCMAX, A, AA, AS,+     $                  X, XX, XS, Y, YY, YS, YT, G )+            GO TO 200+*           Test DTRMV, 06, DTBMV, 07, DTPMV, 08,+*           DTRSV, 09, DTBSV, 10, and DTPSV, 11.+  160       CALL DCHK3( SNAMES( ISNUM ), EPS, THRESH, NOUT, NTRA, TRACE,+     $                  REWI, FATAL, NIDIM, IDIM, NKB, KB, NINC, INC,+     $                  NMAX, INCMAX, A, AA, AS, Y, YY, YS, YT, G, Z )+            GO TO 200+*           Test DGER, 12.+  170       CALL DCHK4( SNAMES( ISNUM ), EPS, THRESH, NOUT, NTRA, TRACE,+     $                  REWI, FATAL, NIDIM, IDIM, NALF, ALF, NINC, INC,+     $                  NMAX, INCMAX, A, AA, AS, X, XX, XS, Y, YY, YS,+     $                  YT, G, Z )+            GO TO 200+*           Test DSYR, 13, and DSPR, 14.+  180       CALL DCHK5( SNAMES( ISNUM ), EPS, THRESH, NOUT, NTRA, TRACE,+     $                  REWI, FATAL, NIDIM, IDIM, NALF, ALF, NINC, INC,+     $                  NMAX, INCMAX, A, AA, AS, X, XX, XS, Y, YY, YS,+     $                  YT, G, Z )+            GO TO 200+*           Test DSYR2, 15, and DSPR2, 16.+  190       CALL DCHK6( SNAMES( ISNUM ), EPS, THRESH, NOUT, NTRA, TRACE,+     $                  REWI, FATAL, NIDIM, IDIM, NALF, ALF, NINC, INC,+     $                  NMAX, INCMAX, A, AA, AS, X, XX, XS, Y, YY, YS,+     $                  YT, G, Z )+*+  200       IF( FATAL.AND.SFATAL )+     $         GO TO 220+         END IF+  210 CONTINUE+      WRITE( NOUT, FMT = 9982 )+      GO TO 240+*+  220 CONTINUE+      WRITE( NOUT, FMT = 9981 )+      GO TO 240+*+  230 CONTINUE+      WRITE( NOUT, FMT = 9987 )+*+  240 CONTINUE+      IF( TRACE )+     $   CLOSE ( NTRA )+      CLOSE ( NOUT )+      STOP+*+ 9999 FORMAT( ' ROUTINES PASS COMPUTATIONAL TESTS IF TEST RATIO IS LES',+     $      'S THAN', F8.2 )+ 9998 FORMAT( ' RELATIVE MACHINE PRECISION IS TAKEN TO BE', 1P, D9.1 )+ 9997 FORMAT( ' NUMBER OF VALUES OF ', A, ' IS LESS THAN 1 OR GREATER ',+     $      'THAN ', I2 )+ 9996 FORMAT( ' VALUE OF N IS LESS THAN 0 OR GREATER THAN ', I2 )+ 9995 FORMAT( ' VALUE OF K IS LESS THAN 0' )+ 9994 FORMAT( ' ABSOLUTE VALUE OF INCX OR INCY IS 0 OR GREATER THAN ',+     $      I2 )+ 9993 FORMAT( ' TESTS OF THE DOUBLE PRECISION LEVEL 2 BLAS', //' THE F',+     $      'OLLOWING PARAMETER VALUES WILL BE USED:' )+ 9992 FORMAT( '   FOR N              ', 9I6 )+ 9991 FORMAT( '   FOR K              ', 7I6 )+ 9990 FORMAT( '   FOR INCX AND INCY  ', 7I6 )+ 9989 FORMAT( '   FOR ALPHA          ', 7F6.1 )+ 9988 FORMAT( '   FOR BETA           ', 7F6.1 )+ 9987 FORMAT( ' AMEND DATA FILE OR INCREASE ARRAY SIZES IN PROGRAM',+     $      /' ******* TESTS ABANDONED *******' )+ 9986 FORMAT( ' SUBPROGRAM NAME ', A6, ' NOT RECOGNIZED', /' ******* T',+     $      'ESTS ABANDONED *******' )+ 9985 FORMAT( ' ERROR IN DMVCH -  IN-LINE DOT PRODUCTS ARE BEING EVALU',+     $      'ATED WRONGLY.', /' DMVCH WAS CALLED WITH TRANS = ', A1,+     $      ' AND RETURNED SAME = ', L1, ' AND ERR = ', F12.3, '.', /+     $   ' THIS MAY BE DUE TO FAULTS IN THE ARITHMETIC OR THE COMPILER.'+     $      , /' ******* TESTS ABANDONED *******' )+ 9984 FORMAT( A6, L2 )+ 9983 FORMAT( 1X, A6, ' WAS NOT TESTED' )+ 9982 FORMAT( /' END OF TESTS' )+ 9981 FORMAT( /' ******* FATAL ERROR - TESTS ABANDONED *******' )+ 9980 FORMAT( ' ERROR-EXITS WILL NOT BE TESTED' )+*+*     End of DBLAT2.+*+      END+      SUBROUTINE DCHK1( SNAME, EPS, THRESH, NOUT, NTRA, TRACE, REWI,+     $                  FATAL, NIDIM, IDIM, NKB, KB, NALF, ALF, NBET,+     $                  BET, NINC, INC, NMAX, INCMAX, A, AA, AS, X, XX,+     $                  XS, Y, YY, YS, YT, G )+*+*  Tests DGEMV and DGBMV.+*+*  Auxiliary routine for test program for Level 2 Blas.+*+*  -- Written on 10-August-1987.+*     Richard Hanson, Sandia National Labs.+*     Jeremy Du Croz, NAG Central Office.+*+*     .. Parameters ..+      DOUBLE PRECISION   ZERO, HALF+      PARAMETER          ( ZERO = 0.0D0, HALF = 0.5D0 )+*     .. Scalar Arguments ..+      DOUBLE PRECISION   EPS, THRESH+      INTEGER            INCMAX, NALF, NBET, NIDIM, NINC, NKB, NMAX,+     $                   NOUT, NTRA+      LOGICAL            FATAL, REWI, TRACE+      CHARACTER*6        SNAME+*     .. Array Arguments ..+      DOUBLE PRECISION   A( NMAX, NMAX ), AA( NMAX*NMAX ), ALF( NALF ),+     $                   AS( NMAX*NMAX ), BET( NBET ), G( NMAX ),+     $                   X( NMAX ), XS( NMAX*INCMAX ),+     $                   XX( NMAX*INCMAX ), Y( NMAX ),+     $                   YS( NMAX*INCMAX ), YT( NMAX ),+     $                   YY( NMAX*INCMAX )+      INTEGER            IDIM( NIDIM ), INC( NINC ), KB( NKB )+*     .. Local Scalars ..+      DOUBLE PRECISION   ALPHA, ALS, BETA, BLS, ERR, ERRMAX, TRANSL+      INTEGER            I, IA, IB, IC, IKU, IM, IN, INCX, INCXS, INCY,+     $                   INCYS, IX, IY, KL, KLS, KU, KUS, LAA, LDA,+     $                   LDAS, LX, LY, M, ML, MS, N, NARGS, NC, ND, NK,+     $                   NL, NS+      LOGICAL            BANDED, FULL, NULL, RESET, SAME, TRAN+      CHARACTER*1        TRANS, TRANSS+      CHARACTER*3        ICH+*     .. Local Arrays ..+      LOGICAL            ISAME( 13 )+*     .. External Functions ..+      LOGICAL            LDE, LDERES+      EXTERNAL           LDE, LDERES+*     .. External Subroutines ..+      EXTERNAL           DGBMV, DGEMV, DMAKE, DMVCH+*     .. Intrinsic Functions ..+      INTRINSIC          ABS, MAX, MIN+*     .. Scalars in Common ..+      INTEGER            INFOT, NOUTC+      LOGICAL            LERR, OK+*     .. Common blocks ..+      COMMON             /INFOC/INFOT, NOUTC, OK, LERR+*     .. Data statements ..+      DATA               ICH/'NTC'/+*     .. Executable Statements ..+      FULL = SNAME( 3: 3 ).EQ.'E'+      BANDED = SNAME( 3: 3 ).EQ.'B'+*     Define the number of arguments.+      IF( FULL )THEN+         NARGS = 11+      ELSE IF( BANDED )THEN+         NARGS = 13+      END IF+*+      NC = 0+      RESET = .TRUE.+      ERRMAX = ZERO+*+      DO 120 IN = 1, NIDIM+         N = IDIM( IN )+         ND = N/2 + 1+*+         DO 110 IM = 1, 2+            IF( IM.EQ.1 )+     $         M = MAX( N - ND, 0 )+            IF( IM.EQ.2 )+     $         M = MIN( N + ND, NMAX )+*+            IF( BANDED )THEN+               NK = NKB+            ELSE+               NK = 1+            END IF+            DO 100 IKU = 1, NK+               IF( BANDED )THEN+                  KU = KB( IKU )+                  KL = MAX( KU - 1, 0 )+               ELSE+                  KU = N - 1+                  KL = M - 1+               END IF+*              Set LDA to 1 more than minimum value if room.+               IF( BANDED )THEN+                  LDA = KL + KU + 1+               ELSE+                  LDA = M+               END IF+               IF( LDA.LT.NMAX )+     $            LDA = LDA + 1+*              Skip tests if not enough room.+               IF( LDA.GT.NMAX )+     $            GO TO 100+               LAA = LDA*N+               NULL = N.LE.0.OR.M.LE.0+*+*              Generate the matrix A.+*+               TRANSL = ZERO+               CALL DMAKE( SNAME( 2: 3 ), ' ', ' ', M, N, A, NMAX, AA,+     $                     LDA, KL, KU, RESET, TRANSL )+*+               DO 90 IC = 1, 3+                  TRANS = ICH( IC: IC )+                  TRAN = TRANS.EQ.'T'.OR.TRANS.EQ.'C'+*+                  IF( TRAN )THEN+                     ML = N+                     NL = M+                  ELSE+                     ML = M+                     NL = N+                  END IF+*+                  DO 80 IX = 1, NINC+                     INCX = INC( IX )+                     LX = ABS( INCX )*NL+*+*                    Generate the vector X.+*+                     TRANSL = HALF+                     CALL DMAKE( 'GE', ' ', ' ', 1, NL, X, 1, XX,+     $                           ABS( INCX ), 0, NL - 1, RESET, TRANSL )+                     IF( NL.GT.1 )THEN+                        X( NL/2 ) = ZERO+                        XX( 1 + ABS( INCX )*( NL/2 - 1 ) ) = ZERO+                     END IF+*+                     DO 70 IY = 1, NINC+                        INCY = INC( IY )+                        LY = ABS( INCY )*ML+*+                        DO 60 IA = 1, NALF+                           ALPHA = ALF( IA )+*+                           DO 50 IB = 1, NBET+                              BETA = BET( IB )+*+*                             Generate the vector Y.+*+                              TRANSL = ZERO+                              CALL DMAKE( 'GE', ' ', ' ', 1, ML, Y, 1,+     $                                    YY, ABS( INCY ), 0, ML - 1,+     $                                    RESET, TRANSL )+*+                              NC = NC + 1+*+*                             Save every datum before calling the+*                             subroutine.+*+                              TRANSS = TRANS+                              MS = M+                              NS = N+                              KLS = KL+                              KUS = KU+                              ALS = ALPHA+                              DO 10 I = 1, LAA+                                 AS( I ) = AA( I )+   10                         CONTINUE+                              LDAS = LDA+                              DO 20 I = 1, LX+                                 XS( I ) = XX( I )+   20                         CONTINUE+                              INCXS = INCX+                              BLS = BETA+                              DO 30 I = 1, LY+                                 YS( I ) = YY( I )+   30                         CONTINUE+                              INCYS = INCY+*+*                             Call the subroutine.+*+                              IF( FULL )THEN+                                 IF( TRACE )+     $                              WRITE( NTRA, FMT = 9994 )NC, SNAME,+     $                              TRANS, M, N, ALPHA, LDA, INCX, BETA,+     $                              INCY+                                 IF( REWI )+     $                              REWIND NTRA+                                 CALL DGEMV( TRANS, M, N, ALPHA, AA,+     $                                       LDA, XX, INCX, BETA, YY,+     $                                       INCY )+                              ELSE IF( BANDED )THEN+                                 IF( TRACE )+     $                              WRITE( NTRA, FMT = 9995 )NC, SNAME,+     $                              TRANS, M, N, KL, KU, ALPHA, LDA,+     $                              INCX, BETA, INCY+                                 IF( REWI )+     $                              REWIND NTRA+                                 CALL DGBMV( TRANS, M, N, KL, KU, ALPHA,+     $                                       AA, LDA, XX, INCX, BETA,+     $                                       YY, INCY )+                              END IF+*+*                             Check if error-exit was taken incorrectly.+*+                              IF( .NOT.OK )THEN+                                 WRITE( NOUT, FMT = 9993 )+                                 FATAL = .TRUE.+                                 GO TO 130+                              END IF+*+*                             See what data changed inside subroutines.+*+                              ISAME( 1 ) = TRANS.EQ.TRANSS+                              ISAME( 2 ) = MS.EQ.M+                              ISAME( 3 ) = NS.EQ.N+                              IF( FULL )THEN+                                 ISAME( 4 ) = ALS.EQ.ALPHA+                                 ISAME( 5 ) = LDE( AS, AA, LAA )+                                 ISAME( 6 ) = LDAS.EQ.LDA+                                 ISAME( 7 ) = LDE( XS, XX, LX )+                                 ISAME( 8 ) = INCXS.EQ.INCX+                                 ISAME( 9 ) = BLS.EQ.BETA+                                 IF( NULL )THEN+                                    ISAME( 10 ) = LDE( YS, YY, LY )+                                 ELSE+                                    ISAME( 10 ) = LDERES( 'GE', ' ', 1,+     $                                            ML, YS, YY,+     $                                            ABS( INCY ) )+                                 END IF+                                 ISAME( 11 ) = INCYS.EQ.INCY+                              ELSE IF( BANDED )THEN+                                 ISAME( 4 ) = KLS.EQ.KL+                                 ISAME( 5 ) = KUS.EQ.KU+                                 ISAME( 6 ) = ALS.EQ.ALPHA+                                 ISAME( 7 ) = LDE( AS, AA, LAA )+                                 ISAME( 8 ) = LDAS.EQ.LDA+                                 ISAME( 9 ) = LDE( XS, XX, LX )+                                 ISAME( 10 ) = INCXS.EQ.INCX+                                 ISAME( 11 ) = BLS.EQ.BETA+                                 IF( NULL )THEN+                                    ISAME( 12 ) = LDE( YS, YY, LY )+                                 ELSE+                                    ISAME( 12 ) = LDERES( 'GE', ' ', 1,+     $                                            ML, YS, YY,+     $                                            ABS( INCY ) )+                                 END IF+                                 ISAME( 13 ) = INCYS.EQ.INCY+                              END IF+*+*                             If data was incorrectly changed, report+*                             and return.+*+                              SAME = .TRUE.+                              DO 40 I = 1, NARGS+                                 SAME = SAME.AND.ISAME( I )+                                 IF( .NOT.ISAME( I ) )+     $                              WRITE( NOUT, FMT = 9998 )I+   40                         CONTINUE+                              IF( .NOT.SAME )THEN+                                 FATAL = .TRUE.+                                 GO TO 130+                              END IF+*+                              IF( .NOT.NULL )THEN+*+*                                Check the result.+*+                                 CALL DMVCH( TRANS, M, N, ALPHA, A,+     $                                       NMAX, X, INCX, BETA, Y,+     $                                       INCY, YT, G, YY, EPS, ERR,+     $                                       FATAL, NOUT, .TRUE. )+                                 ERRMAX = MAX( ERRMAX, ERR )+*                                If got really bad answer, report and+*                                return.+                                 IF( FATAL )+     $                              GO TO 130+                              ELSE+*                                Avoid repeating tests with M.le.0 or+*                                N.le.0.+                                 GO TO 110+                              END IF+*+   50                      CONTINUE+*+   60                   CONTINUE+*+   70                CONTINUE+*+   80             CONTINUE+*+   90          CONTINUE+*+  100       CONTINUE+*+  110    CONTINUE+*+  120 CONTINUE+*+*     Report result.+*+      IF( ERRMAX.LT.THRESH )THEN+         WRITE( NOUT, FMT = 9999 )SNAME, NC+      ELSE+         WRITE( NOUT, FMT = 9997 )SNAME, NC, ERRMAX+      END IF+      GO TO 140+*+  130 CONTINUE+      WRITE( NOUT, FMT = 9996 )SNAME+      IF( FULL )THEN+         WRITE( NOUT, FMT = 9994 )NC, SNAME, TRANS, M, N, ALPHA, LDA,+     $      INCX, BETA, INCY+      ELSE IF( BANDED )THEN+         WRITE( NOUT, FMT = 9995 )NC, SNAME, TRANS, M, N, KL, KU,+     $      ALPHA, LDA, INCX, BETA, INCY+      END IF+*+  140 CONTINUE+      RETURN+*+ 9999 FORMAT( ' ', A6, ' PASSED THE COMPUTATIONAL TESTS (', I6, ' CALL',+     $      'S)' )+ 9998 FORMAT( ' ******* FATAL ERROR - PARAMETER NUMBER ', I2, ' WAS CH',+     $      'ANGED INCORRECTLY *******' )+ 9997 FORMAT( ' ', A6, ' COMPLETED THE COMPUTATIONAL TESTS (', I6, ' C',+     $      'ALLS)', /' ******* BUT WITH MAXIMUM TEST RATIO', F8.2,+     $      ' - SUSPECT *******' )+ 9996 FORMAT( ' ******* ', A6, ' FAILED ON CALL NUMBER:' )+ 9995 FORMAT( 1X, I6, ': ', A6, '(''', A1, ''',', 4( I3, ',' ), F4.1,+     $      ', A,', I3, ', X,', I2, ',', F4.1, ', Y,', I2, ') .' )+ 9994 FORMAT( 1X, I6, ': ', A6, '(''', A1, ''',', 2( I3, ',' ), F4.1,+     $      ', A,', I3, ', X,', I2, ',', F4.1, ', Y,', I2,+     $      ')         .' )+ 9993 FORMAT( ' ******* FATAL ERROR - ERROR-EXIT TAKEN ON VALID CALL *',+     $      '******' )+*+*     End of DCHK1.+*+      END+      SUBROUTINE DCHK2( SNAME, EPS, THRESH, NOUT, NTRA, TRACE, REWI,+     $                  FATAL, NIDIM, IDIM, NKB, KB, NALF, ALF, NBET,+     $                  BET, NINC, INC, NMAX, INCMAX, A, AA, AS, X, XX,+     $                  XS, Y, YY, YS, YT, G )+*+*  Tests DSYMV, DSBMV and DSPMV.+*+*  Auxiliary routine for test program for Level 2 Blas.+*+*  -- Written on 10-August-1987.+*     Richard Hanson, Sandia National Labs.+*     Jeremy Du Croz, NAG Central Office.+*+*     .. Parameters ..+      DOUBLE PRECISION   ZERO, HALF+      PARAMETER          ( ZERO = 0.0D0, HALF = 0.5D0 )+*     .. Scalar Arguments ..+      DOUBLE PRECISION   EPS, THRESH+      INTEGER            INCMAX, NALF, NBET, NIDIM, NINC, NKB, NMAX,+     $                   NOUT, NTRA+      LOGICAL            FATAL, REWI, TRACE+      CHARACTER*6        SNAME+*     .. Array Arguments ..+      DOUBLE PRECISION   A( NMAX, NMAX ), AA( NMAX*NMAX ), ALF( NALF ),+     $                   AS( NMAX*NMAX ), BET( NBET ), G( NMAX ),+     $                   X( NMAX ), XS( NMAX*INCMAX ),+     $                   XX( NMAX*INCMAX ), Y( NMAX ),+     $                   YS( NMAX*INCMAX ), YT( NMAX ),+     $                   YY( NMAX*INCMAX )+      INTEGER            IDIM( NIDIM ), INC( NINC ), KB( NKB )+*     .. Local Scalars ..+      DOUBLE PRECISION   ALPHA, ALS, BETA, BLS, ERR, ERRMAX, TRANSL+      INTEGER            I, IA, IB, IC, IK, IN, INCX, INCXS, INCY,+     $                   INCYS, IX, IY, K, KS, LAA, LDA, LDAS, LX, LY,+     $                   N, NARGS, NC, NK, NS+      LOGICAL            BANDED, FULL, NULL, PACKED, RESET, SAME+      CHARACTER*1        UPLO, UPLOS+      CHARACTER*2        ICH+*     .. Local Arrays ..+      LOGICAL            ISAME( 13 )+*     .. External Functions ..+      LOGICAL            LDE, LDERES+      EXTERNAL           LDE, LDERES+*     .. External Subroutines ..+      EXTERNAL           DMAKE, DMVCH, DSBMV, DSPMV, DSYMV+*     .. Intrinsic Functions ..+      INTRINSIC          ABS, MAX+*     .. Scalars in Common ..+      INTEGER            INFOT, NOUTC+      LOGICAL            LERR, OK+*     .. Common blocks ..+      COMMON             /INFOC/INFOT, NOUTC, OK, LERR+*     .. Data statements ..+      DATA               ICH/'UL'/+*     .. Executable Statements ..+      FULL = SNAME( 3: 3 ).EQ.'Y'+      BANDED = SNAME( 3: 3 ).EQ.'B'+      PACKED = SNAME( 3: 3 ).EQ.'P'+*     Define the number of arguments.+      IF( FULL )THEN+         NARGS = 10+      ELSE IF( BANDED )THEN+         NARGS = 11+      ELSE IF( PACKED )THEN+         NARGS = 9+      END IF+*+      NC = 0+      RESET = .TRUE.+      ERRMAX = ZERO+*+      DO 110 IN = 1, NIDIM+         N = IDIM( IN )+*+         IF( BANDED )THEN+            NK = NKB+         ELSE+            NK = 1+         END IF+         DO 100 IK = 1, NK+            IF( BANDED )THEN+               K = KB( IK )+            ELSE+               K = N - 1+            END IF+*           Set LDA to 1 more than minimum value if room.+            IF( BANDED )THEN+               LDA = K + 1+            ELSE+               LDA = N+            END IF+            IF( LDA.LT.NMAX )+     $         LDA = LDA + 1+*           Skip tests if not enough room.+            IF( LDA.GT.NMAX )+     $         GO TO 100+            IF( PACKED )THEN+               LAA = ( N*( N + 1 ) )/2+            ELSE+               LAA = LDA*N+            END IF+            NULL = N.LE.0+*+            DO 90 IC = 1, 2+               UPLO = ICH( IC: IC )+*+*              Generate the matrix A.+*+               TRANSL = ZERO+               CALL DMAKE( SNAME( 2: 3 ), UPLO, ' ', N, N, A, NMAX, AA,+     $                     LDA, K, K, RESET, TRANSL )+*+               DO 80 IX = 1, NINC+                  INCX = INC( IX )+                  LX = ABS( INCX )*N+*+*                 Generate the vector X.+*+                  TRANSL = HALF+                  CALL DMAKE( 'GE', ' ', ' ', 1, N, X, 1, XX,+     $                        ABS( INCX ), 0, N - 1, RESET, TRANSL )+                  IF( N.GT.1 )THEN+                     X( N/2 ) = ZERO+                     XX( 1 + ABS( INCX )*( N/2 - 1 ) ) = ZERO+                  END IF+*+                  DO 70 IY = 1, NINC+                     INCY = INC( IY )+                     LY = ABS( INCY )*N+*+                     DO 60 IA = 1, NALF+                        ALPHA = ALF( IA )+*+                        DO 50 IB = 1, NBET+                           BETA = BET( IB )+*+*                          Generate the vector Y.+*+                           TRANSL = ZERO+                           CALL DMAKE( 'GE', ' ', ' ', 1, N, Y, 1, YY,+     $                                 ABS( INCY ), 0, N - 1, RESET,+     $                                 TRANSL )+*+                           NC = NC + 1+*+*                          Save every datum before calling the+*                          subroutine.+*+                           UPLOS = UPLO+                           NS = N+                           KS = K+                           ALS = ALPHA+                           DO 10 I = 1, LAA+                              AS( I ) = AA( I )+   10                      CONTINUE+                           LDAS = LDA+                           DO 20 I = 1, LX+                              XS( I ) = XX( I )+   20                      CONTINUE+                           INCXS = INCX+                           BLS = BETA+                           DO 30 I = 1, LY+                              YS( I ) = YY( I )+   30                      CONTINUE+                           INCYS = INCY+*+*                          Call the subroutine.+*+                           IF( FULL )THEN+                              IF( TRACE )+     $                           WRITE( NTRA, FMT = 9993 )NC, SNAME,+     $                           UPLO, N, ALPHA, LDA, INCX, BETA, INCY+                              IF( REWI )+     $                           REWIND NTRA+                              CALL DSYMV( UPLO, N, ALPHA, AA, LDA, XX,+     $                                    INCX, BETA, YY, INCY )+                           ELSE IF( BANDED )THEN+                              IF( TRACE )+     $                           WRITE( NTRA, FMT = 9994 )NC, SNAME,+     $                           UPLO, N, K, ALPHA, LDA, INCX, BETA,+     $                           INCY+                              IF( REWI )+     $                           REWIND NTRA+                              CALL DSBMV( UPLO, N, K, ALPHA, AA, LDA,+     $                                    XX, INCX, BETA, YY, INCY )+                           ELSE IF( PACKED )THEN+                              IF( TRACE )+     $                           WRITE( NTRA, FMT = 9995 )NC, SNAME,+     $                           UPLO, N, ALPHA, INCX, BETA, INCY+                              IF( REWI )+     $                           REWIND NTRA+                              CALL DSPMV( UPLO, N, ALPHA, AA, XX, INCX,+     $                                    BETA, YY, INCY )+                           END IF+*+*                          Check if error-exit was taken incorrectly.+*+                           IF( .NOT.OK )THEN+                              WRITE( NOUT, FMT = 9992 )+                              FATAL = .TRUE.+                              GO TO 120+                           END IF+*+*                          See what data changed inside subroutines.+*+                           ISAME( 1 ) = UPLO.EQ.UPLOS+                           ISAME( 2 ) = NS.EQ.N+                           IF( FULL )THEN+                              ISAME( 3 ) = ALS.EQ.ALPHA+                              ISAME( 4 ) = LDE( AS, AA, LAA )+                              ISAME( 5 ) = LDAS.EQ.LDA+                              ISAME( 6 ) = LDE( XS, XX, LX )+                              ISAME( 7 ) = INCXS.EQ.INCX+                              ISAME( 8 ) = BLS.EQ.BETA+                              IF( NULL )THEN+                                 ISAME( 9 ) = LDE( YS, YY, LY )+                              ELSE+                                 ISAME( 9 ) = LDERES( 'GE', ' ', 1, N,+     $                                        YS, YY, ABS( INCY ) )+                              END IF+                              ISAME( 10 ) = INCYS.EQ.INCY+                           ELSE IF( BANDED )THEN+                              ISAME( 3 ) = KS.EQ.K+                              ISAME( 4 ) = ALS.EQ.ALPHA+                              ISAME( 5 ) = LDE( AS, AA, LAA )+                              ISAME( 6 ) = LDAS.EQ.LDA+                              ISAME( 7 ) = LDE( XS, XX, LX )+                              ISAME( 8 ) = INCXS.EQ.INCX+                              ISAME( 9 ) = BLS.EQ.BETA+                              IF( NULL )THEN+                                 ISAME( 10 ) = LDE( YS, YY, LY )+                              ELSE+                                 ISAME( 10 ) = LDERES( 'GE', ' ', 1, N,+     $                                         YS, YY, ABS( INCY ) )+                              END IF+                              ISAME( 11 ) = INCYS.EQ.INCY+                           ELSE IF( PACKED )THEN+                              ISAME( 3 ) = ALS.EQ.ALPHA+                              ISAME( 4 ) = LDE( AS, AA, LAA )+                              ISAME( 5 ) = LDE( XS, XX, LX )+                              ISAME( 6 ) = INCXS.EQ.INCX+                              ISAME( 7 ) = BLS.EQ.BETA+                              IF( NULL )THEN+                                 ISAME( 8 ) = LDE( YS, YY, LY )+                              ELSE+                                 ISAME( 8 ) = LDERES( 'GE', ' ', 1, N,+     $                                        YS, YY, ABS( INCY ) )+                              END IF+                              ISAME( 9 ) = INCYS.EQ.INCY+                           END IF+*+*                          If data was incorrectly changed, report and+*                          return.+*+                           SAME = .TRUE.+                           DO 40 I = 1, NARGS+                              SAME = SAME.AND.ISAME( I )+                              IF( .NOT.ISAME( I ) )+     $                           WRITE( NOUT, FMT = 9998 )I+   40                      CONTINUE+                           IF( .NOT.SAME )THEN+                              FATAL = .TRUE.+                              GO TO 120+                           END IF+*+                           IF( .NOT.NULL )THEN+*+*                             Check the result.+*+                              CALL DMVCH( 'N', N, N, ALPHA, A, NMAX, X,+     $                                    INCX, BETA, Y, INCY, YT, G,+     $                                    YY, EPS, ERR, FATAL, NOUT,+     $                                    .TRUE. )+                              ERRMAX = MAX( ERRMAX, ERR )+*                             If got really bad answer, report and+*                             return.+                              IF( FATAL )+     $                           GO TO 120+                           ELSE+*                             Avoid repeating tests with N.le.0+                              GO TO 110+                           END IF+*+   50                   CONTINUE+*+   60                CONTINUE+*+   70             CONTINUE+*+   80          CONTINUE+*+   90       CONTINUE+*+  100    CONTINUE+*+  110 CONTINUE+*+*     Report result.+*+      IF( ERRMAX.LT.THRESH )THEN+         WRITE( NOUT, FMT = 9999 )SNAME, NC+      ELSE+         WRITE( NOUT, FMT = 9997 )SNAME, NC, ERRMAX+      END IF+      GO TO 130+*+  120 CONTINUE+      WRITE( NOUT, FMT = 9996 )SNAME+      IF( FULL )THEN+         WRITE( NOUT, FMT = 9993 )NC, SNAME, UPLO, N, ALPHA, LDA, INCX,+     $      BETA, INCY+      ELSE IF( BANDED )THEN+         WRITE( NOUT, FMT = 9994 )NC, SNAME, UPLO, N, K, ALPHA, LDA,+     $      INCX, BETA, INCY+      ELSE IF( PACKED )THEN+         WRITE( NOUT, FMT = 9995 )NC, SNAME, UPLO, N, ALPHA, INCX,+     $      BETA, INCY+      END IF+*+  130 CONTINUE+      RETURN+*+ 9999 FORMAT( ' ', A6, ' PASSED THE COMPUTATIONAL TESTS (', I6, ' CALL',+     $      'S)' )+ 9998 FORMAT( ' ******* FATAL ERROR - PARAMETER NUMBER ', I2, ' WAS CH',+     $      'ANGED INCORRECTLY *******' )+ 9997 FORMAT( ' ', A6, ' COMPLETED THE COMPUTATIONAL TESTS (', I6, ' C',+     $      'ALLS)', /' ******* BUT WITH MAXIMUM TEST RATIO', F8.2,+     $      ' - SUSPECT *******' )+ 9996 FORMAT( ' ******* ', A6, ' FAILED ON CALL NUMBER:' )+ 9995 FORMAT( 1X, I6, ': ', A6, '(''', A1, ''',', I3, ',', F4.1, ', AP',+     $      ', X,', I2, ',', F4.1, ', Y,', I2, ')                .' )+ 9994 FORMAT( 1X, I6, ': ', A6, '(''', A1, ''',', 2( I3, ',' ), F4.1,+     $      ', A,', I3, ', X,', I2, ',', F4.1, ', Y,', I2,+     $      ')         .' )+ 9993 FORMAT( 1X, I6, ': ', A6, '(''', A1, ''',', I3, ',', F4.1, ', A,',+     $      I3, ', X,', I2, ',', F4.1, ', Y,', I2, ')             .' )+ 9992 FORMAT( ' ******* FATAL ERROR - ERROR-EXIT TAKEN ON VALID CALL *',+     $      '******' )+*+*     End of DCHK2.+*+      END+      SUBROUTINE DCHK3( SNAME, EPS, THRESH, NOUT, NTRA, TRACE, REWI,+     $                  FATAL, NIDIM, IDIM, NKB, KB, NINC, INC, NMAX,+     $                  INCMAX, A, AA, AS, X, XX, XS, XT, G, Z )+*+*  Tests DTRMV, DTBMV, DTPMV, DTRSV, DTBSV and DTPSV.+*+*  Auxiliary routine for test program for Level 2 Blas.+*+*  -- Written on 10-August-1987.+*     Richard Hanson, Sandia National Labs.+*     Jeremy Du Croz, NAG Central Office.+*+*     .. Parameters ..+      DOUBLE PRECISION   ZERO, HALF, ONE+      PARAMETER          ( ZERO = 0.0D0, HALF = 0.5D0, ONE = 1.0D0 )+*     .. Scalar Arguments ..+      DOUBLE PRECISION   EPS, THRESH+      INTEGER            INCMAX, NIDIM, NINC, NKB, NMAX, NOUT, NTRA+      LOGICAL            FATAL, REWI, TRACE+      CHARACTER*6        SNAME+*     .. Array Arguments ..+      DOUBLE PRECISION   A( NMAX, NMAX ), AA( NMAX*NMAX ),+     $                   AS( NMAX*NMAX ), G( NMAX ), X( NMAX ),+     $                   XS( NMAX*INCMAX ), XT( NMAX ),+     $                   XX( NMAX*INCMAX ), Z( NMAX )+      INTEGER            IDIM( NIDIM ), INC( NINC ), KB( NKB )+*     .. Local Scalars ..+      DOUBLE PRECISION   ERR, ERRMAX, TRANSL+      INTEGER            I, ICD, ICT, ICU, IK, IN, INCX, INCXS, IX, K,+     $                   KS, LAA, LDA, LDAS, LX, N, NARGS, NC, NK, NS+      LOGICAL            BANDED, FULL, NULL, PACKED, RESET, SAME+      CHARACTER*1        DIAG, DIAGS, TRANS, TRANSS, UPLO, UPLOS+      CHARACTER*2        ICHD, ICHU+      CHARACTER*3        ICHT+*     .. Local Arrays ..+      LOGICAL            ISAME( 13 )+*     .. External Functions ..+      LOGICAL            LDE, LDERES+      EXTERNAL           LDE, LDERES+*     .. External Subroutines ..+      EXTERNAL           DMAKE, DMVCH, DTBMV, DTBSV, DTPMV, DTPSV,+     $                   DTRMV, DTRSV+*     .. Intrinsic Functions ..+      INTRINSIC          ABS, MAX+*     .. Scalars in Common ..+      INTEGER            INFOT, NOUTC+      LOGICAL            LERR, OK+*     .. Common blocks ..+      COMMON             /INFOC/INFOT, NOUTC, OK, LERR+*     .. Data statements ..+      DATA               ICHU/'UL'/, ICHT/'NTC'/, ICHD/'UN'/+*     .. Executable Statements ..+      FULL = SNAME( 3: 3 ).EQ.'R'+      BANDED = SNAME( 3: 3 ).EQ.'B'+      PACKED = SNAME( 3: 3 ).EQ.'P'+*     Define the number of arguments.+      IF( FULL )THEN+         NARGS = 8+      ELSE IF( BANDED )THEN+         NARGS = 9+      ELSE IF( PACKED )THEN+         NARGS = 7+      END IF+*+      NC = 0+      RESET = .TRUE.+      ERRMAX = ZERO+*     Set up zero vector for DMVCH.+      DO 10 I = 1, NMAX+         Z( I ) = ZERO+   10 CONTINUE+*+      DO 110 IN = 1, NIDIM+         N = IDIM( IN )+*+         IF( BANDED )THEN+            NK = NKB+         ELSE+            NK = 1+         END IF+         DO 100 IK = 1, NK+            IF( BANDED )THEN+               K = KB( IK )+            ELSE+               K = N - 1+            END IF+*           Set LDA to 1 more than minimum value if room.+            IF( BANDED )THEN+               LDA = K + 1+            ELSE+               LDA = N+            END IF+            IF( LDA.LT.NMAX )+     $         LDA = LDA + 1+*           Skip tests if not enough room.+            IF( LDA.GT.NMAX )+     $         GO TO 100+            IF( PACKED )THEN+               LAA = ( N*( N + 1 ) )/2+            ELSE+               LAA = LDA*N+            END IF+            NULL = N.LE.0+*+            DO 90 ICU = 1, 2+               UPLO = ICHU( ICU: ICU )+*+               DO 80 ICT = 1, 3+                  TRANS = ICHT( ICT: ICT )+*+                  DO 70 ICD = 1, 2+                     DIAG = ICHD( ICD: ICD )+*+*                    Generate the matrix A.+*+                     TRANSL = ZERO+                     CALL DMAKE( SNAME( 2: 3 ), UPLO, DIAG, N, N, A,+     $                           NMAX, AA, LDA, K, K, RESET, TRANSL )+*+                     DO 60 IX = 1, NINC+                        INCX = INC( IX )+                        LX = ABS( INCX )*N+*+*                       Generate the vector X.+*+                        TRANSL = HALF+                        CALL DMAKE( 'GE', ' ', ' ', 1, N, X, 1, XX,+     $                              ABS( INCX ), 0, N - 1, RESET,+     $                              TRANSL )+                        IF( N.GT.1 )THEN+                           X( N/2 ) = ZERO+                           XX( 1 + ABS( INCX )*( N/2 - 1 ) ) = ZERO+                        END IF+*+                        NC = NC + 1+*+*                       Save every datum before calling the subroutine.+*+                        UPLOS = UPLO+                        TRANSS = TRANS+                        DIAGS = DIAG+                        NS = N+                        KS = K+                        DO 20 I = 1, LAA+                           AS( I ) = AA( I )+   20                   CONTINUE+                        LDAS = LDA+                        DO 30 I = 1, LX+                           XS( I ) = XX( I )+   30                   CONTINUE+                        INCXS = INCX+*+*                       Call the subroutine.+*+                        IF( SNAME( 4: 5 ).EQ.'MV' )THEN+                           IF( FULL )THEN+                              IF( TRACE )+     $                           WRITE( NTRA, FMT = 9993 )NC, SNAME,+     $                           UPLO, TRANS, DIAG, N, LDA, INCX+                              IF( REWI )+     $                           REWIND NTRA+                              CALL DTRMV( UPLO, TRANS, DIAG, N, AA, LDA,+     $                                    XX, INCX )+                           ELSE IF( BANDED )THEN+                              IF( TRACE )+     $                           WRITE( NTRA, FMT = 9994 )NC, SNAME,+     $                           UPLO, TRANS, DIAG, N, K, LDA, INCX+                              IF( REWI )+     $                           REWIND NTRA+                              CALL DTBMV( UPLO, TRANS, DIAG, N, K, AA,+     $                                    LDA, XX, INCX )+                           ELSE IF( PACKED )THEN+                              IF( TRACE )+     $                           WRITE( NTRA, FMT = 9995 )NC, SNAME,+     $                           UPLO, TRANS, DIAG, N, INCX+                              IF( REWI )+     $                           REWIND NTRA+                              CALL DTPMV( UPLO, TRANS, DIAG, N, AA, XX,+     $                                    INCX )+                           END IF+                        ELSE IF( SNAME( 4: 5 ).EQ.'SV' )THEN+                           IF( FULL )THEN+                              IF( TRACE )+     $                           WRITE( NTRA, FMT = 9993 )NC, SNAME,+     $                           UPLO, TRANS, DIAG, N, LDA, INCX+                              IF( REWI )+     $                           REWIND NTRA+                              CALL DTRSV( UPLO, TRANS, DIAG, N, AA, LDA,+     $                                    XX, INCX )+                           ELSE IF( BANDED )THEN+                              IF( TRACE )+     $                           WRITE( NTRA, FMT = 9994 )NC, SNAME,+     $                           UPLO, TRANS, DIAG, N, K, LDA, INCX+                              IF( REWI )+     $                           REWIND NTRA+                              CALL DTBSV( UPLO, TRANS, DIAG, N, K, AA,+     $                                    LDA, XX, INCX )+                           ELSE IF( PACKED )THEN+                              IF( TRACE )+     $                           WRITE( NTRA, FMT = 9995 )NC, SNAME,+     $                           UPLO, TRANS, DIAG, N, INCX+                              IF( REWI )+     $                           REWIND NTRA+                              CALL DTPSV( UPLO, TRANS, DIAG, N, AA, XX,+     $                                    INCX )+                           END IF+                        END IF+*+*                       Check if error-exit was taken incorrectly.+*+                        IF( .NOT.OK )THEN+                           WRITE( NOUT, FMT = 9992 )+                           FATAL = .TRUE.+                           GO TO 120+                        END IF+*+*                       See what data changed inside subroutines.+*+                        ISAME( 1 ) = UPLO.EQ.UPLOS+                        ISAME( 2 ) = TRANS.EQ.TRANSS+                        ISAME( 3 ) = DIAG.EQ.DIAGS+                        ISAME( 4 ) = NS.EQ.N+                        IF( FULL )THEN+                           ISAME( 5 ) = LDE( AS, AA, LAA )+                           ISAME( 6 ) = LDAS.EQ.LDA+                           IF( NULL )THEN+                              ISAME( 7 ) = LDE( XS, XX, LX )+                           ELSE+                              ISAME( 7 ) = LDERES( 'GE', ' ', 1, N, XS,+     $                                     XX, ABS( INCX ) )+                           END IF+                           ISAME( 8 ) = INCXS.EQ.INCX+                        ELSE IF( BANDED )THEN+                           ISAME( 5 ) = KS.EQ.K+                           ISAME( 6 ) = LDE( AS, AA, LAA )+                           ISAME( 7 ) = LDAS.EQ.LDA+                           IF( NULL )THEN+                              ISAME( 8 ) = LDE( XS, XX, LX )+                           ELSE+                              ISAME( 8 ) = LDERES( 'GE', ' ', 1, N, XS,+     $                                     XX, ABS( INCX ) )+                           END IF+                           ISAME( 9 ) = INCXS.EQ.INCX+                        ELSE IF( PACKED )THEN+                           ISAME( 5 ) = LDE( AS, AA, LAA )+                           IF( NULL )THEN+                              ISAME( 6 ) = LDE( XS, XX, LX )+                           ELSE+                              ISAME( 6 ) = LDERES( 'GE', ' ', 1, N, XS,+     $                                     XX, ABS( INCX ) )+                           END IF+                           ISAME( 7 ) = INCXS.EQ.INCX+                        END IF+*+*                       If data was incorrectly changed, report and+*                       return.+*+                        SAME = .TRUE.+                        DO 40 I = 1, NARGS+                           SAME = SAME.AND.ISAME( I )+                           IF( .NOT.ISAME( I ) )+     $                        WRITE( NOUT, FMT = 9998 )I+   40                   CONTINUE+                        IF( .NOT.SAME )THEN+                           FATAL = .TRUE.+                           GO TO 120+                        END IF+*+                        IF( .NOT.NULL )THEN+                           IF( SNAME( 4: 5 ).EQ.'MV' )THEN+*+*                             Check the result.+*+                              CALL DMVCH( TRANS, N, N, ONE, A, NMAX, X,+     $                                    INCX, ZERO, Z, INCX, XT, G,+     $                                    XX, EPS, ERR, FATAL, NOUT,+     $                                    .TRUE. )+                           ELSE IF( SNAME( 4: 5 ).EQ.'SV' )THEN+*+*                             Compute approximation to original vector.+*+                              DO 50 I = 1, N+                                 Z( I ) = XX( 1 + ( I - 1 )*+     $                                    ABS( INCX ) )+                                 XX( 1 + ( I - 1 )*ABS( INCX ) )+     $                              = X( I )+   50                         CONTINUE+                              CALL DMVCH( TRANS, N, N, ONE, A, NMAX, Z,+     $                                    INCX, ZERO, X, INCX, XT, G,+     $                                    XX, EPS, ERR, FATAL, NOUT,+     $                                    .FALSE. )+                           END IF+                           ERRMAX = MAX( ERRMAX, ERR )+*                          If got really bad answer, report and return.+                           IF( FATAL )+     $                        GO TO 120+                        ELSE+*                          Avoid repeating tests with N.le.0.+                           GO TO 110+                        END IF+*+   60                CONTINUE+*+   70             CONTINUE+*+   80          CONTINUE+*+   90       CONTINUE+*+  100    CONTINUE+*+  110 CONTINUE+*+*     Report result.+*+      IF( ERRMAX.LT.THRESH )THEN+         WRITE( NOUT, FMT = 9999 )SNAME, NC+      ELSE+         WRITE( NOUT, FMT = 9997 )SNAME, NC, ERRMAX+      END IF+      GO TO 130+*+  120 CONTINUE+      WRITE( NOUT, FMT = 9996 )SNAME+      IF( FULL )THEN+         WRITE( NOUT, FMT = 9993 )NC, SNAME, UPLO, TRANS, DIAG, N, LDA,+     $      INCX+      ELSE IF( BANDED )THEN+         WRITE( NOUT, FMT = 9994 )NC, SNAME, UPLO, TRANS, DIAG, N, K,+     $      LDA, INCX+      ELSE IF( PACKED )THEN+         WRITE( NOUT, FMT = 9995 )NC, SNAME, UPLO, TRANS, DIAG, N, INCX+      END IF+*+  130 CONTINUE+      RETURN+*+ 9999 FORMAT( ' ', A6, ' PASSED THE COMPUTATIONAL TESTS (', I6, ' CALL',+     $      'S)' )+ 9998 FORMAT( ' ******* FATAL ERROR - PARAMETER NUMBER ', I2, ' WAS CH',+     $      'ANGED INCORRECTLY *******' )+ 9997 FORMAT( ' ', A6, ' COMPLETED THE COMPUTATIONAL TESTS (', I6, ' C',+     $      'ALLS)', /' ******* BUT WITH MAXIMUM TEST RATIO', F8.2,+     $      ' - SUSPECT *******' )+ 9996 FORMAT( ' ******* ', A6, ' FAILED ON CALL NUMBER:' )+ 9995 FORMAT( 1X, I6, ': ', A6, '(', 3( '''', A1, ''',' ), I3, ', AP, ',+     $      'X,', I2, ')                        .' )+ 9994 FORMAT( 1X, I6, ': ', A6, '(', 3( '''', A1, ''',' ), 2( I3, ',' ),+     $      ' A,', I3, ', X,', I2, ')                 .' )+ 9993 FORMAT( 1X, I6, ': ', A6, '(', 3( '''', A1, ''',' ), I3, ', A,',+     $      I3, ', X,', I2, ')                     .' )+ 9992 FORMAT( ' ******* FATAL ERROR - ERROR-EXIT TAKEN ON VALID CALL *',+     $      '******' )+*+*     End of DCHK3.+*+      END+      SUBROUTINE DCHK4( SNAME, EPS, THRESH, NOUT, NTRA, TRACE, REWI,+     $                  FATAL, NIDIM, IDIM, NALF, ALF, NINC, INC, NMAX,+     $                  INCMAX, A, AA, AS, X, XX, XS, Y, YY, YS, YT, G,+     $                  Z )+*+*  Tests DGER.+*+*  Auxiliary routine for test program for Level 2 Blas.+*+*  -- Written on 10-August-1987.+*     Richard Hanson, Sandia National Labs.+*     Jeremy Du Croz, NAG Central Office.+*+*     .. Parameters ..+      DOUBLE PRECISION   ZERO, HALF, ONE+      PARAMETER          ( ZERO = 0.0D0, HALF = 0.5D0, ONE = 1.0D0 )+*     .. Scalar Arguments ..+      DOUBLE PRECISION   EPS, THRESH+      INTEGER            INCMAX, NALF, NIDIM, NINC, NMAX, NOUT, NTRA+      LOGICAL            FATAL, REWI, TRACE+      CHARACTER*6        SNAME+*     .. Array Arguments ..+      DOUBLE PRECISION   A( NMAX, NMAX ), AA( NMAX*NMAX ), ALF( NALF ),+     $                   AS( NMAX*NMAX ), G( NMAX ), X( NMAX ),+     $                   XS( NMAX*INCMAX ), XX( NMAX*INCMAX ),+     $                   Y( NMAX ), YS( NMAX*INCMAX ), YT( NMAX ),+     $                   YY( NMAX*INCMAX ), Z( NMAX )+      INTEGER            IDIM( NIDIM ), INC( NINC )+*     .. Local Scalars ..+      DOUBLE PRECISION   ALPHA, ALS, ERR, ERRMAX, TRANSL+      INTEGER            I, IA, IM, IN, INCX, INCXS, INCY, INCYS, IX,+     $                   IY, J, LAA, LDA, LDAS, LX, LY, M, MS, N, NARGS,+     $                   NC, ND, NS+      LOGICAL            NULL, RESET, SAME+*     .. Local Arrays ..+      DOUBLE PRECISION   W( 1 )+      LOGICAL            ISAME( 13 )+*     .. External Functions ..+      LOGICAL            LDE, LDERES+      EXTERNAL           LDE, LDERES+*     .. External Subroutines ..+      EXTERNAL           DGER, DMAKE, DMVCH+*     .. Intrinsic Functions ..+      INTRINSIC          ABS, MAX, MIN+*     .. Scalars in Common ..+      INTEGER            INFOT, NOUTC+      LOGICAL            LERR, OK+*     .. Common blocks ..+      COMMON             /INFOC/INFOT, NOUTC, OK, LERR+*     .. Executable Statements ..+*     Define the number of arguments.+      NARGS = 9+*+      NC = 0+      RESET = .TRUE.+      ERRMAX = ZERO+*+      DO 120 IN = 1, NIDIM+         N = IDIM( IN )+         ND = N/2 + 1+*+         DO 110 IM = 1, 2+            IF( IM.EQ.1 )+     $         M = MAX( N - ND, 0 )+            IF( IM.EQ.2 )+     $         M = MIN( N + ND, NMAX )+*+*           Set LDA to 1 more than minimum value if room.+            LDA = M+            IF( LDA.LT.NMAX )+     $         LDA = LDA + 1+*           Skip tests if not enough room.+            IF( LDA.GT.NMAX )+     $         GO TO 110+            LAA = LDA*N+            NULL = N.LE.0.OR.M.LE.0+*+            DO 100 IX = 1, NINC+               INCX = INC( IX )+               LX = ABS( INCX )*M+*+*              Generate the vector X.+*+               TRANSL = HALF+               CALL DMAKE( 'GE', ' ', ' ', 1, M, X, 1, XX, ABS( INCX ),+     $                     0, M - 1, RESET, TRANSL )+               IF( M.GT.1 )THEN+                  X( M/2 ) = ZERO+                  XX( 1 + ABS( INCX )*( M/2 - 1 ) ) = ZERO+               END IF+*+               DO 90 IY = 1, NINC+                  INCY = INC( IY )+                  LY = ABS( INCY )*N+*+*                 Generate the vector Y.+*+                  TRANSL = ZERO+                  CALL DMAKE( 'GE', ' ', ' ', 1, N, Y, 1, YY,+     $                        ABS( INCY ), 0, N - 1, RESET, TRANSL )+                  IF( N.GT.1 )THEN+                     Y( N/2 ) = ZERO+                     YY( 1 + ABS( INCY )*( N/2 - 1 ) ) = ZERO+                  END IF+*+                  DO 80 IA = 1, NALF+                     ALPHA = ALF( IA )+*+*                    Generate the matrix A.+*+                     TRANSL = ZERO+                     CALL DMAKE( SNAME( 2: 3 ), ' ', ' ', M, N, A, NMAX,+     $                           AA, LDA, M - 1, N - 1, RESET, TRANSL )+*+                     NC = NC + 1+*+*                    Save every datum before calling the subroutine.+*+                     MS = M+                     NS = N+                     ALS = ALPHA+                     DO 10 I = 1, LAA+                        AS( I ) = AA( I )+   10                CONTINUE+                     LDAS = LDA+                     DO 20 I = 1, LX+                        XS( I ) = XX( I )+   20                CONTINUE+                     INCXS = INCX+                     DO 30 I = 1, LY+                        YS( I ) = YY( I )+   30                CONTINUE+                     INCYS = INCY+*+*                    Call the subroutine.+*+                     IF( TRACE )+     $                  WRITE( NTRA, FMT = 9994 )NC, SNAME, M, N,+     $                  ALPHA, INCX, INCY, LDA+                     IF( REWI )+     $                  REWIND NTRA+                     CALL DGER( M, N, ALPHA, XX, INCX, YY, INCY, AA,+     $                          LDA )+*+*                    Check if error-exit was taken incorrectly.+*+                     IF( .NOT.OK )THEN+                        WRITE( NOUT, FMT = 9993 )+                        FATAL = .TRUE.+                        GO TO 140+                     END IF+*+*                    See what data changed inside subroutine.+*+                     ISAME( 1 ) = MS.EQ.M+                     ISAME( 2 ) = NS.EQ.N+                     ISAME( 3 ) = ALS.EQ.ALPHA+                     ISAME( 4 ) = LDE( XS, XX, LX )+                     ISAME( 5 ) = INCXS.EQ.INCX+                     ISAME( 6 ) = LDE( YS, YY, LY )+                     ISAME( 7 ) = INCYS.EQ.INCY+                     IF( NULL )THEN+                        ISAME( 8 ) = LDE( AS, AA, LAA )+                     ELSE+                        ISAME( 8 ) = LDERES( 'GE', ' ', M, N, AS, AA,+     $                               LDA )+                     END IF+                     ISAME( 9 ) = LDAS.EQ.LDA+*+*                    If data was incorrectly changed, report and return.+*+                     SAME = .TRUE.+                     DO 40 I = 1, NARGS+                        SAME = SAME.AND.ISAME( I )+                        IF( .NOT.ISAME( I ) )+     $                     WRITE( NOUT, FMT = 9998 )I+   40                CONTINUE+                     IF( .NOT.SAME )THEN+                        FATAL = .TRUE.+                        GO TO 140+                     END IF+*+                     IF( .NOT.NULL )THEN+*+*                       Check the result column by column.+*+                        IF( INCX.GT.0 )THEN+                           DO 50 I = 1, M+                              Z( I ) = X( I )+   50                      CONTINUE+                        ELSE+                           DO 60 I = 1, M+                              Z( I ) = X( M - I + 1 )+   60                      CONTINUE+                        END IF+                        DO 70 J = 1, N+                           IF( INCY.GT.0 )THEN+                              W( 1 ) = Y( J )+                           ELSE+                              W( 1 ) = Y( N - J + 1 )+                           END IF+                           CALL DMVCH( 'N', M, 1, ALPHA, Z, NMAX, W, 1,+     $                                 ONE, A( 1, J ), 1, YT, G,+     $                                 AA( 1 + ( J - 1 )*LDA ), EPS,+     $                                 ERR, FATAL, NOUT, .TRUE. )+                           ERRMAX = MAX( ERRMAX, ERR )+*                          If got really bad answer, report and return.+                           IF( FATAL )+     $                        GO TO 130+   70                   CONTINUE+                     ELSE+*                       Avoid repeating tests with M.le.0 or N.le.0.+                        GO TO 110+                     END IF+*+   80             CONTINUE+*+   90          CONTINUE+*+  100       CONTINUE+*+  110    CONTINUE+*+  120 CONTINUE+*+*     Report result.+*+      IF( ERRMAX.LT.THRESH )THEN+         WRITE( NOUT, FMT = 9999 )SNAME, NC+      ELSE+         WRITE( NOUT, FMT = 9997 )SNAME, NC, ERRMAX+      END IF+      GO TO 150+*+  130 CONTINUE+      WRITE( NOUT, FMT = 9995 )J+*+  140 CONTINUE+      WRITE( NOUT, FMT = 9996 )SNAME+      WRITE( NOUT, FMT = 9994 )NC, SNAME, M, N, ALPHA, INCX, INCY, LDA+*+  150 CONTINUE+      RETURN+*+ 9999 FORMAT( ' ', A6, ' PASSED THE COMPUTATIONAL TESTS (', I6, ' CALL',+     $      'S)' )+ 9998 FORMAT( ' ******* FATAL ERROR - PARAMETER NUMBER ', I2, ' WAS CH',+     $      'ANGED INCORRECTLY *******' )+ 9997 FORMAT( ' ', A6, ' COMPLETED THE COMPUTATIONAL TESTS (', I6, ' C',+     $      'ALLS)', /' ******* BUT WITH MAXIMUM TEST RATIO', F8.2,+     $      ' - SUSPECT *******' )+ 9996 FORMAT( ' ******* ', A6, ' FAILED ON CALL NUMBER:' )+ 9995 FORMAT( '      THESE ARE THE RESULTS FOR COLUMN ', I3 )+ 9994 FORMAT( 1X, I6, ': ', A6, '(', 2( I3, ',' ), F4.1, ', X,', I2,+     $      ', Y,', I2, ', A,', I3, ')                  .' )+ 9993 FORMAT( ' ******* FATAL ERROR - ERROR-EXIT TAKEN ON VALID CALL *',+     $      '******' )+*+*     End of DCHK4.+*+      END+      SUBROUTINE DCHK5( SNAME, EPS, THRESH, NOUT, NTRA, TRACE, REWI,+     $                  FATAL, NIDIM, IDIM, NALF, ALF, NINC, INC, NMAX,+     $                  INCMAX, A, AA, AS, X, XX, XS, Y, YY, YS, YT, G,+     $                  Z )+*+*  Tests DSYR and DSPR.+*+*  Auxiliary routine for test program for Level 2 Blas.+*+*  -- Written on 10-August-1987.+*     Richard Hanson, Sandia National Labs.+*     Jeremy Du Croz, NAG Central Office.+*+*     .. Parameters ..+      DOUBLE PRECISION   ZERO, HALF, ONE+      PARAMETER          ( ZERO = 0.0D0, HALF = 0.5D0, ONE = 1.0D0 )+*     .. Scalar Arguments ..+      DOUBLE PRECISION   EPS, THRESH+      INTEGER            INCMAX, NALF, NIDIM, NINC, NMAX, NOUT, NTRA+      LOGICAL            FATAL, REWI, TRACE+      CHARACTER*6        SNAME+*     .. Array Arguments ..+      DOUBLE PRECISION   A( NMAX, NMAX ), AA( NMAX*NMAX ), ALF( NALF ),+     $                   AS( NMAX*NMAX ), G( NMAX ), X( NMAX ),+     $                   XS( NMAX*INCMAX ), XX( NMAX*INCMAX ),+     $                   Y( NMAX ), YS( NMAX*INCMAX ), YT( NMAX ),+     $                   YY( NMAX*INCMAX ), Z( NMAX )+      INTEGER            IDIM( NIDIM ), INC( NINC )+*     .. Local Scalars ..+      DOUBLE PRECISION   ALPHA, ALS, ERR, ERRMAX, TRANSL+      INTEGER            I, IA, IC, IN, INCX, INCXS, IX, J, JA, JJ, LAA,+     $                   LDA, LDAS, LJ, LX, N, NARGS, NC, NS+      LOGICAL            FULL, NULL, PACKED, RESET, SAME, UPPER+      CHARACTER*1        UPLO, UPLOS+      CHARACTER*2        ICH+*     .. Local Arrays ..+      DOUBLE PRECISION   W( 1 )+      LOGICAL            ISAME( 13 )+*     .. External Functions ..+      LOGICAL            LDE, LDERES+      EXTERNAL           LDE, LDERES+*     .. External Subroutines ..+      EXTERNAL           DMAKE, DMVCH, DSPR, DSYR+*     .. Intrinsic Functions ..+      INTRINSIC          ABS, MAX+*     .. Scalars in Common ..+      INTEGER            INFOT, NOUTC+      LOGICAL            LERR, OK+*     .. Common blocks ..+      COMMON             /INFOC/INFOT, NOUTC, OK, LERR+*     .. Data statements ..+      DATA               ICH/'UL'/+*     .. Executable Statements ..+      FULL = SNAME( 3: 3 ).EQ.'Y'+      PACKED = SNAME( 3: 3 ).EQ.'P'+*     Define the number of arguments.+      IF( FULL )THEN+         NARGS = 7+      ELSE IF( PACKED )THEN+         NARGS = 6+      END IF+*+      NC = 0+      RESET = .TRUE.+      ERRMAX = ZERO+*+      DO 100 IN = 1, NIDIM+         N = IDIM( IN )+*        Set LDA to 1 more than minimum value if room.+         LDA = N+         IF( LDA.LT.NMAX )+     $      LDA = LDA + 1+*        Skip tests if not enough room.+         IF( LDA.GT.NMAX )+     $      GO TO 100+         IF( PACKED )THEN+            LAA = ( N*( N + 1 ) )/2+         ELSE+            LAA = LDA*N+         END IF+*+         DO 90 IC = 1, 2+            UPLO = ICH( IC: IC )+            UPPER = UPLO.EQ.'U'+*+            DO 80 IX = 1, NINC+               INCX = INC( IX )+               LX = ABS( INCX )*N+*+*              Generate the vector X.+*+               TRANSL = HALF+               CALL DMAKE( 'GE', ' ', ' ', 1, N, X, 1, XX, ABS( INCX ),+     $                     0, N - 1, RESET, TRANSL )+               IF( N.GT.1 )THEN+                  X( N/2 ) = ZERO+                  XX( 1 + ABS( INCX )*( N/2 - 1 ) ) = ZERO+               END IF+*+               DO 70 IA = 1, NALF+                  ALPHA = ALF( IA )+                  NULL = N.LE.0.OR.ALPHA.EQ.ZERO+*+*                 Generate the matrix A.+*+                  TRANSL = ZERO+                  CALL DMAKE( SNAME( 2: 3 ), UPLO, ' ', N, N, A, NMAX,+     $                        AA, LDA, N - 1, N - 1, RESET, TRANSL )+*+                  NC = NC + 1+*+*                 Save every datum before calling the subroutine.+*+                  UPLOS = UPLO+                  NS = N+                  ALS = ALPHA+                  DO 10 I = 1, LAA+                     AS( I ) = AA( I )+   10             CONTINUE+                  LDAS = LDA+                  DO 20 I = 1, LX+                     XS( I ) = XX( I )+   20             CONTINUE+                  INCXS = INCX+*+*                 Call the subroutine.+*+                  IF( FULL )THEN+                     IF( TRACE )+     $                  WRITE( NTRA, FMT = 9993 )NC, SNAME, UPLO, N,+     $                  ALPHA, INCX, LDA+                     IF( REWI )+     $                  REWIND NTRA+                     CALL DSYR( UPLO, N, ALPHA, XX, INCX, AA, LDA )+                  ELSE IF( PACKED )THEN+                     IF( TRACE )+     $                  WRITE( NTRA, FMT = 9994 )NC, SNAME, UPLO, N,+     $                  ALPHA, INCX+                     IF( REWI )+     $                  REWIND NTRA+                     CALL DSPR( UPLO, N, ALPHA, XX, INCX, AA )+                  END IF+*+*                 Check if error-exit was taken incorrectly.+*+                  IF( .NOT.OK )THEN+                     WRITE( NOUT, FMT = 9992 )+                     FATAL = .TRUE.+                     GO TO 120+                  END IF+*+*                 See what data changed inside subroutines.+*+                  ISAME( 1 ) = UPLO.EQ.UPLOS+                  ISAME( 2 ) = NS.EQ.N+                  ISAME( 3 ) = ALS.EQ.ALPHA+                  ISAME( 4 ) = LDE( XS, XX, LX )+                  ISAME( 5 ) = INCXS.EQ.INCX+                  IF( NULL )THEN+                     ISAME( 6 ) = LDE( AS, AA, LAA )+                  ELSE+                     ISAME( 6 ) = LDERES( SNAME( 2: 3 ), UPLO, N, N, AS,+     $                            AA, LDA )+                  END IF+                  IF( .NOT.PACKED )THEN+                     ISAME( 7 ) = LDAS.EQ.LDA+                  END IF+*+*                 If data was incorrectly changed, report and return.+*+                  SAME = .TRUE.+                  DO 30 I = 1, NARGS+                     SAME = SAME.AND.ISAME( I )+                     IF( .NOT.ISAME( I ) )+     $                  WRITE( NOUT, FMT = 9998 )I+   30             CONTINUE+                  IF( .NOT.SAME )THEN+                     FATAL = .TRUE.+                     GO TO 120+                  END IF+*+                  IF( .NOT.NULL )THEN+*+*                    Check the result column by column.+*+                     IF( INCX.GT.0 )THEN+                        DO 40 I = 1, N+                           Z( I ) = X( I )+   40                   CONTINUE+                     ELSE+                        DO 50 I = 1, N+                           Z( I ) = X( N - I + 1 )+   50                   CONTINUE+                     END IF+                     JA = 1+                     DO 60 J = 1, N+                        W( 1 ) = Z( J )+                        IF( UPPER )THEN+                           JJ = 1+                           LJ = J+                        ELSE+                           JJ = J+                           LJ = N - J + 1+                        END IF+                        CALL DMVCH( 'N', LJ, 1, ALPHA, Z( JJ ), LJ, W,+     $                              1, ONE, A( JJ, J ), 1, YT, G,+     $                              AA( JA ), EPS, ERR, FATAL, NOUT,+     $                              .TRUE. )+                        IF( FULL )THEN+                           IF( UPPER )THEN+                              JA = JA + LDA+                           ELSE+                              JA = JA + LDA + 1+                           END IF+                        ELSE+                           JA = JA + LJ+                        END IF+                        ERRMAX = MAX( ERRMAX, ERR )+*                       If got really bad answer, report and return.+                        IF( FATAL )+     $                     GO TO 110+   60                CONTINUE+                  ELSE+*                    Avoid repeating tests if N.le.0.+                     IF( N.LE.0 )+     $                  GO TO 100+                  END IF+*+   70          CONTINUE+*+   80       CONTINUE+*+   90    CONTINUE+*+  100 CONTINUE+*+*     Report result.+*+      IF( ERRMAX.LT.THRESH )THEN+         WRITE( NOUT, FMT = 9999 )SNAME, NC+      ELSE+         WRITE( NOUT, FMT = 9997 )SNAME, NC, ERRMAX+      END IF+      GO TO 130+*+  110 CONTINUE+      WRITE( NOUT, FMT = 9995 )J+*+  120 CONTINUE+      WRITE( NOUT, FMT = 9996 )SNAME+      IF( FULL )THEN+         WRITE( NOUT, FMT = 9993 )NC, SNAME, UPLO, N, ALPHA, INCX, LDA+      ELSE IF( PACKED )THEN+         WRITE( NOUT, FMT = 9994 )NC, SNAME, UPLO, N, ALPHA, INCX+      END IF+*+  130 CONTINUE+      RETURN+*+ 9999 FORMAT( ' ', A6, ' PASSED THE COMPUTATIONAL TESTS (', I6, ' CALL',+     $      'S)' )+ 9998 FORMAT( ' ******* FATAL ERROR - PARAMETER NUMBER ', I2, ' WAS CH',+     $      'ANGED INCORRECTLY *******' )+ 9997 FORMAT( ' ', A6, ' COMPLETED THE COMPUTATIONAL TESTS (', I6, ' C',+     $      'ALLS)', /' ******* BUT WITH MAXIMUM TEST RATIO', F8.2,+     $      ' - SUSPECT *******' )+ 9996 FORMAT( ' ******* ', A6, ' FAILED ON CALL NUMBER:' )+ 9995 FORMAT( '      THESE ARE THE RESULTS FOR COLUMN ', I3 )+ 9994 FORMAT( 1X, I6, ': ', A6, '(''', A1, ''',', I3, ',', F4.1, ', X,',+     $      I2, ', AP)                           .' )+ 9993 FORMAT( 1X, I6, ': ', A6, '(''', A1, ''',', I3, ',', F4.1, ', X,',+     $      I2, ', A,', I3, ')                        .' )+ 9992 FORMAT( ' ******* FATAL ERROR - ERROR-EXIT TAKEN ON VALID CALL *',+     $      '******' )+*+*     End of DCHK5.+*+      END+      SUBROUTINE DCHK6( SNAME, EPS, THRESH, NOUT, NTRA, TRACE, REWI,+     $                  FATAL, NIDIM, IDIM, NALF, ALF, NINC, INC, NMAX,+     $                  INCMAX, A, AA, AS, X, XX, XS, Y, YY, YS, YT, G,+     $                  Z )+*+*  Tests DSYR2 and DSPR2.+*+*  Auxiliary routine for test program for Level 2 Blas.+*+*  -- Written on 10-August-1987.+*     Richard Hanson, Sandia National Labs.+*     Jeremy Du Croz, NAG Central Office.+*+*     .. Parameters ..+      DOUBLE PRECISION   ZERO, HALF, ONE+      PARAMETER          ( ZERO = 0.0D0, HALF = 0.5D0, ONE = 1.0D0 )+*     .. Scalar Arguments ..+      DOUBLE PRECISION   EPS, THRESH+      INTEGER            INCMAX, NALF, NIDIM, NINC, NMAX, NOUT, NTRA+      LOGICAL            FATAL, REWI, TRACE+      CHARACTER*6        SNAME+*     .. Array Arguments ..+      DOUBLE PRECISION   A( NMAX, NMAX ), AA( NMAX*NMAX ), ALF( NALF ),+     $                   AS( NMAX*NMAX ), G( NMAX ), X( NMAX ),+     $                   XS( NMAX*INCMAX ), XX( NMAX*INCMAX ),+     $                   Y( NMAX ), YS( NMAX*INCMAX ), YT( NMAX ),+     $                   YY( NMAX*INCMAX ), Z( NMAX, 2 )+      INTEGER            IDIM( NIDIM ), INC( NINC )+*     .. Local Scalars ..+      DOUBLE PRECISION   ALPHA, ALS, ERR, ERRMAX, TRANSL+      INTEGER            I, IA, IC, IN, INCX, INCXS, INCY, INCYS, IX,+     $                   IY, J, JA, JJ, LAA, LDA, LDAS, LJ, LX, LY, N,+     $                   NARGS, NC, NS+      LOGICAL            FULL, NULL, PACKED, RESET, SAME, UPPER+      CHARACTER*1        UPLO, UPLOS+      CHARACTER*2        ICH+*     .. Local Arrays ..+      DOUBLE PRECISION   W( 2 )+      LOGICAL            ISAME( 13 )+*     .. External Functions ..+      LOGICAL            LDE, LDERES+      EXTERNAL           LDE, LDERES+*     .. External Subroutines ..+      EXTERNAL           DMAKE, DMVCH, DSPR2, DSYR2+*     .. Intrinsic Functions ..+      INTRINSIC          ABS, MAX+*     .. Scalars in Common ..+      INTEGER            INFOT, NOUTC+      LOGICAL            LERR, OK+*     .. Common blocks ..+      COMMON             /INFOC/INFOT, NOUTC, OK, LERR+*     .. Data statements ..+      DATA               ICH/'UL'/+*     .. Executable Statements ..+      FULL = SNAME( 3: 3 ).EQ.'Y'+      PACKED = SNAME( 3: 3 ).EQ.'P'+*     Define the number of arguments.+      IF( FULL )THEN+         NARGS = 9+      ELSE IF( PACKED )THEN+         NARGS = 8+      END IF+*+      NC = 0+      RESET = .TRUE.+      ERRMAX = ZERO+*+      DO 140 IN = 1, NIDIM+         N = IDIM( IN )+*        Set LDA to 1 more than minimum value if room.+         LDA = N+         IF( LDA.LT.NMAX )+     $      LDA = LDA + 1+*        Skip tests if not enough room.+         IF( LDA.GT.NMAX )+     $      GO TO 140+         IF( PACKED )THEN+            LAA = ( N*( N + 1 ) )/2+         ELSE+            LAA = LDA*N+         END IF+*+         DO 130 IC = 1, 2+            UPLO = ICH( IC: IC )+            UPPER = UPLO.EQ.'U'+*+            DO 120 IX = 1, NINC+               INCX = INC( IX )+               LX = ABS( INCX )*N+*+*              Generate the vector X.+*+               TRANSL = HALF+               CALL DMAKE( 'GE', ' ', ' ', 1, N, X, 1, XX, ABS( INCX ),+     $                     0, N - 1, RESET, TRANSL )+               IF( N.GT.1 )THEN+                  X( N/2 ) = ZERO+                  XX( 1 + ABS( INCX )*( N/2 - 1 ) ) = ZERO+               END IF+*+               DO 110 IY = 1, NINC+                  INCY = INC( IY )+                  LY = ABS( INCY )*N+*+*                 Generate the vector Y.+*+                  TRANSL = ZERO+                  CALL DMAKE( 'GE', ' ', ' ', 1, N, Y, 1, YY,+     $                        ABS( INCY ), 0, N - 1, RESET, TRANSL )+                  IF( N.GT.1 )THEN+                     Y( N/2 ) = ZERO+                     YY( 1 + ABS( INCY )*( N/2 - 1 ) ) = ZERO+                  END IF+*+                  DO 100 IA = 1, NALF+                     ALPHA = ALF( IA )+                     NULL = N.LE.0.OR.ALPHA.EQ.ZERO+*+*                    Generate the matrix A.+*+                     TRANSL = ZERO+                     CALL DMAKE( SNAME( 2: 3 ), UPLO, ' ', N, N, A,+     $                           NMAX, AA, LDA, N - 1, N - 1, RESET,+     $                           TRANSL )+*+                     NC = NC + 1+*+*                    Save every datum before calling the subroutine.+*+                     UPLOS = UPLO+                     NS = N+                     ALS = ALPHA+                     DO 10 I = 1, LAA+                        AS( I ) = AA( I )+   10                CONTINUE+                     LDAS = LDA+                     DO 20 I = 1, LX+                        XS( I ) = XX( I )+   20                CONTINUE+                     INCXS = INCX+                     DO 30 I = 1, LY+                        YS( I ) = YY( I )+   30                CONTINUE+                     INCYS = INCY+*+*                    Call the subroutine.+*+                     IF( FULL )THEN+                        IF( TRACE )+     $                     WRITE( NTRA, FMT = 9993 )NC, SNAME, UPLO, N,+     $                     ALPHA, INCX, INCY, LDA+                        IF( REWI )+     $                     REWIND NTRA+                        CALL DSYR2( UPLO, N, ALPHA, XX, INCX, YY, INCY,+     $                              AA, LDA )+                     ELSE IF( PACKED )THEN+                        IF( TRACE )+     $                     WRITE( NTRA, FMT = 9994 )NC, SNAME, UPLO, N,+     $                     ALPHA, INCX, INCY+                        IF( REWI )+     $                     REWIND NTRA+                        CALL DSPR2( UPLO, N, ALPHA, XX, INCX, YY, INCY,+     $                              AA )+                     END IF+*+*                    Check if error-exit was taken incorrectly.+*+                     IF( .NOT.OK )THEN+                        WRITE( NOUT, FMT = 9992 )+                        FATAL = .TRUE.+                        GO TO 160+                     END IF+*+*                    See what data changed inside subroutines.+*+                     ISAME( 1 ) = UPLO.EQ.UPLOS+                     ISAME( 2 ) = NS.EQ.N+                     ISAME( 3 ) = ALS.EQ.ALPHA+                     ISAME( 4 ) = LDE( XS, XX, LX )+                     ISAME( 5 ) = INCXS.EQ.INCX+                     ISAME( 6 ) = LDE( YS, YY, LY )+                     ISAME( 7 ) = INCYS.EQ.INCY+                     IF( NULL )THEN+                        ISAME( 8 ) = LDE( AS, AA, LAA )+                     ELSE+                        ISAME( 8 ) = LDERES( SNAME( 2: 3 ), UPLO, N, N,+     $                               AS, AA, LDA )+                     END IF+                     IF( .NOT.PACKED )THEN+                        ISAME( 9 ) = LDAS.EQ.LDA+                     END IF+*+*                    If data was incorrectly changed, report and return.+*+                     SAME = .TRUE.+                     DO 40 I = 1, NARGS+                        SAME = SAME.AND.ISAME( I )+                        IF( .NOT.ISAME( I ) )+     $                     WRITE( NOUT, FMT = 9998 )I+   40                CONTINUE+                     IF( .NOT.SAME )THEN+                        FATAL = .TRUE.+                        GO TO 160+                     END IF+*+                     IF( .NOT.NULL )THEN+*+*                       Check the result column by column.+*+                        IF( INCX.GT.0 )THEN+                           DO 50 I = 1, N+                              Z( I, 1 ) = X( I )+   50                      CONTINUE+                        ELSE+                           DO 60 I = 1, N+                              Z( I, 1 ) = X( N - I + 1 )+   60                      CONTINUE+                        END IF+                        IF( INCY.GT.0 )THEN+                           DO 70 I = 1, N+                              Z( I, 2 ) = Y( I )+   70                      CONTINUE+                        ELSE+                           DO 80 I = 1, N+                              Z( I, 2 ) = Y( N - I + 1 )+   80                      CONTINUE+                        END IF+                        JA = 1+                        DO 90 J = 1, N+                           W( 1 ) = Z( J, 2 )+                           W( 2 ) = Z( J, 1 )+                           IF( UPPER )THEN+                              JJ = 1+                              LJ = J+                           ELSE+                              JJ = J+                              LJ = N - J + 1+                           END IF+                           CALL DMVCH( 'N', LJ, 2, ALPHA, Z( JJ, 1 ),+     $                                 NMAX, W, 1, ONE, A( JJ, J ), 1,+     $                                 YT, G, AA( JA ), EPS, ERR, FATAL,+     $                                 NOUT, .TRUE. )+                           IF( FULL )THEN+                              IF( UPPER )THEN+                                 JA = JA + LDA+                              ELSE+                                 JA = JA + LDA + 1+                              END IF+                           ELSE+                              JA = JA + LJ+                           END IF+                           ERRMAX = MAX( ERRMAX, ERR )+*                          If got really bad answer, report and return.+                           IF( FATAL )+     $                        GO TO 150+   90                   CONTINUE+                     ELSE+*                       Avoid repeating tests with N.le.0.+                        IF( N.LE.0 )+     $                     GO TO 140+                     END IF+*+  100             CONTINUE+*+  110          CONTINUE+*+  120       CONTINUE+*+  130    CONTINUE+*+  140 CONTINUE+*+*     Report result.+*+      IF( ERRMAX.LT.THRESH )THEN+         WRITE( NOUT, FMT = 9999 )SNAME, NC+      ELSE+         WRITE( NOUT, FMT = 9997 )SNAME, NC, ERRMAX+      END IF+      GO TO 170+*+  150 CONTINUE+      WRITE( NOUT, FMT = 9995 )J+*+  160 CONTINUE+      WRITE( NOUT, FMT = 9996 )SNAME+      IF( FULL )THEN+         WRITE( NOUT, FMT = 9993 )NC, SNAME, UPLO, N, ALPHA, INCX,+     $      INCY, LDA+      ELSE IF( PACKED )THEN+         WRITE( NOUT, FMT = 9994 )NC, SNAME, UPLO, N, ALPHA, INCX, INCY+      END IF+*+  170 CONTINUE+      RETURN+*+ 9999 FORMAT( ' ', A6, ' PASSED THE COMPUTATIONAL TESTS (', I6, ' CALL',+     $      'S)' )+ 9998 FORMAT( ' ******* FATAL ERROR - PARAMETER NUMBER ', I2, ' WAS CH',+     $      'ANGED INCORRECTLY *******' )+ 9997 FORMAT( ' ', A6, ' COMPLETED THE COMPUTATIONAL TESTS (', I6, ' C',+     $      'ALLS)', /' ******* BUT WITH MAXIMUM TEST RATIO', F8.2,+     $      ' - SUSPECT *******' )+ 9996 FORMAT( ' ******* ', A6, ' FAILED ON CALL NUMBER:' )+ 9995 FORMAT( '      THESE ARE THE RESULTS FOR COLUMN ', I3 )+ 9994 FORMAT( 1X, I6, ': ', A6, '(''', A1, ''',', I3, ',', F4.1, ', X,',+     $      I2, ', Y,', I2, ', AP)                     .' )+ 9993 FORMAT( 1X, I6, ': ', A6, '(''', A1, ''',', I3, ',', F4.1, ', X,',+     $      I2, ', Y,', I2, ', A,', I3, ')                  .' )+ 9992 FORMAT( ' ******* FATAL ERROR - ERROR-EXIT TAKEN ON VALID CALL *',+     $      '******' )+*+*     End of DCHK6.+*+      END+      SUBROUTINE DCHKE( ISNUM, SRNAMT, NOUT )+*+*  Tests the error exits from the Level 2 Blas.+*  Requires a special version of the error-handling routine XERBLA.+*  ALPHA, BETA, A, X and Y should not need to be defined.+*+*  Auxiliary routine for test program for Level 2 Blas.+*+*  -- Written on 10-August-1987.+*     Richard Hanson, Sandia National Labs.+*     Jeremy Du Croz, NAG Central Office.+*+*     .. Scalar Arguments ..+      INTEGER            ISNUM, NOUT+      CHARACTER*6        SRNAMT+*     .. Scalars in Common ..+      INTEGER            INFOT, NOUTC+      LOGICAL            LERR, OK+*     .. Local Scalars ..+      DOUBLE PRECISION   ALPHA, BETA+*     .. Local Arrays ..+      DOUBLE PRECISION   A( 1, 1 ), X( 1 ), Y( 1 )+*     .. External Subroutines ..+      EXTERNAL           CHKXER, DGBMV, DGEMV, DGER, DSBMV, DSPMV, DSPR,+     $                   DSPR2, DSYMV, DSYR, DSYR2, DTBMV, DTBSV, DTPMV,+     $                   DTPSV, DTRMV, DTRSV+*     .. Common blocks ..+      COMMON             /INFOC/INFOT, NOUTC, OK, LERR+*     .. Executable Statements ..+*     OK is set to .FALSE. by the special version of XERBLA or by CHKXER+*     if anything is wrong.+      OK = .TRUE.+*     LERR is set to .TRUE. by the special version of XERBLA each time+*     it is called, and is then tested and re-set by CHKXER.+      LERR = .FALSE.+      GO TO ( 10, 20, 30, 40, 50, 60, 70, 80,+     $        90, 100, 110, 120, 130, 140, 150,+     $        160 )ISNUM+   10 INFOT = 1+      CALL DGEMV( '/', 0, 0, ALPHA, A, 1, X, 1, BETA, Y, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 2+      CALL DGEMV( 'N', -1, 0, ALPHA, A, 1, X, 1, BETA, Y, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 3+      CALL DGEMV( 'N', 0, -1, ALPHA, A, 1, X, 1, BETA, Y, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 6+      CALL DGEMV( 'N', 2, 0, ALPHA, A, 1, X, 1, BETA, Y, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 8+      CALL DGEMV( 'N', 0, 0, ALPHA, A, 1, X, 0, BETA, Y, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 11+      CALL DGEMV( 'N', 0, 0, ALPHA, A, 1, X, 1, BETA, Y, 0 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      GO TO 170+   20 INFOT = 1+      CALL DGBMV( '/', 0, 0, 0, 0, ALPHA, A, 1, X, 1, BETA, Y, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 2+      CALL DGBMV( 'N', -1, 0, 0, 0, ALPHA, A, 1, X, 1, BETA, Y, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 3+      CALL DGBMV( 'N', 0, -1, 0, 0, ALPHA, A, 1, X, 1, BETA, Y, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 4+      CALL DGBMV( 'N', 0, 0, -1, 0, ALPHA, A, 1, X, 1, BETA, Y, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 5+      CALL DGBMV( 'N', 2, 0, 0, -1, ALPHA, A, 1, X, 1, BETA, Y, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 8+      CALL DGBMV( 'N', 0, 0, 1, 0, ALPHA, A, 1, X, 1, BETA, Y, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 10+      CALL DGBMV( 'N', 0, 0, 0, 0, ALPHA, A, 1, X, 0, BETA, Y, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 13+      CALL DGBMV( 'N', 0, 0, 0, 0, ALPHA, A, 1, X, 1, BETA, Y, 0 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      GO TO 170+   30 INFOT = 1+      CALL DSYMV( '/', 0, ALPHA, A, 1, X, 1, BETA, Y, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 2+      CALL DSYMV( 'U', -1, ALPHA, A, 1, X, 1, BETA, Y, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 5+      CALL DSYMV( 'U', 2, ALPHA, A, 1, X, 1, BETA, Y, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 7+      CALL DSYMV( 'U', 0, ALPHA, A, 1, X, 0, BETA, Y, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 10+      CALL DSYMV( 'U', 0, ALPHA, A, 1, X, 1, BETA, Y, 0 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      GO TO 170+   40 INFOT = 1+      CALL DSBMV( '/', 0, 0, ALPHA, A, 1, X, 1, BETA, Y, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 2+      CALL DSBMV( 'U', -1, 0, ALPHA, A, 1, X, 1, BETA, Y, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 3+      CALL DSBMV( 'U', 0, -1, ALPHA, A, 1, X, 1, BETA, Y, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 6+      CALL DSBMV( 'U', 0, 1, ALPHA, A, 1, X, 1, BETA, Y, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 8+      CALL DSBMV( 'U', 0, 0, ALPHA, A, 1, X, 0, BETA, Y, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 11+      CALL DSBMV( 'U', 0, 0, ALPHA, A, 1, X, 1, BETA, Y, 0 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      GO TO 170+   50 INFOT = 1+      CALL DSPMV( '/', 0, ALPHA, A, X, 1, BETA, Y, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 2+      CALL DSPMV( 'U', -1, ALPHA, A, X, 1, BETA, Y, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 6+      CALL DSPMV( 'U', 0, ALPHA, A, X, 0, BETA, Y, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 9+      CALL DSPMV( 'U', 0, ALPHA, A, X, 1, BETA, Y, 0 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      GO TO 170+   60 INFOT = 1+      CALL DTRMV( '/', 'N', 'N', 0, A, 1, X, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 2+      CALL DTRMV( 'U', '/', 'N', 0, A, 1, X, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 3+      CALL DTRMV( 'U', 'N', '/', 0, A, 1, X, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 4+      CALL DTRMV( 'U', 'N', 'N', -1, A, 1, X, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 6+      CALL DTRMV( 'U', 'N', 'N', 2, A, 1, X, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 8+      CALL DTRMV( 'U', 'N', 'N', 0, A, 1, X, 0 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      GO TO 170+   70 INFOT = 1+      CALL DTBMV( '/', 'N', 'N', 0, 0, A, 1, X, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 2+      CALL DTBMV( 'U', '/', 'N', 0, 0, A, 1, X, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 3+      CALL DTBMV( 'U', 'N', '/', 0, 0, A, 1, X, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 4+      CALL DTBMV( 'U', 'N', 'N', -1, 0, A, 1, X, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 5+      CALL DTBMV( 'U', 'N', 'N', 0, -1, A, 1, X, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 7+      CALL DTBMV( 'U', 'N', 'N', 0, 1, A, 1, X, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 9+      CALL DTBMV( 'U', 'N', 'N', 0, 0, A, 1, X, 0 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      GO TO 170+   80 INFOT = 1+      CALL DTPMV( '/', 'N', 'N', 0, A, X, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 2+      CALL DTPMV( 'U', '/', 'N', 0, A, X, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 3+      CALL DTPMV( 'U', 'N', '/', 0, A, X, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 4+      CALL DTPMV( 'U', 'N', 'N', -1, A, X, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 7+      CALL DTPMV( 'U', 'N', 'N', 0, A, X, 0 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      GO TO 170+   90 INFOT = 1+      CALL DTRSV( '/', 'N', 'N', 0, A, 1, X, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 2+      CALL DTRSV( 'U', '/', 'N', 0, A, 1, X, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 3+      CALL DTRSV( 'U', 'N', '/', 0, A, 1, X, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 4+      CALL DTRSV( 'U', 'N', 'N', -1, A, 1, X, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 6+      CALL DTRSV( 'U', 'N', 'N', 2, A, 1, X, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 8+      CALL DTRSV( 'U', 'N', 'N', 0, A, 1, X, 0 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      GO TO 170+  100 INFOT = 1+      CALL DTBSV( '/', 'N', 'N', 0, 0, A, 1, X, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 2+      CALL DTBSV( 'U', '/', 'N', 0, 0, A, 1, X, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 3+      CALL DTBSV( 'U', 'N', '/', 0, 0, A, 1, X, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 4+      CALL DTBSV( 'U', 'N', 'N', -1, 0, A, 1, X, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 5+      CALL DTBSV( 'U', 'N', 'N', 0, -1, A, 1, X, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 7+      CALL DTBSV( 'U', 'N', 'N', 0, 1, A, 1, X, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 9+      CALL DTBSV( 'U', 'N', 'N', 0, 0, A, 1, X, 0 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      GO TO 170+  110 INFOT = 1+      CALL DTPSV( '/', 'N', 'N', 0, A, X, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 2+      CALL DTPSV( 'U', '/', 'N', 0, A, X, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 3+      CALL DTPSV( 'U', 'N', '/', 0, A, X, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 4+      CALL DTPSV( 'U', 'N', 'N', -1, A, X, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 7+      CALL DTPSV( 'U', 'N', 'N', 0, A, X, 0 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      GO TO 170+  120 INFOT = 1+      CALL DGER( -1, 0, ALPHA, X, 1, Y, 1, A, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 2+      CALL DGER( 0, -1, ALPHA, X, 1, Y, 1, A, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 5+      CALL DGER( 0, 0, ALPHA, X, 0, Y, 1, A, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 7+      CALL DGER( 0, 0, ALPHA, X, 1, Y, 0, A, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 9+      CALL DGER( 2, 0, ALPHA, X, 1, Y, 1, A, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      GO TO 170+  130 INFOT = 1+      CALL DSYR( '/', 0, ALPHA, X, 1, A, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 2+      CALL DSYR( 'U', -1, ALPHA, X, 1, A, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 5+      CALL DSYR( 'U', 0, ALPHA, X, 0, A, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 7+      CALL DSYR( 'U', 2, ALPHA, X, 1, A, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      GO TO 170+  140 INFOT = 1+      CALL DSPR( '/', 0, ALPHA, X, 1, A )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 2+      CALL DSPR( 'U', -1, ALPHA, X, 1, A )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 5+      CALL DSPR( 'U', 0, ALPHA, X, 0, A )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      GO TO 170+  150 INFOT = 1+      CALL DSYR2( '/', 0, ALPHA, X, 1, Y, 1, A, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 2+      CALL DSYR2( 'U', -1, ALPHA, X, 1, Y, 1, A, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 5+      CALL DSYR2( 'U', 0, ALPHA, X, 0, Y, 1, A, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 7+      CALL DSYR2( 'U', 0, ALPHA, X, 1, Y, 0, A, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 9+      CALL DSYR2( 'U', 2, ALPHA, X, 1, Y, 1, A, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      GO TO 170+  160 INFOT = 1+      CALL DSPR2( '/', 0, ALPHA, X, 1, Y, 1, A )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 2+      CALL DSPR2( 'U', -1, ALPHA, X, 1, Y, 1, A )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 5+      CALL DSPR2( 'U', 0, ALPHA, X, 0, Y, 1, A )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 7+      CALL DSPR2( 'U', 0, ALPHA, X, 1, Y, 0, A )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+*+  170 IF( OK )THEN+         WRITE( NOUT, FMT = 9999 )SRNAMT+      ELSE+         WRITE( NOUT, FMT = 9998 )SRNAMT+      END IF+      RETURN+*+ 9999 FORMAT( ' ', A6, ' PASSED THE TESTS OF ERROR-EXITS' )+ 9998 FORMAT( ' ******* ', A6, ' FAILED THE TESTS OF ERROR-EXITS *****',+     $      '**' )+*+*     End of DCHKE.+*+      END+      SUBROUTINE DMAKE( TYPE, UPLO, DIAG, M, N, A, NMAX, AA, LDA, KL,+     $                  KU, RESET, TRANSL )+*+*  Generates values for an M by N matrix A within the bandwidth+*  defined by KL and KU.+*  Stores the values in the array AA in the data structure required+*  by the routine, with unwanted elements set to rogue value.+*+*  TYPE is 'GE', 'GB', 'SY', 'SB', 'SP', 'TR', 'TB' OR 'TP'.+*+*  Auxiliary routine for test program for Level 2 Blas.+*+*  -- Written on 10-August-1987.+*     Richard Hanson, Sandia National Labs.+*     Jeremy Du Croz, NAG Central Office.+*+*     .. Parameters ..+      DOUBLE PRECISION   ZERO, ONE+      PARAMETER          ( ZERO = 0.0D0, ONE = 1.0D0 )+      DOUBLE PRECISION   ROGUE+      PARAMETER          ( ROGUE = -1.0D10 )+*     .. Scalar Arguments ..+      DOUBLE PRECISION   TRANSL+      INTEGER            KL, KU, LDA, M, N, NMAX+      LOGICAL            RESET+      CHARACTER*1        DIAG, UPLO+      CHARACTER*2        TYPE+*     .. Array Arguments ..+      DOUBLE PRECISION   A( NMAX, * ), AA( * )+*     .. Local Scalars ..+      INTEGER            I, I1, I2, I3, IBEG, IEND, IOFF, J, KK+      LOGICAL            GEN, LOWER, SYM, TRI, UNIT, UPPER+*     .. External Functions ..+      DOUBLE PRECISION   DBEG+      EXTERNAL           DBEG+*     .. Intrinsic Functions ..+      INTRINSIC          MAX, MIN+*     .. Executable Statements ..+      GEN = TYPE( 1: 1 ).EQ.'G'+      SYM = TYPE( 1: 1 ).EQ.'S'+      TRI = TYPE( 1: 1 ).EQ.'T'+      UPPER = ( SYM.OR.TRI ).AND.UPLO.EQ.'U'+      LOWER = ( SYM.OR.TRI ).AND.UPLO.EQ.'L'+      UNIT = TRI.AND.DIAG.EQ.'U'+*+*     Generate data in array A.+*+      DO 20 J = 1, N+         DO 10 I = 1, M+            IF( GEN.OR.( UPPER.AND.I.LE.J ).OR.( LOWER.AND.I.GE.J ) )+     $          THEN+               IF( ( I.LE.J.AND.J - I.LE.KU ).OR.+     $             ( I.GE.J.AND.I - J.LE.KL ) )THEN+                  A( I, J ) = DBEG( RESET ) + TRANSL+               ELSE+                  A( I, J ) = ZERO+               END IF+               IF( I.NE.J )THEN+                  IF( SYM )THEN+                     A( J, I ) = A( I, J )+                  ELSE IF( TRI )THEN+                     A( J, I ) = ZERO+                  END IF+               END IF+            END IF+   10    CONTINUE+         IF( TRI )+     $      A( J, J ) = A( J, J ) + ONE+         IF( UNIT )+     $      A( J, J ) = ONE+   20 CONTINUE+*+*     Store elements in array AS in data structure required by routine.+*+      IF( TYPE.EQ.'GE' )THEN+         DO 50 J = 1, N+            DO 30 I = 1, M+               AA( I + ( J - 1 )*LDA ) = A( I, J )+   30       CONTINUE+            DO 40 I = M + 1, LDA+               AA( I + ( J - 1 )*LDA ) = ROGUE+   40       CONTINUE+   50    CONTINUE+      ELSE IF( TYPE.EQ.'GB' )THEN+         DO 90 J = 1, N+            DO 60 I1 = 1, KU + 1 - J+               AA( I1 + ( J - 1 )*LDA ) = ROGUE+   60       CONTINUE+            DO 70 I2 = I1, MIN( KL + KU + 1, KU + 1 + M - J )+               AA( I2 + ( J - 1 )*LDA ) = A( I2 + J - KU - 1, J )+   70       CONTINUE+            DO 80 I3 = I2, LDA+               AA( I3 + ( J - 1 )*LDA ) = ROGUE+   80       CONTINUE+   90    CONTINUE+      ELSE IF( TYPE.EQ.'SY'.OR.TYPE.EQ.'TR' )THEN+         DO 130 J = 1, N+            IF( UPPER )THEN+               IBEG = 1+               IF( UNIT )THEN+                  IEND = J - 1+               ELSE+                  IEND = J+               END IF+            ELSE+               IF( UNIT )THEN+                  IBEG = J + 1+               ELSE+                  IBEG = J+               END IF+               IEND = N+            END IF+            DO 100 I = 1, IBEG - 1+               AA( I + ( J - 1 )*LDA ) = ROGUE+  100       CONTINUE+            DO 110 I = IBEG, IEND+               AA( I + ( J - 1 )*LDA ) = A( I, J )+  110       CONTINUE+            DO 120 I = IEND + 1, LDA+               AA( I + ( J - 1 )*LDA ) = ROGUE+  120       CONTINUE+  130    CONTINUE+      ELSE IF( TYPE.EQ.'SB'.OR.TYPE.EQ.'TB' )THEN+         DO 170 J = 1, N+            IF( UPPER )THEN+               KK = KL + 1+               IBEG = MAX( 1, KL + 2 - J )+               IF( UNIT )THEN+                  IEND = KL+               ELSE+                  IEND = KL + 1+               END IF+            ELSE+               KK = 1+               IF( UNIT )THEN+                  IBEG = 2+               ELSE+                  IBEG = 1+               END IF+               IEND = MIN( KL + 1, 1 + M - J )+            END IF+            DO 140 I = 1, IBEG - 1+               AA( I + ( J - 1 )*LDA ) = ROGUE+  140       CONTINUE+            DO 150 I = IBEG, IEND+               AA( I + ( J - 1 )*LDA ) = A( I + J - KK, J )+  150       CONTINUE+            DO 160 I = IEND + 1, LDA+               AA( I + ( J - 1 )*LDA ) = ROGUE+  160       CONTINUE+  170    CONTINUE+      ELSE IF( TYPE.EQ.'SP'.OR.TYPE.EQ.'TP' )THEN+         IOFF = 0+         DO 190 J = 1, N+            IF( UPPER )THEN+               IBEG = 1+               IEND = J+            ELSE+               IBEG = J+               IEND = N+            END IF+            DO 180 I = IBEG, IEND+               IOFF = IOFF + 1+               AA( IOFF ) = A( I, J )+               IF( I.EQ.J )THEN+                  IF( UNIT )+     $               AA( IOFF ) = ROGUE+               END IF+  180       CONTINUE+  190    CONTINUE+      END IF+      RETURN+*+*     End of DMAKE.+*+      END+      SUBROUTINE DMVCH( TRANS, M, N, ALPHA, A, NMAX, X, INCX, BETA, Y,+     $                  INCY, YT, G, YY, EPS, ERR, FATAL, NOUT, MV )+*+*  Checks the results of the computational tests.+*+*  Auxiliary routine for test program for Level 2 Blas.+*+*  -- Written on 10-August-1987.+*     Richard Hanson, Sandia National Labs.+*     Jeremy Du Croz, NAG Central Office.+*+*     .. Parameters ..+      DOUBLE PRECISION   ZERO, ONE+      PARAMETER          ( ZERO = 0.0D0, ONE = 1.0D0 )+*     .. Scalar Arguments ..+      DOUBLE PRECISION   ALPHA, BETA, EPS, ERR+      INTEGER            INCX, INCY, M, N, NMAX, NOUT+      LOGICAL            FATAL, MV+      CHARACTER*1        TRANS+*     .. Array Arguments ..+      DOUBLE PRECISION   A( NMAX, * ), G( * ), X( * ), Y( * ), YT( * ),+     $                   YY( * )+*     .. Local Scalars ..+      DOUBLE PRECISION   ERRI+      INTEGER            I, INCXL, INCYL, IY, J, JX, KX, KY, ML, NL+      LOGICAL            TRAN+*     .. Intrinsic Functions ..+      INTRINSIC          ABS, MAX, SQRT+*     .. Executable Statements ..+      TRAN = TRANS.EQ.'T'.OR.TRANS.EQ.'C'+      IF( TRAN )THEN+         ML = N+         NL = M+      ELSE+         ML = M+         NL = N+      END IF+      IF( INCX.LT.0 )THEN+         KX = NL+         INCXL = -1+      ELSE+         KX = 1+         INCXL = 1+      END IF+      IF( INCY.LT.0 )THEN+         KY = ML+         INCYL = -1+      ELSE+         KY = 1+         INCYL = 1+      END IF+*+*     Compute expected result in YT using data in A, X and Y.+*     Compute gauges in G.+*+      IY = KY+      DO 30 I = 1, ML+         YT( IY ) = ZERO+         G( IY ) = ZERO+         JX = KX+         IF( TRAN )THEN+            DO 10 J = 1, NL+               YT( IY ) = YT( IY ) + A( J, I )*X( JX )+               G( IY ) = G( IY ) + ABS( A( J, I )*X( JX ) )+               JX = JX + INCXL+   10       CONTINUE+         ELSE+            DO 20 J = 1, NL+               YT( IY ) = YT( IY ) + A( I, J )*X( JX )+               G( IY ) = G( IY ) + ABS( A( I, J )*X( JX ) )+               JX = JX + INCXL+   20       CONTINUE+         END IF+         YT( IY ) = ALPHA*YT( IY ) + BETA*Y( IY )+         G( IY ) = ABS( ALPHA )*G( IY ) + ABS( BETA*Y( IY ) )+         IY = IY + INCYL+   30 CONTINUE+*+*     Compute the error ratio for this result.+*+      ERR = ZERO+      DO 40 I = 1, ML+         ERRI = ABS( YT( I ) - YY( 1 + ( I - 1 )*ABS( INCY ) ) )/EPS+         IF( G( I ).NE.ZERO )+     $      ERRI = ERRI/G( I )+         ERR = MAX( ERR, ERRI )+         IF( ERR*SQRT( EPS ).GE.ONE )+     $      GO TO 50+   40 CONTINUE+*     If the loop completes, all results are at least half accurate.+      GO TO 70+*+*     Report fatal error.+*+   50 FATAL = .TRUE.+      WRITE( NOUT, FMT = 9999 )+      DO 60 I = 1, ML+         IF( MV )THEN+            WRITE( NOUT, FMT = 9998 )I, YT( I ),+     $         YY( 1 + ( I - 1 )*ABS( INCY ) )+         ELSE+            WRITE( NOUT, FMT = 9998 )I,+     $         YY( 1 + ( I - 1 )*ABS( INCY ) ), YT( I )+         END IF+   60 CONTINUE+*+   70 CONTINUE+      RETURN+*+ 9999 FORMAT( ' ******* FATAL ERROR - COMPUTED RESULT IS LESS THAN HAL',+     $      'F ACCURATE *******', /'           EXPECTED RESULT   COMPU',+     $      'TED RESULT' )+ 9998 FORMAT( 1X, I7, 2G18.6 )+*+*     End of DMVCH.+*+      END+      LOGICAL FUNCTION LDE( RI, RJ, LR )+*+*  Tests if two arrays are identical.+*+*  Auxiliary routine for test program for Level 2 Blas.+*+*  -- Written on 10-August-1987.+*     Richard Hanson, Sandia National Labs.+*     Jeremy Du Croz, NAG Central Office.+*+*     .. Scalar Arguments ..+      INTEGER            LR+*     .. Array Arguments ..+      DOUBLE PRECISION   RI( * ), RJ( * )+*     .. Local Scalars ..+      INTEGER            I+*     .. Executable Statements ..+      DO 10 I = 1, LR+         IF( RI( I ).NE.RJ( I ) )+     $      GO TO 20+   10 CONTINUE+      LDE = .TRUE.+      GO TO 30+   20 CONTINUE+      LDE = .FALSE.+   30 RETURN+*+*     End of LDE.+*+      END+      LOGICAL FUNCTION LDERES( TYPE, UPLO, M, N, AA, AS, LDA )+*+*  Tests if selected elements in two arrays are equal.+*+*  TYPE is 'GE', 'SY' or 'SP'.+*+*  Auxiliary routine for test program for Level 2 Blas.+*+*  -- Written on 10-August-1987.+*     Richard Hanson, Sandia National Labs.+*     Jeremy Du Croz, NAG Central Office.+*+*     .. Scalar Arguments ..+      INTEGER            LDA, M, N+      CHARACTER*1        UPLO+      CHARACTER*2        TYPE+*     .. Array Arguments ..+      DOUBLE PRECISION   AA( LDA, * ), AS( LDA, * )+*     .. Local Scalars ..+      INTEGER            I, IBEG, IEND, J+      LOGICAL            UPPER+*     .. Executable Statements ..+      UPPER = UPLO.EQ.'U'+      IF( TYPE.EQ.'GE' )THEN+         DO 20 J = 1, N+            DO 10 I = M + 1, LDA+               IF( AA( I, J ).NE.AS( I, J ) )+     $            GO TO 70+   10       CONTINUE+   20    CONTINUE+      ELSE IF( TYPE.EQ.'SY' )THEN+         DO 50 J = 1, N+            IF( UPPER )THEN+               IBEG = 1+               IEND = J+            ELSE+               IBEG = J+               IEND = N+            END IF+            DO 30 I = 1, IBEG - 1+               IF( AA( I, J ).NE.AS( I, J ) )+     $            GO TO 70+   30       CONTINUE+            DO 40 I = IEND + 1, LDA+               IF( AA( I, J ).NE.AS( I, J ) )+     $            GO TO 70+   40       CONTINUE+   50    CONTINUE+      END IF+*+      LDERES = .TRUE.+      GO TO 80+   70 CONTINUE+      LDERES = .FALSE.+   80 RETURN+*+*     End of LDERES.+*+      END+      DOUBLE PRECISION FUNCTION DBEG( RESET )+*+*  Generates random numbers uniformly distributed between -0.5 and 0.5.+*+*  Auxiliary routine for test program for Level 2 Blas.+*+*  -- Written on 10-August-1987.+*     Richard Hanson, Sandia National Labs.+*     Jeremy Du Croz, NAG Central Office.+*+*     .. Scalar Arguments ..+      LOGICAL            RESET+*     .. Local Scalars ..+      INTEGER            I, IC, MI+*     .. Save statement ..+      SAVE               I, IC, MI+*     .. Intrinsic Functions ..+      INTRINSIC          DBLE+*     .. Executable Statements ..+      IF( RESET )THEN+*        Initialize local variables.+         MI = 891+         I = 7+         IC = 0+         RESET = .FALSE.+      END IF+*+*     The sequence of values of I is bounded between 1 and 999.+*     If initial I = 1,2,3,6,7 or 9, the period will be 50.+*     If initial I = 4 or 8, the period will be 25.+*     If initial I = 5, the period will be 10.+*     IC is used to break up the period by skipping 1 value of I in 6.+*+      IC = IC + 1+   10 I = I*MI+      I = I - 1000*( I/1000 )+      IF( IC.GE.5 )THEN+         IC = 0+         GO TO 10+      END IF+      DBEG = DBLE( I - 500 )/1001.0D0+      RETURN+*+*     End of DBEG.+*+      END+      DOUBLE PRECISION FUNCTION DDIFF( X, Y )+*+*  Auxiliary routine for test program for Level 2 Blas.+*+*  -- Written on 10-August-1987.+*     Richard Hanson, Sandia National Labs.+*+*     .. Scalar Arguments ..+      DOUBLE PRECISION   X, Y+*     .. Executable Statements ..+      DDIFF = X - Y+      RETURN+*+*     End of DDIFF.+*+      END+      SUBROUTINE CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+*+*  Tests whether XERBLA has detected an error when it should.+*+*  Auxiliary routine for test program for Level 2 Blas.+*+*  -- Written on 10-August-1987.+*     Richard Hanson, Sandia National Labs.+*     Jeremy Du Croz, NAG Central Office.+*+*     .. Scalar Arguments ..+      INTEGER            INFOT, NOUT+      LOGICAL            LERR, OK+      CHARACTER*6        SRNAMT+*     .. Executable Statements ..+      IF( .NOT.LERR )THEN+         WRITE( NOUT, FMT = 9999 )INFOT, SRNAMT+         OK = .FALSE.+      END IF+      LERR = .FALSE.+      RETURN+*+ 9999 FORMAT( ' ***** ILLEGAL VALUE OF PARAMETER NUMBER ', I2, ' NOT D',+     $      'ETECTED BY ', A6, ' *****' )+*+*     End of CHKXER.+*+      END+      SUBROUTINE XERBLA( SRNAME, INFO )+*+*  This is a special version of XERBLA to be used only as part of+*  the test program for testing error exits from the Level 2 BLAS+*  routines.+*+*  XERBLA  is an error handler for the Level 2 BLAS routines.+*+*  It is called by the Level 2 BLAS routines if an input parameter is+*  invalid.+*+*  Auxiliary routine for test program for Level 2 Blas.+*+*  -- Written on 10-August-1987.+*     Richard Hanson, Sandia National Labs.+*     Jeremy Du Croz, NAG Central Office.+*+*     .. Scalar Arguments ..+      INTEGER            INFO+      CHARACTER*6        SRNAME+*     .. Scalars in Common ..+      INTEGER            INFOT, NOUT+      LOGICAL            LERR, OK+      CHARACTER*6        SRNAMT+*     .. Common blocks ..+      COMMON             /INFOC/INFOT, NOUT, OK, LERR+      COMMON             /SRNAMC/SRNAMT+*     .. Executable Statements ..+      LERR = .TRUE.+      IF( INFO.NE.INFOT )THEN+         IF( INFOT.NE.0 )THEN+            WRITE( NOUT, FMT = 9999 )INFO, INFOT+         ELSE+            WRITE( NOUT, FMT = 9997 )INFO+         END IF+         OK = .FALSE.+      END IF+      IF( SRNAME.NE.SRNAMT )THEN+         WRITE( NOUT, FMT = 9998 )SRNAME, SRNAMT+         OK = .FALSE.+      END IF+      RETURN+*+ 9999 FORMAT( ' ******* XERBLA WAS CALLED WITH INFO = ', I6, ' INSTEAD',+     $      ' OF ', I2, ' *******' )+ 9998 FORMAT( ' ******* XERBLA WAS CALLED WITH SRNAME = ', A6, ' INSTE',+     $      'AD OF ', A6, ' *******' )+ 9997 FORMAT( ' ******* XERBLA WAS CALLED WITH INFO = ', I6,+     $      ' *******' )+*+*     End of XERBLA+*+      END+
+ eigen3/blas/testing/dblat3.dat view
@@ -0,0 +1,20 @@+'dblat3.summ'     NAME OF SUMMARY OUTPUT FILE+6                 UNIT NUMBER OF SUMMARY FILE+'dblat3.snap'     NAME OF SNAPSHOT OUTPUT FILE+-1                UNIT NUMBER OF SNAPSHOT FILE (NOT USED IF .LT. 0)+F        LOGICAL FLAG, T TO REWIND SNAPSHOT FILE AFTER EACH RECORD.+F        LOGICAL FLAG, T TO STOP ON FAILURES.+T        LOGICAL FLAG, T TO TEST ERROR EXITS.+16.0     THRESHOLD VALUE OF TEST RATIO+6                 NUMBER OF VALUES OF N+0 1 2 3 5 9       VALUES OF N+3                 NUMBER OF VALUES OF ALPHA+0.0 1.0 0.7       VALUES OF ALPHA+3                 NUMBER OF VALUES OF BETA+0.0 1.0 1.3       VALUES OF BETA+DGEMM  T PUT F FOR NO TEST. SAME COLUMNS.+DSYMM  T PUT F FOR NO TEST. SAME COLUMNS.+DTRMM  T PUT F FOR NO TEST. SAME COLUMNS.+DTRSM  T PUT F FOR NO TEST. SAME COLUMNS.+DSYRK  T PUT F FOR NO TEST. SAME COLUMNS.+DSYR2K T PUT F FOR NO TEST. SAME COLUMNS.
+ eigen3/blas/testing/dblat3.f view
@@ -0,0 +1,2873 @@+*> \brief \b DBLAT3+*+*  =========== DOCUMENTATION ===========+*+* Online html documentation available at +*            http://www.netlib.org/lapack/explore-html/ +*+*  Definition:+*  ===========+*+*       PROGRAM DBLAT3+* +*+*> \par Purpose:+*  =============+*>+*> \verbatim+*>+*> Test program for the DOUBLE PRECISION Level 3 Blas.+*>+*> The program must be driven by a short data file. The first 14 records+*> of the file are read using list-directed input, the last 6 records+*> are read using the format ( A6, L2 ). An annotated example of a data+*> file can be obtained by deleting the first 3 characters from the+*> following 20 lines:+*> 'dblat3.out'      NAME OF SUMMARY OUTPUT FILE+*> 6                 UNIT NUMBER OF SUMMARY FILE+*> 'DBLAT3.SNAP'     NAME OF SNAPSHOT OUTPUT FILE+*> -1                UNIT NUMBER OF SNAPSHOT FILE (NOT USED IF .LT. 0)+*> F        LOGICAL FLAG, T TO REWIND SNAPSHOT FILE AFTER EACH RECORD.+*> F        LOGICAL FLAG, T TO STOP ON FAILURES.+*> T        LOGICAL FLAG, T TO TEST ERROR EXITS.+*> 16.0     THRESHOLD VALUE OF TEST RATIO+*> 6                 NUMBER OF VALUES OF N+*> 0 1 2 3 5 9       VALUES OF N+*> 3                 NUMBER OF VALUES OF ALPHA+*> 0.0 1.0 0.7       VALUES OF ALPHA+*> 3                 NUMBER OF VALUES OF BETA+*> 0.0 1.0 1.3       VALUES OF BETA+*> DGEMM  T PUT F FOR NO TEST. SAME COLUMNS.+*> DSYMM  T PUT F FOR NO TEST. SAME COLUMNS.+*> DTRMM  T PUT F FOR NO TEST. SAME COLUMNS.+*> DTRSM  T PUT F FOR NO TEST. SAME COLUMNS.+*> DSYRK  T PUT F FOR NO TEST. SAME COLUMNS.+*> DSYR2K T PUT F FOR NO TEST. SAME COLUMNS.+*>+*> Further Details+*> ===============+*>+*> See:+*>+*>    Dongarra J. J., Du Croz J. J., Duff I. S. and Hammarling S.+*>    A Set of Level 3 Basic Linear Algebra Subprograms.+*>+*>    Technical Memorandum No.88 (Revision 1), Mathematics and+*>    Computer Science Division, Argonne National Laboratory, 9700+*>    South Cass Avenue, Argonne, Illinois 60439, US.+*>+*> -- Written on 8-February-1989.+*>    Jack Dongarra, Argonne National Laboratory.+*>    Iain Duff, AERE Harwell.+*>    Jeremy Du Croz, Numerical Algorithms Group Ltd.+*>    Sven Hammarling, Numerical Algorithms Group Ltd.+*>+*>    10-9-00:  Change STATUS='NEW' to 'UNKNOWN' so that the testers+*>              can be run multiple times without deleting generated+*>              output files (susan)+*> \endverbatim+*+*  Authors:+*  ========+*+*> \author Univ. of Tennessee +*> \author Univ. of California Berkeley +*> \author Univ. of Colorado Denver +*> \author NAG Ltd. +*+*> \date April 2012+*+*> \ingroup double_blas_testing+*+*  =====================================================================+      PROGRAM DBLAT3+*+*  -- Reference BLAS test routine (version 3.4.1) --+*  -- Reference BLAS is a software package provided by Univ. of Tennessee,    --+*  -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--+*     April 2012+*+*  =====================================================================+*+*     .. Parameters ..+      INTEGER            NIN+      PARAMETER          ( NIN = 5 )+      INTEGER            NSUBS+      PARAMETER          ( NSUBS = 6 )+      DOUBLE PRECISION   ZERO, ONE+      PARAMETER          ( ZERO = 0.0D0, ONE = 1.0D0 )+      INTEGER            NMAX+      PARAMETER          ( NMAX = 65 )+      INTEGER            NIDMAX, NALMAX, NBEMAX+      PARAMETER          ( NIDMAX = 9, NALMAX = 7, NBEMAX = 7 )+*     .. Local Scalars ..+      DOUBLE PRECISION   EPS, ERR, THRESH+      INTEGER            I, ISNUM, J, N, NALF, NBET, NIDIM, NOUT, NTRA+      LOGICAL            FATAL, LTESTT, REWI, SAME, SFATAL, TRACE,+     $                   TSTERR+      CHARACTER*1        TRANSA, TRANSB+      CHARACTER*6        SNAMET+      CHARACTER*32       SNAPS, SUMMRY+*     .. Local Arrays ..+      DOUBLE PRECISION   AA( NMAX*NMAX ), AB( NMAX, 2*NMAX ),+     $                   ALF( NALMAX ), AS( NMAX*NMAX ),+     $                   BB( NMAX*NMAX ), BET( NBEMAX ),+     $                   BS( NMAX*NMAX ), C( NMAX, NMAX ),+     $                   CC( NMAX*NMAX ), CS( NMAX*NMAX ), CT( NMAX ),+     $                   G( NMAX ), W( 2*NMAX )+      INTEGER            IDIM( NIDMAX )+      LOGICAL            LTEST( NSUBS )+      CHARACTER*6        SNAMES( NSUBS )+*     .. External Functions ..+      DOUBLE PRECISION   DDIFF+      LOGICAL            LDE+      EXTERNAL           DDIFF, LDE+*     .. External Subroutines ..+      EXTERNAL           DCHK1, DCHK2, DCHK3, DCHK4, DCHK5, DCHKE, DMMCH+*     .. Intrinsic Functions ..+      INTRINSIC          MAX, MIN+*     .. Scalars in Common ..+      INTEGER            INFOT, NOUTC+      LOGICAL            LERR, OK+      CHARACTER*6        SRNAMT+*     .. Common blocks ..+      COMMON             /INFOC/INFOT, NOUTC, OK, LERR+      COMMON             /SRNAMC/SRNAMT+*     .. Data statements ..+      DATA               SNAMES/'DGEMM ', 'DSYMM ', 'DTRMM ', 'DTRSM ',+     $                   'DSYRK ', 'DSYR2K'/+*     .. Executable Statements ..+*+*     Read name and unit number for summary output file and open file.+*+      READ( NIN, FMT = * )SUMMRY+      READ( NIN, FMT = * )NOUT+      OPEN( NOUT, FILE = SUMMRY, STATUS = 'UNKNOWN' )+      NOUTC = NOUT+*+*     Read name and unit number for snapshot output file and open file.+*+      READ( NIN, FMT = * )SNAPS+      READ( NIN, FMT = * )NTRA+      TRACE = NTRA.GE.0+      IF( TRACE )THEN+         OPEN( NTRA, FILE = SNAPS, STATUS = 'UNKNOWN' )+      END IF+*     Read the flag that directs rewinding of the snapshot file.+      READ( NIN, FMT = * )REWI+      REWI = REWI.AND.TRACE+*     Read the flag that directs stopping on any failure.+      READ( NIN, FMT = * )SFATAL+*     Read the flag that indicates whether error exits are to be tested.+      READ( NIN, FMT = * )TSTERR+*     Read the threshold value of the test ratio+      READ( NIN, FMT = * )THRESH+*+*     Read and check the parameter values for the tests.+*+*     Values of N+      READ( NIN, FMT = * )NIDIM+      IF( NIDIM.LT.1.OR.NIDIM.GT.NIDMAX )THEN+         WRITE( NOUT, FMT = 9997 )'N', NIDMAX+         GO TO 220+      END IF+      READ( NIN, FMT = * )( IDIM( I ), I = 1, NIDIM )+      DO 10 I = 1, NIDIM+         IF( IDIM( I ).LT.0.OR.IDIM( I ).GT.NMAX )THEN+            WRITE( NOUT, FMT = 9996 )NMAX+            GO TO 220+         END IF+   10 CONTINUE+*     Values of ALPHA+      READ( NIN, FMT = * )NALF+      IF( NALF.LT.1.OR.NALF.GT.NALMAX )THEN+         WRITE( NOUT, FMT = 9997 )'ALPHA', NALMAX+         GO TO 220+      END IF+      READ( NIN, FMT = * )( ALF( I ), I = 1, NALF )+*     Values of BETA+      READ( NIN, FMT = * )NBET+      IF( NBET.LT.1.OR.NBET.GT.NBEMAX )THEN+         WRITE( NOUT, FMT = 9997 )'BETA', NBEMAX+         GO TO 220+      END IF+      READ( NIN, FMT = * )( BET( I ), I = 1, NBET )+*+*     Report values of parameters.+*+      WRITE( NOUT, FMT = 9995 )+      WRITE( NOUT, FMT = 9994 )( IDIM( I ), I = 1, NIDIM )+      WRITE( NOUT, FMT = 9993 )( ALF( I ), I = 1, NALF )+      WRITE( NOUT, FMT = 9992 )( BET( I ), I = 1, NBET )+      IF( .NOT.TSTERR )THEN+         WRITE( NOUT, FMT = * )+         WRITE( NOUT, FMT = 9984 )+      END IF+      WRITE( NOUT, FMT = * )+      WRITE( NOUT, FMT = 9999 )THRESH+      WRITE( NOUT, FMT = * )+*+*     Read names of subroutines and flags which indicate+*     whether they are to be tested.+*+      DO 20 I = 1, NSUBS+         LTEST( I ) = .FALSE.+   20 CONTINUE+   30 READ( NIN, FMT = 9988, END = 60 )SNAMET, LTESTT+      DO 40 I = 1, NSUBS+         IF( SNAMET.EQ.SNAMES( I ) )+     $      GO TO 50+   40 CONTINUE+      WRITE( NOUT, FMT = 9990 )SNAMET+      STOP+   50 LTEST( I ) = LTESTT+      GO TO 30+*+   60 CONTINUE+      CLOSE ( NIN )+*+*     Compute EPS (the machine precision).+*+      EPS = EPSILON(ZERO)+      WRITE( NOUT, FMT = 9998 )EPS+*+*     Check the reliability of DMMCH using exact data.+*+      N = MIN( 32, NMAX )+      DO 100 J = 1, N+         DO 90 I = 1, N+            AB( I, J ) = MAX( I - J + 1, 0 )+   90    CONTINUE+         AB( J, NMAX + 1 ) = J+         AB( 1, NMAX + J ) = J+         C( J, 1 ) = ZERO+  100 CONTINUE+      DO 110 J = 1, N+         CC( J ) = J*( ( J + 1 )*J )/2 - ( ( J + 1 )*J*( J - 1 ) )/3+  110 CONTINUE+*     CC holds the exact result. On exit from DMMCH CT holds+*     the result computed by DMMCH.+      TRANSA = 'N'+      TRANSB = 'N'+      CALL DMMCH( TRANSA, TRANSB, N, 1, N, ONE, AB, NMAX,+     $            AB( 1, NMAX + 1 ), NMAX, ZERO, C, NMAX, CT, G, CC,+     $            NMAX, EPS, ERR, FATAL, NOUT, .TRUE. )+      SAME = LDE( CC, CT, N )+      IF( .NOT.SAME.OR.ERR.NE.ZERO )THEN+         WRITE( NOUT, FMT = 9989 )TRANSA, TRANSB, SAME, ERR+         STOP+      END IF+      TRANSB = 'T'+      CALL DMMCH( TRANSA, TRANSB, N, 1, N, ONE, AB, NMAX,+     $            AB( 1, NMAX + 1 ), NMAX, ZERO, C, NMAX, CT, G, CC,+     $            NMAX, EPS, ERR, FATAL, NOUT, .TRUE. )+      SAME = LDE( CC, CT, N )+      IF( .NOT.SAME.OR.ERR.NE.ZERO )THEN+         WRITE( NOUT, FMT = 9989 )TRANSA, TRANSB, SAME, ERR+         STOP+      END IF+      DO 120 J = 1, N+         AB( J, NMAX + 1 ) = N - J + 1+         AB( 1, NMAX + J ) = N - J + 1+  120 CONTINUE+      DO 130 J = 1, N+         CC( N - J + 1 ) = J*( ( J + 1 )*J )/2 -+     $                     ( ( J + 1 )*J*( J - 1 ) )/3+  130 CONTINUE+      TRANSA = 'T'+      TRANSB = 'N'+      CALL DMMCH( TRANSA, TRANSB, N, 1, N, ONE, AB, NMAX,+     $            AB( 1, NMAX + 1 ), NMAX, ZERO, C, NMAX, CT, G, CC,+     $            NMAX, EPS, ERR, FATAL, NOUT, .TRUE. )+      SAME = LDE( CC, CT, N )+      IF( .NOT.SAME.OR.ERR.NE.ZERO )THEN+         WRITE( NOUT, FMT = 9989 )TRANSA, TRANSB, SAME, ERR+         STOP+      END IF+      TRANSB = 'T'+      CALL DMMCH( TRANSA, TRANSB, N, 1, N, ONE, AB, NMAX,+     $            AB( 1, NMAX + 1 ), NMAX, ZERO, C, NMAX, CT, G, CC,+     $            NMAX, EPS, ERR, FATAL, NOUT, .TRUE. )+      SAME = LDE( CC, CT, N )+      IF( .NOT.SAME.OR.ERR.NE.ZERO )THEN+         WRITE( NOUT, FMT = 9989 )TRANSA, TRANSB, SAME, ERR+         STOP+      END IF+*+*     Test each subroutine in turn.+*+      DO 200 ISNUM = 1, NSUBS+         WRITE( NOUT, FMT = * )+         IF( .NOT.LTEST( ISNUM ) )THEN+*           Subprogram is not to be tested.+            WRITE( NOUT, FMT = 9987 )SNAMES( ISNUM )+         ELSE+            SRNAMT = SNAMES( ISNUM )+*           Test error exits.+            IF( TSTERR )THEN+               CALL DCHKE( ISNUM, SNAMES( ISNUM ), NOUT )+               WRITE( NOUT, FMT = * )+            END IF+*           Test computations.+            INFOT = 0+            OK = .TRUE.+            FATAL = .FALSE.+            GO TO ( 140, 150, 160, 160, 170, 180 )ISNUM+*           Test DGEMM, 01.+  140       CALL DCHK1( SNAMES( ISNUM ), EPS, THRESH, NOUT, NTRA, TRACE,+     $                  REWI, FATAL, NIDIM, IDIM, NALF, ALF, NBET, BET,+     $                  NMAX, AB, AA, AS, AB( 1, NMAX + 1 ), BB, BS, C,+     $                  CC, CS, CT, G )+            GO TO 190+*           Test DSYMM, 02.+  150       CALL DCHK2( SNAMES( ISNUM ), EPS, THRESH, NOUT, NTRA, TRACE,+     $                  REWI, FATAL, NIDIM, IDIM, NALF, ALF, NBET, BET,+     $                  NMAX, AB, AA, AS, AB( 1, NMAX + 1 ), BB, BS, C,+     $                  CC, CS, CT, G )+            GO TO 190+*           Test DTRMM, 03, DTRSM, 04.+  160       CALL DCHK3( SNAMES( ISNUM ), EPS, THRESH, NOUT, NTRA, TRACE,+     $                  REWI, FATAL, NIDIM, IDIM, NALF, ALF, NMAX, AB,+     $                  AA, AS, AB( 1, NMAX + 1 ), BB, BS, CT, G, C )+            GO TO 190+*           Test DSYRK, 05.+  170       CALL DCHK4( SNAMES( ISNUM ), EPS, THRESH, NOUT, NTRA, TRACE,+     $                  REWI, FATAL, NIDIM, IDIM, NALF, ALF, NBET, BET,+     $                  NMAX, AB, AA, AS, AB( 1, NMAX + 1 ), BB, BS, C,+     $                  CC, CS, CT, G )+            GO TO 190+*           Test DSYR2K, 06.+  180       CALL DCHK5( SNAMES( ISNUM ), EPS, THRESH, NOUT, NTRA, TRACE,+     $                  REWI, FATAL, NIDIM, IDIM, NALF, ALF, NBET, BET,+     $                  NMAX, AB, AA, AS, BB, BS, C, CC, CS, CT, G, W )+            GO TO 190+*+  190       IF( FATAL.AND.SFATAL )+     $         GO TO 210+         END IF+  200 CONTINUE+      WRITE( NOUT, FMT = 9986 )+      GO TO 230+*+  210 CONTINUE+      WRITE( NOUT, FMT = 9985 )+      GO TO 230+*+  220 CONTINUE+      WRITE( NOUT, FMT = 9991 )+*+  230 CONTINUE+      IF( TRACE )+     $   CLOSE ( NTRA )+      CLOSE ( NOUT )+      STOP+*+ 9999 FORMAT( ' ROUTINES PASS COMPUTATIONAL TESTS IF TEST RATIO IS LES',+     $      'S THAN', F8.2 )+ 9998 FORMAT( ' RELATIVE MACHINE PRECISION IS TAKEN TO BE', 1P, D9.1 )+ 9997 FORMAT( ' NUMBER OF VALUES OF ', A, ' IS LESS THAN 1 OR GREATER ',+     $      'THAN ', I2 )+ 9996 FORMAT( ' VALUE OF N IS LESS THAN 0 OR GREATER THAN ', I2 )+ 9995 FORMAT( ' TESTS OF THE DOUBLE PRECISION LEVEL 3 BLAS', //' THE F',+     $      'OLLOWING PARAMETER VALUES WILL BE USED:' )+ 9994 FORMAT( '   FOR N              ', 9I6 )+ 9993 FORMAT( '   FOR ALPHA          ', 7F6.1 )+ 9992 FORMAT( '   FOR BETA           ', 7F6.1 )+ 9991 FORMAT( ' AMEND DATA FILE OR INCREASE ARRAY SIZES IN PROGRAM',+     $      /' ******* TESTS ABANDONED *******' )+ 9990 FORMAT( ' SUBPROGRAM NAME ', A6, ' NOT RECOGNIZED', /' ******* T',+     $      'ESTS ABANDONED *******' )+ 9989 FORMAT( ' ERROR IN DMMCH -  IN-LINE DOT PRODUCTS ARE BEING EVALU',+     $      'ATED WRONGLY.', /' DMMCH WAS CALLED WITH TRANSA = ', A1,+     $      ' AND TRANSB = ', A1, /' AND RETURNED SAME = ', L1, ' AND ',+     $      'ERR = ', F12.3, '.', /' THIS MAY BE DUE TO FAULTS IN THE ',+     $      'ARITHMETIC OR THE COMPILER.', /' ******* TESTS ABANDONED ',+     $      '*******' )+ 9988 FORMAT( A6, L2 )+ 9987 FORMAT( 1X, A6, ' WAS NOT TESTED' )+ 9986 FORMAT( /' END OF TESTS' )+ 9985 FORMAT( /' ******* FATAL ERROR - TESTS ABANDONED *******' )+ 9984 FORMAT( ' ERROR-EXITS WILL NOT BE TESTED' )+*+*     End of DBLAT3.+*+      END+      SUBROUTINE DCHK1( SNAME, EPS, THRESH, NOUT, NTRA, TRACE, REWI,+     $                  FATAL, NIDIM, IDIM, NALF, ALF, NBET, BET, NMAX,+     $                  A, AA, AS, B, BB, BS, C, CC, CS, CT, G )+*+*  Tests DGEMM.+*+*  Auxiliary routine for test program for Level 3 Blas.+*+*  -- Written on 8-February-1989.+*     Jack Dongarra, Argonne National Laboratory.+*     Iain Duff, AERE Harwell.+*     Jeremy Du Croz, Numerical Algorithms Group Ltd.+*     Sven Hammarling, Numerical Algorithms Group Ltd.+*+*     .. Parameters ..+      DOUBLE PRECISION   ZERO+      PARAMETER          ( ZERO = 0.0D0 )+*     .. Scalar Arguments ..+      DOUBLE PRECISION   EPS, THRESH+      INTEGER            NALF, NBET, NIDIM, NMAX, NOUT, NTRA+      LOGICAL            FATAL, REWI, TRACE+      CHARACTER*6        SNAME+*     .. Array Arguments ..+      DOUBLE PRECISION   A( NMAX, NMAX ), AA( NMAX*NMAX ), ALF( NALF ),+     $                   AS( NMAX*NMAX ), B( NMAX, NMAX ),+     $                   BB( NMAX*NMAX ), BET( NBET ), BS( NMAX*NMAX ),+     $                   C( NMAX, NMAX ), CC( NMAX*NMAX ),+     $                   CS( NMAX*NMAX ), CT( NMAX ), G( NMAX )+      INTEGER            IDIM( NIDIM )+*     .. Local Scalars ..+      DOUBLE PRECISION   ALPHA, ALS, BETA, BLS, ERR, ERRMAX+      INTEGER            I, IA, IB, ICA, ICB, IK, IM, IN, K, KS, LAA,+     $                   LBB, LCC, LDA, LDAS, LDB, LDBS, LDC, LDCS, M,+     $                   MA, MB, MS, N, NA, NARGS, NB, NC, NS+      LOGICAL            NULL, RESET, SAME, TRANA, TRANB+      CHARACTER*1        TRANAS, TRANBS, TRANSA, TRANSB+      CHARACTER*3        ICH+*     .. Local Arrays ..+      LOGICAL            ISAME( 13 )+*     .. External Functions ..+      LOGICAL            LDE, LDERES+      EXTERNAL           LDE, LDERES+*     .. External Subroutines ..+      EXTERNAL           DGEMM, DMAKE, DMMCH+*     .. Intrinsic Functions ..+      INTRINSIC          MAX+*     .. Scalars in Common ..+      INTEGER            INFOT, NOUTC+      LOGICAL            LERR, OK+*     .. Common blocks ..+      COMMON             /INFOC/INFOT, NOUTC, OK, LERR+*     .. Data statements ..+      DATA               ICH/'NTC'/+*     .. Executable Statements ..+*+      NARGS = 13+      NC = 0+      RESET = .TRUE.+      ERRMAX = ZERO+*+      DO 110 IM = 1, NIDIM+         M = IDIM( IM )+*+         DO 100 IN = 1, NIDIM+            N = IDIM( IN )+*           Set LDC to 1 more than minimum value if room.+            LDC = M+            IF( LDC.LT.NMAX )+     $         LDC = LDC + 1+*           Skip tests if not enough room.+            IF( LDC.GT.NMAX )+     $         GO TO 100+            LCC = LDC*N+            NULL = N.LE.0.OR.M.LE.0+*+            DO 90 IK = 1, NIDIM+               K = IDIM( IK )+*+               DO 80 ICA = 1, 3+                  TRANSA = ICH( ICA: ICA )+                  TRANA = TRANSA.EQ.'T'.OR.TRANSA.EQ.'C'+*+                  IF( TRANA )THEN+                     MA = K+                     NA = M+                  ELSE+                     MA = M+                     NA = K+                  END IF+*                 Set LDA to 1 more than minimum value if room.+                  LDA = MA+                  IF( LDA.LT.NMAX )+     $               LDA = LDA + 1+*                 Skip tests if not enough room.+                  IF( LDA.GT.NMAX )+     $               GO TO 80+                  LAA = LDA*NA+*+*                 Generate the matrix A.+*+                  CALL DMAKE( 'GE', ' ', ' ', MA, NA, A, NMAX, AA, LDA,+     $                        RESET, ZERO )+*+                  DO 70 ICB = 1, 3+                     TRANSB = ICH( ICB: ICB )+                     TRANB = TRANSB.EQ.'T'.OR.TRANSB.EQ.'C'+*+                     IF( TRANB )THEN+                        MB = N+                        NB = K+                     ELSE+                        MB = K+                        NB = N+                     END IF+*                    Set LDB to 1 more than minimum value if room.+                     LDB = MB+                     IF( LDB.LT.NMAX )+     $                  LDB = LDB + 1+*                    Skip tests if not enough room.+                     IF( LDB.GT.NMAX )+     $                  GO TO 70+                     LBB = LDB*NB+*+*                    Generate the matrix B.+*+                     CALL DMAKE( 'GE', ' ', ' ', MB, NB, B, NMAX, BB,+     $                           LDB, RESET, ZERO )+*+                     DO 60 IA = 1, NALF+                        ALPHA = ALF( IA )+*+                        DO 50 IB = 1, NBET+                           BETA = BET( IB )+*+*                          Generate the matrix C.+*+                           CALL DMAKE( 'GE', ' ', ' ', M, N, C, NMAX,+     $                                 CC, LDC, RESET, ZERO )+*+                           NC = NC + 1+*+*                          Save every datum before calling the+*                          subroutine.+*+                           TRANAS = TRANSA+                           TRANBS = TRANSB+                           MS = M+                           NS = N+                           KS = K+                           ALS = ALPHA+                           DO 10 I = 1, LAA+                              AS( I ) = AA( I )+   10                      CONTINUE+                           LDAS = LDA+                           DO 20 I = 1, LBB+                              BS( I ) = BB( I )+   20                      CONTINUE+                           LDBS = LDB+                           BLS = BETA+                           DO 30 I = 1, LCC+                              CS( I ) = CC( I )+   30                      CONTINUE+                           LDCS = LDC+*+*                          Call the subroutine.+*+                           IF( TRACE )+     $                        WRITE( NTRA, FMT = 9995 )NC, SNAME,+     $                        TRANSA, TRANSB, M, N, K, ALPHA, LDA, LDB,+     $                        BETA, LDC+                           IF( REWI )+     $                        REWIND NTRA+                           CALL DGEMM( TRANSA, TRANSB, M, N, K, ALPHA,+     $                                 AA, LDA, BB, LDB, BETA, CC, LDC )+*+*                          Check if error-exit was taken incorrectly.+*+                           IF( .NOT.OK )THEN+                              WRITE( NOUT, FMT = 9994 )+                              FATAL = .TRUE.+                              GO TO 120+                           END IF+*+*                          See what data changed inside subroutines.+*+                           ISAME( 1 ) = TRANSA.EQ.TRANAS+                           ISAME( 2 ) = TRANSB.EQ.TRANBS+                           ISAME( 3 ) = MS.EQ.M+                           ISAME( 4 ) = NS.EQ.N+                           ISAME( 5 ) = KS.EQ.K+                           ISAME( 6 ) = ALS.EQ.ALPHA+                           ISAME( 7 ) = LDE( AS, AA, LAA )+                           ISAME( 8 ) = LDAS.EQ.LDA+                           ISAME( 9 ) = LDE( BS, BB, LBB )+                           ISAME( 10 ) = LDBS.EQ.LDB+                           ISAME( 11 ) = BLS.EQ.BETA+                           IF( NULL )THEN+                              ISAME( 12 ) = LDE( CS, CC, LCC )+                           ELSE+                              ISAME( 12 ) = LDERES( 'GE', ' ', M, N, CS,+     $                                      CC, LDC )+                           END IF+                           ISAME( 13 ) = LDCS.EQ.LDC+*+*                          If data was incorrectly changed, report+*                          and return.+*+                           SAME = .TRUE.+                           DO 40 I = 1, NARGS+                              SAME = SAME.AND.ISAME( I )+                              IF( .NOT.ISAME( I ) )+     $                           WRITE( NOUT, FMT = 9998 )I+   40                      CONTINUE+                           IF( .NOT.SAME )THEN+                              FATAL = .TRUE.+                              GO TO 120+                           END IF+*+                           IF( .NOT.NULL )THEN+*+*                             Check the result.+*+                              CALL DMMCH( TRANSA, TRANSB, M, N, K,+     $                                    ALPHA, A, NMAX, B, NMAX, BETA,+     $                                    C, NMAX, CT, G, CC, LDC, EPS,+     $                                    ERR, FATAL, NOUT, .TRUE. )+                              ERRMAX = MAX( ERRMAX, ERR )+*                             If got really bad answer, report and+*                             return.+                              IF( FATAL )+     $                           GO TO 120+                           END IF+*+   50                   CONTINUE+*+   60                CONTINUE+*+   70             CONTINUE+*+   80          CONTINUE+*+   90       CONTINUE+*+  100    CONTINUE+*+  110 CONTINUE+*+*     Report result.+*+      IF( ERRMAX.LT.THRESH )THEN+         WRITE( NOUT, FMT = 9999 )SNAME, NC+      ELSE+         WRITE( NOUT, FMT = 9997 )SNAME, NC, ERRMAX+      END IF+      GO TO 130+*+  120 CONTINUE+      WRITE( NOUT, FMT = 9996 )SNAME+      WRITE( NOUT, FMT = 9995 )NC, SNAME, TRANSA, TRANSB, M, N, K,+     $   ALPHA, LDA, LDB, BETA, LDC+*+  130 CONTINUE+      RETURN+*+ 9999 FORMAT( ' ', A6, ' PASSED THE COMPUTATIONAL TESTS (', I6, ' CALL',+     $      'S)' )+ 9998 FORMAT( ' ******* FATAL ERROR - PARAMETER NUMBER ', I2, ' WAS CH',+     $      'ANGED INCORRECTLY *******' )+ 9997 FORMAT( ' ', A6, ' COMPLETED THE COMPUTATIONAL TESTS (', I6, ' C',+     $      'ALLS)', /' ******* BUT WITH MAXIMUM TEST RATIO', F8.2,+     $      ' - SUSPECT *******' )+ 9996 FORMAT( ' ******* ', A6, ' FAILED ON CALL NUMBER:' )+ 9995 FORMAT( 1X, I6, ': ', A6, '(''', A1, ''',''', A1, ''',',+     $      3( I3, ',' ), F4.1, ', A,', I3, ', B,', I3, ',', F4.1, ', ',+     $      'C,', I3, ').' )+ 9994 FORMAT( ' ******* FATAL ERROR - ERROR-EXIT TAKEN ON VALID CALL *',+     $      '******' )+*+*     End of DCHK1.+*+      END+      SUBROUTINE DCHK2( SNAME, EPS, THRESH, NOUT, NTRA, TRACE, REWI,+     $                  FATAL, NIDIM, IDIM, NALF, ALF, NBET, BET, NMAX,+     $                  A, AA, AS, B, BB, BS, C, CC, CS, CT, G )+*+*  Tests DSYMM.+*+*  Auxiliary routine for test program for Level 3 Blas.+*+*  -- Written on 8-February-1989.+*     Jack Dongarra, Argonne National Laboratory.+*     Iain Duff, AERE Harwell.+*     Jeremy Du Croz, Numerical Algorithms Group Ltd.+*     Sven Hammarling, Numerical Algorithms Group Ltd.+*+*     .. Parameters ..+      DOUBLE PRECISION   ZERO+      PARAMETER          ( ZERO = 0.0D0 )+*     .. Scalar Arguments ..+      DOUBLE PRECISION   EPS, THRESH+      INTEGER            NALF, NBET, NIDIM, NMAX, NOUT, NTRA+      LOGICAL            FATAL, REWI, TRACE+      CHARACTER*6        SNAME+*     .. Array Arguments ..+      DOUBLE PRECISION   A( NMAX, NMAX ), AA( NMAX*NMAX ), ALF( NALF ),+     $                   AS( NMAX*NMAX ), B( NMAX, NMAX ),+     $                   BB( NMAX*NMAX ), BET( NBET ), BS( NMAX*NMAX ),+     $                   C( NMAX, NMAX ), CC( NMAX*NMAX ),+     $                   CS( NMAX*NMAX ), CT( NMAX ), G( NMAX )+      INTEGER            IDIM( NIDIM )+*     .. Local Scalars ..+      DOUBLE PRECISION   ALPHA, ALS, BETA, BLS, ERR, ERRMAX+      INTEGER            I, IA, IB, ICS, ICU, IM, IN, LAA, LBB, LCC,+     $                   LDA, LDAS, LDB, LDBS, LDC, LDCS, M, MS, N, NA,+     $                   NARGS, NC, NS+      LOGICAL            LEFT, NULL, RESET, SAME+      CHARACTER*1        SIDE, SIDES, UPLO, UPLOS+      CHARACTER*2        ICHS, ICHU+*     .. Local Arrays ..+      LOGICAL            ISAME( 13 )+*     .. External Functions ..+      LOGICAL            LDE, LDERES+      EXTERNAL           LDE, LDERES+*     .. External Subroutines ..+      EXTERNAL           DMAKE, DMMCH, DSYMM+*     .. Intrinsic Functions ..+      INTRINSIC          MAX+*     .. Scalars in Common ..+      INTEGER            INFOT, NOUTC+      LOGICAL            LERR, OK+*     .. Common blocks ..+      COMMON             /INFOC/INFOT, NOUTC, OK, LERR+*     .. Data statements ..+      DATA               ICHS/'LR'/, ICHU/'UL'/+*     .. Executable Statements ..+*+      NARGS = 12+      NC = 0+      RESET = .TRUE.+      ERRMAX = ZERO+*+      DO 100 IM = 1, NIDIM+         M = IDIM( IM )+*+         DO 90 IN = 1, NIDIM+            N = IDIM( IN )+*           Set LDC to 1 more than minimum value if room.+            LDC = M+            IF( LDC.LT.NMAX )+     $         LDC = LDC + 1+*           Skip tests if not enough room.+            IF( LDC.GT.NMAX )+     $         GO TO 90+            LCC = LDC*N+            NULL = N.LE.0.OR.M.LE.0+*+*           Set LDB to 1 more than minimum value if room.+            LDB = M+            IF( LDB.LT.NMAX )+     $         LDB = LDB + 1+*           Skip tests if not enough room.+            IF( LDB.GT.NMAX )+     $         GO TO 90+            LBB = LDB*N+*+*           Generate the matrix B.+*+            CALL DMAKE( 'GE', ' ', ' ', M, N, B, NMAX, BB, LDB, RESET,+     $                  ZERO )+*+            DO 80 ICS = 1, 2+               SIDE = ICHS( ICS: ICS )+               LEFT = SIDE.EQ.'L'+*+               IF( LEFT )THEN+                  NA = M+               ELSE+                  NA = N+               END IF+*              Set LDA to 1 more than minimum value if room.+               LDA = NA+               IF( LDA.LT.NMAX )+     $            LDA = LDA + 1+*              Skip tests if not enough room.+               IF( LDA.GT.NMAX )+     $            GO TO 80+               LAA = LDA*NA+*+               DO 70 ICU = 1, 2+                  UPLO = ICHU( ICU: ICU )+*+*                 Generate the symmetric matrix A.+*+                  CALL DMAKE( 'SY', UPLO, ' ', NA, NA, A, NMAX, AA, LDA,+     $                        RESET, ZERO )+*+                  DO 60 IA = 1, NALF+                     ALPHA = ALF( IA )+*+                     DO 50 IB = 1, NBET+                        BETA = BET( IB )+*+*                       Generate the matrix C.+*+                        CALL DMAKE( 'GE', ' ', ' ', M, N, C, NMAX, CC,+     $                              LDC, RESET, ZERO )+*+                        NC = NC + 1+*+*                       Save every datum before calling the+*                       subroutine.+*+                        SIDES = SIDE+                        UPLOS = UPLO+                        MS = M+                        NS = N+                        ALS = ALPHA+                        DO 10 I = 1, LAA+                           AS( I ) = AA( I )+   10                   CONTINUE+                        LDAS = LDA+                        DO 20 I = 1, LBB+                           BS( I ) = BB( I )+   20                   CONTINUE+                        LDBS = LDB+                        BLS = BETA+                        DO 30 I = 1, LCC+                           CS( I ) = CC( I )+   30                   CONTINUE+                        LDCS = LDC+*+*                       Call the subroutine.+*+                        IF( TRACE )+     $                     WRITE( NTRA, FMT = 9995 )NC, SNAME, SIDE,+     $                     UPLO, M, N, ALPHA, LDA, LDB, BETA, LDC+                        IF( REWI )+     $                     REWIND NTRA+                        CALL DSYMM( SIDE, UPLO, M, N, ALPHA, AA, LDA,+     $                              BB, LDB, BETA, CC, LDC )+*+*                       Check if error-exit was taken incorrectly.+*+                        IF( .NOT.OK )THEN+                           WRITE( NOUT, FMT = 9994 )+                           FATAL = .TRUE.+                           GO TO 110+                        END IF+*+*                       See what data changed inside subroutines.+*+                        ISAME( 1 ) = SIDES.EQ.SIDE+                        ISAME( 2 ) = UPLOS.EQ.UPLO+                        ISAME( 3 ) = MS.EQ.M+                        ISAME( 4 ) = NS.EQ.N+                        ISAME( 5 ) = ALS.EQ.ALPHA+                        ISAME( 6 ) = LDE( AS, AA, LAA )+                        ISAME( 7 ) = LDAS.EQ.LDA+                        ISAME( 8 ) = LDE( BS, BB, LBB )+                        ISAME( 9 ) = LDBS.EQ.LDB+                        ISAME( 10 ) = BLS.EQ.BETA+                        IF( NULL )THEN+                           ISAME( 11 ) = LDE( CS, CC, LCC )+                        ELSE+                           ISAME( 11 ) = LDERES( 'GE', ' ', M, N, CS,+     $                                   CC, LDC )+                        END IF+                        ISAME( 12 ) = LDCS.EQ.LDC+*+*                       If data was incorrectly changed, report and+*                       return.+*+                        SAME = .TRUE.+                        DO 40 I = 1, NARGS+                           SAME = SAME.AND.ISAME( I )+                           IF( .NOT.ISAME( I ) )+     $                        WRITE( NOUT, FMT = 9998 )I+   40                   CONTINUE+                        IF( .NOT.SAME )THEN+                           FATAL = .TRUE.+                           GO TO 110+                        END IF+*+                        IF( .NOT.NULL )THEN+*+*                          Check the result.+*+                           IF( LEFT )THEN+                              CALL DMMCH( 'N', 'N', M, N, M, ALPHA, A,+     $                                    NMAX, B, NMAX, BETA, C, NMAX,+     $                                    CT, G, CC, LDC, EPS, ERR,+     $                                    FATAL, NOUT, .TRUE. )+                           ELSE+                              CALL DMMCH( 'N', 'N', M, N, N, ALPHA, B,+     $                                    NMAX, A, NMAX, BETA, C, NMAX,+     $                                    CT, G, CC, LDC, EPS, ERR,+     $                                    FATAL, NOUT, .TRUE. )+                           END IF+                           ERRMAX = MAX( ERRMAX, ERR )+*                          If got really bad answer, report and+*                          return.+                           IF( FATAL )+     $                        GO TO 110+                        END IF+*+   50                CONTINUE+*+   60             CONTINUE+*+   70          CONTINUE+*+   80       CONTINUE+*+   90    CONTINUE+*+  100 CONTINUE+*+*     Report result.+*+      IF( ERRMAX.LT.THRESH )THEN+         WRITE( NOUT, FMT = 9999 )SNAME, NC+      ELSE+         WRITE( NOUT, FMT = 9997 )SNAME, NC, ERRMAX+      END IF+      GO TO 120+*+  110 CONTINUE+      WRITE( NOUT, FMT = 9996 )SNAME+      WRITE( NOUT, FMT = 9995 )NC, SNAME, SIDE, UPLO, M, N, ALPHA, LDA,+     $   LDB, BETA, LDC+*+  120 CONTINUE+      RETURN+*+ 9999 FORMAT( ' ', A6, ' PASSED THE COMPUTATIONAL TESTS (', I6, ' CALL',+     $      'S)' )+ 9998 FORMAT( ' ******* FATAL ERROR - PARAMETER NUMBER ', I2, ' WAS CH',+     $      'ANGED INCORRECTLY *******' )+ 9997 FORMAT( ' ', A6, ' COMPLETED THE COMPUTATIONAL TESTS (', I6, ' C',+     $      'ALLS)', /' ******* BUT WITH MAXIMUM TEST RATIO', F8.2,+     $      ' - SUSPECT *******' )+ 9996 FORMAT( ' ******* ', A6, ' FAILED ON CALL NUMBER:' )+ 9995 FORMAT( 1X, I6, ': ', A6, '(', 2( '''', A1, ''',' ), 2( I3, ',' ),+     $      F4.1, ', A,', I3, ', B,', I3, ',', F4.1, ', C,', I3, ')   ',+     $      ' .' )+ 9994 FORMAT( ' ******* FATAL ERROR - ERROR-EXIT TAKEN ON VALID CALL *',+     $      '******' )+*+*     End of DCHK2.+*+      END+      SUBROUTINE DCHK3( SNAME, EPS, THRESH, NOUT, NTRA, TRACE, REWI,+     $                  FATAL, NIDIM, IDIM, NALF, ALF, NMAX, A, AA, AS,+     $                  B, BB, BS, CT, G, C )+*+*  Tests DTRMM and DTRSM.+*+*  Auxiliary routine for test program for Level 3 Blas.+*+*  -- Written on 8-February-1989.+*     Jack Dongarra, Argonne National Laboratory.+*     Iain Duff, AERE Harwell.+*     Jeremy Du Croz, Numerical Algorithms Group Ltd.+*     Sven Hammarling, Numerical Algorithms Group Ltd.+*+*     .. Parameters ..+      DOUBLE PRECISION   ZERO, ONE+      PARAMETER          ( ZERO = 0.0D0, ONE = 1.0D0 )+*     .. Scalar Arguments ..+      DOUBLE PRECISION   EPS, THRESH+      INTEGER            NALF, NIDIM, NMAX, NOUT, NTRA+      LOGICAL            FATAL, REWI, TRACE+      CHARACTER*6        SNAME+*     .. Array Arguments ..+      DOUBLE PRECISION   A( NMAX, NMAX ), AA( NMAX*NMAX ), ALF( NALF ),+     $                   AS( NMAX*NMAX ), B( NMAX, NMAX ),+     $                   BB( NMAX*NMAX ), BS( NMAX*NMAX ),+     $                   C( NMAX, NMAX ), CT( NMAX ), G( NMAX )+      INTEGER            IDIM( NIDIM )+*     .. Local Scalars ..+      DOUBLE PRECISION   ALPHA, ALS, ERR, ERRMAX+      INTEGER            I, IA, ICD, ICS, ICT, ICU, IM, IN, J, LAA, LBB,+     $                   LDA, LDAS, LDB, LDBS, M, MS, N, NA, NARGS, NC,+     $                   NS+      LOGICAL            LEFT, NULL, RESET, SAME+      CHARACTER*1        DIAG, DIAGS, SIDE, SIDES, TRANAS, TRANSA, UPLO,+     $                   UPLOS+      CHARACTER*2        ICHD, ICHS, ICHU+      CHARACTER*3        ICHT+*     .. Local Arrays ..+      LOGICAL            ISAME( 13 )+*     .. External Functions ..+      LOGICAL            LDE, LDERES+      EXTERNAL           LDE, LDERES+*     .. External Subroutines ..+      EXTERNAL           DMAKE, DMMCH, DTRMM, DTRSM+*     .. Intrinsic Functions ..+      INTRINSIC          MAX+*     .. Scalars in Common ..+      INTEGER            INFOT, NOUTC+      LOGICAL            LERR, OK+*     .. Common blocks ..+      COMMON             /INFOC/INFOT, NOUTC, OK, LERR+*     .. Data statements ..+      DATA               ICHU/'UL'/, ICHT/'NTC'/, ICHD/'UN'/, ICHS/'LR'/+*     .. Executable Statements ..+*+      NARGS = 11+      NC = 0+      RESET = .TRUE.+      ERRMAX = ZERO+*     Set up zero matrix for DMMCH.+      DO 20 J = 1, NMAX+         DO 10 I = 1, NMAX+            C( I, J ) = ZERO+   10    CONTINUE+   20 CONTINUE+*+      DO 140 IM = 1, NIDIM+         M = IDIM( IM )+*+         DO 130 IN = 1, NIDIM+            N = IDIM( IN )+*           Set LDB to 1 more than minimum value if room.+            LDB = M+            IF( LDB.LT.NMAX )+     $         LDB = LDB + 1+*           Skip tests if not enough room.+            IF( LDB.GT.NMAX )+     $         GO TO 130+            LBB = LDB*N+            NULL = M.LE.0.OR.N.LE.0+*+            DO 120 ICS = 1, 2+               SIDE = ICHS( ICS: ICS )+               LEFT = SIDE.EQ.'L'+               IF( LEFT )THEN+                  NA = M+               ELSE+                  NA = N+               END IF+*              Set LDA to 1 more than minimum value if room.+               LDA = NA+               IF( LDA.LT.NMAX )+     $            LDA = LDA + 1+*              Skip tests if not enough room.+               IF( LDA.GT.NMAX )+     $            GO TO 130+               LAA = LDA*NA+*+               DO 110 ICU = 1, 2+                  UPLO = ICHU( ICU: ICU )+*+                  DO 100 ICT = 1, 3+                     TRANSA = ICHT( ICT: ICT )+*+                     DO 90 ICD = 1, 2+                        DIAG = ICHD( ICD: ICD )+*+                        DO 80 IA = 1, NALF+                           ALPHA = ALF( IA )+*+*                          Generate the matrix A.+*+                           CALL DMAKE( 'TR', UPLO, DIAG, NA, NA, A,+     $                                 NMAX, AA, LDA, RESET, ZERO )+*+*                          Generate the matrix B.+*+                           CALL DMAKE( 'GE', ' ', ' ', M, N, B, NMAX,+     $                                 BB, LDB, RESET, ZERO )+*+                           NC = NC + 1+*+*                          Save every datum before calling the+*                          subroutine.+*+                           SIDES = SIDE+                           UPLOS = UPLO+                           TRANAS = TRANSA+                           DIAGS = DIAG+                           MS = M+                           NS = N+                           ALS = ALPHA+                           DO 30 I = 1, LAA+                              AS( I ) = AA( I )+   30                      CONTINUE+                           LDAS = LDA+                           DO 40 I = 1, LBB+                              BS( I ) = BB( I )+   40                      CONTINUE+                           LDBS = LDB+*+*                          Call the subroutine.+*+                           IF( SNAME( 4: 5 ).EQ.'MM' )THEN+                              IF( TRACE )+     $                           WRITE( NTRA, FMT = 9995 )NC, SNAME,+     $                           SIDE, UPLO, TRANSA, DIAG, M, N, ALPHA,+     $                           LDA, LDB+                              IF( REWI )+     $                           REWIND NTRA+                              CALL DTRMM( SIDE, UPLO, TRANSA, DIAG, M,+     $                                    N, ALPHA, AA, LDA, BB, LDB )+                           ELSE IF( SNAME( 4: 5 ).EQ.'SM' )THEN+                              IF( TRACE )+     $                           WRITE( NTRA, FMT = 9995 )NC, SNAME,+     $                           SIDE, UPLO, TRANSA, DIAG, M, N, ALPHA,+     $                           LDA, LDB+                              IF( REWI )+     $                           REWIND NTRA+                              CALL DTRSM( SIDE, UPLO, TRANSA, DIAG, M,+     $                                    N, ALPHA, AA, LDA, BB, LDB )+                           END IF+*+*                          Check if error-exit was taken incorrectly.+*+                           IF( .NOT.OK )THEN+                              WRITE( NOUT, FMT = 9994 )+                              FATAL = .TRUE.+                              GO TO 150+                           END IF+*+*                          See what data changed inside subroutines.+*+                           ISAME( 1 ) = SIDES.EQ.SIDE+                           ISAME( 2 ) = UPLOS.EQ.UPLO+                           ISAME( 3 ) = TRANAS.EQ.TRANSA+                           ISAME( 4 ) = DIAGS.EQ.DIAG+                           ISAME( 5 ) = MS.EQ.M+                           ISAME( 6 ) = NS.EQ.N+                           ISAME( 7 ) = ALS.EQ.ALPHA+                           ISAME( 8 ) = LDE( AS, AA, LAA )+                           ISAME( 9 ) = LDAS.EQ.LDA+                           IF( NULL )THEN+                              ISAME( 10 ) = LDE( BS, BB, LBB )+                           ELSE+                              ISAME( 10 ) = LDERES( 'GE', ' ', M, N, BS,+     $                                      BB, LDB )+                           END IF+                           ISAME( 11 ) = LDBS.EQ.LDB+*+*                          If data was incorrectly changed, report and+*                          return.+*+                           SAME = .TRUE.+                           DO 50 I = 1, NARGS+                              SAME = SAME.AND.ISAME( I )+                              IF( .NOT.ISAME( I ) )+     $                           WRITE( NOUT, FMT = 9998 )I+   50                      CONTINUE+                           IF( .NOT.SAME )THEN+                              FATAL = .TRUE.+                              GO TO 150+                           END IF+*+                           IF( .NOT.NULL )THEN+                              IF( SNAME( 4: 5 ).EQ.'MM' )THEN+*+*                                Check the result.+*+                                 IF( LEFT )THEN+                                    CALL DMMCH( TRANSA, 'N', M, N, M,+     $                                          ALPHA, A, NMAX, B, NMAX,+     $                                          ZERO, C, NMAX, CT, G,+     $                                          BB, LDB, EPS, ERR,+     $                                          FATAL, NOUT, .TRUE. )+                                 ELSE+                                    CALL DMMCH( 'N', TRANSA, M, N, N,+     $                                          ALPHA, B, NMAX, A, NMAX,+     $                                          ZERO, C, NMAX, CT, G,+     $                                          BB, LDB, EPS, ERR,+     $                                          FATAL, NOUT, .TRUE. )+                                 END IF+                              ELSE IF( SNAME( 4: 5 ).EQ.'SM' )THEN+*+*                                Compute approximation to original+*                                matrix.+*+                                 DO 70 J = 1, N+                                    DO 60 I = 1, M+                                       C( I, J ) = BB( I + ( J - 1 )*+     $                                             LDB )+                                       BB( I + ( J - 1 )*LDB ) = ALPHA*+     $                                    B( I, J )+   60                               CONTINUE+   70                            CONTINUE+*+                                 IF( LEFT )THEN+                                    CALL DMMCH( TRANSA, 'N', M, N, M,+     $                                          ONE, A, NMAX, C, NMAX,+     $                                          ZERO, B, NMAX, CT, G,+     $                                          BB, LDB, EPS, ERR,+     $                                          FATAL, NOUT, .FALSE. )+                                 ELSE+                                    CALL DMMCH( 'N', TRANSA, M, N, N,+     $                                          ONE, C, NMAX, A, NMAX,+     $                                          ZERO, B, NMAX, CT, G,+     $                                          BB, LDB, EPS, ERR,+     $                                          FATAL, NOUT, .FALSE. )+                                 END IF+                              END IF+                              ERRMAX = MAX( ERRMAX, ERR )+*                             If got really bad answer, report and+*                             return.+                              IF( FATAL )+     $                           GO TO 150+                           END IF+*+   80                   CONTINUE+*+   90                CONTINUE+*+  100             CONTINUE+*+  110          CONTINUE+*+  120       CONTINUE+*+  130    CONTINUE+*+  140 CONTINUE+*+*     Report result.+*+      IF( ERRMAX.LT.THRESH )THEN+         WRITE( NOUT, FMT = 9999 )SNAME, NC+      ELSE+         WRITE( NOUT, FMT = 9997 )SNAME, NC, ERRMAX+      END IF+      GO TO 160+*+  150 CONTINUE+      WRITE( NOUT, FMT = 9996 )SNAME+      WRITE( NOUT, FMT = 9995 )NC, SNAME, SIDE, UPLO, TRANSA, DIAG, M,+     $   N, ALPHA, LDA, LDB+*+  160 CONTINUE+      RETURN+*+ 9999 FORMAT( ' ', A6, ' PASSED THE COMPUTATIONAL TESTS (', I6, ' CALL',+     $      'S)' )+ 9998 FORMAT( ' ******* FATAL ERROR - PARAMETER NUMBER ', I2, ' WAS CH',+     $      'ANGED INCORRECTLY *******' )+ 9997 FORMAT( ' ', A6, ' COMPLETED THE COMPUTATIONAL TESTS (', I6, ' C',+     $      'ALLS)', /' ******* BUT WITH MAXIMUM TEST RATIO', F8.2,+     $      ' - SUSPECT *******' )+ 9996 FORMAT( ' ******* ', A6, ' FAILED ON CALL NUMBER:' )+ 9995 FORMAT( 1X, I6, ': ', A6, '(', 4( '''', A1, ''',' ), 2( I3, ',' ),+     $      F4.1, ', A,', I3, ', B,', I3, ')        .' )+ 9994 FORMAT( ' ******* FATAL ERROR - ERROR-EXIT TAKEN ON VALID CALL *',+     $      '******' )+*+*     End of DCHK3.+*+      END+      SUBROUTINE DCHK4( SNAME, EPS, THRESH, NOUT, NTRA, TRACE, REWI,+     $                  FATAL, NIDIM, IDIM, NALF, ALF, NBET, BET, NMAX,+     $                  A, AA, AS, B, BB, BS, C, CC, CS, CT, G )+*+*  Tests DSYRK.+*+*  Auxiliary routine for test program for Level 3 Blas.+*+*  -- Written on 8-February-1989.+*     Jack Dongarra, Argonne National Laboratory.+*     Iain Duff, AERE Harwell.+*     Jeremy Du Croz, Numerical Algorithms Group Ltd.+*     Sven Hammarling, Numerical Algorithms Group Ltd.+*+*     .. Parameters ..+      DOUBLE PRECISION   ZERO+      PARAMETER          ( ZERO = 0.0D0 )+*     .. Scalar Arguments ..+      DOUBLE PRECISION   EPS, THRESH+      INTEGER            NALF, NBET, NIDIM, NMAX, NOUT, NTRA+      LOGICAL            FATAL, REWI, TRACE+      CHARACTER*6        SNAME+*     .. Array Arguments ..+      DOUBLE PRECISION   A( NMAX, NMAX ), AA( NMAX*NMAX ), ALF( NALF ),+     $                   AS( NMAX*NMAX ), B( NMAX, NMAX ),+     $                   BB( NMAX*NMAX ), BET( NBET ), BS( NMAX*NMAX ),+     $                   C( NMAX, NMAX ), CC( NMAX*NMAX ),+     $                   CS( NMAX*NMAX ), CT( NMAX ), G( NMAX )+      INTEGER            IDIM( NIDIM )+*     .. Local Scalars ..+      DOUBLE PRECISION   ALPHA, ALS, BETA, BETS, ERR, ERRMAX+      INTEGER            I, IA, IB, ICT, ICU, IK, IN, J, JC, JJ, K, KS,+     $                   LAA, LCC, LDA, LDAS, LDC, LDCS, LJ, MA, N, NA,+     $                   NARGS, NC, NS+      LOGICAL            NULL, RESET, SAME, TRAN, UPPER+      CHARACTER*1        TRANS, TRANSS, UPLO, UPLOS+      CHARACTER*2        ICHU+      CHARACTER*3        ICHT+*     .. Local Arrays ..+      LOGICAL            ISAME( 13 )+*     .. External Functions ..+      LOGICAL            LDE, LDERES+      EXTERNAL           LDE, LDERES+*     .. External Subroutines ..+      EXTERNAL           DMAKE, DMMCH, DSYRK+*     .. Intrinsic Functions ..+      INTRINSIC          MAX+*     .. Scalars in Common ..+      INTEGER            INFOT, NOUTC+      LOGICAL            LERR, OK+*     .. Common blocks ..+      COMMON             /INFOC/INFOT, NOUTC, OK, LERR+*     .. Data statements ..+      DATA               ICHT/'NTC'/, ICHU/'UL'/+*     .. Executable Statements ..+*+      NARGS = 10+      NC = 0+      RESET = .TRUE.+      ERRMAX = ZERO+*+      DO 100 IN = 1, NIDIM+         N = IDIM( IN )+*        Set LDC to 1 more than minimum value if room.+         LDC = N+         IF( LDC.LT.NMAX )+     $      LDC = LDC + 1+*        Skip tests if not enough room.+         IF( LDC.GT.NMAX )+     $      GO TO 100+         LCC = LDC*N+         NULL = N.LE.0+*+         DO 90 IK = 1, NIDIM+            K = IDIM( IK )+*+            DO 80 ICT = 1, 3+               TRANS = ICHT( ICT: ICT )+               TRAN = TRANS.EQ.'T'.OR.TRANS.EQ.'C'+               IF( TRAN )THEN+                  MA = K+                  NA = N+               ELSE+                  MA = N+                  NA = K+               END IF+*              Set LDA to 1 more than minimum value if room.+               LDA = MA+               IF( LDA.LT.NMAX )+     $            LDA = LDA + 1+*              Skip tests if not enough room.+               IF( LDA.GT.NMAX )+     $            GO TO 80+               LAA = LDA*NA+*+*              Generate the matrix A.+*+               CALL DMAKE( 'GE', ' ', ' ', MA, NA, A, NMAX, AA, LDA,+     $                     RESET, ZERO )+*+               DO 70 ICU = 1, 2+                  UPLO = ICHU( ICU: ICU )+                  UPPER = UPLO.EQ.'U'+*+                  DO 60 IA = 1, NALF+                     ALPHA = ALF( IA )+*+                     DO 50 IB = 1, NBET+                        BETA = BET( IB )+*+*                       Generate the matrix C.+*+                        CALL DMAKE( 'SY', UPLO, ' ', N, N, C, NMAX, CC,+     $                              LDC, RESET, ZERO )+*+                        NC = NC + 1+*+*                       Save every datum before calling the subroutine.+*+                        UPLOS = UPLO+                        TRANSS = TRANS+                        NS = N+                        KS = K+                        ALS = ALPHA+                        DO 10 I = 1, LAA+                           AS( I ) = AA( I )+   10                   CONTINUE+                        LDAS = LDA+                        BETS = BETA+                        DO 20 I = 1, LCC+                           CS( I ) = CC( I )+   20                   CONTINUE+                        LDCS = LDC+*+*                       Call the subroutine.+*+                        IF( TRACE )+     $                     WRITE( NTRA, FMT = 9994 )NC, SNAME, UPLO,+     $                     TRANS, N, K, ALPHA, LDA, BETA, LDC+                        IF( REWI )+     $                     REWIND NTRA+                        CALL DSYRK( UPLO, TRANS, N, K, ALPHA, AA, LDA,+     $                              BETA, CC, LDC )+*+*                       Check if error-exit was taken incorrectly.+*+                        IF( .NOT.OK )THEN+                           WRITE( NOUT, FMT = 9993 )+                           FATAL = .TRUE.+                           GO TO 120+                        END IF+*+*                       See what data changed inside subroutines.+*+                        ISAME( 1 ) = UPLOS.EQ.UPLO+                        ISAME( 2 ) = TRANSS.EQ.TRANS+                        ISAME( 3 ) = NS.EQ.N+                        ISAME( 4 ) = KS.EQ.K+                        ISAME( 5 ) = ALS.EQ.ALPHA+                        ISAME( 6 ) = LDE( AS, AA, LAA )+                        ISAME( 7 ) = LDAS.EQ.LDA+                        ISAME( 8 ) = BETS.EQ.BETA+                        IF( NULL )THEN+                           ISAME( 9 ) = LDE( CS, CC, LCC )+                        ELSE+                           ISAME( 9 ) = LDERES( 'SY', UPLO, N, N, CS,+     $                                  CC, LDC )+                        END IF+                        ISAME( 10 ) = LDCS.EQ.LDC+*+*                       If data was incorrectly changed, report and+*                       return.+*+                        SAME = .TRUE.+                        DO 30 I = 1, NARGS+                           SAME = SAME.AND.ISAME( I )+                           IF( .NOT.ISAME( I ) )+     $                        WRITE( NOUT, FMT = 9998 )I+   30                   CONTINUE+                        IF( .NOT.SAME )THEN+                           FATAL = .TRUE.+                           GO TO 120+                        END IF+*+                        IF( .NOT.NULL )THEN+*+*                          Check the result column by column.+*+                           JC = 1+                           DO 40 J = 1, N+                              IF( UPPER )THEN+                                 JJ = 1+                                 LJ = J+                              ELSE+                                 JJ = J+                                 LJ = N - J + 1+                              END IF+                              IF( TRAN )THEN+                                 CALL DMMCH( 'T', 'N', LJ, 1, K, ALPHA,+     $                                       A( 1, JJ ), NMAX,+     $                                       A( 1, J ), NMAX, BETA,+     $                                       C( JJ, J ), NMAX, CT, G,+     $                                       CC( JC ), LDC, EPS, ERR,+     $                                       FATAL, NOUT, .TRUE. )+                              ELSE+                                 CALL DMMCH( 'N', 'T', LJ, 1, K, ALPHA,+     $                                       A( JJ, 1 ), NMAX,+     $                                       A( J, 1 ), NMAX, BETA,+     $                                       C( JJ, J ), NMAX, CT, G,+     $                                       CC( JC ), LDC, EPS, ERR,+     $                                       FATAL, NOUT, .TRUE. )+                              END IF+                              IF( UPPER )THEN+                                 JC = JC + LDC+                              ELSE+                                 JC = JC + LDC + 1+                              END IF+                              ERRMAX = MAX( ERRMAX, ERR )+*                             If got really bad answer, report and+*                             return.+                              IF( FATAL )+     $                           GO TO 110+   40                      CONTINUE+                        END IF+*+   50                CONTINUE+*+   60             CONTINUE+*+   70          CONTINUE+*+   80       CONTINUE+*+   90    CONTINUE+*+  100 CONTINUE+*+*     Report result.+*+      IF( ERRMAX.LT.THRESH )THEN+         WRITE( NOUT, FMT = 9999 )SNAME, NC+      ELSE+         WRITE( NOUT, FMT = 9997 )SNAME, NC, ERRMAX+      END IF+      GO TO 130+*+  110 CONTINUE+      IF( N.GT.1 )+     $   WRITE( NOUT, FMT = 9995 )J+*+  120 CONTINUE+      WRITE( NOUT, FMT = 9996 )SNAME+      WRITE( NOUT, FMT = 9994 )NC, SNAME, UPLO, TRANS, N, K, ALPHA,+     $   LDA, BETA, LDC+*+  130 CONTINUE+      RETURN+*+ 9999 FORMAT( ' ', A6, ' PASSED THE COMPUTATIONAL TESTS (', I6, ' CALL',+     $      'S)' )+ 9998 FORMAT( ' ******* FATAL ERROR - PARAMETER NUMBER ', I2, ' WAS CH',+     $      'ANGED INCORRECTLY *******' )+ 9997 FORMAT( ' ', A6, ' COMPLETED THE COMPUTATIONAL TESTS (', I6, ' C',+     $      'ALLS)', /' ******* BUT WITH MAXIMUM TEST RATIO', F8.2,+     $      ' - SUSPECT *******' )+ 9996 FORMAT( ' ******* ', A6, ' FAILED ON CALL NUMBER:' )+ 9995 FORMAT( '      THESE ARE THE RESULTS FOR COLUMN ', I3 )+ 9994 FORMAT( 1X, I6, ': ', A6, '(', 2( '''', A1, ''',' ), 2( I3, ',' ),+     $      F4.1, ', A,', I3, ',', F4.1, ', C,', I3, ')           .' )+ 9993 FORMAT( ' ******* FATAL ERROR - ERROR-EXIT TAKEN ON VALID CALL *',+     $      '******' )+*+*     End of DCHK4.+*+      END+      SUBROUTINE DCHK5( SNAME, EPS, THRESH, NOUT, NTRA, TRACE, REWI,+     $                  FATAL, NIDIM, IDIM, NALF, ALF, NBET, BET, NMAX,+     $                  AB, AA, AS, BB, BS, C, CC, CS, CT, G, W )+*+*  Tests DSYR2K.+*+*  Auxiliary routine for test program for Level 3 Blas.+*+*  -- Written on 8-February-1989.+*     Jack Dongarra, Argonne National Laboratory.+*     Iain Duff, AERE Harwell.+*     Jeremy Du Croz, Numerical Algorithms Group Ltd.+*     Sven Hammarling, Numerical Algorithms Group Ltd.+*+*     .. Parameters ..+      DOUBLE PRECISION   ZERO+      PARAMETER          ( ZERO = 0.0D0 )+*     .. Scalar Arguments ..+      DOUBLE PRECISION   EPS, THRESH+      INTEGER            NALF, NBET, NIDIM, NMAX, NOUT, NTRA+      LOGICAL            FATAL, REWI, TRACE+      CHARACTER*6        SNAME+*     .. Array Arguments ..+      DOUBLE PRECISION   AA( NMAX*NMAX ), AB( 2*NMAX*NMAX ),+     $                   ALF( NALF ), AS( NMAX*NMAX ), BB( NMAX*NMAX ),+     $                   BET( NBET ), BS( NMAX*NMAX ), C( NMAX, NMAX ),+     $                   CC( NMAX*NMAX ), CS( NMAX*NMAX ), CT( NMAX ),+     $                   G( NMAX ), W( 2*NMAX )+      INTEGER            IDIM( NIDIM )+*     .. Local Scalars ..+      DOUBLE PRECISION   ALPHA, ALS, BETA, BETS, ERR, ERRMAX+      INTEGER            I, IA, IB, ICT, ICU, IK, IN, J, JC, JJ, JJAB,+     $                   K, KS, LAA, LBB, LCC, LDA, LDAS, LDB, LDBS,+     $                   LDC, LDCS, LJ, MA, N, NA, NARGS, NC, NS+      LOGICAL            NULL, RESET, SAME, TRAN, UPPER+      CHARACTER*1        TRANS, TRANSS, UPLO, UPLOS+      CHARACTER*2        ICHU+      CHARACTER*3        ICHT+*     .. Local Arrays ..+      LOGICAL            ISAME( 13 )+*     .. External Functions ..+      LOGICAL            LDE, LDERES+      EXTERNAL           LDE, LDERES+*     .. External Subroutines ..+      EXTERNAL           DMAKE, DMMCH, DSYR2K+*     .. Intrinsic Functions ..+      INTRINSIC          MAX+*     .. Scalars in Common ..+      INTEGER            INFOT, NOUTC+      LOGICAL            LERR, OK+*     .. Common blocks ..+      COMMON             /INFOC/INFOT, NOUTC, OK, LERR+*     .. Data statements ..+      DATA               ICHT/'NTC'/, ICHU/'UL'/+*     .. Executable Statements ..+*+      NARGS = 12+      NC = 0+      RESET = .TRUE.+      ERRMAX = ZERO+*+      DO 130 IN = 1, NIDIM+         N = IDIM( IN )+*        Set LDC to 1 more than minimum value if room.+         LDC = N+         IF( LDC.LT.NMAX )+     $      LDC = LDC + 1+*        Skip tests if not enough room.+         IF( LDC.GT.NMAX )+     $      GO TO 130+         LCC = LDC*N+         NULL = N.LE.0+*+         DO 120 IK = 1, NIDIM+            K = IDIM( IK )+*+            DO 110 ICT = 1, 3+               TRANS = ICHT( ICT: ICT )+               TRAN = TRANS.EQ.'T'.OR.TRANS.EQ.'C'+               IF( TRAN )THEN+                  MA = K+                  NA = N+               ELSE+                  MA = N+                  NA = K+               END IF+*              Set LDA to 1 more than minimum value if room.+               LDA = MA+               IF( LDA.LT.NMAX )+     $            LDA = LDA + 1+*              Skip tests if not enough room.+               IF( LDA.GT.NMAX )+     $            GO TO 110+               LAA = LDA*NA+*+*              Generate the matrix A.+*+               IF( TRAN )THEN+                  CALL DMAKE( 'GE', ' ', ' ', MA, NA, AB, 2*NMAX, AA,+     $                        LDA, RESET, ZERO )+               ELSE+                  CALL DMAKE( 'GE', ' ', ' ', MA, NA, AB, NMAX, AA, LDA,+     $                        RESET, ZERO )+               END IF+*+*              Generate the matrix B.+*+               LDB = LDA+               LBB = LAA+               IF( TRAN )THEN+                  CALL DMAKE( 'GE', ' ', ' ', MA, NA, AB( K + 1 ),+     $                        2*NMAX, BB, LDB, RESET, ZERO )+               ELSE+                  CALL DMAKE( 'GE', ' ', ' ', MA, NA, AB( K*NMAX + 1 ),+     $                        NMAX, BB, LDB, RESET, ZERO )+               END IF+*+               DO 100 ICU = 1, 2+                  UPLO = ICHU( ICU: ICU )+                  UPPER = UPLO.EQ.'U'+*+                  DO 90 IA = 1, NALF+                     ALPHA = ALF( IA )+*+                     DO 80 IB = 1, NBET+                        BETA = BET( IB )+*+*                       Generate the matrix C.+*+                        CALL DMAKE( 'SY', UPLO, ' ', N, N, C, NMAX, CC,+     $                              LDC, RESET, ZERO )+*+                        NC = NC + 1+*+*                       Save every datum before calling the subroutine.+*+                        UPLOS = UPLO+                        TRANSS = TRANS+                        NS = N+                        KS = K+                        ALS = ALPHA+                        DO 10 I = 1, LAA+                           AS( I ) = AA( I )+   10                   CONTINUE+                        LDAS = LDA+                        DO 20 I = 1, LBB+                           BS( I ) = BB( I )+   20                   CONTINUE+                        LDBS = LDB+                        BETS = BETA+                        DO 30 I = 1, LCC+                           CS( I ) = CC( I )+   30                   CONTINUE+                        LDCS = LDC+*+*                       Call the subroutine.+*+                        IF( TRACE )+     $                     WRITE( NTRA, FMT = 9994 )NC, SNAME, UPLO,+     $                     TRANS, N, K, ALPHA, LDA, LDB, BETA, LDC+                        IF( REWI )+     $                     REWIND NTRA+                        CALL DSYR2K( UPLO, TRANS, N, K, ALPHA, AA, LDA,+     $                               BB, LDB, BETA, CC, LDC )+*+*                       Check if error-exit was taken incorrectly.+*+                        IF( .NOT.OK )THEN+                           WRITE( NOUT, FMT = 9993 )+                           FATAL = .TRUE.+                           GO TO 150+                        END IF+*+*                       See what data changed inside subroutines.+*+                        ISAME( 1 ) = UPLOS.EQ.UPLO+                        ISAME( 2 ) = TRANSS.EQ.TRANS+                        ISAME( 3 ) = NS.EQ.N+                        ISAME( 4 ) = KS.EQ.K+                        ISAME( 5 ) = ALS.EQ.ALPHA+                        ISAME( 6 ) = LDE( AS, AA, LAA )+                        ISAME( 7 ) = LDAS.EQ.LDA+                        ISAME( 8 ) = LDE( BS, BB, LBB )+                        ISAME( 9 ) = LDBS.EQ.LDB+                        ISAME( 10 ) = BETS.EQ.BETA+                        IF( NULL )THEN+                           ISAME( 11 ) = LDE( CS, CC, LCC )+                        ELSE+                           ISAME( 11 ) = LDERES( 'SY', UPLO, N, N, CS,+     $                                   CC, LDC )+                        END IF+                        ISAME( 12 ) = LDCS.EQ.LDC+*+*                       If data was incorrectly changed, report and+*                       return.+*+                        SAME = .TRUE.+                        DO 40 I = 1, NARGS+                           SAME = SAME.AND.ISAME( I )+                           IF( .NOT.ISAME( I ) )+     $                        WRITE( NOUT, FMT = 9998 )I+   40                   CONTINUE+                        IF( .NOT.SAME )THEN+                           FATAL = .TRUE.+                           GO TO 150+                        END IF+*+                        IF( .NOT.NULL )THEN+*+*                          Check the result column by column.+*+                           JJAB = 1+                           JC = 1+                           DO 70 J = 1, N+                              IF( UPPER )THEN+                                 JJ = 1+                                 LJ = J+                              ELSE+                                 JJ = J+                                 LJ = N - J + 1+                              END IF+                              IF( TRAN )THEN+                                 DO 50 I = 1, K+                                    W( I ) = AB( ( J - 1 )*2*NMAX + K ++     $                                       I )+                                    W( K + I ) = AB( ( J - 1 )*2*NMAX ++     $                                           I )+   50                            CONTINUE+                                 CALL DMMCH( 'T', 'N', LJ, 1, 2*K,+     $                                       ALPHA, AB( JJAB ), 2*NMAX,+     $                                       W, 2*NMAX, BETA,+     $                                       C( JJ, J ), NMAX, CT, G,+     $                                       CC( JC ), LDC, EPS, ERR,+     $                                       FATAL, NOUT, .TRUE. )+                              ELSE+                                 DO 60 I = 1, K+                                    W( I ) = AB( ( K + I - 1 )*NMAX ++     $                                       J )+                                    W( K + I ) = AB( ( I - 1 )*NMAX ++     $                                           J )+   60                            CONTINUE+                                 CALL DMMCH( 'N', 'N', LJ, 1, 2*K,+     $                                       ALPHA, AB( JJ ), NMAX, W,+     $                                       2*NMAX, BETA, C( JJ, J ),+     $                                       NMAX, CT, G, CC( JC ), LDC,+     $                                       EPS, ERR, FATAL, NOUT,+     $                                       .TRUE. )+                              END IF+                              IF( UPPER )THEN+                                 JC = JC + LDC+                              ELSE+                                 JC = JC + LDC + 1+                                 IF( TRAN )+     $                              JJAB = JJAB + 2*NMAX+                              END IF+                              ERRMAX = MAX( ERRMAX, ERR )+*                             If got really bad answer, report and+*                             return.+                              IF( FATAL )+     $                           GO TO 140+   70                      CONTINUE+                        END IF+*+   80                CONTINUE+*+   90             CONTINUE+*+  100          CONTINUE+*+  110       CONTINUE+*+  120    CONTINUE+*+  130 CONTINUE+*+*     Report result.+*+      IF( ERRMAX.LT.THRESH )THEN+         WRITE( NOUT, FMT = 9999 )SNAME, NC+      ELSE+         WRITE( NOUT, FMT = 9997 )SNAME, NC, ERRMAX+      END IF+      GO TO 160+*+  140 CONTINUE+      IF( N.GT.1 )+     $   WRITE( NOUT, FMT = 9995 )J+*+  150 CONTINUE+      WRITE( NOUT, FMT = 9996 )SNAME+      WRITE( NOUT, FMT = 9994 )NC, SNAME, UPLO, TRANS, N, K, ALPHA,+     $   LDA, LDB, BETA, LDC+*+  160 CONTINUE+      RETURN+*+ 9999 FORMAT( ' ', A6, ' PASSED THE COMPUTATIONAL TESTS (', I6, ' CALL',+     $      'S)' )+ 9998 FORMAT( ' ******* FATAL ERROR - PARAMETER NUMBER ', I2, ' WAS CH',+     $      'ANGED INCORRECTLY *******' )+ 9997 FORMAT( ' ', A6, ' COMPLETED THE COMPUTATIONAL TESTS (', I6, ' C',+     $      'ALLS)', /' ******* BUT WITH MAXIMUM TEST RATIO', F8.2,+     $      ' - SUSPECT *******' )+ 9996 FORMAT( ' ******* ', A6, ' FAILED ON CALL NUMBER:' )+ 9995 FORMAT( '      THESE ARE THE RESULTS FOR COLUMN ', I3 )+ 9994 FORMAT( 1X, I6, ': ', A6, '(', 2( '''', A1, ''',' ), 2( I3, ',' ),+     $      F4.1, ', A,', I3, ', B,', I3, ',', F4.1, ', C,', I3, ')   ',+     $      ' .' )+ 9993 FORMAT( ' ******* FATAL ERROR - ERROR-EXIT TAKEN ON VALID CALL *',+     $      '******' )+*+*     End of DCHK5.+*+      END+      SUBROUTINE DCHKE( ISNUM, SRNAMT, NOUT )+*+*  Tests the error exits from the Level 3 Blas.+*  Requires a special version of the error-handling routine XERBLA.+*  A, B and C should not need to be defined.+*+*  Auxiliary routine for test program for Level 3 Blas.+*+*  -- Written on 8-February-1989.+*     Jack Dongarra, Argonne National Laboratory.+*     Iain Duff, AERE Harwell.+*     Jeremy Du Croz, Numerical Algorithms Group Ltd.+*     Sven Hammarling, Numerical Algorithms Group Ltd.+*+*  3-19-92:  Initialize ALPHA and BETA  (eca)+*  3-19-92:  Fix argument 12 in calls to SSYMM with INFOT = 9  (eca)+*+*     .. Scalar Arguments ..+      INTEGER            ISNUM, NOUT+      CHARACTER*6        SRNAMT+*     .. Scalars in Common ..+      INTEGER            INFOT, NOUTC+      LOGICAL            LERR, OK+*     .. Parameters ..+      DOUBLE PRECISION   ONE, TWO+      PARAMETER          ( ONE = 1.0D0, TWO = 2.0D0 )+*     .. Local Scalars ..+      DOUBLE PRECISION   ALPHA, BETA+*     .. Local Arrays ..+      DOUBLE PRECISION   A( 2, 1 ), B( 2, 1 ), C( 2, 1 )+*     .. External Subroutines ..+      EXTERNAL           CHKXER, DGEMM, DSYMM, DSYR2K, DSYRK, DTRMM,+     $                   DTRSM+*     .. Common blocks ..+      COMMON             /INFOC/INFOT, NOUTC, OK, LERR+*     .. Executable Statements ..+*     OK is set to .FALSE. by the special version of XERBLA or by CHKXER+*     if anything is wrong.+      OK = .TRUE.+*     LERR is set to .TRUE. by the special version of XERBLA each time+*     it is called, and is then tested and re-set by CHKXER.+      LERR = .FALSE.+*+*     Initialize ALPHA and BETA.+*+      ALPHA = ONE+      BETA = TWO+*+      GO TO ( 10, 20, 30, 40, 50, 60 )ISNUM+   10 INFOT = 1+      CALL DGEMM( '/', 'N', 0, 0, 0, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 1+      CALL DGEMM( '/', 'T', 0, 0, 0, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 2+      CALL DGEMM( 'N', '/', 0, 0, 0, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 2+      CALL DGEMM( 'T', '/', 0, 0, 0, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 3+      CALL DGEMM( 'N', 'N', -1, 0, 0, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 3+      CALL DGEMM( 'N', 'T', -1, 0, 0, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 3+      CALL DGEMM( 'T', 'N', -1, 0, 0, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 3+      CALL DGEMM( 'T', 'T', -1, 0, 0, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 4+      CALL DGEMM( 'N', 'N', 0, -1, 0, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 4+      CALL DGEMM( 'N', 'T', 0, -1, 0, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 4+      CALL DGEMM( 'T', 'N', 0, -1, 0, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 4+      CALL DGEMM( 'T', 'T', 0, -1, 0, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 5+      CALL DGEMM( 'N', 'N', 0, 0, -1, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 5+      CALL DGEMM( 'N', 'T', 0, 0, -1, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 5+      CALL DGEMM( 'T', 'N', 0, 0, -1, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 5+      CALL DGEMM( 'T', 'T', 0, 0, -1, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 8+      CALL DGEMM( 'N', 'N', 2, 0, 0, ALPHA, A, 1, B, 1, BETA, C, 2 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 8+      CALL DGEMM( 'N', 'T', 2, 0, 0, ALPHA, A, 1, B, 1, BETA, C, 2 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 8+      CALL DGEMM( 'T', 'N', 0, 0, 2, ALPHA, A, 1, B, 2, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 8+      CALL DGEMM( 'T', 'T', 0, 0, 2, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 10+      CALL DGEMM( 'N', 'N', 0, 0, 2, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 10+      CALL DGEMM( 'T', 'N', 0, 0, 2, ALPHA, A, 2, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 10+      CALL DGEMM( 'N', 'T', 0, 2, 0, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 10+      CALL DGEMM( 'T', 'T', 0, 2, 0, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 13+      CALL DGEMM( 'N', 'N', 2, 0, 0, ALPHA, A, 2, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 13+      CALL DGEMM( 'N', 'T', 2, 0, 0, ALPHA, A, 2, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 13+      CALL DGEMM( 'T', 'N', 2, 0, 0, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 13+      CALL DGEMM( 'T', 'T', 2, 0, 0, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      GO TO 70+   20 INFOT = 1+      CALL DSYMM( '/', 'U', 0, 0, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 2+      CALL DSYMM( 'L', '/', 0, 0, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 3+      CALL DSYMM( 'L', 'U', -1, 0, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 3+      CALL DSYMM( 'R', 'U', -1, 0, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 3+      CALL DSYMM( 'L', 'L', -1, 0, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 3+      CALL DSYMM( 'R', 'L', -1, 0, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 4+      CALL DSYMM( 'L', 'U', 0, -1, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 4+      CALL DSYMM( 'R', 'U', 0, -1, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 4+      CALL DSYMM( 'L', 'L', 0, -1, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 4+      CALL DSYMM( 'R', 'L', 0, -1, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 7+      CALL DSYMM( 'L', 'U', 2, 0, ALPHA, A, 1, B, 2, BETA, C, 2 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 7+      CALL DSYMM( 'R', 'U', 0, 2, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 7+      CALL DSYMM( 'L', 'L', 2, 0, ALPHA, A, 1, B, 2, BETA, C, 2 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 7+      CALL DSYMM( 'R', 'L', 0, 2, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 9+      CALL DSYMM( 'L', 'U', 2, 0, ALPHA, A, 2, B, 1, BETA, C, 2 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 9+      CALL DSYMM( 'R', 'U', 2, 0, ALPHA, A, 1, B, 1, BETA, C, 2 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 9+      CALL DSYMM( 'L', 'L', 2, 0, ALPHA, A, 2, B, 1, BETA, C, 2 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 9+      CALL DSYMM( 'R', 'L', 2, 0, ALPHA, A, 1, B, 1, BETA, C, 2 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 12+      CALL DSYMM( 'L', 'U', 2, 0, ALPHA, A, 2, B, 2, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 12+      CALL DSYMM( 'R', 'U', 2, 0, ALPHA, A, 1, B, 2, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 12+      CALL DSYMM( 'L', 'L', 2, 0, ALPHA, A, 2, B, 2, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 12+      CALL DSYMM( 'R', 'L', 2, 0, ALPHA, A, 1, B, 2, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      GO TO 70+   30 INFOT = 1+      CALL DTRMM( '/', 'U', 'N', 'N', 0, 0, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 2+      CALL DTRMM( 'L', '/', 'N', 'N', 0, 0, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 3+      CALL DTRMM( 'L', 'U', '/', 'N', 0, 0, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 4+      CALL DTRMM( 'L', 'U', 'N', '/', 0, 0, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 5+      CALL DTRMM( 'L', 'U', 'N', 'N', -1, 0, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 5+      CALL DTRMM( 'L', 'U', 'T', 'N', -1, 0, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 5+      CALL DTRMM( 'R', 'U', 'N', 'N', -1, 0, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 5+      CALL DTRMM( 'R', 'U', 'T', 'N', -1, 0, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 5+      CALL DTRMM( 'L', 'L', 'N', 'N', -1, 0, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 5+      CALL DTRMM( 'L', 'L', 'T', 'N', -1, 0, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 5+      CALL DTRMM( 'R', 'L', 'N', 'N', -1, 0, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 5+      CALL DTRMM( 'R', 'L', 'T', 'N', -1, 0, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 6+      CALL DTRMM( 'L', 'U', 'N', 'N', 0, -1, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 6+      CALL DTRMM( 'L', 'U', 'T', 'N', 0, -1, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 6+      CALL DTRMM( 'R', 'U', 'N', 'N', 0, -1, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 6+      CALL DTRMM( 'R', 'U', 'T', 'N', 0, -1, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 6+      CALL DTRMM( 'L', 'L', 'N', 'N', 0, -1, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 6+      CALL DTRMM( 'L', 'L', 'T', 'N', 0, -1, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 6+      CALL DTRMM( 'R', 'L', 'N', 'N', 0, -1, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 6+      CALL DTRMM( 'R', 'L', 'T', 'N', 0, -1, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 9+      CALL DTRMM( 'L', 'U', 'N', 'N', 2, 0, ALPHA, A, 1, B, 2 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 9+      CALL DTRMM( 'L', 'U', 'T', 'N', 2, 0, ALPHA, A, 1, B, 2 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 9+      CALL DTRMM( 'R', 'U', 'N', 'N', 0, 2, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 9+      CALL DTRMM( 'R', 'U', 'T', 'N', 0, 2, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 9+      CALL DTRMM( 'L', 'L', 'N', 'N', 2, 0, ALPHA, A, 1, B, 2 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 9+      CALL DTRMM( 'L', 'L', 'T', 'N', 2, 0, ALPHA, A, 1, B, 2 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 9+      CALL DTRMM( 'R', 'L', 'N', 'N', 0, 2, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 9+      CALL DTRMM( 'R', 'L', 'T', 'N', 0, 2, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 11+      CALL DTRMM( 'L', 'U', 'N', 'N', 2, 0, ALPHA, A, 2, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 11+      CALL DTRMM( 'L', 'U', 'T', 'N', 2, 0, ALPHA, A, 2, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 11+      CALL DTRMM( 'R', 'U', 'N', 'N', 2, 0, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 11+      CALL DTRMM( 'R', 'U', 'T', 'N', 2, 0, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 11+      CALL DTRMM( 'L', 'L', 'N', 'N', 2, 0, ALPHA, A, 2, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 11+      CALL DTRMM( 'L', 'L', 'T', 'N', 2, 0, ALPHA, A, 2, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 11+      CALL DTRMM( 'R', 'L', 'N', 'N', 2, 0, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 11+      CALL DTRMM( 'R', 'L', 'T', 'N', 2, 0, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      GO TO 70+   40 INFOT = 1+      CALL DTRSM( '/', 'U', 'N', 'N', 0, 0, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 2+      CALL DTRSM( 'L', '/', 'N', 'N', 0, 0, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 3+      CALL DTRSM( 'L', 'U', '/', 'N', 0, 0, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 4+      CALL DTRSM( 'L', 'U', 'N', '/', 0, 0, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 5+      CALL DTRSM( 'L', 'U', 'N', 'N', -1, 0, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 5+      CALL DTRSM( 'L', 'U', 'T', 'N', -1, 0, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 5+      CALL DTRSM( 'R', 'U', 'N', 'N', -1, 0, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 5+      CALL DTRSM( 'R', 'U', 'T', 'N', -1, 0, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 5+      CALL DTRSM( 'L', 'L', 'N', 'N', -1, 0, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 5+      CALL DTRSM( 'L', 'L', 'T', 'N', -1, 0, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 5+      CALL DTRSM( 'R', 'L', 'N', 'N', -1, 0, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 5+      CALL DTRSM( 'R', 'L', 'T', 'N', -1, 0, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 6+      CALL DTRSM( 'L', 'U', 'N', 'N', 0, -1, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 6+      CALL DTRSM( 'L', 'U', 'T', 'N', 0, -1, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 6+      CALL DTRSM( 'R', 'U', 'N', 'N', 0, -1, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 6+      CALL DTRSM( 'R', 'U', 'T', 'N', 0, -1, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 6+      CALL DTRSM( 'L', 'L', 'N', 'N', 0, -1, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 6+      CALL DTRSM( 'L', 'L', 'T', 'N', 0, -1, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 6+      CALL DTRSM( 'R', 'L', 'N', 'N', 0, -1, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 6+      CALL DTRSM( 'R', 'L', 'T', 'N', 0, -1, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 9+      CALL DTRSM( 'L', 'U', 'N', 'N', 2, 0, ALPHA, A, 1, B, 2 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 9+      CALL DTRSM( 'L', 'U', 'T', 'N', 2, 0, ALPHA, A, 1, B, 2 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 9+      CALL DTRSM( 'R', 'U', 'N', 'N', 0, 2, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 9+      CALL DTRSM( 'R', 'U', 'T', 'N', 0, 2, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 9+      CALL DTRSM( 'L', 'L', 'N', 'N', 2, 0, ALPHA, A, 1, B, 2 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 9+      CALL DTRSM( 'L', 'L', 'T', 'N', 2, 0, ALPHA, A, 1, B, 2 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 9+      CALL DTRSM( 'R', 'L', 'N', 'N', 0, 2, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 9+      CALL DTRSM( 'R', 'L', 'T', 'N', 0, 2, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 11+      CALL DTRSM( 'L', 'U', 'N', 'N', 2, 0, ALPHA, A, 2, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 11+      CALL DTRSM( 'L', 'U', 'T', 'N', 2, 0, ALPHA, A, 2, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 11+      CALL DTRSM( 'R', 'U', 'N', 'N', 2, 0, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 11+      CALL DTRSM( 'R', 'U', 'T', 'N', 2, 0, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 11+      CALL DTRSM( 'L', 'L', 'N', 'N', 2, 0, ALPHA, A, 2, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 11+      CALL DTRSM( 'L', 'L', 'T', 'N', 2, 0, ALPHA, A, 2, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 11+      CALL DTRSM( 'R', 'L', 'N', 'N', 2, 0, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 11+      CALL DTRSM( 'R', 'L', 'T', 'N', 2, 0, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      GO TO 70+   50 INFOT = 1+      CALL DSYRK( '/', 'N', 0, 0, ALPHA, A, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 2+      CALL DSYRK( 'U', '/', 0, 0, ALPHA, A, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 3+      CALL DSYRK( 'U', 'N', -1, 0, ALPHA, A, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 3+      CALL DSYRK( 'U', 'T', -1, 0, ALPHA, A, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 3+      CALL DSYRK( 'L', 'N', -1, 0, ALPHA, A, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 3+      CALL DSYRK( 'L', 'T', -1, 0, ALPHA, A, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 4+      CALL DSYRK( 'U', 'N', 0, -1, ALPHA, A, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 4+      CALL DSYRK( 'U', 'T', 0, -1, ALPHA, A, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 4+      CALL DSYRK( 'L', 'N', 0, -1, ALPHA, A, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 4+      CALL DSYRK( 'L', 'T', 0, -1, ALPHA, A, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 7+      CALL DSYRK( 'U', 'N', 2, 0, ALPHA, A, 1, BETA, C, 2 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 7+      CALL DSYRK( 'U', 'T', 0, 2, ALPHA, A, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 7+      CALL DSYRK( 'L', 'N', 2, 0, ALPHA, A, 1, BETA, C, 2 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 7+      CALL DSYRK( 'L', 'T', 0, 2, ALPHA, A, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 10+      CALL DSYRK( 'U', 'N', 2, 0, ALPHA, A, 2, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 10+      CALL DSYRK( 'U', 'T', 2, 0, ALPHA, A, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 10+      CALL DSYRK( 'L', 'N', 2, 0, ALPHA, A, 2, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 10+      CALL DSYRK( 'L', 'T', 2, 0, ALPHA, A, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      GO TO 70+   60 INFOT = 1+      CALL DSYR2K( '/', 'N', 0, 0, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 2+      CALL DSYR2K( 'U', '/', 0, 0, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 3+      CALL DSYR2K( 'U', 'N', -1, 0, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 3+      CALL DSYR2K( 'U', 'T', -1, 0, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 3+      CALL DSYR2K( 'L', 'N', -1, 0, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 3+      CALL DSYR2K( 'L', 'T', -1, 0, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 4+      CALL DSYR2K( 'U', 'N', 0, -1, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 4+      CALL DSYR2K( 'U', 'T', 0, -1, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 4+      CALL DSYR2K( 'L', 'N', 0, -1, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 4+      CALL DSYR2K( 'L', 'T', 0, -1, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 7+      CALL DSYR2K( 'U', 'N', 2, 0, ALPHA, A, 1, B, 1, BETA, C, 2 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 7+      CALL DSYR2K( 'U', 'T', 0, 2, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 7+      CALL DSYR2K( 'L', 'N', 2, 0, ALPHA, A, 1, B, 1, BETA, C, 2 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 7+      CALL DSYR2K( 'L', 'T', 0, 2, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 9+      CALL DSYR2K( 'U', 'N', 2, 0, ALPHA, A, 2, B, 1, BETA, C, 2 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 9+      CALL DSYR2K( 'U', 'T', 0, 2, ALPHA, A, 2, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 9+      CALL DSYR2K( 'L', 'N', 2, 0, ALPHA, A, 2, B, 1, BETA, C, 2 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 9+      CALL DSYR2K( 'L', 'T', 0, 2, ALPHA, A, 2, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 12+      CALL DSYR2K( 'U', 'N', 2, 0, ALPHA, A, 2, B, 2, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 12+      CALL DSYR2K( 'U', 'T', 2, 0, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 12+      CALL DSYR2K( 'L', 'N', 2, 0, ALPHA, A, 2, B, 2, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 12+      CALL DSYR2K( 'L', 'T', 2, 0, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+*+   70 IF( OK )THEN+         WRITE( NOUT, FMT = 9999 )SRNAMT+      ELSE+         WRITE( NOUT, FMT = 9998 )SRNAMT+      END IF+      RETURN+*+ 9999 FORMAT( ' ', A6, ' PASSED THE TESTS OF ERROR-EXITS' )+ 9998 FORMAT( ' ******* ', A6, ' FAILED THE TESTS OF ERROR-EXITS *****',+     $      '**' )+*+*     End of DCHKE.+*+      END+      SUBROUTINE DMAKE( TYPE, UPLO, DIAG, M, N, A, NMAX, AA, LDA, RESET,+     $                  TRANSL )+*+*  Generates values for an M by N matrix A.+*  Stores the values in the array AA in the data structure required+*  by the routine, with unwanted elements set to rogue value.+*+*  TYPE is 'GE', 'SY' or 'TR'.+*+*  Auxiliary routine for test program for Level 3 Blas.+*+*  -- Written on 8-February-1989.+*     Jack Dongarra, Argonne National Laboratory.+*     Iain Duff, AERE Harwell.+*     Jeremy Du Croz, Numerical Algorithms Group Ltd.+*     Sven Hammarling, Numerical Algorithms Group Ltd.+*+*     .. Parameters ..+      DOUBLE PRECISION   ZERO, ONE+      PARAMETER          ( ZERO = 0.0D0, ONE = 1.0D0 )+      DOUBLE PRECISION   ROGUE+      PARAMETER          ( ROGUE = -1.0D10 )+*     .. Scalar Arguments ..+      DOUBLE PRECISION   TRANSL+      INTEGER            LDA, M, N, NMAX+      LOGICAL            RESET+      CHARACTER*1        DIAG, UPLO+      CHARACTER*2        TYPE+*     .. Array Arguments ..+      DOUBLE PRECISION   A( NMAX, * ), AA( * )+*     .. Local Scalars ..+      INTEGER            I, IBEG, IEND, J+      LOGICAL            GEN, LOWER, SYM, TRI, UNIT, UPPER+*     .. External Functions ..+      DOUBLE PRECISION   DBEG+      EXTERNAL           DBEG+*     .. Executable Statements ..+      GEN = TYPE.EQ.'GE'+      SYM = TYPE.EQ.'SY'+      TRI = TYPE.EQ.'TR'+      UPPER = ( SYM.OR.TRI ).AND.UPLO.EQ.'U'+      LOWER = ( SYM.OR.TRI ).AND.UPLO.EQ.'L'+      UNIT = TRI.AND.DIAG.EQ.'U'+*+*     Generate data in array A.+*+      DO 20 J = 1, N+         DO 10 I = 1, M+            IF( GEN.OR.( UPPER.AND.I.LE.J ).OR.( LOWER.AND.I.GE.J ) )+     $          THEN+               A( I, J ) = DBEG( RESET ) + TRANSL+               IF( I.NE.J )THEN+*                 Set some elements to zero+                  IF( N.GT.3.AND.J.EQ.N/2 )+     $               A( I, J ) = ZERO+                  IF( SYM )THEN+                     A( J, I ) = A( I, J )+                  ELSE IF( TRI )THEN+                     A( J, I ) = ZERO+                  END IF+               END IF+            END IF+   10    CONTINUE+         IF( TRI )+     $      A( J, J ) = A( J, J ) + ONE+         IF( UNIT )+     $      A( J, J ) = ONE+   20 CONTINUE+*+*     Store elements in array AS in data structure required by routine.+*+      IF( TYPE.EQ.'GE' )THEN+         DO 50 J = 1, N+            DO 30 I = 1, M+               AA( I + ( J - 1 )*LDA ) = A( I, J )+   30       CONTINUE+            DO 40 I = M + 1, LDA+               AA( I + ( J - 1 )*LDA ) = ROGUE+   40       CONTINUE+   50    CONTINUE+      ELSE IF( TYPE.EQ.'SY'.OR.TYPE.EQ.'TR' )THEN+         DO 90 J = 1, N+            IF( UPPER )THEN+               IBEG = 1+               IF( UNIT )THEN+                  IEND = J - 1+               ELSE+                  IEND = J+               END IF+            ELSE+               IF( UNIT )THEN+                  IBEG = J + 1+               ELSE+                  IBEG = J+               END IF+               IEND = N+            END IF+            DO 60 I = 1, IBEG - 1+               AA( I + ( J - 1 )*LDA ) = ROGUE+   60       CONTINUE+            DO 70 I = IBEG, IEND+               AA( I + ( J - 1 )*LDA ) = A( I, J )+   70       CONTINUE+            DO 80 I = IEND + 1, LDA+               AA( I + ( J - 1 )*LDA ) = ROGUE+   80       CONTINUE+   90    CONTINUE+      END IF+      RETURN+*+*     End of DMAKE.+*+      END+      SUBROUTINE DMMCH( TRANSA, TRANSB, M, N, KK, ALPHA, A, LDA, B, LDB,+     $                  BETA, C, LDC, CT, G, CC, LDCC, EPS, ERR, FATAL,+     $                  NOUT, MV )+*+*  Checks the results of the computational tests.+*+*  Auxiliary routine for test program for Level 3 Blas.+*+*  -- Written on 8-February-1989.+*     Jack Dongarra, Argonne National Laboratory.+*     Iain Duff, AERE Harwell.+*     Jeremy Du Croz, Numerical Algorithms Group Ltd.+*     Sven Hammarling, Numerical Algorithms Group Ltd.+*+*     .. Parameters ..+      DOUBLE PRECISION   ZERO, ONE+      PARAMETER          ( ZERO = 0.0D0, ONE = 1.0D0 )+*     .. Scalar Arguments ..+      DOUBLE PRECISION   ALPHA, BETA, EPS, ERR+      INTEGER            KK, LDA, LDB, LDC, LDCC, M, N, NOUT+      LOGICAL            FATAL, MV+      CHARACTER*1        TRANSA, TRANSB+*     .. Array Arguments ..+      DOUBLE PRECISION   A( LDA, * ), B( LDB, * ), C( LDC, * ),+     $                   CC( LDCC, * ), CT( * ), G( * )+*     .. Local Scalars ..+      DOUBLE PRECISION   ERRI+      INTEGER            I, J, K+      LOGICAL            TRANA, TRANB+*     .. Intrinsic Functions ..+      INTRINSIC          ABS, MAX, SQRT+*     .. Executable Statements ..+      TRANA = TRANSA.EQ.'T'.OR.TRANSA.EQ.'C'+      TRANB = TRANSB.EQ.'T'.OR.TRANSB.EQ.'C'+*+*     Compute expected result, one column at a time, in CT using data+*     in A, B and C.+*     Compute gauges in G.+*+      DO 120 J = 1, N+*+         DO 10 I = 1, M+            CT( I ) = ZERO+            G( I ) = ZERO+   10    CONTINUE+         IF( .NOT.TRANA.AND..NOT.TRANB )THEN+            DO 30 K = 1, KK+               DO 20 I = 1, M+                  CT( I ) = CT( I ) + A( I, K )*B( K, J )+                  G( I ) = G( I ) + ABS( A( I, K ) )*ABS( B( K, J ) )+   20          CONTINUE+   30       CONTINUE+         ELSE IF( TRANA.AND..NOT.TRANB )THEN+            DO 50 K = 1, KK+               DO 40 I = 1, M+                  CT( I ) = CT( I ) + A( K, I )*B( K, J )+                  G( I ) = G( I ) + ABS( A( K, I ) )*ABS( B( K, J ) )+   40          CONTINUE+   50       CONTINUE+         ELSE IF( .NOT.TRANA.AND.TRANB )THEN+            DO 70 K = 1, KK+               DO 60 I = 1, M+                  CT( I ) = CT( I ) + A( I, K )*B( J, K )+                  G( I ) = G( I ) + ABS( A( I, K ) )*ABS( B( J, K ) )+   60          CONTINUE+   70       CONTINUE+         ELSE IF( TRANA.AND.TRANB )THEN+            DO 90 K = 1, KK+               DO 80 I = 1, M+                  CT( I ) = CT( I ) + A( K, I )*B( J, K )+                  G( I ) = G( I ) + ABS( A( K, I ) )*ABS( B( J, K ) )+   80          CONTINUE+   90       CONTINUE+         END IF+         DO 100 I = 1, M+            CT( I ) = ALPHA*CT( I ) + BETA*C( I, J )+            G( I ) = ABS( ALPHA )*G( I ) + ABS( BETA )*ABS( C( I, J ) )+  100    CONTINUE+*+*        Compute the error ratio for this result.+*+         ERR = ZERO+         DO 110 I = 1, M+            ERRI = ABS( CT( I ) - CC( I, J ) )/EPS+            IF( G( I ).NE.ZERO )+     $         ERRI = ERRI/G( I )+            ERR = MAX( ERR, ERRI )+            IF( ERR*SQRT( EPS ).GE.ONE )+     $         GO TO 130+  110    CONTINUE+*+  120 CONTINUE+*+*     If the loop completes, all results are at least half accurate.+      GO TO 150+*+*     Report fatal error.+*+  130 FATAL = .TRUE.+      WRITE( NOUT, FMT = 9999 )+      DO 140 I = 1, M+         IF( MV )THEN+            WRITE( NOUT, FMT = 9998 )I, CT( I ), CC( I, J )+         ELSE+            WRITE( NOUT, FMT = 9998 )I, CC( I, J ), CT( I )+         END IF+  140 CONTINUE+      IF( N.GT.1 )+     $   WRITE( NOUT, FMT = 9997 )J+*+  150 CONTINUE+      RETURN+*+ 9999 FORMAT( ' ******* FATAL ERROR - COMPUTED RESULT IS LESS THAN HAL',+     $      'F ACCURATE *******', /'           EXPECTED RESULT   COMPU',+     $      'TED RESULT' )+ 9998 FORMAT( 1X, I7, 2G18.6 )+ 9997 FORMAT( '      THESE ARE THE RESULTS FOR COLUMN ', I3 )+*+*     End of DMMCH.+*+      END+      LOGICAL FUNCTION LDE( RI, RJ, LR )+*+*  Tests if two arrays are identical.+*+*  Auxiliary routine for test program for Level 3 Blas.+*+*  -- Written on 8-February-1989.+*     Jack Dongarra, Argonne National Laboratory.+*     Iain Duff, AERE Harwell.+*     Jeremy Du Croz, Numerical Algorithms Group Ltd.+*     Sven Hammarling, Numerical Algorithms Group Ltd.+*+*     .. Scalar Arguments ..+      INTEGER            LR+*     .. Array Arguments ..+      DOUBLE PRECISION   RI( * ), RJ( * )+*     .. Local Scalars ..+      INTEGER            I+*     .. Executable Statements ..+      DO 10 I = 1, LR+         IF( RI( I ).NE.RJ( I ) )+     $      GO TO 20+   10 CONTINUE+      LDE = .TRUE.+      GO TO 30+   20 CONTINUE+      LDE = .FALSE.+   30 RETURN+*+*     End of LDE.+*+      END+      LOGICAL FUNCTION LDERES( TYPE, UPLO, M, N, AA, AS, LDA )+*+*  Tests if selected elements in two arrays are equal.+*+*  TYPE is 'GE' or 'SY'.+*+*  Auxiliary routine for test program for Level 3 Blas.+*+*  -- Written on 8-February-1989.+*     Jack Dongarra, Argonne National Laboratory.+*     Iain Duff, AERE Harwell.+*     Jeremy Du Croz, Numerical Algorithms Group Ltd.+*     Sven Hammarling, Numerical Algorithms Group Ltd.+*+*     .. Scalar Arguments ..+      INTEGER            LDA, M, N+      CHARACTER*1        UPLO+      CHARACTER*2        TYPE+*     .. Array Arguments ..+      DOUBLE PRECISION   AA( LDA, * ), AS( LDA, * )+*     .. Local Scalars ..+      INTEGER            I, IBEG, IEND, J+      LOGICAL            UPPER+*     .. Executable Statements ..+      UPPER = UPLO.EQ.'U'+      IF( TYPE.EQ.'GE' )THEN+         DO 20 J = 1, N+            DO 10 I = M + 1, LDA+               IF( AA( I, J ).NE.AS( I, J ) )+     $            GO TO 70+   10       CONTINUE+   20    CONTINUE+      ELSE IF( TYPE.EQ.'SY' )THEN+         DO 50 J = 1, N+            IF( UPPER )THEN+               IBEG = 1+               IEND = J+            ELSE+               IBEG = J+               IEND = N+            END IF+            DO 30 I = 1, IBEG - 1+               IF( AA( I, J ).NE.AS( I, J ) )+     $            GO TO 70+   30       CONTINUE+            DO 40 I = IEND + 1, LDA+               IF( AA( I, J ).NE.AS( I, J ) )+     $            GO TO 70+   40       CONTINUE+   50    CONTINUE+      END IF+*+      LDERES = .TRUE.+      GO TO 80+   70 CONTINUE+      LDERES = .FALSE.+   80 RETURN+*+*     End of LDERES.+*+      END+      DOUBLE PRECISION FUNCTION DBEG( RESET )+*+*  Generates random numbers uniformly distributed between -0.5 and 0.5.+*+*  Auxiliary routine for test program for Level 3 Blas.+*+*  -- Written on 8-February-1989.+*     Jack Dongarra, Argonne National Laboratory.+*     Iain Duff, AERE Harwell.+*     Jeremy Du Croz, Numerical Algorithms Group Ltd.+*     Sven Hammarling, Numerical Algorithms Group Ltd.+*+*     .. Scalar Arguments ..+      LOGICAL            RESET+*     .. Local Scalars ..+      INTEGER            I, IC, MI+*     .. Save statement ..+      SAVE               I, IC, MI+*     .. Executable Statements ..+      IF( RESET )THEN+*        Initialize local variables.+         MI = 891+         I = 7+         IC = 0+         RESET = .FALSE.+      END IF+*+*     The sequence of values of I is bounded between 1 and 999.+*     If initial I = 1,2,3,6,7 or 9, the period will be 50.+*     If initial I = 4 or 8, the period will be 25.+*     If initial I = 5, the period will be 10.+*     IC is used to break up the period by skipping 1 value of I in 6.+*+      IC = IC + 1+   10 I = I*MI+      I = I - 1000*( I/1000 )+      IF( IC.GE.5 )THEN+         IC = 0+         GO TO 10+      END IF+      DBEG = ( I - 500 )/1001.0D0+      RETURN+*+*     End of DBEG.+*+      END+      DOUBLE PRECISION FUNCTION DDIFF( X, Y )+*+*  Auxiliary routine for test program for Level 3 Blas.+*+*  -- Written on 8-February-1989.+*     Jack Dongarra, Argonne National Laboratory.+*     Iain Duff, AERE Harwell.+*     Jeremy Du Croz, Numerical Algorithms Group Ltd.+*     Sven Hammarling, Numerical Algorithms Group Ltd.+*+*     .. Scalar Arguments ..+      DOUBLE PRECISION   X, Y+*     .. Executable Statements ..+      DDIFF = X - Y+      RETURN+*+*     End of DDIFF.+*+      END+      SUBROUTINE CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+*+*  Tests whether XERBLA has detected an error when it should.+*+*  Auxiliary routine for test program for Level 3 Blas.+*+*  -- Written on 8-February-1989.+*     Jack Dongarra, Argonne National Laboratory.+*     Iain Duff, AERE Harwell.+*     Jeremy Du Croz, Numerical Algorithms Group Ltd.+*     Sven Hammarling, Numerical Algorithms Group Ltd.+*+*     .. Scalar Arguments ..+      INTEGER            INFOT, NOUT+      LOGICAL            LERR, OK+      CHARACTER*6        SRNAMT+*     .. Executable Statements ..+      IF( .NOT.LERR )THEN+         WRITE( NOUT, FMT = 9999 )INFOT, SRNAMT+         OK = .FALSE.+      END IF+      LERR = .FALSE.+      RETURN+*+ 9999 FORMAT( ' ***** ILLEGAL VALUE OF PARAMETER NUMBER ', I2, ' NOT D',+     $      'ETECTED BY ', A6, ' *****' )+*+*     End of CHKXER.+*+      END+      SUBROUTINE XERBLA( SRNAME, INFO )+*+*  This is a special version of XERBLA to be used only as part of+*  the test program for testing error exits from the Level 3 BLAS+*  routines.+*+*  XERBLA  is an error handler for the Level 3 BLAS routines.+*+*  It is called by the Level 3 BLAS routines if an input parameter is+*  invalid.+*+*  Auxiliary routine for test program for Level 3 Blas.+*+*  -- Written on 8-February-1989.+*     Jack Dongarra, Argonne National Laboratory.+*     Iain Duff, AERE Harwell.+*     Jeremy Du Croz, Numerical Algorithms Group Ltd.+*     Sven Hammarling, Numerical Algorithms Group Ltd.+*+*     .. Scalar Arguments ..+      INTEGER            INFO+      CHARACTER*6        SRNAME+*     .. Scalars in Common ..+      INTEGER            INFOT, NOUT+      LOGICAL            LERR, OK+      CHARACTER*6        SRNAMT+*     .. Common blocks ..+      COMMON             /INFOC/INFOT, NOUT, OK, LERR+      COMMON             /SRNAMC/SRNAMT+*     .. Executable Statements ..+      LERR = .TRUE.+      IF( INFO.NE.INFOT )THEN+         IF( INFOT.NE.0 )THEN+            WRITE( NOUT, FMT = 9999 )INFO, INFOT+         ELSE+            WRITE( NOUT, FMT = 9997 )INFO+         END IF+         OK = .FALSE.+      END IF+      IF( SRNAME.NE.SRNAMT )THEN+         WRITE( NOUT, FMT = 9998 )SRNAME, SRNAMT+         OK = .FALSE.+      END IF+      RETURN+*+ 9999 FORMAT( ' ******* XERBLA WAS CALLED WITH INFO = ', I6, ' INSTEAD',+     $      ' OF ', I2, ' *******' )+ 9998 FORMAT( ' ******* XERBLA WAS CALLED WITH SRNAME = ', A6, ' INSTE',+     $      'AD OF ', A6, ' *******' )+ 9997 FORMAT( ' ******* XERBLA WAS CALLED WITH INFO = ', I6,+     $      ' *******' )+*+*     End of XERBLA+*+      END+
+ eigen3/blas/testing/runblastest.sh view
@@ -0,0 +1,45 @@+#!/bin/bash++black='\E[30m'+red='\E[31m'+green='\E[32m'+yellow='\E[33m'+blue='\E[34m'+magenta='\E[35m'+cyan='\E[36m'+white='\E[37m'++if [ -f $2 ]; then+  data=$2+  if [ -f $1.summ ]; then rm $1.summ; fi+  if [ -f $1.snap ]; then rm $1.snap; fi+else+  data=$1+fi++if ! ./$1 < $data > /dev/null 2> .runtest.log ; then+  echo -e  $red Test $1 failed: $black+  echo -e $blue+  cat .runtest.log+  echo -e $black+  exit 1+else+  if [ -f $1.summ ]; then+    if [ `grep "FATAL ERROR" $1.summ | wc -l` -gt 0 ]; then+      echo -e  $red "Test $1 failed (FATAL ERROR, read the file $1.summ for details)" $black+      echo -e $blue+      cat .runtest.log+      echo -e $black+      exit 1;+    fi++    if [ `grep "FAILED THE TESTS OF ERROR-EXITS" $1.summ | wc -l` -gt 0 ]; then+      echo -e  $red "Test $1 failed (FAILED THE TESTS OF ERROR-EXITS, read the file $1.summ for details)" $black+      echo -e $blue+      cat .runtest.log+      echo -e $black+      exit 1;+    fi      +  fi+  echo -e $green Test $1 passed$black+fi
+ eigen3/blas/testing/sblat1.f view
@@ -0,0 +1,1021 @@+*> \brief \b SBLAT1+*+*  =========== DOCUMENTATION ===========+*+* Online html documentation available at +*            http://www.netlib.org/lapack/explore-html/ +*+*  Definition:+*  ===========+*+*       PROGRAM SBLAT1+* +*+*> \par Purpose:+*  =============+*>+*> \verbatim+*>+*>    Test program for the REAL Level 1 BLAS.+*>+*>    Based upon the original BLAS test routine together with:+*>    F06EAF Example Program Text+*> \endverbatim+*+*  Authors:+*  ========+*+*> \author Univ. of Tennessee +*> \author Univ. of California Berkeley +*> \author Univ. of Colorado Denver +*> \author NAG Ltd. +*+*> \date April 2012+*+*> \ingroup single_blas_testing+*+*  =====================================================================+      PROGRAM SBLAT1+*+*  -- Reference BLAS test routine (version 3.4.1) --+*  -- Reference BLAS is a software package provided by Univ. of Tennessee,    --+*  -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--+*     April 2012+*+*  =====================================================================+*+*     .. Parameters ..+      INTEGER          NOUT+      PARAMETER        (NOUT=6)+*     .. Scalars in Common ..+      INTEGER          ICASE, INCX, INCY, N+      LOGICAL          PASS+*     .. Local Scalars ..+      REAL             SFAC+      INTEGER          IC+*     .. External Subroutines ..+      EXTERNAL         CHECK0, CHECK1, CHECK2, CHECK3, HEADER+*     .. Common blocks ..+      COMMON           /COMBLA/ICASE, N, INCX, INCY, PASS+*     .. Data statements ..+      DATA             SFAC/9.765625E-4/+*     .. Executable Statements ..+      WRITE (NOUT,99999)+      DO 20 IC = 1, 13+         ICASE = IC+         CALL HEADER+*+*        .. Initialize  PASS,  INCX,  and INCY for a new case. ..+*        .. the value 9999 for INCX or INCY will appear in the ..+*        .. detailed  output, if any, for cases  that do not involve ..+*        .. these parameters ..+*+         PASS = .TRUE.+         INCX = 9999+         INCY = 9999+         IF (ICASE.EQ.3 .OR. ICASE.EQ.11) THEN+            CALL CHECK0(SFAC)+         ELSE IF (ICASE.EQ.7 .OR. ICASE.EQ.8 .OR. ICASE.EQ.9 .OR.+     +            ICASE.EQ.10) THEN+            CALL CHECK1(SFAC)+         ELSE IF (ICASE.EQ.1 .OR. ICASE.EQ.2 .OR. ICASE.EQ.5 .OR.+     +            ICASE.EQ.6 .OR. ICASE.EQ.12 .OR. ICASE.EQ.13) THEN+            CALL CHECK2(SFAC)+         ELSE IF (ICASE.EQ.4) THEN+            CALL CHECK3(SFAC)+         END IF+*        -- Print+         IF (PASS) WRITE (NOUT,99998)+   20 CONTINUE+      STOP+*+99999 FORMAT (' Real BLAS Test Program Results',/1X)+99998 FORMAT ('                                    ----- PASS -----')+      END+      SUBROUTINE HEADER+*     .. Parameters ..+      INTEGER          NOUT+      PARAMETER        (NOUT=6)+*     .. Scalars in Common ..+      INTEGER          ICASE, INCX, INCY, N+      LOGICAL          PASS+*     .. Local Arrays ..+      CHARACTER*6      L(13)+*     .. Common blocks ..+      COMMON           /COMBLA/ICASE, N, INCX, INCY, PASS+*     .. Data statements ..+      DATA             L(1)/' SDOT '/+      DATA             L(2)/'SAXPY '/+      DATA             L(3)/'SROTG '/+      DATA             L(4)/' SROT '/+      DATA             L(5)/'SCOPY '/+      DATA             L(6)/'SSWAP '/+      DATA             L(7)/'SNRM2 '/+      DATA             L(8)/'SASUM '/+      DATA             L(9)/'SSCAL '/+      DATA             L(10)/'ISAMAX'/+      DATA             L(11)/'SROTMG'/+      DATA             L(12)/'SROTM '/+      DATA             L(13)/'SDSDOT'/+*     .. Executable Statements ..+      WRITE (NOUT,99999) ICASE, L(ICASE)+      RETURN+*+99999 FORMAT (/' Test of subprogram number',I3,12X,A6)+      END+      SUBROUTINE CHECK0(SFAC)+*     .. Parameters ..+      INTEGER           NOUT+      PARAMETER         (NOUT=6)+*     .. Scalar Arguments ..+      REAL              SFAC+*     .. Scalars in Common ..+      INTEGER           ICASE, INCX, INCY, N+      LOGICAL           PASS+*     .. Local Scalars ..+      REAL              D12, SA, SB, SC, SS+      INTEGER           I, K+*     .. Local Arrays ..+      REAL              DA1(8), DATRUE(8), DB1(8), DBTRUE(8), DC1(8),+     +                  DS1(8), DAB(4,9), DTEMP(9), DTRUE(9,9)+*     .. External Subroutines ..+      EXTERNAL          SROTG, SROTMG, STEST1+*     .. Common blocks ..+      COMMON            /COMBLA/ICASE, N, INCX, INCY, PASS+*     .. Data statements ..+      DATA              DA1/0.3E0, 0.4E0, -0.3E0, -0.4E0, -0.3E0, 0.0E0,+     +                  0.0E0, 1.0E0/+      DATA              DB1/0.4E0, 0.3E0, 0.4E0, 0.3E0, -0.4E0, 0.0E0,+     +                  1.0E0, 0.0E0/+      DATA              DC1/0.6E0, 0.8E0, -0.6E0, 0.8E0, 0.6E0, 1.0E0,+     +                  0.0E0, 1.0E0/+      DATA              DS1/0.8E0, 0.6E0, 0.8E0, -0.6E0, 0.8E0, 0.0E0,+     +                  1.0E0, 0.0E0/+      DATA              DATRUE/0.5E0, 0.5E0, 0.5E0, -0.5E0, -0.5E0,+     +                  0.0E0, 1.0E0, 1.0E0/+      DATA              DBTRUE/0.0E0, 0.6E0, 0.0E0, -0.6E0, 0.0E0,+     +                  0.0E0, 1.0E0, 0.0E0/+*     INPUT FOR MODIFIED GIVENS+      DATA DAB/ .1E0,.3E0,1.2E0,.2E0,+     A          .7E0, .2E0, .6E0, 4.2E0,+     B          0.E0,0.E0,0.E0,0.E0,+     C          4.E0, -1.E0, 2.E0, 4.E0,+     D          6.E-10, 2.E-2, 1.E5, 10.E0,+     E          4.E10, 2.E-2, 1.E-5, 10.E0,+     F          2.E-10, 4.E-2, 1.E5, 10.E0,+     G          2.E10, 4.E-2, 1.E-5, 10.E0,+     H          4.E0, -2.E0, 8.E0, 4.E0    /+*    TRUE RESULTS FOR MODIFIED GIVENS+      DATA DTRUE/0.E0,0.E0, 1.3E0, .2E0, 0.E0,0.E0,0.E0, .5E0, 0.E0,+     A           0.E0,0.E0, 4.5E0, 4.2E0, 1.E0, .5E0, 0.E0,0.E0,0.E0,+     B           0.E0,0.E0,0.E0,0.E0, -2.E0, 0.E0,0.E0,0.E0,0.E0,+     C           0.E0,0.E0,0.E0, 4.E0, -1.E0, 0.E0,0.E0,0.E0,0.E0,+     D           0.E0, 15.E-3, 0.E0, 10.E0, -1.E0, 0.E0, -1.E-4,+     E           0.E0, 1.E0,+     F           0.E0,0.E0, 6144.E-5, 10.E0, -1.E0, 4096.E0, -1.E6,+     G           0.E0, 1.E0,+     H           0.E0,0.E0,15.E0,10.E0,-1.E0, 5.E-5, 0.E0,1.E0,0.E0,+     I           0.E0,0.E0, 15.E0, 10.E0, -1. E0, 5.E5, -4096.E0,+     J           1.E0, 4096.E-6,+     K           0.E0,0.E0, 7.E0, 4.E0, 0.E0,0.E0, -.5E0, -.25E0, 0.E0/+*                   4096 = 2 ** 12+      DATA D12  /4096.E0/+      DTRUE(1,1) = 12.E0 / 130.E0+      DTRUE(2,1) = 36.E0 / 130.E0+      DTRUE(7,1) = -1.E0 / 6.E0+      DTRUE(1,2) = 14.E0 / 75.E0+      DTRUE(2,2) = 49.E0 / 75.E0+      DTRUE(9,2) = 1.E0 / 7.E0+      DTRUE(1,5) = 45.E-11 * (D12 * D12)+      DTRUE(3,5) = 4.E5 / (3.E0 * D12)+      DTRUE(6,5) = 1.E0 / D12+      DTRUE(8,5) = 1.E4 / (3.E0 * D12)+      DTRUE(1,6) = 4.E10 / (1.5E0 * D12 * D12)+      DTRUE(2,6) = 2.E-2 / 1.5E0+      DTRUE(8,6) = 5.E-7 * D12+      DTRUE(1,7) = 4.E0 / 150.E0+      DTRUE(2,7) = (2.E-10 / 1.5E0) * (D12 * D12)+      DTRUE(7,7) = -DTRUE(6,5)+      DTRUE(9,7) = 1.E4 / D12+      DTRUE(1,8) = DTRUE(1,7)+      DTRUE(2,8) = 2.E10 / (1.5E0 * D12 * D12)+      DTRUE(1,9) = 32.E0 / 7.E0+      DTRUE(2,9) = -16.E0 / 7.E0+*     .. Executable Statements ..+*+*     Compute true values which cannot be prestored+*     in decimal notation+*+      DBTRUE(1) = 1.0E0/0.6E0+      DBTRUE(3) = -1.0E0/0.6E0+      DBTRUE(5) = 1.0E0/0.6E0+*+      DO 20 K = 1, 8+*        .. Set N=K for identification in output if any ..+         N = K+         IF (ICASE.EQ.3) THEN+*           .. SROTG ..+            IF (K.GT.8) GO TO 40+            SA = DA1(K)+            SB = DB1(K)+            CALL SROTG(SA,SB,SC,SS)+            CALL STEST1(SA,DATRUE(K),DATRUE(K),SFAC)+            CALL STEST1(SB,DBTRUE(K),DBTRUE(K),SFAC)+            CALL STEST1(SC,DC1(K),DC1(K),SFAC)+            CALL STEST1(SS,DS1(K),DS1(K),SFAC)+         ELSEIF (ICASE.EQ.11) THEN+*           .. SROTMG ..+            DO I=1,4+               DTEMP(I)= DAB(I,K)+               DTEMP(I+4) = 0.0+            END DO+            DTEMP(9) = 0.0+            CALL SROTMG(DTEMP(1),DTEMP(2),DTEMP(3),DTEMP(4),DTEMP(5))+            CALL STEST(9,DTEMP,DTRUE(1,K),DTRUE(1,K),SFAC)+         ELSE+            WRITE (NOUT,*) ' Shouldn''t be here in CHECK0'+            STOP+         END IF+   20 CONTINUE+   40 RETURN+      END+      SUBROUTINE CHECK1(SFAC)+*     .. Parameters ..+      INTEGER           NOUT+      PARAMETER         (NOUT=6)+*     .. Scalar Arguments ..+      REAL              SFAC+*     .. Scalars in Common ..+      INTEGER           ICASE, INCX, INCY, N+      LOGICAL           PASS+*     .. Local Scalars ..+      INTEGER           I, LEN, NP1+*     .. Local Arrays ..+      REAL              DTRUE1(5), DTRUE3(5), DTRUE5(8,5,2), DV(8,5,2),+     +                  SA(10), STEMP(1), STRUE(8), SX(8)+      INTEGER           ITRUE2(5)+*     .. External Functions ..+      REAL              SASUM, SNRM2+      INTEGER           ISAMAX+      EXTERNAL          SASUM, SNRM2, ISAMAX+*     .. External Subroutines ..+      EXTERNAL          ITEST1, SSCAL, STEST, STEST1+*     .. Intrinsic Functions ..+      INTRINSIC         MAX+*     .. Common blocks ..+      COMMON            /COMBLA/ICASE, N, INCX, INCY, PASS+*     .. Data statements ..+      DATA              SA/0.3E0, -1.0E0, 0.0E0, 1.0E0, 0.3E0, 0.3E0,+     +                  0.3E0, 0.3E0, 0.3E0, 0.3E0/+      DATA              DV/0.1E0, 2.0E0, 2.0E0, 2.0E0, 2.0E0, 2.0E0,+     +                  2.0E0, 2.0E0, 0.3E0, 3.0E0, 3.0E0, 3.0E0, 3.0E0,+     +                  3.0E0, 3.0E0, 3.0E0, 0.3E0, -0.4E0, 4.0E0,+     +                  4.0E0, 4.0E0, 4.0E0, 4.0E0, 4.0E0, 0.2E0,+     +                  -0.6E0, 0.3E0, 5.0E0, 5.0E0, 5.0E0, 5.0E0,+     +                  5.0E0, 0.1E0, -0.3E0, 0.5E0, -0.1E0, 6.0E0,+     +                  6.0E0, 6.0E0, 6.0E0, 0.1E0, 8.0E0, 8.0E0, 8.0E0,+     +                  8.0E0, 8.0E0, 8.0E0, 8.0E0, 0.3E0, 9.0E0, 9.0E0,+     +                  9.0E0, 9.0E0, 9.0E0, 9.0E0, 9.0E0, 0.3E0, 2.0E0,+     +                  -0.4E0, 2.0E0, 2.0E0, 2.0E0, 2.0E0, 2.0E0,+     +                  0.2E0, 3.0E0, -0.6E0, 5.0E0, 0.3E0, 2.0E0,+     +                  2.0E0, 2.0E0, 0.1E0, 4.0E0, -0.3E0, 6.0E0,+     +                  -0.5E0, 7.0E0, -0.1E0, 3.0E0/+      DATA              DTRUE1/0.0E0, 0.3E0, 0.5E0, 0.7E0, 0.6E0/+      DATA              DTRUE3/0.0E0, 0.3E0, 0.7E0, 1.1E0, 1.0E0/+      DATA              DTRUE5/0.10E0, 2.0E0, 2.0E0, 2.0E0, 2.0E0,+     +                  2.0E0, 2.0E0, 2.0E0, -0.3E0, 3.0E0, 3.0E0,+     +                  3.0E0, 3.0E0, 3.0E0, 3.0E0, 3.0E0, 0.0E0, 0.0E0,+     +                  4.0E0, 4.0E0, 4.0E0, 4.0E0, 4.0E0, 4.0E0,+     +                  0.20E0, -0.60E0, 0.30E0, 5.0E0, 5.0E0, 5.0E0,+     +                  5.0E0, 5.0E0, 0.03E0, -0.09E0, 0.15E0, -0.03E0,+     +                  6.0E0, 6.0E0, 6.0E0, 6.0E0, 0.10E0, 8.0E0,+     +                  8.0E0, 8.0E0, 8.0E0, 8.0E0, 8.0E0, 8.0E0,+     +                  0.09E0, 9.0E0, 9.0E0, 9.0E0, 9.0E0, 9.0E0,+     +                  9.0E0, 9.0E0, 0.09E0, 2.0E0, -0.12E0, 2.0E0,+     +                  2.0E0, 2.0E0, 2.0E0, 2.0E0, 0.06E0, 3.0E0,+     +                  -0.18E0, 5.0E0, 0.09E0, 2.0E0, 2.0E0, 2.0E0,+     +                  0.03E0, 4.0E0, -0.09E0, 6.0E0, -0.15E0, 7.0E0,+     +                  -0.03E0, 3.0E0/+      DATA              ITRUE2/0, 1, 2, 2, 3/+*     .. Executable Statements ..+      DO 80 INCX = 1, 2+         DO 60 NP1 = 1, 5+            N = NP1 - 1+            LEN = 2*MAX(N,1)+*           .. Set vector arguments ..+            DO 20 I = 1, LEN+               SX(I) = DV(I,NP1,INCX)+   20       CONTINUE+*+            IF (ICASE.EQ.7) THEN+*              .. SNRM2 ..+               STEMP(1) = DTRUE1(NP1)+               CALL STEST1(SNRM2(N,SX,INCX),STEMP(1),STEMP,SFAC)+            ELSE IF (ICASE.EQ.8) THEN+*              .. SASUM ..+               STEMP(1) = DTRUE3(NP1)+               CALL STEST1(SASUM(N,SX,INCX),STEMP(1),STEMP,SFAC)+            ELSE IF (ICASE.EQ.9) THEN+*              .. SSCAL ..+               CALL SSCAL(N,SA((INCX-1)*5+NP1),SX,INCX)+               DO 40 I = 1, LEN+                  STRUE(I) = DTRUE5(I,NP1,INCX)+   40          CONTINUE+               CALL STEST(LEN,SX,STRUE,STRUE,SFAC)+            ELSE IF (ICASE.EQ.10) THEN+*              .. ISAMAX ..+               CALL ITEST1(ISAMAX(N,SX,INCX),ITRUE2(NP1))+            ELSE+               WRITE (NOUT,*) ' Shouldn''t be here in CHECK1'+               STOP+            END IF+   60    CONTINUE+   80 CONTINUE+      RETURN+      END+      SUBROUTINE CHECK2(SFAC)+*     .. Parameters ..+      INTEGER           NOUT+      PARAMETER         (NOUT=6)+*     .. Scalar Arguments ..+      REAL              SFAC+*     .. Scalars in Common ..+      INTEGER           ICASE, INCX, INCY, N+      LOGICAL           PASS+*     .. Local Scalars ..+      REAL              SA+      INTEGER           I, J, KI, KN, KNI, KPAR, KSIZE, LENX, LENY,+     $                  MX, MY +*     .. Local Arrays ..+      REAL              DT10X(7,4,4), DT10Y(7,4,4), DT7(4,4),+     $                  DT8(7,4,4), DX1(7),+     $                  DY1(7), SSIZE1(4), SSIZE2(14,2), SSIZE3(4),+     $                  SSIZE(7), STX(7), STY(7), SX(7), SY(7),+     $                  DPAR(5,4), DT19X(7,4,16),DT19XA(7,4,4),+     $                  DT19XB(7,4,4), DT19XC(7,4,4),DT19XD(7,4,4),+     $                  DT19Y(7,4,16), DT19YA(7,4,4),DT19YB(7,4,4),+     $                  DT19YC(7,4,4), DT19YD(7,4,4), DTEMP(5),+     $                  ST7B(4,4)+      INTEGER           INCXS(4), INCYS(4), LENS(4,2), NS(4)+*     .. External Functions ..+      REAL              SDOT, SDSDOT+      EXTERNAL          SDOT, SDSDOT+*     .. External Subroutines ..+      EXTERNAL          SAXPY, SCOPY, SROTM, SSWAP, STEST, STEST1+*     .. Intrinsic Functions ..+      INTRINSIC         ABS, MIN+*     .. Common blocks ..+      COMMON            /COMBLA/ICASE, N, INCX, INCY, PASS+*     .. Data statements ..+      EQUIVALENCE (DT19X(1,1,1),DT19XA(1,1,1)),(DT19X(1,1,5),+     A   DT19XB(1,1,1)),(DT19X(1,1,9),DT19XC(1,1,1)),+     B   (DT19X(1,1,13),DT19XD(1,1,1))+      EQUIVALENCE (DT19Y(1,1,1),DT19YA(1,1,1)),(DT19Y(1,1,5),+     A   DT19YB(1,1,1)),(DT19Y(1,1,9),DT19YC(1,1,1)),+     B   (DT19Y(1,1,13),DT19YD(1,1,1))++      DATA              SA/0.3E0/+      DATA              INCXS/1, 2, -2, -1/+      DATA              INCYS/1, -2, 1, -2/+      DATA              LENS/1, 1, 2, 4, 1, 1, 3, 7/+      DATA              NS/0, 1, 2, 4/+      DATA              DX1/0.6E0, 0.1E0, -0.5E0, 0.8E0, 0.9E0, -0.3E0,+     +                  -0.4E0/+      DATA              DY1/0.5E0, -0.9E0, 0.3E0, 0.7E0, -0.6E0, 0.2E0,+     +                  0.8E0/+      DATA              DT7/0.0E0, 0.30E0, 0.21E0, 0.62E0, 0.0E0,+     +                  0.30E0, -0.07E0, 0.85E0, 0.0E0, 0.30E0, -0.79E0,+     +                  -0.74E0, 0.0E0, 0.30E0, 0.33E0, 1.27E0/+      DATA              ST7B/ .1, .4, .31, .72,     .1, .4, .03, .95,+     +                  .1, .4, -.69, -.64,   .1, .4, .43, 1.37/+      DATA              DT8/0.5E0, 0.0E0, 0.0E0, 0.0E0, 0.0E0, 0.0E0,+     +                  0.0E0, 0.68E0, 0.0E0, 0.0E0, 0.0E0, 0.0E0,+     +                  0.0E0, 0.0E0, 0.68E0, -0.87E0, 0.0E0, 0.0E0,+     +                  0.0E0, 0.0E0, 0.0E0, 0.68E0, -0.87E0, 0.15E0,+     +                  0.94E0, 0.0E0, 0.0E0, 0.0E0, 0.5E0, 0.0E0,+     +                  0.0E0, 0.0E0, 0.0E0, 0.0E0, 0.0E0, 0.68E0,+     +                  0.0E0, 0.0E0, 0.0E0, 0.0E0, 0.0E0, 0.0E0,+     +                  0.35E0, -0.9E0, 0.48E0, 0.0E0, 0.0E0, 0.0E0,+     +                  0.0E0, 0.38E0, -0.9E0, 0.57E0, 0.7E0, -0.75E0,+     +                  0.2E0, 0.98E0, 0.5E0, 0.0E0, 0.0E0, 0.0E0,+     +                  0.0E0, 0.0E0, 0.0E0, 0.68E0, 0.0E0, 0.0E0,+     +                  0.0E0, 0.0E0, 0.0E0, 0.0E0, 0.35E0, -0.72E0,+     +                  0.0E0, 0.0E0, 0.0E0, 0.0E0, 0.0E0, 0.38E0,+     +                  -0.63E0, 0.15E0, 0.88E0, 0.0E0, 0.0E0, 0.0E0,+     +                  0.5E0, 0.0E0, 0.0E0, 0.0E0, 0.0E0, 0.0E0, 0.0E0,+     +                  0.68E0, 0.0E0, 0.0E0, 0.0E0, 0.0E0, 0.0E0,+     +                  0.0E0, 0.68E0, -0.9E0, 0.33E0, 0.0E0, 0.0E0,+     +                  0.0E0, 0.0E0, 0.68E0, -0.9E0, 0.33E0, 0.7E0,+     +                  -0.75E0, 0.2E0, 1.04E0/+      DATA              DT10X/0.6E0, 0.0E0, 0.0E0, 0.0E0, 0.0E0, 0.0E0,+     +                  0.0E0, 0.5E0, 0.0E0, 0.0E0, 0.0E0, 0.0E0, 0.0E0,+     +                  0.0E0, 0.5E0, -0.9E0, 0.0E0, 0.0E0, 0.0E0,+     +                  0.0E0, 0.0E0, 0.5E0, -0.9E0, 0.3E0, 0.7E0,+     +                  0.0E0, 0.0E0, 0.0E0, 0.6E0, 0.0E0, 0.0E0, 0.0E0,+     +                  0.0E0, 0.0E0, 0.0E0, 0.5E0, 0.0E0, 0.0E0, 0.0E0,+     +                  0.0E0, 0.0E0, 0.0E0, 0.3E0, 0.1E0, 0.5E0, 0.0E0,+     +                  0.0E0, 0.0E0, 0.0E0, 0.8E0, 0.1E0, -0.6E0,+     +                  0.8E0, 0.3E0, -0.3E0, 0.5E0, 0.6E0, 0.0E0,+     +                  0.0E0, 0.0E0, 0.0E0, 0.0E0, 0.0E0, 0.5E0, 0.0E0,+     +                  0.0E0, 0.0E0, 0.0E0, 0.0E0, 0.0E0, -0.9E0,+     +                  0.1E0, 0.5E0, 0.0E0, 0.0E0, 0.0E0, 0.0E0, 0.7E0,+     +                  0.1E0, 0.3E0, 0.8E0, -0.9E0, -0.3E0, 0.5E0,+     +                  0.6E0, 0.0E0, 0.0E0, 0.0E0, 0.0E0, 0.0E0, 0.0E0,+     +                  0.5E0, 0.0E0, 0.0E0, 0.0E0, 0.0E0, 0.0E0, 0.0E0,+     +                  0.5E0, 0.3E0, 0.0E0, 0.0E0, 0.0E0, 0.0E0, 0.0E0,+     +                  0.5E0, 0.3E0, -0.6E0, 0.8E0, 0.0E0, 0.0E0,+     +                  0.0E0/+      DATA              DT10Y/0.5E0, 0.0E0, 0.0E0, 0.0E0, 0.0E0, 0.0E0,+     +                  0.0E0, 0.6E0, 0.0E0, 0.0E0, 0.0E0, 0.0E0, 0.0E0,+     +                  0.0E0, 0.6E0, 0.1E0, 0.0E0, 0.0E0, 0.0E0, 0.0E0,+     +                  0.0E0, 0.6E0, 0.1E0, -0.5E0, 0.8E0, 0.0E0,+     +                  0.0E0, 0.0E0, 0.5E0, 0.0E0, 0.0E0, 0.0E0, 0.0E0,+     +                  0.0E0, 0.0E0, 0.6E0, 0.0E0, 0.0E0, 0.0E0, 0.0E0,+     +                  0.0E0, 0.0E0, -0.5E0, -0.9E0, 0.6E0, 0.0E0,+     +                  0.0E0, 0.0E0, 0.0E0, -0.4E0, -0.9E0, 0.9E0,+     +                  0.7E0, -0.5E0, 0.2E0, 0.6E0, 0.5E0, 0.0E0,+     +                  0.0E0, 0.0E0, 0.0E0, 0.0E0, 0.0E0, 0.6E0, 0.0E0,+     +                  0.0E0, 0.0E0, 0.0E0, 0.0E0, 0.0E0, -0.5E0,+     +                  0.6E0, 0.0E0, 0.0E0, 0.0E0, 0.0E0, 0.0E0,+     +                  -0.4E0, 0.9E0, -0.5E0, 0.6E0, 0.0E0, 0.0E0,+     +                  0.0E0, 0.5E0, 0.0E0, 0.0E0, 0.0E0, 0.0E0, 0.0E0,+     +                  0.0E0, 0.6E0, 0.0E0, 0.0E0, 0.0E0, 0.0E0, 0.0E0,+     +                  0.0E0, 0.6E0, -0.9E0, 0.1E0, 0.0E0, 0.0E0,+     +                  0.0E0, 0.0E0, 0.6E0, -0.9E0, 0.1E0, 0.7E0,+     +                  -0.5E0, 0.2E0, 0.8E0/+      DATA              SSIZE1/0.0E0, 0.3E0, 1.6E0, 3.2E0/+      DATA              SSIZE2/0.0E0, 0.0E0, 0.0E0, 0.0E0, 0.0E0, 0.0E0,+     +                  0.0E0, 0.0E0, 0.0E0, 0.0E0, 0.0E0, 0.0E0, 0.0E0,+     +                  0.0E0, 1.17E0, 1.17E0, 1.17E0, 1.17E0, 1.17E0,+     +                  1.17E0, 1.17E0, 1.17E0, 1.17E0, 1.17E0, 1.17E0,+     +                  1.17E0, 1.17E0, 1.17E0/+      DATA              SSIZE3/ .1, .4, 1.7, 3.3 /+*+*                         FOR DROTM+*+      DATA DPAR/-2.E0,  0.E0,0.E0,0.E0,0.E0,+     A          -1.E0,  2.E0, -3.E0, -4.E0,  5.E0,+     B           0.E0,  0.E0,  2.E0, -3.E0,  0.E0,+     C           1.E0,  5.E0,  2.E0,  0.E0, -4.E0/+*                        TRUE X RESULTS F0R ROTATIONS DROTM+      DATA DT19XA/.6E0,                  0.E0,0.E0,0.E0,0.E0,0.E0,0.E0,+     A            .6E0,                  0.E0,0.E0,0.E0,0.E0,0.E0,0.E0,+     B            .6E0,                  0.E0,0.E0,0.E0,0.E0,0.E0,0.E0,+     C            .6E0,                  0.E0,0.E0,0.E0,0.E0,0.E0,0.E0,+     D            .6E0,                  0.E0,0.E0,0.E0,0.E0,0.E0,0.E0,+     E           -.8E0,                  0.E0,0.E0,0.E0,0.E0,0.E0,0.E0,+     F           -.9E0,                  0.E0,0.E0,0.E0,0.E0,0.E0,0.E0,+     G           3.5E0,                  0.E0,0.E0,0.E0,0.E0,0.E0,0.E0,+     H            .6E0,   .1E0,             0.E0,0.E0,0.E0,0.E0,0.E0,+     I           -.8E0,  3.8E0,             0.E0,0.E0,0.E0,0.E0,0.E0,+     J           -.9E0,  2.8E0,             0.E0,0.E0,0.E0,0.E0,0.E0,+     K           3.5E0,  -.4E0,             0.E0,0.E0,0.E0,0.E0,0.E0,+     L            .6E0,   .1E0,  -.5E0,   .8E0,          0.E0,0.E0,0.E0,+     M           -.8E0,  3.8E0, -2.2E0, -1.2E0,          0.E0,0.E0,0.E0,+     N           -.9E0,  2.8E0, -1.4E0, -1.3E0,          0.E0,0.E0,0.E0,+     O           3.5E0,  -.4E0, -2.2E0,  4.7E0,          0.E0,0.E0,0.E0/+*+      DATA DT19XB/.6E0,                  0.E0,0.E0,0.E0,0.E0,0.E0,0.E0,+     A            .6E0,                  0.E0,0.E0,0.E0,0.E0,0.E0,0.E0,+     B            .6E0,                  0.E0,0.E0,0.E0,0.E0,0.E0,0.E0,+     C            .6E0,                  0.E0,0.E0,0.E0,0.E0,0.E0,0.E0,+     D            .6E0,                  0.E0,0.E0,0.E0,0.E0,0.E0,0.E0,+     E           -.8E0,                  0.E0,0.E0,0.E0,0.E0,0.E0,0.E0,+     F           -.9E0,                  0.E0,0.E0,0.E0,0.E0,0.E0,0.E0,+     G           3.5E0,                  0.E0,0.E0,0.E0,0.E0,0.E0,0.E0,+     H            .6E0,   .1E0,  -.5E0,             0.E0,0.E0,0.E0,0.E0,+     I           0.E0,    .1E0, -3.0E0,             0.E0,0.E0,0.E0,0.E0,+     J           -.3E0,   .1E0, -2.0E0,             0.E0,0.E0,0.E0,0.E0,+     K           3.3E0,   .1E0, -2.0E0,             0.E0,0.E0,0.E0,0.E0,+     L            .6E0,   .1E0,  -.5E0,   .8E0,   .9E0,  -.3E0,  -.4E0,+     M          -2.0E0,   .1E0,  1.4E0,   .8E0,   .6E0,  -.3E0, -2.8E0,+     N          -1.8E0,   .1E0,  1.3E0,   .8E0,  0.E0,   -.3E0, -1.9E0,+     O           3.8E0,   .1E0, -3.1E0,   .8E0,  4.8E0,  -.3E0, -1.5E0 /+*+      DATA DT19XC/.6E0,                  0.E0,0.E0,0.E0,0.E0,0.E0,0.E0,+     A            .6E0,                  0.E0,0.E0,0.E0,0.E0,0.E0,0.E0,+     B            .6E0,                  0.E0,0.E0,0.E0,0.E0,0.E0,0.E0,+     C            .6E0,                  0.E0,0.E0,0.E0,0.E0,0.E0,0.E0,+     D            .6E0,                  0.E0,0.E0,0.E0,0.E0,0.E0,0.E0,+     E           -.8E0,                  0.E0,0.E0,0.E0,0.E0,0.E0,0.E0,+     F           -.9E0,                  0.E0,0.E0,0.E0,0.E0,0.E0,0.E0,+     G           3.5E0,                  0.E0,0.E0,0.E0,0.E0,0.E0,0.E0,+     H            .6E0,   .1E0,  -.5E0,             0.E0,0.E0,0.E0,0.E0,+     I           4.8E0,   .1E0, -3.0E0,             0.E0,0.E0,0.E0,0.E0,+     J           3.3E0,   .1E0, -2.0E0,             0.E0,0.E0,0.E0,0.E0,+     K           2.1E0,   .1E0, -2.0E0,             0.E0,0.E0,0.E0,0.E0,+     L            .6E0,   .1E0,  -.5E0,   .8E0,   .9E0,  -.3E0,  -.4E0,+     M          -1.6E0,   .1E0, -2.2E0,   .8E0,  5.4E0,  -.3E0, -2.8E0,+     N          -1.5E0,   .1E0, -1.4E0,   .8E0,  3.6E0,  -.3E0, -1.9E0,+     O           3.7E0,   .1E0, -2.2E0,   .8E0,  3.6E0,  -.3E0, -1.5E0 /+*+      DATA DT19XD/.6E0,                  0.E0,0.E0,0.E0,0.E0,0.E0,0.E0,+     A            .6E0,                  0.E0,0.E0,0.E0,0.E0,0.E0,0.E0,+     B            .6E0,                  0.E0,0.E0,0.E0,0.E0,0.E0,0.E0,+     C            .6E0,                  0.E0,0.E0,0.E0,0.E0,0.E0,0.E0,+     D            .6E0,                  0.E0,0.E0,0.E0,0.E0,0.E0,0.E0,+     E           -.8E0,                  0.E0,0.E0,0.E0,0.E0,0.E0,0.E0,+     F           -.9E0,                  0.E0,0.E0,0.E0,0.E0,0.E0,0.E0,+     G           3.5E0,                  0.E0,0.E0,0.E0,0.E0,0.E0,0.E0,+     H            .6E0,   .1E0,             0.E0,0.E0,0.E0,0.E0,0.E0,+     I           -.8E0, -1.0E0,             0.E0,0.E0,0.E0,0.E0,0.E0,+     J           -.9E0,  -.8E0,             0.E0,0.E0,0.E0,0.E0,0.E0,+     K           3.5E0,   .8E0,             0.E0,0.E0,0.E0,0.E0,0.E0,+     L            .6E0,   .1E0,  -.5E0,   .8E0,          0.E0,0.E0,0.E0,+     M           -.8E0, -1.0E0,  1.4E0, -1.6E0,          0.E0,0.E0,0.E0,+     N           -.9E0,  -.8E0,  1.3E0, -1.6E0,          0.E0,0.E0,0.E0,+     O           3.5E0,   .8E0, -3.1E0,  4.8E0,          0.E0,0.E0,0.E0/+*                        TRUE Y RESULTS FOR ROTATIONS DROTM+      DATA DT19YA/.5E0,                  0.E0,0.E0,0.E0,0.E0,0.E0,0.E0,+     A            .5E0,                  0.E0,0.E0,0.E0,0.E0,0.E0,0.E0,+     B            .5E0,                  0.E0,0.E0,0.E0,0.E0,0.E0,0.E0,+     C            .5E0,                  0.E0,0.E0,0.E0,0.E0,0.E0,0.E0,+     D            .5E0,                  0.E0,0.E0,0.E0,0.E0,0.E0,0.E0,+     E            .7E0,                  0.E0,0.E0,0.E0,0.E0,0.E0,0.E0,+     F           1.7E0,                  0.E0,0.E0,0.E0,0.E0,0.E0,0.E0,+     G          -2.6E0,                  0.E0,0.E0,0.E0,0.E0,0.E0,0.E0,+     H            .5E0,  -.9E0,             0.E0,0.E0,0.E0,0.E0,0.E0,+     I            .7E0, -4.8E0,             0.E0,0.E0,0.E0,0.E0,0.E0,+     J           1.7E0,  -.7E0,             0.E0,0.E0,0.E0,0.E0,0.E0,+     K          -2.6E0,  3.5E0,             0.E0,0.E0,0.E0,0.E0,0.E0,+     L            .5E0,  -.9E0,   .3E0,   .7E0,          0.E0,0.E0,0.E0,+     M            .7E0, -4.8E0,  3.0E0,  1.1E0,          0.E0,0.E0,0.E0,+     N           1.7E0,  -.7E0,  -.7E0,  2.3E0,          0.E0,0.E0,0.E0,+     O          -2.6E0,  3.5E0,  -.7E0, -3.6E0,          0.E0,0.E0,0.E0/+*+      DATA DT19YB/.5E0,                  0.E0,0.E0,0.E0,0.E0,0.E0,0.E0,+     A            .5E0,                  0.E0,0.E0,0.E0,0.E0,0.E0,0.E0,+     B            .5E0,                  0.E0,0.E0,0.E0,0.E0,0.E0,0.E0,+     C            .5E0,                  0.E0,0.E0,0.E0,0.E0,0.E0,0.E0,+     D            .5E0,                  0.E0,0.E0,0.E0,0.E0,0.E0,0.E0,+     E            .7E0,                  0.E0,0.E0,0.E0,0.E0,0.E0,0.E0,+     F           1.7E0,                  0.E0,0.E0,0.E0,0.E0,0.E0,0.E0,+     G          -2.6E0,                  0.E0,0.E0,0.E0,0.E0,0.E0,0.E0,+     H            .5E0,  -.9E0,   .3E0,             0.E0,0.E0,0.E0,0.E0,+     I           4.0E0,  -.9E0,  -.3E0,             0.E0,0.E0,0.E0,0.E0,+     J           -.5E0,  -.9E0,  1.5E0,             0.E0,0.E0,0.E0,0.E0,+     K          -1.5E0,  -.9E0, -1.8E0,             0.E0,0.E0,0.E0,0.E0,+     L            .5E0,  -.9E0,   .3E0,   .7E0,  -.6E0,   .2E0,   .8E0,+     M           3.7E0,  -.9E0, -1.2E0,   .7E0, -1.5E0,   .2E0,  2.2E0,+     N           -.3E0,  -.9E0,  2.1E0,   .7E0, -1.6E0,   .2E0,  2.0E0,+     O          -1.6E0,  -.9E0, -2.1E0,   .7E0,  2.9E0,   .2E0, -3.8E0 /+*+      DATA DT19YC/.5E0,                  0.E0,0.E0,0.E0,0.E0,0.E0,0.E0,+     A            .5E0,                  0.E0,0.E0,0.E0,0.E0,0.E0,0.E0,+     B            .5E0,                  0.E0,0.E0,0.E0,0.E0,0.E0,0.E0,+     C            .5E0,                  0.E0,0.E0,0.E0,0.E0,0.E0,0.E0,+     D            .5E0,                  0.E0,0.E0,0.E0,0.E0,0.E0,0.E0,+     E            .7E0,                  0.E0,0.E0,0.E0,0.E0,0.E0,0.E0,+     F           1.7E0,                  0.E0,0.E0,0.E0,0.E0,0.E0,0.E0,+     G          -2.6E0,                  0.E0,0.E0,0.E0,0.E0,0.E0,0.E0,+     H            .5E0,  -.9E0,             0.E0,0.E0,0.E0,0.E0,0.E0,+     I           4.0E0, -6.3E0,             0.E0,0.E0,0.E0,0.E0,0.E0,+     J           -.5E0,   .3E0,             0.E0,0.E0,0.E0,0.E0,0.E0,+     K          -1.5E0,  3.0E0,             0.E0,0.E0,0.E0,0.E0,0.E0,+     L            .5E0,  -.9E0,   .3E0,   .7E0,          0.E0,0.E0,0.E0,+     M           3.7E0, -7.2E0,  3.0E0,  1.7E0,          0.E0,0.E0,0.E0,+     N           -.3E0,   .9E0,  -.7E0,  1.9E0,          0.E0,0.E0,0.E0,+     O          -1.6E0,  2.7E0,  -.7E0, -3.4E0,          0.E0,0.E0,0.E0/+*+      DATA DT19YD/.5E0,                  0.E0,0.E0,0.E0,0.E0,0.E0,0.E0,+     A            .5E0,                  0.E0,0.E0,0.E0,0.E0,0.E0,0.E0,+     B            .5E0,                  0.E0,0.E0,0.E0,0.E0,0.E0,0.E0,+     C            .5E0,                  0.E0,0.E0,0.E0,0.E0,0.E0,0.E0,+     D            .5E0,                  0.E0,0.E0,0.E0,0.E0,0.E0,0.E0,+     E            .7E0,                  0.E0,0.E0,0.E0,0.E0,0.E0,0.E0,+     F           1.7E0,                  0.E0,0.E0,0.E0,0.E0,0.E0,0.E0,+     G          -2.6E0,                  0.E0,0.E0,0.E0,0.E0,0.E0,0.E0,+     H            .5E0,  -.9E0,   .3E0,             0.E0,0.E0,0.E0,0.E0,+     I            .7E0,  -.9E0,  1.2E0,             0.E0,0.E0,0.E0,0.E0,+     J           1.7E0,  -.9E0,   .5E0,             0.E0,0.E0,0.E0,0.E0,+     K          -2.6E0,  -.9E0, -1.3E0,             0.E0,0.E0,0.E0,0.E0,+     L            .5E0,  -.9E0,   .3E0,   .7E0,  -.6E0,   .2E0,   .8E0,+     M            .7E0,  -.9E0,  1.2E0,   .7E0, -1.5E0,   .2E0,  1.6E0,+     N           1.7E0,  -.9E0,   .5E0,   .7E0, -1.6E0,   .2E0,  2.4E0,+     O          -2.6E0,  -.9E0, -1.3E0,   .7E0,  2.9E0,   .2E0, -4.0E0 /+*+*     .. Executable Statements ..+*+      DO 120 KI = 1, 4+         INCX = INCXS(KI)+         INCY = INCYS(KI)+         MX = ABS(INCX)+         MY = ABS(INCY)+*+         DO 100 KN = 1, 4+            N = NS(KN)+            KSIZE = MIN(2,KN)+            LENX = LENS(KN,MX)+            LENY = LENS(KN,MY)+*           .. Initialize all argument arrays ..+            DO 20 I = 1, 7+               SX(I) = DX1(I)+               SY(I) = DY1(I)+   20       CONTINUE+*+            IF (ICASE.EQ.1) THEN+*              .. SDOT ..+               CALL STEST1(SDOT(N,SX,INCX,SY,INCY),DT7(KN,KI),SSIZE1(KN)+     +                     ,SFAC)+            ELSE IF (ICASE.EQ.2) THEN+*              .. SAXPY ..+               CALL SAXPY(N,SA,SX,INCX,SY,INCY)+               DO 40 J = 1, LENY+                  STY(J) = DT8(J,KN,KI)+   40          CONTINUE+               CALL STEST(LENY,SY,STY,SSIZE2(1,KSIZE),SFAC)+            ELSE IF (ICASE.EQ.5) THEN+*              .. SCOPY ..+               DO 60 I = 1, 7+                  STY(I) = DT10Y(I,KN,KI)+   60          CONTINUE+               CALL SCOPY(N,SX,INCX,SY,INCY)+               CALL STEST(LENY,SY,STY,SSIZE2(1,1),1.0E0)+            ELSE IF (ICASE.EQ.6) THEN+*              .. SSWAP ..+               CALL SSWAP(N,SX,INCX,SY,INCY)+               DO 80 I = 1, 7+                  STX(I) = DT10X(I,KN,KI)+                  STY(I) = DT10Y(I,KN,KI)+   80          CONTINUE+               CALL STEST(LENX,SX,STX,SSIZE2(1,1),1.0E0)+               CALL STEST(LENY,SY,STY,SSIZE2(1,1),1.0E0)+            ELSEIF (ICASE.EQ.12) THEN+*              .. SROTM ..+               KNI=KN+4*(KI-1)+               DO KPAR=1,4+                  DO I=1,7+                     SX(I) = DX1(I)+                     SY(I) = DY1(I)+                     STX(I)= DT19X(I,KPAR,KNI)+                     STY(I)= DT19Y(I,KPAR,KNI)+                  END DO+*+                  DO I=1,5+                     DTEMP(I) = DPAR(I,KPAR)+                  END DO+*+                  DO  I=1,LENX+                     SSIZE(I)=STX(I)+                  END DO+*                   SEE REMARK ABOVE ABOUT DT11X(1,2,7)+*                       AND DT11X(5,3,8).+                  IF ((KPAR .EQ. 2) .AND. (KNI .EQ. 7))+     $               SSIZE(1) = 2.4E0+                  IF ((KPAR .EQ. 3) .AND. (KNI .EQ. 8))+     $               SSIZE(5) = 1.8E0+*+                  CALL   SROTM(N,SX,INCX,SY,INCY,DTEMP)+                  CALL   STEST(LENX,SX,STX,SSIZE,SFAC)+                  CALL   STEST(LENY,SY,STY,STY,SFAC)+               END DO+            ELSEIF (ICASE.EQ.13) THEN+*              .. SDSROT ..+               CALL STEST1 (SDSDOT(N,.1,SX,INCX,SY,INCY),+     $                 ST7B(KN,KI),SSIZE3(KN),SFAC)+            ELSE+               WRITE (NOUT,*) ' Shouldn''t be here in CHECK2'+               STOP+            END IF+  100    CONTINUE+  120 CONTINUE+      RETURN+      END+      SUBROUTINE CHECK3(SFAC)+*     .. Parameters ..+      INTEGER           NOUT+      PARAMETER         (NOUT=6)+*     .. Scalar Arguments ..+      REAL              SFAC+*     .. Scalars in Common ..+      INTEGER           ICASE, INCX, INCY, N+      LOGICAL           PASS+*     .. Local Scalars ..+      REAL              SC, SS+      INTEGER           I, K, KI, KN, KSIZE, LENX, LENY, MX, MY+*     .. Local Arrays ..+      REAL              COPYX(5), COPYY(5), DT9X(7,4,4), DT9Y(7,4,4),+     +                  DX1(7), DY1(7), MWPC(11), MWPS(11), MWPSTX(5),+     +                  MWPSTY(5), MWPTX(11,5), MWPTY(11,5), MWPX(5),+     +                  MWPY(5), SSIZE2(14,2), STX(7), STY(7), SX(7),+     +                  SY(7)+      INTEGER           INCXS(4), INCYS(4), LENS(4,2), MWPINX(11),+     +                  MWPINY(11), MWPN(11), NS(4)+*     .. External Subroutines ..+      EXTERNAL          SROT, STEST+*     .. Intrinsic Functions ..+      INTRINSIC         ABS, MIN+*     .. Common blocks ..+      COMMON            /COMBLA/ICASE, N, INCX, INCY, PASS+*     .. Data statements ..+      DATA              INCXS/1, 2, -2, -1/+      DATA              INCYS/1, -2, 1, -2/+      DATA              LENS/1, 1, 2, 4, 1, 1, 3, 7/+      DATA              NS/0, 1, 2, 4/+      DATA              DX1/0.6E0, 0.1E0, -0.5E0, 0.8E0, 0.9E0, -0.3E0,+     +                  -0.4E0/+      DATA              DY1/0.5E0, -0.9E0, 0.3E0, 0.7E0, -0.6E0, 0.2E0,+     +                  0.8E0/+      DATA              SC, SS/0.8E0, 0.6E0/+      DATA              DT9X/0.6E0, 0.0E0, 0.0E0, 0.0E0, 0.0E0, 0.0E0,+     +                  0.0E0, 0.78E0, 0.0E0, 0.0E0, 0.0E0, 0.0E0,+     +                  0.0E0, 0.0E0, 0.78E0, -0.46E0, 0.0E0, 0.0E0,+     +                  0.0E0, 0.0E0, 0.0E0, 0.78E0, -0.46E0, -0.22E0,+     +                  1.06E0, 0.0E0, 0.0E0, 0.0E0, 0.6E0, 0.0E0,+     +                  0.0E0, 0.0E0, 0.0E0, 0.0E0, 0.0E0, 0.78E0,+     +                  0.0E0, 0.0E0, 0.0E0, 0.0E0, 0.0E0, 0.0E0,+     +                  0.66E0, 0.1E0, -0.1E0, 0.0E0, 0.0E0, 0.0E0,+     +                  0.0E0, 0.96E0, 0.1E0, -0.76E0, 0.8E0, 0.90E0,+     +                  -0.3E0, -0.02E0, 0.6E0, 0.0E0, 0.0E0, 0.0E0,+     +                  0.0E0, 0.0E0, 0.0E0, 0.78E0, 0.0E0, 0.0E0,+     +                  0.0E0, 0.0E0, 0.0E0, 0.0E0, -0.06E0, 0.1E0,+     +                  -0.1E0, 0.0E0, 0.0E0, 0.0E0, 0.0E0, 0.90E0,+     +                  0.1E0, -0.22E0, 0.8E0, 0.18E0, -0.3E0, -0.02E0,+     +                  0.6E0, 0.0E0, 0.0E0, 0.0E0, 0.0E0, 0.0E0, 0.0E0,+     +                  0.78E0, 0.0E0, 0.0E0, 0.0E0, 0.0E0, 0.0E0,+     +                  0.0E0, 0.78E0, 0.26E0, 0.0E0, 0.0E0, 0.0E0,+     +                  0.0E0, 0.0E0, 0.78E0, 0.26E0, -0.76E0, 1.12E0,+     +                  0.0E0, 0.0E0, 0.0E0/+      DATA              DT9Y/0.5E0, 0.0E0, 0.0E0, 0.0E0, 0.0E0, 0.0E0,+     +                  0.0E0, 0.04E0, 0.0E0, 0.0E0, 0.0E0, 0.0E0,+     +                  0.0E0, 0.0E0, 0.04E0, -0.78E0, 0.0E0, 0.0E0,+     +                  0.0E0, 0.0E0, 0.0E0, 0.04E0, -0.78E0, 0.54E0,+     +                  0.08E0, 0.0E0, 0.0E0, 0.0E0, 0.5E0, 0.0E0,+     +                  0.0E0, 0.0E0, 0.0E0, 0.0E0, 0.0E0, 0.04E0,+     +                  0.0E0, 0.0E0, 0.0E0, 0.0E0, 0.0E0, 0.0E0, 0.7E0,+     +                  -0.9E0, -0.12E0, 0.0E0, 0.0E0, 0.0E0, 0.0E0,+     +                  0.64E0, -0.9E0, -0.30E0, 0.7E0, -0.18E0, 0.2E0,+     +                  0.28E0, 0.5E0, 0.0E0, 0.0E0, 0.0E0, 0.0E0,+     +                  0.0E0, 0.0E0, 0.04E0, 0.0E0, 0.0E0, 0.0E0,+     +                  0.0E0, 0.0E0, 0.0E0, 0.7E0, -1.08E0, 0.0E0,+     +                  0.0E0, 0.0E0, 0.0E0, 0.0E0, 0.64E0, -1.26E0,+     +                  0.54E0, 0.20E0, 0.0E0, 0.0E0, 0.0E0, 0.5E0,+     +                  0.0E0, 0.0E0, 0.0E0, 0.0E0, 0.0E0, 0.0E0,+     +                  0.04E0, 0.0E0, 0.0E0, 0.0E0, 0.0E0, 0.0E0,+     +                  0.0E0, 0.04E0, -0.9E0, 0.18E0, 0.0E0, 0.0E0,+     +                  0.0E0, 0.0E0, 0.04E0, -0.9E0, 0.18E0, 0.7E0,+     +                  -0.18E0, 0.2E0, 0.16E0/+      DATA              SSIZE2/0.0E0, 0.0E0, 0.0E0, 0.0E0, 0.0E0, 0.0E0,+     +                  0.0E0, 0.0E0, 0.0E0, 0.0E0, 0.0E0, 0.0E0, 0.0E0,+     +                  0.0E0, 1.17E0, 1.17E0, 1.17E0, 1.17E0, 1.17E0,+     +                  1.17E0, 1.17E0, 1.17E0, 1.17E0, 1.17E0, 1.17E0,+     +                  1.17E0, 1.17E0, 1.17E0/+*     .. Executable Statements ..+*+      DO 60 KI = 1, 4+         INCX = INCXS(KI)+         INCY = INCYS(KI)+         MX = ABS(INCX)+         MY = ABS(INCY)+*+         DO 40 KN = 1, 4+            N = NS(KN)+            KSIZE = MIN(2,KN)+            LENX = LENS(KN,MX)+            LENY = LENS(KN,MY)+*+            IF (ICASE.EQ.4) THEN+*              .. SROT ..+               DO 20 I = 1, 7+                  SX(I) = DX1(I)+                  SY(I) = DY1(I)+                  STX(I) = DT9X(I,KN,KI)+                  STY(I) = DT9Y(I,KN,KI)+   20          CONTINUE+               CALL SROT(N,SX,INCX,SY,INCY,SC,SS)+               CALL STEST(LENX,SX,STX,SSIZE2(1,KSIZE),SFAC)+               CALL STEST(LENY,SY,STY,SSIZE2(1,KSIZE),SFAC)+            ELSE+               WRITE (NOUT,*) ' Shouldn''t be here in CHECK3'+               STOP+            END IF+   40    CONTINUE+   60 CONTINUE+*+      MWPC(1) = 1+      DO 80 I = 2, 11+         MWPC(I) = 0+   80 CONTINUE+      MWPS(1) = 0+      DO 100 I = 2, 6+         MWPS(I) = 1+  100 CONTINUE+      DO 120 I = 7, 11+         MWPS(I) = -1+  120 CONTINUE+      MWPINX(1) = 1+      MWPINX(2) = 1+      MWPINX(3) = 1+      MWPINX(4) = -1+      MWPINX(5) = 1+      MWPINX(6) = -1+      MWPINX(7) = 1+      MWPINX(8) = 1+      MWPINX(9) = -1+      MWPINX(10) = 1+      MWPINX(11) = -1+      MWPINY(1) = 1+      MWPINY(2) = 1+      MWPINY(3) = -1+      MWPINY(4) = -1+      MWPINY(5) = 2+      MWPINY(6) = 1+      MWPINY(7) = 1+      MWPINY(8) = -1+      MWPINY(9) = -1+      MWPINY(10) = 2+      MWPINY(11) = 1+      DO 140 I = 1, 11+         MWPN(I) = 5+  140 CONTINUE+      MWPN(5) = 3+      MWPN(10) = 3+      DO 160 I = 1, 5+         MWPX(I) = I+         MWPY(I) = I+         MWPTX(1,I) = I+         MWPTY(1,I) = I+         MWPTX(2,I) = I+         MWPTY(2,I) = -I+         MWPTX(3,I) = 6 - I+         MWPTY(3,I) = I - 6+         MWPTX(4,I) = I+         MWPTY(4,I) = -I+         MWPTX(6,I) = 6 - I+         MWPTY(6,I) = I - 6+         MWPTX(7,I) = -I+         MWPTY(7,I) = I+         MWPTX(8,I) = I - 6+         MWPTY(8,I) = 6 - I+         MWPTX(9,I) = -I+         MWPTY(9,I) = I+         MWPTX(11,I) = I - 6+         MWPTY(11,I) = 6 - I+  160 CONTINUE+      MWPTX(5,1) = 1+      MWPTX(5,2) = 3+      MWPTX(5,3) = 5+      MWPTX(5,4) = 4+      MWPTX(5,5) = 5+      MWPTY(5,1) = -1+      MWPTY(5,2) = 2+      MWPTY(5,3) = -2+      MWPTY(5,4) = 4+      MWPTY(5,5) = -3+      MWPTX(10,1) = -1+      MWPTX(10,2) = -3+      MWPTX(10,3) = -5+      MWPTX(10,4) = 4+      MWPTX(10,5) = 5+      MWPTY(10,1) = 1+      MWPTY(10,2) = 2+      MWPTY(10,3) = 2+      MWPTY(10,4) = 4+      MWPTY(10,5) = 3+      DO 200 I = 1, 11+         INCX = MWPINX(I)+         INCY = MWPINY(I)+         DO 180 K = 1, 5+            COPYX(K) = MWPX(K)+            COPYY(K) = MWPY(K)+            MWPSTX(K) = MWPTX(I,K)+            MWPSTY(K) = MWPTY(I,K)+  180    CONTINUE+         CALL SROT(MWPN(I),COPYX,INCX,COPYY,INCY,MWPC(I),MWPS(I))+         CALL STEST(5,COPYX,MWPSTX,MWPSTX,SFAC)+         CALL STEST(5,COPYY,MWPSTY,MWPSTY,SFAC)+  200 CONTINUE+      RETURN+      END+      SUBROUTINE STEST(LEN,SCOMP,STRUE,SSIZE,SFAC)+*     ********************************* STEST **************************+*+*     THIS SUBR COMPARES ARRAYS  SCOMP() AND STRUE() OF LENGTH LEN TO+*     SEE IF THE TERM BY TERM DIFFERENCES, MULTIPLIED BY SFAC, ARE+*     NEGLIGIBLE.+*+*     C. L. LAWSON, JPL, 1974 DEC 10+*+*     .. Parameters ..+      INTEGER          NOUT+      REAL             ZERO+      PARAMETER        (NOUT=6, ZERO=0.0E0)+*     .. Scalar Arguments ..+      REAL             SFAC+      INTEGER          LEN+*     .. Array Arguments ..+      REAL             SCOMP(LEN), SSIZE(LEN), STRUE(LEN)+*     .. Scalars in Common ..+      INTEGER          ICASE, INCX, INCY, N+      LOGICAL          PASS+*     .. Local Scalars ..+      REAL             SD+      INTEGER          I+*     .. External Functions ..+      REAL             SDIFF+      EXTERNAL         SDIFF+*     .. Intrinsic Functions ..+      INTRINSIC        ABS+*     .. Common blocks ..+      COMMON           /COMBLA/ICASE, N, INCX, INCY, PASS+*     .. Executable Statements ..+*+      DO 40 I = 1, LEN+         SD = SCOMP(I) - STRUE(I)+         IF (ABS(SFAC*SD) .LE. ABS(SSIZE(I))*EPSILON(ZERO))+     +       GO TO 40+*+*                             HERE    SCOMP(I) IS NOT CLOSE TO STRUE(I).+*+         IF ( .NOT. PASS) GO TO 20+*                             PRINT FAIL MESSAGE AND HEADER.+         PASS = .FALSE.+         WRITE (NOUT,99999)+         WRITE (NOUT,99998)+   20    WRITE (NOUT,99997) ICASE, N, INCX, INCY, I, SCOMP(I),+     +     STRUE(I), SD, SSIZE(I)+   40 CONTINUE+      RETURN+*+99999 FORMAT ('                                       FAIL')+99998 FORMAT (/' CASE  N INCX INCY  I                            ',+     +       ' COMP(I)                             TRUE(I)  DIFFERENCE',+     +       '     SIZE(I)',/1X)+99997 FORMAT (1X,I4,I3,2I5,I3,2E36.8,2E12.4)+      END+      SUBROUTINE STEST1(SCOMP1,STRUE1,SSIZE,SFAC)+*     ************************* STEST1 *****************************+*+*     THIS IS AN INTERFACE SUBROUTINE TO ACCOMODATE THE FORTRAN+*     REQUIREMENT THAT WHEN A DUMMY ARGUMENT IS AN ARRAY, THE+*     ACTUAL ARGUMENT MUST ALSO BE AN ARRAY OR AN ARRAY ELEMENT.+*+*     C.L. LAWSON, JPL, 1978 DEC 6+*+*     .. Scalar Arguments ..+      REAL              SCOMP1, SFAC, STRUE1+*     .. Array Arguments ..+      REAL              SSIZE(*)+*     .. Local Arrays ..+      REAL              SCOMP(1), STRUE(1)+*     .. External Subroutines ..+      EXTERNAL          STEST+*     .. Executable Statements ..+*+      SCOMP(1) = SCOMP1+      STRUE(1) = STRUE1+      CALL STEST(1,SCOMP,STRUE,SSIZE,SFAC)+*+      RETURN+      END+      REAL             FUNCTION SDIFF(SA,SB)+*     ********************************* SDIFF **************************+*     COMPUTES DIFFERENCE OF TWO NUMBERS.  C. L. LAWSON, JPL 1974 FEB 15+*+*     .. Scalar Arguments ..+      REAL                            SA, SB+*     .. Executable Statements ..+      SDIFF = SA - SB+      RETURN+      END+      SUBROUTINE ITEST1(ICOMP,ITRUE)+*     ********************************* ITEST1 *************************+*+*     THIS SUBROUTINE COMPARES THE VARIABLES ICOMP AND ITRUE FOR+*     EQUALITY.+*     C. L. LAWSON, JPL, 1974 DEC 10+*+*     .. Parameters ..+      INTEGER           NOUT+      PARAMETER         (NOUT=6)+*     .. Scalar Arguments ..+      INTEGER           ICOMP, ITRUE+*     .. Scalars in Common ..+      INTEGER           ICASE, INCX, INCY, N+      LOGICAL           PASS+*     .. Local Scalars ..+      INTEGER           ID+*     .. Common blocks ..+      COMMON            /COMBLA/ICASE, N, INCX, INCY, PASS+*     .. Executable Statements ..+*+      IF (ICOMP.EQ.ITRUE) GO TO 40+*+*                            HERE ICOMP IS NOT EQUAL TO ITRUE.+*+      IF ( .NOT. PASS) GO TO 20+*                             PRINT FAIL MESSAGE AND HEADER.+      PASS = .FALSE.+      WRITE (NOUT,99999)+      WRITE (NOUT,99998)+   20 ID = ICOMP - ITRUE+      WRITE (NOUT,99997) ICASE, N, INCX, INCY, ICOMP, ITRUE, ID+   40 CONTINUE+      RETURN+*+99999 FORMAT ('                                       FAIL')+99998 FORMAT (/' CASE  N INCX INCY                               ',+     +       ' COMP                                TRUE     DIFFERENCE',+     +       /1X)+99997 FORMAT (1X,I4,I3,2I5,2I36,I12)+      END
+ eigen3/blas/testing/sblat2.dat view
@@ -0,0 +1,34 @@+'sblat2.summ'     NAME OF SUMMARY OUTPUT FILE+6                 UNIT NUMBER OF SUMMARY FILE+'sblat2.snap'     NAME OF SNAPSHOT OUTPUT FILE+-1                UNIT NUMBER OF SNAPSHOT FILE (NOT USED IF .LT. 0)+F        LOGICAL FLAG, T TO REWIND SNAPSHOT FILE AFTER EACH RECORD.+F        LOGICAL FLAG, T TO STOP ON FAILURES.+T        LOGICAL FLAG, T TO TEST ERROR EXITS.+16.0     THRESHOLD VALUE OF TEST RATIO+6                 NUMBER OF VALUES OF N+0 1 2 3 5 9       VALUES OF N+4                 NUMBER OF VALUES OF K+0 1 2 4           VALUES OF K+4                 NUMBER OF VALUES OF INCX AND INCY+1 2 -1 -2         VALUES OF INCX AND INCY+3                 NUMBER OF VALUES OF ALPHA+0.0 1.0 0.7       VALUES OF ALPHA+3                 NUMBER OF VALUES OF BETA+0.0 1.0 0.9       VALUES OF BETA+SGEMV  T PUT F FOR NO TEST. SAME COLUMNS.+SGBMV  T PUT F FOR NO TEST. SAME COLUMNS.+SSYMV  T PUT F FOR NO TEST. SAME COLUMNS.+SSBMV  T PUT F FOR NO TEST. SAME COLUMNS.+SSPMV  T PUT F FOR NO TEST. SAME COLUMNS.+STRMV  T PUT F FOR NO TEST. SAME COLUMNS.+STBMV  T PUT F FOR NO TEST. SAME COLUMNS.+STPMV  T PUT F FOR NO TEST. SAME COLUMNS.+STRSV  T PUT F FOR NO TEST. SAME COLUMNS.+STBSV  T PUT F FOR NO TEST. SAME COLUMNS.+STPSV  T PUT F FOR NO TEST. SAME COLUMNS.+SGER   T PUT F FOR NO TEST. SAME COLUMNS.+SSYR   T PUT F FOR NO TEST. SAME COLUMNS.+SSPR   T PUT F FOR NO TEST. SAME COLUMNS.+SSYR2  T PUT F FOR NO TEST. SAME COLUMNS.+SSPR2  T PUT F FOR NO TEST. SAME COLUMNS.
+ eigen3/blas/testing/sblat2.f view
@@ -0,0 +1,3176 @@+*> \brief \b SBLAT2+*+*  =========== DOCUMENTATION ===========+*+* Online html documentation available at +*            http://www.netlib.org/lapack/explore-html/ +*+*  Definition:+*  ===========+*+*       PROGRAM SBLAT2+* +*+*> \par Purpose:+*  =============+*>+*> \verbatim+*>+*> Test program for the REAL Level 2 Blas.+*>+*> The program must be driven by a short data file. The first 18 records+*> of the file are read using list-directed input, the last 16 records+*> are read using the format ( A6, L2 ). An annotated example of a data+*> file can be obtained by deleting the first 3 characters from the+*> following 34 lines:+*> 'sblat2.out'      NAME OF SUMMARY OUTPUT FILE+*> 6                 UNIT NUMBER OF SUMMARY FILE+*> 'SBLAT2.SNAP'     NAME OF SNAPSHOT OUTPUT FILE+*> -1                UNIT NUMBER OF SNAPSHOT FILE (NOT USED IF .LT. 0)+*> F        LOGICAL FLAG, T TO REWIND SNAPSHOT FILE AFTER EACH RECORD.+*> F        LOGICAL FLAG, T TO STOP ON FAILURES.+*> T        LOGICAL FLAG, T TO TEST ERROR EXITS.+*> 16.0     THRESHOLD VALUE OF TEST RATIO+*> 6                 NUMBER OF VALUES OF N+*> 0 1 2 3 5 9       VALUES OF N+*> 4                 NUMBER OF VALUES OF K+*> 0 1 2 4           VALUES OF K+*> 4                 NUMBER OF VALUES OF INCX AND INCY+*> 1 2 -1 -2         VALUES OF INCX AND INCY+*> 3                 NUMBER OF VALUES OF ALPHA+*> 0.0 1.0 0.7       VALUES OF ALPHA+*> 3                 NUMBER OF VALUES OF BETA+*> 0.0 1.0 0.9       VALUES OF BETA+*> SGEMV  T PUT F FOR NO TEST. SAME COLUMNS.+*> SGBMV  T PUT F FOR NO TEST. SAME COLUMNS.+*> SSYMV  T PUT F FOR NO TEST. SAME COLUMNS.+*> SSBMV  T PUT F FOR NO TEST. SAME COLUMNS.+*> SSPMV  T PUT F FOR NO TEST. SAME COLUMNS.+*> STRMV  T PUT F FOR NO TEST. SAME COLUMNS.+*> STBMV  T PUT F FOR NO TEST. SAME COLUMNS.+*> STPMV  T PUT F FOR NO TEST. SAME COLUMNS.+*> STRSV  T PUT F FOR NO TEST. SAME COLUMNS.+*> STBSV  T PUT F FOR NO TEST. SAME COLUMNS.+*> STPSV  T PUT F FOR NO TEST. SAME COLUMNS.+*> SGER   T PUT F FOR NO TEST. SAME COLUMNS.+*> SSYR   T PUT F FOR NO TEST. SAME COLUMNS.+*> SSPR   T PUT F FOR NO TEST. SAME COLUMNS.+*> SSYR2  T PUT F FOR NO TEST. SAME COLUMNS.+*> SSPR2  T PUT F FOR NO TEST. SAME COLUMNS.+*>+*> Further Details+*> ===============+*>+*>    See:+*>+*>       Dongarra J. J., Du Croz J. J., Hammarling S.  and Hanson R. J..+*>       An  extended  set of Fortran  Basic Linear Algebra Subprograms.+*>+*>       Technical  Memoranda  Nos. 41 (revision 3) and 81,  Mathematics+*>       and  Computer Science  Division,  Argonne  National Laboratory,+*>       9700 South Cass Avenue, Argonne, Illinois 60439, US.+*>+*>       Or+*>+*>       NAG  Technical Reports TR3/87 and TR4/87,  Numerical Algorithms+*>       Group  Ltd.,  NAG  Central  Office,  256  Banbury  Road, Oxford+*>       OX2 7DE, UK,  and  Numerical Algorithms Group Inc.,  1101  31st+*>       Street,  Suite 100,  Downers Grove,  Illinois 60515-1263,  USA.+*>+*>+*> -- Written on 10-August-1987.+*>    Richard Hanson, Sandia National Labs.+*>    Jeremy Du Croz, NAG Central Office.+*>+*>    10-9-00:  Change STATUS='NEW' to 'UNKNOWN' so that the testers+*>              can be run multiple times without deleting generated+*>              output files (susan)+*> \endverbatim+*+*  Authors:+*  ========+*+*> \author Univ. of Tennessee +*> \author Univ. of California Berkeley +*> \author Univ. of Colorado Denver +*> \author NAG Ltd. +*+*> \date April 2012+*+*> \ingroup single_blas_testing+*+*  =====================================================================+      PROGRAM SBLAT2+*+*  -- Reference BLAS test routine (version 3.4.1) --+*  -- Reference BLAS is a software package provided by Univ. of Tennessee,    --+*  -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--+*     April 2012+*+*  =====================================================================+*+*     .. Parameters ..+      INTEGER            NIN+      PARAMETER          ( NIN = 5 )+      INTEGER            NSUBS+      PARAMETER          ( NSUBS = 16 )+      REAL               ZERO, ONE+      PARAMETER          ( ZERO = 0.0, ONE = 1.0 )+      INTEGER            NMAX, INCMAX+      PARAMETER          ( NMAX = 65, INCMAX = 2 )+      INTEGER            NINMAX, NIDMAX, NKBMAX, NALMAX, NBEMAX+      PARAMETER          ( NINMAX = 7, NIDMAX = 9, NKBMAX = 7,+     $                   NALMAX = 7, NBEMAX = 7 )+*     .. Local Scalars ..+      REAL               EPS, ERR, THRESH+      INTEGER            I, ISNUM, J, N, NALF, NBET, NIDIM, NINC, NKB,+     $                   NOUT, NTRA+      LOGICAL            FATAL, LTESTT, REWI, SAME, SFATAL, TRACE,+     $                   TSTERR+      CHARACTER*1        TRANS+      CHARACTER*6        SNAMET+      CHARACTER*32       SNAPS, SUMMRY+*     .. Local Arrays ..+      REAL               A( NMAX, NMAX ), AA( NMAX*NMAX ),+     $                   ALF( NALMAX ), AS( NMAX*NMAX ), BET( NBEMAX ),+     $                   G( NMAX ), X( NMAX ), XS( NMAX*INCMAX ),+     $                   XX( NMAX*INCMAX ), Y( NMAX ),+     $                   YS( NMAX*INCMAX ), YT( NMAX ),+     $                   YY( NMAX*INCMAX ), Z( 2*NMAX )+      INTEGER            IDIM( NIDMAX ), INC( NINMAX ), KB( NKBMAX )+      LOGICAL            LTEST( NSUBS )+      CHARACTER*6        SNAMES( NSUBS )+*     .. External Functions ..+      REAL               SDIFF+      LOGICAL            LSE+      EXTERNAL           SDIFF, LSE+*     .. External Subroutines ..+      EXTERNAL           SCHK1, SCHK2, SCHK3, SCHK4, SCHK5, SCHK6,+     $                   SCHKE, SMVCH+*     .. Intrinsic Functions ..+      INTRINSIC          ABS, MAX, MIN+*     .. Scalars in Common ..+      INTEGER            INFOT, NOUTC+      LOGICAL            LERR, OK+      CHARACTER*6        SRNAMT+*     .. Common blocks ..+      COMMON             /INFOC/INFOT, NOUTC, OK, LERR+      COMMON             /SRNAMC/SRNAMT+*     .. Data statements ..+      DATA               SNAMES/'SGEMV ', 'SGBMV ', 'SSYMV ', 'SSBMV ',+     $                   'SSPMV ', 'STRMV ', 'STBMV ', 'STPMV ',+     $                   'STRSV ', 'STBSV ', 'STPSV ', 'SGER  ',+     $                   'SSYR  ', 'SSPR  ', 'SSYR2 ', 'SSPR2 '/+*     .. Executable Statements ..+*+*     Read name and unit number for summary output file and open file.+*+      READ( NIN, FMT = * )SUMMRY+      READ( NIN, FMT = * )NOUT+      OPEN( NOUT, FILE = SUMMRY, STATUS = 'UNKNOWN' )+      NOUTC = NOUT+*+*     Read name and unit number for snapshot output file and open file.+*+      READ( NIN, FMT = * )SNAPS+      READ( NIN, FMT = * )NTRA+      TRACE = NTRA.GE.0+      IF( TRACE )THEN+         OPEN( NTRA, FILE = SNAPS, STATUS = 'UNKNOWN' )+      END IF+*     Read the flag that directs rewinding of the snapshot file.+      READ( NIN, FMT = * )REWI+      REWI = REWI.AND.TRACE+*     Read the flag that directs stopping on any failure.+      READ( NIN, FMT = * )SFATAL+*     Read the flag that indicates whether error exits are to be tested.+      READ( NIN, FMT = * )TSTERR+*     Read the threshold value of the test ratio+      READ( NIN, FMT = * )THRESH+*+*     Read and check the parameter values for the tests.+*+*     Values of N+      READ( NIN, FMT = * )NIDIM+      IF( NIDIM.LT.1.OR.NIDIM.GT.NIDMAX )THEN+         WRITE( NOUT, FMT = 9997 )'N', NIDMAX+         GO TO 230+      END IF+      READ( NIN, FMT = * )( IDIM( I ), I = 1, NIDIM )+      DO 10 I = 1, NIDIM+         IF( IDIM( I ).LT.0.OR.IDIM( I ).GT.NMAX )THEN+            WRITE( NOUT, FMT = 9996 )NMAX+            GO TO 230+         END IF+   10 CONTINUE+*     Values of K+      READ( NIN, FMT = * )NKB+      IF( NKB.LT.1.OR.NKB.GT.NKBMAX )THEN+         WRITE( NOUT, FMT = 9997 )'K', NKBMAX+         GO TO 230+      END IF+      READ( NIN, FMT = * )( KB( I ), I = 1, NKB )+      DO 20 I = 1, NKB+         IF( KB( I ).LT.0 )THEN+            WRITE( NOUT, FMT = 9995 )+            GO TO 230+         END IF+   20 CONTINUE+*     Values of INCX and INCY+      READ( NIN, FMT = * )NINC+      IF( NINC.LT.1.OR.NINC.GT.NINMAX )THEN+         WRITE( NOUT, FMT = 9997 )'INCX AND INCY', NINMAX+         GO TO 230+      END IF+      READ( NIN, FMT = * )( INC( I ), I = 1, NINC )+      DO 30 I = 1, NINC+         IF( INC( I ).EQ.0.OR.ABS( INC( I ) ).GT.INCMAX )THEN+            WRITE( NOUT, FMT = 9994 )INCMAX+            GO TO 230+         END IF+   30 CONTINUE+*     Values of ALPHA+      READ( NIN, FMT = * )NALF+      IF( NALF.LT.1.OR.NALF.GT.NALMAX )THEN+         WRITE( NOUT, FMT = 9997 )'ALPHA', NALMAX+         GO TO 230+      END IF+      READ( NIN, FMT = * )( ALF( I ), I = 1, NALF )+*     Values of BETA+      READ( NIN, FMT = * )NBET+      IF( NBET.LT.1.OR.NBET.GT.NBEMAX )THEN+         WRITE( NOUT, FMT = 9997 )'BETA', NBEMAX+         GO TO 230+      END IF+      READ( NIN, FMT = * )( BET( I ), I = 1, NBET )+*+*     Report values of parameters.+*+      WRITE( NOUT, FMT = 9993 )+      WRITE( NOUT, FMT = 9992 )( IDIM( I ), I = 1, NIDIM )+      WRITE( NOUT, FMT = 9991 )( KB( I ), I = 1, NKB )+      WRITE( NOUT, FMT = 9990 )( INC( I ), I = 1, NINC )+      WRITE( NOUT, FMT = 9989 )( ALF( I ), I = 1, NALF )+      WRITE( NOUT, FMT = 9988 )( BET( I ), I = 1, NBET )+      IF( .NOT.TSTERR )THEN+         WRITE( NOUT, FMT = * )+         WRITE( NOUT, FMT = 9980 )+      END IF+      WRITE( NOUT, FMT = * )+      WRITE( NOUT, FMT = 9999 )THRESH+      WRITE( NOUT, FMT = * )+*+*     Read names of subroutines and flags which indicate+*     whether they are to be tested.+*+      DO 40 I = 1, NSUBS+         LTEST( I ) = .FALSE.+   40 CONTINUE+   50 READ( NIN, FMT = 9984, END = 80 )SNAMET, LTESTT+      DO 60 I = 1, NSUBS+         IF( SNAMET.EQ.SNAMES( I ) )+     $      GO TO 70+   60 CONTINUE+      WRITE( NOUT, FMT = 9986 )SNAMET+      STOP+   70 LTEST( I ) = LTESTT+      GO TO 50+*+   80 CONTINUE+      CLOSE ( NIN )+*+*     Compute EPS (the machine precision).+*+      EPS = EPSILON(ZERO)+      WRITE( NOUT, FMT = 9998 )EPS+*+*     Check the reliability of SMVCH using exact data.+*+      N = MIN( 32, NMAX )+      DO 120 J = 1, N+         DO 110 I = 1, N+            A( I, J ) = MAX( I - J + 1, 0 )+  110    CONTINUE+         X( J ) = J+         Y( J ) = ZERO+  120 CONTINUE+      DO 130 J = 1, N+         YY( J ) = J*( ( J + 1 )*J )/2 - ( ( J + 1 )*J*( J - 1 ) )/3+  130 CONTINUE+*     YY holds the exact result. On exit from SMVCH YT holds+*     the result computed by SMVCH.+      TRANS = 'N'+      CALL SMVCH( TRANS, N, N, ONE, A, NMAX, X, 1, ZERO, Y, 1, YT, G,+     $            YY, EPS, ERR, FATAL, NOUT, .TRUE. )+      SAME = LSE( YY, YT, N )+      IF( .NOT.SAME.OR.ERR.NE.ZERO )THEN+         WRITE( NOUT, FMT = 9985 )TRANS, SAME, ERR+         STOP+      END IF+      TRANS = 'T'+      CALL SMVCH( TRANS, N, N, ONE, A, NMAX, X, -1, ZERO, Y, -1, YT, G,+     $            YY, EPS, ERR, FATAL, NOUT, .TRUE. )+      SAME = LSE( YY, YT, N )+      IF( .NOT.SAME.OR.ERR.NE.ZERO )THEN+         WRITE( NOUT, FMT = 9985 )TRANS, SAME, ERR+         STOP+      END IF+*+*     Test each subroutine in turn.+*+      DO 210 ISNUM = 1, NSUBS+         WRITE( NOUT, FMT = * )+         IF( .NOT.LTEST( ISNUM ) )THEN+*           Subprogram is not to be tested.+            WRITE( NOUT, FMT = 9983 )SNAMES( ISNUM )+         ELSE+            SRNAMT = SNAMES( ISNUM )+*           Test error exits.+            IF( TSTERR )THEN+               CALL SCHKE( ISNUM, SNAMES( ISNUM ), NOUT )+               WRITE( NOUT, FMT = * )+            END IF+*           Test computations.+            INFOT = 0+            OK = .TRUE.+            FATAL = .FALSE.+            GO TO ( 140, 140, 150, 150, 150, 160, 160,+     $              160, 160, 160, 160, 170, 180, 180,+     $              190, 190 )ISNUM+*           Test SGEMV, 01, and SGBMV, 02.+  140       CALL SCHK1( SNAMES( ISNUM ), EPS, THRESH, NOUT, NTRA, TRACE,+     $                  REWI, FATAL, NIDIM, IDIM, NKB, KB, NALF, ALF,+     $                  NBET, BET, NINC, INC, NMAX, INCMAX, A, AA, AS,+     $                  X, XX, XS, Y, YY, YS, YT, G )+            GO TO 200+*           Test SSYMV, 03, SSBMV, 04, and SSPMV, 05.+  150       CALL SCHK2( SNAMES( ISNUM ), EPS, THRESH, NOUT, NTRA, TRACE,+     $                  REWI, FATAL, NIDIM, IDIM, NKB, KB, NALF, ALF,+     $                  NBET, BET, NINC, INC, NMAX, INCMAX, A, AA, AS,+     $                  X, XX, XS, Y, YY, YS, YT, G )+            GO TO 200+*           Test STRMV, 06, STBMV, 07, STPMV, 08,+*           STRSV, 09, STBSV, 10, and STPSV, 11.+  160       CALL SCHK3( SNAMES( ISNUM ), EPS, THRESH, NOUT, NTRA, TRACE,+     $                  REWI, FATAL, NIDIM, IDIM, NKB, KB, NINC, INC,+     $                  NMAX, INCMAX, A, AA, AS, Y, YY, YS, YT, G, Z )+            GO TO 200+*           Test SGER, 12.+  170       CALL SCHK4( SNAMES( ISNUM ), EPS, THRESH, NOUT, NTRA, TRACE,+     $                  REWI, FATAL, NIDIM, IDIM, NALF, ALF, NINC, INC,+     $                  NMAX, INCMAX, A, AA, AS, X, XX, XS, Y, YY, YS,+     $                  YT, G, Z )+            GO TO 200+*           Test SSYR, 13, and SSPR, 14.+  180       CALL SCHK5( SNAMES( ISNUM ), EPS, THRESH, NOUT, NTRA, TRACE,+     $                  REWI, FATAL, NIDIM, IDIM, NALF, ALF, NINC, INC,+     $                  NMAX, INCMAX, A, AA, AS, X, XX, XS, Y, YY, YS,+     $                  YT, G, Z )+            GO TO 200+*           Test SSYR2, 15, and SSPR2, 16.+  190       CALL SCHK6( SNAMES( ISNUM ), EPS, THRESH, NOUT, NTRA, TRACE,+     $                  REWI, FATAL, NIDIM, IDIM, NALF, ALF, NINC, INC,+     $                  NMAX, INCMAX, A, AA, AS, X, XX, XS, Y, YY, YS,+     $                  YT, G, Z )+*+  200       IF( FATAL.AND.SFATAL )+     $         GO TO 220+         END IF+  210 CONTINUE+      WRITE( NOUT, FMT = 9982 )+      GO TO 240+*+  220 CONTINUE+      WRITE( NOUT, FMT = 9981 )+      GO TO 240+*+  230 CONTINUE+      WRITE( NOUT, FMT = 9987 )+*+  240 CONTINUE+      IF( TRACE )+     $   CLOSE ( NTRA )+      CLOSE ( NOUT )+      STOP+*+ 9999 FORMAT( ' ROUTINES PASS COMPUTATIONAL TESTS IF TEST RATIO IS LES',+     $      'S THAN', F8.2 )+ 9998 FORMAT( ' RELATIVE MACHINE PRECISION IS TAKEN TO BE', 1P, E9.1 )+ 9997 FORMAT( ' NUMBER OF VALUES OF ', A, ' IS LESS THAN 1 OR GREATER ',+     $      'THAN ', I2 )+ 9996 FORMAT( ' VALUE OF N IS LESS THAN 0 OR GREATER THAN ', I2 )+ 9995 FORMAT( ' VALUE OF K IS LESS THAN 0' )+ 9994 FORMAT( ' ABSOLUTE VALUE OF INCX OR INCY IS 0 OR GREATER THAN ',+     $      I2 )+ 9993 FORMAT( ' TESTS OF THE REAL             LEVEL 2 BLAS', //' THE F',+     $      'OLLOWING PARAMETER VALUES WILL BE USED:' )+ 9992 FORMAT( '   FOR N              ', 9I6 )+ 9991 FORMAT( '   FOR K              ', 7I6 )+ 9990 FORMAT( '   FOR INCX AND INCY  ', 7I6 )+ 9989 FORMAT( '   FOR ALPHA          ', 7F6.1 )+ 9988 FORMAT( '   FOR BETA           ', 7F6.1 )+ 9987 FORMAT( ' AMEND DATA FILE OR INCREASE ARRAY SIZES IN PROGRAM',+     $      /' ******* TESTS ABANDONED *******' )+ 9986 FORMAT( ' SUBPROGRAM NAME ', A6, ' NOT RECOGNIZED', /' ******* T',+     $      'ESTS ABANDONED *******' )+ 9985 FORMAT( ' ERROR IN SMVCH -  IN-LINE DOT PRODUCTS ARE BEING EVALU',+     $      'ATED WRONGLY.', /' SMVCH WAS CALLED WITH TRANS = ', A1,+     $      ' AND RETURNED SAME = ', L1, ' AND ERR = ', F12.3, '.', /+     $   ' THIS MAY BE DUE TO FAULTS IN THE ARITHMETIC OR THE COMPILER.'+     $      , /' ******* TESTS ABANDONED *******' )+ 9984 FORMAT( A6, L2 )+ 9983 FORMAT( 1X, A6, ' WAS NOT TESTED' )+ 9982 FORMAT( /' END OF TESTS' )+ 9981 FORMAT( /' ******* FATAL ERROR - TESTS ABANDONED *******' )+ 9980 FORMAT( ' ERROR-EXITS WILL NOT BE TESTED' )+*+*     End of SBLAT2.+*+      END+      SUBROUTINE SCHK1( SNAME, EPS, THRESH, NOUT, NTRA, TRACE, REWI,+     $                  FATAL, NIDIM, IDIM, NKB, KB, NALF, ALF, NBET,+     $                  BET, NINC, INC, NMAX, INCMAX, A, AA, AS, X, XX,+     $                  XS, Y, YY, YS, YT, G )+*+*  Tests SGEMV and SGBMV.+*+*  Auxiliary routine for test program for Level 2 Blas.+*+*  -- Written on 10-August-1987.+*     Richard Hanson, Sandia National Labs.+*     Jeremy Du Croz, NAG Central Office.+*+*     .. Parameters ..+      REAL               ZERO, HALF+      PARAMETER          ( ZERO = 0.0, HALF = 0.5 )+*     .. Scalar Arguments ..+      REAL               EPS, THRESH+      INTEGER            INCMAX, NALF, NBET, NIDIM, NINC, NKB, NMAX,+     $                   NOUT, NTRA+      LOGICAL            FATAL, REWI, TRACE+      CHARACTER*6        SNAME+*     .. Array Arguments ..+      REAL               A( NMAX, NMAX ), AA( NMAX*NMAX ), ALF( NALF ),+     $                   AS( NMAX*NMAX ), BET( NBET ), G( NMAX ),+     $                   X( NMAX ), XS( NMAX*INCMAX ),+     $                   XX( NMAX*INCMAX ), Y( NMAX ),+     $                   YS( NMAX*INCMAX ), YT( NMAX ),+     $                   YY( NMAX*INCMAX )+      INTEGER            IDIM( NIDIM ), INC( NINC ), KB( NKB )+*     .. Local Scalars ..+      REAL               ALPHA, ALS, BETA, BLS, ERR, ERRMAX, TRANSL+      INTEGER            I, IA, IB, IC, IKU, IM, IN, INCX, INCXS, INCY,+     $                   INCYS, IX, IY, KL, KLS, KU, KUS, LAA, LDA,+     $                   LDAS, LX, LY, M, ML, MS, N, NARGS, NC, ND, NK,+     $                   NL, NS+      LOGICAL            BANDED, FULL, NULL, RESET, SAME, TRAN+      CHARACTER*1        TRANS, TRANSS+      CHARACTER*3        ICH+*     .. Local Arrays ..+      LOGICAL            ISAME( 13 )+*     .. External Functions ..+      LOGICAL            LSE, LSERES+      EXTERNAL           LSE, LSERES+*     .. External Subroutines ..+      EXTERNAL           SGBMV, SGEMV, SMAKE, SMVCH+*     .. Intrinsic Functions ..+      INTRINSIC          ABS, MAX, MIN+*     .. Scalars in Common ..+      INTEGER            INFOT, NOUTC+      LOGICAL            LERR, OK+*     .. Common blocks ..+      COMMON             /INFOC/INFOT, NOUTC, OK, LERR+*     .. Data statements ..+      DATA               ICH/'NTC'/+*     .. Executable Statements ..+      FULL = SNAME( 3: 3 ).EQ.'E'+      BANDED = SNAME( 3: 3 ).EQ.'B'+*     Define the number of arguments.+      IF( FULL )THEN+         NARGS = 11+      ELSE IF( BANDED )THEN+         NARGS = 13+      END IF+*+      NC = 0+      RESET = .TRUE.+      ERRMAX = ZERO+*+      DO 120 IN = 1, NIDIM+         N = IDIM( IN )+         ND = N/2 + 1+*+         DO 110 IM = 1, 2+            IF( IM.EQ.1 )+     $         M = MAX( N - ND, 0 )+            IF( IM.EQ.2 )+     $         M = MIN( N + ND, NMAX )+*+            IF( BANDED )THEN+               NK = NKB+            ELSE+               NK = 1+            END IF+            DO 100 IKU = 1, NK+               IF( BANDED )THEN+                  KU = KB( IKU )+                  KL = MAX( KU - 1, 0 )+               ELSE+                  KU = N - 1+                  KL = M - 1+               END IF+*              Set LDA to 1 more than minimum value if room.+               IF( BANDED )THEN+                  LDA = KL + KU + 1+               ELSE+                  LDA = M+               END IF+               IF( LDA.LT.NMAX )+     $            LDA = LDA + 1+*              Skip tests if not enough room.+               IF( LDA.GT.NMAX )+     $            GO TO 100+               LAA = LDA*N+               NULL = N.LE.0.OR.M.LE.0+*+*              Generate the matrix A.+*+               TRANSL = ZERO+               CALL SMAKE( SNAME( 2: 3 ), ' ', ' ', M, N, A, NMAX, AA,+     $                     LDA, KL, KU, RESET, TRANSL )+*+               DO 90 IC = 1, 3+                  TRANS = ICH( IC: IC )+                  TRAN = TRANS.EQ.'T'.OR.TRANS.EQ.'C'+*+                  IF( TRAN )THEN+                     ML = N+                     NL = M+                  ELSE+                     ML = M+                     NL = N+                  END IF+*+                  DO 80 IX = 1, NINC+                     INCX = INC( IX )+                     LX = ABS( INCX )*NL+*+*                    Generate the vector X.+*+                     TRANSL = HALF+                     CALL SMAKE( 'GE', ' ', ' ', 1, NL, X, 1, XX,+     $                           ABS( INCX ), 0, NL - 1, RESET, TRANSL )+                     IF( NL.GT.1 )THEN+                        X( NL/2 ) = ZERO+                        XX( 1 + ABS( INCX )*( NL/2 - 1 ) ) = ZERO+                     END IF+*+                     DO 70 IY = 1, NINC+                        INCY = INC( IY )+                        LY = ABS( INCY )*ML+*+                        DO 60 IA = 1, NALF+                           ALPHA = ALF( IA )+*+                           DO 50 IB = 1, NBET+                              BETA = BET( IB )+*+*                             Generate the vector Y.+*+                              TRANSL = ZERO+                              CALL SMAKE( 'GE', ' ', ' ', 1, ML, Y, 1,+     $                                    YY, ABS( INCY ), 0, ML - 1,+     $                                    RESET, TRANSL )+*+                              NC = NC + 1+*+*                             Save every datum before calling the+*                             subroutine.+*+                              TRANSS = TRANS+                              MS = M+                              NS = N+                              KLS = KL+                              KUS = KU+                              ALS = ALPHA+                              DO 10 I = 1, LAA+                                 AS( I ) = AA( I )+   10                         CONTINUE+                              LDAS = LDA+                              DO 20 I = 1, LX+                                 XS( I ) = XX( I )+   20                         CONTINUE+                              INCXS = INCX+                              BLS = BETA+                              DO 30 I = 1, LY+                                 YS( I ) = YY( I )+   30                         CONTINUE+                              INCYS = INCY+*+*                             Call the subroutine.+*+                              IF( FULL )THEN+                                 IF( TRACE )+     $                              WRITE( NTRA, FMT = 9994 )NC, SNAME,+     $                              TRANS, M, N, ALPHA, LDA, INCX, BETA,+     $                              INCY+                                 IF( REWI )+     $                              REWIND NTRA+                                 CALL SGEMV( TRANS, M, N, ALPHA, AA,+     $                                       LDA, XX, INCX, BETA, YY,+     $                                       INCY )+                              ELSE IF( BANDED )THEN+                                 IF( TRACE )+     $                              WRITE( NTRA, FMT = 9995 )NC, SNAME,+     $                              TRANS, M, N, KL, KU, ALPHA, LDA,+     $                              INCX, BETA, INCY+                                 IF( REWI )+     $                              REWIND NTRA+                                 CALL SGBMV( TRANS, M, N, KL, KU, ALPHA,+     $                                       AA, LDA, XX, INCX, BETA,+     $                                       YY, INCY )+                              END IF+*+*                             Check if error-exit was taken incorrectly.+*+                              IF( .NOT.OK )THEN+                                 WRITE( NOUT, FMT = 9993 )+                                 FATAL = .TRUE.+                                 GO TO 130+                              END IF+*+*                             See what data changed inside subroutines.+*+                              ISAME( 1 ) = TRANS.EQ.TRANSS+                              ISAME( 2 ) = MS.EQ.M+                              ISAME( 3 ) = NS.EQ.N+                              IF( FULL )THEN+                                 ISAME( 4 ) = ALS.EQ.ALPHA+                                 ISAME( 5 ) = LSE( AS, AA, LAA )+                                 ISAME( 6 ) = LDAS.EQ.LDA+                                 ISAME( 7 ) = LSE( XS, XX, LX )+                                 ISAME( 8 ) = INCXS.EQ.INCX+                                 ISAME( 9 ) = BLS.EQ.BETA+                                 IF( NULL )THEN+                                    ISAME( 10 ) = LSE( YS, YY, LY )+                                 ELSE+                                    ISAME( 10 ) = LSERES( 'GE', ' ', 1,+     $                                            ML, YS, YY,+     $                                            ABS( INCY ) )+                                 END IF+                                 ISAME( 11 ) = INCYS.EQ.INCY+                              ELSE IF( BANDED )THEN+                                 ISAME( 4 ) = KLS.EQ.KL+                                 ISAME( 5 ) = KUS.EQ.KU+                                 ISAME( 6 ) = ALS.EQ.ALPHA+                                 ISAME( 7 ) = LSE( AS, AA, LAA )+                                 ISAME( 8 ) = LDAS.EQ.LDA+                                 ISAME( 9 ) = LSE( XS, XX, LX )+                                 ISAME( 10 ) = INCXS.EQ.INCX+                                 ISAME( 11 ) = BLS.EQ.BETA+                                 IF( NULL )THEN+                                    ISAME( 12 ) = LSE( YS, YY, LY )+                                 ELSE+                                    ISAME( 12 ) = LSERES( 'GE', ' ', 1,+     $                                            ML, YS, YY,+     $                                            ABS( INCY ) )+                                 END IF+                                 ISAME( 13 ) = INCYS.EQ.INCY+                              END IF+*+*                             If data was incorrectly changed, report+*                             and return.+*+                              SAME = .TRUE.+                              DO 40 I = 1, NARGS+                                 SAME = SAME.AND.ISAME( I )+                                 IF( .NOT.ISAME( I ) )+     $                              WRITE( NOUT, FMT = 9998 )I+   40                         CONTINUE+                              IF( .NOT.SAME )THEN+                                 FATAL = .TRUE.+                                 GO TO 130+                              END IF+*+                              IF( .NOT.NULL )THEN+*+*                                Check the result.+*+                                 CALL SMVCH( TRANS, M, N, ALPHA, A,+     $                                       NMAX, X, INCX, BETA, Y,+     $                                       INCY, YT, G, YY, EPS, ERR,+     $                                       FATAL, NOUT, .TRUE. )+                                 ERRMAX = MAX( ERRMAX, ERR )+*                                If got really bad answer, report and+*                                return.+                                 IF( FATAL )+     $                              GO TO 130+                              ELSE+*                                Avoid repeating tests with M.le.0 or+*                                N.le.0.+                                 GO TO 110+                              END IF+*+   50                      CONTINUE+*+   60                   CONTINUE+*+   70                CONTINUE+*+   80             CONTINUE+*+   90          CONTINUE+*+  100       CONTINUE+*+  110    CONTINUE+*+  120 CONTINUE+*+*     Report result.+*+      IF( ERRMAX.LT.THRESH )THEN+         WRITE( NOUT, FMT = 9999 )SNAME, NC+      ELSE+         WRITE( NOUT, FMT = 9997 )SNAME, NC, ERRMAX+      END IF+      GO TO 140+*+  130 CONTINUE+      WRITE( NOUT, FMT = 9996 )SNAME+      IF( FULL )THEN+         WRITE( NOUT, FMT = 9994 )NC, SNAME, TRANS, M, N, ALPHA, LDA,+     $      INCX, BETA, INCY+      ELSE IF( BANDED )THEN+         WRITE( NOUT, FMT = 9995 )NC, SNAME, TRANS, M, N, KL, KU,+     $      ALPHA, LDA, INCX, BETA, INCY+      END IF+*+  140 CONTINUE+      RETURN+*+ 9999 FORMAT( ' ', A6, ' PASSED THE COMPUTATIONAL TESTS (', I6, ' CALL',+     $      'S)' )+ 9998 FORMAT( ' ******* FATAL ERROR - PARAMETER NUMBER ', I2, ' WAS CH',+     $      'ANGED INCORRECTLY *******' )+ 9997 FORMAT( ' ', A6, ' COMPLETED THE COMPUTATIONAL TESTS (', I6, ' C',+     $      'ALLS)', /' ******* BUT WITH MAXIMUM TEST RATIO', F8.2,+     $      ' - SUSPECT *******' )+ 9996 FORMAT( ' ******* ', A6, ' FAILED ON CALL NUMBER:' )+ 9995 FORMAT( 1X, I6, ': ', A6, '(''', A1, ''',', 4( I3, ',' ), F4.1,+     $      ', A,', I3, ', X,', I2, ',', F4.1, ', Y,', I2, ') .' )+ 9994 FORMAT( 1X, I6, ': ', A6, '(''', A1, ''',', 2( I3, ',' ), F4.1,+     $      ', A,', I3, ', X,', I2, ',', F4.1, ', Y,', I2,+     $      ')         .' )+ 9993 FORMAT( ' ******* FATAL ERROR - ERROR-EXIT TAKEN ON VALID CALL *',+     $      '******' )+*+*     End of SCHK1.+*+      END+      SUBROUTINE SCHK2( SNAME, EPS, THRESH, NOUT, NTRA, TRACE, REWI,+     $                  FATAL, NIDIM, IDIM, NKB, KB, NALF, ALF, NBET,+     $                  BET, NINC, INC, NMAX, INCMAX, A, AA, AS, X, XX,+     $                  XS, Y, YY, YS, YT, G )+*+*  Tests SSYMV, SSBMV and SSPMV.+*+*  Auxiliary routine for test program for Level 2 Blas.+*+*  -- Written on 10-August-1987.+*     Richard Hanson, Sandia National Labs.+*     Jeremy Du Croz, NAG Central Office.+*+*     .. Parameters ..+      REAL               ZERO, HALF+      PARAMETER          ( ZERO = 0.0, HALF = 0.5 )+*     .. Scalar Arguments ..+      REAL               EPS, THRESH+      INTEGER            INCMAX, NALF, NBET, NIDIM, NINC, NKB, NMAX,+     $                   NOUT, NTRA+      LOGICAL            FATAL, REWI, TRACE+      CHARACTER*6        SNAME+*     .. Array Arguments ..+      REAL               A( NMAX, NMAX ), AA( NMAX*NMAX ), ALF( NALF ),+     $                   AS( NMAX*NMAX ), BET( NBET ), G( NMAX ),+     $                   X( NMAX ), XS( NMAX*INCMAX ),+     $                   XX( NMAX*INCMAX ), Y( NMAX ),+     $                   YS( NMAX*INCMAX ), YT( NMAX ),+     $                   YY( NMAX*INCMAX )+      INTEGER            IDIM( NIDIM ), INC( NINC ), KB( NKB )+*     .. Local Scalars ..+      REAL               ALPHA, ALS, BETA, BLS, ERR, ERRMAX, TRANSL+      INTEGER            I, IA, IB, IC, IK, IN, INCX, INCXS, INCY,+     $                   INCYS, IX, IY, K, KS, LAA, LDA, LDAS, LX, LY,+     $                   N, NARGS, NC, NK, NS+      LOGICAL            BANDED, FULL, NULL, PACKED, RESET, SAME+      CHARACTER*1        UPLO, UPLOS+      CHARACTER*2        ICH+*     .. Local Arrays ..+      LOGICAL            ISAME( 13 )+*     .. External Functions ..+      LOGICAL            LSE, LSERES+      EXTERNAL           LSE, LSERES+*     .. External Subroutines ..+      EXTERNAL           SMAKE, SMVCH, SSBMV, SSPMV, SSYMV+*     .. Intrinsic Functions ..+      INTRINSIC          ABS, MAX+*     .. Scalars in Common ..+      INTEGER            INFOT, NOUTC+      LOGICAL            LERR, OK+*     .. Common blocks ..+      COMMON             /INFOC/INFOT, NOUTC, OK, LERR+*     .. Data statements ..+      DATA               ICH/'UL'/+*     .. Executable Statements ..+      FULL = SNAME( 3: 3 ).EQ.'Y'+      BANDED = SNAME( 3: 3 ).EQ.'B'+      PACKED = SNAME( 3: 3 ).EQ.'P'+*     Define the number of arguments.+      IF( FULL )THEN+         NARGS = 10+      ELSE IF( BANDED )THEN+         NARGS = 11+      ELSE IF( PACKED )THEN+         NARGS = 9+      END IF+*+      NC = 0+      RESET = .TRUE.+      ERRMAX = ZERO+*+      DO 110 IN = 1, NIDIM+         N = IDIM( IN )+*+         IF( BANDED )THEN+            NK = NKB+         ELSE+            NK = 1+         END IF+         DO 100 IK = 1, NK+            IF( BANDED )THEN+               K = KB( IK )+            ELSE+               K = N - 1+            END IF+*           Set LDA to 1 more than minimum value if room.+            IF( BANDED )THEN+               LDA = K + 1+            ELSE+               LDA = N+            END IF+            IF( LDA.LT.NMAX )+     $         LDA = LDA + 1+*           Skip tests if not enough room.+            IF( LDA.GT.NMAX )+     $         GO TO 100+            IF( PACKED )THEN+               LAA = ( N*( N + 1 ) )/2+            ELSE+               LAA = LDA*N+            END IF+            NULL = N.LE.0+*+            DO 90 IC = 1, 2+               UPLO = ICH( IC: IC )+*+*              Generate the matrix A.+*+               TRANSL = ZERO+               CALL SMAKE( SNAME( 2: 3 ), UPLO, ' ', N, N, A, NMAX, AA,+     $                     LDA, K, K, RESET, TRANSL )+*+               DO 80 IX = 1, NINC+                  INCX = INC( IX )+                  LX = ABS( INCX )*N+*+*                 Generate the vector X.+*+                  TRANSL = HALF+                  CALL SMAKE( 'GE', ' ', ' ', 1, N, X, 1, XX,+     $                        ABS( INCX ), 0, N - 1, RESET, TRANSL )+                  IF( N.GT.1 )THEN+                     X( N/2 ) = ZERO+                     XX( 1 + ABS( INCX )*( N/2 - 1 ) ) = ZERO+                  END IF+*+                  DO 70 IY = 1, NINC+                     INCY = INC( IY )+                     LY = ABS( INCY )*N+*+                     DO 60 IA = 1, NALF+                        ALPHA = ALF( IA )+*+                        DO 50 IB = 1, NBET+                           BETA = BET( IB )+*+*                          Generate the vector Y.+*+                           TRANSL = ZERO+                           CALL SMAKE( 'GE', ' ', ' ', 1, N, Y, 1, YY,+     $                                 ABS( INCY ), 0, N - 1, RESET,+     $                                 TRANSL )+*+                           NC = NC + 1+*+*                          Save every datum before calling the+*                          subroutine.+*+                           UPLOS = UPLO+                           NS = N+                           KS = K+                           ALS = ALPHA+                           DO 10 I = 1, LAA+                              AS( I ) = AA( I )+   10                      CONTINUE+                           LDAS = LDA+                           DO 20 I = 1, LX+                              XS( I ) = XX( I )+   20                      CONTINUE+                           INCXS = INCX+                           BLS = BETA+                           DO 30 I = 1, LY+                              YS( I ) = YY( I )+   30                      CONTINUE+                           INCYS = INCY+*+*                          Call the subroutine.+*+                           IF( FULL )THEN+                              IF( TRACE )+     $                           WRITE( NTRA, FMT = 9993 )NC, SNAME,+     $                           UPLO, N, ALPHA, LDA, INCX, BETA, INCY+                              IF( REWI )+     $                           REWIND NTRA+                              CALL SSYMV( UPLO, N, ALPHA, AA, LDA, XX,+     $                                    INCX, BETA, YY, INCY )+                           ELSE IF( BANDED )THEN+                              IF( TRACE )+     $                           WRITE( NTRA, FMT = 9994 )NC, SNAME,+     $                           UPLO, N, K, ALPHA, LDA, INCX, BETA,+     $                           INCY+                              IF( REWI )+     $                           REWIND NTRA+                              CALL SSBMV( UPLO, N, K, ALPHA, AA, LDA,+     $                                    XX, INCX, BETA, YY, INCY )+                           ELSE IF( PACKED )THEN+                              IF( TRACE )+     $                           WRITE( NTRA, FMT = 9995 )NC, SNAME,+     $                           UPLO, N, ALPHA, INCX, BETA, INCY+                              IF( REWI )+     $                           REWIND NTRA+                              CALL SSPMV( UPLO, N, ALPHA, AA, XX, INCX,+     $                                    BETA, YY, INCY )+                           END IF+*+*                          Check if error-exit was taken incorrectly.+*+                           IF( .NOT.OK )THEN+                              WRITE( NOUT, FMT = 9992 )+                              FATAL = .TRUE.+                              GO TO 120+                           END IF+*+*                          See what data changed inside subroutines.+*+                           ISAME( 1 ) = UPLO.EQ.UPLOS+                           ISAME( 2 ) = NS.EQ.N+                           IF( FULL )THEN+                              ISAME( 3 ) = ALS.EQ.ALPHA+                              ISAME( 4 ) = LSE( AS, AA, LAA )+                              ISAME( 5 ) = LDAS.EQ.LDA+                              ISAME( 6 ) = LSE( XS, XX, LX )+                              ISAME( 7 ) = INCXS.EQ.INCX+                              ISAME( 8 ) = BLS.EQ.BETA+                              IF( NULL )THEN+                                 ISAME( 9 ) = LSE( YS, YY, LY )+                              ELSE+                                 ISAME( 9 ) = LSERES( 'GE', ' ', 1, N,+     $                                        YS, YY, ABS( INCY ) )+                              END IF+                              ISAME( 10 ) = INCYS.EQ.INCY+                           ELSE IF( BANDED )THEN+                              ISAME( 3 ) = KS.EQ.K+                              ISAME( 4 ) = ALS.EQ.ALPHA+                              ISAME( 5 ) = LSE( AS, AA, LAA )+                              ISAME( 6 ) = LDAS.EQ.LDA+                              ISAME( 7 ) = LSE( XS, XX, LX )+                              ISAME( 8 ) = INCXS.EQ.INCX+                              ISAME( 9 ) = BLS.EQ.BETA+                              IF( NULL )THEN+                                 ISAME( 10 ) = LSE( YS, YY, LY )+                              ELSE+                                 ISAME( 10 ) = LSERES( 'GE', ' ', 1, N,+     $                                         YS, YY, ABS( INCY ) )+                              END IF+                              ISAME( 11 ) = INCYS.EQ.INCY+                           ELSE IF( PACKED )THEN+                              ISAME( 3 ) = ALS.EQ.ALPHA+                              ISAME( 4 ) = LSE( AS, AA, LAA )+                              ISAME( 5 ) = LSE( XS, XX, LX )+                              ISAME( 6 ) = INCXS.EQ.INCX+                              ISAME( 7 ) = BLS.EQ.BETA+                              IF( NULL )THEN+                                 ISAME( 8 ) = LSE( YS, YY, LY )+                              ELSE+                                 ISAME( 8 ) = LSERES( 'GE', ' ', 1, N,+     $                                        YS, YY, ABS( INCY ) )+                              END IF+                              ISAME( 9 ) = INCYS.EQ.INCY+                           END IF+*+*                          If data was incorrectly changed, report and+*                          return.+*+                           SAME = .TRUE.+                           DO 40 I = 1, NARGS+                              SAME = SAME.AND.ISAME( I )+                              IF( .NOT.ISAME( I ) )+     $                           WRITE( NOUT, FMT = 9998 )I+   40                      CONTINUE+                           IF( .NOT.SAME )THEN+                              FATAL = .TRUE.+                              GO TO 120+                           END IF+*+                           IF( .NOT.NULL )THEN+*+*                             Check the result.+*+                              CALL SMVCH( 'N', N, N, ALPHA, A, NMAX, X,+     $                                    INCX, BETA, Y, INCY, YT, G,+     $                                    YY, EPS, ERR, FATAL, NOUT,+     $                                    .TRUE. )+                              ERRMAX = MAX( ERRMAX, ERR )+*                             If got really bad answer, report and+*                             return.+                              IF( FATAL )+     $                           GO TO 120+                           ELSE+*                             Avoid repeating tests with N.le.0+                              GO TO 110+                           END IF+*+   50                   CONTINUE+*+   60                CONTINUE+*+   70             CONTINUE+*+   80          CONTINUE+*+   90       CONTINUE+*+  100    CONTINUE+*+  110 CONTINUE+*+*     Report result.+*+      IF( ERRMAX.LT.THRESH )THEN+         WRITE( NOUT, FMT = 9999 )SNAME, NC+      ELSE+         WRITE( NOUT, FMT = 9997 )SNAME, NC, ERRMAX+      END IF+      GO TO 130+*+  120 CONTINUE+      WRITE( NOUT, FMT = 9996 )SNAME+      IF( FULL )THEN+         WRITE( NOUT, FMT = 9993 )NC, SNAME, UPLO, N, ALPHA, LDA, INCX,+     $      BETA, INCY+      ELSE IF( BANDED )THEN+         WRITE( NOUT, FMT = 9994 )NC, SNAME, UPLO, N, K, ALPHA, LDA,+     $      INCX, BETA, INCY+      ELSE IF( PACKED )THEN+         WRITE( NOUT, FMT = 9995 )NC, SNAME, UPLO, N, ALPHA, INCX,+     $      BETA, INCY+      END IF+*+  130 CONTINUE+      RETURN+*+ 9999 FORMAT( ' ', A6, ' PASSED THE COMPUTATIONAL TESTS (', I6, ' CALL',+     $      'S)' )+ 9998 FORMAT( ' ******* FATAL ERROR - PARAMETER NUMBER ', I2, ' WAS CH',+     $      'ANGED INCORRECTLY *******' )+ 9997 FORMAT( ' ', A6, ' COMPLETED THE COMPUTATIONAL TESTS (', I6, ' C',+     $      'ALLS)', /' ******* BUT WITH MAXIMUM TEST RATIO', F8.2,+     $      ' - SUSPECT *******' )+ 9996 FORMAT( ' ******* ', A6, ' FAILED ON CALL NUMBER:' )+ 9995 FORMAT( 1X, I6, ': ', A6, '(''', A1, ''',', I3, ',', F4.1, ', AP',+     $      ', X,', I2, ',', F4.1, ', Y,', I2, ')                .' )+ 9994 FORMAT( 1X, I6, ': ', A6, '(''', A1, ''',', 2( I3, ',' ), F4.1,+     $      ', A,', I3, ', X,', I2, ',', F4.1, ', Y,', I2,+     $      ')         .' )+ 9993 FORMAT( 1X, I6, ': ', A6, '(''', A1, ''',', I3, ',', F4.1, ', A,',+     $      I3, ', X,', I2, ',', F4.1, ', Y,', I2, ')             .' )+ 9992 FORMAT( ' ******* FATAL ERROR - ERROR-EXIT TAKEN ON VALID CALL *',+     $      '******' )+*+*     End of SCHK2.+*+      END+      SUBROUTINE SCHK3( SNAME, EPS, THRESH, NOUT, NTRA, TRACE, REWI,+     $                  FATAL, NIDIM, IDIM, NKB, KB, NINC, INC, NMAX,+     $                  INCMAX, A, AA, AS, X, XX, XS, XT, G, Z )+*+*  Tests STRMV, STBMV, STPMV, STRSV, STBSV and STPSV.+*+*  Auxiliary routine for test program for Level 2 Blas.+*+*  -- Written on 10-August-1987.+*     Richard Hanson, Sandia National Labs.+*     Jeremy Du Croz, NAG Central Office.+*+*     .. Parameters ..+      REAL               ZERO, HALF, ONE+      PARAMETER          ( ZERO = 0.0, HALF = 0.5, ONE = 1.0 )+*     .. Scalar Arguments ..+      REAL               EPS, THRESH+      INTEGER            INCMAX, NIDIM, NINC, NKB, NMAX, NOUT, NTRA+      LOGICAL            FATAL, REWI, TRACE+      CHARACTER*6        SNAME+*     .. Array Arguments ..+      REAL               A( NMAX, NMAX ), AA( NMAX*NMAX ),+     $                   AS( NMAX*NMAX ), G( NMAX ), X( NMAX ),+     $                   XS( NMAX*INCMAX ), XT( NMAX ),+     $                   XX( NMAX*INCMAX ), Z( NMAX )+      INTEGER            IDIM( NIDIM ), INC( NINC ), KB( NKB )+*     .. Local Scalars ..+      REAL               ERR, ERRMAX, TRANSL+      INTEGER            I, ICD, ICT, ICU, IK, IN, INCX, INCXS, IX, K,+     $                   KS, LAA, LDA, LDAS, LX, N, NARGS, NC, NK, NS+      LOGICAL            BANDED, FULL, NULL, PACKED, RESET, SAME+      CHARACTER*1        DIAG, DIAGS, TRANS, TRANSS, UPLO, UPLOS+      CHARACTER*2        ICHD, ICHU+      CHARACTER*3        ICHT+*     .. Local Arrays ..+      LOGICAL            ISAME( 13 )+*     .. External Functions ..+      LOGICAL            LSE, LSERES+      EXTERNAL           LSE, LSERES+*     .. External Subroutines ..+      EXTERNAL           SMAKE, SMVCH, STBMV, STBSV, STPMV, STPSV,+     $                   STRMV, STRSV+*     .. Intrinsic Functions ..+      INTRINSIC          ABS, MAX+*     .. Scalars in Common ..+      INTEGER            INFOT, NOUTC+      LOGICAL            LERR, OK+*     .. Common blocks ..+      COMMON             /INFOC/INFOT, NOUTC, OK, LERR+*     .. Data statements ..+      DATA               ICHU/'UL'/, ICHT/'NTC'/, ICHD/'UN'/+*     .. Executable Statements ..+      FULL = SNAME( 3: 3 ).EQ.'R'+      BANDED = SNAME( 3: 3 ).EQ.'B'+      PACKED = SNAME( 3: 3 ).EQ.'P'+*     Define the number of arguments.+      IF( FULL )THEN+         NARGS = 8+      ELSE IF( BANDED )THEN+         NARGS = 9+      ELSE IF( PACKED )THEN+         NARGS = 7+      END IF+*+      NC = 0+      RESET = .TRUE.+      ERRMAX = ZERO+*     Set up zero vector for SMVCH.+      DO 10 I = 1, NMAX+         Z( I ) = ZERO+   10 CONTINUE+*+      DO 110 IN = 1, NIDIM+         N = IDIM( IN )+*+         IF( BANDED )THEN+            NK = NKB+         ELSE+            NK = 1+         END IF+         DO 100 IK = 1, NK+            IF( BANDED )THEN+               K = KB( IK )+            ELSE+               K = N - 1+            END IF+*           Set LDA to 1 more than minimum value if room.+            IF( BANDED )THEN+               LDA = K + 1+            ELSE+               LDA = N+            END IF+            IF( LDA.LT.NMAX )+     $         LDA = LDA + 1+*           Skip tests if not enough room.+            IF( LDA.GT.NMAX )+     $         GO TO 100+            IF( PACKED )THEN+               LAA = ( N*( N + 1 ) )/2+            ELSE+               LAA = LDA*N+            END IF+            NULL = N.LE.0+*+            DO 90 ICU = 1, 2+               UPLO = ICHU( ICU: ICU )+*+               DO 80 ICT = 1, 3+                  TRANS = ICHT( ICT: ICT )+*+                  DO 70 ICD = 1, 2+                     DIAG = ICHD( ICD: ICD )+*+*                    Generate the matrix A.+*+                     TRANSL = ZERO+                     CALL SMAKE( SNAME( 2: 3 ), UPLO, DIAG, N, N, A,+     $                           NMAX, AA, LDA, K, K, RESET, TRANSL )+*+                     DO 60 IX = 1, NINC+                        INCX = INC( IX )+                        LX = ABS( INCX )*N+*+*                       Generate the vector X.+*+                        TRANSL = HALF+                        CALL SMAKE( 'GE', ' ', ' ', 1, N, X, 1, XX,+     $                              ABS( INCX ), 0, N - 1, RESET,+     $                              TRANSL )+                        IF( N.GT.1 )THEN+                           X( N/2 ) = ZERO+                           XX( 1 + ABS( INCX )*( N/2 - 1 ) ) = ZERO+                        END IF+*+                        NC = NC + 1+*+*                       Save every datum before calling the subroutine.+*+                        UPLOS = UPLO+                        TRANSS = TRANS+                        DIAGS = DIAG+                        NS = N+                        KS = K+                        DO 20 I = 1, LAA+                           AS( I ) = AA( I )+   20                   CONTINUE+                        LDAS = LDA+                        DO 30 I = 1, LX+                           XS( I ) = XX( I )+   30                   CONTINUE+                        INCXS = INCX+*+*                       Call the subroutine.+*+                        IF( SNAME( 4: 5 ).EQ.'MV' )THEN+                           IF( FULL )THEN+                              IF( TRACE )+     $                           WRITE( NTRA, FMT = 9993 )NC, SNAME,+     $                           UPLO, TRANS, DIAG, N, LDA, INCX+                              IF( REWI )+     $                           REWIND NTRA+                              CALL STRMV( UPLO, TRANS, DIAG, N, AA, LDA,+     $                                    XX, INCX )+                           ELSE IF( BANDED )THEN+                              IF( TRACE )+     $                           WRITE( NTRA, FMT = 9994 )NC, SNAME,+     $                           UPLO, TRANS, DIAG, N, K, LDA, INCX+                              IF( REWI )+     $                           REWIND NTRA+                              CALL STBMV( UPLO, TRANS, DIAG, N, K, AA,+     $                                    LDA, XX, INCX )+                           ELSE IF( PACKED )THEN+                              IF( TRACE )+     $                           WRITE( NTRA, FMT = 9995 )NC, SNAME,+     $                           UPLO, TRANS, DIAG, N, INCX+                              IF( REWI )+     $                           REWIND NTRA+                              CALL STPMV( UPLO, TRANS, DIAG, N, AA, XX,+     $                                    INCX )+                           END IF+                        ELSE IF( SNAME( 4: 5 ).EQ.'SV' )THEN+                           IF( FULL )THEN+                              IF( TRACE )+     $                           WRITE( NTRA, FMT = 9993 )NC, SNAME,+     $                           UPLO, TRANS, DIAG, N, LDA, INCX+                              IF( REWI )+     $                           REWIND NTRA+                              CALL STRSV( UPLO, TRANS, DIAG, N, AA, LDA,+     $                                    XX, INCX )+                           ELSE IF( BANDED )THEN+                              IF( TRACE )+     $                           WRITE( NTRA, FMT = 9994 )NC, SNAME,+     $                           UPLO, TRANS, DIAG, N, K, LDA, INCX+                              IF( REWI )+     $                           REWIND NTRA+                              CALL STBSV( UPLO, TRANS, DIAG, N, K, AA,+     $                                    LDA, XX, INCX )+                           ELSE IF( PACKED )THEN+                              IF( TRACE )+     $                           WRITE( NTRA, FMT = 9995 )NC, SNAME,+     $                           UPLO, TRANS, DIAG, N, INCX+                              IF( REWI )+     $                           REWIND NTRA+                              CALL STPSV( UPLO, TRANS, DIAG, N, AA, XX,+     $                                    INCX )+                           END IF+                        END IF+*+*                       Check if error-exit was taken incorrectly.+*+                        IF( .NOT.OK )THEN+                           WRITE( NOUT, FMT = 9992 )+                           FATAL = .TRUE.+                           GO TO 120+                        END IF+*+*                       See what data changed inside subroutines.+*+                        ISAME( 1 ) = UPLO.EQ.UPLOS+                        ISAME( 2 ) = TRANS.EQ.TRANSS+                        ISAME( 3 ) = DIAG.EQ.DIAGS+                        ISAME( 4 ) = NS.EQ.N+                        IF( FULL )THEN+                           ISAME( 5 ) = LSE( AS, AA, LAA )+                           ISAME( 6 ) = LDAS.EQ.LDA+                           IF( NULL )THEN+                              ISAME( 7 ) = LSE( XS, XX, LX )+                           ELSE+                              ISAME( 7 ) = LSERES( 'GE', ' ', 1, N, XS,+     $                                     XX, ABS( INCX ) )+                           END IF+                           ISAME( 8 ) = INCXS.EQ.INCX+                        ELSE IF( BANDED )THEN+                           ISAME( 5 ) = KS.EQ.K+                           ISAME( 6 ) = LSE( AS, AA, LAA )+                           ISAME( 7 ) = LDAS.EQ.LDA+                           IF( NULL )THEN+                              ISAME( 8 ) = LSE( XS, XX, LX )+                           ELSE+                              ISAME( 8 ) = LSERES( 'GE', ' ', 1, N, XS,+     $                                     XX, ABS( INCX ) )+                           END IF+                           ISAME( 9 ) = INCXS.EQ.INCX+                        ELSE IF( PACKED )THEN+                           ISAME( 5 ) = LSE( AS, AA, LAA )+                           IF( NULL )THEN+                              ISAME( 6 ) = LSE( XS, XX, LX )+                           ELSE+                              ISAME( 6 ) = LSERES( 'GE', ' ', 1, N, XS,+     $                                     XX, ABS( INCX ) )+                           END IF+                           ISAME( 7 ) = INCXS.EQ.INCX+                        END IF+*+*                       If data was incorrectly changed, report and+*                       return.+*+                        SAME = .TRUE.+                        DO 40 I = 1, NARGS+                           SAME = SAME.AND.ISAME( I )+                           IF( .NOT.ISAME( I ) )+     $                        WRITE( NOUT, FMT = 9998 )I+   40                   CONTINUE+                        IF( .NOT.SAME )THEN+                           FATAL = .TRUE.+                           GO TO 120+                        END IF+*+                        IF( .NOT.NULL )THEN+                           IF( SNAME( 4: 5 ).EQ.'MV' )THEN+*+*                             Check the result.+*+                              CALL SMVCH( TRANS, N, N, ONE, A, NMAX, X,+     $                                    INCX, ZERO, Z, INCX, XT, G,+     $                                    XX, EPS, ERR, FATAL, NOUT,+     $                                    .TRUE. )+                           ELSE IF( SNAME( 4: 5 ).EQ.'SV' )THEN+*+*                             Compute approximation to original vector.+*+                              DO 50 I = 1, N+                                 Z( I ) = XX( 1 + ( I - 1 )*+     $                                    ABS( INCX ) )+                                 XX( 1 + ( I - 1 )*ABS( INCX ) )+     $                              = X( I )+   50                         CONTINUE+                              CALL SMVCH( TRANS, N, N, ONE, A, NMAX, Z,+     $                                    INCX, ZERO, X, INCX, XT, G,+     $                                    XX, EPS, ERR, FATAL, NOUT,+     $                                    .FALSE. )+                           END IF+                           ERRMAX = MAX( ERRMAX, ERR )+*                          If got really bad answer, report and return.+                           IF( FATAL )+     $                        GO TO 120+                        ELSE+*                          Avoid repeating tests with N.le.0.+                           GO TO 110+                        END IF+*+   60                CONTINUE+*+   70             CONTINUE+*+   80          CONTINUE+*+   90       CONTINUE+*+  100    CONTINUE+*+  110 CONTINUE+*+*     Report result.+*+      IF( ERRMAX.LT.THRESH )THEN+         WRITE( NOUT, FMT = 9999 )SNAME, NC+      ELSE+         WRITE( NOUT, FMT = 9997 )SNAME, NC, ERRMAX+      END IF+      GO TO 130+*+  120 CONTINUE+      WRITE( NOUT, FMT = 9996 )SNAME+      IF( FULL )THEN+         WRITE( NOUT, FMT = 9993 )NC, SNAME, UPLO, TRANS, DIAG, N, LDA,+     $      INCX+      ELSE IF( BANDED )THEN+         WRITE( NOUT, FMT = 9994 )NC, SNAME, UPLO, TRANS, DIAG, N, K,+     $      LDA, INCX+      ELSE IF( PACKED )THEN+         WRITE( NOUT, FMT = 9995 )NC, SNAME, UPLO, TRANS, DIAG, N, INCX+      END IF+*+  130 CONTINUE+      RETURN+*+ 9999 FORMAT( ' ', A6, ' PASSED THE COMPUTATIONAL TESTS (', I6, ' CALL',+     $      'S)' )+ 9998 FORMAT( ' ******* FATAL ERROR - PARAMETER NUMBER ', I2, ' WAS CH',+     $      'ANGED INCORRECTLY *******' )+ 9997 FORMAT( ' ', A6, ' COMPLETED THE COMPUTATIONAL TESTS (', I6, ' C',+     $      'ALLS)', /' ******* BUT WITH MAXIMUM TEST RATIO', F8.2,+     $      ' - SUSPECT *******' )+ 9996 FORMAT( ' ******* ', A6, ' FAILED ON CALL NUMBER:' )+ 9995 FORMAT( 1X, I6, ': ', A6, '(', 3( '''', A1, ''',' ), I3, ', AP, ',+     $      'X,', I2, ')                        .' )+ 9994 FORMAT( 1X, I6, ': ', A6, '(', 3( '''', A1, ''',' ), 2( I3, ',' ),+     $      ' A,', I3, ', X,', I2, ')                 .' )+ 9993 FORMAT( 1X, I6, ': ', A6, '(', 3( '''', A1, ''',' ), I3, ', A,',+     $      I3, ', X,', I2, ')                     .' )+ 9992 FORMAT( ' ******* FATAL ERROR - ERROR-EXIT TAKEN ON VALID CALL *',+     $      '******' )+*+*     End of SCHK3.+*+      END+      SUBROUTINE SCHK4( SNAME, EPS, THRESH, NOUT, NTRA, TRACE, REWI,+     $                  FATAL, NIDIM, IDIM, NALF, ALF, NINC, INC, NMAX,+     $                  INCMAX, A, AA, AS, X, XX, XS, Y, YY, YS, YT, G,+     $                  Z )+*+*  Tests SGER.+*+*  Auxiliary routine for test program for Level 2 Blas.+*+*  -- Written on 10-August-1987.+*     Richard Hanson, Sandia National Labs.+*     Jeremy Du Croz, NAG Central Office.+*+*     .. Parameters ..+      REAL               ZERO, HALF, ONE+      PARAMETER          ( ZERO = 0.0, HALF = 0.5, ONE = 1.0 )+*     .. Scalar Arguments ..+      REAL               EPS, THRESH+      INTEGER            INCMAX, NALF, NIDIM, NINC, NMAX, NOUT, NTRA+      LOGICAL            FATAL, REWI, TRACE+      CHARACTER*6        SNAME+*     .. Array Arguments ..+      REAL               A( NMAX, NMAX ), AA( NMAX*NMAX ), ALF( NALF ),+     $                   AS( NMAX*NMAX ), G( NMAX ), X( NMAX ),+     $                   XS( NMAX*INCMAX ), XX( NMAX*INCMAX ),+     $                   Y( NMAX ), YS( NMAX*INCMAX ), YT( NMAX ),+     $                   YY( NMAX*INCMAX ), Z( NMAX )+      INTEGER            IDIM( NIDIM ), INC( NINC )+*     .. Local Scalars ..+      REAL               ALPHA, ALS, ERR, ERRMAX, TRANSL+      INTEGER            I, IA, IM, IN, INCX, INCXS, INCY, INCYS, IX,+     $                   IY, J, LAA, LDA, LDAS, LX, LY, M, MS, N, NARGS,+     $                   NC, ND, NS+      LOGICAL            NULL, RESET, SAME+*     .. Local Arrays ..+      REAL               W( 1 )+      LOGICAL            ISAME( 13 )+*     .. External Functions ..+      LOGICAL            LSE, LSERES+      EXTERNAL           LSE, LSERES+*     .. External Subroutines ..+      EXTERNAL           SGER, SMAKE, SMVCH+*     .. Intrinsic Functions ..+      INTRINSIC          ABS, MAX, MIN+*     .. Scalars in Common ..+      INTEGER            INFOT, NOUTC+      LOGICAL            LERR, OK+*     .. Common blocks ..+      COMMON             /INFOC/INFOT, NOUTC, OK, LERR+*     .. Executable Statements ..+*     Define the number of arguments.+      NARGS = 9+*+      NC = 0+      RESET = .TRUE.+      ERRMAX = ZERO+*+      DO 120 IN = 1, NIDIM+         N = IDIM( IN )+         ND = N/2 + 1+*+         DO 110 IM = 1, 2+            IF( IM.EQ.1 )+     $         M = MAX( N - ND, 0 )+            IF( IM.EQ.2 )+     $         M = MIN( N + ND, NMAX )+*+*           Set LDA to 1 more than minimum value if room.+            LDA = M+            IF( LDA.LT.NMAX )+     $         LDA = LDA + 1+*           Skip tests if not enough room.+            IF( LDA.GT.NMAX )+     $         GO TO 110+            LAA = LDA*N+            NULL = N.LE.0.OR.M.LE.0+*+            DO 100 IX = 1, NINC+               INCX = INC( IX )+               LX = ABS( INCX )*M+*+*              Generate the vector X.+*+               TRANSL = HALF+               CALL SMAKE( 'GE', ' ', ' ', 1, M, X, 1, XX, ABS( INCX ),+     $                     0, M - 1, RESET, TRANSL )+               IF( M.GT.1 )THEN+                  X( M/2 ) = ZERO+                  XX( 1 + ABS( INCX )*( M/2 - 1 ) ) = ZERO+               END IF+*+               DO 90 IY = 1, NINC+                  INCY = INC( IY )+                  LY = ABS( INCY )*N+*+*                 Generate the vector Y.+*+                  TRANSL = ZERO+                  CALL SMAKE( 'GE', ' ', ' ', 1, N, Y, 1, YY,+     $                        ABS( INCY ), 0, N - 1, RESET, TRANSL )+                  IF( N.GT.1 )THEN+                     Y( N/2 ) = ZERO+                     YY( 1 + ABS( INCY )*( N/2 - 1 ) ) = ZERO+                  END IF+*+                  DO 80 IA = 1, NALF+                     ALPHA = ALF( IA )+*+*                    Generate the matrix A.+*+                     TRANSL = ZERO+                     CALL SMAKE( SNAME( 2: 3 ), ' ', ' ', M, N, A, NMAX,+     $                           AA, LDA, M - 1, N - 1, RESET, TRANSL )+*+                     NC = NC + 1+*+*                    Save every datum before calling the subroutine.+*+                     MS = M+                     NS = N+                     ALS = ALPHA+                     DO 10 I = 1, LAA+                        AS( I ) = AA( I )+   10                CONTINUE+                     LDAS = LDA+                     DO 20 I = 1, LX+                        XS( I ) = XX( I )+   20                CONTINUE+                     INCXS = INCX+                     DO 30 I = 1, LY+                        YS( I ) = YY( I )+   30                CONTINUE+                     INCYS = INCY+*+*                    Call the subroutine.+*+                     IF( TRACE )+     $                  WRITE( NTRA, FMT = 9994 )NC, SNAME, M, N,+     $                  ALPHA, INCX, INCY, LDA+                     IF( REWI )+     $                  REWIND NTRA+                     CALL SGER( M, N, ALPHA, XX, INCX, YY, INCY, AA,+     $                          LDA )+*+*                    Check if error-exit was taken incorrectly.+*+                     IF( .NOT.OK )THEN+                        WRITE( NOUT, FMT = 9993 )+                        FATAL = .TRUE.+                        GO TO 140+                     END IF+*+*                    See what data changed inside subroutine.+*+                     ISAME( 1 ) = MS.EQ.M+                     ISAME( 2 ) = NS.EQ.N+                     ISAME( 3 ) = ALS.EQ.ALPHA+                     ISAME( 4 ) = LSE( XS, XX, LX )+                     ISAME( 5 ) = INCXS.EQ.INCX+                     ISAME( 6 ) = LSE( YS, YY, LY )+                     ISAME( 7 ) = INCYS.EQ.INCY+                     IF( NULL )THEN+                        ISAME( 8 ) = LSE( AS, AA, LAA )+                     ELSE+                        ISAME( 8 ) = LSERES( 'GE', ' ', M, N, AS, AA,+     $                               LDA )+                     END IF+                     ISAME( 9 ) = LDAS.EQ.LDA+*+*                    If data was incorrectly changed, report and return.+*+                     SAME = .TRUE.+                     DO 40 I = 1, NARGS+                        SAME = SAME.AND.ISAME( I )+                        IF( .NOT.ISAME( I ) )+     $                     WRITE( NOUT, FMT = 9998 )I+   40                CONTINUE+                     IF( .NOT.SAME )THEN+                        FATAL = .TRUE.+                        GO TO 140+                     END IF+*+                     IF( .NOT.NULL )THEN+*+*                       Check the result column by column.+*+                        IF( INCX.GT.0 )THEN+                           DO 50 I = 1, M+                              Z( I ) = X( I )+   50                      CONTINUE+                        ELSE+                           DO 60 I = 1, M+                              Z( I ) = X( M - I + 1 )+   60                      CONTINUE+                        END IF+                        DO 70 J = 1, N+                           IF( INCY.GT.0 )THEN+                              W( 1 ) = Y( J )+                           ELSE+                              W( 1 ) = Y( N - J + 1 )+                           END IF+                           CALL SMVCH( 'N', M, 1, ALPHA, Z, NMAX, W, 1,+     $                                 ONE, A( 1, J ), 1, YT, G,+     $                                 AA( 1 + ( J - 1 )*LDA ), EPS,+     $                                 ERR, FATAL, NOUT, .TRUE. )+                           ERRMAX = MAX( ERRMAX, ERR )+*                          If got really bad answer, report and return.+                           IF( FATAL )+     $                        GO TO 130+   70                   CONTINUE+                     ELSE+*                       Avoid repeating tests with M.le.0 or N.le.0.+                        GO TO 110+                     END IF+*+   80             CONTINUE+*+   90          CONTINUE+*+  100       CONTINUE+*+  110    CONTINUE+*+  120 CONTINUE+*+*     Report result.+*+      IF( ERRMAX.LT.THRESH )THEN+         WRITE( NOUT, FMT = 9999 )SNAME, NC+      ELSE+         WRITE( NOUT, FMT = 9997 )SNAME, NC, ERRMAX+      END IF+      GO TO 150+*+  130 CONTINUE+      WRITE( NOUT, FMT = 9995 )J+*+  140 CONTINUE+      WRITE( NOUT, FMT = 9996 )SNAME+      WRITE( NOUT, FMT = 9994 )NC, SNAME, M, N, ALPHA, INCX, INCY, LDA+*+  150 CONTINUE+      RETURN+*+ 9999 FORMAT( ' ', A6, ' PASSED THE COMPUTATIONAL TESTS (', I6, ' CALL',+     $      'S)' )+ 9998 FORMAT( ' ******* FATAL ERROR - PARAMETER NUMBER ', I2, ' WAS CH',+     $      'ANGED INCORRECTLY *******' )+ 9997 FORMAT( ' ', A6, ' COMPLETED THE COMPUTATIONAL TESTS (', I6, ' C',+     $      'ALLS)', /' ******* BUT WITH MAXIMUM TEST RATIO', F8.2,+     $      ' - SUSPECT *******' )+ 9996 FORMAT( ' ******* ', A6, ' FAILED ON CALL NUMBER:' )+ 9995 FORMAT( '      THESE ARE THE RESULTS FOR COLUMN ', I3 )+ 9994 FORMAT( 1X, I6, ': ', A6, '(', 2( I3, ',' ), F4.1, ', X,', I2,+     $      ', Y,', I2, ', A,', I3, ')                  .' )+ 9993 FORMAT( ' ******* FATAL ERROR - ERROR-EXIT TAKEN ON VALID CALL *',+     $      '******' )+*+*     End of SCHK4.+*+      END+      SUBROUTINE SCHK5( SNAME, EPS, THRESH, NOUT, NTRA, TRACE, REWI,+     $                  FATAL, NIDIM, IDIM, NALF, ALF, NINC, INC, NMAX,+     $                  INCMAX, A, AA, AS, X, XX, XS, Y, YY, YS, YT, G,+     $                  Z )+*+*  Tests SSYR and SSPR.+*+*  Auxiliary routine for test program for Level 2 Blas.+*+*  -- Written on 10-August-1987.+*     Richard Hanson, Sandia National Labs.+*     Jeremy Du Croz, NAG Central Office.+*+*     .. Parameters ..+      REAL               ZERO, HALF, ONE+      PARAMETER          ( ZERO = 0.0, HALF = 0.5, ONE = 1.0 )+*     .. Scalar Arguments ..+      REAL               EPS, THRESH+      INTEGER            INCMAX, NALF, NIDIM, NINC, NMAX, NOUT, NTRA+      LOGICAL            FATAL, REWI, TRACE+      CHARACTER*6        SNAME+*     .. Array Arguments ..+      REAL               A( NMAX, NMAX ), AA( NMAX*NMAX ), ALF( NALF ),+     $                   AS( NMAX*NMAX ), G( NMAX ), X( NMAX ),+     $                   XS( NMAX*INCMAX ), XX( NMAX*INCMAX ),+     $                   Y( NMAX ), YS( NMAX*INCMAX ), YT( NMAX ),+     $                   YY( NMAX*INCMAX ), Z( NMAX )+      INTEGER            IDIM( NIDIM ), INC( NINC )+*     .. Local Scalars ..+      REAL               ALPHA, ALS, ERR, ERRMAX, TRANSL+      INTEGER            I, IA, IC, IN, INCX, INCXS, IX, J, JA, JJ, LAA,+     $                   LDA, LDAS, LJ, LX, N, NARGS, NC, NS+      LOGICAL            FULL, NULL, PACKED, RESET, SAME, UPPER+      CHARACTER*1        UPLO, UPLOS+      CHARACTER*2        ICH+*     .. Local Arrays ..+      REAL               W( 1 )+      LOGICAL            ISAME( 13 )+*     .. External Functions ..+      LOGICAL            LSE, LSERES+      EXTERNAL           LSE, LSERES+*     .. External Subroutines ..+      EXTERNAL           SMAKE, SMVCH, SSPR, SSYR+*     .. Intrinsic Functions ..+      INTRINSIC          ABS, MAX+*     .. Scalars in Common ..+      INTEGER            INFOT, NOUTC+      LOGICAL            LERR, OK+*     .. Common blocks ..+      COMMON             /INFOC/INFOT, NOUTC, OK, LERR+*     .. Data statements ..+      DATA               ICH/'UL'/+*     .. Executable Statements ..+      FULL = SNAME( 3: 3 ).EQ.'Y'+      PACKED = SNAME( 3: 3 ).EQ.'P'+*     Define the number of arguments.+      IF( FULL )THEN+         NARGS = 7+      ELSE IF( PACKED )THEN+         NARGS = 6+      END IF+*+      NC = 0+      RESET = .TRUE.+      ERRMAX = ZERO+*+      DO 100 IN = 1, NIDIM+         N = IDIM( IN )+*        Set LDA to 1 more than minimum value if room.+         LDA = N+         IF( LDA.LT.NMAX )+     $      LDA = LDA + 1+*        Skip tests if not enough room.+         IF( LDA.GT.NMAX )+     $      GO TO 100+         IF( PACKED )THEN+            LAA = ( N*( N + 1 ) )/2+         ELSE+            LAA = LDA*N+         END IF+*+         DO 90 IC = 1, 2+            UPLO = ICH( IC: IC )+            UPPER = UPLO.EQ.'U'+*+            DO 80 IX = 1, NINC+               INCX = INC( IX )+               LX = ABS( INCX )*N+*+*              Generate the vector X.+*+               TRANSL = HALF+               CALL SMAKE( 'GE', ' ', ' ', 1, N, X, 1, XX, ABS( INCX ),+     $                     0, N - 1, RESET, TRANSL )+               IF( N.GT.1 )THEN+                  X( N/2 ) = ZERO+                  XX( 1 + ABS( INCX )*( N/2 - 1 ) ) = ZERO+               END IF+*+               DO 70 IA = 1, NALF+                  ALPHA = ALF( IA )+                  NULL = N.LE.0.OR.ALPHA.EQ.ZERO+*+*                 Generate the matrix A.+*+                  TRANSL = ZERO+                  CALL SMAKE( SNAME( 2: 3 ), UPLO, ' ', N, N, A, NMAX,+     $                        AA, LDA, N - 1, N - 1, RESET, TRANSL )+*+                  NC = NC + 1+*+*                 Save every datum before calling the subroutine.+*+                  UPLOS = UPLO+                  NS = N+                  ALS = ALPHA+                  DO 10 I = 1, LAA+                     AS( I ) = AA( I )+   10             CONTINUE+                  LDAS = LDA+                  DO 20 I = 1, LX+                     XS( I ) = XX( I )+   20             CONTINUE+                  INCXS = INCX+*+*                 Call the subroutine.+*+                  IF( FULL )THEN+                     IF( TRACE )+     $                  WRITE( NTRA, FMT = 9993 )NC, SNAME, UPLO, N,+     $                  ALPHA, INCX, LDA+                     IF( REWI )+     $                  REWIND NTRA+                     CALL SSYR( UPLO, N, ALPHA, XX, INCX, AA, LDA )+                  ELSE IF( PACKED )THEN+                     IF( TRACE )+     $                  WRITE( NTRA, FMT = 9994 )NC, SNAME, UPLO, N,+     $                  ALPHA, INCX+                     IF( REWI )+     $                  REWIND NTRA+                     CALL SSPR( UPLO, N, ALPHA, XX, INCX, AA )+                  END IF+*+*                 Check if error-exit was taken incorrectly.+*+                  IF( .NOT.OK )THEN+                     WRITE( NOUT, FMT = 9992 )+                     FATAL = .TRUE.+                     GO TO 120+                  END IF+*+*                 See what data changed inside subroutines.+*+                  ISAME( 1 ) = UPLO.EQ.UPLOS+                  ISAME( 2 ) = NS.EQ.N+                  ISAME( 3 ) = ALS.EQ.ALPHA+                  ISAME( 4 ) = LSE( XS, XX, LX )+                  ISAME( 5 ) = INCXS.EQ.INCX+                  IF( NULL )THEN+                     ISAME( 6 ) = LSE( AS, AA, LAA )+                  ELSE+                     ISAME( 6 ) = LSERES( SNAME( 2: 3 ), UPLO, N, N, AS,+     $                            AA, LDA )+                  END IF+                  IF( .NOT.PACKED )THEN+                     ISAME( 7 ) = LDAS.EQ.LDA+                  END IF+*+*                 If data was incorrectly changed, report and return.+*+                  SAME = .TRUE.+                  DO 30 I = 1, NARGS+                     SAME = SAME.AND.ISAME( I )+                     IF( .NOT.ISAME( I ) )+     $                  WRITE( NOUT, FMT = 9998 )I+   30             CONTINUE+                  IF( .NOT.SAME )THEN+                     FATAL = .TRUE.+                     GO TO 120+                  END IF+*+                  IF( .NOT.NULL )THEN+*+*                    Check the result column by column.+*+                     IF( INCX.GT.0 )THEN+                        DO 40 I = 1, N+                           Z( I ) = X( I )+   40                   CONTINUE+                     ELSE+                        DO 50 I = 1, N+                           Z( I ) = X( N - I + 1 )+   50                   CONTINUE+                     END IF+                     JA = 1+                     DO 60 J = 1, N+                        W( 1 ) = Z( J )+                        IF( UPPER )THEN+                           JJ = 1+                           LJ = J+                        ELSE+                           JJ = J+                           LJ = N - J + 1+                        END IF+                        CALL SMVCH( 'N', LJ, 1, ALPHA, Z( JJ ), LJ, W,+     $                              1, ONE, A( JJ, J ), 1, YT, G,+     $                              AA( JA ), EPS, ERR, FATAL, NOUT,+     $                              .TRUE. )+                        IF( FULL )THEN+                           IF( UPPER )THEN+                              JA = JA + LDA+                           ELSE+                              JA = JA + LDA + 1+                           END IF+                        ELSE+                           JA = JA + LJ+                        END IF+                        ERRMAX = MAX( ERRMAX, ERR )+*                       If got really bad answer, report and return.+                        IF( FATAL )+     $                     GO TO 110+   60                CONTINUE+                  ELSE+*                    Avoid repeating tests if N.le.0.+                     IF( N.LE.0 )+     $                  GO TO 100+                  END IF+*+   70          CONTINUE+*+   80       CONTINUE+*+   90    CONTINUE+*+  100 CONTINUE+*+*     Report result.+*+      IF( ERRMAX.LT.THRESH )THEN+         WRITE( NOUT, FMT = 9999 )SNAME, NC+      ELSE+         WRITE( NOUT, FMT = 9997 )SNAME, NC, ERRMAX+      END IF+      GO TO 130+*+  110 CONTINUE+      WRITE( NOUT, FMT = 9995 )J+*+  120 CONTINUE+      WRITE( NOUT, FMT = 9996 )SNAME+      IF( FULL )THEN+         WRITE( NOUT, FMT = 9993 )NC, SNAME, UPLO, N, ALPHA, INCX, LDA+      ELSE IF( PACKED )THEN+         WRITE( NOUT, FMT = 9994 )NC, SNAME, UPLO, N, ALPHA, INCX+      END IF+*+  130 CONTINUE+      RETURN+*+ 9999 FORMAT( ' ', A6, ' PASSED THE COMPUTATIONAL TESTS (', I6, ' CALL',+     $      'S)' )+ 9998 FORMAT( ' ******* FATAL ERROR - PARAMETER NUMBER ', I2, ' WAS CH',+     $      'ANGED INCORRECTLY *******' )+ 9997 FORMAT( ' ', A6, ' COMPLETED THE COMPUTATIONAL TESTS (', I6, ' C',+     $      'ALLS)', /' ******* BUT WITH MAXIMUM TEST RATIO', F8.2,+     $      ' - SUSPECT *******' )+ 9996 FORMAT( ' ******* ', A6, ' FAILED ON CALL NUMBER:' )+ 9995 FORMAT( '      THESE ARE THE RESULTS FOR COLUMN ', I3 )+ 9994 FORMAT( 1X, I6, ': ', A6, '(''', A1, ''',', I3, ',', F4.1, ', X,',+     $      I2, ', AP)                           .' )+ 9993 FORMAT( 1X, I6, ': ', A6, '(''', A1, ''',', I3, ',', F4.1, ', X,',+     $      I2, ', A,', I3, ')                        .' )+ 9992 FORMAT( ' ******* FATAL ERROR - ERROR-EXIT TAKEN ON VALID CALL *',+     $      '******' )+*+*     End of SCHK5.+*+      END+      SUBROUTINE SCHK6( SNAME, EPS, THRESH, NOUT, NTRA, TRACE, REWI,+     $                  FATAL, NIDIM, IDIM, NALF, ALF, NINC, INC, NMAX,+     $                  INCMAX, A, AA, AS, X, XX, XS, Y, YY, YS, YT, G,+     $                  Z )+*+*  Tests SSYR2 and SSPR2.+*+*  Auxiliary routine for test program for Level 2 Blas.+*+*  -- Written on 10-August-1987.+*     Richard Hanson, Sandia National Labs.+*     Jeremy Du Croz, NAG Central Office.+*+*     .. Parameters ..+      REAL               ZERO, HALF, ONE+      PARAMETER          ( ZERO = 0.0, HALF = 0.5, ONE = 1.0 )+*     .. Scalar Arguments ..+      REAL               EPS, THRESH+      INTEGER            INCMAX, NALF, NIDIM, NINC, NMAX, NOUT, NTRA+      LOGICAL            FATAL, REWI, TRACE+      CHARACTER*6        SNAME+*     .. Array Arguments ..+      REAL               A( NMAX, NMAX ), AA( NMAX*NMAX ), ALF( NALF ),+     $                   AS( NMAX*NMAX ), G( NMAX ), X( NMAX ),+     $                   XS( NMAX*INCMAX ), XX( NMAX*INCMAX ),+     $                   Y( NMAX ), YS( NMAX*INCMAX ), YT( NMAX ),+     $                   YY( NMAX*INCMAX ), Z( NMAX, 2 )+      INTEGER            IDIM( NIDIM ), INC( NINC )+*     .. Local Scalars ..+      REAL               ALPHA, ALS, ERR, ERRMAX, TRANSL+      INTEGER            I, IA, IC, IN, INCX, INCXS, INCY, INCYS, IX,+     $                   IY, J, JA, JJ, LAA, LDA, LDAS, LJ, LX, LY, N,+     $                   NARGS, NC, NS+      LOGICAL            FULL, NULL, PACKED, RESET, SAME, UPPER+      CHARACTER*1        UPLO, UPLOS+      CHARACTER*2        ICH+*     .. Local Arrays ..+      REAL               W( 2 )+      LOGICAL            ISAME( 13 )+*     .. External Functions ..+      LOGICAL            LSE, LSERES+      EXTERNAL           LSE, LSERES+*     .. External Subroutines ..+      EXTERNAL           SMAKE, SMVCH, SSPR2, SSYR2+*     .. Intrinsic Functions ..+      INTRINSIC          ABS, MAX+*     .. Scalars in Common ..+      INTEGER            INFOT, NOUTC+      LOGICAL            LERR, OK+*     .. Common blocks ..+      COMMON             /INFOC/INFOT, NOUTC, OK, LERR+*     .. Data statements ..+      DATA               ICH/'UL'/+*     .. Executable Statements ..+      FULL = SNAME( 3: 3 ).EQ.'Y'+      PACKED = SNAME( 3: 3 ).EQ.'P'+*     Define the number of arguments.+      IF( FULL )THEN+         NARGS = 9+      ELSE IF( PACKED )THEN+         NARGS = 8+      END IF+*+      NC = 0+      RESET = .TRUE.+      ERRMAX = ZERO+*+      DO 140 IN = 1, NIDIM+         N = IDIM( IN )+*        Set LDA to 1 more than minimum value if room.+         LDA = N+         IF( LDA.LT.NMAX )+     $      LDA = LDA + 1+*        Skip tests if not enough room.+         IF( LDA.GT.NMAX )+     $      GO TO 140+         IF( PACKED )THEN+            LAA = ( N*( N + 1 ) )/2+         ELSE+            LAA = LDA*N+         END IF+*+         DO 130 IC = 1, 2+            UPLO = ICH( IC: IC )+            UPPER = UPLO.EQ.'U'+*+            DO 120 IX = 1, NINC+               INCX = INC( IX )+               LX = ABS( INCX )*N+*+*              Generate the vector X.+*+               TRANSL = HALF+               CALL SMAKE( 'GE', ' ', ' ', 1, N, X, 1, XX, ABS( INCX ),+     $                     0, N - 1, RESET, TRANSL )+               IF( N.GT.1 )THEN+                  X( N/2 ) = ZERO+                  XX( 1 + ABS( INCX )*( N/2 - 1 ) ) = ZERO+               END IF+*+               DO 110 IY = 1, NINC+                  INCY = INC( IY )+                  LY = ABS( INCY )*N+*+*                 Generate the vector Y.+*+                  TRANSL = ZERO+                  CALL SMAKE( 'GE', ' ', ' ', 1, N, Y, 1, YY,+     $                        ABS( INCY ), 0, N - 1, RESET, TRANSL )+                  IF( N.GT.1 )THEN+                     Y( N/2 ) = ZERO+                     YY( 1 + ABS( INCY )*( N/2 - 1 ) ) = ZERO+                  END IF+*+                  DO 100 IA = 1, NALF+                     ALPHA = ALF( IA )+                     NULL = N.LE.0.OR.ALPHA.EQ.ZERO+*+*                    Generate the matrix A.+*+                     TRANSL = ZERO+                     CALL SMAKE( SNAME( 2: 3 ), UPLO, ' ', N, N, A,+     $                           NMAX, AA, LDA, N - 1, N - 1, RESET,+     $                           TRANSL )+*+                     NC = NC + 1+*+*                    Save every datum before calling the subroutine.+*+                     UPLOS = UPLO+                     NS = N+                     ALS = ALPHA+                     DO 10 I = 1, LAA+                        AS( I ) = AA( I )+   10                CONTINUE+                     LDAS = LDA+                     DO 20 I = 1, LX+                        XS( I ) = XX( I )+   20                CONTINUE+                     INCXS = INCX+                     DO 30 I = 1, LY+                        YS( I ) = YY( I )+   30                CONTINUE+                     INCYS = INCY+*+*                    Call the subroutine.+*+                     IF( FULL )THEN+                        IF( TRACE )+     $                     WRITE( NTRA, FMT = 9993 )NC, SNAME, UPLO, N,+     $                     ALPHA, INCX, INCY, LDA+                        IF( REWI )+     $                     REWIND NTRA+                        CALL SSYR2( UPLO, N, ALPHA, XX, INCX, YY, INCY,+     $                              AA, LDA )+                     ELSE IF( PACKED )THEN+                        IF( TRACE )+     $                     WRITE( NTRA, FMT = 9994 )NC, SNAME, UPLO, N,+     $                     ALPHA, INCX, INCY+                        IF( REWI )+     $                     REWIND NTRA+                        CALL SSPR2( UPLO, N, ALPHA, XX, INCX, YY, INCY,+     $                              AA )+                     END IF+*+*                    Check if error-exit was taken incorrectly.+*+                     IF( .NOT.OK )THEN+                        WRITE( NOUT, FMT = 9992 )+                        FATAL = .TRUE.+                        GO TO 160+                     END IF+*+*                    See what data changed inside subroutines.+*+                     ISAME( 1 ) = UPLO.EQ.UPLOS+                     ISAME( 2 ) = NS.EQ.N+                     ISAME( 3 ) = ALS.EQ.ALPHA+                     ISAME( 4 ) = LSE( XS, XX, LX )+                     ISAME( 5 ) = INCXS.EQ.INCX+                     ISAME( 6 ) = LSE( YS, YY, LY )+                     ISAME( 7 ) = INCYS.EQ.INCY+                     IF( NULL )THEN+                        ISAME( 8 ) = LSE( AS, AA, LAA )+                     ELSE+                        ISAME( 8 ) = LSERES( SNAME( 2: 3 ), UPLO, N, N,+     $                               AS, AA, LDA )+                     END IF+                     IF( .NOT.PACKED )THEN+                        ISAME( 9 ) = LDAS.EQ.LDA+                     END IF+*+*                    If data was incorrectly changed, report and return.+*+                     SAME = .TRUE.+                     DO 40 I = 1, NARGS+                        SAME = SAME.AND.ISAME( I )+                        IF( .NOT.ISAME( I ) )+     $                     WRITE( NOUT, FMT = 9998 )I+   40                CONTINUE+                     IF( .NOT.SAME )THEN+                        FATAL = .TRUE.+                        GO TO 160+                     END IF+*+                     IF( .NOT.NULL )THEN+*+*                       Check the result column by column.+*+                        IF( INCX.GT.0 )THEN+                           DO 50 I = 1, N+                              Z( I, 1 ) = X( I )+   50                      CONTINUE+                        ELSE+                           DO 60 I = 1, N+                              Z( I, 1 ) = X( N - I + 1 )+   60                      CONTINUE+                        END IF+                        IF( INCY.GT.0 )THEN+                           DO 70 I = 1, N+                              Z( I, 2 ) = Y( I )+   70                      CONTINUE+                        ELSE+                           DO 80 I = 1, N+                              Z( I, 2 ) = Y( N - I + 1 )+   80                      CONTINUE+                        END IF+                        JA = 1+                        DO 90 J = 1, N+                           W( 1 ) = Z( J, 2 )+                           W( 2 ) = Z( J, 1 )+                           IF( UPPER )THEN+                              JJ = 1+                              LJ = J+                           ELSE+                              JJ = J+                              LJ = N - J + 1+                           END IF+                           CALL SMVCH( 'N', LJ, 2, ALPHA, Z( JJ, 1 ),+     $                                 NMAX, W, 1, ONE, A( JJ, J ), 1,+     $                                 YT, G, AA( JA ), EPS, ERR, FATAL,+     $                                 NOUT, .TRUE. )+                           IF( FULL )THEN+                              IF( UPPER )THEN+                                 JA = JA + LDA+                              ELSE+                                 JA = JA + LDA + 1+                              END IF+                           ELSE+                              JA = JA + LJ+                           END IF+                           ERRMAX = MAX( ERRMAX, ERR )+*                          If got really bad answer, report and return.+                           IF( FATAL )+     $                        GO TO 150+   90                   CONTINUE+                     ELSE+*                       Avoid repeating tests with N.le.0.+                        IF( N.LE.0 )+     $                     GO TO 140+                     END IF+*+  100             CONTINUE+*+  110          CONTINUE+*+  120       CONTINUE+*+  130    CONTINUE+*+  140 CONTINUE+*+*     Report result.+*+      IF( ERRMAX.LT.THRESH )THEN+         WRITE( NOUT, FMT = 9999 )SNAME, NC+      ELSE+         WRITE( NOUT, FMT = 9997 )SNAME, NC, ERRMAX+      END IF+      GO TO 170+*+  150 CONTINUE+      WRITE( NOUT, FMT = 9995 )J+*+  160 CONTINUE+      WRITE( NOUT, FMT = 9996 )SNAME+      IF( FULL )THEN+         WRITE( NOUT, FMT = 9993 )NC, SNAME, UPLO, N, ALPHA, INCX,+     $      INCY, LDA+      ELSE IF( PACKED )THEN+         WRITE( NOUT, FMT = 9994 )NC, SNAME, UPLO, N, ALPHA, INCX, INCY+      END IF+*+  170 CONTINUE+      RETURN+*+ 9999 FORMAT( ' ', A6, ' PASSED THE COMPUTATIONAL TESTS (', I6, ' CALL',+     $      'S)' )+ 9998 FORMAT( ' ******* FATAL ERROR - PARAMETER NUMBER ', I2, ' WAS CH',+     $      'ANGED INCORRECTLY *******' )+ 9997 FORMAT( ' ', A6, ' COMPLETED THE COMPUTATIONAL TESTS (', I6, ' C',+     $      'ALLS)', /' ******* BUT WITH MAXIMUM TEST RATIO', F8.2,+     $      ' - SUSPECT *******' )+ 9996 FORMAT( ' ******* ', A6, ' FAILED ON CALL NUMBER:' )+ 9995 FORMAT( '      THESE ARE THE RESULTS FOR COLUMN ', I3 )+ 9994 FORMAT( 1X, I6, ': ', A6, '(''', A1, ''',', I3, ',', F4.1, ', X,',+     $      I2, ', Y,', I2, ', AP)                     .' )+ 9993 FORMAT( 1X, I6, ': ', A6, '(''', A1, ''',', I3, ',', F4.1, ', X,',+     $      I2, ', Y,', I2, ', A,', I3, ')                  .' )+ 9992 FORMAT( ' ******* FATAL ERROR - ERROR-EXIT TAKEN ON VALID CALL *',+     $      '******' )+*+*     End of SCHK6.+*+      END+      SUBROUTINE SCHKE( ISNUM, SRNAMT, NOUT )+*+*  Tests the error exits from the Level 2 Blas.+*  Requires a special version of the error-handling routine XERBLA.+*  ALPHA, BETA, A, X and Y should not need to be defined.+*+*  Auxiliary routine for test program for Level 2 Blas.+*+*  -- Written on 10-August-1987.+*     Richard Hanson, Sandia National Labs.+*     Jeremy Du Croz, NAG Central Office.+*+*     .. Scalar Arguments ..+      INTEGER            ISNUM, NOUT+      CHARACTER*6        SRNAMT+*     .. Scalars in Common ..+      INTEGER            INFOT, NOUTC+      LOGICAL            LERR, OK+*     .. Local Scalars ..+      REAL               ALPHA, BETA+*     .. Local Arrays ..+      REAL               A( 1, 1 ), X( 1 ), Y( 1 )+*     .. External Subroutines ..+      EXTERNAL           CHKXER, SGBMV, SGEMV, SGER, SSBMV, SSPMV, SSPR,+     $                   SSPR2, SSYMV, SSYR, SSYR2, STBMV, STBSV, STPMV,+     $                   STPSV, STRMV, STRSV+*     .. Common blocks ..+      COMMON             /INFOC/INFOT, NOUTC, OK, LERR+*     .. Executable Statements ..+*     OK is set to .FALSE. by the special version of XERBLA or by CHKXER+*     if anything is wrong.+      OK = .TRUE.+*     LERR is set to .TRUE. by the special version of XERBLA each time+*     it is called, and is then tested and re-set by CHKXER.+      LERR = .FALSE.+      GO TO ( 10, 20, 30, 40, 50, 60, 70, 80,+     $        90, 100, 110, 120, 130, 140, 150,+     $        160 )ISNUM+   10 INFOT = 1+      CALL SGEMV( '/', 0, 0, ALPHA, A, 1, X, 1, BETA, Y, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 2+      CALL SGEMV( 'N', -1, 0, ALPHA, A, 1, X, 1, BETA, Y, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 3+      CALL SGEMV( 'N', 0, -1, ALPHA, A, 1, X, 1, BETA, Y, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 6+      CALL SGEMV( 'N', 2, 0, ALPHA, A, 1, X, 1, BETA, Y, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 8+      CALL SGEMV( 'N', 0, 0, ALPHA, A, 1, X, 0, BETA, Y, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 11+      CALL SGEMV( 'N', 0, 0, ALPHA, A, 1, X, 1, BETA, Y, 0 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      GO TO 170+   20 INFOT = 1+      CALL SGBMV( '/', 0, 0, 0, 0, ALPHA, A, 1, X, 1, BETA, Y, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 2+      CALL SGBMV( 'N', -1, 0, 0, 0, ALPHA, A, 1, X, 1, BETA, Y, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 3+      CALL SGBMV( 'N', 0, -1, 0, 0, ALPHA, A, 1, X, 1, BETA, Y, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 4+      CALL SGBMV( 'N', 0, 0, -1, 0, ALPHA, A, 1, X, 1, BETA, Y, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 5+      CALL SGBMV( 'N', 2, 0, 0, -1, ALPHA, A, 1, X, 1, BETA, Y, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 8+      CALL SGBMV( 'N', 0, 0, 1, 0, ALPHA, A, 1, X, 1, BETA, Y, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 10+      CALL SGBMV( 'N', 0, 0, 0, 0, ALPHA, A, 1, X, 0, BETA, Y, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 13+      CALL SGBMV( 'N', 0, 0, 0, 0, ALPHA, A, 1, X, 1, BETA, Y, 0 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      GO TO 170+   30 INFOT = 1+      CALL SSYMV( '/', 0, ALPHA, A, 1, X, 1, BETA, Y, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 2+      CALL SSYMV( 'U', -1, ALPHA, A, 1, X, 1, BETA, Y, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 5+      CALL SSYMV( 'U', 2, ALPHA, A, 1, X, 1, BETA, Y, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 7+      CALL SSYMV( 'U', 0, ALPHA, A, 1, X, 0, BETA, Y, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 10+      CALL SSYMV( 'U', 0, ALPHA, A, 1, X, 1, BETA, Y, 0 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      GO TO 170+   40 INFOT = 1+      CALL SSBMV( '/', 0, 0, ALPHA, A, 1, X, 1, BETA, Y, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 2+      CALL SSBMV( 'U', -1, 0, ALPHA, A, 1, X, 1, BETA, Y, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 3+      CALL SSBMV( 'U', 0, -1, ALPHA, A, 1, X, 1, BETA, Y, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 6+      CALL SSBMV( 'U', 0, 1, ALPHA, A, 1, X, 1, BETA, Y, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 8+      CALL SSBMV( 'U', 0, 0, ALPHA, A, 1, X, 0, BETA, Y, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 11+      CALL SSBMV( 'U', 0, 0, ALPHA, A, 1, X, 1, BETA, Y, 0 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      GO TO 170+   50 INFOT = 1+      CALL SSPMV( '/', 0, ALPHA, A, X, 1, BETA, Y, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 2+      CALL SSPMV( 'U', -1, ALPHA, A, X, 1, BETA, Y, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 6+      CALL SSPMV( 'U', 0, ALPHA, A, X, 0, BETA, Y, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 9+      CALL SSPMV( 'U', 0, ALPHA, A, X, 1, BETA, Y, 0 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      GO TO 170+   60 INFOT = 1+      CALL STRMV( '/', 'N', 'N', 0, A, 1, X, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 2+      CALL STRMV( 'U', '/', 'N', 0, A, 1, X, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 3+      CALL STRMV( 'U', 'N', '/', 0, A, 1, X, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 4+      CALL STRMV( 'U', 'N', 'N', -1, A, 1, X, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 6+      CALL STRMV( 'U', 'N', 'N', 2, A, 1, X, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 8+      CALL STRMV( 'U', 'N', 'N', 0, A, 1, X, 0 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      GO TO 170+   70 INFOT = 1+      CALL STBMV( '/', 'N', 'N', 0, 0, A, 1, X, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 2+      CALL STBMV( 'U', '/', 'N', 0, 0, A, 1, X, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 3+      CALL STBMV( 'U', 'N', '/', 0, 0, A, 1, X, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 4+      CALL STBMV( 'U', 'N', 'N', -1, 0, A, 1, X, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 5+      CALL STBMV( 'U', 'N', 'N', 0, -1, A, 1, X, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 7+      CALL STBMV( 'U', 'N', 'N', 0, 1, A, 1, X, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 9+      CALL STBMV( 'U', 'N', 'N', 0, 0, A, 1, X, 0 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      GO TO 170+   80 INFOT = 1+      CALL STPMV( '/', 'N', 'N', 0, A, X, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 2+      CALL STPMV( 'U', '/', 'N', 0, A, X, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 3+      CALL STPMV( 'U', 'N', '/', 0, A, X, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 4+      CALL STPMV( 'U', 'N', 'N', -1, A, X, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 7+      CALL STPMV( 'U', 'N', 'N', 0, A, X, 0 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      GO TO 170+   90 INFOT = 1+      CALL STRSV( '/', 'N', 'N', 0, A, 1, X, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 2+      CALL STRSV( 'U', '/', 'N', 0, A, 1, X, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 3+      CALL STRSV( 'U', 'N', '/', 0, A, 1, X, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 4+      CALL STRSV( 'U', 'N', 'N', -1, A, 1, X, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 6+      CALL STRSV( 'U', 'N', 'N', 2, A, 1, X, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 8+      CALL STRSV( 'U', 'N', 'N', 0, A, 1, X, 0 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      GO TO 170+  100 INFOT = 1+      CALL STBSV( '/', 'N', 'N', 0, 0, A, 1, X, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 2+      CALL STBSV( 'U', '/', 'N', 0, 0, A, 1, X, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 3+      CALL STBSV( 'U', 'N', '/', 0, 0, A, 1, X, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 4+      CALL STBSV( 'U', 'N', 'N', -1, 0, A, 1, X, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 5+      CALL STBSV( 'U', 'N', 'N', 0, -1, A, 1, X, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 7+      CALL STBSV( 'U', 'N', 'N', 0, 1, A, 1, X, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 9+      CALL STBSV( 'U', 'N', 'N', 0, 0, A, 1, X, 0 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      GO TO 170+  110 INFOT = 1+      CALL STPSV( '/', 'N', 'N', 0, A, X, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 2+      CALL STPSV( 'U', '/', 'N', 0, A, X, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 3+      CALL STPSV( 'U', 'N', '/', 0, A, X, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 4+      CALL STPSV( 'U', 'N', 'N', -1, A, X, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 7+      CALL STPSV( 'U', 'N', 'N', 0, A, X, 0 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      GO TO 170+  120 INFOT = 1+      CALL SGER( -1, 0, ALPHA, X, 1, Y, 1, A, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 2+      CALL SGER( 0, -1, ALPHA, X, 1, Y, 1, A, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 5+      CALL SGER( 0, 0, ALPHA, X, 0, Y, 1, A, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 7+      CALL SGER( 0, 0, ALPHA, X, 1, Y, 0, A, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 9+      CALL SGER( 2, 0, ALPHA, X, 1, Y, 1, A, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      GO TO 170+  130 INFOT = 1+      CALL SSYR( '/', 0, ALPHA, X, 1, A, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 2+      CALL SSYR( 'U', -1, ALPHA, X, 1, A, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 5+      CALL SSYR( 'U', 0, ALPHA, X, 0, A, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 7+      CALL SSYR( 'U', 2, ALPHA, X, 1, A, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      GO TO 170+  140 INFOT = 1+      CALL SSPR( '/', 0, ALPHA, X, 1, A )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 2+      CALL SSPR( 'U', -1, ALPHA, X, 1, A )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 5+      CALL SSPR( 'U', 0, ALPHA, X, 0, A )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      GO TO 170+  150 INFOT = 1+      CALL SSYR2( '/', 0, ALPHA, X, 1, Y, 1, A, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 2+      CALL SSYR2( 'U', -1, ALPHA, X, 1, Y, 1, A, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 5+      CALL SSYR2( 'U', 0, ALPHA, X, 0, Y, 1, A, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 7+      CALL SSYR2( 'U', 0, ALPHA, X, 1, Y, 0, A, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 9+      CALL SSYR2( 'U', 2, ALPHA, X, 1, Y, 1, A, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      GO TO 170+  160 INFOT = 1+      CALL SSPR2( '/', 0, ALPHA, X, 1, Y, 1, A )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 2+      CALL SSPR2( 'U', -1, ALPHA, X, 1, Y, 1, A )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 5+      CALL SSPR2( 'U', 0, ALPHA, X, 0, Y, 1, A )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 7+      CALL SSPR2( 'U', 0, ALPHA, X, 1, Y, 0, A )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+*+  170 IF( OK )THEN+         WRITE( NOUT, FMT = 9999 )SRNAMT+      ELSE+         WRITE( NOUT, FMT = 9998 )SRNAMT+      END IF+      RETURN+*+ 9999 FORMAT( ' ', A6, ' PASSED THE TESTS OF ERROR-EXITS' )+ 9998 FORMAT( ' ******* ', A6, ' FAILED THE TESTS OF ERROR-EXITS *****',+     $      '**' )+*+*     End of SCHKE.+*+      END+      SUBROUTINE SMAKE( TYPE, UPLO, DIAG, M, N, A, NMAX, AA, LDA, KL,+     $                  KU, RESET, TRANSL )+*+*  Generates values for an M by N matrix A within the bandwidth+*  defined by KL and KU.+*  Stores the values in the array AA in the data structure required+*  by the routine, with unwanted elements set to rogue value.+*+*  TYPE is 'GE', 'GB', 'SY', 'SB', 'SP', 'TR', 'TB' OR 'TP'.+*+*  Auxiliary routine for test program for Level 2 Blas.+*+*  -- Written on 10-August-1987.+*     Richard Hanson, Sandia National Labs.+*     Jeremy Du Croz, NAG Central Office.+*+*     .. Parameters ..+      REAL               ZERO, ONE+      PARAMETER          ( ZERO = 0.0, ONE = 1.0 )+      REAL               ROGUE+      PARAMETER          ( ROGUE = -1.0E10 )+*     .. Scalar Arguments ..+      REAL               TRANSL+      INTEGER            KL, KU, LDA, M, N, NMAX+      LOGICAL            RESET+      CHARACTER*1        DIAG, UPLO+      CHARACTER*2        TYPE+*     .. Array Arguments ..+      REAL               A( NMAX, * ), AA( * )+*     .. Local Scalars ..+      INTEGER            I, I1, I2, I3, IBEG, IEND, IOFF, J, KK+      LOGICAL            GEN, LOWER, SYM, TRI, UNIT, UPPER+*     .. External Functions ..+      REAL               SBEG+      EXTERNAL           SBEG+*     .. Intrinsic Functions ..+      INTRINSIC          MAX, MIN+*     .. Executable Statements ..+      GEN = TYPE( 1: 1 ).EQ.'G'+      SYM = TYPE( 1: 1 ).EQ.'S'+      TRI = TYPE( 1: 1 ).EQ.'T'+      UPPER = ( SYM.OR.TRI ).AND.UPLO.EQ.'U'+      LOWER = ( SYM.OR.TRI ).AND.UPLO.EQ.'L'+      UNIT = TRI.AND.DIAG.EQ.'U'+*+*     Generate data in array A.+*+      DO 20 J = 1, N+         DO 10 I = 1, M+            IF( GEN.OR.( UPPER.AND.I.LE.J ).OR.( LOWER.AND.I.GE.J ) )+     $          THEN+               IF( ( I.LE.J.AND.J - I.LE.KU ).OR.+     $             ( I.GE.J.AND.I - J.LE.KL ) )THEN+                  A( I, J ) = SBEG( RESET ) + TRANSL+               ELSE+                  A( I, J ) = ZERO+               END IF+               IF( I.NE.J )THEN+                  IF( SYM )THEN+                     A( J, I ) = A( I, J )+                  ELSE IF( TRI )THEN+                     A( J, I ) = ZERO+                  END IF+               END IF+            END IF+   10    CONTINUE+         IF( TRI )+     $      A( J, J ) = A( J, J ) + ONE+         IF( UNIT )+     $      A( J, J ) = ONE+   20 CONTINUE+*+*     Store elements in array AS in data structure required by routine.+*+      IF( TYPE.EQ.'GE' )THEN+         DO 50 J = 1, N+            DO 30 I = 1, M+               AA( I + ( J - 1 )*LDA ) = A( I, J )+   30       CONTINUE+            DO 40 I = M + 1, LDA+               AA( I + ( J - 1 )*LDA ) = ROGUE+   40       CONTINUE+   50    CONTINUE+      ELSE IF( TYPE.EQ.'GB' )THEN+         DO 90 J = 1, N+            DO 60 I1 = 1, KU + 1 - J+               AA( I1 + ( J - 1 )*LDA ) = ROGUE+   60       CONTINUE+            DO 70 I2 = I1, MIN( KL + KU + 1, KU + 1 + M - J )+               AA( I2 + ( J - 1 )*LDA ) = A( I2 + J - KU - 1, J )+   70       CONTINUE+            DO 80 I3 = I2, LDA+               AA( I3 + ( J - 1 )*LDA ) = ROGUE+   80       CONTINUE+   90    CONTINUE+      ELSE IF( TYPE.EQ.'SY'.OR.TYPE.EQ.'TR' )THEN+         DO 130 J = 1, N+            IF( UPPER )THEN+               IBEG = 1+               IF( UNIT )THEN+                  IEND = J - 1+               ELSE+                  IEND = J+               END IF+            ELSE+               IF( UNIT )THEN+                  IBEG = J + 1+               ELSE+                  IBEG = J+               END IF+               IEND = N+            END IF+            DO 100 I = 1, IBEG - 1+               AA( I + ( J - 1 )*LDA ) = ROGUE+  100       CONTINUE+            DO 110 I = IBEG, IEND+               AA( I + ( J - 1 )*LDA ) = A( I, J )+  110       CONTINUE+            DO 120 I = IEND + 1, LDA+               AA( I + ( J - 1 )*LDA ) = ROGUE+  120       CONTINUE+  130    CONTINUE+      ELSE IF( TYPE.EQ.'SB'.OR.TYPE.EQ.'TB' )THEN+         DO 170 J = 1, N+            IF( UPPER )THEN+               KK = KL + 1+               IBEG = MAX( 1, KL + 2 - J )+               IF( UNIT )THEN+                  IEND = KL+               ELSE+                  IEND = KL + 1+               END IF+            ELSE+               KK = 1+               IF( UNIT )THEN+                  IBEG = 2+               ELSE+                  IBEG = 1+               END IF+               IEND = MIN( KL + 1, 1 + M - J )+            END IF+            DO 140 I = 1, IBEG - 1+               AA( I + ( J - 1 )*LDA ) = ROGUE+  140       CONTINUE+            DO 150 I = IBEG, IEND+               AA( I + ( J - 1 )*LDA ) = A( I + J - KK, J )+  150       CONTINUE+            DO 160 I = IEND + 1, LDA+               AA( I + ( J - 1 )*LDA ) = ROGUE+  160       CONTINUE+  170    CONTINUE+      ELSE IF( TYPE.EQ.'SP'.OR.TYPE.EQ.'TP' )THEN+         IOFF = 0+         DO 190 J = 1, N+            IF( UPPER )THEN+               IBEG = 1+               IEND = J+            ELSE+               IBEG = J+               IEND = N+            END IF+            DO 180 I = IBEG, IEND+               IOFF = IOFF + 1+               AA( IOFF ) = A( I, J )+               IF( I.EQ.J )THEN+                  IF( UNIT )+     $               AA( IOFF ) = ROGUE+               END IF+  180       CONTINUE+  190    CONTINUE+      END IF+      RETURN+*+*     End of SMAKE.+*+      END+      SUBROUTINE SMVCH( TRANS, M, N, ALPHA, A, NMAX, X, INCX, BETA, Y,+     $                  INCY, YT, G, YY, EPS, ERR, FATAL, NOUT, MV )+*+*  Checks the results of the computational tests.+*+*  Auxiliary routine for test program for Level 2 Blas.+*+*  -- Written on 10-August-1987.+*     Richard Hanson, Sandia National Labs.+*     Jeremy Du Croz, NAG Central Office.+*+*     .. Parameters ..+      REAL               ZERO, ONE+      PARAMETER          ( ZERO = 0.0, ONE = 1.0 )+*     .. Scalar Arguments ..+      REAL               ALPHA, BETA, EPS, ERR+      INTEGER            INCX, INCY, M, N, NMAX, NOUT+      LOGICAL            FATAL, MV+      CHARACTER*1        TRANS+*     .. Array Arguments ..+      REAL               A( NMAX, * ), G( * ), X( * ), Y( * ), YT( * ),+     $                   YY( * )+*     .. Local Scalars ..+      REAL               ERRI+      INTEGER            I, INCXL, INCYL, IY, J, JX, KX, KY, ML, NL+      LOGICAL            TRAN+*     .. Intrinsic Functions ..+      INTRINSIC          ABS, MAX, SQRT+*     .. Executable Statements ..+      TRAN = TRANS.EQ.'T'.OR.TRANS.EQ.'C'+      IF( TRAN )THEN+         ML = N+         NL = M+      ELSE+         ML = M+         NL = N+      END IF+      IF( INCX.LT.0 )THEN+         KX = NL+         INCXL = -1+      ELSE+         KX = 1+         INCXL = 1+      END IF+      IF( INCY.LT.0 )THEN+         KY = ML+         INCYL = -1+      ELSE+         KY = 1+         INCYL = 1+      END IF+*+*     Compute expected result in YT using data in A, X and Y.+*     Compute gauges in G.+*+      IY = KY+      DO 30 I = 1, ML+         YT( IY ) = ZERO+         G( IY ) = ZERO+         JX = KX+         IF( TRAN )THEN+            DO 10 J = 1, NL+               YT( IY ) = YT( IY ) + A( J, I )*X( JX )+               G( IY ) = G( IY ) + ABS( A( J, I )*X( JX ) )+               JX = JX + INCXL+   10       CONTINUE+         ELSE+            DO 20 J = 1, NL+               YT( IY ) = YT( IY ) + A( I, J )*X( JX )+               G( IY ) = G( IY ) + ABS( A( I, J )*X( JX ) )+               JX = JX + INCXL+   20       CONTINUE+         END IF+         YT( IY ) = ALPHA*YT( IY ) + BETA*Y( IY )+         G( IY ) = ABS( ALPHA )*G( IY ) + ABS( BETA*Y( IY ) )+         IY = IY + INCYL+   30 CONTINUE+*+*     Compute the error ratio for this result.+*+      ERR = ZERO+      DO 40 I = 1, ML+         ERRI = ABS( YT( I ) - YY( 1 + ( I - 1 )*ABS( INCY ) ) )/EPS+         IF( G( I ).NE.ZERO )+     $      ERRI = ERRI/G( I )+         ERR = MAX( ERR, ERRI )+         IF( ERR*SQRT( EPS ).GE.ONE )+     $      GO TO 50+   40 CONTINUE+*     If the loop completes, all results are at least half accurate.+      GO TO 70+*+*     Report fatal error.+*+   50 FATAL = .TRUE.+      WRITE( NOUT, FMT = 9999 )+      DO 60 I = 1, ML+         IF( MV )THEN+            WRITE( NOUT, FMT = 9998 )I, YT( I ),+     $         YY( 1 + ( I - 1 )*ABS( INCY ) )+         ELSE+            WRITE( NOUT, FMT = 9998 )I, +     $         YY( 1 + ( I - 1 )*ABS( INCY ) ), YT(I)+         END IF+   60 CONTINUE+*+   70 CONTINUE+      RETURN+*+ 9999 FORMAT( ' ******* FATAL ERROR - COMPUTED RESULT IS LESS THAN HAL',+     $      'F ACCURATE *******', /'           EXPECTED RESULT   COMPU',+     $      'TED RESULT' )+ 9998 FORMAT( 1X, I7, 2G18.6 )+*+*     End of SMVCH.+*+      END+      LOGICAL FUNCTION LSE( RI, RJ, LR )+*+*  Tests if two arrays are identical.+*+*  Auxiliary routine for test program for Level 2 Blas.+*+*  -- Written on 10-August-1987.+*     Richard Hanson, Sandia National Labs.+*     Jeremy Du Croz, NAG Central Office.+*+*     .. Scalar Arguments ..+      INTEGER            LR+*     .. Array Arguments ..+      REAL               RI( * ), RJ( * )+*     .. Local Scalars ..+      INTEGER            I+*     .. Executable Statements ..+      DO 10 I = 1, LR+         IF( RI( I ).NE.RJ( I ) )+     $      GO TO 20+   10 CONTINUE+      LSE = .TRUE.+      GO TO 30+   20 CONTINUE+      LSE = .FALSE.+   30 RETURN+*+*     End of LSE.+*+      END+      LOGICAL FUNCTION LSERES( TYPE, UPLO, M, N, AA, AS, LDA )+*+*  Tests if selected elements in two arrays are equal.+*+*  TYPE is 'GE', 'SY' or 'SP'.+*+*  Auxiliary routine for test program for Level 2 Blas.+*+*  -- Written on 10-August-1987.+*     Richard Hanson, Sandia National Labs.+*     Jeremy Du Croz, NAG Central Office.+*+*     .. Scalar Arguments ..+      INTEGER            LDA, M, N+      CHARACTER*1        UPLO+      CHARACTER*2        TYPE+*     .. Array Arguments ..+      REAL               AA( LDA, * ), AS( LDA, * )+*     .. Local Scalars ..+      INTEGER            I, IBEG, IEND, J+      LOGICAL            UPPER+*     .. Executable Statements ..+      UPPER = UPLO.EQ.'U'+      IF( TYPE.EQ.'GE' )THEN+         DO 20 J = 1, N+            DO 10 I = M + 1, LDA+               IF( AA( I, J ).NE.AS( I, J ) )+     $            GO TO 70+   10       CONTINUE+   20    CONTINUE+      ELSE IF( TYPE.EQ.'SY' )THEN+         DO 50 J = 1, N+            IF( UPPER )THEN+               IBEG = 1+               IEND = J+            ELSE+               IBEG = J+               IEND = N+            END IF+            DO 30 I = 1, IBEG - 1+               IF( AA( I, J ).NE.AS( I, J ) )+     $            GO TO 70+   30       CONTINUE+            DO 40 I = IEND + 1, LDA+               IF( AA( I, J ).NE.AS( I, J ) )+     $            GO TO 70+   40       CONTINUE+   50    CONTINUE+      END IF+*+      LSERES = .TRUE.+      GO TO 80+   70 CONTINUE+      LSERES = .FALSE.+   80 RETURN+*+*     End of LSERES.+*+      END+      REAL FUNCTION SBEG( RESET )+*+*  Generates random numbers uniformly distributed between -0.5 and 0.5.+*+*  Auxiliary routine for test program for Level 2 Blas.+*+*  -- Written on 10-August-1987.+*     Richard Hanson, Sandia National Labs.+*     Jeremy Du Croz, NAG Central Office.+*+*     .. Scalar Arguments ..+      LOGICAL            RESET+*     .. Local Scalars ..+      INTEGER            I, IC, MI+*     .. Save statement ..+      SAVE               I, IC, MI+*     .. Intrinsic Functions ..+      INTRINSIC          REAL+*     .. Executable Statements ..+      IF( RESET )THEN+*        Initialize local variables.+         MI = 891+         I = 7+         IC = 0+         RESET = .FALSE.+      END IF+*+*     The sequence of values of I is bounded between 1 and 999.+*     If initial I = 1,2,3,6,7 or 9, the period will be 50.+*     If initial I = 4 or 8, the period will be 25.+*     If initial I = 5, the period will be 10.+*     IC is used to break up the period by skipping 1 value of I in 6.+*+      IC = IC + 1+   10 I = I*MI+      I = I - 1000*( I/1000 )+      IF( IC.GE.5 )THEN+         IC = 0+         GO TO 10+      END IF+      SBEG = REAL( I - 500 )/1001.0+      RETURN+*+*     End of SBEG.+*+      END+      REAL FUNCTION SDIFF( X, Y )+*+*  Auxiliary routine for test program for Level 2 Blas.+*+*  -- Written on 10-August-1987.+*     Richard Hanson, Sandia National Labs.+*+*     .. Scalar Arguments ..+      REAL               X, Y+*     .. Executable Statements ..+      SDIFF = X - Y+      RETURN+*+*     End of SDIFF.+*+      END+      SUBROUTINE CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+*+*  Tests whether XERBLA has detected an error when it should.+*+*  Auxiliary routine for test program for Level 2 Blas.+*+*  -- Written on 10-August-1987.+*     Richard Hanson, Sandia National Labs.+*     Jeremy Du Croz, NAG Central Office.+*+*     .. Scalar Arguments ..+      INTEGER            INFOT, NOUT+      LOGICAL            LERR, OK+      CHARACTER*6        SRNAMT+*     .. Executable Statements ..+      IF( .NOT.LERR )THEN+         WRITE( NOUT, FMT = 9999 )INFOT, SRNAMT+         OK = .FALSE.+      END IF+      LERR = .FALSE.+      RETURN+*+ 9999 FORMAT( ' ***** ILLEGAL VALUE OF PARAMETER NUMBER ', I2, ' NOT D',+     $      'ETECTED BY ', A6, ' *****' )+*+*     End of CHKXER.+*+      END+      SUBROUTINE XERBLA( SRNAME, INFO )+*+*  This is a special version of XERBLA to be used only as part of+*  the test program for testing error exits from the Level 2 BLAS+*  routines.+*+*  XERBLA  is an error handler for the Level 2 BLAS routines.+*+*  It is called by the Level 2 BLAS routines if an input parameter is+*  invalid.+*+*  Auxiliary routine for test program for Level 2 Blas.+*+*  -- Written on 10-August-1987.+*     Richard Hanson, Sandia National Labs.+*     Jeremy Du Croz, NAG Central Office.+*+*     .. Scalar Arguments ..+      INTEGER            INFO+      CHARACTER*6        SRNAME+*     .. Scalars in Common ..+      INTEGER            INFOT, NOUT+      LOGICAL            LERR, OK+      CHARACTER*6        SRNAMT+*     .. Common blocks ..+      COMMON             /INFOC/INFOT, NOUT, OK, LERR+      COMMON             /SRNAMC/SRNAMT+*     .. Executable Statements ..+      LERR = .TRUE.+      IF( INFO.NE.INFOT )THEN+         IF( INFOT.NE.0 )THEN+            WRITE( NOUT, FMT = 9999 )INFO, INFOT+         ELSE+            WRITE( NOUT, FMT = 9997 )INFO+         END IF+         OK = .FALSE.+      END IF+      IF( SRNAME.NE.SRNAMT )THEN+         WRITE( NOUT, FMT = 9998 )SRNAME, SRNAMT+         OK = .FALSE.+      END IF+      RETURN+*+ 9999 FORMAT( ' ******* XERBLA WAS CALLED WITH INFO = ', I6, ' INSTEAD',+     $      ' OF ', I2, ' *******' )+ 9998 FORMAT( ' ******* XERBLA WAS CALLED WITH SRNAME = ', A6, ' INSTE',+     $      'AD OF ', A6, ' *******' )+ 9997 FORMAT( ' ******* XERBLA WAS CALLED WITH INFO = ', I6,+     $      ' *******' )+*+*     End of XERBLA+*+      END+
+ eigen3/blas/testing/sblat3.dat view
@@ -0,0 +1,20 @@+'sblat3.summ'     NAME OF SUMMARY OUTPUT FILE+6                 UNIT NUMBER OF SUMMARY FILE+'sblat3.snap'     NAME OF SNAPSHOT OUTPUT FILE+-1                UNIT NUMBER OF SNAPSHOT FILE (NOT USED IF .LT. 0)+F        LOGICAL FLAG, T TO REWIND SNAPSHOT FILE AFTER EACH RECORD.+F        LOGICAL FLAG, T TO STOP ON FAILURES.+T        LOGICAL FLAG, T TO TEST ERROR EXITS.+16.0     THRESHOLD VALUE OF TEST RATIO+6                 NUMBER OF VALUES OF N+0 1 2 3 5 9       VALUES OF N+3                 NUMBER OF VALUES OF ALPHA+0.0 1.0 0.7       VALUES OF ALPHA+3                 NUMBER OF VALUES OF BETA+0.0 1.0 1.3       VALUES OF BETA+SGEMM  T PUT F FOR NO TEST. SAME COLUMNS.+SSYMM  T PUT F FOR NO TEST. SAME COLUMNS.+STRMM  T PUT F FOR NO TEST. SAME COLUMNS.+STRSM  T PUT F FOR NO TEST. SAME COLUMNS.+SSYRK  T PUT F FOR NO TEST. SAME COLUMNS.+SSYR2K T PUT F FOR NO TEST. SAME COLUMNS.
+ eigen3/blas/testing/sblat3.f view
@@ -0,0 +1,2873 @@+*> \brief \b SBLAT3+*+*  =========== DOCUMENTATION ===========+*+* Online html documentation available at +*            http://www.netlib.org/lapack/explore-html/ +*+*  Definition:+*  ===========+*+*       PROGRAM SBLAT3+* +*+*> \par Purpose:+*  =============+*>+*> \verbatim+*>+*> Test program for the REAL             Level 3 Blas.+*>+*> The program must be driven by a short data file. The first 14 records+*> of the file are read using list-directed input, the last 6 records+*> are read using the format ( A6, L2 ). An annotated example of a data+*> file can be obtained by deleting the first 3 characters from the+*> following 20 lines:+*> 'sblat3.out'      NAME OF SUMMARY OUTPUT FILE+*> 6                 UNIT NUMBER OF SUMMARY FILE+*> 'SBLAT3.SNAP'     NAME OF SNAPSHOT OUTPUT FILE+*> -1                UNIT NUMBER OF SNAPSHOT FILE (NOT USED IF .LT. 0)+*> F        LOGICAL FLAG, T TO REWIND SNAPSHOT FILE AFTER EACH RECORD.+*> F        LOGICAL FLAG, T TO STOP ON FAILURES.+*> T        LOGICAL FLAG, T TO TEST ERROR EXITS.+*> 16.0     THRESHOLD VALUE OF TEST RATIO+*> 6                 NUMBER OF VALUES OF N+*> 0 1 2 3 5 9       VALUES OF N+*> 3                 NUMBER OF VALUES OF ALPHA+*> 0.0 1.0 0.7       VALUES OF ALPHA+*> 3                 NUMBER OF VALUES OF BETA+*> 0.0 1.0 1.3       VALUES OF BETA+*> SGEMM  T PUT F FOR NO TEST. SAME COLUMNS.+*> SSYMM  T PUT F FOR NO TEST. SAME COLUMNS.+*> STRMM  T PUT F FOR NO TEST. SAME COLUMNS.+*> STRSM  T PUT F FOR NO TEST. SAME COLUMNS.+*> SSYRK  T PUT F FOR NO TEST. SAME COLUMNS.+*> SSYR2K T PUT F FOR NO TEST. SAME COLUMNS.+*>+*> Further Details+*> ===============+*>+*> See:+*>+*>    Dongarra J. J., Du Croz J. J., Duff I. S. and Hammarling S.+*>    A Set of Level 3 Basic Linear Algebra Subprograms.+*>+*>    Technical Memorandum No.88 (Revision 1), Mathematics and+*>    Computer Science Division, Argonne National Laboratory, 9700+*>    South Cass Avenue, Argonne, Illinois 60439, US.+*>+*> -- Written on 8-February-1989.+*>    Jack Dongarra, Argonne National Laboratory.+*>    Iain Duff, AERE Harwell.+*>    Jeremy Du Croz, Numerical Algorithms Group Ltd.+*>    Sven Hammarling, Numerical Algorithms Group Ltd.+*>+*>    10-9-00:  Change STATUS='NEW' to 'UNKNOWN' so that the testers+*>              can be run multiple times without deleting generated+*>              output files (susan)+*> \endverbatim+*+*  Authors:+*  ========+*+*> \author Univ. of Tennessee +*> \author Univ. of California Berkeley +*> \author Univ. of Colorado Denver +*> \author NAG Ltd. +*+*> \date April 2012+*+*> \ingroup single_blas_testing+*+*  =====================================================================+      PROGRAM SBLAT3+*+*  -- Reference BLAS test routine (version 3.4.1) --+*  -- Reference BLAS is a software package provided by Univ. of Tennessee,    --+*  -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--+*     April 2012+*+*  =====================================================================+*+*     .. Parameters ..+      INTEGER            NIN+      PARAMETER          ( NIN = 5 )+      INTEGER            NSUBS+      PARAMETER          ( NSUBS = 6 )+      REAL               ZERO, ONE+      PARAMETER          ( ZERO = 0.0, ONE = 1.0 )+      INTEGER            NMAX+      PARAMETER          ( NMAX = 65 )+      INTEGER            NIDMAX, NALMAX, NBEMAX+      PARAMETER          ( NIDMAX = 9, NALMAX = 7, NBEMAX = 7 )+*     .. Local Scalars ..+      REAL               EPS, ERR, THRESH+      INTEGER            I, ISNUM, J, N, NALF, NBET, NIDIM, NOUT, NTRA+      LOGICAL            FATAL, LTESTT, REWI, SAME, SFATAL, TRACE,+     $                   TSTERR+      CHARACTER*1        TRANSA, TRANSB+      CHARACTER*6        SNAMET+      CHARACTER*32       SNAPS, SUMMRY+*     .. Local Arrays ..+      REAL               AA( NMAX*NMAX ), AB( NMAX, 2*NMAX ),+     $                   ALF( NALMAX ), AS( NMAX*NMAX ),+     $                   BB( NMAX*NMAX ), BET( NBEMAX ),+     $                   BS( NMAX*NMAX ), C( NMAX, NMAX ),+     $                   CC( NMAX*NMAX ), CS( NMAX*NMAX ), CT( NMAX ),+     $                   G( NMAX ), W( 2*NMAX )+      INTEGER            IDIM( NIDMAX )+      LOGICAL            LTEST( NSUBS )+      CHARACTER*6        SNAMES( NSUBS )+*     .. External Functions ..+      REAL               SDIFF+      LOGICAL            LSE+      EXTERNAL           SDIFF, LSE+*     .. External Subroutines ..+      EXTERNAL           SCHK1, SCHK2, SCHK3, SCHK4, SCHK5, SCHKE, SMMCH+*     .. Intrinsic Functions ..+      INTRINSIC          MAX, MIN+*     .. Scalars in Common ..+      INTEGER            INFOT, NOUTC+      LOGICAL            LERR, OK+      CHARACTER*6        SRNAMT+*     .. Common blocks ..+      COMMON             /INFOC/INFOT, NOUTC, OK, LERR+      COMMON             /SRNAMC/SRNAMT+*     .. Data statements ..+      DATA               SNAMES/'SGEMM ', 'SSYMM ', 'STRMM ', 'STRSM ',+     $                   'SSYRK ', 'SSYR2K'/+*     .. Executable Statements ..+*+*     Read name and unit number for summary output file and open file.+*+      READ( NIN, FMT = * )SUMMRY+      READ( NIN, FMT = * )NOUT+      OPEN( NOUT, FILE = SUMMRY )+      NOUTC = NOUT+*+*     Read name and unit number for snapshot output file and open file.+*+      READ( NIN, FMT = * )SNAPS+      READ( NIN, FMT = * )NTRA+      TRACE = NTRA.GE.0+      IF( TRACE )THEN+         OPEN( NTRA, FILE = SNAPS )+      END IF+*     Read the flag that directs rewinding of the snapshot file.+      READ( NIN, FMT = * )REWI+      REWI = REWI.AND.TRACE+*     Read the flag that directs stopping on any failure.+      READ( NIN, FMT = * )SFATAL+*     Read the flag that indicates whether error exits are to be tested.+      READ( NIN, FMT = * )TSTERR+*     Read the threshold value of the test ratio+      READ( NIN, FMT = * )THRESH+*+*     Read and check the parameter values for the tests.+*+*     Values of N+      READ( NIN, FMT = * )NIDIM+      IF( NIDIM.LT.1.OR.NIDIM.GT.NIDMAX )THEN+         WRITE( NOUT, FMT = 9997 )'N', NIDMAX+         GO TO 220+      END IF+      READ( NIN, FMT = * )( IDIM( I ), I = 1, NIDIM )+      DO 10 I = 1, NIDIM+         IF( IDIM( I ).LT.0.OR.IDIM( I ).GT.NMAX )THEN+            WRITE( NOUT, FMT = 9996 )NMAX+            GO TO 220+         END IF+   10 CONTINUE+*     Values of ALPHA+      READ( NIN, FMT = * )NALF+      IF( NALF.LT.1.OR.NALF.GT.NALMAX )THEN+         WRITE( NOUT, FMT = 9997 )'ALPHA', NALMAX+         GO TO 220+      END IF+      READ( NIN, FMT = * )( ALF( I ), I = 1, NALF )+*     Values of BETA+      READ( NIN, FMT = * )NBET+      IF( NBET.LT.1.OR.NBET.GT.NBEMAX )THEN+         WRITE( NOUT, FMT = 9997 )'BETA', NBEMAX+         GO TO 220+      END IF+      READ( NIN, FMT = * )( BET( I ), I = 1, NBET )+*+*     Report values of parameters.+*+      WRITE( NOUT, FMT = 9995 )+      WRITE( NOUT, FMT = 9994 )( IDIM( I ), I = 1, NIDIM )+      WRITE( NOUT, FMT = 9993 )( ALF( I ), I = 1, NALF )+      WRITE( NOUT, FMT = 9992 )( BET( I ), I = 1, NBET )+      IF( .NOT.TSTERR )THEN+         WRITE( NOUT, FMT = * )+         WRITE( NOUT, FMT = 9984 )+      END IF+      WRITE( NOUT, FMT = * )+      WRITE( NOUT, FMT = 9999 )THRESH+      WRITE( NOUT, FMT = * )+*+*     Read names of subroutines and flags which indicate+*     whether they are to be tested.+*+      DO 20 I = 1, NSUBS+         LTEST( I ) = .FALSE.+   20 CONTINUE+   30 READ( NIN, FMT = 9988, END = 60 )SNAMET, LTESTT+      DO 40 I = 1, NSUBS+         IF( SNAMET.EQ.SNAMES( I ) )+     $      GO TO 50+   40 CONTINUE+      WRITE( NOUT, FMT = 9990 )SNAMET+      STOP+   50 LTEST( I ) = LTESTT+      GO TO 30+*+   60 CONTINUE+      CLOSE ( NIN )+*+*     Compute EPS (the machine precision).+*+      EPS = EPSILON(ZERO)+      WRITE( NOUT, FMT = 9998 )EPS+*+*     Check the reliability of SMMCH using exact data.+*+      N = MIN( 32, NMAX )+      DO 100 J = 1, N+         DO 90 I = 1, N+            AB( I, J ) = MAX( I - J + 1, 0 )+   90    CONTINUE+         AB( J, NMAX + 1 ) = J+         AB( 1, NMAX + J ) = J+         C( J, 1 ) = ZERO+  100 CONTINUE+      DO 110 J = 1, N+         CC( J ) = J*( ( J + 1 )*J )/2 - ( ( J + 1 )*J*( J - 1 ) )/3+  110 CONTINUE+*     CC holds the exact result. On exit from SMMCH CT holds+*     the result computed by SMMCH.+      TRANSA = 'N'+      TRANSB = 'N'+      CALL SMMCH( TRANSA, TRANSB, N, 1, N, ONE, AB, NMAX,+     $            AB( 1, NMAX + 1 ), NMAX, ZERO, C, NMAX, CT, G, CC,+     $            NMAX, EPS, ERR, FATAL, NOUT, .TRUE. )+      SAME = LSE( CC, CT, N )+      IF( .NOT.SAME.OR.ERR.NE.ZERO )THEN+         WRITE( NOUT, FMT = 9989 )TRANSA, TRANSB, SAME, ERR+         STOP+      END IF+      TRANSB = 'T'+      CALL SMMCH( TRANSA, TRANSB, N, 1, N, ONE, AB, NMAX,+     $            AB( 1, NMAX + 1 ), NMAX, ZERO, C, NMAX, CT, G, CC,+     $            NMAX, EPS, ERR, FATAL, NOUT, .TRUE. )+      SAME = LSE( CC, CT, N )+      IF( .NOT.SAME.OR.ERR.NE.ZERO )THEN+         WRITE( NOUT, FMT = 9989 )TRANSA, TRANSB, SAME, ERR+         STOP+      END IF+      DO 120 J = 1, N+         AB( J, NMAX + 1 ) = N - J + 1+         AB( 1, NMAX + J ) = N - J + 1+  120 CONTINUE+      DO 130 J = 1, N+         CC( N - J + 1 ) = J*( ( J + 1 )*J )/2 -+     $                     ( ( J + 1 )*J*( J - 1 ) )/3+  130 CONTINUE+      TRANSA = 'T'+      TRANSB = 'N'+      CALL SMMCH( TRANSA, TRANSB, N, 1, N, ONE, AB, NMAX,+     $            AB( 1, NMAX + 1 ), NMAX, ZERO, C, NMAX, CT, G, CC,+     $            NMAX, EPS, ERR, FATAL, NOUT, .TRUE. )+      SAME = LSE( CC, CT, N )+      IF( .NOT.SAME.OR.ERR.NE.ZERO )THEN+         WRITE( NOUT, FMT = 9989 )TRANSA, TRANSB, SAME, ERR+         STOP+      END IF+      TRANSB = 'T'+      CALL SMMCH( TRANSA, TRANSB, N, 1, N, ONE, AB, NMAX,+     $            AB( 1, NMAX + 1 ), NMAX, ZERO, C, NMAX, CT, G, CC,+     $            NMAX, EPS, ERR, FATAL, NOUT, .TRUE. )+      SAME = LSE( CC, CT, N )+      IF( .NOT.SAME.OR.ERR.NE.ZERO )THEN+         WRITE( NOUT, FMT = 9989 )TRANSA, TRANSB, SAME, ERR+         STOP+      END IF+*+*     Test each subroutine in turn.+*+      DO 200 ISNUM = 1, NSUBS+         WRITE( NOUT, FMT = * )+         IF( .NOT.LTEST( ISNUM ) )THEN+*           Subprogram is not to be tested.+            WRITE( NOUT, FMT = 9987 )SNAMES( ISNUM )+         ELSE+            SRNAMT = SNAMES( ISNUM )+*           Test error exits.+            IF( TSTERR )THEN+               CALL SCHKE( ISNUM, SNAMES( ISNUM ), NOUT )+               WRITE( NOUT, FMT = * )+            END IF+*           Test computations.+            INFOT = 0+            OK = .TRUE.+            FATAL = .FALSE.+            GO TO ( 140, 150, 160, 160, 170, 180 )ISNUM+*           Test SGEMM, 01.+  140       CALL SCHK1( SNAMES( ISNUM ), EPS, THRESH, NOUT, NTRA, TRACE,+     $                  REWI, FATAL, NIDIM, IDIM, NALF, ALF, NBET, BET,+     $                  NMAX, AB, AA, AS, AB( 1, NMAX + 1 ), BB, BS, C,+     $                  CC, CS, CT, G )+            GO TO 190+*           Test SSYMM, 02.+  150       CALL SCHK2( SNAMES( ISNUM ), EPS, THRESH, NOUT, NTRA, TRACE,+     $                  REWI, FATAL, NIDIM, IDIM, NALF, ALF, NBET, BET,+     $                  NMAX, AB, AA, AS, AB( 1, NMAX + 1 ), BB, BS, C,+     $                  CC, CS, CT, G )+            GO TO 190+*           Test STRMM, 03, STRSM, 04.+  160       CALL SCHK3( SNAMES( ISNUM ), EPS, THRESH, NOUT, NTRA, TRACE,+     $                  REWI, FATAL, NIDIM, IDIM, NALF, ALF, NMAX, AB,+     $                  AA, AS, AB( 1, NMAX + 1 ), BB, BS, CT, G, C )+            GO TO 190+*           Test SSYRK, 05.+  170       CALL SCHK4( SNAMES( ISNUM ), EPS, THRESH, NOUT, NTRA, TRACE,+     $                  REWI, FATAL, NIDIM, IDIM, NALF, ALF, NBET, BET,+     $                  NMAX, AB, AA, AS, AB( 1, NMAX + 1 ), BB, BS, C,+     $                  CC, CS, CT, G )+            GO TO 190+*           Test SSYR2K, 06.+  180       CALL SCHK5( SNAMES( ISNUM ), EPS, THRESH, NOUT, NTRA, TRACE,+     $                  REWI, FATAL, NIDIM, IDIM, NALF, ALF, NBET, BET,+     $                  NMAX, AB, AA, AS, BB, BS, C, CC, CS, CT, G, W )+            GO TO 190+*+  190       IF( FATAL.AND.SFATAL )+     $         GO TO 210+         END IF+  200 CONTINUE+      WRITE( NOUT, FMT = 9986 )+      GO TO 230+*+  210 CONTINUE+      WRITE( NOUT, FMT = 9985 )+      GO TO 230+*+  220 CONTINUE+      WRITE( NOUT, FMT = 9991 )+*+  230 CONTINUE+      IF( TRACE )+     $   CLOSE ( NTRA )+      CLOSE ( NOUT )+      STOP+*+ 9999 FORMAT( ' ROUTINES PASS COMPUTATIONAL TESTS IF TEST RATIO IS LES',+     $      'S THAN', F8.2 )+ 9998 FORMAT( ' RELATIVE MACHINE PRECISION IS TAKEN TO BE', 1P, E9.1 )+ 9997 FORMAT( ' NUMBER OF VALUES OF ', A, ' IS LESS THAN 1 OR GREATER ',+     $      'THAN ', I2 )+ 9996 FORMAT( ' VALUE OF N IS LESS THAN 0 OR GREATER THAN ', I2 )+ 9995 FORMAT( ' TESTS OF THE REAL             LEVEL 3 BLAS', //' THE F',+     $      'OLLOWING PARAMETER VALUES WILL BE USED:' )+ 9994 FORMAT( '   FOR N              ', 9I6 )+ 9993 FORMAT( '   FOR ALPHA          ', 7F6.1 )+ 9992 FORMAT( '   FOR BETA           ', 7F6.1 )+ 9991 FORMAT( ' AMEND DATA FILE OR INCREASE ARRAY SIZES IN PROGRAM',+     $      /' ******* TESTS ABANDONED *******' )+ 9990 FORMAT( ' SUBPROGRAM NAME ', A6, ' NOT RECOGNIZED', /' ******* T',+     $      'ESTS ABANDONED *******' )+ 9989 FORMAT( ' ERROR IN SMMCH -  IN-LINE DOT PRODUCTS ARE BEING EVALU',+     $      'ATED WRONGLY.', /' SMMCH WAS CALLED WITH TRANSA = ', A1,+     $      ' AND TRANSB = ', A1, /' AND RETURNED SAME = ', L1, ' AND ',+     $      'ERR = ', F12.3, '.', /' THIS MAY BE DUE TO FAULTS IN THE ',+     $      'ARITHMETIC OR THE COMPILER.', /' ******* TESTS ABANDONED ',+     $      '*******' )+ 9988 FORMAT( A6, L2 )+ 9987 FORMAT( 1X, A6, ' WAS NOT TESTED' )+ 9986 FORMAT( /' END OF TESTS' )+ 9985 FORMAT( /' ******* FATAL ERROR - TESTS ABANDONED *******' )+ 9984 FORMAT( ' ERROR-EXITS WILL NOT BE TESTED' )+*+*     End of SBLAT3.+*+      END+      SUBROUTINE SCHK1( SNAME, EPS, THRESH, NOUT, NTRA, TRACE, REWI,+     $                  FATAL, NIDIM, IDIM, NALF, ALF, NBET, BET, NMAX,+     $                  A, AA, AS, B, BB, BS, C, CC, CS, CT, G )+*+*  Tests SGEMM.+*+*  Auxiliary routine for test program for Level 3 Blas.+*+*  -- Written on 8-February-1989.+*     Jack Dongarra, Argonne National Laboratory.+*     Iain Duff, AERE Harwell.+*     Jeremy Du Croz, Numerical Algorithms Group Ltd.+*     Sven Hammarling, Numerical Algorithms Group Ltd.+*+*     .. Parameters ..+      REAL               ZERO+      PARAMETER          ( ZERO = 0.0 )+*     .. Scalar Arguments ..+      REAL               EPS, THRESH+      INTEGER            NALF, NBET, NIDIM, NMAX, NOUT, NTRA+      LOGICAL            FATAL, REWI, TRACE+      CHARACTER*6        SNAME+*     .. Array Arguments ..+      REAL               A( NMAX, NMAX ), AA( NMAX*NMAX ), ALF( NALF ),+     $                   AS( NMAX*NMAX ), B( NMAX, NMAX ),+     $                   BB( NMAX*NMAX ), BET( NBET ), BS( NMAX*NMAX ),+     $                   C( NMAX, NMAX ), CC( NMAX*NMAX ),+     $                   CS( NMAX*NMAX ), CT( NMAX ), G( NMAX )+      INTEGER            IDIM( NIDIM )+*     .. Local Scalars ..+      REAL               ALPHA, ALS, BETA, BLS, ERR, ERRMAX+      INTEGER            I, IA, IB, ICA, ICB, IK, IM, IN, K, KS, LAA,+     $                   LBB, LCC, LDA, LDAS, LDB, LDBS, LDC, LDCS, M,+     $                   MA, MB, MS, N, NA, NARGS, NB, NC, NS+      LOGICAL            NULL, RESET, SAME, TRANA, TRANB+      CHARACTER*1        TRANAS, TRANBS, TRANSA, TRANSB+      CHARACTER*3        ICH+*     .. Local Arrays ..+      LOGICAL            ISAME( 13 )+*     .. External Functions ..+      LOGICAL            LSE, LSERES+      EXTERNAL           LSE, LSERES+*     .. External Subroutines ..+      EXTERNAL           SGEMM, SMAKE, SMMCH+*     .. Intrinsic Functions ..+      INTRINSIC          MAX+*     .. Scalars in Common ..+      INTEGER            INFOT, NOUTC+      LOGICAL            LERR, OK+*     .. Common blocks ..+      COMMON             /INFOC/INFOT, NOUTC, OK, LERR+*     .. Data statements ..+      DATA               ICH/'NTC'/+*     .. Executable Statements ..+*+      NARGS = 13+      NC = 0+      RESET = .TRUE.+      ERRMAX = ZERO+*+      DO 110 IM = 1, NIDIM+         M = IDIM( IM )+*+         DO 100 IN = 1, NIDIM+            N = IDIM( IN )+*           Set LDC to 1 more than minimum value if room.+            LDC = M+            IF( LDC.LT.NMAX )+     $         LDC = LDC + 1+*           Skip tests if not enough room.+            IF( LDC.GT.NMAX )+     $         GO TO 100+            LCC = LDC*N+            NULL = N.LE.0.OR.M.LE.0+*+            DO 90 IK = 1, NIDIM+               K = IDIM( IK )+*+               DO 80 ICA = 1, 3+                  TRANSA = ICH( ICA: ICA )+                  TRANA = TRANSA.EQ.'T'.OR.TRANSA.EQ.'C'+*+                  IF( TRANA )THEN+                     MA = K+                     NA = M+                  ELSE+                     MA = M+                     NA = K+                  END IF+*                 Set LDA to 1 more than minimum value if room.+                  LDA = MA+                  IF( LDA.LT.NMAX )+     $               LDA = LDA + 1+*                 Skip tests if not enough room.+                  IF( LDA.GT.NMAX )+     $               GO TO 80+                  LAA = LDA*NA+*+*                 Generate the matrix A.+*+                  CALL SMAKE( 'GE', ' ', ' ', MA, NA, A, NMAX, AA, LDA,+     $                        RESET, ZERO )+*+                  DO 70 ICB = 1, 3+                     TRANSB = ICH( ICB: ICB )+                     TRANB = TRANSB.EQ.'T'.OR.TRANSB.EQ.'C'+*+                     IF( TRANB )THEN+                        MB = N+                        NB = K+                     ELSE+                        MB = K+                        NB = N+                     END IF+*                    Set LDB to 1 more than minimum value if room.+                     LDB = MB+                     IF( LDB.LT.NMAX )+     $                  LDB = LDB + 1+*                    Skip tests if not enough room.+                     IF( LDB.GT.NMAX )+     $                  GO TO 70+                     LBB = LDB*NB+*+*                    Generate the matrix B.+*+                     CALL SMAKE( 'GE', ' ', ' ', MB, NB, B, NMAX, BB,+     $                           LDB, RESET, ZERO )+*+                     DO 60 IA = 1, NALF+                        ALPHA = ALF( IA )+*+                        DO 50 IB = 1, NBET+                           BETA = BET( IB )+*+*                          Generate the matrix C.+*+                           CALL SMAKE( 'GE', ' ', ' ', M, N, C, NMAX,+     $                                 CC, LDC, RESET, ZERO )+*+                           NC = NC + 1+*+*                          Save every datum before calling the+*                          subroutine.+*+                           TRANAS = TRANSA+                           TRANBS = TRANSB+                           MS = M+                           NS = N+                           KS = K+                           ALS = ALPHA+                           DO 10 I = 1, LAA+                              AS( I ) = AA( I )+   10                      CONTINUE+                           LDAS = LDA+                           DO 20 I = 1, LBB+                              BS( I ) = BB( I )+   20                      CONTINUE+                           LDBS = LDB+                           BLS = BETA+                           DO 30 I = 1, LCC+                              CS( I ) = CC( I )+   30                      CONTINUE+                           LDCS = LDC+*+*                          Call the subroutine.+*+                           IF( TRACE )+     $                        WRITE( NTRA, FMT = 9995 )NC, SNAME,+     $                        TRANSA, TRANSB, M, N, K, ALPHA, LDA, LDB,+     $                        BETA, LDC+                           IF( REWI )+     $                        REWIND NTRA+                           CALL SGEMM( TRANSA, TRANSB, M, N, K, ALPHA,+     $                                 AA, LDA, BB, LDB, BETA, CC, LDC )+*+*                          Check if error-exit was taken incorrectly.+*+                           IF( .NOT.OK )THEN+                              WRITE( NOUT, FMT = 9994 )+                              FATAL = .TRUE.+                              GO TO 120+                           END IF+*+*                          See what data changed inside subroutines.+*+                           ISAME( 1 ) = TRANSA.EQ.TRANAS+                           ISAME( 2 ) = TRANSB.EQ.TRANBS+                           ISAME( 3 ) = MS.EQ.M+                           ISAME( 4 ) = NS.EQ.N+                           ISAME( 5 ) = KS.EQ.K+                           ISAME( 6 ) = ALS.EQ.ALPHA+                           ISAME( 7 ) = LSE( AS, AA, LAA )+                           ISAME( 8 ) = LDAS.EQ.LDA+                           ISAME( 9 ) = LSE( BS, BB, LBB )+                           ISAME( 10 ) = LDBS.EQ.LDB+                           ISAME( 11 ) = BLS.EQ.BETA+                           IF( NULL )THEN+                              ISAME( 12 ) = LSE( CS, CC, LCC )+                           ELSE+                              ISAME( 12 ) = LSERES( 'GE', ' ', M, N, CS,+     $                                      CC, LDC )+                           END IF+                           ISAME( 13 ) = LDCS.EQ.LDC+*+*                          If data was incorrectly changed, report+*                          and return.+*+                           SAME = .TRUE.+                           DO 40 I = 1, NARGS+                              SAME = SAME.AND.ISAME( I )+                              IF( .NOT.ISAME( I ) )+     $                           WRITE( NOUT, FMT = 9998 )I+   40                      CONTINUE+                           IF( .NOT.SAME )THEN+                              FATAL = .TRUE.+                              GO TO 120+                           END IF+*+                           IF( .NOT.NULL )THEN+*+*                             Check the result.+*+                              CALL SMMCH( TRANSA, TRANSB, M, N, K,+     $                                    ALPHA, A, NMAX, B, NMAX, BETA,+     $                                    C, NMAX, CT, G, CC, LDC, EPS,+     $                                    ERR, FATAL, NOUT, .TRUE. )+                              ERRMAX = MAX( ERRMAX, ERR )+*                             If got really bad answer, report and+*                             return.+                              IF( FATAL )+     $                           GO TO 120+                           END IF+*+   50                   CONTINUE+*+   60                CONTINUE+*+   70             CONTINUE+*+   80          CONTINUE+*+   90       CONTINUE+*+  100    CONTINUE+*+  110 CONTINUE+*+*     Report result.+*+      IF( ERRMAX.LT.THRESH )THEN+         WRITE( NOUT, FMT = 9999 )SNAME, NC+      ELSE+         WRITE( NOUT, FMT = 9997 )SNAME, NC, ERRMAX+      END IF+      GO TO 130+*+  120 CONTINUE+      WRITE( NOUT, FMT = 9996 )SNAME+      WRITE( NOUT, FMT = 9995 )NC, SNAME, TRANSA, TRANSB, M, N, K,+     $   ALPHA, LDA, LDB, BETA, LDC+*+  130 CONTINUE+      RETURN+*+ 9999 FORMAT( ' ', A6, ' PASSED THE COMPUTATIONAL TESTS (', I6, ' CALL',+     $      'S)' )+ 9998 FORMAT( ' ******* FATAL ERROR - PARAMETER NUMBER ', I2, ' WAS CH',+     $      'ANGED INCORRECTLY *******' )+ 9997 FORMAT( ' ', A6, ' COMPLETED THE COMPUTATIONAL TESTS (', I6, ' C',+     $      'ALLS)', /' ******* BUT WITH MAXIMUM TEST RATIO', F8.2,+     $      ' - SUSPECT *******' )+ 9996 FORMAT( ' ******* ', A6, ' FAILED ON CALL NUMBER:' )+ 9995 FORMAT( 1X, I6, ': ', A6, '(''', A1, ''',''', A1, ''',',+     $      3( I3, ',' ), F4.1, ', A,', I3, ', B,', I3, ',', F4.1, ', ',+     $      'C,', I3, ').' )+ 9994 FORMAT( ' ******* FATAL ERROR - ERROR-EXIT TAKEN ON VALID CALL *',+     $      '******' )+*+*     End of SCHK1.+*+      END+      SUBROUTINE SCHK2( SNAME, EPS, THRESH, NOUT, NTRA, TRACE, REWI,+     $                  FATAL, NIDIM, IDIM, NALF, ALF, NBET, BET, NMAX,+     $                  A, AA, AS, B, BB, BS, C, CC, CS, CT, G )+*+*  Tests SSYMM.+*+*  Auxiliary routine for test program for Level 3 Blas.+*+*  -- Written on 8-February-1989.+*     Jack Dongarra, Argonne National Laboratory.+*     Iain Duff, AERE Harwell.+*     Jeremy Du Croz, Numerical Algorithms Group Ltd.+*     Sven Hammarling, Numerical Algorithms Group Ltd.+*+*     .. Parameters ..+      REAL               ZERO+      PARAMETER          ( ZERO = 0.0 )+*     .. Scalar Arguments ..+      REAL               EPS, THRESH+      INTEGER            NALF, NBET, NIDIM, NMAX, NOUT, NTRA+      LOGICAL            FATAL, REWI, TRACE+      CHARACTER*6        SNAME+*     .. Array Arguments ..+      REAL               A( NMAX, NMAX ), AA( NMAX*NMAX ), ALF( NALF ),+     $                   AS( NMAX*NMAX ), B( NMAX, NMAX ),+     $                   BB( NMAX*NMAX ), BET( NBET ), BS( NMAX*NMAX ),+     $                   C( NMAX, NMAX ), CC( NMAX*NMAX ),+     $                   CS( NMAX*NMAX ), CT( NMAX ), G( NMAX )+      INTEGER            IDIM( NIDIM )+*     .. Local Scalars ..+      REAL               ALPHA, ALS, BETA, BLS, ERR, ERRMAX+      INTEGER            I, IA, IB, ICS, ICU, IM, IN, LAA, LBB, LCC,+     $                   LDA, LDAS, LDB, LDBS, LDC, LDCS, M, MS, N, NA,+     $                   NARGS, NC, NS+      LOGICAL            LEFT, NULL, RESET, SAME+      CHARACTER*1        SIDE, SIDES, UPLO, UPLOS+      CHARACTER*2        ICHS, ICHU+*     .. Local Arrays ..+      LOGICAL            ISAME( 13 )+*     .. External Functions ..+      LOGICAL            LSE, LSERES+      EXTERNAL           LSE, LSERES+*     .. External Subroutines ..+      EXTERNAL           SMAKE, SMMCH, SSYMM+*     .. Intrinsic Functions ..+      INTRINSIC          MAX+*     .. Scalars in Common ..+      INTEGER            INFOT, NOUTC+      LOGICAL            LERR, OK+*     .. Common blocks ..+      COMMON             /INFOC/INFOT, NOUTC, OK, LERR+*     .. Data statements ..+      DATA               ICHS/'LR'/, ICHU/'UL'/+*     .. Executable Statements ..+*+      NARGS = 12+      NC = 0+      RESET = .TRUE.+      ERRMAX = ZERO+*+      DO 100 IM = 1, NIDIM+         M = IDIM( IM )+*+         DO 90 IN = 1, NIDIM+            N = IDIM( IN )+*           Set LDC to 1 more than minimum value if room.+            LDC = M+            IF( LDC.LT.NMAX )+     $         LDC = LDC + 1+*           Skip tests if not enough room.+            IF( LDC.GT.NMAX )+     $         GO TO 90+            LCC = LDC*N+            NULL = N.LE.0.OR.M.LE.0+*+*           Set LDB to 1 more than minimum value if room.+            LDB = M+            IF( LDB.LT.NMAX )+     $         LDB = LDB + 1+*           Skip tests if not enough room.+            IF( LDB.GT.NMAX )+     $         GO TO 90+            LBB = LDB*N+*+*           Generate the matrix B.+*+            CALL SMAKE( 'GE', ' ', ' ', M, N, B, NMAX, BB, LDB, RESET,+     $                  ZERO )+*+            DO 80 ICS = 1, 2+               SIDE = ICHS( ICS: ICS )+               LEFT = SIDE.EQ.'L'+*+               IF( LEFT )THEN+                  NA = M+               ELSE+                  NA = N+               END IF+*              Set LDA to 1 more than minimum value if room.+               LDA = NA+               IF( LDA.LT.NMAX )+     $            LDA = LDA + 1+*              Skip tests if not enough room.+               IF( LDA.GT.NMAX )+     $            GO TO 80+               LAA = LDA*NA+*+               DO 70 ICU = 1, 2+                  UPLO = ICHU( ICU: ICU )+*+*                 Generate the symmetric matrix A.+*+                  CALL SMAKE( 'SY', UPLO, ' ', NA, NA, A, NMAX, AA, LDA,+     $                        RESET, ZERO )+*+                  DO 60 IA = 1, NALF+                     ALPHA = ALF( IA )+*+                     DO 50 IB = 1, NBET+                        BETA = BET( IB )+*+*                       Generate the matrix C.+*+                        CALL SMAKE( 'GE', ' ', ' ', M, N, C, NMAX, CC,+     $                              LDC, RESET, ZERO )+*+                        NC = NC + 1+*+*                       Save every datum before calling the+*                       subroutine.+*+                        SIDES = SIDE+                        UPLOS = UPLO+                        MS = M+                        NS = N+                        ALS = ALPHA+                        DO 10 I = 1, LAA+                           AS( I ) = AA( I )+   10                   CONTINUE+                        LDAS = LDA+                        DO 20 I = 1, LBB+                           BS( I ) = BB( I )+   20                   CONTINUE+                        LDBS = LDB+                        BLS = BETA+                        DO 30 I = 1, LCC+                           CS( I ) = CC( I )+   30                   CONTINUE+                        LDCS = LDC+*+*                       Call the subroutine.+*+                        IF( TRACE )+     $                     WRITE( NTRA, FMT = 9995 )NC, SNAME, SIDE,+     $                     UPLO, M, N, ALPHA, LDA, LDB, BETA, LDC+                        IF( REWI )+     $                     REWIND NTRA+                        CALL SSYMM( SIDE, UPLO, M, N, ALPHA, AA, LDA,+     $                              BB, LDB, BETA, CC, LDC )+*+*                       Check if error-exit was taken incorrectly.+*+                        IF( .NOT.OK )THEN+                           WRITE( NOUT, FMT = 9994 )+                           FATAL = .TRUE.+                           GO TO 110+                        END IF+*+*                       See what data changed inside subroutines.+*+                        ISAME( 1 ) = SIDES.EQ.SIDE+                        ISAME( 2 ) = UPLOS.EQ.UPLO+                        ISAME( 3 ) = MS.EQ.M+                        ISAME( 4 ) = NS.EQ.N+                        ISAME( 5 ) = ALS.EQ.ALPHA+                        ISAME( 6 ) = LSE( AS, AA, LAA )+                        ISAME( 7 ) = LDAS.EQ.LDA+                        ISAME( 8 ) = LSE( BS, BB, LBB )+                        ISAME( 9 ) = LDBS.EQ.LDB+                        ISAME( 10 ) = BLS.EQ.BETA+                        IF( NULL )THEN+                           ISAME( 11 ) = LSE( CS, CC, LCC )+                        ELSE+                           ISAME( 11 ) = LSERES( 'GE', ' ', M, N, CS,+     $                                   CC, LDC )+                        END IF+                        ISAME( 12 ) = LDCS.EQ.LDC+*+*                       If data was incorrectly changed, report and+*                       return.+*+                        SAME = .TRUE.+                        DO 40 I = 1, NARGS+                           SAME = SAME.AND.ISAME( I )+                           IF( .NOT.ISAME( I ) )+     $                        WRITE( NOUT, FMT = 9998 )I+   40                   CONTINUE+                        IF( .NOT.SAME )THEN+                           FATAL = .TRUE.+                           GO TO 110+                        END IF+*+                        IF( .NOT.NULL )THEN+*+*                          Check the result.+*+                           IF( LEFT )THEN+                              CALL SMMCH( 'N', 'N', M, N, M, ALPHA, A,+     $                                    NMAX, B, NMAX, BETA, C, NMAX,+     $                                    CT, G, CC, LDC, EPS, ERR,+     $                                    FATAL, NOUT, .TRUE. )+                           ELSE+                              CALL SMMCH( 'N', 'N', M, N, N, ALPHA, B,+     $                                    NMAX, A, NMAX, BETA, C, NMAX,+     $                                    CT, G, CC, LDC, EPS, ERR,+     $                                    FATAL, NOUT, .TRUE. )+                           END IF+                           ERRMAX = MAX( ERRMAX, ERR )+*                          If got really bad answer, report and+*                          return.+                           IF( FATAL )+     $                        GO TO 110+                        END IF+*+   50                CONTINUE+*+   60             CONTINUE+*+   70          CONTINUE+*+   80       CONTINUE+*+   90    CONTINUE+*+  100 CONTINUE+*+*     Report result.+*+      IF( ERRMAX.LT.THRESH )THEN+         WRITE( NOUT, FMT = 9999 )SNAME, NC+      ELSE+         WRITE( NOUT, FMT = 9997 )SNAME, NC, ERRMAX+      END IF+      GO TO 120+*+  110 CONTINUE+      WRITE( NOUT, FMT = 9996 )SNAME+      WRITE( NOUT, FMT = 9995 )NC, SNAME, SIDE, UPLO, M, N, ALPHA, LDA,+     $   LDB, BETA, LDC+*+  120 CONTINUE+      RETURN+*+ 9999 FORMAT( ' ', A6, ' PASSED THE COMPUTATIONAL TESTS (', I6, ' CALL',+     $      'S)' )+ 9998 FORMAT( ' ******* FATAL ERROR - PARAMETER NUMBER ', I2, ' WAS CH',+     $      'ANGED INCORRECTLY *******' )+ 9997 FORMAT( ' ', A6, ' COMPLETED THE COMPUTATIONAL TESTS (', I6, ' C',+     $      'ALLS)', /' ******* BUT WITH MAXIMUM TEST RATIO', F8.2,+     $      ' - SUSPECT *******' )+ 9996 FORMAT( ' ******* ', A6, ' FAILED ON CALL NUMBER:' )+ 9995 FORMAT( 1X, I6, ': ', A6, '(', 2( '''', A1, ''',' ), 2( I3, ',' ),+     $      F4.1, ', A,', I3, ', B,', I3, ',', F4.1, ', C,', I3, ')   ',+     $      ' .' )+ 9994 FORMAT( ' ******* FATAL ERROR - ERROR-EXIT TAKEN ON VALID CALL *',+     $      '******' )+*+*     End of SCHK2.+*+      END+      SUBROUTINE SCHK3( SNAME, EPS, THRESH, NOUT, NTRA, TRACE, REWI,+     $                  FATAL, NIDIM, IDIM, NALF, ALF, NMAX, A, AA, AS,+     $                  B, BB, BS, CT, G, C )+*+*  Tests STRMM and STRSM.+*+*  Auxiliary routine for test program for Level 3 Blas.+*+*  -- Written on 8-February-1989.+*     Jack Dongarra, Argonne National Laboratory.+*     Iain Duff, AERE Harwell.+*     Jeremy Du Croz, Numerical Algorithms Group Ltd.+*     Sven Hammarling, Numerical Algorithms Group Ltd.+*+*     .. Parameters ..+      REAL               ZERO, ONE+      PARAMETER          ( ZERO = 0.0, ONE = 1.0 )+*     .. Scalar Arguments ..+      REAL               EPS, THRESH+      INTEGER            NALF, NIDIM, NMAX, NOUT, NTRA+      LOGICAL            FATAL, REWI, TRACE+      CHARACTER*6        SNAME+*     .. Array Arguments ..+      REAL               A( NMAX, NMAX ), AA( NMAX*NMAX ), ALF( NALF ),+     $                   AS( NMAX*NMAX ), B( NMAX, NMAX ),+     $                   BB( NMAX*NMAX ), BS( NMAX*NMAX ),+     $                   C( NMAX, NMAX ), CT( NMAX ), G( NMAX )+      INTEGER            IDIM( NIDIM )+*     .. Local Scalars ..+      REAL               ALPHA, ALS, ERR, ERRMAX+      INTEGER            I, IA, ICD, ICS, ICT, ICU, IM, IN, J, LAA, LBB,+     $                   LDA, LDAS, LDB, LDBS, M, MS, N, NA, NARGS, NC,+     $                   NS+      LOGICAL            LEFT, NULL, RESET, SAME+      CHARACTER*1        DIAG, DIAGS, SIDE, SIDES, TRANAS, TRANSA, UPLO,+     $                   UPLOS+      CHARACTER*2        ICHD, ICHS, ICHU+      CHARACTER*3        ICHT+*     .. Local Arrays ..+      LOGICAL            ISAME( 13 )+*     .. External Functions ..+      LOGICAL            LSE, LSERES+      EXTERNAL           LSE, LSERES+*     .. External Subroutines ..+      EXTERNAL           SMAKE, SMMCH, STRMM, STRSM+*     .. Intrinsic Functions ..+      INTRINSIC          MAX+*     .. Scalars in Common ..+      INTEGER            INFOT, NOUTC+      LOGICAL            LERR, OK+*     .. Common blocks ..+      COMMON             /INFOC/INFOT, NOUTC, OK, LERR+*     .. Data statements ..+      DATA               ICHU/'UL'/, ICHT/'NTC'/, ICHD/'UN'/, ICHS/'LR'/+*     .. Executable Statements ..+*+      NARGS = 11+      NC = 0+      RESET = .TRUE.+      ERRMAX = ZERO+*     Set up zero matrix for SMMCH.+      DO 20 J = 1, NMAX+         DO 10 I = 1, NMAX+            C( I, J ) = ZERO+   10    CONTINUE+   20 CONTINUE+*+      DO 140 IM = 1, NIDIM+         M = IDIM( IM )+*+         DO 130 IN = 1, NIDIM+            N = IDIM( IN )+*           Set LDB to 1 more than minimum value if room.+            LDB = M+            IF( LDB.LT.NMAX )+     $         LDB = LDB + 1+*           Skip tests if not enough room.+            IF( LDB.GT.NMAX )+     $         GO TO 130+            LBB = LDB*N+            NULL = M.LE.0.OR.N.LE.0+*+            DO 120 ICS = 1, 2+               SIDE = ICHS( ICS: ICS )+               LEFT = SIDE.EQ.'L'+               IF( LEFT )THEN+                  NA = M+               ELSE+                  NA = N+               END IF+*              Set LDA to 1 more than minimum value if room.+               LDA = NA+               IF( LDA.LT.NMAX )+     $            LDA = LDA + 1+*              Skip tests if not enough room.+               IF( LDA.GT.NMAX )+     $            GO TO 130+               LAA = LDA*NA+*+               DO 110 ICU = 1, 2+                  UPLO = ICHU( ICU: ICU )+*+                  DO 100 ICT = 1, 3+                     TRANSA = ICHT( ICT: ICT )+*+                     DO 90 ICD = 1, 2+                        DIAG = ICHD( ICD: ICD )+*+                        DO 80 IA = 1, NALF+                           ALPHA = ALF( IA )+*+*                          Generate the matrix A.+*+                           CALL SMAKE( 'TR', UPLO, DIAG, NA, NA, A,+     $                                 NMAX, AA, LDA, RESET, ZERO )+*+*                          Generate the matrix B.+*+                           CALL SMAKE( 'GE', ' ', ' ', M, N, B, NMAX,+     $                                 BB, LDB, RESET, ZERO )+*+                           NC = NC + 1+*+*                          Save every datum before calling the+*                          subroutine.+*+                           SIDES = SIDE+                           UPLOS = UPLO+                           TRANAS = TRANSA+                           DIAGS = DIAG+                           MS = M+                           NS = N+                           ALS = ALPHA+                           DO 30 I = 1, LAA+                              AS( I ) = AA( I )+   30                      CONTINUE+                           LDAS = LDA+                           DO 40 I = 1, LBB+                              BS( I ) = BB( I )+   40                      CONTINUE+                           LDBS = LDB+*+*                          Call the subroutine.+*+                           IF( SNAME( 4: 5 ).EQ.'MM' )THEN+                              IF( TRACE )+     $                           WRITE( NTRA, FMT = 9995 )NC, SNAME,+     $                           SIDE, UPLO, TRANSA, DIAG, M, N, ALPHA,+     $                           LDA, LDB+                              IF( REWI )+     $                           REWIND NTRA+                              CALL STRMM( SIDE, UPLO, TRANSA, DIAG, M,+     $                                    N, ALPHA, AA, LDA, BB, LDB )+                           ELSE IF( SNAME( 4: 5 ).EQ.'SM' )THEN+                              IF( TRACE )+     $                           WRITE( NTRA, FMT = 9995 )NC, SNAME,+     $                           SIDE, UPLO, TRANSA, DIAG, M, N, ALPHA,+     $                           LDA, LDB+                              IF( REWI )+     $                           REWIND NTRA+                              CALL STRSM( SIDE, UPLO, TRANSA, DIAG, M,+     $                                    N, ALPHA, AA, LDA, BB, LDB )+                           END IF+*+*                          Check if error-exit was taken incorrectly.+*+                           IF( .NOT.OK )THEN+                              WRITE( NOUT, FMT = 9994 )+                              FATAL = .TRUE.+                              GO TO 150+                           END IF+*+*                          See what data changed inside subroutines.+*+                           ISAME( 1 ) = SIDES.EQ.SIDE+                           ISAME( 2 ) = UPLOS.EQ.UPLO+                           ISAME( 3 ) = TRANAS.EQ.TRANSA+                           ISAME( 4 ) = DIAGS.EQ.DIAG+                           ISAME( 5 ) = MS.EQ.M+                           ISAME( 6 ) = NS.EQ.N+                           ISAME( 7 ) = ALS.EQ.ALPHA+                           ISAME( 8 ) = LSE( AS, AA, LAA )+                           ISAME( 9 ) = LDAS.EQ.LDA+                           IF( NULL )THEN+                              ISAME( 10 ) = LSE( BS, BB, LBB )+                           ELSE+                              ISAME( 10 ) = LSERES( 'GE', ' ', M, N, BS,+     $                                      BB, LDB )+                           END IF+                           ISAME( 11 ) = LDBS.EQ.LDB+*+*                          If data was incorrectly changed, report and+*                          return.+*+                           SAME = .TRUE.+                           DO 50 I = 1, NARGS+                              SAME = SAME.AND.ISAME( I )+                              IF( .NOT.ISAME( I ) )+     $                           WRITE( NOUT, FMT = 9998 )I+   50                      CONTINUE+                           IF( .NOT.SAME )THEN+                              FATAL = .TRUE.+                              GO TO 150+                           END IF+*+                           IF( .NOT.NULL )THEN+                              IF( SNAME( 4: 5 ).EQ.'MM' )THEN+*+*                                Check the result.+*+                                 IF( LEFT )THEN+                                    CALL SMMCH( TRANSA, 'N', M, N, M,+     $                                          ALPHA, A, NMAX, B, NMAX,+     $                                          ZERO, C, NMAX, CT, G,+     $                                          BB, LDB, EPS, ERR,+     $                                          FATAL, NOUT, .TRUE. )+                                 ELSE+                                    CALL SMMCH( 'N', TRANSA, M, N, N,+     $                                          ALPHA, B, NMAX, A, NMAX,+     $                                          ZERO, C, NMAX, CT, G,+     $                                          BB, LDB, EPS, ERR,+     $                                          FATAL, NOUT, .TRUE. )+                                 END IF+                              ELSE IF( SNAME( 4: 5 ).EQ.'SM' )THEN+*+*                                Compute approximation to original+*                                matrix.+*+                                 DO 70 J = 1, N+                                    DO 60 I = 1, M+                                       C( I, J ) = BB( I + ( J - 1 )*+     $                                             LDB )+                                       BB( I + ( J - 1 )*LDB ) = ALPHA*+     $                                    B( I, J )+   60                               CONTINUE+   70                            CONTINUE+*+                                 IF( LEFT )THEN+                                    CALL SMMCH( TRANSA, 'N', M, N, M,+     $                                          ONE, A, NMAX, C, NMAX,+     $                                          ZERO, B, NMAX, CT, G,+     $                                          BB, LDB, EPS, ERR,+     $                                          FATAL, NOUT, .FALSE. )+                                 ELSE+                                    CALL SMMCH( 'N', TRANSA, M, N, N,+     $                                          ONE, C, NMAX, A, NMAX,+     $                                          ZERO, B, NMAX, CT, G,+     $                                          BB, LDB, EPS, ERR,+     $                                          FATAL, NOUT, .FALSE. )+                                 END IF+                              END IF+                              ERRMAX = MAX( ERRMAX, ERR )+*                             If got really bad answer, report and+*                             return.+                              IF( FATAL )+     $                           GO TO 150+                           END IF+*+   80                   CONTINUE+*+   90                CONTINUE+*+  100             CONTINUE+*+  110          CONTINUE+*+  120       CONTINUE+*+  130    CONTINUE+*+  140 CONTINUE+*+*     Report result.+*+      IF( ERRMAX.LT.THRESH )THEN+         WRITE( NOUT, FMT = 9999 )SNAME, NC+      ELSE+         WRITE( NOUT, FMT = 9997 )SNAME, NC, ERRMAX+      END IF+      GO TO 160+*+  150 CONTINUE+      WRITE( NOUT, FMT = 9996 )SNAME+      WRITE( NOUT, FMT = 9995 )NC, SNAME, SIDE, UPLO, TRANSA, DIAG, M,+     $   N, ALPHA, LDA, LDB+*+  160 CONTINUE+      RETURN+*+ 9999 FORMAT( ' ', A6, ' PASSED THE COMPUTATIONAL TESTS (', I6, ' CALL',+     $      'S)' )+ 9998 FORMAT( ' ******* FATAL ERROR - PARAMETER NUMBER ', I2, ' WAS CH',+     $      'ANGED INCORRECTLY *******' )+ 9997 FORMAT( ' ', A6, ' COMPLETED THE COMPUTATIONAL TESTS (', I6, ' C',+     $      'ALLS)', /' ******* BUT WITH MAXIMUM TEST RATIO', F8.2,+     $      ' - SUSPECT *******' )+ 9996 FORMAT( ' ******* ', A6, ' FAILED ON CALL NUMBER:' )+ 9995 FORMAT( 1X, I6, ': ', A6, '(', 4( '''', A1, ''',' ), 2( I3, ',' ),+     $      F4.1, ', A,', I3, ', B,', I3, ')        .' )+ 9994 FORMAT( ' ******* FATAL ERROR - ERROR-EXIT TAKEN ON VALID CALL *',+     $      '******' )+*+*     End of SCHK3.+*+      END+      SUBROUTINE SCHK4( SNAME, EPS, THRESH, NOUT, NTRA, TRACE, REWI,+     $                  FATAL, NIDIM, IDIM, NALF, ALF, NBET, BET, NMAX,+     $                  A, AA, AS, B, BB, BS, C, CC, CS, CT, G )+*+*  Tests SSYRK.+*+*  Auxiliary routine for test program for Level 3 Blas.+*+*  -- Written on 8-February-1989.+*     Jack Dongarra, Argonne National Laboratory.+*     Iain Duff, AERE Harwell.+*     Jeremy Du Croz, Numerical Algorithms Group Ltd.+*     Sven Hammarling, Numerical Algorithms Group Ltd.+*+*     .. Parameters ..+      REAL               ZERO+      PARAMETER          ( ZERO = 0.0 )+*     .. Scalar Arguments ..+      REAL               EPS, THRESH+      INTEGER            NALF, NBET, NIDIM, NMAX, NOUT, NTRA+      LOGICAL            FATAL, REWI, TRACE+      CHARACTER*6        SNAME+*     .. Array Arguments ..+      REAL               A( NMAX, NMAX ), AA( NMAX*NMAX ), ALF( NALF ),+     $                   AS( NMAX*NMAX ), B( NMAX, NMAX ),+     $                   BB( NMAX*NMAX ), BET( NBET ), BS( NMAX*NMAX ),+     $                   C( NMAX, NMAX ), CC( NMAX*NMAX ),+     $                   CS( NMAX*NMAX ), CT( NMAX ), G( NMAX )+      INTEGER            IDIM( NIDIM )+*     .. Local Scalars ..+      REAL               ALPHA, ALS, BETA, BETS, ERR, ERRMAX+      INTEGER            I, IA, IB, ICT, ICU, IK, IN, J, JC, JJ, K, KS,+     $                   LAA, LCC, LDA, LDAS, LDC, LDCS, LJ, MA, N, NA,+     $                   NARGS, NC, NS+      LOGICAL            NULL, RESET, SAME, TRAN, UPPER+      CHARACTER*1        TRANS, TRANSS, UPLO, UPLOS+      CHARACTER*2        ICHU+      CHARACTER*3        ICHT+*     .. Local Arrays ..+      LOGICAL            ISAME( 13 )+*     .. External Functions ..+      LOGICAL            LSE, LSERES+      EXTERNAL           LSE, LSERES+*     .. External Subroutines ..+      EXTERNAL           SMAKE, SMMCH, SSYRK+*     .. Intrinsic Functions ..+      INTRINSIC          MAX+*     .. Scalars in Common ..+      INTEGER            INFOT, NOUTC+      LOGICAL            LERR, OK+*     .. Common blocks ..+      COMMON             /INFOC/INFOT, NOUTC, OK, LERR+*     .. Data statements ..+      DATA               ICHT/'NTC'/, ICHU/'UL'/+*     .. Executable Statements ..+*+      NARGS = 10+      NC = 0+      RESET = .TRUE.+      ERRMAX = ZERO+*+      DO 100 IN = 1, NIDIM+         N = IDIM( IN )+*        Set LDC to 1 more than minimum value if room.+         LDC = N+         IF( LDC.LT.NMAX )+     $      LDC = LDC + 1+*        Skip tests if not enough room.+         IF( LDC.GT.NMAX )+     $      GO TO 100+         LCC = LDC*N+         NULL = N.LE.0+*+         DO 90 IK = 1, NIDIM+            K = IDIM( IK )+*+            DO 80 ICT = 1, 3+               TRANS = ICHT( ICT: ICT )+               TRAN = TRANS.EQ.'T'.OR.TRANS.EQ.'C'+               IF( TRAN )THEN+                  MA = K+                  NA = N+               ELSE+                  MA = N+                  NA = K+               END IF+*              Set LDA to 1 more than minimum value if room.+               LDA = MA+               IF( LDA.LT.NMAX )+     $            LDA = LDA + 1+*              Skip tests if not enough room.+               IF( LDA.GT.NMAX )+     $            GO TO 80+               LAA = LDA*NA+*+*              Generate the matrix A.+*+               CALL SMAKE( 'GE', ' ', ' ', MA, NA, A, NMAX, AA, LDA,+     $                     RESET, ZERO )+*+               DO 70 ICU = 1, 2+                  UPLO = ICHU( ICU: ICU )+                  UPPER = UPLO.EQ.'U'+*+                  DO 60 IA = 1, NALF+                     ALPHA = ALF( IA )+*+                     DO 50 IB = 1, NBET+                        BETA = BET( IB )+*+*                       Generate the matrix C.+*+                        CALL SMAKE( 'SY', UPLO, ' ', N, N, C, NMAX, CC,+     $                              LDC, RESET, ZERO )+*+                        NC = NC + 1+*+*                       Save every datum before calling the subroutine.+*+                        UPLOS = UPLO+                        TRANSS = TRANS+                        NS = N+                        KS = K+                        ALS = ALPHA+                        DO 10 I = 1, LAA+                           AS( I ) = AA( I )+   10                   CONTINUE+                        LDAS = LDA+                        BETS = BETA+                        DO 20 I = 1, LCC+                           CS( I ) = CC( I )+   20                   CONTINUE+                        LDCS = LDC+*+*                       Call the subroutine.+*+                        IF( TRACE )+     $                     WRITE( NTRA, FMT = 9994 )NC, SNAME, UPLO,+     $                     TRANS, N, K, ALPHA, LDA, BETA, LDC+                        IF( REWI )+     $                     REWIND NTRA+                        CALL SSYRK( UPLO, TRANS, N, K, ALPHA, AA, LDA,+     $                              BETA, CC, LDC )+*+*                       Check if error-exit was taken incorrectly.+*+                        IF( .NOT.OK )THEN+                           WRITE( NOUT, FMT = 9993 )+                           FATAL = .TRUE.+                           GO TO 120+                        END IF+*+*                       See what data changed inside subroutines.+*+                        ISAME( 1 ) = UPLOS.EQ.UPLO+                        ISAME( 2 ) = TRANSS.EQ.TRANS+                        ISAME( 3 ) = NS.EQ.N+                        ISAME( 4 ) = KS.EQ.K+                        ISAME( 5 ) = ALS.EQ.ALPHA+                        ISAME( 6 ) = LSE( AS, AA, LAA )+                        ISAME( 7 ) = LDAS.EQ.LDA+                        ISAME( 8 ) = BETS.EQ.BETA+                        IF( NULL )THEN+                           ISAME( 9 ) = LSE( CS, CC, LCC )+                        ELSE+                           ISAME( 9 ) = LSERES( 'SY', UPLO, N, N, CS,+     $                                  CC, LDC )+                        END IF+                        ISAME( 10 ) = LDCS.EQ.LDC+*+*                       If data was incorrectly changed, report and+*                       return.+*+                        SAME = .TRUE.+                        DO 30 I = 1, NARGS+                           SAME = SAME.AND.ISAME( I )+                           IF( .NOT.ISAME( I ) )+     $                        WRITE( NOUT, FMT = 9998 )I+   30                   CONTINUE+                        IF( .NOT.SAME )THEN+                           FATAL = .TRUE.+                           GO TO 120+                        END IF+*+                        IF( .NOT.NULL )THEN+*+*                          Check the result column by column.+*+                           JC = 1+                           DO 40 J = 1, N+                              IF( UPPER )THEN+                                 JJ = 1+                                 LJ = J+                              ELSE+                                 JJ = J+                                 LJ = N - J + 1+                              END IF+                              IF( TRAN )THEN+                                 CALL SMMCH( 'T', 'N', LJ, 1, K, ALPHA,+     $                                       A( 1, JJ ), NMAX,+     $                                       A( 1, J ), NMAX, BETA,+     $                                       C( JJ, J ), NMAX, CT, G,+     $                                       CC( JC ), LDC, EPS, ERR,+     $                                       FATAL, NOUT, .TRUE. )+                              ELSE+                                 CALL SMMCH( 'N', 'T', LJ, 1, K, ALPHA,+     $                                       A( JJ, 1 ), NMAX,+     $                                       A( J, 1 ), NMAX, BETA,+     $                                       C( JJ, J ), NMAX, CT, G,+     $                                       CC( JC ), LDC, EPS, ERR,+     $                                       FATAL, NOUT, .TRUE. )+                              END IF+                              IF( UPPER )THEN+                                 JC = JC + LDC+                              ELSE+                                 JC = JC + LDC + 1+                              END IF+                              ERRMAX = MAX( ERRMAX, ERR )+*                             If got really bad answer, report and+*                             return.+                              IF( FATAL )+     $                           GO TO 110+   40                      CONTINUE+                        END IF+*+   50                CONTINUE+*+   60             CONTINUE+*+   70          CONTINUE+*+   80       CONTINUE+*+   90    CONTINUE+*+  100 CONTINUE+*+*     Report result.+*+      IF( ERRMAX.LT.THRESH )THEN+         WRITE( NOUT, FMT = 9999 )SNAME, NC+      ELSE+         WRITE( NOUT, FMT = 9997 )SNAME, NC, ERRMAX+      END IF+      GO TO 130+*+  110 CONTINUE+      IF( N.GT.1 )+     $   WRITE( NOUT, FMT = 9995 )J+*+  120 CONTINUE+      WRITE( NOUT, FMT = 9996 )SNAME+      WRITE( NOUT, FMT = 9994 )NC, SNAME, UPLO, TRANS, N, K, ALPHA,+     $   LDA, BETA, LDC+*+  130 CONTINUE+      RETURN+*+ 9999 FORMAT( ' ', A6, ' PASSED THE COMPUTATIONAL TESTS (', I6, ' CALL',+     $      'S)' )+ 9998 FORMAT( ' ******* FATAL ERROR - PARAMETER NUMBER ', I2, ' WAS CH',+     $      'ANGED INCORRECTLY *******' )+ 9997 FORMAT( ' ', A6, ' COMPLETED THE COMPUTATIONAL TESTS (', I6, ' C',+     $      'ALLS)', /' ******* BUT WITH MAXIMUM TEST RATIO', F8.2,+     $      ' - SUSPECT *******' )+ 9996 FORMAT( ' ******* ', A6, ' FAILED ON CALL NUMBER:' )+ 9995 FORMAT( '      THESE ARE THE RESULTS FOR COLUMN ', I3 )+ 9994 FORMAT( 1X, I6, ': ', A6, '(', 2( '''', A1, ''',' ), 2( I3, ',' ),+     $      F4.1, ', A,', I3, ',', F4.1, ', C,', I3, ')           .' )+ 9993 FORMAT( ' ******* FATAL ERROR - ERROR-EXIT TAKEN ON VALID CALL *',+     $      '******' )+*+*     End of SCHK4.+*+      END+      SUBROUTINE SCHK5( SNAME, EPS, THRESH, NOUT, NTRA, TRACE, REWI,+     $                  FATAL, NIDIM, IDIM, NALF, ALF, NBET, BET, NMAX,+     $                  AB, AA, AS, BB, BS, C, CC, CS, CT, G, W )+*+*  Tests SSYR2K.+*+*  Auxiliary routine for test program for Level 3 Blas.+*+*  -- Written on 8-February-1989.+*     Jack Dongarra, Argonne National Laboratory.+*     Iain Duff, AERE Harwell.+*     Jeremy Du Croz, Numerical Algorithms Group Ltd.+*     Sven Hammarling, Numerical Algorithms Group Ltd.+*+*     .. Parameters ..+      REAL               ZERO+      PARAMETER          ( ZERO = 0.0 )+*     .. Scalar Arguments ..+      REAL               EPS, THRESH+      INTEGER            NALF, NBET, NIDIM, NMAX, NOUT, NTRA+      LOGICAL            FATAL, REWI, TRACE+      CHARACTER*6        SNAME+*     .. Array Arguments ..+      REAL               AA( NMAX*NMAX ), AB( 2*NMAX*NMAX ),+     $                   ALF( NALF ), AS( NMAX*NMAX ), BB( NMAX*NMAX ),+     $                   BET( NBET ), BS( NMAX*NMAX ), C( NMAX, NMAX ),+     $                   CC( NMAX*NMAX ), CS( NMAX*NMAX ), CT( NMAX ),+     $                   G( NMAX ), W( 2*NMAX )+      INTEGER            IDIM( NIDIM )+*     .. Local Scalars ..+      REAL               ALPHA, ALS, BETA, BETS, ERR, ERRMAX+      INTEGER            I, IA, IB, ICT, ICU, IK, IN, J, JC, JJ, JJAB,+     $                   K, KS, LAA, LBB, LCC, LDA, LDAS, LDB, LDBS,+     $                   LDC, LDCS, LJ, MA, N, NA, NARGS, NC, NS+      LOGICAL            NULL, RESET, SAME, TRAN, UPPER+      CHARACTER*1        TRANS, TRANSS, UPLO, UPLOS+      CHARACTER*2        ICHU+      CHARACTER*3        ICHT+*     .. Local Arrays ..+      LOGICAL            ISAME( 13 )+*     .. External Functions ..+      LOGICAL            LSE, LSERES+      EXTERNAL           LSE, LSERES+*     .. External Subroutines ..+      EXTERNAL           SMAKE, SMMCH, SSYR2K+*     .. Intrinsic Functions ..+      INTRINSIC          MAX+*     .. Scalars in Common ..+      INTEGER            INFOT, NOUTC+      LOGICAL            LERR, OK+*     .. Common blocks ..+      COMMON             /INFOC/INFOT, NOUTC, OK, LERR+*     .. Data statements ..+      DATA               ICHT/'NTC'/, ICHU/'UL'/+*     .. Executable Statements ..+*+      NARGS = 12+      NC = 0+      RESET = .TRUE.+      ERRMAX = ZERO+*+      DO 130 IN = 1, NIDIM+         N = IDIM( IN )+*        Set LDC to 1 more than minimum value if room.+         LDC = N+         IF( LDC.LT.NMAX )+     $      LDC = LDC + 1+*        Skip tests if not enough room.+         IF( LDC.GT.NMAX )+     $      GO TO 130+         LCC = LDC*N+         NULL = N.LE.0+*+         DO 120 IK = 1, NIDIM+            K = IDIM( IK )+*+            DO 110 ICT = 1, 3+               TRANS = ICHT( ICT: ICT )+               TRAN = TRANS.EQ.'T'.OR.TRANS.EQ.'C'+               IF( TRAN )THEN+                  MA = K+                  NA = N+               ELSE+                  MA = N+                  NA = K+               END IF+*              Set LDA to 1 more than minimum value if room.+               LDA = MA+               IF( LDA.LT.NMAX )+     $            LDA = LDA + 1+*              Skip tests if not enough room.+               IF( LDA.GT.NMAX )+     $            GO TO 110+               LAA = LDA*NA+*+*              Generate the matrix A.+*+               IF( TRAN )THEN+                  CALL SMAKE( 'GE', ' ', ' ', MA, NA, AB, 2*NMAX, AA,+     $                        LDA, RESET, ZERO )+               ELSE+                  CALL SMAKE( 'GE', ' ', ' ', MA, NA, AB, NMAX, AA, LDA,+     $                        RESET, ZERO )+               END IF+*+*              Generate the matrix B.+*+               LDB = LDA+               LBB = LAA+               IF( TRAN )THEN+                  CALL SMAKE( 'GE', ' ', ' ', MA, NA, AB( K + 1 ),+     $                        2*NMAX, BB, LDB, RESET, ZERO )+               ELSE+                  CALL SMAKE( 'GE', ' ', ' ', MA, NA, AB( K*NMAX + 1 ),+     $                        NMAX, BB, LDB, RESET, ZERO )+               END IF+*+               DO 100 ICU = 1, 2+                  UPLO = ICHU( ICU: ICU )+                  UPPER = UPLO.EQ.'U'+*+                  DO 90 IA = 1, NALF+                     ALPHA = ALF( IA )+*+                     DO 80 IB = 1, NBET+                        BETA = BET( IB )+*+*                       Generate the matrix C.+*+                        CALL SMAKE( 'SY', UPLO, ' ', N, N, C, NMAX, CC,+     $                              LDC, RESET, ZERO )+*+                        NC = NC + 1+*+*                       Save every datum before calling the subroutine.+*+                        UPLOS = UPLO+                        TRANSS = TRANS+                        NS = N+                        KS = K+                        ALS = ALPHA+                        DO 10 I = 1, LAA+                           AS( I ) = AA( I )+   10                   CONTINUE+                        LDAS = LDA+                        DO 20 I = 1, LBB+                           BS( I ) = BB( I )+   20                   CONTINUE+                        LDBS = LDB+                        BETS = BETA+                        DO 30 I = 1, LCC+                           CS( I ) = CC( I )+   30                   CONTINUE+                        LDCS = LDC+*+*                       Call the subroutine.+*+                        IF( TRACE )+     $                     WRITE( NTRA, FMT = 9994 )NC, SNAME, UPLO,+     $                     TRANS, N, K, ALPHA, LDA, LDB, BETA, LDC+                        IF( REWI )+     $                     REWIND NTRA+                        CALL SSYR2K( UPLO, TRANS, N, K, ALPHA, AA, LDA,+     $                               BB, LDB, BETA, CC, LDC )+*+*                       Check if error-exit was taken incorrectly.+*+                        IF( .NOT.OK )THEN+                           WRITE( NOUT, FMT = 9993 )+                           FATAL = .TRUE.+                           GO TO 150+                        END IF+*+*                       See what data changed inside subroutines.+*+                        ISAME( 1 ) = UPLOS.EQ.UPLO+                        ISAME( 2 ) = TRANSS.EQ.TRANS+                        ISAME( 3 ) = NS.EQ.N+                        ISAME( 4 ) = KS.EQ.K+                        ISAME( 5 ) = ALS.EQ.ALPHA+                        ISAME( 6 ) = LSE( AS, AA, LAA )+                        ISAME( 7 ) = LDAS.EQ.LDA+                        ISAME( 8 ) = LSE( BS, BB, LBB )+                        ISAME( 9 ) = LDBS.EQ.LDB+                        ISAME( 10 ) = BETS.EQ.BETA+                        IF( NULL )THEN+                           ISAME( 11 ) = LSE( CS, CC, LCC )+                        ELSE+                           ISAME( 11 ) = LSERES( 'SY', UPLO, N, N, CS,+     $                                   CC, LDC )+                        END IF+                        ISAME( 12 ) = LDCS.EQ.LDC+*+*                       If data was incorrectly changed, report and+*                       return.+*+                        SAME = .TRUE.+                        DO 40 I = 1, NARGS+                           SAME = SAME.AND.ISAME( I )+                           IF( .NOT.ISAME( I ) )+     $                        WRITE( NOUT, FMT = 9998 )I+   40                   CONTINUE+                        IF( .NOT.SAME )THEN+                           FATAL = .TRUE.+                           GO TO 150+                        END IF+*+                        IF( .NOT.NULL )THEN+*+*                          Check the result column by column.+*+                           JJAB = 1+                           JC = 1+                           DO 70 J = 1, N+                              IF( UPPER )THEN+                                 JJ = 1+                                 LJ = J+                              ELSE+                                 JJ = J+                                 LJ = N - J + 1+                              END IF+                              IF( TRAN )THEN+                                 DO 50 I = 1, K+                                    W( I ) = AB( ( J - 1 )*2*NMAX + K ++     $                                       I )+                                    W( K + I ) = AB( ( J - 1 )*2*NMAX ++     $                                           I )+   50                            CONTINUE+                                 CALL SMMCH( 'T', 'N', LJ, 1, 2*K,+     $                                       ALPHA, AB( JJAB ), 2*NMAX,+     $                                       W, 2*NMAX, BETA,+     $                                       C( JJ, J ), NMAX, CT, G,+     $                                       CC( JC ), LDC, EPS, ERR,+     $                                       FATAL, NOUT, .TRUE. )+                              ELSE+                                 DO 60 I = 1, K+                                    W( I ) = AB( ( K + I - 1 )*NMAX ++     $                                       J )+                                    W( K + I ) = AB( ( I - 1 )*NMAX ++     $                                           J )+   60                            CONTINUE+                                 CALL SMMCH( 'N', 'N', LJ, 1, 2*K,+     $                                       ALPHA, AB( JJ ), NMAX, W,+     $                                       2*NMAX, BETA, C( JJ, J ),+     $                                       NMAX, CT, G, CC( JC ), LDC,+     $                                       EPS, ERR, FATAL, NOUT,+     $                                       .TRUE. )+                              END IF+                              IF( UPPER )THEN+                                 JC = JC + LDC+                              ELSE+                                 JC = JC + LDC + 1+                                 IF( TRAN )+     $                              JJAB = JJAB + 2*NMAX+                              END IF+                              ERRMAX = MAX( ERRMAX, ERR )+*                             If got really bad answer, report and+*                             return.+                              IF( FATAL )+     $                           GO TO 140+   70                      CONTINUE+                        END IF+*+   80                CONTINUE+*+   90             CONTINUE+*+  100          CONTINUE+*+  110       CONTINUE+*+  120    CONTINUE+*+  130 CONTINUE+*+*     Report result.+*+      IF( ERRMAX.LT.THRESH )THEN+         WRITE( NOUT, FMT = 9999 )SNAME, NC+      ELSE+         WRITE( NOUT, FMT = 9997 )SNAME, NC, ERRMAX+      END IF+      GO TO 160+*+  140 CONTINUE+      IF( N.GT.1 )+     $   WRITE( NOUT, FMT = 9995 )J+*+  150 CONTINUE+      WRITE( NOUT, FMT = 9996 )SNAME+      WRITE( NOUT, FMT = 9994 )NC, SNAME, UPLO, TRANS, N, K, ALPHA,+     $   LDA, LDB, BETA, LDC+*+  160 CONTINUE+      RETURN+*+ 9999 FORMAT( ' ', A6, ' PASSED THE COMPUTATIONAL TESTS (', I6, ' CALL',+     $      'S)' )+ 9998 FORMAT( ' ******* FATAL ERROR - PARAMETER NUMBER ', I2, ' WAS CH',+     $      'ANGED INCORRECTLY *******' )+ 9997 FORMAT( ' ', A6, ' COMPLETED THE COMPUTATIONAL TESTS (', I6, ' C',+     $      'ALLS)', /' ******* BUT WITH MAXIMUM TEST RATIO', F8.2,+     $      ' - SUSPECT *******' )+ 9996 FORMAT( ' ******* ', A6, ' FAILED ON CALL NUMBER:' )+ 9995 FORMAT( '      THESE ARE THE RESULTS FOR COLUMN ', I3 )+ 9994 FORMAT( 1X, I6, ': ', A6, '(', 2( '''', A1, ''',' ), 2( I3, ',' ),+     $      F4.1, ', A,', I3, ', B,', I3, ',', F4.1, ', C,', I3, ')   ',+     $      ' .' )+ 9993 FORMAT( ' ******* FATAL ERROR - ERROR-EXIT TAKEN ON VALID CALL *',+     $      '******' )+*+*     End of SCHK5.+*+      END+      SUBROUTINE SCHKE( ISNUM, SRNAMT, NOUT )+*+*  Tests the error exits from the Level 3 Blas.+*  Requires a special version of the error-handling routine XERBLA.+*  A, B and C should not need to be defined.+*+*  Auxiliary routine for test program for Level 3 Blas.+*+*  -- Written on 8-February-1989.+*     Jack Dongarra, Argonne National Laboratory.+*     Iain Duff, AERE Harwell.+*     Jeremy Du Croz, Numerical Algorithms Group Ltd.+*     Sven Hammarling, Numerical Algorithms Group Ltd.+*+*  3-19-92:  Initialize ALPHA and BETA  (eca)+*  3-19-92:  Fix argument 12 in calls to SSYMM with INFOT = 9  (eca)+*+*     .. Scalar Arguments ..+      INTEGER            ISNUM, NOUT+      CHARACTER*6        SRNAMT+*     .. Scalars in Common ..+      INTEGER            INFOT, NOUTC+      LOGICAL            LERR, OK+*     .. Parameters ..+      REAL               ONE, TWO+      PARAMETER          ( ONE = 1.0E0, TWO = 2.0E0 )+*     .. Local Scalars ..+      REAL               ALPHA, BETA+*     .. Local Arrays ..+      REAL               A( 2, 1 ), B( 2, 1 ), C( 2, 1 )+*     .. External Subroutines ..+      EXTERNAL           CHKXER, SGEMM, SSYMM, SSYR2K, SSYRK, STRMM,+     $                   STRSM+*     .. Common blocks ..+      COMMON             /INFOC/INFOT, NOUTC, OK, LERR+*     .. Executable Statements ..+*     OK is set to .FALSE. by the special version of XERBLA or by CHKXER+*     if anything is wrong.+      OK = .TRUE.+*     LERR is set to .TRUE. by the special version of XERBLA each time+*     it is called, and is then tested and re-set by CHKXER.+      LERR = .FALSE.+*+*     Initialize ALPHA and BETA.+*+      ALPHA = ONE+      BETA = TWO+*+      GO TO ( 10, 20, 30, 40, 50, 60 )ISNUM+   10 INFOT = 1+      CALL SGEMM( '/', 'N', 0, 0, 0, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 1+      CALL SGEMM( '/', 'T', 0, 0, 0, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 2+      CALL SGEMM( 'N', '/', 0, 0, 0, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 2+      CALL SGEMM( 'T', '/', 0, 0, 0, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 3+      CALL SGEMM( 'N', 'N', -1, 0, 0, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 3+      CALL SGEMM( 'N', 'T', -1, 0, 0, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 3+      CALL SGEMM( 'T', 'N', -1, 0, 0, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 3+      CALL SGEMM( 'T', 'T', -1, 0, 0, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 4+      CALL SGEMM( 'N', 'N', 0, -1, 0, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 4+      CALL SGEMM( 'N', 'T', 0, -1, 0, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 4+      CALL SGEMM( 'T', 'N', 0, -1, 0, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 4+      CALL SGEMM( 'T', 'T', 0, -1, 0, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 5+      CALL SGEMM( 'N', 'N', 0, 0, -1, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 5+      CALL SGEMM( 'N', 'T', 0, 0, -1, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 5+      CALL SGEMM( 'T', 'N', 0, 0, -1, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 5+      CALL SGEMM( 'T', 'T', 0, 0, -1, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 8+      CALL SGEMM( 'N', 'N', 2, 0, 0, ALPHA, A, 1, B, 1, BETA, C, 2 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 8+      CALL SGEMM( 'N', 'T', 2, 0, 0, ALPHA, A, 1, B, 1, BETA, C, 2 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 8+      CALL SGEMM( 'T', 'N', 0, 0, 2, ALPHA, A, 1, B, 2, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 8+      CALL SGEMM( 'T', 'T', 0, 0, 2, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 10+      CALL SGEMM( 'N', 'N', 0, 0, 2, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 10+      CALL SGEMM( 'T', 'N', 0, 0, 2, ALPHA, A, 2, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 10+      CALL SGEMM( 'N', 'T', 0, 2, 0, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 10+      CALL SGEMM( 'T', 'T', 0, 2, 0, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 13+      CALL SGEMM( 'N', 'N', 2, 0, 0, ALPHA, A, 2, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 13+      CALL SGEMM( 'N', 'T', 2, 0, 0, ALPHA, A, 2, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 13+      CALL SGEMM( 'T', 'N', 2, 0, 0, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 13+      CALL SGEMM( 'T', 'T', 2, 0, 0, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      GO TO 70+   20 INFOT = 1+      CALL SSYMM( '/', 'U', 0, 0, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 2+      CALL SSYMM( 'L', '/', 0, 0, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 3+      CALL SSYMM( 'L', 'U', -1, 0, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 3+      CALL SSYMM( 'R', 'U', -1, 0, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 3+      CALL SSYMM( 'L', 'L', -1, 0, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 3+      CALL SSYMM( 'R', 'L', -1, 0, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 4+      CALL SSYMM( 'L', 'U', 0, -1, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 4+      CALL SSYMM( 'R', 'U', 0, -1, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 4+      CALL SSYMM( 'L', 'L', 0, -1, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 4+      CALL SSYMM( 'R', 'L', 0, -1, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 7+      CALL SSYMM( 'L', 'U', 2, 0, ALPHA, A, 1, B, 2, BETA, C, 2 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 7+      CALL SSYMM( 'R', 'U', 0, 2, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 7+      CALL SSYMM( 'L', 'L', 2, 0, ALPHA, A, 1, B, 2, BETA, C, 2 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 7+      CALL SSYMM( 'R', 'L', 0, 2, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 9+      CALL SSYMM( 'L', 'U', 2, 0, ALPHA, A, 2, B, 1, BETA, C, 2 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 9+      CALL SSYMM( 'R', 'U', 2, 0, ALPHA, A, 1, B, 1, BETA, C, 2 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 9+      CALL SSYMM( 'L', 'L', 2, 0, ALPHA, A, 2, B, 1, BETA, C, 2 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 9+      CALL SSYMM( 'R', 'L', 2, 0, ALPHA, A, 1, B, 1, BETA, C, 2 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 12+      CALL SSYMM( 'L', 'U', 2, 0, ALPHA, A, 2, B, 2, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 12+      CALL SSYMM( 'R', 'U', 2, 0, ALPHA, A, 1, B, 2, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 12+      CALL SSYMM( 'L', 'L', 2, 0, ALPHA, A, 2, B, 2, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 12+      CALL SSYMM( 'R', 'L', 2, 0, ALPHA, A, 1, B, 2, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      GO TO 70+   30 INFOT = 1+      CALL STRMM( '/', 'U', 'N', 'N', 0, 0, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 2+      CALL STRMM( 'L', '/', 'N', 'N', 0, 0, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 3+      CALL STRMM( 'L', 'U', '/', 'N', 0, 0, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 4+      CALL STRMM( 'L', 'U', 'N', '/', 0, 0, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 5+      CALL STRMM( 'L', 'U', 'N', 'N', -1, 0, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 5+      CALL STRMM( 'L', 'U', 'T', 'N', -1, 0, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 5+      CALL STRMM( 'R', 'U', 'N', 'N', -1, 0, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 5+      CALL STRMM( 'R', 'U', 'T', 'N', -1, 0, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 5+      CALL STRMM( 'L', 'L', 'N', 'N', -1, 0, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 5+      CALL STRMM( 'L', 'L', 'T', 'N', -1, 0, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 5+      CALL STRMM( 'R', 'L', 'N', 'N', -1, 0, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 5+      CALL STRMM( 'R', 'L', 'T', 'N', -1, 0, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 6+      CALL STRMM( 'L', 'U', 'N', 'N', 0, -1, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 6+      CALL STRMM( 'L', 'U', 'T', 'N', 0, -1, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 6+      CALL STRMM( 'R', 'U', 'N', 'N', 0, -1, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 6+      CALL STRMM( 'R', 'U', 'T', 'N', 0, -1, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 6+      CALL STRMM( 'L', 'L', 'N', 'N', 0, -1, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 6+      CALL STRMM( 'L', 'L', 'T', 'N', 0, -1, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 6+      CALL STRMM( 'R', 'L', 'N', 'N', 0, -1, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 6+      CALL STRMM( 'R', 'L', 'T', 'N', 0, -1, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 9+      CALL STRMM( 'L', 'U', 'N', 'N', 2, 0, ALPHA, A, 1, B, 2 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 9+      CALL STRMM( 'L', 'U', 'T', 'N', 2, 0, ALPHA, A, 1, B, 2 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 9+      CALL STRMM( 'R', 'U', 'N', 'N', 0, 2, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 9+      CALL STRMM( 'R', 'U', 'T', 'N', 0, 2, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 9+      CALL STRMM( 'L', 'L', 'N', 'N', 2, 0, ALPHA, A, 1, B, 2 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 9+      CALL STRMM( 'L', 'L', 'T', 'N', 2, 0, ALPHA, A, 1, B, 2 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 9+      CALL STRMM( 'R', 'L', 'N', 'N', 0, 2, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 9+      CALL STRMM( 'R', 'L', 'T', 'N', 0, 2, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 11+      CALL STRMM( 'L', 'U', 'N', 'N', 2, 0, ALPHA, A, 2, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 11+      CALL STRMM( 'L', 'U', 'T', 'N', 2, 0, ALPHA, A, 2, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 11+      CALL STRMM( 'R', 'U', 'N', 'N', 2, 0, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 11+      CALL STRMM( 'R', 'U', 'T', 'N', 2, 0, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 11+      CALL STRMM( 'L', 'L', 'N', 'N', 2, 0, ALPHA, A, 2, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 11+      CALL STRMM( 'L', 'L', 'T', 'N', 2, 0, ALPHA, A, 2, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 11+      CALL STRMM( 'R', 'L', 'N', 'N', 2, 0, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 11+      CALL STRMM( 'R', 'L', 'T', 'N', 2, 0, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      GO TO 70+   40 INFOT = 1+      CALL STRSM( '/', 'U', 'N', 'N', 0, 0, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 2+      CALL STRSM( 'L', '/', 'N', 'N', 0, 0, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 3+      CALL STRSM( 'L', 'U', '/', 'N', 0, 0, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 4+      CALL STRSM( 'L', 'U', 'N', '/', 0, 0, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 5+      CALL STRSM( 'L', 'U', 'N', 'N', -1, 0, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 5+      CALL STRSM( 'L', 'U', 'T', 'N', -1, 0, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 5+      CALL STRSM( 'R', 'U', 'N', 'N', -1, 0, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 5+      CALL STRSM( 'R', 'U', 'T', 'N', -1, 0, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 5+      CALL STRSM( 'L', 'L', 'N', 'N', -1, 0, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 5+      CALL STRSM( 'L', 'L', 'T', 'N', -1, 0, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 5+      CALL STRSM( 'R', 'L', 'N', 'N', -1, 0, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 5+      CALL STRSM( 'R', 'L', 'T', 'N', -1, 0, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 6+      CALL STRSM( 'L', 'U', 'N', 'N', 0, -1, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 6+      CALL STRSM( 'L', 'U', 'T', 'N', 0, -1, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 6+      CALL STRSM( 'R', 'U', 'N', 'N', 0, -1, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 6+      CALL STRSM( 'R', 'U', 'T', 'N', 0, -1, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 6+      CALL STRSM( 'L', 'L', 'N', 'N', 0, -1, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 6+      CALL STRSM( 'L', 'L', 'T', 'N', 0, -1, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 6+      CALL STRSM( 'R', 'L', 'N', 'N', 0, -1, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 6+      CALL STRSM( 'R', 'L', 'T', 'N', 0, -1, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 9+      CALL STRSM( 'L', 'U', 'N', 'N', 2, 0, ALPHA, A, 1, B, 2 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 9+      CALL STRSM( 'L', 'U', 'T', 'N', 2, 0, ALPHA, A, 1, B, 2 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 9+      CALL STRSM( 'R', 'U', 'N', 'N', 0, 2, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 9+      CALL STRSM( 'R', 'U', 'T', 'N', 0, 2, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 9+      CALL STRSM( 'L', 'L', 'N', 'N', 2, 0, ALPHA, A, 1, B, 2 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 9+      CALL STRSM( 'L', 'L', 'T', 'N', 2, 0, ALPHA, A, 1, B, 2 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 9+      CALL STRSM( 'R', 'L', 'N', 'N', 0, 2, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 9+      CALL STRSM( 'R', 'L', 'T', 'N', 0, 2, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 11+      CALL STRSM( 'L', 'U', 'N', 'N', 2, 0, ALPHA, A, 2, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 11+      CALL STRSM( 'L', 'U', 'T', 'N', 2, 0, ALPHA, A, 2, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 11+      CALL STRSM( 'R', 'U', 'N', 'N', 2, 0, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 11+      CALL STRSM( 'R', 'U', 'T', 'N', 2, 0, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 11+      CALL STRSM( 'L', 'L', 'N', 'N', 2, 0, ALPHA, A, 2, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 11+      CALL STRSM( 'L', 'L', 'T', 'N', 2, 0, ALPHA, A, 2, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 11+      CALL STRSM( 'R', 'L', 'N', 'N', 2, 0, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 11+      CALL STRSM( 'R', 'L', 'T', 'N', 2, 0, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      GO TO 70+   50 INFOT = 1+      CALL SSYRK( '/', 'N', 0, 0, ALPHA, A, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 2+      CALL SSYRK( 'U', '/', 0, 0, ALPHA, A, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 3+      CALL SSYRK( 'U', 'N', -1, 0, ALPHA, A, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 3+      CALL SSYRK( 'U', 'T', -1, 0, ALPHA, A, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 3+      CALL SSYRK( 'L', 'N', -1, 0, ALPHA, A, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 3+      CALL SSYRK( 'L', 'T', -1, 0, ALPHA, A, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 4+      CALL SSYRK( 'U', 'N', 0, -1, ALPHA, A, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 4+      CALL SSYRK( 'U', 'T', 0, -1, ALPHA, A, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 4+      CALL SSYRK( 'L', 'N', 0, -1, ALPHA, A, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 4+      CALL SSYRK( 'L', 'T', 0, -1, ALPHA, A, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 7+      CALL SSYRK( 'U', 'N', 2, 0, ALPHA, A, 1, BETA, C, 2 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 7+      CALL SSYRK( 'U', 'T', 0, 2, ALPHA, A, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 7+      CALL SSYRK( 'L', 'N', 2, 0, ALPHA, A, 1, BETA, C, 2 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 7+      CALL SSYRK( 'L', 'T', 0, 2, ALPHA, A, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 10+      CALL SSYRK( 'U', 'N', 2, 0, ALPHA, A, 2, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 10+      CALL SSYRK( 'U', 'T', 2, 0, ALPHA, A, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 10+      CALL SSYRK( 'L', 'N', 2, 0, ALPHA, A, 2, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 10+      CALL SSYRK( 'L', 'T', 2, 0, ALPHA, A, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      GO TO 70+   60 INFOT = 1+      CALL SSYR2K( '/', 'N', 0, 0, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 2+      CALL SSYR2K( 'U', '/', 0, 0, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 3+      CALL SSYR2K( 'U', 'N', -1, 0, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 3+      CALL SSYR2K( 'U', 'T', -1, 0, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 3+      CALL SSYR2K( 'L', 'N', -1, 0, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 3+      CALL SSYR2K( 'L', 'T', -1, 0, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 4+      CALL SSYR2K( 'U', 'N', 0, -1, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 4+      CALL SSYR2K( 'U', 'T', 0, -1, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 4+      CALL SSYR2K( 'L', 'N', 0, -1, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 4+      CALL SSYR2K( 'L', 'T', 0, -1, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 7+      CALL SSYR2K( 'U', 'N', 2, 0, ALPHA, A, 1, B, 1, BETA, C, 2 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 7+      CALL SSYR2K( 'U', 'T', 0, 2, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 7+      CALL SSYR2K( 'L', 'N', 2, 0, ALPHA, A, 1, B, 1, BETA, C, 2 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 7+      CALL SSYR2K( 'L', 'T', 0, 2, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 9+      CALL SSYR2K( 'U', 'N', 2, 0, ALPHA, A, 2, B, 1, BETA, C, 2 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 9+      CALL SSYR2K( 'U', 'T', 0, 2, ALPHA, A, 2, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 9+      CALL SSYR2K( 'L', 'N', 2, 0, ALPHA, A, 2, B, 1, BETA, C, 2 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 9+      CALL SSYR2K( 'L', 'T', 0, 2, ALPHA, A, 2, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 12+      CALL SSYR2K( 'U', 'N', 2, 0, ALPHA, A, 2, B, 2, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 12+      CALL SSYR2K( 'U', 'T', 2, 0, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 12+      CALL SSYR2K( 'L', 'N', 2, 0, ALPHA, A, 2, B, 2, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 12+      CALL SSYR2K( 'L', 'T', 2, 0, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+*+   70 IF( OK )THEN+         WRITE( NOUT, FMT = 9999 )SRNAMT+      ELSE+         WRITE( NOUT, FMT = 9998 )SRNAMT+      END IF+      RETURN+*+ 9999 FORMAT( ' ', A6, ' PASSED THE TESTS OF ERROR-EXITS' )+ 9998 FORMAT( ' ******* ', A6, ' FAILED THE TESTS OF ERROR-EXITS *****',+     $      '**' )+*+*     End of SCHKE.+*+      END+      SUBROUTINE SMAKE( TYPE, UPLO, DIAG, M, N, A, NMAX, AA, LDA, RESET,+     $                  TRANSL )+*+*  Generates values for an M by N matrix A.+*  Stores the values in the array AA in the data structure required+*  by the routine, with unwanted elements set to rogue value.+*+*  TYPE is 'GE', 'SY' or 'TR'.+*+*  Auxiliary routine for test program for Level 3 Blas.+*+*  -- Written on 8-February-1989.+*     Jack Dongarra, Argonne National Laboratory.+*     Iain Duff, AERE Harwell.+*     Jeremy Du Croz, Numerical Algorithms Group Ltd.+*     Sven Hammarling, Numerical Algorithms Group Ltd.+*+*     .. Parameters ..+      REAL               ZERO, ONE+      PARAMETER          ( ZERO = 0.0, ONE = 1.0 )+      REAL               ROGUE+      PARAMETER          ( ROGUE = -1.0E10 )+*     .. Scalar Arguments ..+      REAL               TRANSL+      INTEGER            LDA, M, N, NMAX+      LOGICAL            RESET+      CHARACTER*1        DIAG, UPLO+      CHARACTER*2        TYPE+*     .. Array Arguments ..+      REAL               A( NMAX, * ), AA( * )+*     .. Local Scalars ..+      INTEGER            I, IBEG, IEND, J+      LOGICAL            GEN, LOWER, SYM, TRI, UNIT, UPPER+*     .. External Functions ..+      REAL               SBEG+      EXTERNAL           SBEG+*     .. Executable Statements ..+      GEN = TYPE.EQ.'GE'+      SYM = TYPE.EQ.'SY'+      TRI = TYPE.EQ.'TR'+      UPPER = ( SYM.OR.TRI ).AND.UPLO.EQ.'U'+      LOWER = ( SYM.OR.TRI ).AND.UPLO.EQ.'L'+      UNIT = TRI.AND.DIAG.EQ.'U'+*+*     Generate data in array A.+*+      DO 20 J = 1, N+         DO 10 I = 1, M+            IF( GEN.OR.( UPPER.AND.I.LE.J ).OR.( LOWER.AND.I.GE.J ) )+     $          THEN+               A( I, J ) = SBEG( RESET ) + TRANSL+               IF( I.NE.J )THEN+*                 Set some elements to zero+                  IF( N.GT.3.AND.J.EQ.N/2 )+     $               A( I, J ) = ZERO+                  IF( SYM )THEN+                     A( J, I ) = A( I, J )+                  ELSE IF( TRI )THEN+                     A( J, I ) = ZERO+                  END IF+               END IF+            END IF+   10    CONTINUE+         IF( TRI )+     $      A( J, J ) = A( J, J ) + ONE+         IF( UNIT )+     $      A( J, J ) = ONE+   20 CONTINUE+*+*     Store elements in array AS in data structure required by routine.+*+      IF( TYPE.EQ.'GE' )THEN+         DO 50 J = 1, N+            DO 30 I = 1, M+               AA( I + ( J - 1 )*LDA ) = A( I, J )+   30       CONTINUE+            DO 40 I = M + 1, LDA+               AA( I + ( J - 1 )*LDA ) = ROGUE+   40       CONTINUE+   50    CONTINUE+      ELSE IF( TYPE.EQ.'SY'.OR.TYPE.EQ.'TR' )THEN+         DO 90 J = 1, N+            IF( UPPER )THEN+               IBEG = 1+               IF( UNIT )THEN+                  IEND = J - 1+               ELSE+                  IEND = J+               END IF+            ELSE+               IF( UNIT )THEN+                  IBEG = J + 1+               ELSE+                  IBEG = J+               END IF+               IEND = N+            END IF+            DO 60 I = 1, IBEG - 1+               AA( I + ( J - 1 )*LDA ) = ROGUE+   60       CONTINUE+            DO 70 I = IBEG, IEND+               AA( I + ( J - 1 )*LDA ) = A( I, J )+   70       CONTINUE+            DO 80 I = IEND + 1, LDA+               AA( I + ( J - 1 )*LDA ) = ROGUE+   80       CONTINUE+   90    CONTINUE+      END IF+      RETURN+*+*     End of SMAKE.+*+      END+      SUBROUTINE SMMCH( TRANSA, TRANSB, M, N, KK, ALPHA, A, LDA, B, LDB,+     $                  BETA, C, LDC, CT, G, CC, LDCC, EPS, ERR, FATAL,+     $                  NOUT, MV )+*+*  Checks the results of the computational tests.+*+*  Auxiliary routine for test program for Level 3 Blas.+*+*  -- Written on 8-February-1989.+*     Jack Dongarra, Argonne National Laboratory.+*     Iain Duff, AERE Harwell.+*     Jeremy Du Croz, Numerical Algorithms Group Ltd.+*     Sven Hammarling, Numerical Algorithms Group Ltd.+*+*     .. Parameters ..+      REAL               ZERO, ONE+      PARAMETER          ( ZERO = 0.0, ONE = 1.0 )+*     .. Scalar Arguments ..+      REAL               ALPHA, BETA, EPS, ERR+      INTEGER            KK, LDA, LDB, LDC, LDCC, M, N, NOUT+      LOGICAL            FATAL, MV+      CHARACTER*1        TRANSA, TRANSB+*     .. Array Arguments ..+      REAL               A( LDA, * ), B( LDB, * ), C( LDC, * ),+     $                   CC( LDCC, * ), CT( * ), G( * )+*     .. Local Scalars ..+      REAL               ERRI+      INTEGER            I, J, K+      LOGICAL            TRANA, TRANB+*     .. Intrinsic Functions ..+      INTRINSIC          ABS, MAX, SQRT+*     .. Executable Statements ..+      TRANA = TRANSA.EQ.'T'.OR.TRANSA.EQ.'C'+      TRANB = TRANSB.EQ.'T'.OR.TRANSB.EQ.'C'+*+*     Compute expected result, one column at a time, in CT using data+*     in A, B and C.+*     Compute gauges in G.+*+      DO 120 J = 1, N+*+         DO 10 I = 1, M+            CT( I ) = ZERO+            G( I ) = ZERO+   10    CONTINUE+         IF( .NOT.TRANA.AND..NOT.TRANB )THEN+            DO 30 K = 1, KK+               DO 20 I = 1, M+                  CT( I ) = CT( I ) + A( I, K )*B( K, J )+                  G( I ) = G( I ) + ABS( A( I, K ) )*ABS( B( K, J ) )+   20          CONTINUE+   30       CONTINUE+         ELSE IF( TRANA.AND..NOT.TRANB )THEN+            DO 50 K = 1, KK+               DO 40 I = 1, M+                  CT( I ) = CT( I ) + A( K, I )*B( K, J )+                  G( I ) = G( I ) + ABS( A( K, I ) )*ABS( B( K, J ) )+   40          CONTINUE+   50       CONTINUE+         ELSE IF( .NOT.TRANA.AND.TRANB )THEN+            DO 70 K = 1, KK+               DO 60 I = 1, M+                  CT( I ) = CT( I ) + A( I, K )*B( J, K )+                  G( I ) = G( I ) + ABS( A( I, K ) )*ABS( B( J, K ) )+   60          CONTINUE+   70       CONTINUE+         ELSE IF( TRANA.AND.TRANB )THEN+            DO 90 K = 1, KK+               DO 80 I = 1, M+                  CT( I ) = CT( I ) + A( K, I )*B( J, K )+                  G( I ) = G( I ) + ABS( A( K, I ) )*ABS( B( J, K ) )+   80          CONTINUE+   90       CONTINUE+         END IF+         DO 100 I = 1, M+            CT( I ) = ALPHA*CT( I ) + BETA*C( I, J )+            G( I ) = ABS( ALPHA )*G( I ) + ABS( BETA )*ABS( C( I, J ) )+  100    CONTINUE+*+*        Compute the error ratio for this result.+*+         ERR = ZERO+         DO 110 I = 1, M+            ERRI = ABS( CT( I ) - CC( I, J ) )/EPS+            IF( G( I ).NE.ZERO )+     $         ERRI = ERRI/G( I )+            ERR = MAX( ERR, ERRI )+            IF( ERR*SQRT( EPS ).GE.ONE )+     $         GO TO 130+  110    CONTINUE+*+  120 CONTINUE+*+*     If the loop completes, all results are at least half accurate.+      GO TO 150+*+*     Report fatal error.+*+  130 FATAL = .TRUE.+      WRITE( NOUT, FMT = 9999 )+      DO 140 I = 1, M+         IF( MV )THEN+            WRITE( NOUT, FMT = 9998 )I, CT( I ), CC( I, J )+         ELSE+            WRITE( NOUT, FMT = 9998 )I, CC( I, J ), CT( I )+         END IF+  140 CONTINUE+      IF( N.GT.1 )+     $   WRITE( NOUT, FMT = 9997 )J+*+  150 CONTINUE+      RETURN+*+ 9999 FORMAT( ' ******* FATAL ERROR - COMPUTED RESULT IS LESS THAN HAL',+     $      'F ACCURATE *******', /'           EXPECTED RESULT   COMPU',+     $      'TED RESULT' )+ 9998 FORMAT( 1X, I7, 2G18.6 )+ 9997 FORMAT( '      THESE ARE THE RESULTS FOR COLUMN ', I3 )+*+*     End of SMMCH.+*+      END+      LOGICAL FUNCTION LSE( RI, RJ, LR )+*+*  Tests if two arrays are identical.+*+*  Auxiliary routine for test program for Level 3 Blas.+*+*  -- Written on 8-February-1989.+*     Jack Dongarra, Argonne National Laboratory.+*     Iain Duff, AERE Harwell.+*     Jeremy Du Croz, Numerical Algorithms Group Ltd.+*     Sven Hammarling, Numerical Algorithms Group Ltd.+*+*     .. Scalar Arguments ..+      INTEGER            LR+*     .. Array Arguments ..+      REAL               RI( * ), RJ( * )+*     .. Local Scalars ..+      INTEGER            I+*     .. Executable Statements ..+      DO 10 I = 1, LR+         IF( RI( I ).NE.RJ( I ) )+     $      GO TO 20+   10 CONTINUE+      LSE = .TRUE.+      GO TO 30+   20 CONTINUE+      LSE = .FALSE.+   30 RETURN+*+*     End of LSE.+*+      END+      LOGICAL FUNCTION LSERES( TYPE, UPLO, M, N, AA, AS, LDA )+*+*  Tests if selected elements in two arrays are equal.+*+*  TYPE is 'GE' or 'SY'.+*+*  Auxiliary routine for test program for Level 3 Blas.+*+*  -- Written on 8-February-1989.+*     Jack Dongarra, Argonne National Laboratory.+*     Iain Duff, AERE Harwell.+*     Jeremy Du Croz, Numerical Algorithms Group Ltd.+*     Sven Hammarling, Numerical Algorithms Group Ltd.+*+*     .. Scalar Arguments ..+      INTEGER            LDA, M, N+      CHARACTER*1        UPLO+      CHARACTER*2        TYPE+*     .. Array Arguments ..+      REAL               AA( LDA, * ), AS( LDA, * )+*     .. Local Scalars ..+      INTEGER            I, IBEG, IEND, J+      LOGICAL            UPPER+*     .. Executable Statements ..+      UPPER = UPLO.EQ.'U'+      IF( TYPE.EQ.'GE' )THEN+         DO 20 J = 1, N+            DO 10 I = M + 1, LDA+               IF( AA( I, J ).NE.AS( I, J ) )+     $            GO TO 70+   10       CONTINUE+   20    CONTINUE+      ELSE IF( TYPE.EQ.'SY' )THEN+         DO 50 J = 1, N+            IF( UPPER )THEN+               IBEG = 1+               IEND = J+            ELSE+               IBEG = J+               IEND = N+            END IF+            DO 30 I = 1, IBEG - 1+               IF( AA( I, J ).NE.AS( I, J ) )+     $            GO TO 70+   30       CONTINUE+            DO 40 I = IEND + 1, LDA+               IF( AA( I, J ).NE.AS( I, J ) )+     $            GO TO 70+   40       CONTINUE+   50    CONTINUE+      END IF+*+      LSERES = .TRUE.+      GO TO 80+   70 CONTINUE+      LSERES = .FALSE.+   80 RETURN+*+*     End of LSERES.+*+      END+      REAL FUNCTION SBEG( RESET )+*+*  Generates random numbers uniformly distributed between -0.5 and 0.5.+*+*  Auxiliary routine for test program for Level 3 Blas.+*+*  -- Written on 8-February-1989.+*     Jack Dongarra, Argonne National Laboratory.+*     Iain Duff, AERE Harwell.+*     Jeremy Du Croz, Numerical Algorithms Group Ltd.+*     Sven Hammarling, Numerical Algorithms Group Ltd.+*+*     .. Scalar Arguments ..+      LOGICAL            RESET+*     .. Local Scalars ..+      INTEGER            I, IC, MI+*     .. Save statement ..+      SAVE               I, IC, MI+*     .. Executable Statements ..+      IF( RESET )THEN+*        Initialize local variables.+         MI = 891+         I = 7+         IC = 0+         RESET = .FALSE.+      END IF+*+*     The sequence of values of I is bounded between 1 and 999.+*     If initial I = 1,2,3,6,7 or 9, the period will be 50.+*     If initial I = 4 or 8, the period will be 25.+*     If initial I = 5, the period will be 10.+*     IC is used to break up the period by skipping 1 value of I in 6.+*+      IC = IC + 1+   10 I = I*MI+      I = I - 1000*( I/1000 )+      IF( IC.GE.5 )THEN+         IC = 0+         GO TO 10+      END IF+      SBEG = ( I - 500 )/1001.0+      RETURN+*+*     End of SBEG.+*+      END+      REAL FUNCTION SDIFF( X, Y )+*+*  Auxiliary routine for test program for Level 3 Blas.+*+*  -- Written on 8-February-1989.+*     Jack Dongarra, Argonne National Laboratory.+*     Iain Duff, AERE Harwell.+*     Jeremy Du Croz, Numerical Algorithms Group Ltd.+*     Sven Hammarling, Numerical Algorithms Group Ltd.+*+*     .. Scalar Arguments ..+      REAL               X, Y+*     .. Executable Statements ..+      SDIFF = X - Y+      RETURN+*+*     End of SDIFF.+*+      END+      SUBROUTINE CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+*+*  Tests whether XERBLA has detected an error when it should.+*+*  Auxiliary routine for test program for Level 3 Blas.+*+*  -- Written on 8-February-1989.+*     Jack Dongarra, Argonne National Laboratory.+*     Iain Duff, AERE Harwell.+*     Jeremy Du Croz, Numerical Algorithms Group Ltd.+*     Sven Hammarling, Numerical Algorithms Group Ltd.+*+*     .. Scalar Arguments ..+      INTEGER            INFOT, NOUT+      LOGICAL            LERR, OK+      CHARACTER*6        SRNAMT+*     .. Executable Statements ..+      IF( .NOT.LERR )THEN+         WRITE( NOUT, FMT = 9999 )INFOT, SRNAMT+         OK = .FALSE.+      END IF+      LERR = .FALSE.+      RETURN+*+ 9999 FORMAT( ' ***** ILLEGAL VALUE OF PARAMETER NUMBER ', I2, ' NOT D',+     $      'ETECTED BY ', A6, ' *****' )+*+*     End of CHKXER.+*+      END+      SUBROUTINE XERBLA( SRNAME, INFO )+*+*  This is a special version of XERBLA to be used only as part of+*  the test program for testing error exits from the Level 3 BLAS+*  routines.+*+*  XERBLA  is an error handler for the Level 3 BLAS routines.+*+*  It is called by the Level 3 BLAS routines if an input parameter is+*  invalid.+*+*  Auxiliary routine for test program for Level 3 Blas.+*+*  -- Written on 8-February-1989.+*     Jack Dongarra, Argonne National Laboratory.+*     Iain Duff, AERE Harwell.+*     Jeremy Du Croz, Numerical Algorithms Group Ltd.+*     Sven Hammarling, Numerical Algorithms Group Ltd.+*+*     .. Scalar Arguments ..+      INTEGER            INFO+      CHARACTER*6        SRNAME+*     .. Scalars in Common ..+      INTEGER            INFOT, NOUT+      LOGICAL            LERR, OK+      CHARACTER*6        SRNAMT+*     .. Common blocks ..+      COMMON             /INFOC/INFOT, NOUT, OK, LERR+      COMMON             /SRNAMC/SRNAMT+*     .. Executable Statements ..+      LERR = .TRUE.+      IF( INFO.NE.INFOT )THEN+         IF( INFOT.NE.0 )THEN+            WRITE( NOUT, FMT = 9999 )INFO, INFOT+         ELSE+            WRITE( NOUT, FMT = 9997 )INFO+         END IF+         OK = .FALSE.+      END IF+      IF( SRNAME.NE.SRNAMT )THEN+         WRITE( NOUT, FMT = 9998 )SRNAME, SRNAMT+         OK = .FALSE.+      END IF+      RETURN+*+ 9999 FORMAT( ' ******* XERBLA WAS CALLED WITH INFO = ', I6, ' INSTEAD',+     $      ' OF ', I2, ' *******' )+ 9998 FORMAT( ' ******* XERBLA WAS CALLED WITH SRNAME = ', A6, ' INSTE',+     $      'AD OF ', A6, ' *******' )+ 9997 FORMAT( ' ******* XERBLA WAS CALLED WITH INFO = ', I6,+     $      ' *******' )+*+*     End of XERBLA+*+      END+
+ eigen3/blas/testing/zblat1.f view
@@ -0,0 +1,724 @@+*> \brief \b ZBLAT1+*+*  =========== DOCUMENTATION ===========+*+* Online html documentation available at +*            http://www.netlib.org/lapack/explore-html/ +*+*  Definition:+*  ===========+*+*       PROGRAM ZBLAT1+* +*+*> \par Purpose:+*  =============+*>+*> \verbatim+*>+*>    Test program for the COMPLEX*16 Level 1 BLAS.+*>+*>    Based upon the original BLAS test routine together with:+*>    F06GAF Example Program Text+*> \endverbatim+*+*  Authors:+*  ========+*+*> \author Univ. of Tennessee +*> \author Univ. of California Berkeley +*> \author Univ. of Colorado Denver +*> \author NAG Ltd. +*+*> \date April 2012+*+*> \ingroup complex16_blas_testing+*+*  =====================================================================+      PROGRAM ZBLAT1+*+*  -- Reference BLAS test routine (version 3.4.1) --+*  -- Reference BLAS is a software package provided by Univ. of Tennessee,    --+*  -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--+*     April 2012+*+*  =====================================================================+*+*     .. Parameters ..+      INTEGER          NOUT+      PARAMETER        (NOUT=6)+*     .. Scalars in Common ..+      INTEGER          ICASE, INCX, INCY, MODE, N+      LOGICAL          PASS+*     .. Local Scalars ..+      DOUBLE PRECISION SFAC+      INTEGER          IC+*     .. External Subroutines ..+      EXTERNAL         CHECK1, CHECK2, HEADER+*     .. Common blocks ..+      COMMON           /COMBLA/ICASE, N, INCX, INCY, MODE, PASS+*     .. Data statements ..+      DATA             SFAC/9.765625D-4/+*     .. Executable Statements ..+      WRITE (NOUT,99999)+      DO 20 IC = 1, 10+         ICASE = IC+         CALL HEADER+*+*        Initialize PASS, INCX, INCY, and MODE for a new case.+*        The value 9999 for INCX, INCY or MODE will appear in the+*        detailed  output, if any, for cases that do not involve+*        these parameters.+*+         PASS = .TRUE.+         INCX = 9999+         INCY = 9999+         MODE = 9999+         IF (ICASE.LE.5) THEN+            CALL CHECK2(SFAC)+         ELSE IF (ICASE.GE.6) THEN+            CALL CHECK1(SFAC)+         END IF+*        -- Print+         IF (PASS) WRITE (NOUT,99998)+   20 CONTINUE+      STOP+*+99999 FORMAT (' Complex BLAS Test Program Results',/1X)+99998 FORMAT ('                                    ----- PASS -----')+      END+      SUBROUTINE HEADER+*     .. Parameters ..+      INTEGER          NOUT+      PARAMETER        (NOUT=6)+*     .. Scalars in Common ..+      INTEGER          ICASE, INCX, INCY, MODE, N+      LOGICAL          PASS+*     .. Local Arrays ..+      CHARACTER*6      L(10)+*     .. Common blocks ..+      COMMON           /COMBLA/ICASE, N, INCX, INCY, MODE, PASS+*     .. Data statements ..+      DATA             L(1)/'ZDOTC '/+      DATA             L(2)/'ZDOTU '/+      DATA             L(3)/'ZAXPY '/+      DATA             L(4)/'ZCOPY '/+      DATA             L(5)/'ZSWAP '/+      DATA             L(6)/'DZNRM2'/+      DATA             L(7)/'DZASUM'/+      DATA             L(8)/'ZSCAL '/+      DATA             L(9)/'ZDSCAL'/+      DATA             L(10)/'IZAMAX'/+*     .. Executable Statements ..+      WRITE (NOUT,99999) ICASE, L(ICASE)+      RETURN+*+99999 FORMAT (/' Test of subprogram number',I3,12X,A6)+      END+      SUBROUTINE CHECK1(SFAC)+*     .. Parameters ..+      INTEGER           NOUT+      PARAMETER         (NOUT=6)+*     .. Scalar Arguments ..+      DOUBLE PRECISION  SFAC+*     .. Scalars in Common ..+      INTEGER           ICASE, INCX, INCY, MODE, N+      LOGICAL           PASS+*     .. Local Scalars ..+      COMPLEX*16        CA+      DOUBLE PRECISION  SA+      INTEGER           I, J, LEN, NP1+*     .. Local Arrays ..+      COMPLEX*16        CTRUE5(8,5,2), CTRUE6(8,5,2), CV(8,5,2), CX(8),+     +                  MWPCS(5), MWPCT(5)+      DOUBLE PRECISION  STRUE2(5), STRUE4(5)+      INTEGER           ITRUE3(5)+*     .. External Functions ..+      DOUBLE PRECISION  DZASUM, DZNRM2+      INTEGER           IZAMAX+      EXTERNAL          DZASUM, DZNRM2, IZAMAX+*     .. External Subroutines ..+      EXTERNAL          ZSCAL, ZDSCAL, CTEST, ITEST1, STEST1+*     .. Intrinsic Functions ..+      INTRINSIC         MAX+*     .. Common blocks ..+      COMMON            /COMBLA/ICASE, N, INCX, INCY, MODE, PASS+*     .. Data statements ..+      DATA              SA, CA/0.3D0, (0.4D0,-0.7D0)/+      DATA              ((CV(I,J,1),I=1,8),J=1,5)/(0.1D0,0.1D0),+     +                  (1.0D0,2.0D0), (1.0D0,2.0D0), (1.0D0,2.0D0),+     +                  (1.0D0,2.0D0), (1.0D0,2.0D0), (1.0D0,2.0D0),+     +                  (1.0D0,2.0D0), (0.3D0,-0.4D0), (3.0D0,4.0D0),+     +                  (3.0D0,4.0D0), (3.0D0,4.0D0), (3.0D0,4.0D0),+     +                  (3.0D0,4.0D0), (3.0D0,4.0D0), (3.0D0,4.0D0),+     +                  (0.1D0,-0.3D0), (0.5D0,-0.1D0), (5.0D0,6.0D0),+     +                  (5.0D0,6.0D0), (5.0D0,6.0D0), (5.0D0,6.0D0),+     +                  (5.0D0,6.0D0), (5.0D0,6.0D0), (0.1D0,0.1D0),+     +                  (-0.6D0,0.1D0), (0.1D0,-0.3D0), (7.0D0,8.0D0),+     +                  (7.0D0,8.0D0), (7.0D0,8.0D0), (7.0D0,8.0D0),+     +                  (7.0D0,8.0D0), (0.3D0,0.1D0), (0.5D0,0.0D0),+     +                  (0.0D0,0.5D0), (0.0D0,0.2D0), (2.0D0,3.0D0),+     +                  (2.0D0,3.0D0), (2.0D0,3.0D0), (2.0D0,3.0D0)/+      DATA              ((CV(I,J,2),I=1,8),J=1,5)/(0.1D0,0.1D0),+     +                  (4.0D0,5.0D0), (4.0D0,5.0D0), (4.0D0,5.0D0),+     +                  (4.0D0,5.0D0), (4.0D0,5.0D0), (4.0D0,5.0D0),+     +                  (4.0D0,5.0D0), (0.3D0,-0.4D0), (6.0D0,7.0D0),+     +                  (6.0D0,7.0D0), (6.0D0,7.0D0), (6.0D0,7.0D0),+     +                  (6.0D0,7.0D0), (6.0D0,7.0D0), (6.0D0,7.0D0),+     +                  (0.1D0,-0.3D0), (8.0D0,9.0D0), (0.5D0,-0.1D0),+     +                  (2.0D0,5.0D0), (2.0D0,5.0D0), (2.0D0,5.0D0),+     +                  (2.0D0,5.0D0), (2.0D0,5.0D0), (0.1D0,0.1D0),+     +                  (3.0D0,6.0D0), (-0.6D0,0.1D0), (4.0D0,7.0D0),+     +                  (0.1D0,-0.3D0), (7.0D0,2.0D0), (7.0D0,2.0D0),+     +                  (7.0D0,2.0D0), (0.3D0,0.1D0), (5.0D0,8.0D0),+     +                  (0.5D0,0.0D0), (6.0D0,9.0D0), (0.0D0,0.5D0),+     +                  (8.0D0,3.0D0), (0.0D0,0.2D0), (9.0D0,4.0D0)/+      DATA              STRUE2/0.0D0, 0.5D0, 0.6D0, 0.7D0, 0.8D0/+      DATA              STRUE4/0.0D0, 0.7D0, 1.0D0, 1.3D0, 1.6D0/+      DATA              ((CTRUE5(I,J,1),I=1,8),J=1,5)/(0.1D0,0.1D0),+     +                  (1.0D0,2.0D0), (1.0D0,2.0D0), (1.0D0,2.0D0),+     +                  (1.0D0,2.0D0), (1.0D0,2.0D0), (1.0D0,2.0D0),+     +                  (1.0D0,2.0D0), (-0.16D0,-0.37D0), (3.0D0,4.0D0),+     +                  (3.0D0,4.0D0), (3.0D0,4.0D0), (3.0D0,4.0D0),+     +                  (3.0D0,4.0D0), (3.0D0,4.0D0), (3.0D0,4.0D0),+     +                  (-0.17D0,-0.19D0), (0.13D0,-0.39D0),+     +                  (5.0D0,6.0D0), (5.0D0,6.0D0), (5.0D0,6.0D0),+     +                  (5.0D0,6.0D0), (5.0D0,6.0D0), (5.0D0,6.0D0),+     +                  (0.11D0,-0.03D0), (-0.17D0,0.46D0),+     +                  (-0.17D0,-0.19D0), (7.0D0,8.0D0), (7.0D0,8.0D0),+     +                  (7.0D0,8.0D0), (7.0D0,8.0D0), (7.0D0,8.0D0),+     +                  (0.19D0,-0.17D0), (0.20D0,-0.35D0),+     +                  (0.35D0,0.20D0), (0.14D0,0.08D0),+     +                  (2.0D0,3.0D0), (2.0D0,3.0D0), (2.0D0,3.0D0),+     +                  (2.0D0,3.0D0)/+      DATA              ((CTRUE5(I,J,2),I=1,8),J=1,5)/(0.1D0,0.1D0),+     +                  (4.0D0,5.0D0), (4.0D0,5.0D0), (4.0D0,5.0D0),+     +                  (4.0D0,5.0D0), (4.0D0,5.0D0), (4.0D0,5.0D0),+     +                  (4.0D0,5.0D0), (-0.16D0,-0.37D0), (6.0D0,7.0D0),+     +                  (6.0D0,7.0D0), (6.0D0,7.0D0), (6.0D0,7.0D0),+     +                  (6.0D0,7.0D0), (6.0D0,7.0D0), (6.0D0,7.0D0),+     +                  (-0.17D0,-0.19D0), (8.0D0,9.0D0),+     +                  (0.13D0,-0.39D0), (2.0D0,5.0D0), (2.0D0,5.0D0),+     +                  (2.0D0,5.0D0), (2.0D0,5.0D0), (2.0D0,5.0D0),+     +                  (0.11D0,-0.03D0), (3.0D0,6.0D0),+     +                  (-0.17D0,0.46D0), (4.0D0,7.0D0),+     +                  (-0.17D0,-0.19D0), (7.0D0,2.0D0), (7.0D0,2.0D0),+     +                  (7.0D0,2.0D0), (0.19D0,-0.17D0), (5.0D0,8.0D0),+     +                  (0.20D0,-0.35D0), (6.0D0,9.0D0),+     +                  (0.35D0,0.20D0), (8.0D0,3.0D0),+     +                  (0.14D0,0.08D0), (9.0D0,4.0D0)/+      DATA              ((CTRUE6(I,J,1),I=1,8),J=1,5)/(0.1D0,0.1D0),+     +                  (1.0D0,2.0D0), (1.0D0,2.0D0), (1.0D0,2.0D0),+     +                  (1.0D0,2.0D0), (1.0D0,2.0D0), (1.0D0,2.0D0),+     +                  (1.0D0,2.0D0), (0.09D0,-0.12D0), (3.0D0,4.0D0),+     +                  (3.0D0,4.0D0), (3.0D0,4.0D0), (3.0D0,4.0D0),+     +                  (3.0D0,4.0D0), (3.0D0,4.0D0), (3.0D0,4.0D0),+     +                  (0.03D0,-0.09D0), (0.15D0,-0.03D0),+     +                  (5.0D0,6.0D0), (5.0D0,6.0D0), (5.0D0,6.0D0),+     +                  (5.0D0,6.0D0), (5.0D0,6.0D0), (5.0D0,6.0D0),+     +                  (0.03D0,0.03D0), (-0.18D0,0.03D0),+     +                  (0.03D0,-0.09D0), (7.0D0,8.0D0), (7.0D0,8.0D0),+     +                  (7.0D0,8.0D0), (7.0D0,8.0D0), (7.0D0,8.0D0),+     +                  (0.09D0,0.03D0), (0.15D0,0.00D0),+     +                  (0.00D0,0.15D0), (0.00D0,0.06D0), (2.0D0,3.0D0),+     +                  (2.0D0,3.0D0), (2.0D0,3.0D0), (2.0D0,3.0D0)/+      DATA              ((CTRUE6(I,J,2),I=1,8),J=1,5)/(0.1D0,0.1D0),+     +                  (4.0D0,5.0D0), (4.0D0,5.0D0), (4.0D0,5.0D0),+     +                  (4.0D0,5.0D0), (4.0D0,5.0D0), (4.0D0,5.0D0),+     +                  (4.0D0,5.0D0), (0.09D0,-0.12D0), (6.0D0,7.0D0),+     +                  (6.0D0,7.0D0), (6.0D0,7.0D0), (6.0D0,7.0D0),+     +                  (6.0D0,7.0D0), (6.0D0,7.0D0), (6.0D0,7.0D0),+     +                  (0.03D0,-0.09D0), (8.0D0,9.0D0),+     +                  (0.15D0,-0.03D0), (2.0D0,5.0D0), (2.0D0,5.0D0),+     +                  (2.0D0,5.0D0), (2.0D0,5.0D0), (2.0D0,5.0D0),+     +                  (0.03D0,0.03D0), (3.0D0,6.0D0),+     +                  (-0.18D0,0.03D0), (4.0D0,7.0D0),+     +                  (0.03D0,-0.09D0), (7.0D0,2.0D0), (7.0D0,2.0D0),+     +                  (7.0D0,2.0D0), (0.09D0,0.03D0), (5.0D0,8.0D0),+     +                  (0.15D0,0.00D0), (6.0D0,9.0D0), (0.00D0,0.15D0),+     +                  (8.0D0,3.0D0), (0.00D0,0.06D0), (9.0D0,4.0D0)/+      DATA              ITRUE3/0, 1, 2, 2, 2/+*     .. Executable Statements ..+      DO 60 INCX = 1, 2+         DO 40 NP1 = 1, 5+            N = NP1 - 1+            LEN = 2*MAX(N,1)+*           .. Set vector arguments ..+            DO 20 I = 1, LEN+               CX(I) = CV(I,NP1,INCX)+   20       CONTINUE+            IF (ICASE.EQ.6) THEN+*              .. DZNRM2 ..+               CALL STEST1(DZNRM2(N,CX,INCX),STRUE2(NP1),STRUE2(NP1),+     +                     SFAC)+            ELSE IF (ICASE.EQ.7) THEN+*              .. DZASUM ..+               CALL STEST1(DZASUM(N,CX,INCX),STRUE4(NP1),STRUE4(NP1),+     +                     SFAC)+            ELSE IF (ICASE.EQ.8) THEN+*              .. ZSCAL ..+               CALL ZSCAL(N,CA,CX,INCX)+               CALL CTEST(LEN,CX,CTRUE5(1,NP1,INCX),CTRUE5(1,NP1,INCX),+     +                    SFAC)+            ELSE IF (ICASE.EQ.9) THEN+*              .. ZDSCAL ..+               CALL ZDSCAL(N,SA,CX,INCX)+               CALL CTEST(LEN,CX,CTRUE6(1,NP1,INCX),CTRUE6(1,NP1,INCX),+     +                    SFAC)+            ELSE IF (ICASE.EQ.10) THEN+*              .. IZAMAX ..+               CALL ITEST1(IZAMAX(N,CX,INCX),ITRUE3(NP1))+            ELSE+               WRITE (NOUT,*) ' Shouldn''t be here in CHECK1'+               STOP+            END IF+*+   40    CONTINUE+   60 CONTINUE+*+      INCX = 1+      IF (ICASE.EQ.8) THEN+*        ZSCAL+*        Add a test for alpha equal to zero.+         CA = (0.0D0,0.0D0)+         DO 80 I = 1, 5+            MWPCT(I) = (0.0D0,0.0D0)+            MWPCS(I) = (1.0D0,1.0D0)+   80    CONTINUE+         CALL ZSCAL(5,CA,CX,INCX)+         CALL CTEST(5,CX,MWPCT,MWPCS,SFAC)+      ELSE IF (ICASE.EQ.9) THEN+*        ZDSCAL+*        Add a test for alpha equal to zero.+         SA = 0.0D0+         DO 100 I = 1, 5+            MWPCT(I) = (0.0D0,0.0D0)+            MWPCS(I) = (1.0D0,1.0D0)+  100    CONTINUE+         CALL ZDSCAL(5,SA,CX,INCX)+         CALL CTEST(5,CX,MWPCT,MWPCS,SFAC)+*        Add a test for alpha equal to one.+         SA = 1.0D0+         DO 120 I = 1, 5+            MWPCT(I) = CX(I)+            MWPCS(I) = CX(I)+  120    CONTINUE+         CALL ZDSCAL(5,SA,CX,INCX)+         CALL CTEST(5,CX,MWPCT,MWPCS,SFAC)+*        Add a test for alpha equal to minus one.+         SA = -1.0D0+         DO 140 I = 1, 5+            MWPCT(I) = -CX(I)+            MWPCS(I) = -CX(I)+  140    CONTINUE+         CALL ZDSCAL(5,SA,CX,INCX)+         CALL CTEST(5,CX,MWPCT,MWPCS,SFAC)+      END IF+      RETURN+      END+      SUBROUTINE CHECK2(SFAC)+*     .. Parameters ..+      INTEGER           NOUT+      PARAMETER         (NOUT=6)+*     .. Scalar Arguments ..+      DOUBLE PRECISION  SFAC+*     .. Scalars in Common ..+      INTEGER           ICASE, INCX, INCY, MODE, N+      LOGICAL           PASS+*     .. Local Scalars ..+      COMPLEX*16        CA+      INTEGER           I, J, KI, KN, KSIZE, LENX, LENY, MX, MY+*     .. Local Arrays ..+      COMPLEX*16        CDOT(1), CSIZE1(4), CSIZE2(7,2), CSIZE3(14),+     +                  CT10X(7,4,4), CT10Y(7,4,4), CT6(4,4), CT7(4,4),+     +                  CT8(7,4,4), CX(7), CX1(7), CY(7), CY1(7)+      INTEGER           INCXS(4), INCYS(4), LENS(4,2), NS(4)+*     .. External Functions ..+      COMPLEX*16        ZDOTC, ZDOTU+      EXTERNAL          ZDOTC, ZDOTU+*     .. External Subroutines ..+      EXTERNAL          ZAXPY, ZCOPY, ZSWAP, CTEST+*     .. Intrinsic Functions ..+      INTRINSIC         ABS, MIN+*     .. Common blocks ..+      COMMON            /COMBLA/ICASE, N, INCX, INCY, MODE, PASS+*     .. Data statements ..+      DATA              CA/(0.4D0,-0.7D0)/+      DATA              INCXS/1, 2, -2, -1/+      DATA              INCYS/1, -2, 1, -2/+      DATA              LENS/1, 1, 2, 4, 1, 1, 3, 7/+      DATA              NS/0, 1, 2, 4/+      DATA              CX1/(0.7D0,-0.8D0), (-0.4D0,-0.7D0),+     +                  (-0.1D0,-0.9D0), (0.2D0,-0.8D0),+     +                  (-0.9D0,-0.4D0), (0.1D0,0.4D0), (-0.6D0,0.6D0)/+      DATA              CY1/(0.6D0,-0.6D0), (-0.9D0,0.5D0),+     +                  (0.7D0,-0.6D0), (0.1D0,-0.5D0), (-0.1D0,-0.2D0),+     +                  (-0.5D0,-0.3D0), (0.8D0,-0.7D0)/+      DATA              ((CT8(I,J,1),I=1,7),J=1,4)/(0.6D0,-0.6D0),+     +                  (0.0D0,0.0D0), (0.0D0,0.0D0), (0.0D0,0.0D0),+     +                  (0.0D0,0.0D0), (0.0D0,0.0D0), (0.0D0,0.0D0),+     +                  (0.32D0,-1.41D0), (0.0D0,0.0D0), (0.0D0,0.0D0),+     +                  (0.0D0,0.0D0), (0.0D0,0.0D0), (0.0D0,0.0D0),+     +                  (0.0D0,0.0D0), (0.32D0,-1.41D0),+     +                  (-1.55D0,0.5D0), (0.0D0,0.0D0), (0.0D0,0.0D0),+     +                  (0.0D0,0.0D0), (0.0D0,0.0D0), (0.0D0,0.0D0),+     +                  (0.32D0,-1.41D0), (-1.55D0,0.5D0),+     +                  (0.03D0,-0.89D0), (-0.38D0,-0.96D0),+     +                  (0.0D0,0.0D0), (0.0D0,0.0D0), (0.0D0,0.0D0)/+      DATA              ((CT8(I,J,2),I=1,7),J=1,4)/(0.6D0,-0.6D0),+     +                  (0.0D0,0.0D0), (0.0D0,0.0D0), (0.0D0,0.0D0),+     +                  (0.0D0,0.0D0), (0.0D0,0.0D0), (0.0D0,0.0D0),+     +                  (0.32D0,-1.41D0), (0.0D0,0.0D0), (0.0D0,0.0D0),+     +                  (0.0D0,0.0D0), (0.0D0,0.0D0), (0.0D0,0.0D0),+     +                  (0.0D0,0.0D0), (-0.07D0,-0.89D0),+     +                  (-0.9D0,0.5D0), (0.42D0,-1.41D0), (0.0D0,0.0D0),+     +                  (0.0D0,0.0D0), (0.0D0,0.0D0), (0.0D0,0.0D0),+     +                  (0.78D0,0.06D0), (-0.9D0,0.5D0),+     +                  (0.06D0,-0.13D0), (0.1D0,-0.5D0),+     +                  (-0.77D0,-0.49D0), (-0.5D0,-0.3D0),+     +                  (0.52D0,-1.51D0)/+      DATA              ((CT8(I,J,3),I=1,7),J=1,4)/(0.6D0,-0.6D0),+     +                  (0.0D0,0.0D0), (0.0D0,0.0D0), (0.0D0,0.0D0),+     +                  (0.0D0,0.0D0), (0.0D0,0.0D0), (0.0D0,0.0D0),+     +                  (0.32D0,-1.41D0), (0.0D0,0.0D0), (0.0D0,0.0D0),+     +                  (0.0D0,0.0D0), (0.0D0,0.0D0), (0.0D0,0.0D0),+     +                  (0.0D0,0.0D0), (-0.07D0,-0.89D0),+     +                  (-1.18D0,-0.31D0), (0.0D0,0.0D0), (0.0D0,0.0D0),+     +                  (0.0D0,0.0D0), (0.0D0,0.0D0), (0.0D0,0.0D0),+     +                  (0.78D0,0.06D0), (-1.54D0,0.97D0),+     +                  (0.03D0,-0.89D0), (-0.18D0,-1.31D0),+     +                  (0.0D0,0.0D0), (0.0D0,0.0D0), (0.0D0,0.0D0)/+      DATA              ((CT8(I,J,4),I=1,7),J=1,4)/(0.6D0,-0.6D0),+     +                  (0.0D0,0.0D0), (0.0D0,0.0D0), (0.0D0,0.0D0),+     +                  (0.0D0,0.0D0), (0.0D0,0.0D0), (0.0D0,0.0D0),+     +                  (0.32D0,-1.41D0), (0.0D0,0.0D0), (0.0D0,0.0D0),+     +                  (0.0D0,0.0D0), (0.0D0,0.0D0), (0.0D0,0.0D0),+     +                  (0.0D0,0.0D0), (0.32D0,-1.41D0), (-0.9D0,0.5D0),+     +                  (0.05D0,-0.6D0), (0.0D0,0.0D0), (0.0D0,0.0D0),+     +                  (0.0D0,0.0D0), (0.0D0,0.0D0), (0.32D0,-1.41D0),+     +                  (-0.9D0,0.5D0), (0.05D0,-0.6D0), (0.1D0,-0.5D0),+     +                  (-0.77D0,-0.49D0), (-0.5D0,-0.3D0),+     +                  (0.32D0,-1.16D0)/+      DATA              CT7/(0.0D0,0.0D0), (-0.06D0,-0.90D0),+     +                  (0.65D0,-0.47D0), (-0.34D0,-1.22D0),+     +                  (0.0D0,0.0D0), (-0.06D0,-0.90D0),+     +                  (-0.59D0,-1.46D0), (-1.04D0,-0.04D0),+     +                  (0.0D0,0.0D0), (-0.06D0,-0.90D0),+     +                  (-0.83D0,0.59D0), (0.07D0,-0.37D0),+     +                  (0.0D0,0.0D0), (-0.06D0,-0.90D0),+     +                  (-0.76D0,-1.15D0), (-1.33D0,-1.82D0)/+      DATA              CT6/(0.0D0,0.0D0), (0.90D0,0.06D0),+     +                  (0.91D0,-0.77D0), (1.80D0,-0.10D0),+     +                  (0.0D0,0.0D0), (0.90D0,0.06D0), (1.45D0,0.74D0),+     +                  (0.20D0,0.90D0), (0.0D0,0.0D0), (0.90D0,0.06D0),+     +                  (-0.55D0,0.23D0), (0.83D0,-0.39D0),+     +                  (0.0D0,0.0D0), (0.90D0,0.06D0), (1.04D0,0.79D0),+     +                  (1.95D0,1.22D0)/+      DATA              ((CT10X(I,J,1),I=1,7),J=1,4)/(0.7D0,-0.8D0),+     +                  (0.0D0,0.0D0), (0.0D0,0.0D0), (0.0D0,0.0D0),+     +                  (0.0D0,0.0D0), (0.0D0,0.0D0), (0.0D0,0.0D0),+     +                  (0.6D0,-0.6D0), (0.0D0,0.0D0), (0.0D0,0.0D0),+     +                  (0.0D0,0.0D0), (0.0D0,0.0D0), (0.0D0,0.0D0),+     +                  (0.0D0,0.0D0), (0.6D0,-0.6D0), (-0.9D0,0.5D0),+     +                  (0.0D0,0.0D0), (0.0D0,0.0D0), (0.0D0,0.0D0),+     +                  (0.0D0,0.0D0), (0.0D0,0.0D0), (0.6D0,-0.6D0),+     +                  (-0.9D0,0.5D0), (0.7D0,-0.6D0), (0.1D0,-0.5D0),+     +                  (0.0D0,0.0D0), (0.0D0,0.0D0), (0.0D0,0.0D0)/+      DATA              ((CT10X(I,J,2),I=1,7),J=1,4)/(0.7D0,-0.8D0),+     +                  (0.0D0,0.0D0), (0.0D0,0.0D0), (0.0D0,0.0D0),+     +                  (0.0D0,0.0D0), (0.0D0,0.0D0), (0.0D0,0.0D0),+     +                  (0.6D0,-0.6D0), (0.0D0,0.0D0), (0.0D0,0.0D0),+     +                  (0.0D0,0.0D0), (0.0D0,0.0D0), (0.0D0,0.0D0),+     +                  (0.0D0,0.0D0), (0.7D0,-0.6D0), (-0.4D0,-0.7D0),+     +                  (0.6D0,-0.6D0), (0.0D0,0.0D0), (0.0D0,0.0D0),+     +                  (0.0D0,0.0D0), (0.0D0,0.0D0), (0.8D0,-0.7D0),+     +                  (-0.4D0,-0.7D0), (-0.1D0,-0.2D0),+     +                  (0.2D0,-0.8D0), (0.7D0,-0.6D0), (0.1D0,0.4D0),+     +                  (0.6D0,-0.6D0)/+      DATA              ((CT10X(I,J,3),I=1,7),J=1,4)/(0.7D0,-0.8D0),+     +                  (0.0D0,0.0D0), (0.0D0,0.0D0), (0.0D0,0.0D0),+     +                  (0.0D0,0.0D0), (0.0D0,0.0D0), (0.0D0,0.0D0),+     +                  (0.6D0,-0.6D0), (0.0D0,0.0D0), (0.0D0,0.0D0),+     +                  (0.0D0,0.0D0), (0.0D0,0.0D0), (0.0D0,0.0D0),+     +                  (0.0D0,0.0D0), (-0.9D0,0.5D0), (-0.4D0,-0.7D0),+     +                  (0.6D0,-0.6D0), (0.0D0,0.0D0), (0.0D0,0.0D0),+     +                  (0.0D0,0.0D0), (0.0D0,0.0D0), (0.1D0,-0.5D0),+     +                  (-0.4D0,-0.7D0), (0.7D0,-0.6D0), (0.2D0,-0.8D0),+     +                  (-0.9D0,0.5D0), (0.1D0,0.4D0), (0.6D0,-0.6D0)/+      DATA              ((CT10X(I,J,4),I=1,7),J=1,4)/(0.7D0,-0.8D0),+     +                  (0.0D0,0.0D0), (0.0D0,0.0D0), (0.0D0,0.0D0),+     +                  (0.0D0,0.0D0), (0.0D0,0.0D0), (0.0D0,0.0D0),+     +                  (0.6D0,-0.6D0), (0.0D0,0.0D0), (0.0D0,0.0D0),+     +                  (0.0D0,0.0D0), (0.0D0,0.0D0), (0.0D0,0.0D0),+     +                  (0.0D0,0.0D0), (0.6D0,-0.6D0), (0.7D0,-0.6D0),+     +                  (0.0D0,0.0D0), (0.0D0,0.0D0), (0.0D0,0.0D0),+     +                  (0.0D0,0.0D0), (0.0D0,0.0D0), (0.6D0,-0.6D0),+     +                  (0.7D0,-0.6D0), (-0.1D0,-0.2D0), (0.8D0,-0.7D0),+     +                  (0.0D0,0.0D0), (0.0D0,0.0D0), (0.0D0,0.0D0)/+      DATA              ((CT10Y(I,J,1),I=1,7),J=1,4)/(0.6D0,-0.6D0),+     +                  (0.0D0,0.0D0), (0.0D0,0.0D0), (0.0D0,0.0D0),+     +                  (0.0D0,0.0D0), (0.0D0,0.0D0), (0.0D0,0.0D0),+     +                  (0.7D0,-0.8D0), (0.0D0,0.0D0), (0.0D0,0.0D0),+     +                  (0.0D0,0.0D0), (0.0D0,0.0D0), (0.0D0,0.0D0),+     +                  (0.0D0,0.0D0), (0.7D0,-0.8D0), (-0.4D0,-0.7D0),+     +                  (0.0D0,0.0D0), (0.0D0,0.0D0), (0.0D0,0.0D0),+     +                  (0.0D0,0.0D0), (0.0D0,0.0D0), (0.7D0,-0.8D0),+     +                  (-0.4D0,-0.7D0), (-0.1D0,-0.9D0),+     +                  (0.2D0,-0.8D0), (0.0D0,0.0D0), (0.0D0,0.0D0),+     +                  (0.0D0,0.0D0)/+      DATA              ((CT10Y(I,J,2),I=1,7),J=1,4)/(0.6D0,-0.6D0),+     +                  (0.0D0,0.0D0), (0.0D0,0.0D0), (0.0D0,0.0D0),+     +                  (0.0D0,0.0D0), (0.0D0,0.0D0), (0.0D0,0.0D0),+     +                  (0.7D0,-0.8D0), (0.0D0,0.0D0), (0.0D0,0.0D0),+     +                  (0.0D0,0.0D0), (0.0D0,0.0D0), (0.0D0,0.0D0),+     +                  (0.0D0,0.0D0), (-0.1D0,-0.9D0), (-0.9D0,0.5D0),+     +                  (0.7D0,-0.8D0), (0.0D0,0.0D0), (0.0D0,0.0D0),+     +                  (0.0D0,0.0D0), (0.0D0,0.0D0), (-0.6D0,0.6D0),+     +                  (-0.9D0,0.5D0), (-0.9D0,-0.4D0), (0.1D0,-0.5D0),+     +                  (-0.1D0,-0.9D0), (-0.5D0,-0.3D0),+     +                  (0.7D0,-0.8D0)/+      DATA              ((CT10Y(I,J,3),I=1,7),J=1,4)/(0.6D0,-0.6D0),+     +                  (0.0D0,0.0D0), (0.0D0,0.0D0), (0.0D0,0.0D0),+     +                  (0.0D0,0.0D0), (0.0D0,0.0D0), (0.0D0,0.0D0),+     +                  (0.7D0,-0.8D0), (0.0D0,0.0D0), (0.0D0,0.0D0),+     +                  (0.0D0,0.0D0), (0.0D0,0.0D0), (0.0D0,0.0D0),+     +                  (0.0D0,0.0D0), (-0.1D0,-0.9D0), (0.7D0,-0.8D0),+     +                  (0.0D0,0.0D0), (0.0D0,0.0D0), (0.0D0,0.0D0),+     +                  (0.0D0,0.0D0), (0.0D0,0.0D0), (-0.6D0,0.6D0),+     +                  (-0.9D0,-0.4D0), (-0.1D0,-0.9D0),+     +                  (0.7D0,-0.8D0), (0.0D0,0.0D0), (0.0D0,0.0D0),+     +                  (0.0D0,0.0D0)/+      DATA              ((CT10Y(I,J,4),I=1,7),J=1,4)/(0.6D0,-0.6D0),+     +                  (0.0D0,0.0D0), (0.0D0,0.0D0), (0.0D0,0.0D0),+     +                  (0.0D0,0.0D0), (0.0D0,0.0D0), (0.0D0,0.0D0),+     +                  (0.7D0,-0.8D0), (0.0D0,0.0D0), (0.0D0,0.0D0),+     +                  (0.0D0,0.0D0), (0.0D0,0.0D0), (0.0D0,0.0D0),+     +                  (0.0D0,0.0D0), (0.7D0,-0.8D0), (-0.9D0,0.5D0),+     +                  (-0.4D0,-0.7D0), (0.0D0,0.0D0), (0.0D0,0.0D0),+     +                  (0.0D0,0.0D0), (0.0D0,0.0D0), (0.7D0,-0.8D0),+     +                  (-0.9D0,0.5D0), (-0.4D0,-0.7D0), (0.1D0,-0.5D0),+     +                  (-0.1D0,-0.9D0), (-0.5D0,-0.3D0),+     +                  (0.2D0,-0.8D0)/+      DATA              CSIZE1/(0.0D0,0.0D0), (0.9D0,0.9D0),+     +                  (1.63D0,1.73D0), (2.90D0,2.78D0)/+      DATA              CSIZE3/(0.0D0,0.0D0), (0.0D0,0.0D0),+     +                  (0.0D0,0.0D0), (0.0D0,0.0D0), (0.0D0,0.0D0),+     +                  (0.0D0,0.0D0), (0.0D0,0.0D0), (1.17D0,1.17D0),+     +                  (1.17D0,1.17D0), (1.17D0,1.17D0),+     +                  (1.17D0,1.17D0), (1.17D0,1.17D0),+     +                  (1.17D0,1.17D0), (1.17D0,1.17D0)/+      DATA              CSIZE2/(0.0D0,0.0D0), (0.0D0,0.0D0),+     +                  (0.0D0,0.0D0), (0.0D0,0.0D0), (0.0D0,0.0D0),+     +                  (0.0D0,0.0D0), (0.0D0,0.0D0), (1.54D0,1.54D0),+     +                  (1.54D0,1.54D0), (1.54D0,1.54D0),+     +                  (1.54D0,1.54D0), (1.54D0,1.54D0),+     +                  (1.54D0,1.54D0), (1.54D0,1.54D0)/+*     .. Executable Statements ..+      DO 60 KI = 1, 4+         INCX = INCXS(KI)+         INCY = INCYS(KI)+         MX = ABS(INCX)+         MY = ABS(INCY)+*+         DO 40 KN = 1, 4+            N = NS(KN)+            KSIZE = MIN(2,KN)+            LENX = LENS(KN,MX)+            LENY = LENS(KN,MY)+*           .. initialize all argument arrays ..+            DO 20 I = 1, 7+               CX(I) = CX1(I)+               CY(I) = CY1(I)+   20       CONTINUE+            IF (ICASE.EQ.1) THEN+*              .. ZDOTC ..+               CDOT(1) = ZDOTC(N,CX,INCX,CY,INCY)+               CALL CTEST(1,CDOT,CT6(KN,KI),CSIZE1(KN),SFAC)+            ELSE IF (ICASE.EQ.2) THEN+*              .. ZDOTU ..+               CDOT(1) = ZDOTU(N,CX,INCX,CY,INCY)+               CALL CTEST(1,CDOT,CT7(KN,KI),CSIZE1(KN),SFAC)+            ELSE IF (ICASE.EQ.3) THEN+*              .. ZAXPY ..+               CALL ZAXPY(N,CA,CX,INCX,CY,INCY)+               CALL CTEST(LENY,CY,CT8(1,KN,KI),CSIZE2(1,KSIZE),SFAC)+            ELSE IF (ICASE.EQ.4) THEN+*              .. ZCOPY ..+               CALL ZCOPY(N,CX,INCX,CY,INCY)+               CALL CTEST(LENY,CY,CT10Y(1,KN,KI),CSIZE3,1.0D0)+            ELSE IF (ICASE.EQ.5) THEN+*              .. ZSWAP ..+               CALL ZSWAP(N,CX,INCX,CY,INCY)+               CALL CTEST(LENX,CX,CT10X(1,KN,KI),CSIZE3,1.0D0)+               CALL CTEST(LENY,CY,CT10Y(1,KN,KI),CSIZE3,1.0D0)+            ELSE+               WRITE (NOUT,*) ' Shouldn''t be here in CHECK2'+               STOP+            END IF+*+   40    CONTINUE+   60 CONTINUE+      RETURN+      END+      SUBROUTINE STEST(LEN,SCOMP,STRUE,SSIZE,SFAC)+*     ********************************* STEST **************************+*+*     THIS SUBR COMPARES ARRAYS  SCOMP() AND STRUE() OF LENGTH LEN TO+*     SEE IF THE TERM BY TERM DIFFERENCES, MULTIPLIED BY SFAC, ARE+*     NEGLIGIBLE.+*+*     C. L. LAWSON, JPL, 1974 DEC 10+*+*     .. Parameters ..+      INTEGER          NOUT+      DOUBLE PRECISION ZERO+      PARAMETER        (NOUT=6, ZERO=0.0D0)+*     .. Scalar Arguments ..+      DOUBLE PRECISION SFAC+      INTEGER          LEN+*     .. Array Arguments ..+      DOUBLE PRECISION SCOMP(LEN), SSIZE(LEN), STRUE(LEN)+*     .. Scalars in Common ..+      INTEGER          ICASE, INCX, INCY, MODE, N+      LOGICAL          PASS+*     .. Local Scalars ..+      DOUBLE PRECISION SD+      INTEGER          I+*     .. External Functions ..+      DOUBLE PRECISION SDIFF+      EXTERNAL         SDIFF+*     .. Intrinsic Functions ..+      INTRINSIC        ABS+*     .. Common blocks ..+      COMMON           /COMBLA/ICASE, N, INCX, INCY, MODE, PASS+*     .. Executable Statements ..+*+      DO 40 I = 1, LEN+         SD = SCOMP(I) - STRUE(I)+         IF (ABS(SFAC*SD) .LE. ABS(SSIZE(I))*EPSILON(ZERO))+     +       GO TO 40+*+*                             HERE    SCOMP(I) IS NOT CLOSE TO STRUE(I).+*+         IF ( .NOT. PASS) GO TO 20+*                             PRINT FAIL MESSAGE AND HEADER.+         PASS = .FALSE.+         WRITE (NOUT,99999)+         WRITE (NOUT,99998)+   20    WRITE (NOUT,99997) ICASE, N, INCX, INCY, MODE, I, SCOMP(I),+     +     STRUE(I), SD, SSIZE(I)+   40 CONTINUE+      RETURN+*+99999 FORMAT ('                                       FAIL')+99998 FORMAT (/' CASE  N INCX INCY MODE  I                            ',+     +       ' COMP(I)                             TRUE(I)  DIFFERENCE',+     +       '     SIZE(I)',/1X)+99997 FORMAT (1X,I4,I3,3I5,I3,2D36.8,2D12.4)+      END+      SUBROUTINE STEST1(SCOMP1,STRUE1,SSIZE,SFAC)+*     ************************* STEST1 *****************************+*+*     THIS IS AN INTERFACE SUBROUTINE TO ACCOMODATE THE FORTRAN+*     REQUIREMENT THAT WHEN A DUMMY ARGUMENT IS AN ARRAY, THE+*     ACTUAL ARGUMENT MUST ALSO BE AN ARRAY OR AN ARRAY ELEMENT.+*+*     C.L. LAWSON, JPL, 1978 DEC 6+*+*     .. Scalar Arguments ..+      DOUBLE PRECISION  SCOMP1, SFAC, STRUE1+*     .. Array Arguments ..+      DOUBLE PRECISION  SSIZE(*)+*     .. Local Arrays ..+      DOUBLE PRECISION  SCOMP(1), STRUE(1)+*     .. External Subroutines ..+      EXTERNAL          STEST+*     .. Executable Statements ..+*+      SCOMP(1) = SCOMP1+      STRUE(1) = STRUE1+      CALL STEST(1,SCOMP,STRUE,SSIZE,SFAC)+*+      RETURN+      END+      DOUBLE PRECISION FUNCTION SDIFF(SA,SB)+*     ********************************* SDIFF **************************+*     COMPUTES DIFFERENCE OF TWO NUMBERS.  C. L. LAWSON, JPL 1974 FEB 15+*+*     .. Scalar Arguments ..+      DOUBLE PRECISION                SA, SB+*     .. Executable Statements ..+      SDIFF = SA - SB+      RETURN+      END+      SUBROUTINE CTEST(LEN,CCOMP,CTRUE,CSIZE,SFAC)+*     **************************** CTEST *****************************+*+*     C.L. LAWSON, JPL, 1978 DEC 6+*+*     .. Scalar Arguments ..+      DOUBLE PRECISION SFAC+      INTEGER          LEN+*     .. Array Arguments ..+      COMPLEX*16       CCOMP(LEN), CSIZE(LEN), CTRUE(LEN)+*     .. Local Scalars ..+      INTEGER          I+*     .. Local Arrays ..+      DOUBLE PRECISION SCOMP(20), SSIZE(20), STRUE(20)+*     .. External Subroutines ..+      EXTERNAL         STEST+*     .. Intrinsic Functions ..+      INTRINSIC        DIMAG, DBLE+*     .. Executable Statements ..+      DO 20 I = 1, LEN+         SCOMP(2*I-1) = DBLE(CCOMP(I))+         SCOMP(2*I) = DIMAG(CCOMP(I))+         STRUE(2*I-1) = DBLE(CTRUE(I))+         STRUE(2*I) = DIMAG(CTRUE(I))+         SSIZE(2*I-1) = DBLE(CSIZE(I))+         SSIZE(2*I) = DIMAG(CSIZE(I))+   20 CONTINUE+*+      CALL STEST(2*LEN,SCOMP,STRUE,SSIZE,SFAC)+      RETURN+      END+      SUBROUTINE ITEST1(ICOMP,ITRUE)+*     ********************************* ITEST1 *************************+*+*     THIS SUBROUTINE COMPARES THE VARIABLES ICOMP AND ITRUE FOR+*     EQUALITY.+*     C. L. LAWSON, JPL, 1974 DEC 10+*+*     .. Parameters ..+      INTEGER           NOUT+      PARAMETER         (NOUT=6)+*     .. Scalar Arguments ..+      INTEGER           ICOMP, ITRUE+*     .. Scalars in Common ..+      INTEGER           ICASE, INCX, INCY, MODE, N+      LOGICAL           PASS+*     .. Local Scalars ..+      INTEGER           ID+*     .. Common blocks ..+      COMMON            /COMBLA/ICASE, N, INCX, INCY, MODE, PASS+*     .. Executable Statements ..+      IF (ICOMP.EQ.ITRUE) GO TO 40+*+*                            HERE ICOMP IS NOT EQUAL TO ITRUE.+*+      IF ( .NOT. PASS) GO TO 20+*                             PRINT FAIL MESSAGE AND HEADER.+      PASS = .FALSE.+      WRITE (NOUT,99999)+      WRITE (NOUT,99998)+   20 ID = ICOMP - ITRUE+      WRITE (NOUT,99997) ICASE, N, INCX, INCY, MODE, ICOMP, ITRUE, ID+   40 CONTINUE+      RETURN+*+99999 FORMAT ('                                       FAIL')+99998 FORMAT (/' CASE  N INCX INCY MODE                               ',+     +       ' COMP                                TRUE     DIFFERENCE',+     +       /1X)+99997 FORMAT (1X,I4,I3,3I5,2I36,I12)+      END
+ eigen3/blas/testing/zblat2.dat view
@@ -0,0 +1,35 @@+'zblat2.summ'     NAME OF SUMMARY OUTPUT FILE+6                 UNIT NUMBER OF SUMMARY FILE+'cbla2t.snap'     NAME OF SNAPSHOT OUTPUT FILE+-1                UNIT NUMBER OF SNAPSHOT FILE (NOT USED IF .LT. 0)+F        LOGICAL FLAG, T TO REWIND SNAPSHOT FILE AFTER EACH RECORD.+F        LOGICAL FLAG, T TO STOP ON FAILURES.+T        LOGICAL FLAG, T TO TEST ERROR EXITS.+16.0     THRESHOLD VALUE OF TEST RATIO+6                 NUMBER OF VALUES OF N+0 1 2 3 5 9       VALUES OF N+4                 NUMBER OF VALUES OF K+0 1 2 4           VALUES OF K+4                 NUMBER OF VALUES OF INCX AND INCY+1 2 -1 -2         VALUES OF INCX AND INCY+3                 NUMBER OF VALUES OF ALPHA+(0.0,0.0) (1.0,0.0) (0.7,-0.9)       VALUES OF ALPHA+3                 NUMBER OF VALUES OF BETA+(0.0,0.0) (1.0,0.0) (1.3,-1.1)       VALUES OF BETA+ZGEMV  T PUT F FOR NO TEST. SAME COLUMNS.+ZGBMV  T PUT F FOR NO TEST. SAME COLUMNS.+ZHEMV  T PUT F FOR NO TEST. SAME COLUMNS.+ZHBMV  T PUT F FOR NO TEST. SAME COLUMNS.+ZHPMV  T PUT F FOR NO TEST. SAME COLUMNS.+ZTRMV  T PUT F FOR NO TEST. SAME COLUMNS.+ZTBMV  T PUT F FOR NO TEST. SAME COLUMNS.+ZTPMV  T PUT F FOR NO TEST. SAME COLUMNS.+ZTRSV  T PUT F FOR NO TEST. SAME COLUMNS.+ZTBSV  T PUT F FOR NO TEST. SAME COLUMNS.+ZTPSV  T PUT F FOR NO TEST. SAME COLUMNS.+ZGERC  T PUT F FOR NO TEST. SAME COLUMNS.+ZGERU  T PUT F FOR NO TEST. SAME COLUMNS.+ZHER   T PUT F FOR NO TEST. SAME COLUMNS.+ZHPR   T PUT F FOR NO TEST. SAME COLUMNS.+ZHER2  T PUT F FOR NO TEST. SAME COLUMNS.+ZHPR2  T PUT F FOR NO TEST. SAME COLUMNS.
+ eigen3/blas/testing/zblat2.f view
@@ -0,0 +1,3287 @@+*> \brief \b ZBLAT2+*+*  =========== DOCUMENTATION ===========+*+* Online html documentation available at +*            http://www.netlib.org/lapack/explore-html/ +*+*  Definition:+*  ===========+*+*       PROGRAM ZBLAT2+* +*+*> \par Purpose:+*  =============+*>+*> \verbatim+*>+*> Test program for the COMPLEX*16       Level 2 Blas.+*>+*> The program must be driven by a short data file. The first 18 records+*> of the file are read using list-directed input, the last 17 records+*> are read using the format ( A6, L2 ). An annotated example of a data+*> file can be obtained by deleting the first 3 characters from the+*> following 35 lines:+*> 'zblat2.out'      NAME OF SUMMARY OUTPUT FILE+*> 6                 UNIT NUMBER OF SUMMARY FILE+*> 'CBLA2T.SNAP'     NAME OF SNAPSHOT OUTPUT FILE+*> -1                UNIT NUMBER OF SNAPSHOT FILE (NOT USED IF .LT. 0)+*> F        LOGICAL FLAG, T TO REWIND SNAPSHOT FILE AFTER EACH RECORD.+*> F        LOGICAL FLAG, T TO STOP ON FAILURES.+*> T        LOGICAL FLAG, T TO TEST ERROR EXITS.+*> 16.0     THRESHOLD VALUE OF TEST RATIO+*> 6                 NUMBER OF VALUES OF N+*> 0 1 2 3 5 9       VALUES OF N+*> 4                 NUMBER OF VALUES OF K+*> 0 1 2 4           VALUES OF K+*> 4                 NUMBER OF VALUES OF INCX AND INCY+*> 1 2 -1 -2         VALUES OF INCX AND INCY+*> 3                 NUMBER OF VALUES OF ALPHA+*> (0.0,0.0) (1.0,0.0) (0.7,-0.9)       VALUES OF ALPHA+*> 3                 NUMBER OF VALUES OF BETA+*> (0.0,0.0) (1.0,0.0) (1.3,-1.1)       VALUES OF BETA+*> ZGEMV  T PUT F FOR NO TEST. SAME COLUMNS.+*> ZGBMV  T PUT F FOR NO TEST. SAME COLUMNS.+*> ZHEMV  T PUT F FOR NO TEST. SAME COLUMNS.+*> ZHBMV  T PUT F FOR NO TEST. SAME COLUMNS.+*> ZHPMV  T PUT F FOR NO TEST. SAME COLUMNS.+*> ZTRMV  T PUT F FOR NO TEST. SAME COLUMNS.+*> ZTBMV  T PUT F FOR NO TEST. SAME COLUMNS.+*> ZTPMV  T PUT F FOR NO TEST. SAME COLUMNS.+*> ZTRSV  T PUT F FOR NO TEST. SAME COLUMNS.+*> ZTBSV  T PUT F FOR NO TEST. SAME COLUMNS.+*> ZTPSV  T PUT F FOR NO TEST. SAME COLUMNS.+*> ZGERC  T PUT F FOR NO TEST. SAME COLUMNS.+*> ZGERU  T PUT F FOR NO TEST. SAME COLUMNS.+*> ZHER   T PUT F FOR NO TEST. SAME COLUMNS.+*> ZHPR   T PUT F FOR NO TEST. SAME COLUMNS.+*> ZHER2  T PUT F FOR NO TEST. SAME COLUMNS.+*> ZHPR2  T PUT F FOR NO TEST. SAME COLUMNS.+*>+*> Further Details+*> ===============+*>+*>    See:+*>+*>       Dongarra J. J., Du Croz J. J., Hammarling S.  and Hanson R. J..+*>       An  extended  set of Fortran  Basic Linear Algebra Subprograms.+*>+*>       Technical  Memoranda  Nos. 41 (revision 3) and 81,  Mathematics+*>       and  Computer Science  Division,  Argonne  National Laboratory,+*>       9700 South Cass Avenue, Argonne, Illinois 60439, US.+*>+*>       Or+*>+*>       NAG  Technical Reports TR3/87 and TR4/87,  Numerical Algorithms+*>       Group  Ltd.,  NAG  Central  Office,  256  Banbury  Road, Oxford+*>       OX2 7DE, UK,  and  Numerical Algorithms Group Inc.,  1101  31st+*>       Street,  Suite 100,  Downers Grove,  Illinois 60515-1263,  USA.+*>+*>+*> -- Written on 10-August-1987.+*>    Richard Hanson, Sandia National Labs.+*>    Jeremy Du Croz, NAG Central Office.+*>+*>    10-9-00:  Change STATUS='NEW' to 'UNKNOWN' so that the testers+*>              can be run multiple times without deleting generated+*>              output files (susan)+*> \endverbatim+*+*  Authors:+*  ========+*+*> \author Univ. of Tennessee +*> \author Univ. of California Berkeley +*> \author Univ. of Colorado Denver +*> \author NAG Ltd. +*+*> \date April 2012+*+*> \ingroup complex16_blas_testing+*+*  =====================================================================+      PROGRAM ZBLAT2+*+*  -- Reference BLAS test routine (version 3.4.1) --+*  -- Reference BLAS is a software package provided by Univ. of Tennessee,    --+*  -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--+*     April 2012+*+*  =====================================================================+*+*     .. Parameters ..+      INTEGER            NIN+      PARAMETER          ( NIN = 5 )+      INTEGER            NSUBS+      PARAMETER          ( NSUBS = 17 )+      COMPLEX*16         ZERO, ONE+      PARAMETER          ( ZERO = ( 0.0D0, 0.0D0 ),+     $                   ONE = ( 1.0D0, 0.0D0 ) )+      DOUBLE PRECISION   RZERO+      PARAMETER          ( RZERO = 0.0D0 )+      INTEGER            NMAX, INCMAX+      PARAMETER          ( NMAX = 65, INCMAX = 2 )+      INTEGER            NINMAX, NIDMAX, NKBMAX, NALMAX, NBEMAX+      PARAMETER          ( NINMAX = 7, NIDMAX = 9, NKBMAX = 7,+     $                   NALMAX = 7, NBEMAX = 7 )+*     .. Local Scalars ..+      DOUBLE PRECISION   EPS, ERR, THRESH+      INTEGER            I, ISNUM, J, N, NALF, NBET, NIDIM, NINC, NKB,+     $                   NOUT, NTRA+      LOGICAL            FATAL, LTESTT, REWI, SAME, SFATAL, TRACE,+     $                   TSTERR+      CHARACTER*1        TRANS+      CHARACTER*6        SNAMET+      CHARACTER*32       SNAPS, SUMMRY+*     .. Local Arrays ..+      COMPLEX*16         A( NMAX, NMAX ), AA( NMAX*NMAX ),+     $                   ALF( NALMAX ), AS( NMAX*NMAX ), BET( NBEMAX ),+     $                   X( NMAX ), XS( NMAX*INCMAX ),+     $                   XX( NMAX*INCMAX ), Y( NMAX ),+     $                   YS( NMAX*INCMAX ), YT( NMAX ),+     $                   YY( NMAX*INCMAX ), Z( 2*NMAX )+      DOUBLE PRECISION   G( NMAX )+      INTEGER            IDIM( NIDMAX ), INC( NINMAX ), KB( NKBMAX )+      LOGICAL            LTEST( NSUBS )+      CHARACTER*6        SNAMES( NSUBS )+*     .. External Functions ..+      DOUBLE PRECISION   DDIFF+      LOGICAL            LZE+      EXTERNAL           DDIFF, LZE+*     .. External Subroutines ..+      EXTERNAL           ZCHK1, ZCHK2, ZCHK3, ZCHK4, ZCHK5, ZCHK6,+     $                   ZCHKE, ZMVCH+*     .. Intrinsic Functions ..+      INTRINSIC          ABS, MAX, MIN+*     .. Scalars in Common ..+      INTEGER            INFOT, NOUTC+      LOGICAL            LERR, OK+      CHARACTER*6        SRNAMT+*     .. Common blocks ..+      COMMON             /INFOC/INFOT, NOUTC, OK, LERR+      COMMON             /SRNAMC/SRNAMT+*     .. Data statements ..+      DATA               SNAMES/'ZGEMV ', 'ZGBMV ', 'ZHEMV ', 'ZHBMV ',+     $                   'ZHPMV ', 'ZTRMV ', 'ZTBMV ', 'ZTPMV ',+     $                   'ZTRSV ', 'ZTBSV ', 'ZTPSV ', 'ZGERC ',+     $                   'ZGERU ', 'ZHER  ', 'ZHPR  ', 'ZHER2 ',+     $                   'ZHPR2 '/+*     .. Executable Statements ..+*+*     Read name and unit number for summary output file and open file.+*+      READ( NIN, FMT = * )SUMMRY+      READ( NIN, FMT = * )NOUT+      OPEN( NOUT, FILE = SUMMRY, STATUS = 'UNKNOWN' )+      NOUTC = NOUT+*+*     Read name and unit number for snapshot output file and open file.+*+      READ( NIN, FMT = * )SNAPS+      READ( NIN, FMT = * )NTRA+      TRACE = NTRA.GE.0+      IF( TRACE )THEN+         OPEN( NTRA, FILE = SNAPS, STATUS = 'UNKNOWN' )+      END IF+*     Read the flag that directs rewinding of the snapshot file.+      READ( NIN, FMT = * )REWI+      REWI = REWI.AND.TRACE+*     Read the flag that directs stopping on any failure.+      READ( NIN, FMT = * )SFATAL+*     Read the flag that indicates whether error exits are to be tested.+      READ( NIN, FMT = * )TSTERR+*     Read the threshold value of the test ratio+      READ( NIN, FMT = * )THRESH+*+*     Read and check the parameter values for the tests.+*+*     Values of N+      READ( NIN, FMT = * )NIDIM+      IF( NIDIM.LT.1.OR.NIDIM.GT.NIDMAX )THEN+         WRITE( NOUT, FMT = 9997 )'N', NIDMAX+         GO TO 230+      END IF+      READ( NIN, FMT = * )( IDIM( I ), I = 1, NIDIM )+      DO 10 I = 1, NIDIM+         IF( IDIM( I ).LT.0.OR.IDIM( I ).GT.NMAX )THEN+            WRITE( NOUT, FMT = 9996 )NMAX+            GO TO 230+         END IF+   10 CONTINUE+*     Values of K+      READ( NIN, FMT = * )NKB+      IF( NKB.LT.1.OR.NKB.GT.NKBMAX )THEN+         WRITE( NOUT, FMT = 9997 )'K', NKBMAX+         GO TO 230+      END IF+      READ( NIN, FMT = * )( KB( I ), I = 1, NKB )+      DO 20 I = 1, NKB+         IF( KB( I ).LT.0 )THEN+            WRITE( NOUT, FMT = 9995 )+            GO TO 230+         END IF+   20 CONTINUE+*     Values of INCX and INCY+      READ( NIN, FMT = * )NINC+      IF( NINC.LT.1.OR.NINC.GT.NINMAX )THEN+         WRITE( NOUT, FMT = 9997 )'INCX AND INCY', NINMAX+         GO TO 230+      END IF+      READ( NIN, FMT = * )( INC( I ), I = 1, NINC )+      DO 30 I = 1, NINC+         IF( INC( I ).EQ.0.OR.ABS( INC( I ) ).GT.INCMAX )THEN+            WRITE( NOUT, FMT = 9994 )INCMAX+            GO TO 230+         END IF+   30 CONTINUE+*     Values of ALPHA+      READ( NIN, FMT = * )NALF+      IF( NALF.LT.1.OR.NALF.GT.NALMAX )THEN+         WRITE( NOUT, FMT = 9997 )'ALPHA', NALMAX+         GO TO 230+      END IF+      READ( NIN, FMT = * )( ALF( I ), I = 1, NALF )+*     Values of BETA+      READ( NIN, FMT = * )NBET+      IF( NBET.LT.1.OR.NBET.GT.NBEMAX )THEN+         WRITE( NOUT, FMT = 9997 )'BETA', NBEMAX+         GO TO 230+      END IF+      READ( NIN, FMT = * )( BET( I ), I = 1, NBET )+*+*     Report values of parameters.+*+      WRITE( NOUT, FMT = 9993 )+      WRITE( NOUT, FMT = 9992 )( IDIM( I ), I = 1, NIDIM )+      WRITE( NOUT, FMT = 9991 )( KB( I ), I = 1, NKB )+      WRITE( NOUT, FMT = 9990 )( INC( I ), I = 1, NINC )+      WRITE( NOUT, FMT = 9989 )( ALF( I ), I = 1, NALF )+      WRITE( NOUT, FMT = 9988 )( BET( I ), I = 1, NBET )+      IF( .NOT.TSTERR )THEN+         WRITE( NOUT, FMT = * )+         WRITE( NOUT, FMT = 9980 )+      END IF+      WRITE( NOUT, FMT = * )+      WRITE( NOUT, FMT = 9999 )THRESH+      WRITE( NOUT, FMT = * )+*+*     Read names of subroutines and flags which indicate+*     whether they are to be tested.+*+      DO 40 I = 1, NSUBS+         LTEST( I ) = .FALSE.+   40 CONTINUE+   50 READ( NIN, FMT = 9984, END = 80 )SNAMET, LTESTT+      DO 60 I = 1, NSUBS+         IF( SNAMET.EQ.SNAMES( I ) )+     $      GO TO 70+   60 CONTINUE+      WRITE( NOUT, FMT = 9986 )SNAMET+      STOP+   70 LTEST( I ) = LTESTT+      GO TO 50+*+   80 CONTINUE+      CLOSE ( NIN )+*+*     Compute EPS (the machine precision).+*+      EPS = EPSILON(RZERO)+      WRITE( NOUT, FMT = 9998 )EPS+*+*     Check the reliability of ZMVCH using exact data.+*+      N = MIN( 32, NMAX )+      DO 120 J = 1, N+         DO 110 I = 1, N+            A( I, J ) = MAX( I - J + 1, 0 )+  110    CONTINUE+         X( J ) = J+         Y( J ) = ZERO+  120 CONTINUE+      DO 130 J = 1, N+         YY( J ) = J*( ( J + 1 )*J )/2 - ( ( J + 1 )*J*( J - 1 ) )/3+  130 CONTINUE+*     YY holds the exact result. On exit from ZMVCH YT holds+*     the result computed by ZMVCH.+      TRANS = 'N'+      CALL ZMVCH( TRANS, N, N, ONE, A, NMAX, X, 1, ZERO, Y, 1, YT, G,+     $            YY, EPS, ERR, FATAL, NOUT, .TRUE. )+      SAME = LZE( YY, YT, N )+      IF( .NOT.SAME.OR.ERR.NE.RZERO )THEN+         WRITE( NOUT, FMT = 9985 )TRANS, SAME, ERR+         STOP+      END IF+      TRANS = 'T'+      CALL ZMVCH( TRANS, N, N, ONE, A, NMAX, X, -1, ZERO, Y, -1, YT, G,+     $            YY, EPS, ERR, FATAL, NOUT, .TRUE. )+      SAME = LZE( YY, YT, N )+      IF( .NOT.SAME.OR.ERR.NE.RZERO )THEN+         WRITE( NOUT, FMT = 9985 )TRANS, SAME, ERR+         STOP+      END IF+*+*     Test each subroutine in turn.+*+      DO 210 ISNUM = 1, NSUBS+         WRITE( NOUT, FMT = * )+         IF( .NOT.LTEST( ISNUM ) )THEN+*           Subprogram is not to be tested.+            WRITE( NOUT, FMT = 9983 )SNAMES( ISNUM )+         ELSE+            SRNAMT = SNAMES( ISNUM )+*           Test error exits.+            IF( TSTERR )THEN+               CALL ZCHKE( ISNUM, SNAMES( ISNUM ), NOUT )+               WRITE( NOUT, FMT = * )+            END IF+*           Test computations.+            INFOT = 0+            OK = .TRUE.+            FATAL = .FALSE.+            GO TO ( 140, 140, 150, 150, 150, 160, 160,+     $              160, 160, 160, 160, 170, 170, 180,+     $              180, 190, 190 )ISNUM+*           Test ZGEMV, 01, and ZGBMV, 02.+  140       CALL ZCHK1( SNAMES( ISNUM ), EPS, THRESH, NOUT, NTRA, TRACE,+     $                  REWI, FATAL, NIDIM, IDIM, NKB, KB, NALF, ALF,+     $                  NBET, BET, NINC, INC, NMAX, INCMAX, A, AA, AS,+     $                  X, XX, XS, Y, YY, YS, YT, G )+            GO TO 200+*           Test ZHEMV, 03, ZHBMV, 04, and ZHPMV, 05.+  150       CALL ZCHK2( SNAMES( ISNUM ), EPS, THRESH, NOUT, NTRA, TRACE,+     $                  REWI, FATAL, NIDIM, IDIM, NKB, KB, NALF, ALF,+     $                  NBET, BET, NINC, INC, NMAX, INCMAX, A, AA, AS,+     $                  X, XX, XS, Y, YY, YS, YT, G )+            GO TO 200+*           Test ZTRMV, 06, ZTBMV, 07, ZTPMV, 08,+*           ZTRSV, 09, ZTBSV, 10, and ZTPSV, 11.+  160       CALL ZCHK3( SNAMES( ISNUM ), EPS, THRESH, NOUT, NTRA, TRACE,+     $                  REWI, FATAL, NIDIM, IDIM, NKB, KB, NINC, INC,+     $                  NMAX, INCMAX, A, AA, AS, Y, YY, YS, YT, G, Z )+            GO TO 200+*           Test ZGERC, 12, ZGERU, 13.+  170       CALL ZCHK4( SNAMES( ISNUM ), EPS, THRESH, NOUT, NTRA, TRACE,+     $                  REWI, FATAL, NIDIM, IDIM, NALF, ALF, NINC, INC,+     $                  NMAX, INCMAX, A, AA, AS, X, XX, XS, Y, YY, YS,+     $                  YT, G, Z )+            GO TO 200+*           Test ZHER, 14, and ZHPR, 15.+  180       CALL ZCHK5( SNAMES( ISNUM ), EPS, THRESH, NOUT, NTRA, TRACE,+     $                  REWI, FATAL, NIDIM, IDIM, NALF, ALF, NINC, INC,+     $                  NMAX, INCMAX, A, AA, AS, X, XX, XS, Y, YY, YS,+     $                  YT, G, Z )+            GO TO 200+*           Test ZHER2, 16, and ZHPR2, 17.+  190       CALL ZCHK6( SNAMES( ISNUM ), EPS, THRESH, NOUT, NTRA, TRACE,+     $                  REWI, FATAL, NIDIM, IDIM, NALF, ALF, NINC, INC,+     $                  NMAX, INCMAX, A, AA, AS, X, XX, XS, Y, YY, YS,+     $                  YT, G, Z )+*+  200       IF( FATAL.AND.SFATAL )+     $         GO TO 220+         END IF+  210 CONTINUE+      WRITE( NOUT, FMT = 9982 )+      GO TO 240+*+  220 CONTINUE+      WRITE( NOUT, FMT = 9981 )+      GO TO 240+*+  230 CONTINUE+      WRITE( NOUT, FMT = 9987 )+*+  240 CONTINUE+      IF( TRACE )+     $   CLOSE ( NTRA )+      CLOSE ( NOUT )+      STOP+*+ 9999 FORMAT( ' ROUTINES PASS COMPUTATIONAL TESTS IF TEST RATIO IS LES',+     $      'S THAN', F8.2 )+ 9998 FORMAT( ' RELATIVE MACHINE PRECISION IS TAKEN TO BE', 1P, D9.1 )+ 9997 FORMAT( ' NUMBER OF VALUES OF ', A, ' IS LESS THAN 1 OR GREATER ',+     $      'THAN ', I2 )+ 9996 FORMAT( ' VALUE OF N IS LESS THAN 0 OR GREATER THAN ', I2 )+ 9995 FORMAT( ' VALUE OF K IS LESS THAN 0' )+ 9994 FORMAT( ' ABSOLUTE VALUE OF INCX OR INCY IS 0 OR GREATER THAN ',+     $      I2 )+ 9993 FORMAT( ' TESTS OF THE COMPLEX*16       LEVEL 2 BLAS', //' THE F',+     $      'OLLOWING PARAMETER VALUES WILL BE USED:' )+ 9992 FORMAT( '   FOR N              ', 9I6 )+ 9991 FORMAT( '   FOR K              ', 7I6 )+ 9990 FORMAT( '   FOR INCX AND INCY  ', 7I6 )+ 9989 FORMAT( '   FOR ALPHA          ',+     $      7( '(', F4.1, ',', F4.1, ')  ', : ) )+ 9988 FORMAT( '   FOR BETA           ',+     $      7( '(', F4.1, ',', F4.1, ')  ', : ) )+ 9987 FORMAT( ' AMEND DATA FILE OR INCREASE ARRAY SIZES IN PROGRAM',+     $      /' ******* TESTS ABANDONED *******' )+ 9986 FORMAT( ' SUBPROGRAM NAME ', A6, ' NOT RECOGNIZED', /' ******* T',+     $      'ESTS ABANDONED *******' )+ 9985 FORMAT( ' ERROR IN ZMVCH -  IN-LINE DOT PRODUCTS ARE BEING EVALU',+     $      'ATED WRONGLY.', /' ZMVCH WAS CALLED WITH TRANS = ', A1,+     $      ' AND RETURNED SAME = ', L1, ' AND ERR = ', F12.3, '.', /+     $   ' THIS MAY BE DUE TO FAULTS IN THE ARITHMETIC OR THE COMPILER.'+     $      , /' ******* TESTS ABANDONED *******' )+ 9984 FORMAT( A6, L2 )+ 9983 FORMAT( 1X, A6, ' WAS NOT TESTED' )+ 9982 FORMAT( /' END OF TESTS' )+ 9981 FORMAT( /' ******* FATAL ERROR - TESTS ABANDONED *******' )+ 9980 FORMAT( ' ERROR-EXITS WILL NOT BE TESTED' )+*+*     End of ZBLAT2.+*+      END+      SUBROUTINE ZCHK1( SNAME, EPS, THRESH, NOUT, NTRA, TRACE, REWI,+     $                  FATAL, NIDIM, IDIM, NKB, KB, NALF, ALF, NBET,+     $                  BET, NINC, INC, NMAX, INCMAX, A, AA, AS, X, XX,+     $                  XS, Y, YY, YS, YT, G )+*+*  Tests ZGEMV and ZGBMV.+*+*  Auxiliary routine for test program for Level 2 Blas.+*+*  -- Written on 10-August-1987.+*     Richard Hanson, Sandia National Labs.+*     Jeremy Du Croz, NAG Central Office.+*+*     .. Parameters ..+      COMPLEX*16         ZERO, HALF+      PARAMETER          ( ZERO = ( 0.0D0, 0.0D0 ),+     $                   HALF = ( 0.5D0, 0.0D0 ) )+      DOUBLE PRECISION   RZERO+      PARAMETER          ( RZERO = 0.0D0 )+*     .. Scalar Arguments ..+      DOUBLE PRECISION   EPS, THRESH+      INTEGER            INCMAX, NALF, NBET, NIDIM, NINC, NKB, NMAX,+     $                   NOUT, NTRA+      LOGICAL            FATAL, REWI, TRACE+      CHARACTER*6        SNAME+*     .. Array Arguments ..+      COMPLEX*16         A( NMAX, NMAX ), AA( NMAX*NMAX ), ALF( NALF ),+     $                   AS( NMAX*NMAX ), BET( NBET ), X( NMAX ),+     $                   XS( NMAX*INCMAX ), XX( NMAX*INCMAX ),+     $                   Y( NMAX ), YS( NMAX*INCMAX ), YT( NMAX ),+     $                   YY( NMAX*INCMAX )+      DOUBLE PRECISION   G( NMAX )+      INTEGER            IDIM( NIDIM ), INC( NINC ), KB( NKB )+*     .. Local Scalars ..+      COMPLEX*16         ALPHA, ALS, BETA, BLS, TRANSL+      DOUBLE PRECISION   ERR, ERRMAX+      INTEGER            I, IA, IB, IC, IKU, IM, IN, INCX, INCXS, INCY,+     $                   INCYS, IX, IY, KL, KLS, KU, KUS, LAA, LDA,+     $                   LDAS, LX, LY, M, ML, MS, N, NARGS, NC, ND, NK,+     $                   NL, NS+      LOGICAL            BANDED, FULL, NULL, RESET, SAME, TRAN+      CHARACTER*1        TRANS, TRANSS+      CHARACTER*3        ICH+*     .. Local Arrays ..+      LOGICAL            ISAME( 13 )+*     .. External Functions ..+      LOGICAL            LZE, LZERES+      EXTERNAL           LZE, LZERES+*     .. External Subroutines ..+      EXTERNAL           ZGBMV, ZGEMV, ZMAKE, ZMVCH+*     .. Intrinsic Functions ..+      INTRINSIC          ABS, MAX, MIN+*     .. Scalars in Common ..+      INTEGER            INFOT, NOUTC+      LOGICAL            LERR, OK+*     .. Common blocks ..+      COMMON             /INFOC/INFOT, NOUTC, OK, LERR+*     .. Data statements ..+      DATA               ICH/'NTC'/+*     .. Executable Statements ..+      FULL = SNAME( 3: 3 ).EQ.'E'+      BANDED = SNAME( 3: 3 ).EQ.'B'+*     Define the number of arguments.+      IF( FULL )THEN+         NARGS = 11+      ELSE IF( BANDED )THEN+         NARGS = 13+      END IF+*+      NC = 0+      RESET = .TRUE.+      ERRMAX = RZERO+*+      DO 120 IN = 1, NIDIM+         N = IDIM( IN )+         ND = N/2 + 1+*+         DO 110 IM = 1, 2+            IF( IM.EQ.1 )+     $         M = MAX( N - ND, 0 )+            IF( IM.EQ.2 )+     $         M = MIN( N + ND, NMAX )+*+            IF( BANDED )THEN+               NK = NKB+            ELSE+               NK = 1+            END IF+            DO 100 IKU = 1, NK+               IF( BANDED )THEN+                  KU = KB( IKU )+                  KL = MAX( KU - 1, 0 )+               ELSE+                  KU = N - 1+                  KL = M - 1+               END IF+*              Set LDA to 1 more than minimum value if room.+               IF( BANDED )THEN+                  LDA = KL + KU + 1+               ELSE+                  LDA = M+               END IF+               IF( LDA.LT.NMAX )+     $            LDA = LDA + 1+*              Skip tests if not enough room.+               IF( LDA.GT.NMAX )+     $            GO TO 100+               LAA = LDA*N+               NULL = N.LE.0.OR.M.LE.0+*+*              Generate the matrix A.+*+               TRANSL = ZERO+               CALL ZMAKE( SNAME( 2: 3 ), ' ', ' ', M, N, A, NMAX, AA,+     $                     LDA, KL, KU, RESET, TRANSL )+*+               DO 90 IC = 1, 3+                  TRANS = ICH( IC: IC )+                  TRAN = TRANS.EQ.'T'.OR.TRANS.EQ.'C'+*+                  IF( TRAN )THEN+                     ML = N+                     NL = M+                  ELSE+                     ML = M+                     NL = N+                  END IF+*+                  DO 80 IX = 1, NINC+                     INCX = INC( IX )+                     LX = ABS( INCX )*NL+*+*                    Generate the vector X.+*+                     TRANSL = HALF+                     CALL ZMAKE( 'GE', ' ', ' ', 1, NL, X, 1, XX,+     $                           ABS( INCX ), 0, NL - 1, RESET, TRANSL )+                     IF( NL.GT.1 )THEN+                        X( NL/2 ) = ZERO+                        XX( 1 + ABS( INCX )*( NL/2 - 1 ) ) = ZERO+                     END IF+*+                     DO 70 IY = 1, NINC+                        INCY = INC( IY )+                        LY = ABS( INCY )*ML+*+                        DO 60 IA = 1, NALF+                           ALPHA = ALF( IA )+*+                           DO 50 IB = 1, NBET+                              BETA = BET( IB )+*+*                             Generate the vector Y.+*+                              TRANSL = ZERO+                              CALL ZMAKE( 'GE', ' ', ' ', 1, ML, Y, 1,+     $                                    YY, ABS( INCY ), 0, ML - 1,+     $                                    RESET, TRANSL )+*+                              NC = NC + 1+*+*                             Save every datum before calling the+*                             subroutine.+*+                              TRANSS = TRANS+                              MS = M+                              NS = N+                              KLS = KL+                              KUS = KU+                              ALS = ALPHA+                              DO 10 I = 1, LAA+                                 AS( I ) = AA( I )+   10                         CONTINUE+                              LDAS = LDA+                              DO 20 I = 1, LX+                                 XS( I ) = XX( I )+   20                         CONTINUE+                              INCXS = INCX+                              BLS = BETA+                              DO 30 I = 1, LY+                                 YS( I ) = YY( I )+   30                         CONTINUE+                              INCYS = INCY+*+*                             Call the subroutine.+*+                              IF( FULL )THEN+                                 IF( TRACE )+     $                              WRITE( NTRA, FMT = 9994 )NC, SNAME,+     $                              TRANS, M, N, ALPHA, LDA, INCX, BETA,+     $                              INCY+                                 IF( REWI )+     $                              REWIND NTRA+                                 CALL ZGEMV( TRANS, M, N, ALPHA, AA,+     $                                       LDA, XX, INCX, BETA, YY,+     $                                       INCY )+                              ELSE IF( BANDED )THEN+                                 IF( TRACE )+     $                              WRITE( NTRA, FMT = 9995 )NC, SNAME,+     $                              TRANS, M, N, KL, KU, ALPHA, LDA,+     $                              INCX, BETA, INCY+                                 IF( REWI )+     $                              REWIND NTRA+                                 CALL ZGBMV( TRANS, M, N, KL, KU, ALPHA,+     $                                       AA, LDA, XX, INCX, BETA,+     $                                       YY, INCY )+                              END IF+*+*                             Check if error-exit was taken incorrectly.+*+                              IF( .NOT.OK )THEN+                                 WRITE( NOUT, FMT = 9993 )+                                 FATAL = .TRUE.+                                 GO TO 130+                              END IF+*+*                             See what data changed inside subroutines.+*+                              ISAME( 1 ) = TRANS.EQ.TRANSS+                              ISAME( 2 ) = MS.EQ.M+                              ISAME( 3 ) = NS.EQ.N+                              IF( FULL )THEN+                                 ISAME( 4 ) = ALS.EQ.ALPHA+                                 ISAME( 5 ) = LZE( AS, AA, LAA )+                                 ISAME( 6 ) = LDAS.EQ.LDA+                                 ISAME( 7 ) = LZE( XS, XX, LX )+                                 ISAME( 8 ) = INCXS.EQ.INCX+                                 ISAME( 9 ) = BLS.EQ.BETA+                                 IF( NULL )THEN+                                    ISAME( 10 ) = LZE( YS, YY, LY )+                                 ELSE+                                    ISAME( 10 ) = LZERES( 'GE', ' ', 1,+     $                                            ML, YS, YY,+     $                                            ABS( INCY ) )+                                 END IF+                                 ISAME( 11 ) = INCYS.EQ.INCY+                              ELSE IF( BANDED )THEN+                                 ISAME( 4 ) = KLS.EQ.KL+                                 ISAME( 5 ) = KUS.EQ.KU+                                 ISAME( 6 ) = ALS.EQ.ALPHA+                                 ISAME( 7 ) = LZE( AS, AA, LAA )+                                 ISAME( 8 ) = LDAS.EQ.LDA+                                 ISAME( 9 ) = LZE( XS, XX, LX )+                                 ISAME( 10 ) = INCXS.EQ.INCX+                                 ISAME( 11 ) = BLS.EQ.BETA+                                 IF( NULL )THEN+                                    ISAME( 12 ) = LZE( YS, YY, LY )+                                 ELSE+                                    ISAME( 12 ) = LZERES( 'GE', ' ', 1,+     $                                            ML, YS, YY,+     $                                            ABS( INCY ) )+                                 END IF+                                 ISAME( 13 ) = INCYS.EQ.INCY+                              END IF+*+*                             If data was incorrectly changed, report+*                             and return.+*+                              SAME = .TRUE.+                              DO 40 I = 1, NARGS+                                 SAME = SAME.AND.ISAME( I )+                                 IF( .NOT.ISAME( I ) )+     $                              WRITE( NOUT, FMT = 9998 )I+   40                         CONTINUE+                              IF( .NOT.SAME )THEN+                                 FATAL = .TRUE.+                                 GO TO 130+                              END IF+*+                              IF( .NOT.NULL )THEN+*+*                                Check the result.+*+                                 CALL ZMVCH( TRANS, M, N, ALPHA, A,+     $                                       NMAX, X, INCX, BETA, Y,+     $                                       INCY, YT, G, YY, EPS, ERR,+     $                                       FATAL, NOUT, .TRUE. )+                                 ERRMAX = MAX( ERRMAX, ERR )+*                                If got really bad answer, report and+*                                return.+                                 IF( FATAL )+     $                              GO TO 130+                              ELSE+*                                Avoid repeating tests with M.le.0 or+*                                N.le.0.+                                 GO TO 110+                              END IF+*+   50                      CONTINUE+*+   60                   CONTINUE+*+   70                CONTINUE+*+   80             CONTINUE+*+   90          CONTINUE+*+  100       CONTINUE+*+  110    CONTINUE+*+  120 CONTINUE+*+*     Report result.+*+      IF( ERRMAX.LT.THRESH )THEN+         WRITE( NOUT, FMT = 9999 )SNAME, NC+      ELSE+         WRITE( NOUT, FMT = 9997 )SNAME, NC, ERRMAX+      END IF+      GO TO 140+*+  130 CONTINUE+      WRITE( NOUT, FMT = 9996 )SNAME+      IF( FULL )THEN+         WRITE( NOUT, FMT = 9994 )NC, SNAME, TRANS, M, N, ALPHA, LDA,+     $      INCX, BETA, INCY+      ELSE IF( BANDED )THEN+         WRITE( NOUT, FMT = 9995 )NC, SNAME, TRANS, M, N, KL, KU,+     $      ALPHA, LDA, INCX, BETA, INCY+      END IF+*+  140 CONTINUE+      RETURN+*+ 9999 FORMAT( ' ', A6, ' PASSED THE COMPUTATIONAL TESTS (', I6, ' CALL',+     $      'S)' )+ 9998 FORMAT( ' ******* FATAL ERROR - PARAMETER NUMBER ', I2, ' WAS CH',+     $      'ANGED INCORRECTLY *******' )+ 9997 FORMAT( ' ', A6, ' COMPLETED THE COMPUTATIONAL TESTS (', I6, ' C',+     $      'ALLS)', /' ******* BUT WITH MAXIMUM TEST RATIO', F8.2,+     $      ' - SUSPECT *******' )+ 9996 FORMAT( ' ******* ', A6, ' FAILED ON CALL NUMBER:' )+ 9995 FORMAT( 1X, I6, ': ', A6, '(''', A1, ''',', 4( I3, ',' ), '(',+     $      F4.1, ',', F4.1, '), A,', I3, ', X,', I2, ',(', F4.1, ',',+     $      F4.1, '), Y,', I2, ') .' )+ 9994 FORMAT( 1X, I6, ': ', A6, '(''', A1, ''',', 2( I3, ',' ), '(',+     $      F4.1, ',', F4.1, '), A,', I3, ', X,', I2, ',(', F4.1, ',',+     $      F4.1, '), Y,', I2, ')         .' )+ 9993 FORMAT( ' ******* FATAL ERROR - ERROR-EXIT TAKEN ON VALID CALL *',+     $      '******' )+*+*     End of ZCHK1.+*+      END+      SUBROUTINE ZCHK2( SNAME, EPS, THRESH, NOUT, NTRA, TRACE, REWI,+     $                  FATAL, NIDIM, IDIM, NKB, KB, NALF, ALF, NBET,+     $                  BET, NINC, INC, NMAX, INCMAX, A, AA, AS, X, XX,+     $                  XS, Y, YY, YS, YT, G )+*+*  Tests ZHEMV, ZHBMV and ZHPMV.+*+*  Auxiliary routine for test program for Level 2 Blas.+*+*  -- Written on 10-August-1987.+*     Richard Hanson, Sandia National Labs.+*     Jeremy Du Croz, NAG Central Office.+*+*     .. Parameters ..+      COMPLEX*16         ZERO, HALF+      PARAMETER          ( ZERO = ( 0.0D0, 0.0D0 ),+     $                   HALF = ( 0.5D0, 0.0D0 ) )+      DOUBLE PRECISION   RZERO+      PARAMETER          ( RZERO = 0.0D0 )+*     .. Scalar Arguments ..+      DOUBLE PRECISION   EPS, THRESH+      INTEGER            INCMAX, NALF, NBET, NIDIM, NINC, NKB, NMAX,+     $                   NOUT, NTRA+      LOGICAL            FATAL, REWI, TRACE+      CHARACTER*6        SNAME+*     .. Array Arguments ..+      COMPLEX*16         A( NMAX, NMAX ), AA( NMAX*NMAX ), ALF( NALF ),+     $                   AS( NMAX*NMAX ), BET( NBET ), X( NMAX ),+     $                   XS( NMAX*INCMAX ), XX( NMAX*INCMAX ),+     $                   Y( NMAX ), YS( NMAX*INCMAX ), YT( NMAX ),+     $                   YY( NMAX*INCMAX )+      DOUBLE PRECISION   G( NMAX )+      INTEGER            IDIM( NIDIM ), INC( NINC ), KB( NKB )+*     .. Local Scalars ..+      COMPLEX*16         ALPHA, ALS, BETA, BLS, TRANSL+      DOUBLE PRECISION   ERR, ERRMAX+      INTEGER            I, IA, IB, IC, IK, IN, INCX, INCXS, INCY,+     $                   INCYS, IX, IY, K, KS, LAA, LDA, LDAS, LX, LY,+     $                   N, NARGS, NC, NK, NS+      LOGICAL            BANDED, FULL, NULL, PACKED, RESET, SAME+      CHARACTER*1        UPLO, UPLOS+      CHARACTER*2        ICH+*     .. Local Arrays ..+      LOGICAL            ISAME( 13 )+*     .. External Functions ..+      LOGICAL            LZE, LZERES+      EXTERNAL           LZE, LZERES+*     .. External Subroutines ..+      EXTERNAL           ZHBMV, ZHEMV, ZHPMV, ZMAKE, ZMVCH+*     .. Intrinsic Functions ..+      INTRINSIC          ABS, MAX+*     .. Scalars in Common ..+      INTEGER            INFOT, NOUTC+      LOGICAL            LERR, OK+*     .. Common blocks ..+      COMMON             /INFOC/INFOT, NOUTC, OK, LERR+*     .. Data statements ..+      DATA               ICH/'UL'/+*     .. Executable Statements ..+      FULL = SNAME( 3: 3 ).EQ.'E'+      BANDED = SNAME( 3: 3 ).EQ.'B'+      PACKED = SNAME( 3: 3 ).EQ.'P'+*     Define the number of arguments.+      IF( FULL )THEN+         NARGS = 10+      ELSE IF( BANDED )THEN+         NARGS = 11+      ELSE IF( PACKED )THEN+         NARGS = 9+      END IF+*+      NC = 0+      RESET = .TRUE.+      ERRMAX = RZERO+*+      DO 110 IN = 1, NIDIM+         N = IDIM( IN )+*+         IF( BANDED )THEN+            NK = NKB+         ELSE+            NK = 1+         END IF+         DO 100 IK = 1, NK+            IF( BANDED )THEN+               K = KB( IK )+            ELSE+               K = N - 1+            END IF+*           Set LDA to 1 more than minimum value if room.+            IF( BANDED )THEN+               LDA = K + 1+            ELSE+               LDA = N+            END IF+            IF( LDA.LT.NMAX )+     $         LDA = LDA + 1+*           Skip tests if not enough room.+            IF( LDA.GT.NMAX )+     $         GO TO 100+            IF( PACKED )THEN+               LAA = ( N*( N + 1 ) )/2+            ELSE+               LAA = LDA*N+            END IF+            NULL = N.LE.0+*+            DO 90 IC = 1, 2+               UPLO = ICH( IC: IC )+*+*              Generate the matrix A.+*+               TRANSL = ZERO+               CALL ZMAKE( SNAME( 2: 3 ), UPLO, ' ', N, N, A, NMAX, AA,+     $                     LDA, K, K, RESET, TRANSL )+*+               DO 80 IX = 1, NINC+                  INCX = INC( IX )+                  LX = ABS( INCX )*N+*+*                 Generate the vector X.+*+                  TRANSL = HALF+                  CALL ZMAKE( 'GE', ' ', ' ', 1, N, X, 1, XX,+     $                        ABS( INCX ), 0, N - 1, RESET, TRANSL )+                  IF( N.GT.1 )THEN+                     X( N/2 ) = ZERO+                     XX( 1 + ABS( INCX )*( N/2 - 1 ) ) = ZERO+                  END IF+*+                  DO 70 IY = 1, NINC+                     INCY = INC( IY )+                     LY = ABS( INCY )*N+*+                     DO 60 IA = 1, NALF+                        ALPHA = ALF( IA )+*+                        DO 50 IB = 1, NBET+                           BETA = BET( IB )+*+*                          Generate the vector Y.+*+                           TRANSL = ZERO+                           CALL ZMAKE( 'GE', ' ', ' ', 1, N, Y, 1, YY,+     $                                 ABS( INCY ), 0, N - 1, RESET,+     $                                 TRANSL )+*+                           NC = NC + 1+*+*                          Save every datum before calling the+*                          subroutine.+*+                           UPLOS = UPLO+                           NS = N+                           KS = K+                           ALS = ALPHA+                           DO 10 I = 1, LAA+                              AS( I ) = AA( I )+   10                      CONTINUE+                           LDAS = LDA+                           DO 20 I = 1, LX+                              XS( I ) = XX( I )+   20                      CONTINUE+                           INCXS = INCX+                           BLS = BETA+                           DO 30 I = 1, LY+                              YS( I ) = YY( I )+   30                      CONTINUE+                           INCYS = INCY+*+*                          Call the subroutine.+*+                           IF( FULL )THEN+                              IF( TRACE )+     $                           WRITE( NTRA, FMT = 9993 )NC, SNAME,+     $                           UPLO, N, ALPHA, LDA, INCX, BETA, INCY+                              IF( REWI )+     $                           REWIND NTRA+                              CALL ZHEMV( UPLO, N, ALPHA, AA, LDA, XX,+     $                                    INCX, BETA, YY, INCY )+                           ELSE IF( BANDED )THEN+                              IF( TRACE )+     $                           WRITE( NTRA, FMT = 9994 )NC, SNAME,+     $                           UPLO, N, K, ALPHA, LDA, INCX, BETA,+     $                           INCY+                              IF( REWI )+     $                           REWIND NTRA+                              CALL ZHBMV( UPLO, N, K, ALPHA, AA, LDA,+     $                                    XX, INCX, BETA, YY, INCY )+                           ELSE IF( PACKED )THEN+                              IF( TRACE )+     $                           WRITE( NTRA, FMT = 9995 )NC, SNAME,+     $                           UPLO, N, ALPHA, INCX, BETA, INCY+                              IF( REWI )+     $                           REWIND NTRA+                              CALL ZHPMV( UPLO, N, ALPHA, AA, XX, INCX,+     $                                    BETA, YY, INCY )+                           END IF+*+*                          Check if error-exit was taken incorrectly.+*+                           IF( .NOT.OK )THEN+                              WRITE( NOUT, FMT = 9992 )+                              FATAL = .TRUE.+                              GO TO 120+                           END IF+*+*                          See what data changed inside subroutines.+*+                           ISAME( 1 ) = UPLO.EQ.UPLOS+                           ISAME( 2 ) = NS.EQ.N+                           IF( FULL )THEN+                              ISAME( 3 ) = ALS.EQ.ALPHA+                              ISAME( 4 ) = LZE( AS, AA, LAA )+                              ISAME( 5 ) = LDAS.EQ.LDA+                              ISAME( 6 ) = LZE( XS, XX, LX )+                              ISAME( 7 ) = INCXS.EQ.INCX+                              ISAME( 8 ) = BLS.EQ.BETA+                              IF( NULL )THEN+                                 ISAME( 9 ) = LZE( YS, YY, LY )+                              ELSE+                                 ISAME( 9 ) = LZERES( 'GE', ' ', 1, N,+     $                                        YS, YY, ABS( INCY ) )+                              END IF+                              ISAME( 10 ) = INCYS.EQ.INCY+                           ELSE IF( BANDED )THEN+                              ISAME( 3 ) = KS.EQ.K+                              ISAME( 4 ) = ALS.EQ.ALPHA+                              ISAME( 5 ) = LZE( AS, AA, LAA )+                              ISAME( 6 ) = LDAS.EQ.LDA+                              ISAME( 7 ) = LZE( XS, XX, LX )+                              ISAME( 8 ) = INCXS.EQ.INCX+                              ISAME( 9 ) = BLS.EQ.BETA+                              IF( NULL )THEN+                                 ISAME( 10 ) = LZE( YS, YY, LY )+                              ELSE+                                 ISAME( 10 ) = LZERES( 'GE', ' ', 1, N,+     $                                         YS, YY, ABS( INCY ) )+                              END IF+                              ISAME( 11 ) = INCYS.EQ.INCY+                           ELSE IF( PACKED )THEN+                              ISAME( 3 ) = ALS.EQ.ALPHA+                              ISAME( 4 ) = LZE( AS, AA, LAA )+                              ISAME( 5 ) = LZE( XS, XX, LX )+                              ISAME( 6 ) = INCXS.EQ.INCX+                              ISAME( 7 ) = BLS.EQ.BETA+                              IF( NULL )THEN+                                 ISAME( 8 ) = LZE( YS, YY, LY )+                              ELSE+                                 ISAME( 8 ) = LZERES( 'GE', ' ', 1, N,+     $                                        YS, YY, ABS( INCY ) )+                              END IF+                              ISAME( 9 ) = INCYS.EQ.INCY+                           END IF+*+*                          If data was incorrectly changed, report and+*                          return.+*+                           SAME = .TRUE.+                           DO 40 I = 1, NARGS+                              SAME = SAME.AND.ISAME( I )+                              IF( .NOT.ISAME( I ) )+     $                           WRITE( NOUT, FMT = 9998 )I+   40                      CONTINUE+                           IF( .NOT.SAME )THEN+                              FATAL = .TRUE.+                              GO TO 120+                           END IF+*+                           IF( .NOT.NULL )THEN+*+*                             Check the result.+*+                              CALL ZMVCH( 'N', N, N, ALPHA, A, NMAX, X,+     $                                    INCX, BETA, Y, INCY, YT, G,+     $                                    YY, EPS, ERR, FATAL, NOUT,+     $                                    .TRUE. )+                              ERRMAX = MAX( ERRMAX, ERR )+*                             If got really bad answer, report and+*                             return.+                              IF( FATAL )+     $                           GO TO 120+                           ELSE+*                             Avoid repeating tests with N.le.0+                              GO TO 110+                           END IF+*+   50                   CONTINUE+*+   60                CONTINUE+*+   70             CONTINUE+*+   80          CONTINUE+*+   90       CONTINUE+*+  100    CONTINUE+*+  110 CONTINUE+*+*     Report result.+*+      IF( ERRMAX.LT.THRESH )THEN+         WRITE( NOUT, FMT = 9999 )SNAME, NC+      ELSE+         WRITE( NOUT, FMT = 9997 )SNAME, NC, ERRMAX+      END IF+      GO TO 130+*+  120 CONTINUE+      WRITE( NOUT, FMT = 9996 )SNAME+      IF( FULL )THEN+         WRITE( NOUT, FMT = 9993 )NC, SNAME, UPLO, N, ALPHA, LDA, INCX,+     $      BETA, INCY+      ELSE IF( BANDED )THEN+         WRITE( NOUT, FMT = 9994 )NC, SNAME, UPLO, N, K, ALPHA, LDA,+     $      INCX, BETA, INCY+      ELSE IF( PACKED )THEN+         WRITE( NOUT, FMT = 9995 )NC, SNAME, UPLO, N, ALPHA, INCX,+     $      BETA, INCY+      END IF+*+  130 CONTINUE+      RETURN+*+ 9999 FORMAT( ' ', A6, ' PASSED THE COMPUTATIONAL TESTS (', I6, ' CALL',+     $      'S)' )+ 9998 FORMAT( ' ******* FATAL ERROR - PARAMETER NUMBER ', I2, ' WAS CH',+     $      'ANGED INCORRECTLY *******' )+ 9997 FORMAT( ' ', A6, ' COMPLETED THE COMPUTATIONAL TESTS (', I6, ' C',+     $      'ALLS)', /' ******* BUT WITH MAXIMUM TEST RATIO', F8.2,+     $      ' - SUSPECT *******' )+ 9996 FORMAT( ' ******* ', A6, ' FAILED ON CALL NUMBER:' )+ 9995 FORMAT( 1X, I6, ': ', A6, '(''', A1, ''',', I3, ',(', F4.1, ',',+     $      F4.1, '), AP, X,', I2, ',(', F4.1, ',', F4.1, '), Y,', I2,+     $      ')                .' )+ 9994 FORMAT( 1X, I6, ': ', A6, '(''', A1, ''',', 2( I3, ',' ), '(',+     $      F4.1, ',', F4.1, '), A,', I3, ', X,', I2, ',(', F4.1, ',',+     $      F4.1, '), Y,', I2, ')         .' )+ 9993 FORMAT( 1X, I6, ': ', A6, '(''', A1, ''',', I3, ',(', F4.1, ',',+     $      F4.1, '), A,', I3, ', X,', I2, ',(', F4.1, ',', F4.1, '), ',+     $      'Y,', I2, ')             .' )+ 9992 FORMAT( ' ******* FATAL ERROR - ERROR-EXIT TAKEN ON VALID CALL *',+     $      '******' )+*+*     End of ZCHK2.+*+      END+      SUBROUTINE ZCHK3( SNAME, EPS, THRESH, NOUT, NTRA, TRACE, REWI,+     $                  FATAL, NIDIM, IDIM, NKB, KB, NINC, INC, NMAX,+     $                  INCMAX, A, AA, AS, X, XX, XS, XT, G, Z )+*+*  Tests ZTRMV, ZTBMV, ZTPMV, ZTRSV, ZTBSV and ZTPSV.+*+*  Auxiliary routine for test program for Level 2 Blas.+*+*  -- Written on 10-August-1987.+*     Richard Hanson, Sandia National Labs.+*     Jeremy Du Croz, NAG Central Office.+*+*     .. Parameters ..+      COMPLEX*16         ZERO, HALF, ONE+      PARAMETER          ( ZERO = ( 0.0D0, 0.0D0 ),+     $                   HALF = ( 0.5D0, 0.0D0 ),+     $                   ONE = ( 1.0D0, 0.0D0 ) )+      DOUBLE PRECISION   RZERO+      PARAMETER          ( RZERO = 0.0D0 )+*     .. Scalar Arguments ..+      DOUBLE PRECISION   EPS, THRESH+      INTEGER            INCMAX, NIDIM, NINC, NKB, NMAX, NOUT, NTRA+      LOGICAL            FATAL, REWI, TRACE+      CHARACTER*6        SNAME+*     .. Array Arguments ..+      COMPLEX*16         A( NMAX, NMAX ), AA( NMAX*NMAX ),+     $                   AS( NMAX*NMAX ), X( NMAX ), XS( NMAX*INCMAX ),+     $                   XT( NMAX ), XX( NMAX*INCMAX ), Z( NMAX )+      DOUBLE PRECISION   G( NMAX )+      INTEGER            IDIM( NIDIM ), INC( NINC ), KB( NKB )+*     .. Local Scalars ..+      COMPLEX*16         TRANSL+      DOUBLE PRECISION   ERR, ERRMAX+      INTEGER            I, ICD, ICT, ICU, IK, IN, INCX, INCXS, IX, K,+     $                   KS, LAA, LDA, LDAS, LX, N, NARGS, NC, NK, NS+      LOGICAL            BANDED, FULL, NULL, PACKED, RESET, SAME+      CHARACTER*1        DIAG, DIAGS, TRANS, TRANSS, UPLO, UPLOS+      CHARACTER*2        ICHD, ICHU+      CHARACTER*3        ICHT+*     .. Local Arrays ..+      LOGICAL            ISAME( 13 )+*     .. External Functions ..+      LOGICAL            LZE, LZERES+      EXTERNAL           LZE, LZERES+*     .. External Subroutines ..+      EXTERNAL           ZMAKE, ZMVCH, ZTBMV, ZTBSV, ZTPMV, ZTPSV,+     $                   ZTRMV, ZTRSV+*     .. Intrinsic Functions ..+      INTRINSIC          ABS, MAX+*     .. Scalars in Common ..+      INTEGER            INFOT, NOUTC+      LOGICAL            LERR, OK+*     .. Common blocks ..+      COMMON             /INFOC/INFOT, NOUTC, OK, LERR+*     .. Data statements ..+      DATA               ICHU/'UL'/, ICHT/'NTC'/, ICHD/'UN'/+*     .. Executable Statements ..+      FULL = SNAME( 3: 3 ).EQ.'R'+      BANDED = SNAME( 3: 3 ).EQ.'B'+      PACKED = SNAME( 3: 3 ).EQ.'P'+*     Define the number of arguments.+      IF( FULL )THEN+         NARGS = 8+      ELSE IF( BANDED )THEN+         NARGS = 9+      ELSE IF( PACKED )THEN+         NARGS = 7+      END IF+*+      NC = 0+      RESET = .TRUE.+      ERRMAX = RZERO+*     Set up zero vector for ZMVCH.+      DO 10 I = 1, NMAX+         Z( I ) = ZERO+   10 CONTINUE+*+      DO 110 IN = 1, NIDIM+         N = IDIM( IN )+*+         IF( BANDED )THEN+            NK = NKB+         ELSE+            NK = 1+         END IF+         DO 100 IK = 1, NK+            IF( BANDED )THEN+               K = KB( IK )+            ELSE+               K = N - 1+            END IF+*           Set LDA to 1 more than minimum value if room.+            IF( BANDED )THEN+               LDA = K + 1+            ELSE+               LDA = N+            END IF+            IF( LDA.LT.NMAX )+     $         LDA = LDA + 1+*           Skip tests if not enough room.+            IF( LDA.GT.NMAX )+     $         GO TO 100+            IF( PACKED )THEN+               LAA = ( N*( N + 1 ) )/2+            ELSE+               LAA = LDA*N+            END IF+            NULL = N.LE.0+*+            DO 90 ICU = 1, 2+               UPLO = ICHU( ICU: ICU )+*+               DO 80 ICT = 1, 3+                  TRANS = ICHT( ICT: ICT )+*+                  DO 70 ICD = 1, 2+                     DIAG = ICHD( ICD: ICD )+*+*                    Generate the matrix A.+*+                     TRANSL = ZERO+                     CALL ZMAKE( SNAME( 2: 3 ), UPLO, DIAG, N, N, A,+     $                           NMAX, AA, LDA, K, K, RESET, TRANSL )+*+                     DO 60 IX = 1, NINC+                        INCX = INC( IX )+                        LX = ABS( INCX )*N+*+*                       Generate the vector X.+*+                        TRANSL = HALF+                        CALL ZMAKE( 'GE', ' ', ' ', 1, N, X, 1, XX,+     $                              ABS( INCX ), 0, N - 1, RESET,+     $                              TRANSL )+                        IF( N.GT.1 )THEN+                           X( N/2 ) = ZERO+                           XX( 1 + ABS( INCX )*( N/2 - 1 ) ) = ZERO+                        END IF+*+                        NC = NC + 1+*+*                       Save every datum before calling the subroutine.+*+                        UPLOS = UPLO+                        TRANSS = TRANS+                        DIAGS = DIAG+                        NS = N+                        KS = K+                        DO 20 I = 1, LAA+                           AS( I ) = AA( I )+   20                   CONTINUE+                        LDAS = LDA+                        DO 30 I = 1, LX+                           XS( I ) = XX( I )+   30                   CONTINUE+                        INCXS = INCX+*+*                       Call the subroutine.+*+                        IF( SNAME( 4: 5 ).EQ.'MV' )THEN+                           IF( FULL )THEN+                              IF( TRACE )+     $                           WRITE( NTRA, FMT = 9993 )NC, SNAME,+     $                           UPLO, TRANS, DIAG, N, LDA, INCX+                              IF( REWI )+     $                           REWIND NTRA+                              CALL ZTRMV( UPLO, TRANS, DIAG, N, AA, LDA,+     $                                    XX, INCX )+                           ELSE IF( BANDED )THEN+                              IF( TRACE )+     $                           WRITE( NTRA, FMT = 9994 )NC, SNAME,+     $                           UPLO, TRANS, DIAG, N, K, LDA, INCX+                              IF( REWI )+     $                           REWIND NTRA+                              CALL ZTBMV( UPLO, TRANS, DIAG, N, K, AA,+     $                                    LDA, XX, INCX )+                           ELSE IF( PACKED )THEN+                              IF( TRACE )+     $                           WRITE( NTRA, FMT = 9995 )NC, SNAME,+     $                           UPLO, TRANS, DIAG, N, INCX+                              IF( REWI )+     $                           REWIND NTRA+                              CALL ZTPMV( UPLO, TRANS, DIAG, N, AA, XX,+     $                                    INCX )+                           END IF+                        ELSE IF( SNAME( 4: 5 ).EQ.'SV' )THEN+                           IF( FULL )THEN+                              IF( TRACE )+     $                           WRITE( NTRA, FMT = 9993 )NC, SNAME,+     $                           UPLO, TRANS, DIAG, N, LDA, INCX+                              IF( REWI )+     $                           REWIND NTRA+                              CALL ZTRSV( UPLO, TRANS, DIAG, N, AA, LDA,+     $                                    XX, INCX )+                           ELSE IF( BANDED )THEN+                              IF( TRACE )+     $                           WRITE( NTRA, FMT = 9994 )NC, SNAME,+     $                           UPLO, TRANS, DIAG, N, K, LDA, INCX+                              IF( REWI )+     $                           REWIND NTRA+                              CALL ZTBSV( UPLO, TRANS, DIAG, N, K, AA,+     $                                    LDA, XX, INCX )+                           ELSE IF( PACKED )THEN+                              IF( TRACE )+     $                           WRITE( NTRA, FMT = 9995 )NC, SNAME,+     $                           UPLO, TRANS, DIAG, N, INCX+                              IF( REWI )+     $                           REWIND NTRA+                              CALL ZTPSV( UPLO, TRANS, DIAG, N, AA, XX,+     $                                    INCX )+                           END IF+                        END IF+*+*                       Check if error-exit was taken incorrectly.+*+                        IF( .NOT.OK )THEN+                           WRITE( NOUT, FMT = 9992 )+                           FATAL = .TRUE.+                           GO TO 120+                        END IF+*+*                       See what data changed inside subroutines.+*+                        ISAME( 1 ) = UPLO.EQ.UPLOS+                        ISAME( 2 ) = TRANS.EQ.TRANSS+                        ISAME( 3 ) = DIAG.EQ.DIAGS+                        ISAME( 4 ) = NS.EQ.N+                        IF( FULL )THEN+                           ISAME( 5 ) = LZE( AS, AA, LAA )+                           ISAME( 6 ) = LDAS.EQ.LDA+                           IF( NULL )THEN+                              ISAME( 7 ) = LZE( XS, XX, LX )+                           ELSE+                              ISAME( 7 ) = LZERES( 'GE', ' ', 1, N, XS,+     $                                     XX, ABS( INCX ) )+                           END IF+                           ISAME( 8 ) = INCXS.EQ.INCX+                        ELSE IF( BANDED )THEN+                           ISAME( 5 ) = KS.EQ.K+                           ISAME( 6 ) = LZE( AS, AA, LAA )+                           ISAME( 7 ) = LDAS.EQ.LDA+                           IF( NULL )THEN+                              ISAME( 8 ) = LZE( XS, XX, LX )+                           ELSE+                              ISAME( 8 ) = LZERES( 'GE', ' ', 1, N, XS,+     $                                     XX, ABS( INCX ) )+                           END IF+                           ISAME( 9 ) = INCXS.EQ.INCX+                        ELSE IF( PACKED )THEN+                           ISAME( 5 ) = LZE( AS, AA, LAA )+                           IF( NULL )THEN+                              ISAME( 6 ) = LZE( XS, XX, LX )+                           ELSE+                              ISAME( 6 ) = LZERES( 'GE', ' ', 1, N, XS,+     $                                     XX, ABS( INCX ) )+                           END IF+                           ISAME( 7 ) = INCXS.EQ.INCX+                        END IF+*+*                       If data was incorrectly changed, report and+*                       return.+*+                        SAME = .TRUE.+                        DO 40 I = 1, NARGS+                           SAME = SAME.AND.ISAME( I )+                           IF( .NOT.ISAME( I ) )+     $                        WRITE( NOUT, FMT = 9998 )I+   40                   CONTINUE+                        IF( .NOT.SAME )THEN+                           FATAL = .TRUE.+                           GO TO 120+                        END IF+*+                        IF( .NOT.NULL )THEN+                           IF( SNAME( 4: 5 ).EQ.'MV' )THEN+*+*                             Check the result.+*+                              CALL ZMVCH( TRANS, N, N, ONE, A, NMAX, X,+     $                                    INCX, ZERO, Z, INCX, XT, G,+     $                                    XX, EPS, ERR, FATAL, NOUT,+     $                                    .TRUE. )+                           ELSE IF( SNAME( 4: 5 ).EQ.'SV' )THEN+*+*                             Compute approximation to original vector.+*+                              DO 50 I = 1, N+                                 Z( I ) = XX( 1 + ( I - 1 )*+     $                                    ABS( INCX ) )+                                 XX( 1 + ( I - 1 )*ABS( INCX ) )+     $                              = X( I )+   50                         CONTINUE+                              CALL ZMVCH( TRANS, N, N, ONE, A, NMAX, Z,+     $                                    INCX, ZERO, X, INCX, XT, G,+     $                                    XX, EPS, ERR, FATAL, NOUT,+     $                                    .FALSE. )+                           END IF+                           ERRMAX = MAX( ERRMAX, ERR )+*                          If got really bad answer, report and return.+                           IF( FATAL )+     $                        GO TO 120+                        ELSE+*                          Avoid repeating tests with N.le.0.+                           GO TO 110+                        END IF+*+   60                CONTINUE+*+   70             CONTINUE+*+   80          CONTINUE+*+   90       CONTINUE+*+  100    CONTINUE+*+  110 CONTINUE+*+*     Report result.+*+      IF( ERRMAX.LT.THRESH )THEN+         WRITE( NOUT, FMT = 9999 )SNAME, NC+      ELSE+         WRITE( NOUT, FMT = 9997 )SNAME, NC, ERRMAX+      END IF+      GO TO 130+*+  120 CONTINUE+      WRITE( NOUT, FMT = 9996 )SNAME+      IF( FULL )THEN+         WRITE( NOUT, FMT = 9993 )NC, SNAME, UPLO, TRANS, DIAG, N, LDA,+     $      INCX+      ELSE IF( BANDED )THEN+         WRITE( NOUT, FMT = 9994 )NC, SNAME, UPLO, TRANS, DIAG, N, K,+     $      LDA, INCX+      ELSE IF( PACKED )THEN+         WRITE( NOUT, FMT = 9995 )NC, SNAME, UPLO, TRANS, DIAG, N, INCX+      END IF+*+  130 CONTINUE+      RETURN+*+ 9999 FORMAT( ' ', A6, ' PASSED THE COMPUTATIONAL TESTS (', I6, ' CALL',+     $      'S)' )+ 9998 FORMAT( ' ******* FATAL ERROR - PARAMETER NUMBER ', I2, ' WAS CH',+     $      'ANGED INCORRECTLY *******' )+ 9997 FORMAT( ' ', A6, ' COMPLETED THE COMPUTATIONAL TESTS (', I6, ' C',+     $      'ALLS)', /' ******* BUT WITH MAXIMUM TEST RATIO', F8.2,+     $      ' - SUSPECT *******' )+ 9996 FORMAT( ' ******* ', A6, ' FAILED ON CALL NUMBER:' )+ 9995 FORMAT( 1X, I6, ': ', A6, '(', 3( '''', A1, ''',' ), I3, ', AP, ',+     $      'X,', I2, ')                                      .' )+ 9994 FORMAT( 1X, I6, ': ', A6, '(', 3( '''', A1, ''',' ), 2( I3, ',' ),+     $      ' A,', I3, ', X,', I2, ')                               .' )+ 9993 FORMAT( 1X, I6, ': ', A6, '(', 3( '''', A1, ''',' ), I3, ', A,',+     $      I3, ', X,', I2, ')                                   .' )+ 9992 FORMAT( ' ******* FATAL ERROR - ERROR-EXIT TAKEN ON VALID CALL *',+     $      '******' )+*+*     End of ZCHK3.+*+      END+      SUBROUTINE ZCHK4( SNAME, EPS, THRESH, NOUT, NTRA, TRACE, REWI,+     $                  FATAL, NIDIM, IDIM, NALF, ALF, NINC, INC, NMAX,+     $                  INCMAX, A, AA, AS, X, XX, XS, Y, YY, YS, YT, G,+     $                  Z )+*+*  Tests ZGERC and ZGERU.+*+*  Auxiliary routine for test program for Level 2 Blas.+*+*  -- Written on 10-August-1987.+*     Richard Hanson, Sandia National Labs.+*     Jeremy Du Croz, NAG Central Office.+*+*     .. Parameters ..+      COMPLEX*16         ZERO, HALF, ONE+      PARAMETER          ( ZERO = ( 0.0D0, 0.0D0 ),+     $                   HALF = ( 0.5D0, 0.0D0 ),+     $                   ONE = ( 1.0D0, 0.0D0 ) )+      DOUBLE PRECISION   RZERO+      PARAMETER          ( RZERO = 0.0D0 )+*     .. Scalar Arguments ..+      DOUBLE PRECISION   EPS, THRESH+      INTEGER            INCMAX, NALF, NIDIM, NINC, NMAX, NOUT, NTRA+      LOGICAL            FATAL, REWI, TRACE+      CHARACTER*6        SNAME+*     .. Array Arguments ..+      COMPLEX*16         A( NMAX, NMAX ), AA( NMAX*NMAX ), ALF( NALF ),+     $                   AS( NMAX*NMAX ), X( NMAX ), XS( NMAX*INCMAX ),+     $                   XX( NMAX*INCMAX ), Y( NMAX ),+     $                   YS( NMAX*INCMAX ), YT( NMAX ),+     $                   YY( NMAX*INCMAX ), Z( NMAX )+      DOUBLE PRECISION   G( NMAX )+      INTEGER            IDIM( NIDIM ), INC( NINC )+*     .. Local Scalars ..+      COMPLEX*16         ALPHA, ALS, TRANSL+      DOUBLE PRECISION   ERR, ERRMAX+      INTEGER            I, IA, IM, IN, INCX, INCXS, INCY, INCYS, IX,+     $                   IY, J, LAA, LDA, LDAS, LX, LY, M, MS, N, NARGS,+     $                   NC, ND, NS+      LOGICAL            CONJ, NULL, RESET, SAME+*     .. Local Arrays ..+      COMPLEX*16         W( 1 )+      LOGICAL            ISAME( 13 )+*     .. External Functions ..+      LOGICAL            LZE, LZERES+      EXTERNAL           LZE, LZERES+*     .. External Subroutines ..+      EXTERNAL           ZGERC, ZGERU, ZMAKE, ZMVCH+*     .. Intrinsic Functions ..+      INTRINSIC          ABS, DCONJG, MAX, MIN+*     .. Scalars in Common ..+      INTEGER            INFOT, NOUTC+      LOGICAL            LERR, OK+*     .. Common blocks ..+      COMMON             /INFOC/INFOT, NOUTC, OK, LERR+*     .. Executable Statements ..+      CONJ = SNAME( 5: 5 ).EQ.'C'+*     Define the number of arguments.+      NARGS = 9+*+      NC = 0+      RESET = .TRUE.+      ERRMAX = RZERO+*+      DO 120 IN = 1, NIDIM+         N = IDIM( IN )+         ND = N/2 + 1+*+         DO 110 IM = 1, 2+            IF( IM.EQ.1 )+     $         M = MAX( N - ND, 0 )+            IF( IM.EQ.2 )+     $         M = MIN( N + ND, NMAX )+*+*           Set LDA to 1 more than minimum value if room.+            LDA = M+            IF( LDA.LT.NMAX )+     $         LDA = LDA + 1+*           Skip tests if not enough room.+            IF( LDA.GT.NMAX )+     $         GO TO 110+            LAA = LDA*N+            NULL = N.LE.0.OR.M.LE.0+*+            DO 100 IX = 1, NINC+               INCX = INC( IX )+               LX = ABS( INCX )*M+*+*              Generate the vector X.+*+               TRANSL = HALF+               CALL ZMAKE( 'GE', ' ', ' ', 1, M, X, 1, XX, ABS( INCX ),+     $                     0, M - 1, RESET, TRANSL )+               IF( M.GT.1 )THEN+                  X( M/2 ) = ZERO+                  XX( 1 + ABS( INCX )*( M/2 - 1 ) ) = ZERO+               END IF+*+               DO 90 IY = 1, NINC+                  INCY = INC( IY )+                  LY = ABS( INCY )*N+*+*                 Generate the vector Y.+*+                  TRANSL = ZERO+                  CALL ZMAKE( 'GE', ' ', ' ', 1, N, Y, 1, YY,+     $                        ABS( INCY ), 0, N - 1, RESET, TRANSL )+                  IF( N.GT.1 )THEN+                     Y( N/2 ) = ZERO+                     YY( 1 + ABS( INCY )*( N/2 - 1 ) ) = ZERO+                  END IF+*+                  DO 80 IA = 1, NALF+                     ALPHA = ALF( IA )+*+*                    Generate the matrix A.+*+                     TRANSL = ZERO+                     CALL ZMAKE( SNAME( 2: 3 ), ' ', ' ', M, N, A, NMAX,+     $                           AA, LDA, M - 1, N - 1, RESET, TRANSL )+*+                     NC = NC + 1+*+*                    Save every datum before calling the subroutine.+*+                     MS = M+                     NS = N+                     ALS = ALPHA+                     DO 10 I = 1, LAA+                        AS( I ) = AA( I )+   10                CONTINUE+                     LDAS = LDA+                     DO 20 I = 1, LX+                        XS( I ) = XX( I )+   20                CONTINUE+                     INCXS = INCX+                     DO 30 I = 1, LY+                        YS( I ) = YY( I )+   30                CONTINUE+                     INCYS = INCY+*+*                    Call the subroutine.+*+                     IF( TRACE )+     $                  WRITE( NTRA, FMT = 9994 )NC, SNAME, M, N,+     $                  ALPHA, INCX, INCY, LDA+                     IF( CONJ )THEN+                        IF( REWI )+     $                     REWIND NTRA+                        CALL ZGERC( M, N, ALPHA, XX, INCX, YY, INCY, AA,+     $                              LDA )+                     ELSE+                        IF( REWI )+     $                     REWIND NTRA+                        CALL ZGERU( M, N, ALPHA, XX, INCX, YY, INCY, AA,+     $                              LDA )+                     END IF+*+*                    Check if error-exit was taken incorrectly.+*+                     IF( .NOT.OK )THEN+                        WRITE( NOUT, FMT = 9993 )+                        FATAL = .TRUE.+                        GO TO 140+                     END IF+*+*                    See what data changed inside subroutine.+*+                     ISAME( 1 ) = MS.EQ.M+                     ISAME( 2 ) = NS.EQ.N+                     ISAME( 3 ) = ALS.EQ.ALPHA+                     ISAME( 4 ) = LZE( XS, XX, LX )+                     ISAME( 5 ) = INCXS.EQ.INCX+                     ISAME( 6 ) = LZE( YS, YY, LY )+                     ISAME( 7 ) = INCYS.EQ.INCY+                     IF( NULL )THEN+                        ISAME( 8 ) = LZE( AS, AA, LAA )+                     ELSE+                        ISAME( 8 ) = LZERES( 'GE', ' ', M, N, AS, AA,+     $                               LDA )+                     END IF+                     ISAME( 9 ) = LDAS.EQ.LDA+*+*                    If data was incorrectly changed, report and return.+*+                     SAME = .TRUE.+                     DO 40 I = 1, NARGS+                        SAME = SAME.AND.ISAME( I )+                        IF( .NOT.ISAME( I ) )+     $                     WRITE( NOUT, FMT = 9998 )I+   40                CONTINUE+                     IF( .NOT.SAME )THEN+                        FATAL = .TRUE.+                        GO TO 140+                     END IF+*+                     IF( .NOT.NULL )THEN+*+*                       Check the result column by column.+*+                        IF( INCX.GT.0 )THEN+                           DO 50 I = 1, M+                              Z( I ) = X( I )+   50                      CONTINUE+                        ELSE+                           DO 60 I = 1, M+                              Z( I ) = X( M - I + 1 )+   60                      CONTINUE+                        END IF+                        DO 70 J = 1, N+                           IF( INCY.GT.0 )THEN+                              W( 1 ) = Y( J )+                           ELSE+                              W( 1 ) = Y( N - J + 1 )+                           END IF+                           IF( CONJ )+     $                        W( 1 ) = DCONJG( W( 1 ) )+                           CALL ZMVCH( 'N', M, 1, ALPHA, Z, NMAX, W, 1,+     $                                 ONE, A( 1, J ), 1, YT, G,+     $                                 AA( 1 + ( J - 1 )*LDA ), EPS,+     $                                 ERR, FATAL, NOUT, .TRUE. )+                           ERRMAX = MAX( ERRMAX, ERR )+*                          If got really bad answer, report and return.+                           IF( FATAL )+     $                        GO TO 130+   70                   CONTINUE+                     ELSE+*                       Avoid repeating tests with M.le.0 or N.le.0.+                        GO TO 110+                     END IF+*+   80             CONTINUE+*+   90          CONTINUE+*+  100       CONTINUE+*+  110    CONTINUE+*+  120 CONTINUE+*+*     Report result.+*+      IF( ERRMAX.LT.THRESH )THEN+         WRITE( NOUT, FMT = 9999 )SNAME, NC+      ELSE+         WRITE( NOUT, FMT = 9997 )SNAME, NC, ERRMAX+      END IF+      GO TO 150+*+  130 CONTINUE+      WRITE( NOUT, FMT = 9995 )J+*+  140 CONTINUE+      WRITE( NOUT, FMT = 9996 )SNAME+      WRITE( NOUT, FMT = 9994 )NC, SNAME, M, N, ALPHA, INCX, INCY, LDA+*+  150 CONTINUE+      RETURN+*+ 9999 FORMAT( ' ', A6, ' PASSED THE COMPUTATIONAL TESTS (', I6, ' CALL',+     $      'S)' )+ 9998 FORMAT( ' ******* FATAL ERROR - PARAMETER NUMBER ', I2, ' WAS CH',+     $      'ANGED INCORRECTLY *******' )+ 9997 FORMAT( ' ', A6, ' COMPLETED THE COMPUTATIONAL TESTS (', I6, ' C',+     $      'ALLS)', /' ******* BUT WITH MAXIMUM TEST RATIO', F8.2,+     $      ' - SUSPECT *******' )+ 9996 FORMAT( ' ******* ', A6, ' FAILED ON CALL NUMBER:' )+ 9995 FORMAT( '      THESE ARE THE RESULTS FOR COLUMN ', I3 )+ 9994 FORMAT( 1X, I6, ': ', A6, '(', 2( I3, ',' ), '(', F4.1, ',', F4.1,+     $      '), X,', I2, ', Y,', I2, ', A,', I3, ')                   ',+     $      '      .' )+ 9993 FORMAT( ' ******* FATAL ERROR - ERROR-EXIT TAKEN ON VALID CALL *',+     $      '******' )+*+*     End of ZCHK4.+*+      END+      SUBROUTINE ZCHK5( SNAME, EPS, THRESH, NOUT, NTRA, TRACE, REWI,+     $                  FATAL, NIDIM, IDIM, NALF, ALF, NINC, INC, NMAX,+     $                  INCMAX, A, AA, AS, X, XX, XS, Y, YY, YS, YT, G,+     $                  Z )+*+*  Tests ZHER and ZHPR.+*+*  Auxiliary routine for test program for Level 2 Blas.+*+*  -- Written on 10-August-1987.+*     Richard Hanson, Sandia National Labs.+*     Jeremy Du Croz, NAG Central Office.+*+*     .. Parameters ..+      COMPLEX*16         ZERO, HALF, ONE+      PARAMETER          ( ZERO = ( 0.0D0, 0.0D0 ),+     $                   HALF = ( 0.5D0, 0.0D0 ),+     $                   ONE = ( 1.0D0, 0.0D0 ) )+      DOUBLE PRECISION   RZERO+      PARAMETER          ( RZERO = 0.0D0 )+*     .. Scalar Arguments ..+      DOUBLE PRECISION   EPS, THRESH+      INTEGER            INCMAX, NALF, NIDIM, NINC, NMAX, NOUT, NTRA+      LOGICAL            FATAL, REWI, TRACE+      CHARACTER*6        SNAME+*     .. Array Arguments ..+      COMPLEX*16         A( NMAX, NMAX ), AA( NMAX*NMAX ), ALF( NALF ),+     $                   AS( NMAX*NMAX ), X( NMAX ), XS( NMAX*INCMAX ),+     $                   XX( NMAX*INCMAX ), Y( NMAX ),+     $                   YS( NMAX*INCMAX ), YT( NMAX ),+     $                   YY( NMAX*INCMAX ), Z( NMAX )+      DOUBLE PRECISION   G( NMAX )+      INTEGER            IDIM( NIDIM ), INC( NINC )+*     .. Local Scalars ..+      COMPLEX*16         ALPHA, TRANSL+      DOUBLE PRECISION   ERR, ERRMAX, RALPHA, RALS+      INTEGER            I, IA, IC, IN, INCX, INCXS, IX, J, JA, JJ, LAA,+     $                   LDA, LDAS, LJ, LX, N, NARGS, NC, NS+      LOGICAL            FULL, NULL, PACKED, RESET, SAME, UPPER+      CHARACTER*1        UPLO, UPLOS+      CHARACTER*2        ICH+*     .. Local Arrays ..+      COMPLEX*16         W( 1 )+      LOGICAL            ISAME( 13 )+*     .. External Functions ..+      LOGICAL            LZE, LZERES+      EXTERNAL           LZE, LZERES+*     .. External Subroutines ..+      EXTERNAL           ZHER, ZHPR, ZMAKE, ZMVCH+*     .. Intrinsic Functions ..+      INTRINSIC          ABS, DBLE, DCMPLX, DCONJG, MAX+*     .. Scalars in Common ..+      INTEGER            INFOT, NOUTC+      LOGICAL            LERR, OK+*     .. Common blocks ..+      COMMON             /INFOC/INFOT, NOUTC, OK, LERR+*     .. Data statements ..+      DATA               ICH/'UL'/+*     .. Executable Statements ..+      FULL = SNAME( 3: 3 ).EQ.'E'+      PACKED = SNAME( 3: 3 ).EQ.'P'+*     Define the number of arguments.+      IF( FULL )THEN+         NARGS = 7+      ELSE IF( PACKED )THEN+         NARGS = 6+      END IF+*+      NC = 0+      RESET = .TRUE.+      ERRMAX = RZERO+*+      DO 100 IN = 1, NIDIM+         N = IDIM( IN )+*        Set LDA to 1 more than minimum value if room.+         LDA = N+         IF( LDA.LT.NMAX )+     $      LDA = LDA + 1+*        Skip tests if not enough room.+         IF( LDA.GT.NMAX )+     $      GO TO 100+         IF( PACKED )THEN+            LAA = ( N*( N + 1 ) )/2+         ELSE+            LAA = LDA*N+         END IF+*+         DO 90 IC = 1, 2+            UPLO = ICH( IC: IC )+            UPPER = UPLO.EQ.'U'+*+            DO 80 IX = 1, NINC+               INCX = INC( IX )+               LX = ABS( INCX )*N+*+*              Generate the vector X.+*+               TRANSL = HALF+               CALL ZMAKE( 'GE', ' ', ' ', 1, N, X, 1, XX, ABS( INCX ),+     $                     0, N - 1, RESET, TRANSL )+               IF( N.GT.1 )THEN+                  X( N/2 ) = ZERO+                  XX( 1 + ABS( INCX )*( N/2 - 1 ) ) = ZERO+               END IF+*+               DO 70 IA = 1, NALF+                  RALPHA = DBLE( ALF( IA ) )+                  ALPHA = DCMPLX( RALPHA, RZERO )+                  NULL = N.LE.0.OR.RALPHA.EQ.RZERO+*+*                 Generate the matrix A.+*+                  TRANSL = ZERO+                  CALL ZMAKE( SNAME( 2: 3 ), UPLO, ' ', N, N, A, NMAX,+     $                        AA, LDA, N - 1, N - 1, RESET, TRANSL )+*+                  NC = NC + 1+*+*                 Save every datum before calling the subroutine.+*+                  UPLOS = UPLO+                  NS = N+                  RALS = RALPHA+                  DO 10 I = 1, LAA+                     AS( I ) = AA( I )+   10             CONTINUE+                  LDAS = LDA+                  DO 20 I = 1, LX+                     XS( I ) = XX( I )+   20             CONTINUE+                  INCXS = INCX+*+*                 Call the subroutine.+*+                  IF( FULL )THEN+                     IF( TRACE )+     $                  WRITE( NTRA, FMT = 9993 )NC, SNAME, UPLO, N,+     $                  RALPHA, INCX, LDA+                     IF( REWI )+     $                  REWIND NTRA+                     CALL ZHER( UPLO, N, RALPHA, XX, INCX, AA, LDA )+                  ELSE IF( PACKED )THEN+                     IF( TRACE )+     $                  WRITE( NTRA, FMT = 9994 )NC, SNAME, UPLO, N,+     $                  RALPHA, INCX+                     IF( REWI )+     $                  REWIND NTRA+                     CALL ZHPR( UPLO, N, RALPHA, XX, INCX, AA )+                  END IF+*+*                 Check if error-exit was taken incorrectly.+*+                  IF( .NOT.OK )THEN+                     WRITE( NOUT, FMT = 9992 )+                     FATAL = .TRUE.+                     GO TO 120+                  END IF+*+*                 See what data changed inside subroutines.+*+                  ISAME( 1 ) = UPLO.EQ.UPLOS+                  ISAME( 2 ) = NS.EQ.N+                  ISAME( 3 ) = RALS.EQ.RALPHA+                  ISAME( 4 ) = LZE( XS, XX, LX )+                  ISAME( 5 ) = INCXS.EQ.INCX+                  IF( NULL )THEN+                     ISAME( 6 ) = LZE( AS, AA, LAA )+                  ELSE+                     ISAME( 6 ) = LZERES( SNAME( 2: 3 ), UPLO, N, N, AS,+     $                            AA, LDA )+                  END IF+                  IF( .NOT.PACKED )THEN+                     ISAME( 7 ) = LDAS.EQ.LDA+                  END IF+*+*                 If data was incorrectly changed, report and return.+*+                  SAME = .TRUE.+                  DO 30 I = 1, NARGS+                     SAME = SAME.AND.ISAME( I )+                     IF( .NOT.ISAME( I ) )+     $                  WRITE( NOUT, FMT = 9998 )I+   30             CONTINUE+                  IF( .NOT.SAME )THEN+                     FATAL = .TRUE.+                     GO TO 120+                  END IF+*+                  IF( .NOT.NULL )THEN+*+*                    Check the result column by column.+*+                     IF( INCX.GT.0 )THEN+                        DO 40 I = 1, N+                           Z( I ) = X( I )+   40                   CONTINUE+                     ELSE+                        DO 50 I = 1, N+                           Z( I ) = X( N - I + 1 )+   50                   CONTINUE+                     END IF+                     JA = 1+                     DO 60 J = 1, N+                        W( 1 ) = DCONJG( Z( J ) )+                        IF( UPPER )THEN+                           JJ = 1+                           LJ = J+                        ELSE+                           JJ = J+                           LJ = N - J + 1+                        END IF+                        CALL ZMVCH( 'N', LJ, 1, ALPHA, Z( JJ ), LJ, W,+     $                              1, ONE, A( JJ, J ), 1, YT, G,+     $                              AA( JA ), EPS, ERR, FATAL, NOUT,+     $                              .TRUE. )+                        IF( FULL )THEN+                           IF( UPPER )THEN+                              JA = JA + LDA+                           ELSE+                              JA = JA + LDA + 1+                           END IF+                        ELSE+                           JA = JA + LJ+                        END IF+                        ERRMAX = MAX( ERRMAX, ERR )+*                       If got really bad answer, report and return.+                        IF( FATAL )+     $                     GO TO 110+   60                CONTINUE+                  ELSE+*                    Avoid repeating tests if N.le.0.+                     IF( N.LE.0 )+     $                  GO TO 100+                  END IF+*+   70          CONTINUE+*+   80       CONTINUE+*+   90    CONTINUE+*+  100 CONTINUE+*+*     Report result.+*+      IF( ERRMAX.LT.THRESH )THEN+         WRITE( NOUT, FMT = 9999 )SNAME, NC+      ELSE+         WRITE( NOUT, FMT = 9997 )SNAME, NC, ERRMAX+      END IF+      GO TO 130+*+  110 CONTINUE+      WRITE( NOUT, FMT = 9995 )J+*+  120 CONTINUE+      WRITE( NOUT, FMT = 9996 )SNAME+      IF( FULL )THEN+         WRITE( NOUT, FMT = 9993 )NC, SNAME, UPLO, N, RALPHA, INCX, LDA+      ELSE IF( PACKED )THEN+         WRITE( NOUT, FMT = 9994 )NC, SNAME, UPLO, N, RALPHA, INCX+      END IF+*+  130 CONTINUE+      RETURN+*+ 9999 FORMAT( ' ', A6, ' PASSED THE COMPUTATIONAL TESTS (', I6, ' CALL',+     $      'S)' )+ 9998 FORMAT( ' ******* FATAL ERROR - PARAMETER NUMBER ', I2, ' WAS CH',+     $      'ANGED INCORRECTLY *******' )+ 9997 FORMAT( ' ', A6, ' COMPLETED THE COMPUTATIONAL TESTS (', I6, ' C',+     $      'ALLS)', /' ******* BUT WITH MAXIMUM TEST RATIO', F8.2,+     $      ' - SUSPECT *******' )+ 9996 FORMAT( ' ******* ', A6, ' FAILED ON CALL NUMBER:' )+ 9995 FORMAT( '      THESE ARE THE RESULTS FOR COLUMN ', I3 )+ 9994 FORMAT( 1X, I6, ': ', A6, '(''', A1, ''',', I3, ',', F4.1, ', X,',+     $      I2, ', AP)                                         .' )+ 9993 FORMAT( 1X, I6, ': ', A6, '(''', A1, ''',', I3, ',', F4.1, ', X,',+     $      I2, ', A,', I3, ')                                      .' )+ 9992 FORMAT( ' ******* FATAL ERROR - ERROR-EXIT TAKEN ON VALID CALL *',+     $      '******' )+*+*     End of ZCHK5.+*+      END+      SUBROUTINE ZCHK6( SNAME, EPS, THRESH, NOUT, NTRA, TRACE, REWI,+     $                  FATAL, NIDIM, IDIM, NALF, ALF, NINC, INC, NMAX,+     $                  INCMAX, A, AA, AS, X, XX, XS, Y, YY, YS, YT, G,+     $                  Z )+*+*  Tests ZHER2 and ZHPR2.+*+*  Auxiliary routine for test program for Level 2 Blas.+*+*  -- Written on 10-August-1987.+*     Richard Hanson, Sandia National Labs.+*     Jeremy Du Croz, NAG Central Office.+*+*     .. Parameters ..+      COMPLEX*16         ZERO, HALF, ONE+      PARAMETER          ( ZERO = ( 0.0D0, 0.0D0 ),+     $                   HALF = ( 0.5D0, 0.0D0 ),+     $                   ONE = ( 1.0D0, 0.0D0 ) )+      DOUBLE PRECISION   RZERO+      PARAMETER          ( RZERO = 0.0D0 )+*     .. Scalar Arguments ..+      DOUBLE PRECISION   EPS, THRESH+      INTEGER            INCMAX, NALF, NIDIM, NINC, NMAX, NOUT, NTRA+      LOGICAL            FATAL, REWI, TRACE+      CHARACTER*6        SNAME+*     .. Array Arguments ..+      COMPLEX*16         A( NMAX, NMAX ), AA( NMAX*NMAX ), ALF( NALF ),+     $                   AS( NMAX*NMAX ), X( NMAX ), XS( NMAX*INCMAX ),+     $                   XX( NMAX*INCMAX ), Y( NMAX ),+     $                   YS( NMAX*INCMAX ), YT( NMAX ),+     $                   YY( NMAX*INCMAX ), Z( NMAX, 2 )+      DOUBLE PRECISION   G( NMAX )+      INTEGER            IDIM( NIDIM ), INC( NINC )+*     .. Local Scalars ..+      COMPLEX*16         ALPHA, ALS, TRANSL+      DOUBLE PRECISION   ERR, ERRMAX+      INTEGER            I, IA, IC, IN, INCX, INCXS, INCY, INCYS, IX,+     $                   IY, J, JA, JJ, LAA, LDA, LDAS, LJ, LX, LY, N,+     $                   NARGS, NC, NS+      LOGICAL            FULL, NULL, PACKED, RESET, SAME, UPPER+      CHARACTER*1        UPLO, UPLOS+      CHARACTER*2        ICH+*     .. Local Arrays ..+      COMPLEX*16         W( 2 )+      LOGICAL            ISAME( 13 )+*     .. External Functions ..+      LOGICAL            LZE, LZERES+      EXTERNAL           LZE, LZERES+*     .. External Subroutines ..+      EXTERNAL           ZHER2, ZHPR2, ZMAKE, ZMVCH+*     .. Intrinsic Functions ..+      INTRINSIC          ABS, DCONJG, MAX+*     .. Scalars in Common ..+      INTEGER            INFOT, NOUTC+      LOGICAL            LERR, OK+*     .. Common blocks ..+      COMMON             /INFOC/INFOT, NOUTC, OK, LERR+*     .. Data statements ..+      DATA               ICH/'UL'/+*     .. Executable Statements ..+      FULL = SNAME( 3: 3 ).EQ.'E'+      PACKED = SNAME( 3: 3 ).EQ.'P'+*     Define the number of arguments.+      IF( FULL )THEN+         NARGS = 9+      ELSE IF( PACKED )THEN+         NARGS = 8+      END IF+*+      NC = 0+      RESET = .TRUE.+      ERRMAX = RZERO+*+      DO 140 IN = 1, NIDIM+         N = IDIM( IN )+*        Set LDA to 1 more than minimum value if room.+         LDA = N+         IF( LDA.LT.NMAX )+     $      LDA = LDA + 1+*        Skip tests if not enough room.+         IF( LDA.GT.NMAX )+     $      GO TO 140+         IF( PACKED )THEN+            LAA = ( N*( N + 1 ) )/2+         ELSE+            LAA = LDA*N+         END IF+*+         DO 130 IC = 1, 2+            UPLO = ICH( IC: IC )+            UPPER = UPLO.EQ.'U'+*+            DO 120 IX = 1, NINC+               INCX = INC( IX )+               LX = ABS( INCX )*N+*+*              Generate the vector X.+*+               TRANSL = HALF+               CALL ZMAKE( 'GE', ' ', ' ', 1, N, X, 1, XX, ABS( INCX ),+     $                     0, N - 1, RESET, TRANSL )+               IF( N.GT.1 )THEN+                  X( N/2 ) = ZERO+                  XX( 1 + ABS( INCX )*( N/2 - 1 ) ) = ZERO+               END IF+*+               DO 110 IY = 1, NINC+                  INCY = INC( IY )+                  LY = ABS( INCY )*N+*+*                 Generate the vector Y.+*+                  TRANSL = ZERO+                  CALL ZMAKE( 'GE', ' ', ' ', 1, N, Y, 1, YY,+     $                        ABS( INCY ), 0, N - 1, RESET, TRANSL )+                  IF( N.GT.1 )THEN+                     Y( N/2 ) = ZERO+                     YY( 1 + ABS( INCY )*( N/2 - 1 ) ) = ZERO+                  END IF+*+                  DO 100 IA = 1, NALF+                     ALPHA = ALF( IA )+                     NULL = N.LE.0.OR.ALPHA.EQ.ZERO+*+*                    Generate the matrix A.+*+                     TRANSL = ZERO+                     CALL ZMAKE( SNAME( 2: 3 ), UPLO, ' ', N, N, A,+     $                           NMAX, AA, LDA, N - 1, N - 1, RESET,+     $                           TRANSL )+*+                     NC = NC + 1+*+*                    Save every datum before calling the subroutine.+*+                     UPLOS = UPLO+                     NS = N+                     ALS = ALPHA+                     DO 10 I = 1, LAA+                        AS( I ) = AA( I )+   10                CONTINUE+                     LDAS = LDA+                     DO 20 I = 1, LX+                        XS( I ) = XX( I )+   20                CONTINUE+                     INCXS = INCX+                     DO 30 I = 1, LY+                        YS( I ) = YY( I )+   30                CONTINUE+                     INCYS = INCY+*+*                    Call the subroutine.+*+                     IF( FULL )THEN+                        IF( TRACE )+     $                     WRITE( NTRA, FMT = 9993 )NC, SNAME, UPLO, N,+     $                     ALPHA, INCX, INCY, LDA+                        IF( REWI )+     $                     REWIND NTRA+                        CALL ZHER2( UPLO, N, ALPHA, XX, INCX, YY, INCY,+     $                              AA, LDA )+                     ELSE IF( PACKED )THEN+                        IF( TRACE )+     $                     WRITE( NTRA, FMT = 9994 )NC, SNAME, UPLO, N,+     $                     ALPHA, INCX, INCY+                        IF( REWI )+     $                     REWIND NTRA+                        CALL ZHPR2( UPLO, N, ALPHA, XX, INCX, YY, INCY,+     $                              AA )+                     END IF+*+*                    Check if error-exit was taken incorrectly.+*+                     IF( .NOT.OK )THEN+                        WRITE( NOUT, FMT = 9992 )+                        FATAL = .TRUE.+                        GO TO 160+                     END IF+*+*                    See what data changed inside subroutines.+*+                     ISAME( 1 ) = UPLO.EQ.UPLOS+                     ISAME( 2 ) = NS.EQ.N+                     ISAME( 3 ) = ALS.EQ.ALPHA+                     ISAME( 4 ) = LZE( XS, XX, LX )+                     ISAME( 5 ) = INCXS.EQ.INCX+                     ISAME( 6 ) = LZE( YS, YY, LY )+                     ISAME( 7 ) = INCYS.EQ.INCY+                     IF( NULL )THEN+                        ISAME( 8 ) = LZE( AS, AA, LAA )+                     ELSE+                        ISAME( 8 ) = LZERES( SNAME( 2: 3 ), UPLO, N, N,+     $                               AS, AA, LDA )+                     END IF+                     IF( .NOT.PACKED )THEN+                        ISAME( 9 ) = LDAS.EQ.LDA+                     END IF+*+*                    If data was incorrectly changed, report and return.+*+                     SAME = .TRUE.+                     DO 40 I = 1, NARGS+                        SAME = SAME.AND.ISAME( I )+                        IF( .NOT.ISAME( I ) )+     $                     WRITE( NOUT, FMT = 9998 )I+   40                CONTINUE+                     IF( .NOT.SAME )THEN+                        FATAL = .TRUE.+                        GO TO 160+                     END IF+*+                     IF( .NOT.NULL )THEN+*+*                       Check the result column by column.+*+                        IF( INCX.GT.0 )THEN+                           DO 50 I = 1, N+                              Z( I, 1 ) = X( I )+   50                      CONTINUE+                        ELSE+                           DO 60 I = 1, N+                              Z( I, 1 ) = X( N - I + 1 )+   60                      CONTINUE+                        END IF+                        IF( INCY.GT.0 )THEN+                           DO 70 I = 1, N+                              Z( I, 2 ) = Y( I )+   70                      CONTINUE+                        ELSE+                           DO 80 I = 1, N+                              Z( I, 2 ) = Y( N - I + 1 )+   80                      CONTINUE+                        END IF+                        JA = 1+                        DO 90 J = 1, N+                           W( 1 ) = ALPHA*DCONJG( Z( J, 2 ) )+                           W( 2 ) = DCONJG( ALPHA )*DCONJG( Z( J, 1 ) )+                           IF( UPPER )THEN+                              JJ = 1+                              LJ = J+                           ELSE+                              JJ = J+                              LJ = N - J + 1+                           END IF+                           CALL ZMVCH( 'N', LJ, 2, ONE, Z( JJ, 1 ),+     $                                 NMAX, W, 1, ONE, A( JJ, J ), 1,+     $                                 YT, G, AA( JA ), EPS, ERR, FATAL,+     $                                 NOUT, .TRUE. )+                           IF( FULL )THEN+                              IF( UPPER )THEN+                                 JA = JA + LDA+                              ELSE+                                 JA = JA + LDA + 1+                              END IF+                           ELSE+                              JA = JA + LJ+                           END IF+                           ERRMAX = MAX( ERRMAX, ERR )+*                          If got really bad answer, report and return.+                           IF( FATAL )+     $                        GO TO 150+   90                   CONTINUE+                     ELSE+*                       Avoid repeating tests with N.le.0.+                        IF( N.LE.0 )+     $                     GO TO 140+                     END IF+*+  100             CONTINUE+*+  110          CONTINUE+*+  120       CONTINUE+*+  130    CONTINUE+*+  140 CONTINUE+*+*     Report result.+*+      IF( ERRMAX.LT.THRESH )THEN+         WRITE( NOUT, FMT = 9999 )SNAME, NC+      ELSE+         WRITE( NOUT, FMT = 9997 )SNAME, NC, ERRMAX+      END IF+      GO TO 170+*+  150 CONTINUE+      WRITE( NOUT, FMT = 9995 )J+*+  160 CONTINUE+      WRITE( NOUT, FMT = 9996 )SNAME+      IF( FULL )THEN+         WRITE( NOUT, FMT = 9993 )NC, SNAME, UPLO, N, ALPHA, INCX,+     $      INCY, LDA+      ELSE IF( PACKED )THEN+         WRITE( NOUT, FMT = 9994 )NC, SNAME, UPLO, N, ALPHA, INCX, INCY+      END IF+*+  170 CONTINUE+      RETURN+*+ 9999 FORMAT( ' ', A6, ' PASSED THE COMPUTATIONAL TESTS (', I6, ' CALL',+     $      'S)' )+ 9998 FORMAT( ' ******* FATAL ERROR - PARAMETER NUMBER ', I2, ' WAS CH',+     $      'ANGED INCORRECTLY *******' )+ 9997 FORMAT( ' ', A6, ' COMPLETED THE COMPUTATIONAL TESTS (', I6, ' C',+     $      'ALLS)', /' ******* BUT WITH MAXIMUM TEST RATIO', F8.2,+     $      ' - SUSPECT *******' )+ 9996 FORMAT( ' ******* ', A6, ' FAILED ON CALL NUMBER:' )+ 9995 FORMAT( '      THESE ARE THE RESULTS FOR COLUMN ', I3 )+ 9994 FORMAT( 1X, I6, ': ', A6, '(''', A1, ''',', I3, ',(', F4.1, ',',+     $      F4.1, '), X,', I2, ', Y,', I2, ', AP)                     ',+     $      '       .' )+ 9993 FORMAT( 1X, I6, ': ', A6, '(''', A1, ''',', I3, ',(', F4.1, ',',+     $      F4.1, '), X,', I2, ', Y,', I2, ', A,', I3, ')             ',+     $      '            .' )+ 9992 FORMAT( ' ******* FATAL ERROR - ERROR-EXIT TAKEN ON VALID CALL *',+     $      '******' )+*+*     End of ZCHK6.+*+      END+      SUBROUTINE ZCHKE( ISNUM, SRNAMT, NOUT )+*+*  Tests the error exits from the Level 2 Blas.+*  Requires a special version of the error-handling routine XERBLA.+*  ALPHA, RALPHA, BETA, A, X and Y should not need to be defined.+*+*  Auxiliary routine for test program for Level 2 Blas.+*+*  -- Written on 10-August-1987.+*     Richard Hanson, Sandia National Labs.+*     Jeremy Du Croz, NAG Central Office.+*+*     .. Scalar Arguments ..+      INTEGER            ISNUM, NOUT+      CHARACTER*6        SRNAMT+*     .. Scalars in Common ..+      INTEGER            INFOT, NOUTC+      LOGICAL            LERR, OK+*     .. Local Scalars ..+      COMPLEX*16         ALPHA, BETA+      DOUBLE PRECISION   RALPHA+*     .. Local Arrays ..+      COMPLEX*16         A( 1, 1 ), X( 1 ), Y( 1 )+*     .. External Subroutines ..+      EXTERNAL           CHKXER, ZGBMV, ZGEMV, ZGERC, ZGERU, ZHBMV,+     $                   ZHEMV, ZHER, ZHER2, ZHPMV, ZHPR, ZHPR2, ZTBMV,+     $                   ZTBSV, ZTPMV, ZTPSV, ZTRMV, ZTRSV+*     .. Common blocks ..+      COMMON             /INFOC/INFOT, NOUTC, OK, LERR+*     .. Executable Statements ..+*     OK is set to .FALSE. by the special version of XERBLA or by CHKXER+*     if anything is wrong.+      OK = .TRUE.+*     LERR is set to .TRUE. by the special version of XERBLA each time+*     it is called, and is then tested and re-set by CHKXER.+      LERR = .FALSE.+      GO TO ( 10, 20, 30, 40, 50, 60, 70, 80,+     $        90, 100, 110, 120, 130, 140, 150, 160,+     $        170 )ISNUM+   10 INFOT = 1+      CALL ZGEMV( '/', 0, 0, ALPHA, A, 1, X, 1, BETA, Y, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 2+      CALL ZGEMV( 'N', -1, 0, ALPHA, A, 1, X, 1, BETA, Y, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 3+      CALL ZGEMV( 'N', 0, -1, ALPHA, A, 1, X, 1, BETA, Y, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 6+      CALL ZGEMV( 'N', 2, 0, ALPHA, A, 1, X, 1, BETA, Y, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 8+      CALL ZGEMV( 'N', 0, 0, ALPHA, A, 1, X, 0, BETA, Y, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 11+      CALL ZGEMV( 'N', 0, 0, ALPHA, A, 1, X, 1, BETA, Y, 0 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      GO TO 180+   20 INFOT = 1+      CALL ZGBMV( '/', 0, 0, 0, 0, ALPHA, A, 1, X, 1, BETA, Y, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 2+      CALL ZGBMV( 'N', -1, 0, 0, 0, ALPHA, A, 1, X, 1, BETA, Y, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 3+      CALL ZGBMV( 'N', 0, -1, 0, 0, ALPHA, A, 1, X, 1, BETA, Y, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 4+      CALL ZGBMV( 'N', 0, 0, -1, 0, ALPHA, A, 1, X, 1, BETA, Y, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 5+      CALL ZGBMV( 'N', 2, 0, 0, -1, ALPHA, A, 1, X, 1, BETA, Y, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 8+      CALL ZGBMV( 'N', 0, 0, 1, 0, ALPHA, A, 1, X, 1, BETA, Y, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 10+      CALL ZGBMV( 'N', 0, 0, 0, 0, ALPHA, A, 1, X, 0, BETA, Y, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 13+      CALL ZGBMV( 'N', 0, 0, 0, 0, ALPHA, A, 1, X, 1, BETA, Y, 0 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      GO TO 180+   30 INFOT = 1+      CALL ZHEMV( '/', 0, ALPHA, A, 1, X, 1, BETA, Y, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 2+      CALL ZHEMV( 'U', -1, ALPHA, A, 1, X, 1, BETA, Y, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 5+      CALL ZHEMV( 'U', 2, ALPHA, A, 1, X, 1, BETA, Y, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 7+      CALL ZHEMV( 'U', 0, ALPHA, A, 1, X, 0, BETA, Y, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 10+      CALL ZHEMV( 'U', 0, ALPHA, A, 1, X, 1, BETA, Y, 0 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      GO TO 180+   40 INFOT = 1+      CALL ZHBMV( '/', 0, 0, ALPHA, A, 1, X, 1, BETA, Y, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 2+      CALL ZHBMV( 'U', -1, 0, ALPHA, A, 1, X, 1, BETA, Y, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 3+      CALL ZHBMV( 'U', 0, -1, ALPHA, A, 1, X, 1, BETA, Y, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 6+      CALL ZHBMV( 'U', 0, 1, ALPHA, A, 1, X, 1, BETA, Y, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 8+      CALL ZHBMV( 'U', 0, 0, ALPHA, A, 1, X, 0, BETA, Y, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 11+      CALL ZHBMV( 'U', 0, 0, ALPHA, A, 1, X, 1, BETA, Y, 0 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      GO TO 180+   50 INFOT = 1+      CALL ZHPMV( '/', 0, ALPHA, A, X, 1, BETA, Y, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 2+      CALL ZHPMV( 'U', -1, ALPHA, A, X, 1, BETA, Y, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 6+      CALL ZHPMV( 'U', 0, ALPHA, A, X, 0, BETA, Y, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 9+      CALL ZHPMV( 'U', 0, ALPHA, A, X, 1, BETA, Y, 0 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      GO TO 180+   60 INFOT = 1+      CALL ZTRMV( '/', 'N', 'N', 0, A, 1, X, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 2+      CALL ZTRMV( 'U', '/', 'N', 0, A, 1, X, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 3+      CALL ZTRMV( 'U', 'N', '/', 0, A, 1, X, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 4+      CALL ZTRMV( 'U', 'N', 'N', -1, A, 1, X, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 6+      CALL ZTRMV( 'U', 'N', 'N', 2, A, 1, X, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 8+      CALL ZTRMV( 'U', 'N', 'N', 0, A, 1, X, 0 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      GO TO 180+   70 INFOT = 1+      CALL ZTBMV( '/', 'N', 'N', 0, 0, A, 1, X, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 2+      CALL ZTBMV( 'U', '/', 'N', 0, 0, A, 1, X, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 3+      CALL ZTBMV( 'U', 'N', '/', 0, 0, A, 1, X, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 4+      CALL ZTBMV( 'U', 'N', 'N', -1, 0, A, 1, X, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 5+      CALL ZTBMV( 'U', 'N', 'N', 0, -1, A, 1, X, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 7+      CALL ZTBMV( 'U', 'N', 'N', 0, 1, A, 1, X, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 9+      CALL ZTBMV( 'U', 'N', 'N', 0, 0, A, 1, X, 0 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      GO TO 180+   80 INFOT = 1+      CALL ZTPMV( '/', 'N', 'N', 0, A, X, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 2+      CALL ZTPMV( 'U', '/', 'N', 0, A, X, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 3+      CALL ZTPMV( 'U', 'N', '/', 0, A, X, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 4+      CALL ZTPMV( 'U', 'N', 'N', -1, A, X, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 7+      CALL ZTPMV( 'U', 'N', 'N', 0, A, X, 0 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      GO TO 180+   90 INFOT = 1+      CALL ZTRSV( '/', 'N', 'N', 0, A, 1, X, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 2+      CALL ZTRSV( 'U', '/', 'N', 0, A, 1, X, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 3+      CALL ZTRSV( 'U', 'N', '/', 0, A, 1, X, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 4+      CALL ZTRSV( 'U', 'N', 'N', -1, A, 1, X, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 6+      CALL ZTRSV( 'U', 'N', 'N', 2, A, 1, X, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 8+      CALL ZTRSV( 'U', 'N', 'N', 0, A, 1, X, 0 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      GO TO 180+  100 INFOT = 1+      CALL ZTBSV( '/', 'N', 'N', 0, 0, A, 1, X, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 2+      CALL ZTBSV( 'U', '/', 'N', 0, 0, A, 1, X, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 3+      CALL ZTBSV( 'U', 'N', '/', 0, 0, A, 1, X, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 4+      CALL ZTBSV( 'U', 'N', 'N', -1, 0, A, 1, X, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 5+      CALL ZTBSV( 'U', 'N', 'N', 0, -1, A, 1, X, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 7+      CALL ZTBSV( 'U', 'N', 'N', 0, 1, A, 1, X, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 9+      CALL ZTBSV( 'U', 'N', 'N', 0, 0, A, 1, X, 0 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      GO TO 180+  110 INFOT = 1+      CALL ZTPSV( '/', 'N', 'N', 0, A, X, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 2+      CALL ZTPSV( 'U', '/', 'N', 0, A, X, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 3+      CALL ZTPSV( 'U', 'N', '/', 0, A, X, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 4+      CALL ZTPSV( 'U', 'N', 'N', -1, A, X, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 7+      CALL ZTPSV( 'U', 'N', 'N', 0, A, X, 0 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      GO TO 180+  120 INFOT = 1+      CALL ZGERC( -1, 0, ALPHA, X, 1, Y, 1, A, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 2+      CALL ZGERC( 0, -1, ALPHA, X, 1, Y, 1, A, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 5+      CALL ZGERC( 0, 0, ALPHA, X, 0, Y, 1, A, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 7+      CALL ZGERC( 0, 0, ALPHA, X, 1, Y, 0, A, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 9+      CALL ZGERC( 2, 0, ALPHA, X, 1, Y, 1, A, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      GO TO 180+  130 INFOT = 1+      CALL ZGERU( -1, 0, ALPHA, X, 1, Y, 1, A, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 2+      CALL ZGERU( 0, -1, ALPHA, X, 1, Y, 1, A, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 5+      CALL ZGERU( 0, 0, ALPHA, X, 0, Y, 1, A, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 7+      CALL ZGERU( 0, 0, ALPHA, X, 1, Y, 0, A, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 9+      CALL ZGERU( 2, 0, ALPHA, X, 1, Y, 1, A, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      GO TO 180+  140 INFOT = 1+      CALL ZHER( '/', 0, RALPHA, X, 1, A, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 2+      CALL ZHER( 'U', -1, RALPHA, X, 1, A, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 5+      CALL ZHER( 'U', 0, RALPHA, X, 0, A, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 7+      CALL ZHER( 'U', 2, RALPHA, X, 1, A, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      GO TO 180+  150 INFOT = 1+      CALL ZHPR( '/', 0, RALPHA, X, 1, A )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 2+      CALL ZHPR( 'U', -1, RALPHA, X, 1, A )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 5+      CALL ZHPR( 'U', 0, RALPHA, X, 0, A )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      GO TO 180+  160 INFOT = 1+      CALL ZHER2( '/', 0, ALPHA, X, 1, Y, 1, A, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 2+      CALL ZHER2( 'U', -1, ALPHA, X, 1, Y, 1, A, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 5+      CALL ZHER2( 'U', 0, ALPHA, X, 0, Y, 1, A, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 7+      CALL ZHER2( 'U', 0, ALPHA, X, 1, Y, 0, A, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 9+      CALL ZHER2( 'U', 2, ALPHA, X, 1, Y, 1, A, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      GO TO 180+  170 INFOT = 1+      CALL ZHPR2( '/', 0, ALPHA, X, 1, Y, 1, A )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 2+      CALL ZHPR2( 'U', -1, ALPHA, X, 1, Y, 1, A )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 5+      CALL ZHPR2( 'U', 0, ALPHA, X, 0, Y, 1, A )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 7+      CALL ZHPR2( 'U', 0, ALPHA, X, 1, Y, 0, A )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+*+  180 IF( OK )THEN+         WRITE( NOUT, FMT = 9999 )SRNAMT+      ELSE+         WRITE( NOUT, FMT = 9998 )SRNAMT+      END IF+      RETURN+*+ 9999 FORMAT( ' ', A6, ' PASSED THE TESTS OF ERROR-EXITS' )+ 9998 FORMAT( ' ******* ', A6, ' FAILED THE TESTS OF ERROR-EXITS *****',+     $      '**' )+*+*     End of ZCHKE.+*+      END+      SUBROUTINE ZMAKE( TYPE, UPLO, DIAG, M, N, A, NMAX, AA, LDA, KL,+     $                  KU, RESET, TRANSL )+*+*  Generates values for an M by N matrix A within the bandwidth+*  defined by KL and KU.+*  Stores the values in the array AA in the data structure required+*  by the routine, with unwanted elements set to rogue value.+*+*  TYPE is 'GE', 'GB', 'HE', 'HB', 'HP', 'TR', 'TB' OR 'TP'.+*+*  Auxiliary routine for test program for Level 2 Blas.+*+*  -- Written on 10-August-1987.+*     Richard Hanson, Sandia National Labs.+*     Jeremy Du Croz, NAG Central Office.+*+*     .. Parameters ..+      COMPLEX*16         ZERO, ONE+      PARAMETER          ( ZERO = ( 0.0D0, 0.0D0 ),+     $                   ONE = ( 1.0D0, 0.0D0 ) )+      COMPLEX*16         ROGUE+      PARAMETER          ( ROGUE = ( -1.0D10, 1.0D10 ) )+      DOUBLE PRECISION   RZERO+      PARAMETER          ( RZERO = 0.0D0 )+      DOUBLE PRECISION   RROGUE+      PARAMETER          ( RROGUE = -1.0D10 )+*     .. Scalar Arguments ..+      COMPLEX*16         TRANSL+      INTEGER            KL, KU, LDA, M, N, NMAX+      LOGICAL            RESET+      CHARACTER*1        DIAG, UPLO+      CHARACTER*2        TYPE+*     .. Array Arguments ..+      COMPLEX*16         A( NMAX, * ), AA( * )+*     .. Local Scalars ..+      INTEGER            I, I1, I2, I3, IBEG, IEND, IOFF, J, JJ, KK+      LOGICAL            GEN, LOWER, SYM, TRI, UNIT, UPPER+*     .. External Functions ..+      COMPLEX*16         ZBEG+      EXTERNAL           ZBEG+*     .. Intrinsic Functions ..+      INTRINSIC          DBLE, DCMPLX, DCONJG, MAX, MIN+*     .. Executable Statements ..+      GEN = TYPE( 1: 1 ).EQ.'G'+      SYM = TYPE( 1: 1 ).EQ.'H'+      TRI = TYPE( 1: 1 ).EQ.'T'+      UPPER = ( SYM.OR.TRI ).AND.UPLO.EQ.'U'+      LOWER = ( SYM.OR.TRI ).AND.UPLO.EQ.'L'+      UNIT = TRI.AND.DIAG.EQ.'U'+*+*     Generate data in array A.+*+      DO 20 J = 1, N+         DO 10 I = 1, M+            IF( GEN.OR.( UPPER.AND.I.LE.J ).OR.( LOWER.AND.I.GE.J ) )+     $          THEN+               IF( ( I.LE.J.AND.J - I.LE.KU ).OR.+     $             ( I.GE.J.AND.I - J.LE.KL ) )THEN+                  A( I, J ) = ZBEG( RESET ) + TRANSL+               ELSE+                  A( I, J ) = ZERO+               END IF+               IF( I.NE.J )THEN+                  IF( SYM )THEN+                     A( J, I ) = DCONJG( A( I, J ) )+                  ELSE IF( TRI )THEN+                     A( J, I ) = ZERO+                  END IF+               END IF+            END IF+   10    CONTINUE+         IF( SYM )+     $      A( J, J ) = DCMPLX( DBLE( A( J, J ) ), RZERO )+         IF( TRI )+     $      A( J, J ) = A( J, J ) + ONE+         IF( UNIT )+     $      A( J, J ) = ONE+   20 CONTINUE+*+*     Store elements in array AS in data structure required by routine.+*+      IF( TYPE.EQ.'GE' )THEN+         DO 50 J = 1, N+            DO 30 I = 1, M+               AA( I + ( J - 1 )*LDA ) = A( I, J )+   30       CONTINUE+            DO 40 I = M + 1, LDA+               AA( I + ( J - 1 )*LDA ) = ROGUE+   40       CONTINUE+   50    CONTINUE+      ELSE IF( TYPE.EQ.'GB' )THEN+         DO 90 J = 1, N+            DO 60 I1 = 1, KU + 1 - J+               AA( I1 + ( J - 1 )*LDA ) = ROGUE+   60       CONTINUE+            DO 70 I2 = I1, MIN( KL + KU + 1, KU + 1 + M - J )+               AA( I2 + ( J - 1 )*LDA ) = A( I2 + J - KU - 1, J )+   70       CONTINUE+            DO 80 I3 = I2, LDA+               AA( I3 + ( J - 1 )*LDA ) = ROGUE+   80       CONTINUE+   90    CONTINUE+      ELSE IF( TYPE.EQ.'HE'.OR.TYPE.EQ.'TR' )THEN+         DO 130 J = 1, N+            IF( UPPER )THEN+               IBEG = 1+               IF( UNIT )THEN+                  IEND = J - 1+               ELSE+                  IEND = J+               END IF+            ELSE+               IF( UNIT )THEN+                  IBEG = J + 1+               ELSE+                  IBEG = J+               END IF+               IEND = N+            END IF+            DO 100 I = 1, IBEG - 1+               AA( I + ( J - 1 )*LDA ) = ROGUE+  100       CONTINUE+            DO 110 I = IBEG, IEND+               AA( I + ( J - 1 )*LDA ) = A( I, J )+  110       CONTINUE+            DO 120 I = IEND + 1, LDA+               AA( I + ( J - 1 )*LDA ) = ROGUE+  120       CONTINUE+            IF( SYM )THEN+               JJ = J + ( J - 1 )*LDA+               AA( JJ ) = DCMPLX( DBLE( AA( JJ ) ), RROGUE )+            END IF+  130    CONTINUE+      ELSE IF( TYPE.EQ.'HB'.OR.TYPE.EQ.'TB' )THEN+         DO 170 J = 1, N+            IF( UPPER )THEN+               KK = KL + 1+               IBEG = MAX( 1, KL + 2 - J )+               IF( UNIT )THEN+                  IEND = KL+               ELSE+                  IEND = KL + 1+               END IF+            ELSE+               KK = 1+               IF( UNIT )THEN+                  IBEG = 2+               ELSE+                  IBEG = 1+               END IF+               IEND = MIN( KL + 1, 1 + M - J )+            END IF+            DO 140 I = 1, IBEG - 1+               AA( I + ( J - 1 )*LDA ) = ROGUE+  140       CONTINUE+            DO 150 I = IBEG, IEND+               AA( I + ( J - 1 )*LDA ) = A( I + J - KK, J )+  150       CONTINUE+            DO 160 I = IEND + 1, LDA+               AA( I + ( J - 1 )*LDA ) = ROGUE+  160       CONTINUE+            IF( SYM )THEN+               JJ = KK + ( J - 1 )*LDA+               AA( JJ ) = DCMPLX( DBLE( AA( JJ ) ), RROGUE )+            END IF+  170    CONTINUE+      ELSE IF( TYPE.EQ.'HP'.OR.TYPE.EQ.'TP' )THEN+         IOFF = 0+         DO 190 J = 1, N+            IF( UPPER )THEN+               IBEG = 1+               IEND = J+            ELSE+               IBEG = J+               IEND = N+            END IF+            DO 180 I = IBEG, IEND+               IOFF = IOFF + 1+               AA( IOFF ) = A( I, J )+               IF( I.EQ.J )THEN+                  IF( UNIT )+     $               AA( IOFF ) = ROGUE+                  IF( SYM )+     $               AA( IOFF ) = DCMPLX( DBLE( AA( IOFF ) ), RROGUE )+               END IF+  180       CONTINUE+  190    CONTINUE+      END IF+      RETURN+*+*     End of ZMAKE.+*+      END+      SUBROUTINE ZMVCH( TRANS, M, N, ALPHA, A, NMAX, X, INCX, BETA, Y,+     $                  INCY, YT, G, YY, EPS, ERR, FATAL, NOUT, MV )+*+*  Checks the results of the computational tests.+*+*  Auxiliary routine for test program for Level 2 Blas.+*+*  -- Written on 10-August-1987.+*     Richard Hanson, Sandia National Labs.+*     Jeremy Du Croz, NAG Central Office.+*+*     .. Parameters ..+      COMPLEX*16         ZERO+      PARAMETER          ( ZERO = ( 0.0D0, 0.0D0 ) )+      DOUBLE PRECISION   RZERO, RONE+      PARAMETER          ( RZERO = 0.0D0, RONE = 1.0D0 )+*     .. Scalar Arguments ..+      COMPLEX*16         ALPHA, BETA+      DOUBLE PRECISION   EPS, ERR+      INTEGER            INCX, INCY, M, N, NMAX, NOUT+      LOGICAL            FATAL, MV+      CHARACTER*1        TRANS+*     .. Array Arguments ..+      COMPLEX*16         A( NMAX, * ), X( * ), Y( * ), YT( * ), YY( * )+      DOUBLE PRECISION   G( * )+*     .. Local Scalars ..+      COMPLEX*16         C+      DOUBLE PRECISION   ERRI+      INTEGER            I, INCXL, INCYL, IY, J, JX, KX, KY, ML, NL+      LOGICAL            CTRAN, TRAN+*     .. Intrinsic Functions ..+      INTRINSIC          ABS, DBLE, DCONJG, DIMAG, MAX, SQRT+*     .. Statement Functions ..+      DOUBLE PRECISION   ABS1+*     .. Statement Function definitions ..+      ABS1( C ) = ABS( DBLE( C ) ) + ABS( DIMAG( C ) )+*     .. Executable Statements ..+      TRAN = TRANS.EQ.'T'+      CTRAN = TRANS.EQ.'C'+      IF( TRAN.OR.CTRAN )THEN+         ML = N+         NL = M+      ELSE+         ML = M+         NL = N+      END IF+      IF( INCX.LT.0 )THEN+         KX = NL+         INCXL = -1+      ELSE+         KX = 1+         INCXL = 1+      END IF+      IF( INCY.LT.0 )THEN+         KY = ML+         INCYL = -1+      ELSE+         KY = 1+         INCYL = 1+      END IF+*+*     Compute expected result in YT using data in A, X and Y.+*     Compute gauges in G.+*+      IY = KY+      DO 40 I = 1, ML+         YT( IY ) = ZERO+         G( IY ) = RZERO+         JX = KX+         IF( TRAN )THEN+            DO 10 J = 1, NL+               YT( IY ) = YT( IY ) + A( J, I )*X( JX )+               G( IY ) = G( IY ) + ABS1( A( J, I ) )*ABS1( X( JX ) )+               JX = JX + INCXL+   10       CONTINUE+         ELSE IF( CTRAN )THEN+            DO 20 J = 1, NL+               YT( IY ) = YT( IY ) + DCONJG( A( J, I ) )*X( JX )+               G( IY ) = G( IY ) + ABS1( A( J, I ) )*ABS1( X( JX ) )+               JX = JX + INCXL+   20       CONTINUE+         ELSE+            DO 30 J = 1, NL+               YT( IY ) = YT( IY ) + A( I, J )*X( JX )+               G( IY ) = G( IY ) + ABS1( A( I, J ) )*ABS1( X( JX ) )+               JX = JX + INCXL+   30       CONTINUE+         END IF+         YT( IY ) = ALPHA*YT( IY ) + BETA*Y( IY )+         G( IY ) = ABS1( ALPHA )*G( IY ) + ABS1( BETA )*ABS1( Y( IY ) )+         IY = IY + INCYL+   40 CONTINUE+*+*     Compute the error ratio for this result.+*+      ERR = ZERO+      DO 50 I = 1, ML+         ERRI = ABS( YT( I ) - YY( 1 + ( I - 1 )*ABS( INCY ) ) )/EPS+         IF( G( I ).NE.RZERO )+     $      ERRI = ERRI/G( I )+         ERR = MAX( ERR, ERRI )+         IF( ERR*SQRT( EPS ).GE.RONE )+     $      GO TO 60+   50 CONTINUE+*     If the loop completes, all results are at least half accurate.+      GO TO 80+*+*     Report fatal error.+*+   60 FATAL = .TRUE.+      WRITE( NOUT, FMT = 9999 )+      DO 70 I = 1, ML+         IF( MV )THEN+            WRITE( NOUT, FMT = 9998 )I, YT( I ),+     $         YY( 1 + ( I - 1 )*ABS( INCY ) )+         ELSE+            WRITE( NOUT, FMT = 9998 )I,+     $         YY( 1 + ( I - 1 )*ABS( INCY ) ), YT( I )+         END IF+   70 CONTINUE+*+   80 CONTINUE+      RETURN+*+ 9999 FORMAT( ' ******* FATAL ERROR - COMPUTED RESULT IS LESS THAN HAL',+     $      'F ACCURATE *******', /'                       EXPECTED RE',+     $      'SULT                    COMPUTED RESULT' )+ 9998 FORMAT( 1X, I7, 2( '  (', G15.6, ',', G15.6, ')' ) )+*+*     End of ZMVCH.+*+      END+      LOGICAL FUNCTION LZE( RI, RJ, LR )+*+*  Tests if two arrays are identical.+*+*  Auxiliary routine for test program for Level 2 Blas.+*+*  -- Written on 10-August-1987.+*     Richard Hanson, Sandia National Labs.+*     Jeremy Du Croz, NAG Central Office.+*+*     .. Scalar Arguments ..+      INTEGER            LR+*     .. Array Arguments ..+      COMPLEX*16         RI( * ), RJ( * )+*     .. Local Scalars ..+      INTEGER            I+*     .. Executable Statements ..+      DO 10 I = 1, LR+         IF( RI( I ).NE.RJ( I ) )+     $      GO TO 20+   10 CONTINUE+      LZE = .TRUE.+      GO TO 30+   20 CONTINUE+      LZE = .FALSE.+   30 RETURN+*+*     End of LZE.+*+      END+      LOGICAL FUNCTION LZERES( TYPE, UPLO, M, N, AA, AS, LDA )+*+*  Tests if selected elements in two arrays are equal.+*+*  TYPE is 'GE', 'HE' or 'HP'.+*+*  Auxiliary routine for test program for Level 2 Blas.+*+*  -- Written on 10-August-1987.+*     Richard Hanson, Sandia National Labs.+*     Jeremy Du Croz, NAG Central Office.+*+*     .. Scalar Arguments ..+      INTEGER            LDA, M, N+      CHARACTER*1        UPLO+      CHARACTER*2        TYPE+*     .. Array Arguments ..+      COMPLEX*16         AA( LDA, * ), AS( LDA, * )+*     .. Local Scalars ..+      INTEGER            I, IBEG, IEND, J+      LOGICAL            UPPER+*     .. Executable Statements ..+      UPPER = UPLO.EQ.'U'+      IF( TYPE.EQ.'GE' )THEN+         DO 20 J = 1, N+            DO 10 I = M + 1, LDA+               IF( AA( I, J ).NE.AS( I, J ) )+     $            GO TO 70+   10       CONTINUE+   20    CONTINUE+      ELSE IF( TYPE.EQ.'HE' )THEN+         DO 50 J = 1, N+            IF( UPPER )THEN+               IBEG = 1+               IEND = J+            ELSE+               IBEG = J+               IEND = N+            END IF+            DO 30 I = 1, IBEG - 1+               IF( AA( I, J ).NE.AS( I, J ) )+     $            GO TO 70+   30       CONTINUE+            DO 40 I = IEND + 1, LDA+               IF( AA( I, J ).NE.AS( I, J ) )+     $            GO TO 70+   40       CONTINUE+   50    CONTINUE+      END IF+*+      LZERES = .TRUE.+      GO TO 80+   70 CONTINUE+      LZERES = .FALSE.+   80 RETURN+*+*     End of LZERES.+*+      END+      COMPLEX*16 FUNCTION ZBEG( RESET )+*+*  Generates complex numbers as pairs of random numbers uniformly+*  distributed between -0.5 and 0.5.+*+*  Auxiliary routine for test program for Level 2 Blas.+*+*  -- Written on 10-August-1987.+*     Richard Hanson, Sandia National Labs.+*     Jeremy Du Croz, NAG Central Office.+*+*     .. Scalar Arguments ..+      LOGICAL            RESET+*     .. Local Scalars ..+      INTEGER            I, IC, J, MI, MJ+*     .. Save statement ..+      SAVE               I, IC, J, MI, MJ+*     .. Intrinsic Functions ..+      INTRINSIC          DCMPLX+*     .. Executable Statements ..+      IF( RESET )THEN+*        Initialize local variables.+         MI = 891+         MJ = 457+         I = 7+         J = 7+         IC = 0+         RESET = .FALSE.+      END IF+*+*     The sequence of values of I or J is bounded between 1 and 999.+*     If initial I or J = 1,2,3,6,7 or 9, the period will be 50.+*     If initial I or J = 4 or 8, the period will be 25.+*     If initial I or J = 5, the period will be 10.+*     IC is used to break up the period by skipping 1 value of I or J+*     in 6.+*+      IC = IC + 1+   10 I = I*MI+      J = J*MJ+      I = I - 1000*( I/1000 )+      J = J - 1000*( J/1000 )+      IF( IC.GE.5 )THEN+         IC = 0+         GO TO 10+      END IF+      ZBEG = DCMPLX( ( I - 500 )/1001.0D0, ( J - 500 )/1001.0D0 )+      RETURN+*+*     End of ZBEG.+*+      END+      DOUBLE PRECISION FUNCTION DDIFF( X, Y )+*+*  Auxiliary routine for test program for Level 2 Blas.+*+*  -- Written on 10-August-1987.+*     Richard Hanson, Sandia National Labs.+*+*     .. Scalar Arguments ..+      DOUBLE PRECISION   X, Y+*     .. Executable Statements ..+      DDIFF = X - Y+      RETURN+*+*     End of DDIFF.+*+      END+      SUBROUTINE CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+*+*  Tests whether XERBLA has detected an error when it should.+*+*  Auxiliary routine for test program for Level 2 Blas.+*+*  -- Written on 10-August-1987.+*     Richard Hanson, Sandia National Labs.+*     Jeremy Du Croz, NAG Central Office.+*+*     .. Scalar Arguments ..+      INTEGER            INFOT, NOUT+      LOGICAL            LERR, OK+      CHARACTER*6        SRNAMT+*     .. Executable Statements ..+      IF( .NOT.LERR )THEN+         WRITE( NOUT, FMT = 9999 )INFOT, SRNAMT+         OK = .FALSE.+      END IF+      LERR = .FALSE.+      RETURN+*+ 9999 FORMAT( ' ***** ILLEGAL VALUE OF PARAMETER NUMBER ', I2, ' NOT D',+     $      'ETECTED BY ', A6, ' *****' )+*+*     End of CHKXER.+*+      END+      SUBROUTINE XERBLA( SRNAME, INFO )+*+*  This is a special version of XERBLA to be used only as part of+*  the test program for testing error exits from the Level 2 BLAS+*  routines.+*+*  XERBLA  is an error handler for the Level 2 BLAS routines.+*+*  It is called by the Level 2 BLAS routines if an input parameter is+*  invalid.+*+*  Auxiliary routine for test program for Level 2 Blas.+*+*  -- Written on 10-August-1987.+*     Richard Hanson, Sandia National Labs.+*     Jeremy Du Croz, NAG Central Office.+*+*     .. Scalar Arguments ..+      INTEGER            INFO+      CHARACTER*6        SRNAME+*     .. Scalars in Common ..+      INTEGER            INFOT, NOUT+      LOGICAL            LERR, OK+      CHARACTER*6        SRNAMT+*     .. Common blocks ..+      COMMON             /INFOC/INFOT, NOUT, OK, LERR+      COMMON             /SRNAMC/SRNAMT+*     .. Executable Statements ..+      LERR = .TRUE.+      IF( INFO.NE.INFOT )THEN+         IF( INFOT.NE.0 )THEN+            WRITE( NOUT, FMT = 9999 )INFO, INFOT+         ELSE+            WRITE( NOUT, FMT = 9997 )INFO+         END IF+         OK = .FALSE.+      END IF+      IF( SRNAME.NE.SRNAMT )THEN+         WRITE( NOUT, FMT = 9998 )SRNAME, SRNAMT+         OK = .FALSE.+      END IF+      RETURN+*+ 9999 FORMAT( ' ******* XERBLA WAS CALLED WITH INFO = ', I6, ' INSTEAD',+     $      ' OF ', I2, ' *******' )+ 9998 FORMAT( ' ******* XERBLA WAS CALLED WITH SRNAME = ', A6, ' INSTE',+     $      'AD OF ', A6, ' *******' )+ 9997 FORMAT( ' ******* XERBLA WAS CALLED WITH INFO = ', I6,+     $      ' *******' )+*+*     End of XERBLA+*+      END+
+ eigen3/blas/testing/zblat3.dat view
@@ -0,0 +1,23 @@+'zblat3.summ'     NAME OF SUMMARY OUTPUT FILE+6                 UNIT NUMBER OF SUMMARY FILE+'zblat3.snap'     NAME OF SNAPSHOT OUTPUT FILE+-1                UNIT NUMBER OF SNAPSHOT FILE (NOT USED IF .LT. 0)+F        LOGICAL FLAG, T TO REWIND SNAPSHOT FILE AFTER EACH RECORD.+F        LOGICAL FLAG, T TO STOP ON FAILURES.+F        LOGICAL FLAG, T TO TEST ERROR EXITS.+16.0     THRESHOLD VALUE OF TEST RATIO+6                 NUMBER OF VALUES OF N+0 1 2 3 5 9       VALUES OF N+3                 NUMBER OF VALUES OF ALPHA+(0.0,0.0) (1.0,0.0) (0.7,-0.9)       VALUES OF ALPHA+3                 NUMBER OF VALUES OF BETA+(0.0,0.0) (1.0,0.0) (1.3,-1.1)       VALUES OF BETA+ZGEMM  T PUT F FOR NO TEST. SAME COLUMNS.+ZHEMM  T PUT F FOR NO TEST. SAME COLUMNS.+ZSYMM  T PUT F FOR NO TEST. SAME COLUMNS.+ZTRMM  T PUT F FOR NO TEST. SAME COLUMNS.+ZTRSM  T PUT F FOR NO TEST. SAME COLUMNS.+ZHERK  T PUT F FOR NO TEST. SAME COLUMNS.+ZSYRK  T PUT F FOR NO TEST. SAME COLUMNS.+ZHER2K T PUT F FOR NO TEST. SAME COLUMNS.+ZSYR2K T PUT F FOR NO TEST. SAME COLUMNS.
+ eigen3/blas/testing/zblat3.f view
@@ -0,0 +1,3502 @@+*> \brief \b ZBLAT3+*+*  =========== DOCUMENTATION ===========+*+* Online html documentation available at +*            http://www.netlib.org/lapack/explore-html/ +*+*  Definition:+*  ===========+*+*       PROGRAM ZBLAT3+* +*+*> \par Purpose:+*  =============+*>+*> \verbatim+*>+*> Test program for the COMPLEX*16       Level 3 Blas.+*>+*> The program must be driven by a short data file. The first 14 records+*> of the file are read using list-directed input, the last 9 records+*> are read using the format ( A6, L2 ). An annotated example of a data+*> file can be obtained by deleting the first 3 characters from the+*> following 23 lines:+*> 'zblat3.out'      NAME OF SUMMARY OUTPUT FILE+*> 6                 UNIT NUMBER OF SUMMARY FILE+*> 'ZBLAT3.SNAP'     NAME OF SNAPSHOT OUTPUT FILE+*> -1                UNIT NUMBER OF SNAPSHOT FILE (NOT USED IF .LT. 0)+*> F        LOGICAL FLAG, T TO REWIND SNAPSHOT FILE AFTER EACH RECORD.+*> F        LOGICAL FLAG, T TO STOP ON FAILURES.+*> T        LOGICAL FLAG, T TO TEST ERROR EXITS.+*> 16.0     THRESHOLD VALUE OF TEST RATIO+*> 6                 NUMBER OF VALUES OF N+*> 0 1 2 3 5 9       VALUES OF N+*> 3                 NUMBER OF VALUES OF ALPHA+*> (0.0,0.0) (1.0,0.0) (0.7,-0.9)       VALUES OF ALPHA+*> 3                 NUMBER OF VALUES OF BETA+*> (0.0,0.0) (1.0,0.0) (1.3,-1.1)       VALUES OF BETA+*> ZGEMM  T PUT F FOR NO TEST. SAME COLUMNS.+*> ZHEMM  T PUT F FOR NO TEST. SAME COLUMNS.+*> ZSYMM  T PUT F FOR NO TEST. SAME COLUMNS.+*> ZTRMM  T PUT F FOR NO TEST. SAME COLUMNS.+*> ZTRSM  T PUT F FOR NO TEST. SAME COLUMNS.+*> ZHERK  T PUT F FOR NO TEST. SAME COLUMNS.+*> ZSYRK  T PUT F FOR NO TEST. SAME COLUMNS.+*> ZHER2K T PUT F FOR NO TEST. SAME COLUMNS.+*> ZSYR2K T PUT F FOR NO TEST. SAME COLUMNS.+*>+*> +*> Further Details+*> ===============+*>+*> See:+*>+*>    Dongarra J. J., Du Croz J. J., Duff I. S. and Hammarling S.+*>    A Set of Level 3 Basic Linear Algebra Subprograms.+*>+*>    Technical Memorandum No.88 (Revision 1), Mathematics and+*>    Computer Science Division, Argonne National Laboratory, 9700+*>    South Cass Avenue, Argonne, Illinois 60439, US.+*>+*> -- Written on 8-February-1989.+*>    Jack Dongarra, Argonne National Laboratory.+*>    Iain Duff, AERE Harwell.+*>    Jeremy Du Croz, Numerical Algorithms Group Ltd.+*>    Sven Hammarling, Numerical Algorithms Group Ltd.+*>+*>    10-9-00:  Change STATUS='NEW' to 'UNKNOWN' so that the testers+*>              can be run multiple times without deleting generated+*>              output files (susan)+*> \endverbatim+*+*  Authors:+*  ========+*+*> \author Univ. of Tennessee +*> \author Univ. of California Berkeley +*> \author Univ. of Colorado Denver +*> \author NAG Ltd. +*+*> \date April 2012+*+*> \ingroup complex16_blas_testing+*+*  =====================================================================+      PROGRAM ZBLAT3+*+*  -- Reference BLAS test routine (version 3.4.1) --+*  -- Reference BLAS is a software package provided by Univ. of Tennessee,    --+*  -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--+*     April 2012+*+*  =====================================================================+*+*     .. Parameters ..+      INTEGER            NIN+      PARAMETER          ( NIN = 5 )+      INTEGER            NSUBS+      PARAMETER          ( NSUBS = 9 )+      COMPLEX*16         ZERO, ONE+      PARAMETER          ( ZERO = ( 0.0D0, 0.0D0 ),+     $                   ONE = ( 1.0D0, 0.0D0 ) )+      DOUBLE PRECISION   RZERO+      PARAMETER          ( RZERO = 0.0D0 )+      INTEGER            NMAX+      PARAMETER          ( NMAX = 65 )+      INTEGER            NIDMAX, NALMAX, NBEMAX+      PARAMETER          ( NIDMAX = 9, NALMAX = 7, NBEMAX = 7 )+*     .. Local Scalars ..+      DOUBLE PRECISION   EPS, ERR, THRESH+      INTEGER            I, ISNUM, J, N, NALF, NBET, NIDIM, NOUT, NTRA+      LOGICAL            FATAL, LTESTT, REWI, SAME, SFATAL, TRACE,+     $                   TSTERR+      CHARACTER*1        TRANSA, TRANSB+      CHARACTER*6        SNAMET+      CHARACTER*32       SNAPS, SUMMRY+*     .. Local Arrays ..+      COMPLEX*16         AA( NMAX*NMAX ), AB( NMAX, 2*NMAX ),+     $                   ALF( NALMAX ), AS( NMAX*NMAX ),+     $                   BB( NMAX*NMAX ), BET( NBEMAX ),+     $                   BS( NMAX*NMAX ), C( NMAX, NMAX ),+     $                   CC( NMAX*NMAX ), CS( NMAX*NMAX ), CT( NMAX ),+     $                   W( 2*NMAX )+      DOUBLE PRECISION   G( NMAX )+      INTEGER            IDIM( NIDMAX )+      LOGICAL            LTEST( NSUBS )+      CHARACTER*6        SNAMES( NSUBS )+*     .. External Functions ..+      DOUBLE PRECISION   DDIFF+      LOGICAL            LZE+      EXTERNAL           DDIFF, LZE+*     .. External Subroutines ..+      EXTERNAL           ZCHK1, ZCHK2, ZCHK3, ZCHK4, ZCHK5, ZCHKE, ZMMCH+*     .. Intrinsic Functions ..+      INTRINSIC          MAX, MIN+*     .. Scalars in Common ..+      INTEGER            INFOT, NOUTC+      LOGICAL            LERR, OK+      CHARACTER*6        SRNAMT+*     .. Common blocks ..+      COMMON             /INFOC/INFOT, NOUTC, OK, LERR+      COMMON             /SRNAMC/SRNAMT+*     .. Data statements ..+      DATA               SNAMES/'ZGEMM ', 'ZHEMM ', 'ZSYMM ', 'ZTRMM ',+     $                   'ZTRSM ', 'ZHERK ', 'ZSYRK ', 'ZHER2K',+     $                   'ZSYR2K'/+*     .. Executable Statements ..+*+*     Read name and unit number for summary output file and open file.+*+      READ( NIN, FMT = * )SUMMRY+      READ( NIN, FMT = * )NOUT+      OPEN( NOUT, FILE = SUMMRY, STATUS = 'UNKNOWN' )+      NOUTC = NOUT+*+*     Read name and unit number for snapshot output file and open file.+*+      READ( NIN, FMT = * )SNAPS+      READ( NIN, FMT = * )NTRA+      TRACE = NTRA.GE.0+      IF( TRACE )THEN+         OPEN( NTRA, FILE = SNAPS, STATUS = 'UNKNOWN' )+      END IF+*     Read the flag that directs rewinding of the snapshot file.+      READ( NIN, FMT = * )REWI+      REWI = REWI.AND.TRACE+*     Read the flag that directs stopping on any failure.+      READ( NIN, FMT = * )SFATAL+*     Read the flag that indicates whether error exits are to be tested.+      READ( NIN, FMT = * )TSTERR+*     Read the threshold value of the test ratio+      READ( NIN, FMT = * )THRESH+*+*     Read and check the parameter values for the tests.+*+*     Values of N+      READ( NIN, FMT = * )NIDIM+      IF( NIDIM.LT.1.OR.NIDIM.GT.NIDMAX )THEN+         WRITE( NOUT, FMT = 9997 )'N', NIDMAX+         GO TO 220+      END IF+      READ( NIN, FMT = * )( IDIM( I ), I = 1, NIDIM )+      DO 10 I = 1, NIDIM+         IF( IDIM( I ).LT.0.OR.IDIM( I ).GT.NMAX )THEN+            WRITE( NOUT, FMT = 9996 )NMAX+            GO TO 220+         END IF+   10 CONTINUE+*     Values of ALPHA+      READ( NIN, FMT = * )NALF+      IF( NALF.LT.1.OR.NALF.GT.NALMAX )THEN+         WRITE( NOUT, FMT = 9997 )'ALPHA', NALMAX+         GO TO 220+      END IF+      READ( NIN, FMT = * )( ALF( I ), I = 1, NALF )+*     Values of BETA+      READ( NIN, FMT = * )NBET+      IF( NBET.LT.1.OR.NBET.GT.NBEMAX )THEN+         WRITE( NOUT, FMT = 9997 )'BETA', NBEMAX+         GO TO 220+      END IF+      READ( NIN, FMT = * )( BET( I ), I = 1, NBET )+*+*     Report values of parameters.+*+      WRITE( NOUT, FMT = 9995 )+      WRITE( NOUT, FMT = 9994 )( IDIM( I ), I = 1, NIDIM )+      WRITE( NOUT, FMT = 9993 )( ALF( I ), I = 1, NALF )+      WRITE( NOUT, FMT = 9992 )( BET( I ), I = 1, NBET )+      IF( .NOT.TSTERR )THEN+         WRITE( NOUT, FMT = * )+         WRITE( NOUT, FMT = 9984 )+      END IF+      WRITE( NOUT, FMT = * )+      WRITE( NOUT, FMT = 9999 )THRESH+      WRITE( NOUT, FMT = * )+*+*     Read names of subroutines and flags which indicate+*     whether they are to be tested.+*+      DO 20 I = 1, NSUBS+         LTEST( I ) = .FALSE.+   20 CONTINUE+   30 READ( NIN, FMT = 9988, END = 60 )SNAMET, LTESTT+      DO 40 I = 1, NSUBS+         IF( SNAMET.EQ.SNAMES( I ) )+     $      GO TO 50+   40 CONTINUE+      WRITE( NOUT, FMT = 9990 )SNAMET+      STOP+   50 LTEST( I ) = LTESTT+      GO TO 30+*+   60 CONTINUE+      CLOSE ( NIN )+*+*     Compute EPS (the machine precision).+*+      EPS = EPSILON(RZERO)+      WRITE( NOUT, FMT = 9998 )EPS+*+*     Check the reliability of ZMMCH using exact data.+*+      N = MIN( 32, NMAX )+      DO 100 J = 1, N+         DO 90 I = 1, N+            AB( I, J ) = MAX( I - J + 1, 0 )+   90    CONTINUE+         AB( J, NMAX + 1 ) = J+         AB( 1, NMAX + J ) = J+         C( J, 1 ) = ZERO+  100 CONTINUE+      DO 110 J = 1, N+         CC( J ) = J*( ( J + 1 )*J )/2 - ( ( J + 1 )*J*( J - 1 ) )/3+  110 CONTINUE+*     CC holds the exact result. On exit from ZMMCH CT holds+*     the result computed by ZMMCH.+      TRANSA = 'N'+      TRANSB = 'N'+      CALL ZMMCH( TRANSA, TRANSB, N, 1, N, ONE, AB, NMAX,+     $            AB( 1, NMAX + 1 ), NMAX, ZERO, C, NMAX, CT, G, CC,+     $            NMAX, EPS, ERR, FATAL, NOUT, .TRUE. )+      SAME = LZE( CC, CT, N )+      IF( .NOT.SAME.OR.ERR.NE.RZERO )THEN+         WRITE( NOUT, FMT = 9989 )TRANSA, TRANSB, SAME, ERR+         STOP+      END IF+      TRANSB = 'C'+      CALL ZMMCH( TRANSA, TRANSB, N, 1, N, ONE, AB, NMAX,+     $            AB( 1, NMAX + 1 ), NMAX, ZERO, C, NMAX, CT, G, CC,+     $            NMAX, EPS, ERR, FATAL, NOUT, .TRUE. )+      SAME = LZE( CC, CT, N )+      IF( .NOT.SAME.OR.ERR.NE.RZERO )THEN+         WRITE( NOUT, FMT = 9989 )TRANSA, TRANSB, SAME, ERR+         STOP+      END IF+      DO 120 J = 1, N+         AB( J, NMAX + 1 ) = N - J + 1+         AB( 1, NMAX + J ) = N - J + 1+  120 CONTINUE+      DO 130 J = 1, N+         CC( N - J + 1 ) = J*( ( J + 1 )*J )/2 -+     $                     ( ( J + 1 )*J*( J - 1 ) )/3+  130 CONTINUE+      TRANSA = 'C'+      TRANSB = 'N'+      CALL ZMMCH( TRANSA, TRANSB, N, 1, N, ONE, AB, NMAX,+     $            AB( 1, NMAX + 1 ), NMAX, ZERO, C, NMAX, CT, G, CC,+     $            NMAX, EPS, ERR, FATAL, NOUT, .TRUE. )+      SAME = LZE( CC, CT, N )+      IF( .NOT.SAME.OR.ERR.NE.RZERO )THEN+         WRITE( NOUT, FMT = 9989 )TRANSA, TRANSB, SAME, ERR+         STOP+      END IF+      TRANSB = 'C'+      CALL ZMMCH( TRANSA, TRANSB, N, 1, N, ONE, AB, NMAX,+     $            AB( 1, NMAX + 1 ), NMAX, ZERO, C, NMAX, CT, G, CC,+     $            NMAX, EPS, ERR, FATAL, NOUT, .TRUE. )+      SAME = LZE( CC, CT, N )+      IF( .NOT.SAME.OR.ERR.NE.RZERO )THEN+         WRITE( NOUT, FMT = 9989 )TRANSA, TRANSB, SAME, ERR+         STOP+      END IF+*+*     Test each subroutine in turn.+*+      DO 200 ISNUM = 1, NSUBS+         WRITE( NOUT, FMT = * )+         IF( .NOT.LTEST( ISNUM ) )THEN+*           Subprogram is not to be tested.+            WRITE( NOUT, FMT = 9987 )SNAMES( ISNUM )+         ELSE+            SRNAMT = SNAMES( ISNUM )+*           Test error exits.+            IF( TSTERR )THEN+               CALL ZCHKE( ISNUM, SNAMES( ISNUM ), NOUT )+               WRITE( NOUT, FMT = * )+            END IF+*           Test computations.+            INFOT = 0+            OK = .TRUE.+            FATAL = .FALSE.+            GO TO ( 140, 150, 150, 160, 160, 170, 170,+     $              180, 180 )ISNUM+*           Test ZGEMM, 01.+  140       CALL ZCHK1( SNAMES( ISNUM ), EPS, THRESH, NOUT, NTRA, TRACE,+     $                  REWI, FATAL, NIDIM, IDIM, NALF, ALF, NBET, BET,+     $                  NMAX, AB, AA, AS, AB( 1, NMAX + 1 ), BB, BS, C,+     $                  CC, CS, CT, G )+            GO TO 190+*           Test ZHEMM, 02, ZSYMM, 03.+  150       CALL ZCHK2( SNAMES( ISNUM ), EPS, THRESH, NOUT, NTRA, TRACE,+     $                  REWI, FATAL, NIDIM, IDIM, NALF, ALF, NBET, BET,+     $                  NMAX, AB, AA, AS, AB( 1, NMAX + 1 ), BB, BS, C,+     $                  CC, CS, CT, G )+            GO TO 190+*           Test ZTRMM, 04, ZTRSM, 05.+  160       CALL ZCHK3( SNAMES( ISNUM ), EPS, THRESH, NOUT, NTRA, TRACE,+     $                  REWI, FATAL, NIDIM, IDIM, NALF, ALF, NMAX, AB,+     $                  AA, AS, AB( 1, NMAX + 1 ), BB, BS, CT, G, C )+            GO TO 190+*           Test ZHERK, 06, ZSYRK, 07.+  170       CALL ZCHK4( SNAMES( ISNUM ), EPS, THRESH, NOUT, NTRA, TRACE,+     $                  REWI, FATAL, NIDIM, IDIM, NALF, ALF, NBET, BET,+     $                  NMAX, AB, AA, AS, AB( 1, NMAX + 1 ), BB, BS, C,+     $                  CC, CS, CT, G )+            GO TO 190+*           Test ZHER2K, 08, ZSYR2K, 09.+  180       CALL ZCHK5( SNAMES( ISNUM ), EPS, THRESH, NOUT, NTRA, TRACE,+     $                  REWI, FATAL, NIDIM, IDIM, NALF, ALF, NBET, BET,+     $                  NMAX, AB, AA, AS, BB, BS, C, CC, CS, CT, G, W )+            GO TO 190+*+  190       IF( FATAL.AND.SFATAL )+     $         GO TO 210+         END IF+  200 CONTINUE+      WRITE( NOUT, FMT = 9986 )+      GO TO 230+*+  210 CONTINUE+      WRITE( NOUT, FMT = 9985 )+      GO TO 230+*+  220 CONTINUE+      WRITE( NOUT, FMT = 9991 )+*+  230 CONTINUE+      IF( TRACE )+     $   CLOSE ( NTRA )+      CLOSE ( NOUT )+      STOP+*+ 9999 FORMAT( ' ROUTINES PASS COMPUTATIONAL TESTS IF TEST RATIO IS LES',+     $      'S THAN', F8.2 )+ 9998 FORMAT( ' RELATIVE MACHINE PRECISION IS TAKEN TO BE', 1P, D9.1 )+ 9997 FORMAT( ' NUMBER OF VALUES OF ', A, ' IS LESS THAN 1 OR GREATER ',+     $      'THAN ', I2 )+ 9996 FORMAT( ' VALUE OF N IS LESS THAN 0 OR GREATER THAN ', I2 )+ 9995 FORMAT( ' TESTS OF THE COMPLEX*16       LEVEL 3 BLAS', //' THE F',+     $      'OLLOWING PARAMETER VALUES WILL BE USED:' )+ 9994 FORMAT( '   FOR N              ', 9I6 )+ 9993 FORMAT( '   FOR ALPHA          ',+     $      7( '(', F4.1, ',', F4.1, ')  ', : ) )+ 9992 FORMAT( '   FOR BETA           ',+     $      7( '(', F4.1, ',', F4.1, ')  ', : ) )+ 9991 FORMAT( ' AMEND DATA FILE OR INCREASE ARRAY SIZES IN PROGRAM',+     $      /' ******* TESTS ABANDONED *******' )+ 9990 FORMAT( ' SUBPROGRAM NAME ', A6, ' NOT RECOGNIZED', /' ******* T',+     $      'ESTS ABANDONED *******' )+ 9989 FORMAT( ' ERROR IN ZMMCH -  IN-LINE DOT PRODUCTS ARE BEING EVALU',+     $      'ATED WRONGLY.', /' ZMMCH WAS CALLED WITH TRANSA = ', A1,+     $      ' AND TRANSB = ', A1, /' AND RETURNED SAME = ', L1, ' AND ',+     $      'ERR = ', F12.3, '.', /' THIS MAY BE DUE TO FAULTS IN THE ',+     $      'ARITHMETIC OR THE COMPILER.', /' ******* TESTS ABANDONED ',+     $      '*******' )+ 9988 FORMAT( A6, L2 )+ 9987 FORMAT( 1X, A6, ' WAS NOT TESTED' )+ 9986 FORMAT( /' END OF TESTS' )+ 9985 FORMAT( /' ******* FATAL ERROR - TESTS ABANDONED *******' )+ 9984 FORMAT( ' ERROR-EXITS WILL NOT BE TESTED' )+*+*     End of ZBLAT3.+*+      END+      SUBROUTINE ZCHK1( SNAME, EPS, THRESH, NOUT, NTRA, TRACE, REWI,+     $                  FATAL, NIDIM, IDIM, NALF, ALF, NBET, BET, NMAX,+     $                  A, AA, AS, B, BB, BS, C, CC, CS, CT, G )+*+*  Tests ZGEMM.+*+*  Auxiliary routine for test program for Level 3 Blas.+*+*  -- Written on 8-February-1989.+*     Jack Dongarra, Argonne National Laboratory.+*     Iain Duff, AERE Harwell.+*     Jeremy Du Croz, Numerical Algorithms Group Ltd.+*     Sven Hammarling, Numerical Algorithms Group Ltd.+*+*     .. Parameters ..+      COMPLEX*16         ZERO+      PARAMETER          ( ZERO = ( 0.0D0, 0.0D0 ) )+      DOUBLE PRECISION   RZERO+      PARAMETER          ( RZERO = 0.0D0 )+*     .. Scalar Arguments ..+      DOUBLE PRECISION   EPS, THRESH+      INTEGER            NALF, NBET, NIDIM, NMAX, NOUT, NTRA+      LOGICAL            FATAL, REWI, TRACE+      CHARACTER*6        SNAME+*     .. Array Arguments ..+      COMPLEX*16         A( NMAX, NMAX ), AA( NMAX*NMAX ), ALF( NALF ),+     $                   AS( NMAX*NMAX ), B( NMAX, NMAX ),+     $                   BB( NMAX*NMAX ), BET( NBET ), BS( NMAX*NMAX ),+     $                   C( NMAX, NMAX ), CC( NMAX*NMAX ),+     $                   CS( NMAX*NMAX ), CT( NMAX )+      DOUBLE PRECISION   G( NMAX )+      INTEGER            IDIM( NIDIM )+*     .. Local Scalars ..+      COMPLEX*16         ALPHA, ALS, BETA, BLS+      DOUBLE PRECISION   ERR, ERRMAX+      INTEGER            I, IA, IB, ICA, ICB, IK, IM, IN, K, KS, LAA,+     $                   LBB, LCC, LDA, LDAS, LDB, LDBS, LDC, LDCS, M,+     $                   MA, MB, MS, N, NA, NARGS, NB, NC, NS+      LOGICAL            NULL, RESET, SAME, TRANA, TRANB+      CHARACTER*1        TRANAS, TRANBS, TRANSA, TRANSB+      CHARACTER*3        ICH+*     .. Local Arrays ..+      LOGICAL            ISAME( 13 )+*     .. External Functions ..+      LOGICAL            LZE, LZERES+      EXTERNAL           LZE, LZERES+*     .. External Subroutines ..+      EXTERNAL           ZGEMM, ZMAKE, ZMMCH+*     .. Intrinsic Functions ..+      INTRINSIC          MAX+*     .. Scalars in Common ..+      INTEGER            INFOT, NOUTC+      LOGICAL            LERR, OK+*     .. Common blocks ..+      COMMON             /INFOC/INFOT, NOUTC, OK, LERR+*     .. Data statements ..+      DATA               ICH/'NTC'/+*     .. Executable Statements ..+*+      NARGS = 13+      NC = 0+      RESET = .TRUE.+      ERRMAX = RZERO+*+      DO 110 IM = 1, NIDIM+         M = IDIM( IM )+*+         DO 100 IN = 1, NIDIM+            N = IDIM( IN )+*           Set LDC to 1 more than minimum value if room.+            LDC = M+            IF( LDC.LT.NMAX )+     $         LDC = LDC + 1+*           Skip tests if not enough room.+            IF( LDC.GT.NMAX )+     $         GO TO 100+            LCC = LDC*N+            NULL = N.LE.0.OR.M.LE.0+*+            DO 90 IK = 1, NIDIM+               K = IDIM( IK )+*+               DO 80 ICA = 1, 3+                  TRANSA = ICH( ICA: ICA )+                  TRANA = TRANSA.EQ.'T'.OR.TRANSA.EQ.'C'+*+                  IF( TRANA )THEN+                     MA = K+                     NA = M+                  ELSE+                     MA = M+                     NA = K+                  END IF+*                 Set LDA to 1 more than minimum value if room.+                  LDA = MA+                  IF( LDA.LT.NMAX )+     $               LDA = LDA + 1+*                 Skip tests if not enough room.+                  IF( LDA.GT.NMAX )+     $               GO TO 80+                  LAA = LDA*NA+*+*                 Generate the matrix A.+*+                  CALL ZMAKE( 'GE', ' ', ' ', MA, NA, A, NMAX, AA, LDA,+     $                        RESET, ZERO )+*+                  DO 70 ICB = 1, 3+                     TRANSB = ICH( ICB: ICB )+                     TRANB = TRANSB.EQ.'T'.OR.TRANSB.EQ.'C'+*+                     IF( TRANB )THEN+                        MB = N+                        NB = K+                     ELSE+                        MB = K+                        NB = N+                     END IF+*                    Set LDB to 1 more than minimum value if room.+                     LDB = MB+                     IF( LDB.LT.NMAX )+     $                  LDB = LDB + 1+*                    Skip tests if not enough room.+                     IF( LDB.GT.NMAX )+     $                  GO TO 70+                     LBB = LDB*NB+*+*                    Generate the matrix B.+*+                     CALL ZMAKE( 'GE', ' ', ' ', MB, NB, B, NMAX, BB,+     $                           LDB, RESET, ZERO )+*+                     DO 60 IA = 1, NALF+                        ALPHA = ALF( IA )+*+                        DO 50 IB = 1, NBET+                           BETA = BET( IB )+*+*                          Generate the matrix C.+*+                           CALL ZMAKE( 'GE', ' ', ' ', M, N, C, NMAX,+     $                                 CC, LDC, RESET, ZERO )+*+                           NC = NC + 1+*+*                          Save every datum before calling the+*                          subroutine.+*+                           TRANAS = TRANSA+                           TRANBS = TRANSB+                           MS = M+                           NS = N+                           KS = K+                           ALS = ALPHA+                           DO 10 I = 1, LAA+                              AS( I ) = AA( I )+   10                      CONTINUE+                           LDAS = LDA+                           DO 20 I = 1, LBB+                              BS( I ) = BB( I )+   20                      CONTINUE+                           LDBS = LDB+                           BLS = BETA+                           DO 30 I = 1, LCC+                              CS( I ) = CC( I )+   30                      CONTINUE+                           LDCS = LDC+*+*                          Call the subroutine.+*+                           IF( TRACE )+     $                        WRITE( NTRA, FMT = 9995 )NC, SNAME,+     $                        TRANSA, TRANSB, M, N, K, ALPHA, LDA, LDB,+     $                        BETA, LDC+                           IF( REWI )+     $                        REWIND NTRA+                           CALL ZGEMM( TRANSA, TRANSB, M, N, K, ALPHA,+     $                                 AA, LDA, BB, LDB, BETA, CC, LDC )+*+*                          Check if error-exit was taken incorrectly.+*+                           IF( .NOT.OK )THEN+                              WRITE( NOUT, FMT = 9994 )+                              FATAL = .TRUE.+                              GO TO 120+                           END IF+*+*                          See what data changed inside subroutines.+*+                           ISAME( 1 ) = TRANSA.EQ.TRANAS+                           ISAME( 2 ) = TRANSB.EQ.TRANBS+                           ISAME( 3 ) = MS.EQ.M+                           ISAME( 4 ) = NS.EQ.N+                           ISAME( 5 ) = KS.EQ.K+                           ISAME( 6 ) = ALS.EQ.ALPHA+                           ISAME( 7 ) = LZE( AS, AA, LAA )+                           ISAME( 8 ) = LDAS.EQ.LDA+                           ISAME( 9 ) = LZE( BS, BB, LBB )+                           ISAME( 10 ) = LDBS.EQ.LDB+                           ISAME( 11 ) = BLS.EQ.BETA+                           IF( NULL )THEN+                              ISAME( 12 ) = LZE( CS, CC, LCC )+                           ELSE+                              ISAME( 12 ) = LZERES( 'GE', ' ', M, N, CS,+     $                                      CC, LDC )+                           END IF+                           ISAME( 13 ) = LDCS.EQ.LDC+*+*                          If data was incorrectly changed, report+*                          and return.+*+                           SAME = .TRUE.+                           DO 40 I = 1, NARGS+                              SAME = SAME.AND.ISAME( I )+                              IF( .NOT.ISAME( I ) )+     $                           WRITE( NOUT, FMT = 9998 )I+   40                      CONTINUE+                           IF( .NOT.SAME )THEN+                              FATAL = .TRUE.+                              GO TO 120+                           END IF+*+                           IF( .NOT.NULL )THEN+*+*                             Check the result.+*+                              CALL ZMMCH( TRANSA, TRANSB, M, N, K,+     $                                    ALPHA, A, NMAX, B, NMAX, BETA,+     $                                    C, NMAX, CT, G, CC, LDC, EPS,+     $                                    ERR, FATAL, NOUT, .TRUE. )+                              ERRMAX = MAX( ERRMAX, ERR )+*                             If got really bad answer, report and+*                             return.+                              IF( FATAL )+     $                           GO TO 120+                           END IF+*+   50                   CONTINUE+*+   60                CONTINUE+*+   70             CONTINUE+*+   80          CONTINUE+*+   90       CONTINUE+*+  100    CONTINUE+*+  110 CONTINUE+*+*     Report result.+*+      IF( ERRMAX.LT.THRESH )THEN+         WRITE( NOUT, FMT = 9999 )SNAME, NC+      ELSE+         WRITE( NOUT, FMT = 9997 )SNAME, NC, ERRMAX+      END IF+      GO TO 130+*+  120 CONTINUE+      WRITE( NOUT, FMT = 9996 )SNAME+      WRITE( NOUT, FMT = 9995 )NC, SNAME, TRANSA, TRANSB, M, N, K,+     $   ALPHA, LDA, LDB, BETA, LDC+*+  130 CONTINUE+      RETURN+*+ 9999 FORMAT( ' ', A6, ' PASSED THE COMPUTATIONAL TESTS (', I6, ' CALL',+     $      'S)' )+ 9998 FORMAT( ' ******* FATAL ERROR - PARAMETER NUMBER ', I2, ' WAS CH',+     $      'ANGED INCORRECTLY *******' )+ 9997 FORMAT( ' ', A6, ' COMPLETED THE COMPUTATIONAL TESTS (', I6, ' C',+     $      'ALLS)', /' ******* BUT WITH MAXIMUM TEST RATIO', F8.2,+     $      ' - SUSPECT *******' )+ 9996 FORMAT( ' ******* ', A6, ' FAILED ON CALL NUMBER:' )+ 9995 FORMAT( 1X, I6, ': ', A6, '(''', A1, ''',''', A1, ''',',+     $      3( I3, ',' ), '(', F4.1, ',', F4.1, '), A,', I3, ', B,', I3,+     $      ',(', F4.1, ',', F4.1, '), C,', I3, ').' )+ 9994 FORMAT( ' ******* FATAL ERROR - ERROR-EXIT TAKEN ON VALID CALL *',+     $      '******' )+*+*     End of ZCHK1.+*+      END+      SUBROUTINE ZCHK2( SNAME, EPS, THRESH, NOUT, NTRA, TRACE, REWI,+     $                  FATAL, NIDIM, IDIM, NALF, ALF, NBET, BET, NMAX,+     $                  A, AA, AS, B, BB, BS, C, CC, CS, CT, G )+*+*  Tests ZHEMM and ZSYMM.+*+*  Auxiliary routine for test program for Level 3 Blas.+*+*  -- Written on 8-February-1989.+*     Jack Dongarra, Argonne National Laboratory.+*     Iain Duff, AERE Harwell.+*     Jeremy Du Croz, Numerical Algorithms Group Ltd.+*     Sven Hammarling, Numerical Algorithms Group Ltd.+*+*     .. Parameters ..+      COMPLEX*16         ZERO+      PARAMETER          ( ZERO = ( 0.0D0, 0.0D0 ) )+      DOUBLE PRECISION   RZERO+      PARAMETER          ( RZERO = 0.0D0 )+*     .. Scalar Arguments ..+      DOUBLE PRECISION   EPS, THRESH+      INTEGER            NALF, NBET, NIDIM, NMAX, NOUT, NTRA+      LOGICAL            FATAL, REWI, TRACE+      CHARACTER*6        SNAME+*     .. Array Arguments ..+      COMPLEX*16         A( NMAX, NMAX ), AA( NMAX*NMAX ), ALF( NALF ),+     $                   AS( NMAX*NMAX ), B( NMAX, NMAX ),+     $                   BB( NMAX*NMAX ), BET( NBET ), BS( NMAX*NMAX ),+     $                   C( NMAX, NMAX ), CC( NMAX*NMAX ),+     $                   CS( NMAX*NMAX ), CT( NMAX )+      DOUBLE PRECISION   G( NMAX )+      INTEGER            IDIM( NIDIM )+*     .. Local Scalars ..+      COMPLEX*16         ALPHA, ALS, BETA, BLS+      DOUBLE PRECISION   ERR, ERRMAX+      INTEGER            I, IA, IB, ICS, ICU, IM, IN, LAA, LBB, LCC,+     $                   LDA, LDAS, LDB, LDBS, LDC, LDCS, M, MS, N, NA,+     $                   NARGS, NC, NS+      LOGICAL            CONJ, LEFT, NULL, RESET, SAME+      CHARACTER*1        SIDE, SIDES, UPLO, UPLOS+      CHARACTER*2        ICHS, ICHU+*     .. Local Arrays ..+      LOGICAL            ISAME( 13 )+*     .. External Functions ..+      LOGICAL            LZE, LZERES+      EXTERNAL           LZE, LZERES+*     .. External Subroutines ..+      EXTERNAL           ZHEMM, ZMAKE, ZMMCH, ZSYMM+*     .. Intrinsic Functions ..+      INTRINSIC          MAX+*     .. Scalars in Common ..+      INTEGER            INFOT, NOUTC+      LOGICAL            LERR, OK+*     .. Common blocks ..+      COMMON             /INFOC/INFOT, NOUTC, OK, LERR+*     .. Data statements ..+      DATA               ICHS/'LR'/, ICHU/'UL'/+*     .. Executable Statements ..+      CONJ = SNAME( 2: 3 ).EQ.'HE'+*+      NARGS = 12+      NC = 0+      RESET = .TRUE.+      ERRMAX = RZERO+*+      DO 100 IM = 1, NIDIM+         M = IDIM( IM )+*+         DO 90 IN = 1, NIDIM+            N = IDIM( IN )+*           Set LDC to 1 more than minimum value if room.+            LDC = M+            IF( LDC.LT.NMAX )+     $         LDC = LDC + 1+*           Skip tests if not enough room.+            IF( LDC.GT.NMAX )+     $         GO TO 90+            LCC = LDC*N+            NULL = N.LE.0.OR.M.LE.0+*           Set LDB to 1 more than minimum value if room.+            LDB = M+            IF( LDB.LT.NMAX )+     $         LDB = LDB + 1+*           Skip tests if not enough room.+            IF( LDB.GT.NMAX )+     $         GO TO 90+            LBB = LDB*N+*+*           Generate the matrix B.+*+            CALL ZMAKE( 'GE', ' ', ' ', M, N, B, NMAX, BB, LDB, RESET,+     $                  ZERO )+*+            DO 80 ICS = 1, 2+               SIDE = ICHS( ICS: ICS )+               LEFT = SIDE.EQ.'L'+*+               IF( LEFT )THEN+                  NA = M+               ELSE+                  NA = N+               END IF+*              Set LDA to 1 more than minimum value if room.+               LDA = NA+               IF( LDA.LT.NMAX )+     $            LDA = LDA + 1+*              Skip tests if not enough room.+               IF( LDA.GT.NMAX )+     $            GO TO 80+               LAA = LDA*NA+*+               DO 70 ICU = 1, 2+                  UPLO = ICHU( ICU: ICU )+*+*                 Generate the hermitian or symmetric matrix A.+*+                  CALL ZMAKE( SNAME( 2: 3 ), UPLO, ' ', NA, NA, A, NMAX,+     $                        AA, LDA, RESET, ZERO )+*+                  DO 60 IA = 1, NALF+                     ALPHA = ALF( IA )+*+                     DO 50 IB = 1, NBET+                        BETA = BET( IB )+*+*                       Generate the matrix C.+*+                        CALL ZMAKE( 'GE', ' ', ' ', M, N, C, NMAX, CC,+     $                              LDC, RESET, ZERO )+*+                        NC = NC + 1+*+*                       Save every datum before calling the+*                       subroutine.+*+                        SIDES = SIDE+                        UPLOS = UPLO+                        MS = M+                        NS = N+                        ALS = ALPHA+                        DO 10 I = 1, LAA+                           AS( I ) = AA( I )+   10                   CONTINUE+                        LDAS = LDA+                        DO 20 I = 1, LBB+                           BS( I ) = BB( I )+   20                   CONTINUE+                        LDBS = LDB+                        BLS = BETA+                        DO 30 I = 1, LCC+                           CS( I ) = CC( I )+   30                   CONTINUE+                        LDCS = LDC+*+*                       Call the subroutine.+*+                        IF( TRACE )+     $                     WRITE( NTRA, FMT = 9995 )NC, SNAME, SIDE,+     $                     UPLO, M, N, ALPHA, LDA, LDB, BETA, LDC+                        IF( REWI )+     $                     REWIND NTRA+                        IF( CONJ )THEN+                           CALL ZHEMM( SIDE, UPLO, M, N, ALPHA, AA, LDA,+     $                                 BB, LDB, BETA, CC, LDC )+                        ELSE+                           CALL ZSYMM( SIDE, UPLO, M, N, ALPHA, AA, LDA,+     $                                 BB, LDB, BETA, CC, LDC )+                        END IF+*+*                       Check if error-exit was taken incorrectly.+*+                        IF( .NOT.OK )THEN+                           WRITE( NOUT, FMT = 9994 )+                           FATAL = .TRUE.+                           GO TO 110+                        END IF+*+*                       See what data changed inside subroutines.+*+                        ISAME( 1 ) = SIDES.EQ.SIDE+                        ISAME( 2 ) = UPLOS.EQ.UPLO+                        ISAME( 3 ) = MS.EQ.M+                        ISAME( 4 ) = NS.EQ.N+                        ISAME( 5 ) = ALS.EQ.ALPHA+                        ISAME( 6 ) = LZE( AS, AA, LAA )+                        ISAME( 7 ) = LDAS.EQ.LDA+                        ISAME( 8 ) = LZE( BS, BB, LBB )+                        ISAME( 9 ) = LDBS.EQ.LDB+                        ISAME( 10 ) = BLS.EQ.BETA+                        IF( NULL )THEN+                           ISAME( 11 ) = LZE( CS, CC, LCC )+                        ELSE+                           ISAME( 11 ) = LZERES( 'GE', ' ', M, N, CS,+     $                                   CC, LDC )+                        END IF+                        ISAME( 12 ) = LDCS.EQ.LDC+*+*                       If data was incorrectly changed, report and+*                       return.+*+                        SAME = .TRUE.+                        DO 40 I = 1, NARGS+                           SAME = SAME.AND.ISAME( I )+                           IF( .NOT.ISAME( I ) )+     $                        WRITE( NOUT, FMT = 9998 )I+   40                   CONTINUE+                        IF( .NOT.SAME )THEN+                           FATAL = .TRUE.+                           GO TO 110+                        END IF+*+                        IF( .NOT.NULL )THEN+*+*                          Check the result.+*+                           IF( LEFT )THEN+                              CALL ZMMCH( 'N', 'N', M, N, M, ALPHA, A,+     $                                    NMAX, B, NMAX, BETA, C, NMAX,+     $                                    CT, G, CC, LDC, EPS, ERR,+     $                                    FATAL, NOUT, .TRUE. )+                           ELSE+                              CALL ZMMCH( 'N', 'N', M, N, N, ALPHA, B,+     $                                    NMAX, A, NMAX, BETA, C, NMAX,+     $                                    CT, G, CC, LDC, EPS, ERR,+     $                                    FATAL, NOUT, .TRUE. )+                           END IF+                           ERRMAX = MAX( ERRMAX, ERR )+*                          If got really bad answer, report and+*                          return.+                           IF( FATAL )+     $                        GO TO 110+                        END IF+*+   50                CONTINUE+*+   60             CONTINUE+*+   70          CONTINUE+*+   80       CONTINUE+*+   90    CONTINUE+*+  100 CONTINUE+*+*     Report result.+*+      IF( ERRMAX.LT.THRESH )THEN+         WRITE( NOUT, FMT = 9999 )SNAME, NC+      ELSE+         WRITE( NOUT, FMT = 9997 )SNAME, NC, ERRMAX+      END IF+      GO TO 120+*+  110 CONTINUE+      WRITE( NOUT, FMT = 9996 )SNAME+      WRITE( NOUT, FMT = 9995 )NC, SNAME, SIDE, UPLO, M, N, ALPHA, LDA,+     $   LDB, BETA, LDC+*+  120 CONTINUE+      RETURN+*+ 9999 FORMAT( ' ', A6, ' PASSED THE COMPUTATIONAL TESTS (', I6, ' CALL',+     $      'S)' )+ 9998 FORMAT( ' ******* FATAL ERROR - PARAMETER NUMBER ', I2, ' WAS CH',+     $      'ANGED INCORRECTLY *******' )+ 9997 FORMAT( ' ', A6, ' COMPLETED THE COMPUTATIONAL TESTS (', I6, ' C',+     $      'ALLS)', /' ******* BUT WITH MAXIMUM TEST RATIO', F8.2,+     $      ' - SUSPECT *******' )+ 9996 FORMAT( ' ******* ', A6, ' FAILED ON CALL NUMBER:' )+ 9995 FORMAT( 1X, I6, ': ', A6, '(', 2( '''', A1, ''',' ), 2( I3, ',' ),+     $      '(', F4.1, ',', F4.1, '), A,', I3, ', B,', I3, ',(', F4.1,+     $      ',', F4.1, '), C,', I3, ')    .' )+ 9994 FORMAT( ' ******* FATAL ERROR - ERROR-EXIT TAKEN ON VALID CALL *',+     $      '******' )+*+*     End of ZCHK2.+*+      END+      SUBROUTINE ZCHK3( SNAME, EPS, THRESH, NOUT, NTRA, TRACE, REWI,+     $                  FATAL, NIDIM, IDIM, NALF, ALF, NMAX, A, AA, AS,+     $                  B, BB, BS, CT, G, C )+*+*  Tests ZTRMM and ZTRSM.+*+*  Auxiliary routine for test program for Level 3 Blas.+*+*  -- Written on 8-February-1989.+*     Jack Dongarra, Argonne National Laboratory.+*     Iain Duff, AERE Harwell.+*     Jeremy Du Croz, Numerical Algorithms Group Ltd.+*     Sven Hammarling, Numerical Algorithms Group Ltd.+*+*     .. Parameters ..+      COMPLEX*16         ZERO, ONE+      PARAMETER          ( ZERO = ( 0.0D0, 0.0D0 ),+     $                   ONE = ( 1.0D0, 0.0D0 ) )+      DOUBLE PRECISION   RZERO+      PARAMETER          ( RZERO = 0.0D0 )+*     .. Scalar Arguments ..+      DOUBLE PRECISION   EPS, THRESH+      INTEGER            NALF, NIDIM, NMAX, NOUT, NTRA+      LOGICAL            FATAL, REWI, TRACE+      CHARACTER*6        SNAME+*     .. Array Arguments ..+      COMPLEX*16         A( NMAX, NMAX ), AA( NMAX*NMAX ), ALF( NALF ),+     $                   AS( NMAX*NMAX ), B( NMAX, NMAX ),+     $                   BB( NMAX*NMAX ), BS( NMAX*NMAX ),+     $                   C( NMAX, NMAX ), CT( NMAX )+      DOUBLE PRECISION   G( NMAX )+      INTEGER            IDIM( NIDIM )+*     .. Local Scalars ..+      COMPLEX*16         ALPHA, ALS+      DOUBLE PRECISION   ERR, ERRMAX+      INTEGER            I, IA, ICD, ICS, ICT, ICU, IM, IN, J, LAA, LBB,+     $                   LDA, LDAS, LDB, LDBS, M, MS, N, NA, NARGS, NC,+     $                   NS+      LOGICAL            LEFT, NULL, RESET, SAME+      CHARACTER*1        DIAG, DIAGS, SIDE, SIDES, TRANAS, TRANSA, UPLO,+     $                   UPLOS+      CHARACTER*2        ICHD, ICHS, ICHU+      CHARACTER*3        ICHT+*     .. Local Arrays ..+      LOGICAL            ISAME( 13 )+*     .. External Functions ..+      LOGICAL            LZE, LZERES+      EXTERNAL           LZE, LZERES+*     .. External Subroutines ..+      EXTERNAL           ZMAKE, ZMMCH, ZTRMM, ZTRSM+*     .. Intrinsic Functions ..+      INTRINSIC          MAX+*     .. Scalars in Common ..+      INTEGER            INFOT, NOUTC+      LOGICAL            LERR, OK+*     .. Common blocks ..+      COMMON             /INFOC/INFOT, NOUTC, OK, LERR+*     .. Data statements ..+      DATA               ICHU/'UL'/, ICHT/'NTC'/, ICHD/'UN'/, ICHS/'LR'/+*     .. Executable Statements ..+*+      NARGS = 11+      NC = 0+      RESET = .TRUE.+      ERRMAX = RZERO+*     Set up zero matrix for ZMMCH.+      DO 20 J = 1, NMAX+         DO 10 I = 1, NMAX+            C( I, J ) = ZERO+   10    CONTINUE+   20 CONTINUE+*+      DO 140 IM = 1, NIDIM+         M = IDIM( IM )+*+         DO 130 IN = 1, NIDIM+            N = IDIM( IN )+*           Set LDB to 1 more than minimum value if room.+            LDB = M+            IF( LDB.LT.NMAX )+     $         LDB = LDB + 1+*           Skip tests if not enough room.+            IF( LDB.GT.NMAX )+     $         GO TO 130+            LBB = LDB*N+            NULL = M.LE.0.OR.N.LE.0+*+            DO 120 ICS = 1, 2+               SIDE = ICHS( ICS: ICS )+               LEFT = SIDE.EQ.'L'+               IF( LEFT )THEN+                  NA = M+               ELSE+                  NA = N+               END IF+*              Set LDA to 1 more than minimum value if room.+               LDA = NA+               IF( LDA.LT.NMAX )+     $            LDA = LDA + 1+*              Skip tests if not enough room.+               IF( LDA.GT.NMAX )+     $            GO TO 130+               LAA = LDA*NA+*+               DO 110 ICU = 1, 2+                  UPLO = ICHU( ICU: ICU )+*+                  DO 100 ICT = 1, 3+                     TRANSA = ICHT( ICT: ICT )+*+                     DO 90 ICD = 1, 2+                        DIAG = ICHD( ICD: ICD )+*+                        DO 80 IA = 1, NALF+                           ALPHA = ALF( IA )+*+*                          Generate the matrix A.+*+                           CALL ZMAKE( 'TR', UPLO, DIAG, NA, NA, A,+     $                                 NMAX, AA, LDA, RESET, ZERO )+*+*                          Generate the matrix B.+*+                           CALL ZMAKE( 'GE', ' ', ' ', M, N, B, NMAX,+     $                                 BB, LDB, RESET, ZERO )+*+                           NC = NC + 1+*+*                          Save every datum before calling the+*                          subroutine.+*+                           SIDES = SIDE+                           UPLOS = UPLO+                           TRANAS = TRANSA+                           DIAGS = DIAG+                           MS = M+                           NS = N+                           ALS = ALPHA+                           DO 30 I = 1, LAA+                              AS( I ) = AA( I )+   30                      CONTINUE+                           LDAS = LDA+                           DO 40 I = 1, LBB+                              BS( I ) = BB( I )+   40                      CONTINUE+                           LDBS = LDB+*+*                          Call the subroutine.+*+                           IF( SNAME( 4: 5 ).EQ.'MM' )THEN+                              IF( TRACE )+     $                           WRITE( NTRA, FMT = 9995 )NC, SNAME,+     $                           SIDE, UPLO, TRANSA, DIAG, M, N, ALPHA,+     $                           LDA, LDB+                              IF( REWI )+     $                           REWIND NTRA+                              CALL ZTRMM( SIDE, UPLO, TRANSA, DIAG, M,+     $                                    N, ALPHA, AA, LDA, BB, LDB )+                           ELSE IF( SNAME( 4: 5 ).EQ.'SM' )THEN+                              IF( TRACE )+     $                           WRITE( NTRA, FMT = 9995 )NC, SNAME,+     $                           SIDE, UPLO, TRANSA, DIAG, M, N, ALPHA,+     $                           LDA, LDB+                              IF( REWI )+     $                           REWIND NTRA+                              CALL ZTRSM( SIDE, UPLO, TRANSA, DIAG, M,+     $                                    N, ALPHA, AA, LDA, BB, LDB )+                           END IF+*+*                          Check if error-exit was taken incorrectly.+*+                           IF( .NOT.OK )THEN+                              WRITE( NOUT, FMT = 9994 )+                              FATAL = .TRUE.+                              GO TO 150+                           END IF+*+*                          See what data changed inside subroutines.+*+                           ISAME( 1 ) = SIDES.EQ.SIDE+                           ISAME( 2 ) = UPLOS.EQ.UPLO+                           ISAME( 3 ) = TRANAS.EQ.TRANSA+                           ISAME( 4 ) = DIAGS.EQ.DIAG+                           ISAME( 5 ) = MS.EQ.M+                           ISAME( 6 ) = NS.EQ.N+                           ISAME( 7 ) = ALS.EQ.ALPHA+                           ISAME( 8 ) = LZE( AS, AA, LAA )+                           ISAME( 9 ) = LDAS.EQ.LDA+                           IF( NULL )THEN+                              ISAME( 10 ) = LZE( BS, BB, LBB )+                           ELSE+                              ISAME( 10 ) = LZERES( 'GE', ' ', M, N, BS,+     $                                      BB, LDB )+                           END IF+                           ISAME( 11 ) = LDBS.EQ.LDB+*+*                          If data was incorrectly changed, report and+*                          return.+*+                           SAME = .TRUE.+                           DO 50 I = 1, NARGS+                              SAME = SAME.AND.ISAME( I )+                              IF( .NOT.ISAME( I ) )+     $                           WRITE( NOUT, FMT = 9998 )I+   50                      CONTINUE+                           IF( .NOT.SAME )THEN+                              FATAL = .TRUE.+                              GO TO 150+                           END IF+*+                           IF( .NOT.NULL )THEN+                              IF( SNAME( 4: 5 ).EQ.'MM' )THEN+*+*                                Check the result.+*+                                 IF( LEFT )THEN+                                    CALL ZMMCH( TRANSA, 'N', M, N, M,+     $                                          ALPHA, A, NMAX, B, NMAX,+     $                                          ZERO, C, NMAX, CT, G,+     $                                          BB, LDB, EPS, ERR,+     $                                          FATAL, NOUT, .TRUE. )+                                 ELSE+                                    CALL ZMMCH( 'N', TRANSA, M, N, N,+     $                                          ALPHA, B, NMAX, A, NMAX,+     $                                          ZERO, C, NMAX, CT, G,+     $                                          BB, LDB, EPS, ERR,+     $                                          FATAL, NOUT, .TRUE. )+                                 END IF+                              ELSE IF( SNAME( 4: 5 ).EQ.'SM' )THEN+*+*                                Compute approximation to original+*                                matrix.+*+                                 DO 70 J = 1, N+                                    DO 60 I = 1, M+                                       C( I, J ) = BB( I + ( J - 1 )*+     $                                             LDB )+                                       BB( I + ( J - 1 )*LDB ) = ALPHA*+     $                                    B( I, J )+   60                               CONTINUE+   70                            CONTINUE+*+                                 IF( LEFT )THEN+                                    CALL ZMMCH( TRANSA, 'N', M, N, M,+     $                                          ONE, A, NMAX, C, NMAX,+     $                                          ZERO, B, NMAX, CT, G,+     $                                          BB, LDB, EPS, ERR,+     $                                          FATAL, NOUT, .FALSE. )+                                 ELSE+                                    CALL ZMMCH( 'N', TRANSA, M, N, N,+     $                                          ONE, C, NMAX, A, NMAX,+     $                                          ZERO, B, NMAX, CT, G,+     $                                          BB, LDB, EPS, ERR,+     $                                          FATAL, NOUT, .FALSE. )+                                 END IF+                              END IF+                              ERRMAX = MAX( ERRMAX, ERR )+*                             If got really bad answer, report and+*                             return.+                              IF( FATAL )+     $                           GO TO 150+                           END IF+*+   80                   CONTINUE+*+   90                CONTINUE+*+  100             CONTINUE+*+  110          CONTINUE+*+  120       CONTINUE+*+  130    CONTINUE+*+  140 CONTINUE+*+*     Report result.+*+      IF( ERRMAX.LT.THRESH )THEN+         WRITE( NOUT, FMT = 9999 )SNAME, NC+      ELSE+         WRITE( NOUT, FMT = 9997 )SNAME, NC, ERRMAX+      END IF+      GO TO 160+*+  150 CONTINUE+      WRITE( NOUT, FMT = 9996 )SNAME+      WRITE( NOUT, FMT = 9995 )NC, SNAME, SIDE, UPLO, TRANSA, DIAG, M,+     $   N, ALPHA, LDA, LDB+*+  160 CONTINUE+      RETURN+*+ 9999 FORMAT( ' ', A6, ' PASSED THE COMPUTATIONAL TESTS (', I6, ' CALL',+     $      'S)' )+ 9998 FORMAT( ' ******* FATAL ERROR - PARAMETER NUMBER ', I2, ' WAS CH',+     $      'ANGED INCORRECTLY *******' )+ 9997 FORMAT( ' ', A6, ' COMPLETED THE COMPUTATIONAL TESTS (', I6, ' C',+     $      'ALLS)', /' ******* BUT WITH MAXIMUM TEST RATIO', F8.2,+     $      ' - SUSPECT *******' )+ 9996 FORMAT( ' ******* ', A6, ' FAILED ON CALL NUMBER:' )+ 9995 FORMAT( 1X, I6, ': ', A6, '(', 4( '''', A1, ''',' ), 2( I3, ',' ),+     $      '(', F4.1, ',', F4.1, '), A,', I3, ', B,', I3, ')         ',+     $      '      .' )+ 9994 FORMAT( ' ******* FATAL ERROR - ERROR-EXIT TAKEN ON VALID CALL *',+     $      '******' )+*+*     End of ZCHK3.+*+      END+      SUBROUTINE ZCHK4( SNAME, EPS, THRESH, NOUT, NTRA, TRACE, REWI,+     $                  FATAL, NIDIM, IDIM, NALF, ALF, NBET, BET, NMAX,+     $                  A, AA, AS, B, BB, BS, C, CC, CS, CT, G )+*+*  Tests ZHERK and ZSYRK.+*+*  Auxiliary routine for test program for Level 3 Blas.+*+*  -- Written on 8-February-1989.+*     Jack Dongarra, Argonne National Laboratory.+*     Iain Duff, AERE Harwell.+*     Jeremy Du Croz, Numerical Algorithms Group Ltd.+*     Sven Hammarling, Numerical Algorithms Group Ltd.+*+*     .. Parameters ..+      COMPLEX*16         ZERO+      PARAMETER          ( ZERO = ( 0.0D0, 0.0D0 ) )+      DOUBLE PRECISION   RONE, RZERO+      PARAMETER          ( RONE = 1.0D0, RZERO = 0.0D0 )+*     .. Scalar Arguments ..+      DOUBLE PRECISION   EPS, THRESH+      INTEGER            NALF, NBET, NIDIM, NMAX, NOUT, NTRA+      LOGICAL            FATAL, REWI, TRACE+      CHARACTER*6        SNAME+*     .. Array Arguments ..+      COMPLEX*16         A( NMAX, NMAX ), AA( NMAX*NMAX ), ALF( NALF ),+     $                   AS( NMAX*NMAX ), B( NMAX, NMAX ),+     $                   BB( NMAX*NMAX ), BET( NBET ), BS( NMAX*NMAX ),+     $                   C( NMAX, NMAX ), CC( NMAX*NMAX ),+     $                   CS( NMAX*NMAX ), CT( NMAX )+      DOUBLE PRECISION   G( NMAX )+      INTEGER            IDIM( NIDIM )+*     .. Local Scalars ..+      COMPLEX*16         ALPHA, ALS, BETA, BETS+      DOUBLE PRECISION   ERR, ERRMAX, RALPHA, RALS, RBETA, RBETS+      INTEGER            I, IA, IB, ICT, ICU, IK, IN, J, JC, JJ, K, KS,+     $                   LAA, LCC, LDA, LDAS, LDC, LDCS, LJ, MA, N, NA,+     $                   NARGS, NC, NS+      LOGICAL            CONJ, NULL, RESET, SAME, TRAN, UPPER+      CHARACTER*1        TRANS, TRANSS, TRANST, UPLO, UPLOS+      CHARACTER*2        ICHT, ICHU+*     .. Local Arrays ..+      LOGICAL            ISAME( 13 )+*     .. External Functions ..+      LOGICAL            LZE, LZERES+      EXTERNAL           LZE, LZERES+*     .. External Subroutines ..+      EXTERNAL           ZHERK, ZMAKE, ZMMCH, ZSYRK+*     .. Intrinsic Functions ..+      INTRINSIC          DCMPLX, MAX, DBLE+*     .. Scalars in Common ..+      INTEGER            INFOT, NOUTC+      LOGICAL            LERR, OK+*     .. Common blocks ..+      COMMON             /INFOC/INFOT, NOUTC, OK, LERR+*     .. Data statements ..+      DATA               ICHT/'NC'/, ICHU/'UL'/+*     .. Executable Statements ..+      CONJ = SNAME( 2: 3 ).EQ.'HE'+*+      NARGS = 10+      NC = 0+      RESET = .TRUE.+      ERRMAX = RZERO+*+      DO 100 IN = 1, NIDIM+         N = IDIM( IN )+*        Set LDC to 1 more than minimum value if room.+         LDC = N+         IF( LDC.LT.NMAX )+     $      LDC = LDC + 1+*        Skip tests if not enough room.+         IF( LDC.GT.NMAX )+     $      GO TO 100+         LCC = LDC*N+*+         DO 90 IK = 1, NIDIM+            K = IDIM( IK )+*+            DO 80 ICT = 1, 2+               TRANS = ICHT( ICT: ICT )+               TRAN = TRANS.EQ.'C'+               IF( TRAN.AND..NOT.CONJ )+     $            TRANS = 'T'+               IF( TRAN )THEN+                  MA = K+                  NA = N+               ELSE+                  MA = N+                  NA = K+               END IF+*              Set LDA to 1 more than minimum value if room.+               LDA = MA+               IF( LDA.LT.NMAX )+     $            LDA = LDA + 1+*              Skip tests if not enough room.+               IF( LDA.GT.NMAX )+     $            GO TO 80+               LAA = LDA*NA+*+*              Generate the matrix A.+*+               CALL ZMAKE( 'GE', ' ', ' ', MA, NA, A, NMAX, AA, LDA,+     $                     RESET, ZERO )+*+               DO 70 ICU = 1, 2+                  UPLO = ICHU( ICU: ICU )+                  UPPER = UPLO.EQ.'U'+*+                  DO 60 IA = 1, NALF+                     ALPHA = ALF( IA )+                     IF( CONJ )THEN+                        RALPHA = DBLE( ALPHA )+                        ALPHA = DCMPLX( RALPHA, RZERO )+                     END IF+*+                     DO 50 IB = 1, NBET+                        BETA = BET( IB )+                        IF( CONJ )THEN+                           RBETA = DBLE( BETA )+                           BETA = DCMPLX( RBETA, RZERO )+                        END IF+                        NULL = N.LE.0+                        IF( CONJ )+     $                     NULL = NULL.OR.( ( K.LE.0.OR.RALPHA.EQ.+     $                            RZERO ).AND.RBETA.EQ.RONE )+*+*                       Generate the matrix C.+*+                        CALL ZMAKE( SNAME( 2: 3 ), UPLO, ' ', N, N, C,+     $                              NMAX, CC, LDC, RESET, ZERO )+*+                        NC = NC + 1+*+*                       Save every datum before calling the subroutine.+*+                        UPLOS = UPLO+                        TRANSS = TRANS+                        NS = N+                        KS = K+                        IF( CONJ )THEN+                           RALS = RALPHA+                        ELSE+                           ALS = ALPHA+                        END IF+                        DO 10 I = 1, LAA+                           AS( I ) = AA( I )+   10                   CONTINUE+                        LDAS = LDA+                        IF( CONJ )THEN+                           RBETS = RBETA+                        ELSE+                           BETS = BETA+                        END IF+                        DO 20 I = 1, LCC+                           CS( I ) = CC( I )+   20                   CONTINUE+                        LDCS = LDC+*+*                       Call the subroutine.+*+                        IF( CONJ )THEN+                           IF( TRACE )+     $                        WRITE( NTRA, FMT = 9994 )NC, SNAME, UPLO,+     $                        TRANS, N, K, RALPHA, LDA, RBETA, LDC+                           IF( REWI )+     $                        REWIND NTRA+                           CALL ZHERK( UPLO, TRANS, N, K, RALPHA, AA,+     $                                 LDA, RBETA, CC, LDC )+                        ELSE+                           IF( TRACE )+     $                        WRITE( NTRA, FMT = 9993 )NC, SNAME, UPLO,+     $                        TRANS, N, K, ALPHA, LDA, BETA, LDC+                           IF( REWI )+     $                        REWIND NTRA+                           CALL ZSYRK( UPLO, TRANS, N, K, ALPHA, AA,+     $                                 LDA, BETA, CC, LDC )+                        END IF+*+*                       Check if error-exit was taken incorrectly.+*+                        IF( .NOT.OK )THEN+                           WRITE( NOUT, FMT = 9992 )+                           FATAL = .TRUE.+                           GO TO 120+                        END IF+*+*                       See what data changed inside subroutines.+*+                        ISAME( 1 ) = UPLOS.EQ.UPLO+                        ISAME( 2 ) = TRANSS.EQ.TRANS+                        ISAME( 3 ) = NS.EQ.N+                        ISAME( 4 ) = KS.EQ.K+                        IF( CONJ )THEN+                           ISAME( 5 ) = RALS.EQ.RALPHA+                        ELSE+                           ISAME( 5 ) = ALS.EQ.ALPHA+                        END IF+                        ISAME( 6 ) = LZE( AS, AA, LAA )+                        ISAME( 7 ) = LDAS.EQ.LDA+                        IF( CONJ )THEN+                           ISAME( 8 ) = RBETS.EQ.RBETA+                        ELSE+                           ISAME( 8 ) = BETS.EQ.BETA+                        END IF+                        IF( NULL )THEN+                           ISAME( 9 ) = LZE( CS, CC, LCC )+                        ELSE+                           ISAME( 9 ) = LZERES( SNAME( 2: 3 ), UPLO, N,+     $                                  N, CS, CC, LDC )+                        END IF+                        ISAME( 10 ) = LDCS.EQ.LDC+*+*                       If data was incorrectly changed, report and+*                       return.+*+                        SAME = .TRUE.+                        DO 30 I = 1, NARGS+                           SAME = SAME.AND.ISAME( I )+                           IF( .NOT.ISAME( I ) )+     $                        WRITE( NOUT, FMT = 9998 )I+   30                   CONTINUE+                        IF( .NOT.SAME )THEN+                           FATAL = .TRUE.+                           GO TO 120+                        END IF+*+                        IF( .NOT.NULL )THEN+*+*                          Check the result column by column.+*+                           IF( CONJ )THEN+                              TRANST = 'C'+                           ELSE+                              TRANST = 'T'+                           END IF+                           JC = 1+                           DO 40 J = 1, N+                              IF( UPPER )THEN+                                 JJ = 1+                                 LJ = J+                              ELSE+                                 JJ = J+                                 LJ = N - J + 1+                              END IF+                              IF( TRAN )THEN+                                 CALL ZMMCH( TRANST, 'N', LJ, 1, K,+     $                                       ALPHA, A( 1, JJ ), NMAX,+     $                                       A( 1, J ), NMAX, BETA,+     $                                       C( JJ, J ), NMAX, CT, G,+     $                                       CC( JC ), LDC, EPS, ERR,+     $                                       FATAL, NOUT, .TRUE. )+                              ELSE+                                 CALL ZMMCH( 'N', TRANST, LJ, 1, K,+     $                                       ALPHA, A( JJ, 1 ), NMAX,+     $                                       A( J, 1 ), NMAX, BETA,+     $                                       C( JJ, J ), NMAX, CT, G,+     $                                       CC( JC ), LDC, EPS, ERR,+     $                                       FATAL, NOUT, .TRUE. )+                              END IF+                              IF( UPPER )THEN+                                 JC = JC + LDC+                              ELSE+                                 JC = JC + LDC + 1+                              END IF+                              ERRMAX = MAX( ERRMAX, ERR )+*                             If got really bad answer, report and+*                             return.+                              IF( FATAL )+     $                           GO TO 110+   40                      CONTINUE+                        END IF+*+   50                CONTINUE+*+   60             CONTINUE+*+   70          CONTINUE+*+   80       CONTINUE+*+   90    CONTINUE+*+  100 CONTINUE+*+*     Report result.+*+      IF( ERRMAX.LT.THRESH )THEN+         WRITE( NOUT, FMT = 9999 )SNAME, NC+      ELSE+         WRITE( NOUT, FMT = 9997 )SNAME, NC, ERRMAX+      END IF+      GO TO 130+*+  110 CONTINUE+      IF( N.GT.1 )+     $   WRITE( NOUT, FMT = 9995 )J+*+  120 CONTINUE+      WRITE( NOUT, FMT = 9996 )SNAME+      IF( CONJ )THEN+         WRITE( NOUT, FMT = 9994 )NC, SNAME, UPLO, TRANS, N, K, RALPHA,+     $      LDA, RBETA, LDC+      ELSE+         WRITE( NOUT, FMT = 9993 )NC, SNAME, UPLO, TRANS, N, K, ALPHA,+     $      LDA, BETA, LDC+      END IF+*+  130 CONTINUE+      RETURN+*+ 9999 FORMAT( ' ', A6, ' PASSED THE COMPUTATIONAL TESTS (', I6, ' CALL',+     $      'S)' )+ 9998 FORMAT( ' ******* FATAL ERROR - PARAMETER NUMBER ', I2, ' WAS CH',+     $      'ANGED INCORRECTLY *******' )+ 9997 FORMAT( ' ', A6, ' COMPLETED THE COMPUTATIONAL TESTS (', I6, ' C',+     $      'ALLS)', /' ******* BUT WITH MAXIMUM TEST RATIO', F8.2,+     $      ' - SUSPECT *******' )+ 9996 FORMAT( ' ******* ', A6, ' FAILED ON CALL NUMBER:' )+ 9995 FORMAT( '      THESE ARE THE RESULTS FOR COLUMN ', I3 )+ 9994 FORMAT( 1X, I6, ': ', A6, '(', 2( '''', A1, ''',' ), 2( I3, ',' ),+     $      F4.1, ', A,', I3, ',', F4.1, ', C,', I3, ')               ',+     $      '          .' )+ 9993 FORMAT( 1X, I6, ': ', A6, '(', 2( '''', A1, ''',' ), 2( I3, ',' ),+     $      '(', F4.1, ',', F4.1, ') , A,', I3, ',(', F4.1, ',', F4.1,+     $      '), C,', I3, ')          .' )+ 9992 FORMAT( ' ******* FATAL ERROR - ERROR-EXIT TAKEN ON VALID CALL *',+     $      '******' )+*+*     End of ZCHK4.+*+      END+      SUBROUTINE ZCHK5( SNAME, EPS, THRESH, NOUT, NTRA, TRACE, REWI,+     $                  FATAL, NIDIM, IDIM, NALF, ALF, NBET, BET, NMAX,+     $                  AB, AA, AS, BB, BS, C, CC, CS, CT, G, W )+*+*  Tests ZHER2K and ZSYR2K.+*+*  Auxiliary routine for test program for Level 3 Blas.+*+*  -- Written on 8-February-1989.+*     Jack Dongarra, Argonne National Laboratory.+*     Iain Duff, AERE Harwell.+*     Jeremy Du Croz, Numerical Algorithms Group Ltd.+*     Sven Hammarling, Numerical Algorithms Group Ltd.+*+*     .. Parameters ..+      COMPLEX*16         ZERO, ONE+      PARAMETER          ( ZERO = ( 0.0D0, 0.0D0 ),+     $                   ONE = ( 1.0D0, 0.0D0 ) )+      DOUBLE PRECISION   RONE, RZERO+      PARAMETER          ( RONE = 1.0D0, RZERO = 0.0D0 )+*     .. Scalar Arguments ..+      DOUBLE PRECISION   EPS, THRESH+      INTEGER            NALF, NBET, NIDIM, NMAX, NOUT, NTRA+      LOGICAL            FATAL, REWI, TRACE+      CHARACTER*6        SNAME+*     .. Array Arguments ..+      COMPLEX*16         AA( NMAX*NMAX ), AB( 2*NMAX*NMAX ),+     $                   ALF( NALF ), AS( NMAX*NMAX ), BB( NMAX*NMAX ),+     $                   BET( NBET ), BS( NMAX*NMAX ), C( NMAX, NMAX ),+     $                   CC( NMAX*NMAX ), CS( NMAX*NMAX ), CT( NMAX ),+     $                   W( 2*NMAX )+      DOUBLE PRECISION   G( NMAX )+      INTEGER            IDIM( NIDIM )+*     .. Local Scalars ..+      COMPLEX*16         ALPHA, ALS, BETA, BETS+      DOUBLE PRECISION   ERR, ERRMAX, RBETA, RBETS+      INTEGER            I, IA, IB, ICT, ICU, IK, IN, J, JC, JJ, JJAB,+     $                   K, KS, LAA, LBB, LCC, LDA, LDAS, LDB, LDBS,+     $                   LDC, LDCS, LJ, MA, N, NA, NARGS, NC, NS+      LOGICAL            CONJ, NULL, RESET, SAME, TRAN, UPPER+      CHARACTER*1        TRANS, TRANSS, TRANST, UPLO, UPLOS+      CHARACTER*2        ICHT, ICHU+*     .. Local Arrays ..+      LOGICAL            ISAME( 13 )+*     .. External Functions ..+      LOGICAL            LZE, LZERES+      EXTERNAL           LZE, LZERES+*     .. External Subroutines ..+      EXTERNAL           ZHER2K, ZMAKE, ZMMCH, ZSYR2K+*     .. Intrinsic Functions ..+      INTRINSIC          DCMPLX, DCONJG, MAX, DBLE+*     .. Scalars in Common ..+      INTEGER            INFOT, NOUTC+      LOGICAL            LERR, OK+*     .. Common blocks ..+      COMMON             /INFOC/INFOT, NOUTC, OK, LERR+*     .. Data statements ..+      DATA               ICHT/'NC'/, ICHU/'UL'/+*     .. Executable Statements ..+      CONJ = SNAME( 2: 3 ).EQ.'HE'+*+      NARGS = 12+      NC = 0+      RESET = .TRUE.+      ERRMAX = RZERO+*+      DO 130 IN = 1, NIDIM+         N = IDIM( IN )+*        Set LDC to 1 more than minimum value if room.+         LDC = N+         IF( LDC.LT.NMAX )+     $      LDC = LDC + 1+*        Skip tests if not enough room.+         IF( LDC.GT.NMAX )+     $      GO TO 130+         LCC = LDC*N+*+         DO 120 IK = 1, NIDIM+            K = IDIM( IK )+*+            DO 110 ICT = 1, 2+               TRANS = ICHT( ICT: ICT )+               TRAN = TRANS.EQ.'C'+               IF( TRAN.AND..NOT.CONJ )+     $            TRANS = 'T'+               IF( TRAN )THEN+                  MA = K+                  NA = N+               ELSE+                  MA = N+                  NA = K+               END IF+*              Set LDA to 1 more than minimum value if room.+               LDA = MA+               IF( LDA.LT.NMAX )+     $            LDA = LDA + 1+*              Skip tests if not enough room.+               IF( LDA.GT.NMAX )+     $            GO TO 110+               LAA = LDA*NA+*+*              Generate the matrix A.+*+               IF( TRAN )THEN+                  CALL ZMAKE( 'GE', ' ', ' ', MA, NA, AB, 2*NMAX, AA,+     $                        LDA, RESET, ZERO )+               ELSE+                  CALL ZMAKE( 'GE', ' ', ' ', MA, NA, AB, NMAX, AA, LDA,+     $                        RESET, ZERO )+               END IF+*+*              Generate the matrix B.+*+               LDB = LDA+               LBB = LAA+               IF( TRAN )THEN+                  CALL ZMAKE( 'GE', ' ', ' ', MA, NA, AB( K + 1 ),+     $                        2*NMAX, BB, LDB, RESET, ZERO )+               ELSE+                  CALL ZMAKE( 'GE', ' ', ' ', MA, NA, AB( K*NMAX + 1 ),+     $                        NMAX, BB, LDB, RESET, ZERO )+               END IF+*+               DO 100 ICU = 1, 2+                  UPLO = ICHU( ICU: ICU )+                  UPPER = UPLO.EQ.'U'+*+                  DO 90 IA = 1, NALF+                     ALPHA = ALF( IA )+*+                     DO 80 IB = 1, NBET+                        BETA = BET( IB )+                        IF( CONJ )THEN+                           RBETA = DBLE( BETA )+                           BETA = DCMPLX( RBETA, RZERO )+                        END IF+                        NULL = N.LE.0+                        IF( CONJ )+     $                     NULL = NULL.OR.( ( K.LE.0.OR.ALPHA.EQ.+     $                            ZERO ).AND.RBETA.EQ.RONE )+*+*                       Generate the matrix C.+*+                        CALL ZMAKE( SNAME( 2: 3 ), UPLO, ' ', N, N, C,+     $                              NMAX, CC, LDC, RESET, ZERO )+*+                        NC = NC + 1+*+*                       Save every datum before calling the subroutine.+*+                        UPLOS = UPLO+                        TRANSS = TRANS+                        NS = N+                        KS = K+                        ALS = ALPHA+                        DO 10 I = 1, LAA+                           AS( I ) = AA( I )+   10                   CONTINUE+                        LDAS = LDA+                        DO 20 I = 1, LBB+                           BS( I ) = BB( I )+   20                   CONTINUE+                        LDBS = LDB+                        IF( CONJ )THEN+                           RBETS = RBETA+                        ELSE+                           BETS = BETA+                        END IF+                        DO 30 I = 1, LCC+                           CS( I ) = CC( I )+   30                   CONTINUE+                        LDCS = LDC+*+*                       Call the subroutine.+*+                        IF( CONJ )THEN+                           IF( TRACE )+     $                        WRITE( NTRA, FMT = 9994 )NC, SNAME, UPLO,+     $                        TRANS, N, K, ALPHA, LDA, LDB, RBETA, LDC+                           IF( REWI )+     $                        REWIND NTRA+                           CALL ZHER2K( UPLO, TRANS, N, K, ALPHA, AA,+     $                                  LDA, BB, LDB, RBETA, CC, LDC )+                        ELSE+                           IF( TRACE )+     $                        WRITE( NTRA, FMT = 9993 )NC, SNAME, UPLO,+     $                        TRANS, N, K, ALPHA, LDA, LDB, BETA, LDC+                           IF( REWI )+     $                        REWIND NTRA+                           CALL ZSYR2K( UPLO, TRANS, N, K, ALPHA, AA,+     $                                  LDA, BB, LDB, BETA, CC, LDC )+                        END IF+*+*                       Check if error-exit was taken incorrectly.+*+                        IF( .NOT.OK )THEN+                           WRITE( NOUT, FMT = 9992 )+                           FATAL = .TRUE.+                           GO TO 150+                        END IF+*+*                       See what data changed inside subroutines.+*+                        ISAME( 1 ) = UPLOS.EQ.UPLO+                        ISAME( 2 ) = TRANSS.EQ.TRANS+                        ISAME( 3 ) = NS.EQ.N+                        ISAME( 4 ) = KS.EQ.K+                        ISAME( 5 ) = ALS.EQ.ALPHA+                        ISAME( 6 ) = LZE( AS, AA, LAA )+                        ISAME( 7 ) = LDAS.EQ.LDA+                        ISAME( 8 ) = LZE( BS, BB, LBB )+                        ISAME( 9 ) = LDBS.EQ.LDB+                        IF( CONJ )THEN+                           ISAME( 10 ) = RBETS.EQ.RBETA+                        ELSE+                           ISAME( 10 ) = BETS.EQ.BETA+                        END IF+                        IF( NULL )THEN+                           ISAME( 11 ) = LZE( CS, CC, LCC )+                        ELSE+                           ISAME( 11 ) = LZERES( 'HE', UPLO, N, N, CS,+     $                                   CC, LDC )+                        END IF+                        ISAME( 12 ) = LDCS.EQ.LDC+*+*                       If data was incorrectly changed, report and+*                       return.+*+                        SAME = .TRUE.+                        DO 40 I = 1, NARGS+                           SAME = SAME.AND.ISAME( I )+                           IF( .NOT.ISAME( I ) )+     $                        WRITE( NOUT, FMT = 9998 )I+   40                   CONTINUE+                        IF( .NOT.SAME )THEN+                           FATAL = .TRUE.+                           GO TO 150+                        END IF+*+                        IF( .NOT.NULL )THEN+*+*                          Check the result column by column.+*+                           IF( CONJ )THEN+                              TRANST = 'C'+                           ELSE+                              TRANST = 'T'+                           END IF+                           JJAB = 1+                           JC = 1+                           DO 70 J = 1, N+                              IF( UPPER )THEN+                                 JJ = 1+                                 LJ = J+                              ELSE+                                 JJ = J+                                 LJ = N - J + 1+                              END IF+                              IF( TRAN )THEN+                                 DO 50 I = 1, K+                                    W( I ) = ALPHA*AB( ( J - 1 )*2*+     $                                       NMAX + K + I )+                                    IF( CONJ )THEN+                                       W( K + I ) = DCONJG( ALPHA )*+     $                                              AB( ( J - 1 )*2*+     $                                              NMAX + I )+                                    ELSE+                                       W( K + I ) = ALPHA*+     $                                              AB( ( J - 1 )*2*+     $                                              NMAX + I )+                                    END IF+   50                            CONTINUE+                                 CALL ZMMCH( TRANST, 'N', LJ, 1, 2*K,+     $                                       ONE, AB( JJAB ), 2*NMAX, W,+     $                                       2*NMAX, BETA, C( JJ, J ),+     $                                       NMAX, CT, G, CC( JC ), LDC,+     $                                       EPS, ERR, FATAL, NOUT,+     $                                       .TRUE. )+                              ELSE+                                 DO 60 I = 1, K+                                    IF( CONJ )THEN+                                       W( I ) = ALPHA*DCONJG( AB( ( K ++     $                                          I - 1 )*NMAX + J ) )+                                       W( K + I ) = DCONJG( ALPHA*+     $                                              AB( ( I - 1 )*NMAX ++     $                                              J ) )+                                    ELSE+                                       W( I ) = ALPHA*AB( ( K + I - 1 )*+     $                                          NMAX + J )+                                       W( K + I ) = ALPHA*+     $                                              AB( ( I - 1 )*NMAX ++     $                                              J )+                                    END IF+   60                            CONTINUE+                                 CALL ZMMCH( 'N', 'N', LJ, 1, 2*K, ONE,+     $                                       AB( JJ ), NMAX, W, 2*NMAX,+     $                                       BETA, C( JJ, J ), NMAX, CT,+     $                                       G, CC( JC ), LDC, EPS, ERR,+     $                                       FATAL, NOUT, .TRUE. )+                              END IF+                              IF( UPPER )THEN+                                 JC = JC + LDC+                              ELSE+                                 JC = JC + LDC + 1+                                 IF( TRAN )+     $                              JJAB = JJAB + 2*NMAX+                              END IF+                              ERRMAX = MAX( ERRMAX, ERR )+*                             If got really bad answer, report and+*                             return.+                              IF( FATAL )+     $                           GO TO 140+   70                      CONTINUE+                        END IF+*+   80                CONTINUE+*+   90             CONTINUE+*+  100          CONTINUE+*+  110       CONTINUE+*+  120    CONTINUE+*+  130 CONTINUE+*+*     Report result.+*+      IF( ERRMAX.LT.THRESH )THEN+         WRITE( NOUT, FMT = 9999 )SNAME, NC+      ELSE+         WRITE( NOUT, FMT = 9997 )SNAME, NC, ERRMAX+      END IF+      GO TO 160+*+  140 CONTINUE+      IF( N.GT.1 )+     $   WRITE( NOUT, FMT = 9995 )J+*+  150 CONTINUE+      WRITE( NOUT, FMT = 9996 )SNAME+      IF( CONJ )THEN+         WRITE( NOUT, FMT = 9994 )NC, SNAME, UPLO, TRANS, N, K, ALPHA,+     $      LDA, LDB, RBETA, LDC+      ELSE+         WRITE( NOUT, FMT = 9993 )NC, SNAME, UPLO, TRANS, N, K, ALPHA,+     $      LDA, LDB, BETA, LDC+      END IF+*+  160 CONTINUE+      RETURN+*+ 9999 FORMAT( ' ', A6, ' PASSED THE COMPUTATIONAL TESTS (', I6, ' CALL',+     $      'S)' )+ 9998 FORMAT( ' ******* FATAL ERROR - PARAMETER NUMBER ', I2, ' WAS CH',+     $      'ANGED INCORRECTLY *******' )+ 9997 FORMAT( ' ', A6, ' COMPLETED THE COMPUTATIONAL TESTS (', I6, ' C',+     $      'ALLS)', /' ******* BUT WITH MAXIMUM TEST RATIO', F8.2,+     $      ' - SUSPECT *******' )+ 9996 FORMAT( ' ******* ', A6, ' FAILED ON CALL NUMBER:' )+ 9995 FORMAT( '      THESE ARE THE RESULTS FOR COLUMN ', I3 )+ 9994 FORMAT( 1X, I6, ': ', A6, '(', 2( '''', A1, ''',' ), 2( I3, ',' ),+     $      '(', F4.1, ',', F4.1, '), A,', I3, ', B,', I3, ',', F4.1,+     $      ', C,', I3, ')           .' )+ 9993 FORMAT( 1X, I6, ': ', A6, '(', 2( '''', A1, ''',' ), 2( I3, ',' ),+     $      '(', F4.1, ',', F4.1, '), A,', I3, ', B,', I3, ',(', F4.1,+     $      ',', F4.1, '), C,', I3, ')    .' )+ 9992 FORMAT( ' ******* FATAL ERROR - ERROR-EXIT TAKEN ON VALID CALL *',+     $      '******' )+*+*     End of ZCHK5.+*+      END+      SUBROUTINE ZCHKE( ISNUM, SRNAMT, NOUT )+*+*  Tests the error exits from the Level 3 Blas.+*  Requires a special version of the error-handling routine XERBLA.+*  A, B and C should not need to be defined.+*+*  Auxiliary routine for test program for Level 3 Blas.+*+*  -- Written on 8-February-1989.+*     Jack Dongarra, Argonne National Laboratory.+*     Iain Duff, AERE Harwell.+*     Jeremy Du Croz, Numerical Algorithms Group Ltd.+*     Sven Hammarling, Numerical Algorithms Group Ltd.+*+*  3-19-92:  Initialize ALPHA, BETA, RALPHA, and RBETA  (eca)+*  3-19-92:  Fix argument 12 in calls to ZSYMM and ZHEMM+*            with INFOT = 9  (eca)+*  10-9-00:  Declared INTRINSIC DCMPLX (susan)+*+*     .. Scalar Arguments ..+      INTEGER            ISNUM, NOUT+      CHARACTER*6        SRNAMT+*     .. Scalars in Common ..+      INTEGER            INFOT, NOUTC+      LOGICAL            LERR, OK+*     .. Parameters ..+      REAL               ONE, TWO+      PARAMETER          ( ONE = 1.0D0, TWO = 2.0D0 )+*     .. Local Scalars ..+      COMPLEX*16         ALPHA, BETA+      DOUBLE PRECISION   RALPHA, RBETA+*     .. Local Arrays ..+      COMPLEX*16         A( 2, 1 ), B( 2, 1 ), C( 2, 1 )+*     .. External Subroutines ..+      EXTERNAL           ZGEMM, ZHEMM, ZHER2K, ZHERK, CHKXER, ZSYMM,+     $                   ZSYR2K, ZSYRK, ZTRMM, ZTRSM+*     .. Intrinsic Functions ..+      INTRINSIC          DCMPLX+*     .. Common blocks ..+      COMMON             /INFOC/INFOT, NOUTC, OK, LERR+*     .. Executable Statements ..+*     OK is set to .FALSE. by the special version of XERBLA or by CHKXER+*     if anything is wrong.+      OK = .TRUE.+*     LERR is set to .TRUE. by the special version of XERBLA each time+*     it is called, and is then tested and re-set by CHKXER.+      LERR = .FALSE.+*+*     Initialize ALPHA, BETA, RALPHA, and RBETA.+*+      ALPHA = DCMPLX( ONE, -ONE )+      BETA = DCMPLX( TWO, -TWO )+      RALPHA = ONE+      RBETA = TWO+*+      GO TO ( 10, 20, 30, 40, 50, 60, 70, 80,+     $        90 )ISNUM+   10 INFOT = 1+      CALL ZGEMM( '/', 'N', 0, 0, 0, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 1+      CALL ZGEMM( '/', 'C', 0, 0, 0, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 1+      CALL ZGEMM( '/', 'T', 0, 0, 0, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 2+      CALL ZGEMM( 'N', '/', 0, 0, 0, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 2+      CALL ZGEMM( 'C', '/', 0, 0, 0, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 2+      CALL ZGEMM( 'T', '/', 0, 0, 0, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 3+      CALL ZGEMM( 'N', 'N', -1, 0, 0, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 3+      CALL ZGEMM( 'N', 'C', -1, 0, 0, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 3+      CALL ZGEMM( 'N', 'T', -1, 0, 0, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 3+      CALL ZGEMM( 'C', 'N', -1, 0, 0, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 3+      CALL ZGEMM( 'C', 'C', -1, 0, 0, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 3+      CALL ZGEMM( 'C', 'T', -1, 0, 0, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 3+      CALL ZGEMM( 'T', 'N', -1, 0, 0, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 3+      CALL ZGEMM( 'T', 'C', -1, 0, 0, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 3+      CALL ZGEMM( 'T', 'T', -1, 0, 0, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 4+      CALL ZGEMM( 'N', 'N', 0, -1, 0, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 4+      CALL ZGEMM( 'N', 'C', 0, -1, 0, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 4+      CALL ZGEMM( 'N', 'T', 0, -1, 0, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 4+      CALL ZGEMM( 'C', 'N', 0, -1, 0, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 4+      CALL ZGEMM( 'C', 'C', 0, -1, 0, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 4+      CALL ZGEMM( 'C', 'T', 0, -1, 0, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 4+      CALL ZGEMM( 'T', 'N', 0, -1, 0, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 4+      CALL ZGEMM( 'T', 'C', 0, -1, 0, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 4+      CALL ZGEMM( 'T', 'T', 0, -1, 0, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 5+      CALL ZGEMM( 'N', 'N', 0, 0, -1, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 5+      CALL ZGEMM( 'N', 'C', 0, 0, -1, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 5+      CALL ZGEMM( 'N', 'T', 0, 0, -1, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 5+      CALL ZGEMM( 'C', 'N', 0, 0, -1, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 5+      CALL ZGEMM( 'C', 'C', 0, 0, -1, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 5+      CALL ZGEMM( 'C', 'T', 0, 0, -1, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 5+      CALL ZGEMM( 'T', 'N', 0, 0, -1, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 5+      CALL ZGEMM( 'T', 'C', 0, 0, -1, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 5+      CALL ZGEMM( 'T', 'T', 0, 0, -1, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 8+      CALL ZGEMM( 'N', 'N', 2, 0, 0, ALPHA, A, 1, B, 1, BETA, C, 2 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 8+      CALL ZGEMM( 'N', 'C', 2, 0, 0, ALPHA, A, 1, B, 1, BETA, C, 2 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 8+      CALL ZGEMM( 'N', 'T', 2, 0, 0, ALPHA, A, 1, B, 1, BETA, C, 2 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 8+      CALL ZGEMM( 'C', 'N', 0, 0, 2, ALPHA, A, 1, B, 2, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 8+      CALL ZGEMM( 'C', 'C', 0, 0, 2, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 8+      CALL ZGEMM( 'C', 'T', 0, 0, 2, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 8+      CALL ZGEMM( 'T', 'N', 0, 0, 2, ALPHA, A, 1, B, 2, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 8+      CALL ZGEMM( 'T', 'C', 0, 0, 2, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 8+      CALL ZGEMM( 'T', 'T', 0, 0, 2, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 10+      CALL ZGEMM( 'N', 'N', 0, 0, 2, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 10+      CALL ZGEMM( 'C', 'N', 0, 0, 2, ALPHA, A, 2, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 10+      CALL ZGEMM( 'T', 'N', 0, 0, 2, ALPHA, A, 2, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 10+      CALL ZGEMM( 'N', 'C', 0, 2, 0, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 10+      CALL ZGEMM( 'C', 'C', 0, 2, 0, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 10+      CALL ZGEMM( 'T', 'C', 0, 2, 0, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 10+      CALL ZGEMM( 'N', 'T', 0, 2, 0, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 10+      CALL ZGEMM( 'C', 'T', 0, 2, 0, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 10+      CALL ZGEMM( 'T', 'T', 0, 2, 0, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 13+      CALL ZGEMM( 'N', 'N', 2, 0, 0, ALPHA, A, 2, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 13+      CALL ZGEMM( 'N', 'C', 2, 0, 0, ALPHA, A, 2, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 13+      CALL ZGEMM( 'N', 'T', 2, 0, 0, ALPHA, A, 2, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 13+      CALL ZGEMM( 'C', 'N', 2, 0, 0, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 13+      CALL ZGEMM( 'C', 'C', 2, 0, 0, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 13+      CALL ZGEMM( 'C', 'T', 2, 0, 0, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 13+      CALL ZGEMM( 'T', 'N', 2, 0, 0, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 13+      CALL ZGEMM( 'T', 'C', 2, 0, 0, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 13+      CALL ZGEMM( 'T', 'T', 2, 0, 0, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      GO TO 100+   20 INFOT = 1+      CALL ZHEMM( '/', 'U', 0, 0, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 2+      CALL ZHEMM( 'L', '/', 0, 0, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 3+      CALL ZHEMM( 'L', 'U', -1, 0, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 3+      CALL ZHEMM( 'R', 'U', -1, 0, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 3+      CALL ZHEMM( 'L', 'L', -1, 0, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 3+      CALL ZHEMM( 'R', 'L', -1, 0, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 4+      CALL ZHEMM( 'L', 'U', 0, -1, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 4+      CALL ZHEMM( 'R', 'U', 0, -1, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 4+      CALL ZHEMM( 'L', 'L', 0, -1, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 4+      CALL ZHEMM( 'R', 'L', 0, -1, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 7+      CALL ZHEMM( 'L', 'U', 2, 0, ALPHA, A, 1, B, 2, BETA, C, 2 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 7+      CALL ZHEMM( 'R', 'U', 0, 2, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 7+      CALL ZHEMM( 'L', 'L', 2, 0, ALPHA, A, 1, B, 2, BETA, C, 2 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 7+      CALL ZHEMM( 'R', 'L', 0, 2, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 9+      CALL ZHEMM( 'L', 'U', 2, 0, ALPHA, A, 2, B, 1, BETA, C, 2 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 9+      CALL ZHEMM( 'R', 'U', 2, 0, ALPHA, A, 1, B, 1, BETA, C, 2 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 9+      CALL ZHEMM( 'L', 'L', 2, 0, ALPHA, A, 2, B, 1, BETA, C, 2 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 9+      CALL ZHEMM( 'R', 'L', 2, 0, ALPHA, A, 1, B, 1, BETA, C, 2 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 12+      CALL ZHEMM( 'L', 'U', 2, 0, ALPHA, A, 2, B, 2, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 12+      CALL ZHEMM( 'R', 'U', 2, 0, ALPHA, A, 1, B, 2, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 12+      CALL ZHEMM( 'L', 'L', 2, 0, ALPHA, A, 2, B, 2, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 12+      CALL ZHEMM( 'R', 'L', 2, 0, ALPHA, A, 1, B, 2, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      GO TO 100+   30 INFOT = 1+      CALL ZSYMM( '/', 'U', 0, 0, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 2+      CALL ZSYMM( 'L', '/', 0, 0, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 3+      CALL ZSYMM( 'L', 'U', -1, 0, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 3+      CALL ZSYMM( 'R', 'U', -1, 0, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 3+      CALL ZSYMM( 'L', 'L', -1, 0, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 3+      CALL ZSYMM( 'R', 'L', -1, 0, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 4+      CALL ZSYMM( 'L', 'U', 0, -1, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 4+      CALL ZSYMM( 'R', 'U', 0, -1, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 4+      CALL ZSYMM( 'L', 'L', 0, -1, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 4+      CALL ZSYMM( 'R', 'L', 0, -1, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 7+      CALL ZSYMM( 'L', 'U', 2, 0, ALPHA, A, 1, B, 2, BETA, C, 2 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 7+      CALL ZSYMM( 'R', 'U', 0, 2, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 7+      CALL ZSYMM( 'L', 'L', 2, 0, ALPHA, A, 1, B, 2, BETA, C, 2 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 7+      CALL ZSYMM( 'R', 'L', 0, 2, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 9+      CALL ZSYMM( 'L', 'U', 2, 0, ALPHA, A, 2, B, 1, BETA, C, 2 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 9+      CALL ZSYMM( 'R', 'U', 2, 0, ALPHA, A, 1, B, 1, BETA, C, 2 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 9+      CALL ZSYMM( 'L', 'L', 2, 0, ALPHA, A, 2, B, 1, BETA, C, 2 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 9+      CALL ZSYMM( 'R', 'L', 2, 0, ALPHA, A, 1, B, 1, BETA, C, 2 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 12+      CALL ZSYMM( 'L', 'U', 2, 0, ALPHA, A, 2, B, 2, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 12+      CALL ZSYMM( 'R', 'U', 2, 0, ALPHA, A, 1, B, 2, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 12+      CALL ZSYMM( 'L', 'L', 2, 0, ALPHA, A, 2, B, 2, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 12+      CALL ZSYMM( 'R', 'L', 2, 0, ALPHA, A, 1, B, 2, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      GO TO 100+   40 INFOT = 1+      CALL ZTRMM( '/', 'U', 'N', 'N', 0, 0, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 2+      CALL ZTRMM( 'L', '/', 'N', 'N', 0, 0, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 3+      CALL ZTRMM( 'L', 'U', '/', 'N', 0, 0, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 4+      CALL ZTRMM( 'L', 'U', 'N', '/', 0, 0, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 5+      CALL ZTRMM( 'L', 'U', 'N', 'N', -1, 0, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 5+      CALL ZTRMM( 'L', 'U', 'C', 'N', -1, 0, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 5+      CALL ZTRMM( 'L', 'U', 'T', 'N', -1, 0, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 5+      CALL ZTRMM( 'R', 'U', 'N', 'N', -1, 0, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 5+      CALL ZTRMM( 'R', 'U', 'C', 'N', -1, 0, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 5+      CALL ZTRMM( 'R', 'U', 'T', 'N', -1, 0, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 5+      CALL ZTRMM( 'L', 'L', 'N', 'N', -1, 0, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 5+      CALL ZTRMM( 'L', 'L', 'C', 'N', -1, 0, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 5+      CALL ZTRMM( 'L', 'L', 'T', 'N', -1, 0, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 5+      CALL ZTRMM( 'R', 'L', 'N', 'N', -1, 0, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 5+      CALL ZTRMM( 'R', 'L', 'C', 'N', -1, 0, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 5+      CALL ZTRMM( 'R', 'L', 'T', 'N', -1, 0, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 6+      CALL ZTRMM( 'L', 'U', 'N', 'N', 0, -1, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 6+      CALL ZTRMM( 'L', 'U', 'C', 'N', 0, -1, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 6+      CALL ZTRMM( 'L', 'U', 'T', 'N', 0, -1, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 6+      CALL ZTRMM( 'R', 'U', 'N', 'N', 0, -1, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 6+      CALL ZTRMM( 'R', 'U', 'C', 'N', 0, -1, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 6+      CALL ZTRMM( 'R', 'U', 'T', 'N', 0, -1, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 6+      CALL ZTRMM( 'L', 'L', 'N', 'N', 0, -1, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 6+      CALL ZTRMM( 'L', 'L', 'C', 'N', 0, -1, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 6+      CALL ZTRMM( 'L', 'L', 'T', 'N', 0, -1, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 6+      CALL ZTRMM( 'R', 'L', 'N', 'N', 0, -1, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 6+      CALL ZTRMM( 'R', 'L', 'C', 'N', 0, -1, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 6+      CALL ZTRMM( 'R', 'L', 'T', 'N', 0, -1, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 9+      CALL ZTRMM( 'L', 'U', 'N', 'N', 2, 0, ALPHA, A, 1, B, 2 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 9+      CALL ZTRMM( 'L', 'U', 'C', 'N', 2, 0, ALPHA, A, 1, B, 2 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 9+      CALL ZTRMM( 'L', 'U', 'T', 'N', 2, 0, ALPHA, A, 1, B, 2 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 9+      CALL ZTRMM( 'R', 'U', 'N', 'N', 0, 2, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 9+      CALL ZTRMM( 'R', 'U', 'C', 'N', 0, 2, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 9+      CALL ZTRMM( 'R', 'U', 'T', 'N', 0, 2, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 9+      CALL ZTRMM( 'L', 'L', 'N', 'N', 2, 0, ALPHA, A, 1, B, 2 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 9+      CALL ZTRMM( 'L', 'L', 'C', 'N', 2, 0, ALPHA, A, 1, B, 2 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 9+      CALL ZTRMM( 'L', 'L', 'T', 'N', 2, 0, ALPHA, A, 1, B, 2 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 9+      CALL ZTRMM( 'R', 'L', 'N', 'N', 0, 2, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 9+      CALL ZTRMM( 'R', 'L', 'C', 'N', 0, 2, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 9+      CALL ZTRMM( 'R', 'L', 'T', 'N', 0, 2, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 11+      CALL ZTRMM( 'L', 'U', 'N', 'N', 2, 0, ALPHA, A, 2, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 11+      CALL ZTRMM( 'L', 'U', 'C', 'N', 2, 0, ALPHA, A, 2, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 11+      CALL ZTRMM( 'L', 'U', 'T', 'N', 2, 0, ALPHA, A, 2, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 11+      CALL ZTRMM( 'R', 'U', 'N', 'N', 2, 0, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 11+      CALL ZTRMM( 'R', 'U', 'C', 'N', 2, 0, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 11+      CALL ZTRMM( 'R', 'U', 'T', 'N', 2, 0, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 11+      CALL ZTRMM( 'L', 'L', 'N', 'N', 2, 0, ALPHA, A, 2, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 11+      CALL ZTRMM( 'L', 'L', 'C', 'N', 2, 0, ALPHA, A, 2, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 11+      CALL ZTRMM( 'L', 'L', 'T', 'N', 2, 0, ALPHA, A, 2, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 11+      CALL ZTRMM( 'R', 'L', 'N', 'N', 2, 0, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 11+      CALL ZTRMM( 'R', 'L', 'C', 'N', 2, 0, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 11+      CALL ZTRMM( 'R', 'L', 'T', 'N', 2, 0, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      GO TO 100+   50 INFOT = 1+      CALL ZTRSM( '/', 'U', 'N', 'N', 0, 0, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 2+      CALL ZTRSM( 'L', '/', 'N', 'N', 0, 0, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 3+      CALL ZTRSM( 'L', 'U', '/', 'N', 0, 0, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 4+      CALL ZTRSM( 'L', 'U', 'N', '/', 0, 0, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 5+      CALL ZTRSM( 'L', 'U', 'N', 'N', -1, 0, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 5+      CALL ZTRSM( 'L', 'U', 'C', 'N', -1, 0, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 5+      CALL ZTRSM( 'L', 'U', 'T', 'N', -1, 0, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 5+      CALL ZTRSM( 'R', 'U', 'N', 'N', -1, 0, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 5+      CALL ZTRSM( 'R', 'U', 'C', 'N', -1, 0, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 5+      CALL ZTRSM( 'R', 'U', 'T', 'N', -1, 0, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 5+      CALL ZTRSM( 'L', 'L', 'N', 'N', -1, 0, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 5+      CALL ZTRSM( 'L', 'L', 'C', 'N', -1, 0, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 5+      CALL ZTRSM( 'L', 'L', 'T', 'N', -1, 0, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 5+      CALL ZTRSM( 'R', 'L', 'N', 'N', -1, 0, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 5+      CALL ZTRSM( 'R', 'L', 'C', 'N', -1, 0, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 5+      CALL ZTRSM( 'R', 'L', 'T', 'N', -1, 0, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 6+      CALL ZTRSM( 'L', 'U', 'N', 'N', 0, -1, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 6+      CALL ZTRSM( 'L', 'U', 'C', 'N', 0, -1, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 6+      CALL ZTRSM( 'L', 'U', 'T', 'N', 0, -1, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 6+      CALL ZTRSM( 'R', 'U', 'N', 'N', 0, -1, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 6+      CALL ZTRSM( 'R', 'U', 'C', 'N', 0, -1, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 6+      CALL ZTRSM( 'R', 'U', 'T', 'N', 0, -1, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 6+      CALL ZTRSM( 'L', 'L', 'N', 'N', 0, -1, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 6+      CALL ZTRSM( 'L', 'L', 'C', 'N', 0, -1, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 6+      CALL ZTRSM( 'L', 'L', 'T', 'N', 0, -1, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 6+      CALL ZTRSM( 'R', 'L', 'N', 'N', 0, -1, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 6+      CALL ZTRSM( 'R', 'L', 'C', 'N', 0, -1, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 6+      CALL ZTRSM( 'R', 'L', 'T', 'N', 0, -1, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 9+      CALL ZTRSM( 'L', 'U', 'N', 'N', 2, 0, ALPHA, A, 1, B, 2 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 9+      CALL ZTRSM( 'L', 'U', 'C', 'N', 2, 0, ALPHA, A, 1, B, 2 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 9+      CALL ZTRSM( 'L', 'U', 'T', 'N', 2, 0, ALPHA, A, 1, B, 2 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 9+      CALL ZTRSM( 'R', 'U', 'N', 'N', 0, 2, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 9+      CALL ZTRSM( 'R', 'U', 'C', 'N', 0, 2, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 9+      CALL ZTRSM( 'R', 'U', 'T', 'N', 0, 2, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 9+      CALL ZTRSM( 'L', 'L', 'N', 'N', 2, 0, ALPHA, A, 1, B, 2 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 9+      CALL ZTRSM( 'L', 'L', 'C', 'N', 2, 0, ALPHA, A, 1, B, 2 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 9+      CALL ZTRSM( 'L', 'L', 'T', 'N', 2, 0, ALPHA, A, 1, B, 2 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 9+      CALL ZTRSM( 'R', 'L', 'N', 'N', 0, 2, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 9+      CALL ZTRSM( 'R', 'L', 'C', 'N', 0, 2, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 9+      CALL ZTRSM( 'R', 'L', 'T', 'N', 0, 2, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 11+      CALL ZTRSM( 'L', 'U', 'N', 'N', 2, 0, ALPHA, A, 2, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 11+      CALL ZTRSM( 'L', 'U', 'C', 'N', 2, 0, ALPHA, A, 2, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 11+      CALL ZTRSM( 'L', 'U', 'T', 'N', 2, 0, ALPHA, A, 2, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 11+      CALL ZTRSM( 'R', 'U', 'N', 'N', 2, 0, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 11+      CALL ZTRSM( 'R', 'U', 'C', 'N', 2, 0, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 11+      CALL ZTRSM( 'R', 'U', 'T', 'N', 2, 0, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 11+      CALL ZTRSM( 'L', 'L', 'N', 'N', 2, 0, ALPHA, A, 2, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 11+      CALL ZTRSM( 'L', 'L', 'C', 'N', 2, 0, ALPHA, A, 2, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 11+      CALL ZTRSM( 'L', 'L', 'T', 'N', 2, 0, ALPHA, A, 2, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 11+      CALL ZTRSM( 'R', 'L', 'N', 'N', 2, 0, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 11+      CALL ZTRSM( 'R', 'L', 'C', 'N', 2, 0, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 11+      CALL ZTRSM( 'R', 'L', 'T', 'N', 2, 0, ALPHA, A, 1, B, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      GO TO 100+   60 INFOT = 1+      CALL ZHERK( '/', 'N', 0, 0, RALPHA, A, 1, RBETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 2+      CALL ZHERK( 'U', 'T', 0, 0, RALPHA, A, 1, RBETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 3+      CALL ZHERK( 'U', 'N', -1, 0, RALPHA, A, 1, RBETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 3+      CALL ZHERK( 'U', 'C', -1, 0, RALPHA, A, 1, RBETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 3+      CALL ZHERK( 'L', 'N', -1, 0, RALPHA, A, 1, RBETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 3+      CALL ZHERK( 'L', 'C', -1, 0, RALPHA, A, 1, RBETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 4+      CALL ZHERK( 'U', 'N', 0, -1, RALPHA, A, 1, RBETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 4+      CALL ZHERK( 'U', 'C', 0, -1, RALPHA, A, 1, RBETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 4+      CALL ZHERK( 'L', 'N', 0, -1, RALPHA, A, 1, RBETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 4+      CALL ZHERK( 'L', 'C', 0, -1, RALPHA, A, 1, RBETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 7+      CALL ZHERK( 'U', 'N', 2, 0, RALPHA, A, 1, RBETA, C, 2 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 7+      CALL ZHERK( 'U', 'C', 0, 2, RALPHA, A, 1, RBETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 7+      CALL ZHERK( 'L', 'N', 2, 0, RALPHA, A, 1, RBETA, C, 2 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 7+      CALL ZHERK( 'L', 'C', 0, 2, RALPHA, A, 1, RBETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 10+      CALL ZHERK( 'U', 'N', 2, 0, RALPHA, A, 2, RBETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 10+      CALL ZHERK( 'U', 'C', 2, 0, RALPHA, A, 1, RBETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 10+      CALL ZHERK( 'L', 'N', 2, 0, RALPHA, A, 2, RBETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 10+      CALL ZHERK( 'L', 'C', 2, 0, RALPHA, A, 1, RBETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      GO TO 100+   70 INFOT = 1+      CALL ZSYRK( '/', 'N', 0, 0, ALPHA, A, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 2+      CALL ZSYRK( 'U', 'C', 0, 0, ALPHA, A, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 3+      CALL ZSYRK( 'U', 'N', -1, 0, ALPHA, A, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 3+      CALL ZSYRK( 'U', 'T', -1, 0, ALPHA, A, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 3+      CALL ZSYRK( 'L', 'N', -1, 0, ALPHA, A, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 3+      CALL ZSYRK( 'L', 'T', -1, 0, ALPHA, A, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 4+      CALL ZSYRK( 'U', 'N', 0, -1, ALPHA, A, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 4+      CALL ZSYRK( 'U', 'T', 0, -1, ALPHA, A, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 4+      CALL ZSYRK( 'L', 'N', 0, -1, ALPHA, A, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 4+      CALL ZSYRK( 'L', 'T', 0, -1, ALPHA, A, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 7+      CALL ZSYRK( 'U', 'N', 2, 0, ALPHA, A, 1, BETA, C, 2 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 7+      CALL ZSYRK( 'U', 'T', 0, 2, ALPHA, A, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 7+      CALL ZSYRK( 'L', 'N', 2, 0, ALPHA, A, 1, BETA, C, 2 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 7+      CALL ZSYRK( 'L', 'T', 0, 2, ALPHA, A, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 10+      CALL ZSYRK( 'U', 'N', 2, 0, ALPHA, A, 2, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 10+      CALL ZSYRK( 'U', 'T', 2, 0, ALPHA, A, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 10+      CALL ZSYRK( 'L', 'N', 2, 0, ALPHA, A, 2, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 10+      CALL ZSYRK( 'L', 'T', 2, 0, ALPHA, A, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      GO TO 100+   80 INFOT = 1+      CALL ZHER2K( '/', 'N', 0, 0, ALPHA, A, 1, B, 1, RBETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 2+      CALL ZHER2K( 'U', 'T', 0, 0, ALPHA, A, 1, B, 1, RBETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 3+      CALL ZHER2K( 'U', 'N', -1, 0, ALPHA, A, 1, B, 1, RBETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 3+      CALL ZHER2K( 'U', 'C', -1, 0, ALPHA, A, 1, B, 1, RBETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 3+      CALL ZHER2K( 'L', 'N', -1, 0, ALPHA, A, 1, B, 1, RBETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 3+      CALL ZHER2K( 'L', 'C', -1, 0, ALPHA, A, 1, B, 1, RBETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 4+      CALL ZHER2K( 'U', 'N', 0, -1, ALPHA, A, 1, B, 1, RBETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 4+      CALL ZHER2K( 'U', 'C', 0, -1, ALPHA, A, 1, B, 1, RBETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 4+      CALL ZHER2K( 'L', 'N', 0, -1, ALPHA, A, 1, B, 1, RBETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 4+      CALL ZHER2K( 'L', 'C', 0, -1, ALPHA, A, 1, B, 1, RBETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 7+      CALL ZHER2K( 'U', 'N', 2, 0, ALPHA, A, 1, B, 1, RBETA, C, 2 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 7+      CALL ZHER2K( 'U', 'C', 0, 2, ALPHA, A, 1, B, 1, RBETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 7+      CALL ZHER2K( 'L', 'N', 2, 0, ALPHA, A, 1, B, 1, RBETA, C, 2 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 7+      CALL ZHER2K( 'L', 'C', 0, 2, ALPHA, A, 1, B, 1, RBETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 9+      CALL ZHER2K( 'U', 'N', 2, 0, ALPHA, A, 2, B, 1, RBETA, C, 2 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 9+      CALL ZHER2K( 'U', 'C', 0, 2, ALPHA, A, 2, B, 1, RBETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 9+      CALL ZHER2K( 'L', 'N', 2, 0, ALPHA, A, 2, B, 1, RBETA, C, 2 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 9+      CALL ZHER2K( 'L', 'C', 0, 2, ALPHA, A, 2, B, 1, RBETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 12+      CALL ZHER2K( 'U', 'N', 2, 0, ALPHA, A, 2, B, 2, RBETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 12+      CALL ZHER2K( 'U', 'C', 2, 0, ALPHA, A, 1, B, 1, RBETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 12+      CALL ZHER2K( 'L', 'N', 2, 0, ALPHA, A, 2, B, 2, RBETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 12+      CALL ZHER2K( 'L', 'C', 2, 0, ALPHA, A, 1, B, 1, RBETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      GO TO 100+   90 INFOT = 1+      CALL ZSYR2K( '/', 'N', 0, 0, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 2+      CALL ZSYR2K( 'U', 'C', 0, 0, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 3+      CALL ZSYR2K( 'U', 'N', -1, 0, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 3+      CALL ZSYR2K( 'U', 'T', -1, 0, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 3+      CALL ZSYR2K( 'L', 'N', -1, 0, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 3+      CALL ZSYR2K( 'L', 'T', -1, 0, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 4+      CALL ZSYR2K( 'U', 'N', 0, -1, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 4+      CALL ZSYR2K( 'U', 'T', 0, -1, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 4+      CALL ZSYR2K( 'L', 'N', 0, -1, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 4+      CALL ZSYR2K( 'L', 'T', 0, -1, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 7+      CALL ZSYR2K( 'U', 'N', 2, 0, ALPHA, A, 1, B, 1, BETA, C, 2 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 7+      CALL ZSYR2K( 'U', 'T', 0, 2, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 7+      CALL ZSYR2K( 'L', 'N', 2, 0, ALPHA, A, 1, B, 1, BETA, C, 2 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 7+      CALL ZSYR2K( 'L', 'T', 0, 2, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 9+      CALL ZSYR2K( 'U', 'N', 2, 0, ALPHA, A, 2, B, 1, BETA, C, 2 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 9+      CALL ZSYR2K( 'U', 'T', 0, 2, ALPHA, A, 2, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 9+      CALL ZSYR2K( 'L', 'N', 2, 0, ALPHA, A, 2, B, 1, BETA, C, 2 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 9+      CALL ZSYR2K( 'L', 'T', 0, 2, ALPHA, A, 2, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 12+      CALL ZSYR2K( 'U', 'N', 2, 0, ALPHA, A, 2, B, 2, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 12+      CALL ZSYR2K( 'U', 'T', 2, 0, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 12+      CALL ZSYR2K( 'L', 'N', 2, 0, ALPHA, A, 2, B, 2, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+      INFOT = 12+      CALL ZSYR2K( 'L', 'T', 2, 0, ALPHA, A, 1, B, 1, BETA, C, 1 )+      CALL CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+*+  100 IF( OK )THEN+         WRITE( NOUT, FMT = 9999 )SRNAMT+      ELSE+         WRITE( NOUT, FMT = 9998 )SRNAMT+      END IF+      RETURN+*+ 9999 FORMAT( ' ', A6, ' PASSED THE TESTS OF ERROR-EXITS' )+ 9998 FORMAT( ' ******* ', A6, ' FAILED THE TESTS OF ERROR-EXITS *****',+     $      '**' )+*+*     End of ZCHKE.+*+      END+      SUBROUTINE ZMAKE( TYPE, UPLO, DIAG, M, N, A, NMAX, AA, LDA, RESET,+     $                  TRANSL )+*+*  Generates values for an M by N matrix A.+*  Stores the values in the array AA in the data structure required+*  by the routine, with unwanted elements set to rogue value.+*+*  TYPE is 'GE', 'HE', 'SY' or 'TR'.+*+*  Auxiliary routine for test program for Level 3 Blas.+*+*  -- Written on 8-February-1989.+*     Jack Dongarra, Argonne National Laboratory.+*     Iain Duff, AERE Harwell.+*     Jeremy Du Croz, Numerical Algorithms Group Ltd.+*     Sven Hammarling, Numerical Algorithms Group Ltd.+*+*     .. Parameters ..+      COMPLEX*16         ZERO, ONE+      PARAMETER          ( ZERO = ( 0.0D0, 0.0D0 ),+     $                   ONE = ( 1.0D0, 0.0D0 ) )+      COMPLEX*16         ROGUE+      PARAMETER          ( ROGUE = ( -1.0D10, 1.0D10 ) )+      DOUBLE PRECISION   RZERO+      PARAMETER          ( RZERO = 0.0D0 )+      DOUBLE PRECISION   RROGUE+      PARAMETER          ( RROGUE = -1.0D10 )+*     .. Scalar Arguments ..+      COMPLEX*16         TRANSL+      INTEGER            LDA, M, N, NMAX+      LOGICAL            RESET+      CHARACTER*1        DIAG, UPLO+      CHARACTER*2        TYPE+*     .. Array Arguments ..+      COMPLEX*16         A( NMAX, * ), AA( * )+*     .. Local Scalars ..+      INTEGER            I, IBEG, IEND, J, JJ+      LOGICAL            GEN, HER, LOWER, SYM, TRI, UNIT, UPPER+*     .. External Functions ..+      COMPLEX*16         ZBEG+      EXTERNAL           ZBEG+*     .. Intrinsic Functions ..+      INTRINSIC          DCMPLX, DCONJG, DBLE+*     .. Executable Statements ..+      GEN = TYPE.EQ.'GE'+      HER = TYPE.EQ.'HE'+      SYM = TYPE.EQ.'SY'+      TRI = TYPE.EQ.'TR'+      UPPER = ( HER.OR.SYM.OR.TRI ).AND.UPLO.EQ.'U'+      LOWER = ( HER.OR.SYM.OR.TRI ).AND.UPLO.EQ.'L'+      UNIT = TRI.AND.DIAG.EQ.'U'+*+*     Generate data in array A.+*+      DO 20 J = 1, N+         DO 10 I = 1, M+            IF( GEN.OR.( UPPER.AND.I.LE.J ).OR.( LOWER.AND.I.GE.J ) )+     $          THEN+               A( I, J ) = ZBEG( RESET ) + TRANSL+               IF( I.NE.J )THEN+*                 Set some elements to zero+                  IF( N.GT.3.AND.J.EQ.N/2 )+     $               A( I, J ) = ZERO+                  IF( HER )THEN+                     A( J, I ) = DCONJG( A( I, J ) )+                  ELSE IF( SYM )THEN+                     A( J, I ) = A( I, J )+                  ELSE IF( TRI )THEN+                     A( J, I ) = ZERO+                  END IF+               END IF+            END IF+   10    CONTINUE+         IF( HER )+     $      A( J, J ) = DCMPLX( DBLE( A( J, J ) ), RZERO )+         IF( TRI )+     $      A( J, J ) = A( J, J ) + ONE+         IF( UNIT )+     $      A( J, J ) = ONE+   20 CONTINUE+*+*     Store elements in array AS in data structure required by routine.+*+      IF( TYPE.EQ.'GE' )THEN+         DO 50 J = 1, N+            DO 30 I = 1, M+               AA( I + ( J - 1 )*LDA ) = A( I, J )+   30       CONTINUE+            DO 40 I = M + 1, LDA+               AA( I + ( J - 1 )*LDA ) = ROGUE+   40       CONTINUE+   50    CONTINUE+      ELSE IF( TYPE.EQ.'HE'.OR.TYPE.EQ.'SY'.OR.TYPE.EQ.'TR' )THEN+         DO 90 J = 1, N+            IF( UPPER )THEN+               IBEG = 1+               IF( UNIT )THEN+                  IEND = J - 1+               ELSE+                  IEND = J+               END IF+            ELSE+               IF( UNIT )THEN+                  IBEG = J + 1+               ELSE+                  IBEG = J+               END IF+               IEND = N+            END IF+            DO 60 I = 1, IBEG - 1+               AA( I + ( J - 1 )*LDA ) = ROGUE+   60       CONTINUE+            DO 70 I = IBEG, IEND+               AA( I + ( J - 1 )*LDA ) = A( I, J )+   70       CONTINUE+            DO 80 I = IEND + 1, LDA+               AA( I + ( J - 1 )*LDA ) = ROGUE+   80       CONTINUE+            IF( HER )THEN+               JJ = J + ( J - 1 )*LDA+               AA( JJ ) = DCMPLX( DBLE( AA( JJ ) ), RROGUE )+            END IF+   90    CONTINUE+      END IF+      RETURN+*+*     End of ZMAKE.+*+      END+      SUBROUTINE ZMMCH( TRANSA, TRANSB, M, N, KK, ALPHA, A, LDA, B, LDB,+     $                  BETA, C, LDC, CT, G, CC, LDCC, EPS, ERR, FATAL,+     $                  NOUT, MV )+*+*  Checks the results of the computational tests.+*+*  Auxiliary routine for test program for Level 3 Blas.+*+*  -- Written on 8-February-1989.+*     Jack Dongarra, Argonne National Laboratory.+*     Iain Duff, AERE Harwell.+*     Jeremy Du Croz, Numerical Algorithms Group Ltd.+*     Sven Hammarling, Numerical Algorithms Group Ltd.+*+*     .. Parameters ..+      COMPLEX*16         ZERO+      PARAMETER          ( ZERO = ( 0.0D0, 0.0D0 ) )+      DOUBLE PRECISION   RZERO, RONE+      PARAMETER          ( RZERO = 0.0D0, RONE = 1.0D0 )+*     .. Scalar Arguments ..+      COMPLEX*16         ALPHA, BETA+      DOUBLE PRECISION   EPS, ERR+      INTEGER            KK, LDA, LDB, LDC, LDCC, M, N, NOUT+      LOGICAL            FATAL, MV+      CHARACTER*1        TRANSA, TRANSB+*     .. Array Arguments ..+      COMPLEX*16         A( LDA, * ), B( LDB, * ), C( LDC, * ),+     $                   CC( LDCC, * ), CT( * )+      DOUBLE PRECISION   G( * )+*     .. Local Scalars ..+      COMPLEX*16         CL+      DOUBLE PRECISION   ERRI+      INTEGER            I, J, K+      LOGICAL            CTRANA, CTRANB, TRANA, TRANB+*     .. Intrinsic Functions ..+      INTRINSIC          ABS, DIMAG, DCONJG, MAX, DBLE, SQRT+*     .. Statement Functions ..+      DOUBLE PRECISION   ABS1+*     .. Statement Function definitions ..+      ABS1( CL ) = ABS( DBLE( CL ) ) + ABS( DIMAG( CL ) )+*     .. Executable Statements ..+      TRANA = TRANSA.EQ.'T'.OR.TRANSA.EQ.'C'+      TRANB = TRANSB.EQ.'T'.OR.TRANSB.EQ.'C'+      CTRANA = TRANSA.EQ.'C'+      CTRANB = TRANSB.EQ.'C'+*+*     Compute expected result, one column at a time, in CT using data+*     in A, B and C.+*     Compute gauges in G.+*+      DO 220 J = 1, N+*+         DO 10 I = 1, M+            CT( I ) = ZERO+            G( I ) = RZERO+   10    CONTINUE+         IF( .NOT.TRANA.AND..NOT.TRANB )THEN+            DO 30 K = 1, KK+               DO 20 I = 1, M+                  CT( I ) = CT( I ) + A( I, K )*B( K, J )+                  G( I ) = G( I ) + ABS1( A( I, K ) )*ABS1( B( K, J ) )+   20          CONTINUE+   30       CONTINUE+         ELSE IF( TRANA.AND..NOT.TRANB )THEN+            IF( CTRANA )THEN+               DO 50 K = 1, KK+                  DO 40 I = 1, M+                     CT( I ) = CT( I ) + DCONJG( A( K, I ) )*B( K, J )+                     G( I ) = G( I ) + ABS1( A( K, I ) )*+     $                        ABS1( B( K, J ) )+   40             CONTINUE+   50          CONTINUE+            ELSE+               DO 70 K = 1, KK+                  DO 60 I = 1, M+                     CT( I ) = CT( I ) + A( K, I )*B( K, J )+                     G( I ) = G( I ) + ABS1( A( K, I ) )*+     $                        ABS1( B( K, J ) )+   60             CONTINUE+   70          CONTINUE+            END IF+         ELSE IF( .NOT.TRANA.AND.TRANB )THEN+            IF( CTRANB )THEN+               DO 90 K = 1, KK+                  DO 80 I = 1, M+                     CT( I ) = CT( I ) + A( I, K )*DCONJG( B( J, K ) )+                     G( I ) = G( I ) + ABS1( A( I, K ) )*+     $                        ABS1( B( J, K ) )+   80             CONTINUE+   90          CONTINUE+            ELSE+               DO 110 K = 1, KK+                  DO 100 I = 1, M+                     CT( I ) = CT( I ) + A( I, K )*B( J, K )+                     G( I ) = G( I ) + ABS1( A( I, K ) )*+     $                        ABS1( B( J, K ) )+  100             CONTINUE+  110          CONTINUE+            END IF+         ELSE IF( TRANA.AND.TRANB )THEN+            IF( CTRANA )THEN+               IF( CTRANB )THEN+                  DO 130 K = 1, KK+                     DO 120 I = 1, M+                        CT( I ) = CT( I ) + DCONJG( A( K, I ) )*+     $                            DCONJG( B( J, K ) )+                        G( I ) = G( I ) + ABS1( A( K, I ) )*+     $                           ABS1( B( J, K ) )+  120                CONTINUE+  130             CONTINUE+               ELSE+                  DO 150 K = 1, KK+                     DO 140 I = 1, M+                        CT( I ) = CT( I ) + DCONJG( A( K, I ) )*+     $                            B( J, K )+                        G( I ) = G( I ) + ABS1( A( K, I ) )*+     $                           ABS1( B( J, K ) )+  140                CONTINUE+  150             CONTINUE+               END IF+            ELSE+               IF( CTRANB )THEN+                  DO 170 K = 1, KK+                     DO 160 I = 1, M+                        CT( I ) = CT( I ) + A( K, I )*+     $                            DCONJG( B( J, K ) )+                        G( I ) = G( I ) + ABS1( A( K, I ) )*+     $                           ABS1( B( J, K ) )+  160                CONTINUE+  170             CONTINUE+               ELSE+                  DO 190 K = 1, KK+                     DO 180 I = 1, M+                        CT( I ) = CT( I ) + A( K, I )*B( J, K )+                        G( I ) = G( I ) + ABS1( A( K, I ) )*+     $                           ABS1( B( J, K ) )+  180                CONTINUE+  190             CONTINUE+               END IF+            END IF+         END IF+         DO 200 I = 1, M+            CT( I ) = ALPHA*CT( I ) + BETA*C( I, J )+            G( I ) = ABS1( ALPHA )*G( I ) ++     $               ABS1( BETA )*ABS1( C( I, J ) )+  200    CONTINUE+*+*        Compute the error ratio for this result.+*+         ERR = ZERO+         DO 210 I = 1, M+            ERRI = ABS1( CT( I ) - CC( I, J ) )/EPS+            IF( G( I ).NE.RZERO )+     $         ERRI = ERRI/G( I )+            ERR = MAX( ERR, ERRI )+            IF( ERR*SQRT( EPS ).GE.RONE )+     $         GO TO 230+  210    CONTINUE+*+  220 CONTINUE+*+*     If the loop completes, all results are at least half accurate.+      GO TO 250+*+*     Report fatal error.+*+  230 FATAL = .TRUE.+      WRITE( NOUT, FMT = 9999 )+      DO 240 I = 1, M+         IF( MV )THEN+            WRITE( NOUT, FMT = 9998 )I, CT( I ), CC( I, J )+         ELSE+            WRITE( NOUT, FMT = 9998 )I, CC( I, J ), CT( I )+         END IF+  240 CONTINUE+      IF( N.GT.1 )+     $   WRITE( NOUT, FMT = 9997 )J+*+  250 CONTINUE+      RETURN+*+ 9999 FORMAT( ' ******* FATAL ERROR - COMPUTED RESULT IS LESS THAN HAL',+     $      'F ACCURATE *******', /'                       EXPECTED RE',+     $      'SULT                    COMPUTED RESULT' )+ 9998 FORMAT( 1X, I7, 2( '  (', G15.6, ',', G15.6, ')' ) )+ 9997 FORMAT( '      THESE ARE THE RESULTS FOR COLUMN ', I3 )+*+*     End of ZMMCH.+*+      END+      LOGICAL FUNCTION LZE( RI, RJ, LR )+*+*  Tests if two arrays are identical.+*+*  Auxiliary routine for test program for Level 3 Blas.+*+*  -- Written on 8-February-1989.+*     Jack Dongarra, Argonne National Laboratory.+*     Iain Duff, AERE Harwell.+*     Jeremy Du Croz, Numerical Algorithms Group Ltd.+*     Sven Hammarling, Numerical Algorithms Group Ltd.+*+*     .. Scalar Arguments ..+      INTEGER            LR+*     .. Array Arguments ..+      COMPLEX*16         RI( * ), RJ( * )+*     .. Local Scalars ..+      INTEGER            I+*     .. Executable Statements ..+      DO 10 I = 1, LR+         IF( RI( I ).NE.RJ( I ) )+     $      GO TO 20+   10 CONTINUE+      LZE = .TRUE.+      GO TO 30+   20 CONTINUE+      LZE = .FALSE.+   30 RETURN+*+*     End of LZE.+*+      END+      LOGICAL FUNCTION LZERES( TYPE, UPLO, M, N, AA, AS, LDA )+*+*  Tests if selected elements in two arrays are equal.+*+*  TYPE is 'GE' or 'HE' or 'SY'.+*+*  Auxiliary routine for test program for Level 3 Blas.+*+*  -- Written on 8-February-1989.+*     Jack Dongarra, Argonne National Laboratory.+*     Iain Duff, AERE Harwell.+*     Jeremy Du Croz, Numerical Algorithms Group Ltd.+*     Sven Hammarling, Numerical Algorithms Group Ltd.+*+*     .. Scalar Arguments ..+      INTEGER            LDA, M, N+      CHARACTER*1        UPLO+      CHARACTER*2        TYPE+*     .. Array Arguments ..+      COMPLEX*16         AA( LDA, * ), AS( LDA, * )+*     .. Local Scalars ..+      INTEGER            I, IBEG, IEND, J+      LOGICAL            UPPER+*     .. Executable Statements ..+      UPPER = UPLO.EQ.'U'+      IF( TYPE.EQ.'GE' )THEN+         DO 20 J = 1, N+            DO 10 I = M + 1, LDA+               IF( AA( I, J ).NE.AS( I, J ) )+     $            GO TO 70+   10       CONTINUE+   20    CONTINUE+      ELSE IF( TYPE.EQ.'HE'.OR.TYPE.EQ.'SY' )THEN+         DO 50 J = 1, N+            IF( UPPER )THEN+               IBEG = 1+               IEND = J+            ELSE+               IBEG = J+               IEND = N+            END IF+            DO 30 I = 1, IBEG - 1+               IF( AA( I, J ).NE.AS( I, J ) )+     $            GO TO 70+   30       CONTINUE+            DO 40 I = IEND + 1, LDA+               IF( AA( I, J ).NE.AS( I, J ) )+     $            GO TO 70+   40       CONTINUE+   50    CONTINUE+      END IF+*+      LZERES = .TRUE.+      GO TO 80+   70 CONTINUE+      LZERES = .FALSE.+   80 RETURN+*+*     End of LZERES.+*+      END+      COMPLEX*16     FUNCTION ZBEG( RESET )+*+*  Generates complex numbers as pairs of random numbers uniformly+*  distributed between -0.5 and 0.5.+*+*  Auxiliary routine for test program for Level 3 Blas.+*+*  -- Written on 8-February-1989.+*     Jack Dongarra, Argonne National Laboratory.+*     Iain Duff, AERE Harwell.+*     Jeremy Du Croz, Numerical Algorithms Group Ltd.+*     Sven Hammarling, Numerical Algorithms Group Ltd.+*+*     .. Scalar Arguments ..+      LOGICAL            RESET+*     .. Local Scalars ..+      INTEGER            I, IC, J, MI, MJ+*     .. Save statement ..+      SAVE               I, IC, J, MI, MJ+*     .. Intrinsic Functions ..+      INTRINSIC          DCMPLX+*     .. Executable Statements ..+      IF( RESET )THEN+*        Initialize local variables.+         MI = 891+         MJ = 457+         I = 7+         J = 7+         IC = 0+         RESET = .FALSE.+      END IF+*+*     The sequence of values of I or J is bounded between 1 and 999.+*     If initial I or J = 1,2,3,6,7 or 9, the period will be 50.+*     If initial I or J = 4 or 8, the period will be 25.+*     If initial I or J = 5, the period will be 10.+*     IC is used to break up the period by skipping 1 value of I or J+*     in 6.+*+      IC = IC + 1+   10 I = I*MI+      J = J*MJ+      I = I - 1000*( I/1000 )+      J = J - 1000*( J/1000 )+      IF( IC.GE.5 )THEN+         IC = 0+         GO TO 10+      END IF+      ZBEG = DCMPLX( ( I - 500 )/1001.0D0, ( J - 500 )/1001.0D0 )+      RETURN+*+*     End of ZBEG.+*+      END+      DOUBLE PRECISION FUNCTION DDIFF( X, Y )+*+*  Auxiliary routine for test program for Level 3 Blas.+*+*  -- Written on 8-February-1989.+*     Jack Dongarra, Argonne National Laboratory.+*     Iain Duff, AERE Harwell.+*     Jeremy Du Croz, Numerical Algorithms Group Ltd.+*     Sven Hammarling, Numerical Algorithms Group Ltd.+*+*     .. Scalar Arguments ..+      DOUBLE PRECISION   X, Y+*     .. Executable Statements ..+      DDIFF = X - Y+      RETURN+*+*     End of DDIFF.+*+      END+      SUBROUTINE CHKXER( SRNAMT, INFOT, NOUT, LERR, OK )+*+*  Tests whether XERBLA has detected an error when it should.+*+*  Auxiliary routine for test program for Level 3 Blas.+*+*  -- Written on 8-February-1989.+*     Jack Dongarra, Argonne National Laboratory.+*     Iain Duff, AERE Harwell.+*     Jeremy Du Croz, Numerical Algorithms Group Ltd.+*     Sven Hammarling, Numerical Algorithms Group Ltd.+*+*     .. Scalar Arguments ..+      INTEGER            INFOT, NOUT+      LOGICAL            LERR, OK+      CHARACTER*6        SRNAMT+*     .. Executable Statements ..+      IF( .NOT.LERR )THEN+         WRITE( NOUT, FMT = 9999 )INFOT, SRNAMT+         OK = .FALSE.+      END IF+      LERR = .FALSE.+      RETURN+*+ 9999 FORMAT( ' ***** ILLEGAL VALUE OF PARAMETER NUMBER ', I2, ' NOT D',+     $      'ETECTED BY ', A6, ' *****' )+*+*     End of CHKXER.+*+      END+      SUBROUTINE XERBLA( SRNAME, INFO )+*+*  This is a special version of XERBLA to be used only as part of+*  the test program for testing error exits from the Level 3 BLAS+*  routines.+*+*  XERBLA  is an error handler for the Level 3 BLAS routines.+*+*  It is called by the Level 3 BLAS routines if an input parameter is+*  invalid.+*+*  Auxiliary routine for test program for Level 3 Blas.+*+*  -- Written on 8-February-1989.+*     Jack Dongarra, Argonne National Laboratory.+*     Iain Duff, AERE Harwell.+*     Jeremy Du Croz, Numerical Algorithms Group Ltd.+*     Sven Hammarling, Numerical Algorithms Group Ltd.+*+*     .. Scalar Arguments ..+      INTEGER            INFO+      CHARACTER*6        SRNAME+*     .. Scalars in Common ..+      INTEGER            INFOT, NOUT+      LOGICAL            LERR, OK+      CHARACTER*6        SRNAMT+*     .. Common blocks ..+      COMMON             /INFOC/INFOT, NOUT, OK, LERR+      COMMON             /SRNAMC/SRNAMT+*     .. Executable Statements ..+      LERR = .TRUE.+      IF( INFO.NE.INFOT )THEN+         IF( INFOT.NE.0 )THEN+            WRITE( NOUT, FMT = 9999 )INFO, INFOT+         ELSE+            WRITE( NOUT, FMT = 9997 )INFO+         END IF+         OK = .FALSE.+      END IF+      IF( SRNAME.NE.SRNAMT )THEN+         WRITE( NOUT, FMT = 9998 )SRNAME, SRNAMT+         OK = .FALSE.+      END IF+      RETURN+*+ 9999 FORMAT( ' ******* XERBLA WAS CALLED WITH INFO = ', I6, ' INSTEAD',+     $      ' OF ', I2, ' *******' )+ 9998 FORMAT( ' ******* XERBLA WAS CALLED WITH SRNAME = ', A6, ' INSTE',+     $      'AD OF ', A6, ' *******' )+ 9997 FORMAT( ' ******* XERBLA WAS CALLED WITH INFO = ', I6,+     $      ' *******' )+*+*     End of XERBLA+*+      END+
+ eigen3/blas/xerbla.cpp view
@@ -0,0 +1,23 @@++#include <stdio.h>++#if (defined __GNUC__) && (!defined __MINGW32__) && (!defined __CYGWIN__)+#define EIGEN_WEAK_LINKING __attribute__ ((weak))+#else+#define EIGEN_WEAK_LINKING+#endif++#ifdef __cplusplus+extern "C"+{+#endif++EIGEN_WEAK_LINKING int xerbla_(const char * msg, int *info, int)+{+  printf("Eigen BLAS ERROR #%i: %s\n", *info, msg );+  return 0;+}++#ifdef __cplusplus+}+#endif
+ eigen3/cmake/Eigen3Config.cmake.in view
@@ -0,0 +1,21 @@+# This file exports the Eigen3::Eigen CMake target which should be passed to the+# target_link_libraries command.++@PACKAGE_INIT@++include ("${CMAKE_CURRENT_LIST_DIR}/Eigen3Targets.cmake")++# Legacy variables, do *not* use. May be removed in the future.++set (EIGEN3_FOUND 1)+set (EIGEN3_USE_FILE    "${CMAKE_CURRENT_LIST_DIR}/UseEigen3.cmake")++set (EIGEN3_DEFINITIONS  "@EIGEN_DEFINITIONS@")+set (EIGEN3_INCLUDE_DIR  "@PACKAGE_EIGEN_INCLUDE_DIR@")+set (EIGEN3_INCLUDE_DIRS "@PACKAGE_EIGEN_INCLUDE_DIR@")+set (EIGEN3_ROOT_DIR     "@PACKAGE_EIGEN_ROOT_DIR@")++set (EIGEN3_VERSION_STRING "@EIGEN_VERSION_STRING@")+set (EIGEN3_VERSION_MAJOR  "@EIGEN_VERSION_MAJOR@")+set (EIGEN3_VERSION_MINOR  "@EIGEN_VERSION_MINOR@")+set (EIGEN3_VERSION_PATCH  "@EIGEN_VERSION_PATCH@")
+ eigen3/cmake/Eigen3ConfigLegacy.cmake.in view
@@ -0,0 +1,30 @@+#                                               -*- cmake -*-+#+#  Eigen3Config.cmake(.in)++# Use the following variables to compile and link against Eigen:+#  EIGEN3_FOUND              - True if Eigen was found on your system+#  EIGEN3_USE_FILE           - The file making Eigen usable+#  EIGEN3_DEFINITIONS        - Definitions needed to build with Eigen+#  EIGEN3_INCLUDE_DIR        - Directory where signature_of_eigen3_matrix_library can be found+#  EIGEN3_INCLUDE_DIRS       - List of directories of Eigen and it's dependencies+#  EIGEN3_ROOT_DIR           - The base directory of Eigen+#  EIGEN3_VERSION_STRING     - A human-readable string containing the version+#  EIGEN3_VERSION_MAJOR      - The major version of Eigen+#  EIGEN3_VERSION_MINOR      - The minor version of Eigen+#  EIGEN3_VERSION_PATCH      - The patch version of Eigen++@PACKAGE_INIT@++set ( EIGEN3_FOUND 1 )+set ( EIGEN3_USE_FILE     "${CMAKE_CURRENT_LIST_DIR}/UseEigen3.cmake" )++set ( EIGEN3_DEFINITIONS  "@EIGEN_DEFINITIONS@" )+set ( EIGEN3_INCLUDE_DIR  "@PACKAGE_EIGEN_INCLUDE_DIR@" )+set ( EIGEN3_INCLUDE_DIRS "@PACKAGE_EIGEN_INCLUDE_DIR@" )+set ( EIGEN3_ROOT_DIR     "@PACKAGE_EIGEN_ROOT_DIR@" )++set ( EIGEN3_VERSION_STRING "@EIGEN_VERSION_STRING@" )+set ( EIGEN3_VERSION_MAJOR  "@EIGEN_VERSION_MAJOR@" )+set ( EIGEN3_VERSION_MINOR  "@EIGEN_VERSION_MINOR@" )+set ( EIGEN3_VERSION_PATCH  "@EIGEN_VERSION_PATCH@" )
+ eigen3/cmake/EigenConfigureTesting.cmake view
@@ -0,0 +1,58 @@+include(EigenTesting)+include(CheckCXXSourceCompiles)++# configure the "site" and "buildname" +ei_set_sitename()++# retrieve and store the build string+ei_set_build_string()++add_custom_target(buildtests)+add_custom_target(check COMMAND "ctest")+add_dependencies(check buildtests)++# check whether /bin/bash exists (disabled as not used anymore)+# find_file(EIGEN_BIN_BASH_EXISTS "/bin/bash" PATHS "/" NO_DEFAULT_PATH)++# This call activates testing and generates the DartConfiguration.tcl+include(CTest)++set(EIGEN_TEST_BUILD_FLAGS "" CACHE STRING "Options passed to the build command of unit tests")+set(EIGEN_DASHBOARD_BUILD_TARGET "buildtests" CACHE STRING "Target to be built in dashboard mode, default is buildtests")+set(EIGEN_CTEST_ERROR_EXCEPTION "" CACHE STRING "Regular expression for build error messages to be filtered out")++# Overwrite default DartConfiguration.tcl such that ctest can build our unit tests.+# Recall that our unit tests are not in the "all" target, so we have to explicitely ask ctest to build our custom 'buildtests' target.+# At this stage, we can also add custom flags to the build tool through the user defined EIGEN_TEST_BUILD_FLAGS variable.+file(READ  "${CMAKE_CURRENT_BINARY_DIR}/DartConfiguration.tcl" EIGEN_DART_CONFIG_FILE)+# try to grab the default flags+string(REGEX MATCH "MakeCommand:.*-- (.*)\nDefaultCTestConfigurationType" EIGEN_DUMMY ${EIGEN_DART_CONFIG_FILE})+if(NOT CMAKE_MATCH_1)+string(REGEX MATCH "MakeCommand:.*[^c]make (.*)\nDefaultCTestConfigurationType" EIGEN_DUMMY ${EIGEN_DART_CONFIG_FILE})+endif()+string(REGEX REPLACE "MakeCommand:.*DefaultCTestConfigurationType" "MakeCommand: ${CMAKE_COMMAND} --build . --target ${EIGEN_DASHBOARD_BUILD_TARGET} --config \"\${CTEST_CONFIGURATION_TYPE}\" -- ${CMAKE_MATCH_1} ${EIGEN_TEST_BUILD_FLAGS}\nDefaultCTestConfigurationType"+       EIGEN_DART_CONFIG_FILE2 ${EIGEN_DART_CONFIG_FILE})+file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/DartConfiguration.tcl" ${EIGEN_DART_CONFIG_FILE2})++configure_file(${CMAKE_CURRENT_SOURCE_DIR}/CTestCustom.cmake.in ${CMAKE_BINARY_DIR}/CTestCustom.cmake)++# some documentation of this function would be nice+ei_init_testing()++# configure Eigen related testing options+option(EIGEN_NO_ASSERTION_CHECKING "Disable checking of assertions using exceptions" OFF)+option(EIGEN_DEBUG_ASSERTS "Enable advanced debuging of assertions" OFF)++if(CMAKE_COMPILER_IS_GNUCXX)+  option(EIGEN_COVERAGE_TESTING "Enable/disable gcov" OFF)+  if(EIGEN_COVERAGE_TESTING)+    set(COVERAGE_FLAGS "-fprofile-arcs -ftest-coverage")+    set(CTEST_CUSTOM_COVERAGE_EXCLUDE "/test/")+    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${COVERAGE_FLAGS}")+  endif(EIGEN_COVERAGE_TESTING)+  +elseif(MSVC)+  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /D_CRT_SECURE_NO_WARNINGS /D_SCL_SECURE_NO_WARNINGS")+endif(CMAKE_COMPILER_IS_GNUCXX)++
+ eigen3/cmake/EigenDetermineOSVersion.cmake view
@@ -0,0 +1,46 @@+# The utility function DetermineOSVersion aims at providing an+# improved version of the CMake variable ${CMAKE_SYSTEM} on Windows+# machines.+#+# Usage:+#  include(EigenDetermineOSVersion)+#  DetermineOSVersion(OS_VERSION)+#  message("OS: ${OS_VERSION}")++# - A little helper variable which should not be directly called+function(DetermineShortWindowsName WIN_VERSION win_num_version)+   if    (${win_num_version} VERSION_EQUAL "6.1")+       set(_version "win7")+   elseif(${win_num_version} VERSION_EQUAL "6.0")+       set(_version "winVista")+   elseif(${win_num_version} VERSION_EQUAL "5.2")+       set(_version "winXpProf")+   elseif(${win_num_version} VERSION_EQUAL "5.1")+       set(_version "winXp")+   elseif(${win_num_version} VERSION_EQUAL "5.0")+       set(_version "win2000Prof")+   else()+       set(_version "unknownWin")+   endif()+   set(${WIN_VERSION} ${_version} PARENT_SCOPE)+endfunction()++function(DetermineOSVersion OS_VERSION)+  if (WIN32 AND CMAKE_HOST_SYSTEM_NAME MATCHES Windows)+    file (TO_NATIVE_PATH "$ENV{COMSPEC}" SHELL)+    exec_program( ${SHELL} ARGS "/c" "ver" OUTPUT_VARIABLE ver_output)+				+      string(REGEX MATCHALL "[0-9]+"+           ver_list "${ver_output}")+      list(GET ver_list 0 _major)		   +      list(GET ver_list 1 _minor)+				+    set(win_num_version ${_major}.${_minor})+    DetermineShortWindowsName(win_version "${win_num_version}")+    if(win_version)+      set(${OS_VERSION} ${win_version} PARENT_SCOPE)+    endif()+  else()+    set(${OS_VERSION} ${CMAKE_SYSTEM} PARENT_SCOPE)+  endif()+endfunction()
+ eigen3/cmake/EigenDetermineVSServicePack.cmake view
@@ -0,0 +1,41 @@+include(CMakeDetermineVSServicePack)++# The code is almost identical to the CMake version. The only difference is that we remove+# _DetermineVSServicePack_FastCheckVersionWithCompiler which lead to errors on some systems.+function(EigenDetermineVSServicePack _pack)+    if(NOT DETERMINED_VS_SERVICE_PACK OR NOT ${_pack})+        if(NOT DETERMINED_VS_SERVICE_PACK)+            _DetermineVSServicePack_CheckVersionWithTryCompile(DETERMINED_VS_SERVICE_PACK _cl_version)+            if(NOT DETERMINED_VS_SERVICE_PACK)+                _DetermineVSServicePack_CheckVersionWithTryRun(DETERMINED_VS_SERVICE_PACK _cl_version)+            endif()+        endif()++        if(DETERMINED_VS_SERVICE_PACK)+            if(_cl_version)+                # Call helper function to determine VS version+                _DetermineVSServicePackFromCompiler(_sp "${_cl_version}")+              +                # temporary fix, until CMake catches up+                if (NOT _sp)+                    if(${_cl_version} VERSION_EQUAL "17.00.50727.1")+                        set(_sp "vc110")+                    elseif(${_cl_version} VERSION_EQUAL "17.00.51106.1")+                        set(_sp "vc110sp1")+                    elseif(${_cl_version} VERSION_EQUAL "17.00.60315.1")+                        set(_sp "vc110sp2")+                    elseif(${_cl_version} VERSION_EQUAL "17.00.60610.1")+                        set(_sp "vc110sp3")+                    else()+                        set(_sp ${CMAKE_CXX_COMPILER_VERSION})+                    endif()+                endif()+                +                if(_sp)+                    set(${_pack} ${_sp} CACHE INTERNAL+                        "The Visual Studio Release with Service Pack")+                endif()+            endif()+        endif()+    endif()+endfunction()
+ eigen3/cmake/EigenTesting.cmake view
@@ -0,0 +1,723 @@++macro(ei_add_property prop value)+  get_property(previous GLOBAL PROPERTY ${prop})+  if ((NOT previous) OR (previous STREQUAL ""))+    set_property(GLOBAL PROPERTY ${prop} "${value}")+  else()+    set_property(GLOBAL PROPERTY ${prop} "${previous} ${value}")+  endif()+endmacro(ei_add_property)++#internal. See documentation of ei_add_test for details.+macro(ei_add_test_internal testname testname_with_suffix)+  set(targetname ${testname_with_suffix})++  if(EIGEN_ADD_TEST_FILENAME_EXTENSION)+    set(filename ${testname}.${EIGEN_ADD_TEST_FILENAME_EXTENSION})+  else()+    set(filename ${testname}.cpp)+  endif()++  if(EIGEN_ADD_TEST_FILENAME_EXTENSION STREQUAL cu)+    if(EIGEN_TEST_CUDA_CLANG)+      set_source_files_properties(${filename} PROPERTIES LANGUAGE CXX)+      if(CUDA_64_BIT_DEVICE_CODE)+        link_directories("${CUDA_TOOLKIT_ROOT_DIR}/lib64")+      else()+        link_directories("${CUDA_TOOLKIT_ROOT_DIR}/lib")+      endif()+      if (${ARGC} GREATER 2)+        add_executable(${targetname} ${filename})+      else()+        add_executable(${targetname} ${filename} OPTIONS ${ARGV2})+      endif()+      target_link_libraries(${targetname} "cudart_static" "cuda" "dl" "rt" "pthread")+    else()+      if (${ARGC} GREATER 2)+        cuda_add_executable(${targetname} ${filename} OPTIONS ${ARGV2})+      else()+        cuda_add_executable(${targetname} ${filename})+      endif()+    endif()+  else()+    add_executable(${targetname} ${filename})+  endif()++  if (targetname MATCHES "^eigen2_")+    add_dependencies(eigen2_buildtests ${targetname})+  else()+    add_dependencies(buildtests ${targetname})+  endif()++  if(EIGEN_NO_ASSERTION_CHECKING)+    ei_add_target_property(${targetname} COMPILE_FLAGS "-DEIGEN_NO_ASSERTION_CHECKING=1")+  else(EIGEN_NO_ASSERTION_CHECKING)+    if(EIGEN_DEBUG_ASSERTS)+      ei_add_target_property(${targetname} COMPILE_FLAGS "-DEIGEN_DEBUG_ASSERTS=1")+    endif(EIGEN_DEBUG_ASSERTS)+  endif(EIGEN_NO_ASSERTION_CHECKING)++  ei_add_target_property(${targetname} COMPILE_FLAGS "-DEIGEN_TEST_MAX_SIZE=${EIGEN_TEST_MAX_SIZE}")++  ei_add_target_property(${targetname} COMPILE_FLAGS "-DEIGEN_TEST_FUNC=${testname}")++  if(MSVC)+    ei_add_target_property(${targetname} COMPILE_FLAGS "/bigobj")+  endif()++  # let the user pass flags.+  if(${ARGC} GREATER 2)+    ei_add_target_property(${targetname} COMPILE_FLAGS "${ARGV2}")+  endif(${ARGC} GREATER 2)++  if(EIGEN_TEST_CUSTOM_CXX_FLAGS)+    ei_add_target_property(${targetname} COMPILE_FLAGS "${EIGEN_TEST_CUSTOM_CXX_FLAGS}")+  endif()++  if(EIGEN_STANDARD_LIBRARIES_TO_LINK_TO)+    target_link_libraries(${targetname} ${EIGEN_STANDARD_LIBRARIES_TO_LINK_TO})+  endif()+  if(EXTERNAL_LIBS)+    target_link_libraries(${targetname} ${EXTERNAL_LIBS})+  endif()+  if(EIGEN_TEST_CUSTOM_LINKER_FLAGS)+    target_link_libraries(${targetname} ${EIGEN_TEST_CUSTOM_LINKER_FLAGS})+  endif()++  if(${ARGC} GREATER 3)+    set(libs_to_link ${ARGV3})+    # it could be that some cmake module provides a bad library string " "  (just spaces),+    # and that severely breaks target_link_libraries ("can't link to -l-lstdc++" errors).+    # so we check for strings containing only spaces.+    string(STRIP "${libs_to_link}" libs_to_link_stripped)+    string(LENGTH "${libs_to_link_stripped}" libs_to_link_stripped_length)+    if(${libs_to_link_stripped_length} GREATER 0)+      # notice: no double quotes around ${libs_to_link} here. It may be a list.+      target_link_libraries(${targetname} ${libs_to_link})+    endif()+  endif()++  add_test(${testname_with_suffix} "${targetname}")++  # Specify target and test labels accoirding to EIGEN_CURRENT_SUBPROJECT+  get_property(current_subproject GLOBAL PROPERTY EIGEN_CURRENT_SUBPROJECT)+  if ((current_subproject) AND (NOT (current_subproject STREQUAL "")))+    set_property(TARGET ${targetname} PROPERTY LABELS "Build${current_subproject}")+    add_dependencies("Build${current_subproject}" ${targetname})+    set_property(TEST ${testname_with_suffix} PROPERTY LABELS "${current_subproject}")+  endif()++endmacro(ei_add_test_internal)++# SYCL+macro(ei_add_test_internal_sycl testname testname_with_suffix)+  include_directories( SYSTEM ${COMPUTECPP_PACKAGE_ROOT_DIR}/include)+  set(targetname ${testname_with_suffix})++  if(EIGEN_ADD_TEST_FILENAME_EXTENSION)+    set(filename ${testname}.${EIGEN_ADD_TEST_FILENAME_EXTENSION})+  else()+    set(filename ${testname}.cpp)+  endif()++  set( include_file ${CMAKE_CURRENT_BINARY_DIR}/inc_${filename})+  set( bc_file ${CMAKE_CURRENT_BINARY_DIR}/${filename})+  set( host_file ${CMAKE_CURRENT_SOURCE_DIR}/${filename})++  ADD_CUSTOM_COMMAND(+    OUTPUT ${include_file}+    COMMAND ${CMAKE_COMMAND} -E echo "\\#include \\\"${host_file}\\\"" > ${include_file}+    COMMAND ${CMAKE_COMMAND} -E echo "\\#include \\\"${bc_file}.sycl\\\"" >> ${include_file}+    DEPENDS ${filename} ${bc_file}.sycl+    COMMENT "Building ComputeCpp integration header file ${include_file}"+  )+  # Add a custom target for the generated integration header+  add_custom_target(${testname}_integration_header_sycl DEPENDS ${include_file})++  add_executable(${targetname} ${include_file})+  add_dependencies(${targetname} ${testname}_integration_header_sycl)+  add_sycl_to_target(${targetname} ${filename} ${CMAKE_CURRENT_BINARY_DIR})++  if (targetname MATCHES "^eigen2_")+    add_dependencies(eigen2_buildtests ${targetname})+  else()+    add_dependencies(buildtests ${targetname})+  endif()++  if(EIGEN_NO_ASSERTION_CHECKING)+    ei_add_target_property(${targetname} COMPILE_FLAGS "-DEIGEN_NO_ASSERTION_CHECKING=1")+  else(EIGEN_NO_ASSERTION_CHECKING)+    if(EIGEN_DEBUG_ASSERTS)+      ei_add_target_property(${targetname} COMPILE_FLAGS "-DEIGEN_DEBUG_ASSERTS=1")+    endif(EIGEN_DEBUG_ASSERTS)+  endif(EIGEN_NO_ASSERTION_CHECKING)++  ei_add_target_property(${targetname} COMPILE_FLAGS "-DEIGEN_TEST_MAX_SIZE=${EIGEN_TEST_MAX_SIZE}")++  ei_add_target_property(${targetname} COMPILE_FLAGS "-DEIGEN_TEST_FUNC=${testname}")++  if(MSVC AND NOT EIGEN_SPLIT_LARGE_TESTS)+    ei_add_target_property(${targetname} COMPILE_FLAGS "/bigobj")+  endif()++  # let the user pass flags.+  if(${ARGC} GREATER 2)+    ei_add_target_property(${targetname} COMPILE_FLAGS "${ARGV2}")+  endif(${ARGC} GREATER 2)++  if(EIGEN_TEST_CUSTOM_CXX_FLAGS)+    ei_add_target_property(${targetname} COMPILE_FLAGS "${EIGEN_TEST_CUSTOM_CXX_FLAGS}")+  endif()++  if(EIGEN_STANDARD_LIBRARIES_TO_LINK_TO)+    target_link_libraries(${targetname} ${EIGEN_STANDARD_LIBRARIES_TO_LINK_TO})+  endif()+  if(EXTERNAL_LIBS)+    target_link_libraries(${targetname} ${EXTERNAL_LIBS})+  endif()+  if(EIGEN_TEST_CUSTOM_LINKER_FLAGS)+    target_link_libraries(${targetname} ${EIGEN_TEST_CUSTOM_LINKER_FLAGS})+  endif()++  if(${ARGC} GREATER 3)+    set(libs_to_link ${ARGV3})+    # it could be that some cmake module provides a bad library string " "  (just spaces),+    # and that severely breaks target_link_libraries ("can't link to -l-lstdc++" errors).+    # so we check for strings containing only spaces.+    string(STRIP "${libs_to_link}" libs_to_link_stripped)+    string(LENGTH "${libs_to_link_stripped}" libs_to_link_stripped_length)+    if(${libs_to_link_stripped_length} GREATER 0)+      # notice: no double quotes around ${libs_to_link} here. It may be a list.+      target_link_libraries(${targetname} ${libs_to_link})+    endif()+  endif()++  add_test(${testname_with_suffix} "${targetname}")++  # Specify target and test labels according to EIGEN_CURRENT_SUBPROJECT+  get_property(current_subproject GLOBAL PROPERTY EIGEN_CURRENT_SUBPROJECT)+  if ((current_subproject) AND (NOT (current_subproject STREQUAL "")))+    set_property(TARGET ${targetname} PROPERTY LABELS "Build${current_subproject}")+    add_dependencies("Build${current_subproject}" ${targetname})+    set_property(TEST ${testname_with_suffix} PROPERTY LABELS "${current_subproject}")+  endif()+++endmacro(ei_add_test_internal_sycl)+++# Macro to add a test+#+# the unique mandatory parameter testname must correspond to a file+# <testname>.cpp which follows this pattern:+#+# #include "main.h"+# void test_<testname>() { ... }+#+# Depending on the contents of that file, this macro can have 2 behaviors,+# see below.+#+# The optional 2nd parameter is libraries to link to.+#+# A. Default behavior+#+# this macro adds an executable <testname> as well as a ctest test+# named <testname> too.+#+# On platforms with bash simply run:+#   "ctest -V" or "ctest -V -R <testname>"+# On other platform use ctest as usual+#+# B. Multi-part behavior+#+# If the source file matches the regexp+#    CALL_SUBTEST_[0-9]+|EIGEN_TEST_PART_[0-9]++# then it is interpreted as a multi-part test. The behavior then depends on the+# CMake option EIGEN_SPLIT_LARGE_TESTS, which is ON by default.+#+# If EIGEN_SPLIT_LARGE_TESTS is OFF, the behavior is the same as in A (the multi-part+# aspect is ignored).+#+# If EIGEN_SPLIT_LARGE_TESTS is ON, the test is split into multiple executables+#   test_<testname>_<N>+# where N runs from 1 to the greatest occurence found in the source file. Each of these+# executables is built passing -DEIGEN_TEST_PART_N. This allows to split large tests+# into smaller executables.+#+# Moreover, targets <testname> are still generated, they+# have the effect of building all the parts of the test.+#+# Again, ctest -R allows to run all matching tests.+macro(ei_add_test testname)+  get_property(EIGEN_TESTS_LIST GLOBAL PROPERTY EIGEN_TESTS_LIST)+  set(EIGEN_TESTS_LIST "${EIGEN_TESTS_LIST}${testname}\n")+  set_property(GLOBAL PROPERTY EIGEN_TESTS_LIST "${EIGEN_TESTS_LIST}")++  if(EIGEN_ADD_TEST_FILENAME_EXTENSION)+    set(filename ${testname}.${EIGEN_ADD_TEST_FILENAME_EXTENSION})+  else()+    set(filename ${testname}.cpp)+  endif()++  file(READ "${filename}" test_source)+  set(parts 0)+  string(REGEX MATCHALL "CALL_SUBTEST_[0-9]+|EIGEN_TEST_PART_[0-9]+|EIGEN_SUFFIXES(;[0-9]+)+"+         occurences "${test_source}")+  string(REGEX REPLACE "CALL_SUBTEST_|EIGEN_TEST_PART_|EIGEN_SUFFIXES" "" suffixes "${occurences}")+  list(REMOVE_DUPLICATES suffixes)+  if(EIGEN_SPLIT_LARGE_TESTS AND suffixes)+    add_custom_target(${testname})+    foreach(suffix ${suffixes})+      ei_add_test_internal(${testname} ${testname}_${suffix}+        "${ARGV1} -DEIGEN_TEST_PART_${suffix}=1" "${ARGV2}")+      add_dependencies(${testname} ${testname}_${suffix})+    endforeach(suffix)+  else(EIGEN_SPLIT_LARGE_TESTS AND suffixes)+    set(symbols_to_enable_all_parts "")+    foreach(suffix ${suffixes})+      set(symbols_to_enable_all_parts+        "${symbols_to_enable_all_parts} -DEIGEN_TEST_PART_${suffix}=1")+    endforeach(suffix)+    ei_add_test_internal(${testname} ${testname} "${ARGV1} ${symbols_to_enable_all_parts}" "${ARGV2}")+  endif(EIGEN_SPLIT_LARGE_TESTS AND suffixes)+endmacro(ei_add_test)++macro(ei_add_test_sycl testname)+  get_property(EIGEN_TESTS_LIST GLOBAL PROPERTY EIGEN_TESTS_LIST)+  set(EIGEN_TESTS_LIST "${EIGEN_TESTS_LIST}${testname}\n")+  set_property(GLOBAL PROPERTY EIGEN_TESTS_LIST "${EIGEN_TESTS_LIST}")++  if(EIGEN_ADD_TEST_FILENAME_EXTENSION)+    set(filename ${testname}.${EIGEN_ADD_TEST_FILENAME_EXTENSION})+  else()+    set(filename ${testname}.cpp)+  endif()++  file(READ "${filename}" test_source)+  set(parts 0)+  string(REGEX MATCHALL "CALL_SUBTEST_[0-9]+|EIGEN_TEST_PART_[0-9]+|EIGEN_SUFFIXES(;[0-9]+)+"+         occurences "${test_source}")+  string(REGEX REPLACE "CALL_SUBTEST_|EIGEN_TEST_PART_|EIGEN_SUFFIXES" "" suffixes "${occurences}")+  list(REMOVE_DUPLICATES suffixes)+  if(EIGEN_SPLIT_LARGE_TESTS AND suffixes)+    add_custom_target(${testname})+    foreach(suffix ${suffixes})+      ei_add_test_internal_sycl(${testname} ${testname}_${suffix}+        "${ARGV1} -DEIGEN_TEST_PART_${suffix}=1" "${ARGV2}")+      add_dependencies(${testname} ${testname}_${suffix})+    endforeach(suffix)+  else(EIGEN_SPLIT_LARGE_TESTS AND suffixes)+    set(symbols_to_enable_all_parts "")+    foreach(suffix ${suffixes})+      set(symbols_to_enable_all_parts+        "${symbols_to_enable_all_parts} -DEIGEN_TEST_PART_${suffix}=1")+    endforeach(suffix)+    ei_add_test_internal_sycl(${testname} ${testname} "${ARGV1} ${symbols_to_enable_all_parts}" "${ARGV2}")+  endif(EIGEN_SPLIT_LARGE_TESTS AND suffixes)+endmacro(ei_add_test_sycl)++# adds a failtest, i.e. a test that succeed if the program fails to compile+# note that the test runner for these is CMake itself, when passed -DEIGEN_FAILTEST=ON+# so here we're just running CMake commands immediately, we're not adding any targets.+macro(ei_add_failtest testname)+  get_property(EIGEN_FAILTEST_FAILURE_COUNT GLOBAL PROPERTY EIGEN_FAILTEST_FAILURE_COUNT)+  get_property(EIGEN_FAILTEST_COUNT GLOBAL PROPERTY EIGEN_FAILTEST_COUNT)++  message(STATUS "Checking failtest: ${testname}")+  set(filename "${testname}.cpp")+  file(READ "${filename}" test_source)++  try_compile(succeeds_when_it_should_fail+              "${CMAKE_CURRENT_BINARY_DIR}"+              "${CMAKE_CURRENT_SOURCE_DIR}/${filename}"+              COMPILE_DEFINITIONS "-DEIGEN_SHOULD_FAIL_TO_BUILD")+  if (succeeds_when_it_should_fail)+    message(STATUS "FAILED: ${testname} build succeeded when it should have failed")+  endif()++  try_compile(succeeds_when_it_should_succeed+              "${CMAKE_CURRENT_BINARY_DIR}"+              "${CMAKE_CURRENT_SOURCE_DIR}/${filename}"+              COMPILE_DEFINITIONS)+  if (NOT succeeds_when_it_should_succeed)+    message(STATUS "FAILED: ${testname} build failed when it should have succeeded")+  endif()++  if (succeeds_when_it_should_fail OR NOT succeeds_when_it_should_succeed)+    math(EXPR EIGEN_FAILTEST_FAILURE_COUNT ${EIGEN_FAILTEST_FAILURE_COUNT}+1)+  endif()++  math(EXPR EIGEN_FAILTEST_COUNT ${EIGEN_FAILTEST_COUNT}+1)++  set_property(GLOBAL PROPERTY EIGEN_FAILTEST_FAILURE_COUNT ${EIGEN_FAILTEST_FAILURE_COUNT})+  set_property(GLOBAL PROPERTY EIGEN_FAILTEST_COUNT ${EIGEN_FAILTEST_COUNT})+endmacro(ei_add_failtest)++# print a summary of the different options+macro(ei_testing_print_summary)+  message(STATUS "************************************************************")+  message(STATUS "***    Eigen's unit tests configuration summary          ***")+  message(STATUS "************************************************************")+  message(STATUS "")+  message(STATUS "Build type:        ${CMAKE_BUILD_TYPE}")+  message(STATUS "Build site:        ${SITE}")+  message(STATUS "Build string:      ${BUILDNAME}")+  get_property(EIGEN_TESTING_SUMMARY GLOBAL PROPERTY EIGEN_TESTING_SUMMARY)+  get_property(EIGEN_TESTED_BACKENDS GLOBAL PROPERTY EIGEN_TESTED_BACKENDS)+  get_property(EIGEN_MISSING_BACKENDS GLOBAL PROPERTY EIGEN_MISSING_BACKENDS)+  message(STATUS "Enabled backends:  ${EIGEN_TESTED_BACKENDS}")+  message(STATUS "Disabled backends: ${EIGEN_MISSING_BACKENDS}")++  if(EIGEN_DEFAULT_TO_ROW_MAJOR)+    message(STATUS "Default order:     Row-major")+  else()+    message(STATUS "Default order:     Column-major")+  endif()++  if(EIGEN_TEST_NO_EXPLICIT_ALIGNMENT)+    message(STATUS "Explicit alignment (hence vectorization) disabled")+  elseif(EIGEN_TEST_NO_EXPLICIT_VECTORIZATION)+    message(STATUS "Explicit vectorization disabled (alignment kept enabled)")+  else()++  message(STATUS "Maximal matrix/vector size: ${EIGEN_TEST_MAX_SIZE}")++    if(EIGEN_TEST_SSE2)+      message(STATUS "SSE2:              ON")+    else()+      message(STATUS "SSE2:              Using architecture defaults")+    endif()++    if(EIGEN_TEST_SSE3)+      message(STATUS "SSE3:              ON")+    else()+      message(STATUS "SSE3:              Using architecture defaults")+    endif()++    if(EIGEN_TEST_SSSE3)+      message(STATUS "SSSE3:             ON")+    else()+      message(STATUS "SSSE3:             Using architecture defaults")+    endif()++    if(EIGEN_TEST_SSE4_1)+      message(STATUS "SSE4.1:            ON")+    else()+      message(STATUS "SSE4.1:            Using architecture defaults")+    endif()++    if(EIGEN_TEST_SSE4_2)+      message(STATUS "SSE4.2:            ON")+    else()+      message(STATUS "SSE4.2:            Using architecture defaults")+    endif()++    if(EIGEN_TEST_AVX)+      message(STATUS "AVX:               ON")+    else()+      message(STATUS "AVX:               Using architecture defaults")+    endif()++    if(EIGEN_TEST_FMA)+      message(STATUS "FMA:               ON")+    else()+      message(STATUS "FMA:               Using architecture defaults")+    endif()++    if(EIGEN_TEST_AVX512)+      message(STATUS "AVX512:            ON")+    else()+      message(STATUS "AVX512:            Using architecture defaults")+    endif()++    if(EIGEN_TEST_ALTIVEC)+      message(STATUS "Altivec:           ON")+    else()+      message(STATUS "Altivec:           Using architecture defaults")+    endif()++    if(EIGEN_TEST_VSX)+      message(STATUS "VSX:               ON")+    else()+      message(STATUS "VSX:               Using architecture defaults")+    endif()++    if(EIGEN_TEST_NEON)+      message(STATUS "ARM NEON:          ON")+    else()+      message(STATUS "ARM NEON:          Using architecture defaults")+    endif()++    if(EIGEN_TEST_NEON64)+      message(STATUS "ARMv8 NEON:        ON")+    else()+      message(STATUS "ARMv8 NEON:        Using architecture defaults")+    endif()++    if(EIGEN_TEST_ZVECTOR)+      message(STATUS "S390X ZVECTOR:     ON")+    else()+      message(STATUS "S390X ZVECTOR:     Using architecture defaults")+    endif()++    if(EIGEN_TEST_CXX11)+      message(STATUS "C++11:             ON")+    else()+      message(STATUS "C++11:             OFF")+    endif()++    if(EIGEN_TEST_SYCL)+      message(STATUS "SYCL:              ON")+    else()+      message(STATUS "SYCL:              OFF")+    endif()+    if(EIGEN_TEST_CUDA)+      if(EIGEN_TEST_CUDA_CLANG)+        message(STATUS "CUDA:              ON (using clang)")+      else()+        message(STATUS "CUDA:              ON (using nvcc)")+      endif()+    else()+      message(STATUS "CUDA:              OFF")+    endif()++  endif() # vectorization / alignment options++  message(STATUS "\n${EIGEN_TESTING_SUMMARY}")++  message(STATUS "************************************************************")+endmacro(ei_testing_print_summary)++macro(ei_init_testing)+  define_property(GLOBAL PROPERTY EIGEN_CURRENT_SUBPROJECT BRIEF_DOCS " " FULL_DOCS " ")+  define_property(GLOBAL PROPERTY EIGEN_TESTED_BACKENDS BRIEF_DOCS " " FULL_DOCS " ")+  define_property(GLOBAL PROPERTY EIGEN_MISSING_BACKENDS BRIEF_DOCS " " FULL_DOCS " ")+  define_property(GLOBAL PROPERTY EIGEN_TESTING_SUMMARY BRIEF_DOCS " " FULL_DOCS " ")+  define_property(GLOBAL PROPERTY EIGEN_TESTS_LIST BRIEF_DOCS " " FULL_DOCS " ")++  set_property(GLOBAL PROPERTY EIGEN_TESTED_BACKENDS "")+  set_property(GLOBAL PROPERTY EIGEN_MISSING_BACKENDS "")+  set_property(GLOBAL PROPERTY EIGEN_TESTING_SUMMARY "")+  set_property(GLOBAL PROPERTY EIGEN_TESTS_LIST "")++  define_property(GLOBAL PROPERTY EIGEN_FAILTEST_FAILURE_COUNT BRIEF_DOCS " " FULL_DOCS " ")+  define_property(GLOBAL PROPERTY EIGEN_FAILTEST_COUNT BRIEF_DOCS " " FULL_DOCS " ")++  set_property(GLOBAL PROPERTY EIGEN_FAILTEST_FAILURE_COUNT "0")+  set_property(GLOBAL PROPERTY EIGEN_FAILTEST_COUNT "0")++  # uncomment anytime you change the ei_get_compilerver_from_cxx_version_string macro+  # ei_test_get_compilerver_from_cxx_version_string()+endmacro(ei_init_testing)++macro(ei_set_sitename)+  # if the sitename is not yet set, try to set it+  if(NOT ${SITE} OR ${SITE} STREQUAL "")+    set(eigen_computername $ENV{COMPUTERNAME})+    set(eigen_hostname $ENV{HOSTNAME})+    if(eigen_hostname)+      set(SITE ${eigen_hostname})+    elseif(eigen_computername)+      set(SITE ${eigen_computername})+    endif()+  endif()+  # in case it is already set, enforce lower case+  if(SITE)+    string(TOLOWER ${SITE} SITE)+  endif()+endmacro(ei_set_sitename)++macro(ei_get_compilerver VAR)+    if(MSVC)+      # on windows system, we use a modified CMake script+      include(EigenDetermineVSServicePack)+      EigenDetermineVSServicePack( my_service_pack )++      if( my_service_pack )+        set(${VAR} ${my_service_pack})+      else()+        set(${VAR} "na")+      endif()+    else()+    # on all other system we rely on ${CMAKE_CXX_COMPILER}+    # supporting a "--version" or "/version" flag++    if(WIN32 AND ${CMAKE_CXX_COMPILER_ID} EQUAL "Intel")+      set(EIGEN_CXX_FLAG_VERSION "/version")+    else()+      set(EIGEN_CXX_FLAG_VERSION "--version")+    endif()++    execute_process(COMMAND ${CMAKE_CXX_COMPILER} ${EIGEN_CXX_FLAG_VERSION}+                    OUTPUT_VARIABLE eigen_cxx_compiler_version_string OUTPUT_STRIP_TRAILING_WHITESPACE)+    string(REGEX REPLACE "[\n\r].*"  ""  eigen_cxx_compiler_version_string  ${eigen_cxx_compiler_version_string})++    ei_get_compilerver_from_cxx_version_string("${eigen_cxx_compiler_version_string}" CNAME CVER)+    set(${VAR} "${CNAME}-${CVER}")++  endif()+endmacro(ei_get_compilerver)++# Extract compiler name and version from a raw version string+# WARNING: if you edit thid macro, then please test it by  uncommenting+# the testing macro call in ei_init_testing() of the EigenTesting.cmake file.+# See also the ei_test_get_compilerver_from_cxx_version_string macro at the end of the file+macro(ei_get_compilerver_from_cxx_version_string VERSTRING CNAME CVER)+  # extract possible compiler names+  string(REGEX MATCH "g\\+\\+"      ei_has_gpp    ${VERSTRING})+  string(REGEX MATCH "llvm|LLVM"    ei_has_llvm   ${VERSTRING})+  string(REGEX MATCH "gcc|GCC"      ei_has_gcc    ${VERSTRING})+  string(REGEX MATCH "icpc|ICC"     ei_has_icpc   ${VERSTRING})+  string(REGEX MATCH "clang|CLANG"  ei_has_clang  ${VERSTRING})++  # combine them+  if((ei_has_llvm) AND (ei_has_gpp OR ei_has_gcc))+    set(${CNAME} "llvm-g++")+  elseif((ei_has_llvm) AND (ei_has_clang))+    set(${CNAME} "llvm-clang++")+  elseif(ei_has_clang)+    set(${CNAME} "clang++")+  elseif(ei_has_icpc)+    set(${CNAME} "icpc")+  elseif(ei_has_gpp OR ei_has_gcc)+    set(${CNAME} "g++")+  else()+    set(${CNAME} "_")+  endif()++  # extract possible version numbers+  # first try to extract 3 isolated numbers:+  string(REGEX MATCH " [0-9]+\\.[0-9]+\\.[0-9]+" eicver ${VERSTRING})+  if(NOT eicver)+    # try to extract 2 isolated ones:+    string(REGEX MATCH " [0-9]+\\.[0-9]+" eicver ${VERSTRING})+    if(NOT eicver)+      # try to extract 3:+      string(REGEX MATCH "[^0-9][0-9]+\\.[0-9]+\\.[0-9]+" eicver ${VERSTRING})+      if(NOT eicver)+        # try to extract 2:+        string(REGEX MATCH "[^0-9][0-9]+\\.[0-9]+" eicver ${VERSTRING})+      else()+        set(eicver " _")+      endif()+    endif()+  endif()++  string(REGEX REPLACE ".(.*)" "\\1" ${CVER} ${eicver})++endmacro(ei_get_compilerver_from_cxx_version_string)++macro(ei_get_cxxflags VAR)+  set(${VAR} "")+  ei_is_64bit_env(IS_64BIT_ENV)+  if(EIGEN_TEST_NEON)+    set(${VAR} NEON)+  elseif(EIGEN_TEST_NEON64)+    set(${VAR} NEON)+  elseif(EIGEN_TEST_ZVECTOR)+    set(${VAR} ZVECTOR)+  elseif(EIGEN_TEST_VSX)+    set(${VAR} VSX)+  elseif(EIGEN_TEST_ALTIVEC)+    set(${VAR} ALVEC)+  elseif(EIGEN_TEST_FMA)+    set(${VAR} FMA)+  elseif(EIGEN_TEST_AVX)+    set(${VAR} AVX)+  elseif(EIGEN_TEST_SSE4_2)+    set(${VAR} SSE42)+  elseif(EIGEN_TEST_SSE4_1)+    set(${VAR} SSE41)+  elseif(EIGEN_TEST_SSSE3)+    set(${VAR} SSSE3)+  elseif(EIGEN_TEST_SSE3)+    set(${VAR} SSE3)+  elseif(EIGEN_TEST_SSE2 OR IS_64BIT_ENV)+    set(${VAR} SSE2)+  endif()++  if(EIGEN_TEST_OPENMP)+    if (${VAR} STREQUAL "")+      set(${VAR} OMP)+    else()+      set(${VAR} ${${VAR}}-OMP)+    endif()+  endif()++  if(EIGEN_DEFAULT_TO_ROW_MAJOR)+    if (${VAR} STREQUAL "")+      set(${VAR} ROW)+    else()+      set(${VAR} ${${VAR}}-ROWMAJ)+    endif()+  endif()+endmacro(ei_get_cxxflags)++macro(ei_set_build_string)+  ei_get_compilerver(LOCAL_COMPILER_VERSION)+  ei_get_cxxflags(LOCAL_COMPILER_FLAGS)++  include(EigenDetermineOSVersion)+  DetermineOSVersion(OS_VERSION)++  set(TMP_BUILD_STRING ${OS_VERSION}-${LOCAL_COMPILER_VERSION})++  if (NOT ${LOCAL_COMPILER_FLAGS} STREQUAL  "")+    set(TMP_BUILD_STRING ${TMP_BUILD_STRING}-${LOCAL_COMPILER_FLAGS})+  endif()++  ei_is_64bit_env(IS_64BIT_ENV)+  if(NOT IS_64BIT_ENV)+    set(TMP_BUILD_STRING ${TMP_BUILD_STRING}-32bit)+  else()+    set(TMP_BUILD_STRING ${TMP_BUILD_STRING}-64bit)+  endif()++  if(EIGEN_TEST_CXX11)+    set(TMP_BUILD_STRING ${TMP_BUILD_STRING}-cxx11)+  endif()++  if(EIGEN_BUILD_STRING_SUFFIX)+    set(TMP_BUILD_STRING ${TMP_BUILD_STRING}-${EIGEN_BUILD_STRING_SUFFIX})+  endif()++  string(TOLOWER ${TMP_BUILD_STRING} BUILDNAME)+endmacro(ei_set_build_string)++macro(ei_is_64bit_env VAR)+  if(CMAKE_SIZEOF_VOID_P EQUAL 8)+    set(${VAR} 1)+  elseif(CMAKE_SIZEOF_VOID_P EQUAL 4)+    set(${VAR} 0)+  else()+    message(WARNING "Unsupported pointer size. Please contact the authors.")+  endif()+endmacro(ei_is_64bit_env)+++# helper macro for testing ei_get_compilerver_from_cxx_version_string+# STR: raw version string+# REFNAME: expected compiler name+# REFVER: expected compiler version+macro(ei_test1_get_compilerver_from_cxx_version_string STR REFNAME REFVER)+  ei_get_compilerver_from_cxx_version_string(${STR} CNAME CVER)+  if((NOT ${REFNAME} STREQUAL ${CNAME}) OR (NOT ${REFVER} STREQUAL ${CVER}))+    message("STATUS ei_get_compilerver_from_cxx_version_string error:")+    message("Expected \"${REFNAME}-${REFVER}\", got \"${CNAME}-${CVER}\"")+  endif()+endmacro(ei_test1_get_compilerver_from_cxx_version_string)++# macro for testing ei_get_compilerver_from_cxx_version_string+# feel free to add more version strings+macro(ei_test_get_compilerver_from_cxx_version_string)+  ei_test1_get_compilerver_from_cxx_version_string("g++ (SUSE Linux) 4.5.3 20110428 [gcc-4_5-branch revision 173117]" "g++" "4.5.3")+  ei_test1_get_compilerver_from_cxx_version_string("c++ (GCC) 4.5.1 20100924 (Red Hat 4.5.1-4)" "g++" "4.5.1")+  ei_test1_get_compilerver_from_cxx_version_string("icpc (ICC) 11.0 20081105" "icpc" "11.0")+  ei_test1_get_compilerver_from_cxx_version_string("g++-3.4 (GCC) 3.4.6" "g++" "3.4.6")+  ei_test1_get_compilerver_from_cxx_version_string("SUSE Linux clang version 3.0 (branches/release_30 145598) (based on LLVM 3.0)" "llvm-clang++" "3.0")+  ei_test1_get_compilerver_from_cxx_version_string("icpc (ICC) 12.0.5 20110719" "icpc" "12.0.5")+  ei_test1_get_compilerver_from_cxx_version_string("Apple clang version 2.1 (tags/Apple/clang-163.7.1) (based on LLVM 3.0svn)" "llvm-clang++" "2.1")+  ei_test1_get_compilerver_from_cxx_version_string("i686-apple-darwin11-llvm-g++-4.2 (GCC) 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)" "llvm-g++" "4.2.1")+  ei_test1_get_compilerver_from_cxx_version_string("g++-mp-4.4 (GCC) 4.4.6" "g++" "4.4.6")+  ei_test1_get_compilerver_from_cxx_version_string("g++-mp-4.4 (GCC) 2011" "g++" "4.4")+endmacro(ei_test_get_compilerver_from_cxx_version_string)
+ eigen3/cmake/EigenUninstall.cmake view
@@ -0,0 +1,40 @@+################ CMake Uninstall Template #######################+# CMake Template file for uninstallation of files+# mentioned in 'install_manifest.txt'+#+# Used by uinstall target+#################################################################++set(MANIFEST "${CMAKE_CURRENT_BINARY_DIR}/install_manifest.txt")++if(EXISTS ${MANIFEST})+  message(STATUS "============== Uninstalling Eigen  ===================")++  file(STRINGS ${MANIFEST} files)+  foreach(file ${files})+    if(EXISTS ${file})+      message(STATUS "Removing file: '${file}'")++      execute_process(+        COMMAND ${CMAKE_COMMAND} -E remove ${file}+        OUTPUT_VARIABLE rm_out+        RESULT_VARIABLE rm_retval+        )++      if(NOT "${rm_retval}" STREQUAL 0)+        message(FATAL_ERROR "Failed to remove file: '${file}'.")+      endif()+    else()+      message(STATUS "File '${file}' does not exist.")+    endif()+  endforeach(file)++  message(STATUS "========== Finished Uninstalling Eigen  ==============")+else()+  message(STATUS "Cannot find install manifest: '${MANIFEST}'")+  message(STATUS "Probably make install has not been performed")+  message(STATUS "   or install_manifest.txt has been deleted.")+endif()+++
+ eigen3/cmake/FindAdolc.cmake view
@@ -0,0 +1,20 @@++if (ADOLC_INCLUDES AND ADOLC_LIBRARIES)+  set(ADOLC_FIND_QUIETLY TRUE)+endif (ADOLC_INCLUDES AND ADOLC_LIBRARIES)++find_path(ADOLC_INCLUDES+  NAMES+  adolc/adtl.h+  PATHS+  $ENV{ADOLCDIR}+  ${INCLUDE_INSTALL_DIR}+)++find_library(ADOLC_LIBRARIES adolc PATHS $ENV{ADOLCDIR} ${LIB_INSTALL_DIR})++include(FindPackageHandleStandardArgs)+find_package_handle_standard_args(ADOLC DEFAULT_MSG+                                  ADOLC_INCLUDES ADOLC_LIBRARIES)++mark_as_advanced(ADOLC_INCLUDES ADOLC_LIBRARIES)
+ eigen3/cmake/FindBLAS.cmake view
@@ -0,0 +1,1406 @@+###+#+# @copyright (c) 2009-2014 The University of Tennessee and The University+#                          of Tennessee Research Foundation.+#                          All rights reserved.+# @copyright (c) 2012-2016 Inria. All rights reserved.+# @copyright (c) 2012-2014 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, Univ. Bordeaux. All rights reserved.+#+###+#+# - Find BLAS library+# This module finds an installed fortran library that implements the BLAS+# linear-algebra interface (see http://www.netlib.org/blas/).+# The list of libraries searched for is taken+# from the autoconf macro file, acx_blas.m4 (distributed at+# http://ac-archive.sourceforge.net/ac-archive/acx_blas.html).+#+# This module sets the following variables:+#  BLAS_FOUND - set to true if a library implementing the BLAS interface+#    is found+#  BLAS_LINKER_FLAGS - uncached list of required linker flags (excluding -l+#    and -L).+#  BLAS_COMPILER_FLAGS - uncached list of required compiler flags (including -I for mkl headers).+#  BLAS_LIBRARIES - uncached list of libraries (using full path name) to+#    link against to use BLAS+#  BLAS95_LIBRARIES - uncached list of libraries (using full path name)+#    to link against to use BLAS95 interface+#  BLAS95_FOUND - set to true if a library implementing the BLAS f95 interface+#    is found+#  BLA_STATIC  if set on this determines what kind of linkage we do (static)+#  BLA_VENDOR  if set checks only the specified vendor, if not set checks+#     all the possibilities+#  BLAS_VENDOR_FOUND stores the BLAS vendor found +#  BLA_F95     if set on tries to find the f95 interfaces for BLAS/LAPACK+# The user can give specific paths where to find the libraries adding cmake+# options at configure (ex: cmake path/to/project -DBLAS_DIR=path/to/blas):+#  BLAS_DIR            - Where to find the base directory of blas+#  BLAS_INCDIR         - Where to find the header files+#  BLAS_LIBDIR         - Where to find the library files+# The module can also look for the following environment variables if paths+# are not given as cmake variable: BLAS_DIR, BLAS_INCDIR, BLAS_LIBDIR+# For MKL case and if no paths are given as hints, we will try to use the MKLROOT+# environment variable+#  BLAS_VERBOSE Print some additional information during BLAS libraries detection+##########+### List of vendors (BLA_VENDOR) valid in this module+########## List of vendors (BLA_VENDOR) valid in this module+##  Open (for OpenBlas), Eigen (for EigenBlas), Goto, ATLAS PhiPACK,+##  CXML, DXML, SunPerf, SCSL, SGIMATH, IBMESSL, IBMESSLMT+##  Intel10_32 (intel mkl v10 32 bit), Intel10_64lp (intel mkl v10 64 bit,lp thread model, lp64 model),+##  Intel10_64lp_seq (intel mkl v10 64 bit,sequential code, lp64 model),+##  Intel( older versions of mkl 32 and 64 bit),+##  ACML, ACML_MP, ACML_GPU, Apple, NAS, Generic+# C/CXX should be enabled to use Intel mkl+###+# We handle different modes to find the dependency+#+# - Detection if already installed on the system+#   - BLAS libraries can be detected from different ways+#     Here is the order of precedence:+#     1) we look in cmake variable BLAS_LIBDIR or BLAS_DIR (we guess the libdirs) if defined+#     2) we look in environment variable BLAS_LIBDIR or BLAS_DIR (we guess the libdirs) if defined+#     3) we look in common environnment variables depending on the system (INCLUDE, C_INCLUDE_PATH, CPATH - LIB, DYLD_LIBRARY_PATH, LD_LIBRARY_PATH)+#     4) we look in common system paths depending on the system, see for example paths contained in the following cmake variables:+#       - CMAKE_PLATFORM_IMPLICIT_INCLUDE_DIRECTORIES, CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES+#       - CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES, CMAKE_C_IMPLICIT_LINK_DIRECTORIES+#++#=============================================================================+# Copyright 2007-2009 Kitware, Inc.+#+# Distributed under the OSI-approved BSD License (the "License");+# see accompanying file Copyright.txt for details.+#+# This software is distributed WITHOUT ANY WARRANTY; without even the+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.+# See the License for more information.+#=============================================================================+# (To distribute this file outside of CMake, substitute the full+#  License text for the above reference.)++## Some macros to print status when search for headers and libs+# This macro informs why the _lib_to_find file has not been found+macro(Print_Find_Library_Blas_Status _libname _lib_to_find)++  # save _libname upper/lower case+  string(TOUPPER ${_libname} LIBNAME)+  string(TOLOWER ${_libname} libname)++  # print status+  #message(" ")+  if(${LIBNAME}_LIBDIR)+    message("${Yellow}${LIBNAME}_LIBDIR is defined but ${_lib_to_find}"+      "has not been found in ${ARGN}${ColourReset}")+  else()+    if(${LIBNAME}_DIR)+      message("${Yellow}${LIBNAME}_DIR is defined but ${_lib_to_find}"+	"has not been found in ${ARGN}${ColourReset}")+    else()+      message("${Yellow}${_lib_to_find} not found."+	"Nor ${LIBNAME}_DIR neither ${LIBNAME}_LIBDIR"+	"are defined so that we look for ${_lib_to_find} in"+	"system paths (Linux: LD_LIBRARY_PATH, Windows: LIB,"+	"Mac: DYLD_LIBRARY_PATH,"+	"CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES,"+	"CMAKE_C_IMPLICIT_LINK_DIRECTORIES)${ColourReset}")+      if(_lib_env)+	message("${Yellow}${_lib_to_find} has not been found in"+	  "${_lib_env}${ColourReset}")+      endif()+    endif()+  endif()+  message("${BoldYellow}Please indicate where to find ${_lib_to_find}. You have three options:\n"+    "- Option 1: Provide the Installation directory of BLAS library with cmake option: -D${LIBNAME}_DIR=your/path/to/${libname}/\n"+    "- Option 2: Provide the directory where to find the library with cmake option: -D${LIBNAME}_LIBDIR=your/path/to/${libname}/lib/\n"+    "- Option 3: Update your environment variable (Linux: LD_LIBRARY_PATH, Windows: LIB, Mac: DYLD_LIBRARY_PATH)\n"+    "- Option 4: If your library provides a PkgConfig file, make sure pkg-config finds your library${ColourReset}")++endmacro()++# This macro informs why the _lib_to_find file has not been found+macro(Print_Find_Library_Blas_CheckFunc_Status _name)++  # save _libname upper/lower case+  string(TOUPPER ${_name} FUNCNAME)+  string(TOLOWER ${_name} funcname)++  # print status+  #message(" ")+  message("${Red}Libs have been found but check of symbol ${_name} failed "+    "with following libraries ${ARGN}${ColourReset}")+  message("${BoldRed}Please open your error file CMakeFiles/CMakeError.log"+    "to figure out why it fails${ColourReset}")+  #message(" ")++endmacro()++if (NOT BLAS_FOUND)+  set(BLAS_DIR "" CACHE PATH "Installation directory of BLAS library")+  if (NOT BLAS_FIND_QUIETLY)+    message(STATUS "A cache variable, namely BLAS_DIR, has been set to specify the install directory of BLAS")+  endif()+endif()++option(BLAS_VERBOSE "Print some additional information during BLAS libraries detection" OFF)+mark_as_advanced(BLAS_VERBOSE)++include(CheckFunctionExists)+include(CheckFortranFunctionExists)++set(_blas_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES})++# Check the language being used+get_property( _LANGUAGES_ GLOBAL PROPERTY ENABLED_LANGUAGES )+if( _LANGUAGES_ MATCHES Fortran AND CMAKE_Fortran_COMPILER)+  set( _CHECK_FORTRAN TRUE )+elseif( (_LANGUAGES_ MATCHES C) OR (_LANGUAGES_ MATCHES CXX) )+  set( _CHECK_FORTRAN FALSE )+else()+  if(BLAS_FIND_REQUIRED)+    message(FATAL_ERROR "FindBLAS requires Fortran, C, or C++ to be enabled.")+  else()+    message(STATUS "Looking for BLAS... - NOT found (Unsupported languages)")+    return()+  endif()+endif()++macro(Check_Fortran_Libraries LIBRARIES _prefix _name _flags _list _thread)+  # This macro checks for the existence of the combination of fortran libraries+  # given by _list.  If the combination is found, this macro checks (using the+  # Check_Fortran_Function_Exists macro) whether can link against that library+  # combination using the name of a routine given by _name using the linker+  # flags given by _flags.  If the combination of libraries is found and passes+  # the link test, LIBRARIES is set to the list of complete library paths that+  # have been found.  Otherwise, LIBRARIES is set to FALSE.++  # N.B. _prefix is the prefix applied to the names of all cached variables that+  # are generated internally and marked advanced by this macro.++  set(_libdir ${ARGN})++  set(_libraries_work TRUE)+  set(${LIBRARIES})+  set(_combined_name)+  set(ENV_MKLROOT "$ENV{MKLROOT}")+  set(ENV_BLAS_DIR "$ENV{BLAS_DIR}")+  set(ENV_BLAS_LIBDIR "$ENV{BLAS_LIBDIR}")+  if (NOT _libdir)+    if (BLAS_LIBDIR)+      list(APPEND _libdir "${BLAS_LIBDIR}")+    elseif (BLAS_DIR)+      list(APPEND _libdir "${BLAS_DIR}")+      list(APPEND _libdir "${BLAS_DIR}/lib")+      if("${CMAKE_SIZEOF_VOID_P}" EQUAL "8")+	list(APPEND _libdir "${BLAS_DIR}/lib64")+	list(APPEND _libdir "${BLAS_DIR}/lib/intel64")+      else()+	list(APPEND _libdir "${BLAS_DIR}/lib32")+	list(APPEND _libdir "${BLAS_DIR}/lib/ia32")+      endif()+    elseif(ENV_BLAS_LIBDIR)+      list(APPEND _libdir "${ENV_BLAS_LIBDIR}")+    elseif(ENV_BLAS_DIR)+      list(APPEND _libdir "${ENV_BLAS_DIR}")+      list(APPEND _libdir "${ENV_BLAS_DIR}/lib")+      if("${CMAKE_SIZEOF_VOID_P}" EQUAL "8")+	list(APPEND _libdir "${ENV_BLAS_DIR}/lib64")+	list(APPEND _libdir "${ENV_BLAS_DIR}/lib/intel64")+      else()+	list(APPEND _libdir "${ENV_BLAS_DIR}/lib32")+	list(APPEND _libdir "${ENV_BLAS_DIR}/lib/ia32")+      endif()+    else()+      if (ENV_MKLROOT)+	list(APPEND _libdir "${ENV_MKLROOT}/lib")+	if("${CMAKE_SIZEOF_VOID_P}" EQUAL "8")+	  list(APPEND _libdir "${ENV_MKLROOT}/lib64")+	  list(APPEND _libdir "${ENV_MKLROOT}/lib/intel64")+	else()+	  list(APPEND _libdir "${ENV_MKLROOT}/lib32")+	  list(APPEND _libdir "${ENV_MKLROOT}/lib/ia32")+	endif()+      endif()+      if (WIN32)+	string(REPLACE ":" ";" _libdir2 "$ENV{LIB}")+      elseif (APPLE)+	string(REPLACE ":" ";" _libdir2 "$ENV{DYLD_LIBRARY_PATH}")+      else ()+	string(REPLACE ":" ";" _libdir2 "$ENV{LD_LIBRARY_PATH}")+      endif ()+      list(APPEND _libdir "${_libdir2}")+      list(APPEND _libdir "${CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES}")+      list(APPEND _libdir "${CMAKE_C_IMPLICIT_LINK_DIRECTORIES}")+    endif()+  endif ()++  if (BLAS_VERBOSE)+    message("${Cyan}Try to find BLAS libraries: ${_list}")+  endif ()++  foreach(_library ${_list})+    set(_combined_name ${_combined_name}_${_library})++    if(_libraries_work)+      if (BLA_STATIC)+	if (WIN32)+	  set(CMAKE_FIND_LIBRARY_SUFFIXES .lib ${CMAKE_FIND_LIBRARY_SUFFIXES})+	endif ()+	if (APPLE)+	  set(CMAKE_FIND_LIBRARY_SUFFIXES .lib ${CMAKE_FIND_LIBRARY_SUFFIXES})+	else ()+	  set(CMAKE_FIND_LIBRARY_SUFFIXES .a ${CMAKE_FIND_LIBRARY_SUFFIXES})+	endif ()+      else ()+	if (CMAKE_SYSTEM_NAME STREQUAL "Linux")+	  # for ubuntu's libblas3gf and liblapack3gf packages+	  set(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES} .so.3gf)+	endif ()+      endif ()+      find_library(${_prefix}_${_library}_LIBRARY+	NAMES ${_library}+	HINTS ${_libdir}+	NO_DEFAULT_PATH+	)+      mark_as_advanced(${_prefix}_${_library}_LIBRARY)+      # Print status if not found+      # -------------------------+      if (NOT ${_prefix}_${_library}_LIBRARY AND NOT BLAS_FIND_QUIETLY AND BLAS_VERBOSE)+	Print_Find_Library_Blas_Status(blas ${_library} ${_libdir})+      endif ()+      set(${LIBRARIES} ${${LIBRARIES}} ${${_prefix}_${_library}_LIBRARY})+      set(_libraries_work ${${_prefix}_${_library}_LIBRARY})+    endif(_libraries_work)+  endforeach(_library ${_list})++  if(_libraries_work)+    # Test this combination of libraries.+    if (CMAKE_SYSTEM_NAME STREQUAL "Linux" AND BLA_STATIC)+      list(INSERT ${LIBRARIES} 0 "-Wl,--start-group")+      list(APPEND ${LIBRARIES} "-Wl,--end-group")+    endif()+    set(CMAKE_REQUIRED_LIBRARIES "${_flags};${${LIBRARIES}};${_thread}")+    set(CMAKE_REQUIRED_FLAGS "${BLAS_COMPILER_FLAGS}")+    if (BLAS_VERBOSE)+      message("${Cyan}BLAS libs found for BLA_VENDOR ${BLA_VENDOR}."+	"Try to compile symbol ${_name} with following libraries:"+	"${CMAKE_REQUIRED_LIBRARIES}")+    endif ()+    if(NOT BLAS_FOUND)+      unset(${_prefix}${_combined_name}_WORKS CACHE)+    endif()+    if (_CHECK_FORTRAN)+      if (CMAKE_Fortran_COMPILER_ID STREQUAL "GNU")+	string(REPLACE "mkl_intel_lp64" "mkl_gf_lp64" CMAKE_REQUIRED_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES}")+	string(REPLACE "mkl_intel_ilp64" "mkl_gf_ilp64" CMAKE_REQUIRED_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES}")+      endif()+      check_fortran_function_exists("${_name}" ${_prefix}${_combined_name}_WORKS)+    else()+      check_function_exists("${_name}_" ${_prefix}${_combined_name}_WORKS)+    endif()+    mark_as_advanced(${_prefix}${_combined_name}_WORKS)+    set(_libraries_work ${${_prefix}${_combined_name}_WORKS})+    # Print status if not found+    # -------------------------+    if (NOT _libraries_work AND NOT BLAS_FIND_QUIETLY AND BLAS_VERBOSE)+      Print_Find_Library_Blas_CheckFunc_Status(${_name} ${CMAKE_REQUIRED_LIBRARIES})+    endif ()+    set(CMAKE_REQUIRED_LIBRARIES)+  endif()++  if(_libraries_work)+    set(${LIBRARIES} ${${LIBRARIES}} ${_thread})+  else(_libraries_work)+    set(${LIBRARIES} FALSE)+  endif(_libraries_work)++endmacro(Check_Fortran_Libraries)+++set(BLAS_LINKER_FLAGS)+set(BLAS_LIBRARIES)+set(BLAS95_LIBRARIES)+if ($ENV{BLA_VENDOR} MATCHES ".+")+  set(BLA_VENDOR $ENV{BLA_VENDOR})+else ()+  if(NOT BLA_VENDOR)+    set(BLA_VENDOR "All")+  endif()+endif ()++#BLAS in intel mkl 10 library? (em64t 64bit)+if (BLA_VENDOR MATCHES "Intel*" OR BLA_VENDOR STREQUAL "All")++  if(NOT BLAS_LIBRARIES OR BLA_VENDOR MATCHES "Intel*")+    # Looking for include+    # -------------------++    # Add system include paths to search include+    # ------------------------------------------+    unset(_inc_env)+    set(ENV_MKLROOT "$ENV{MKLROOT}")+    set(ENV_BLAS_DIR "$ENV{BLAS_DIR}")+    set(ENV_BLAS_INCDIR "$ENV{BLAS_INCDIR}")+    if(ENV_BLAS_INCDIR)+      list(APPEND _inc_env "${ENV_BLAS_INCDIR}")+    elseif(ENV_BLAS_DIR)+      list(APPEND _inc_env "${ENV_BLAS_DIR}")+      list(APPEND _inc_env "${ENV_BLAS_DIR}/include")+    else()+      if (ENV_MKLROOT)+	list(APPEND _inc_env "${ENV_MKLROOT}/include")+      endif()+      # system variables+      if(WIN32)+	string(REPLACE ":" ";" _path_env "$ENV{INCLUDE}")+	list(APPEND _inc_env "${_path_env}")+      else()+	string(REPLACE ":" ";" _path_env "$ENV{INCLUDE}")+	list(APPEND _inc_env "${_path_env}")+	string(REPLACE ":" ";" _path_env "$ENV{C_INCLUDE_PATH}")+	list(APPEND _inc_env "${_path_env}")+	string(REPLACE ":" ";" _path_env "$ENV{CPATH}")+	list(APPEND _inc_env "${_path_env}")+	string(REPLACE ":" ";" _path_env "$ENV{INCLUDE_PATH}")+	list(APPEND _inc_env "${_path_env}")+      endif()+    endif()+    list(APPEND _inc_env "${CMAKE_PLATFORM_IMPLICIT_INCLUDE_DIRECTORIES}")+    list(APPEND _inc_env "${CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES}")+    list(REMOVE_DUPLICATES _inc_env)++    # set paths where to look for+    set(PATH_TO_LOOK_FOR "${_inc_env}")++    # Try to find the fftw header in the given paths+    # -------------------------------------------------+    # call cmake macro to find the header path+    if(BLAS_INCDIR)+      set(BLAS_mkl.h_DIRS "BLAS_mkl.h_DIRS-NOTFOUND")+      find_path(BLAS_mkl.h_DIRS+	NAMES mkl.h+	HINTS ${BLAS_INCDIR})+    else()+      if(BLAS_DIR)+	set(BLAS_mkl.h_DIRS "BLAS_mkl.h_DIRS-NOTFOUND")+	find_path(BLAS_mkl.h_DIRS+	  NAMES mkl.h+	  HINTS ${BLAS_DIR}+	  PATH_SUFFIXES "include")+      else()+	set(BLAS_mkl.h_DIRS "BLAS_mkl.h_DIRS-NOTFOUND")+	find_path(BLAS_mkl.h_DIRS+	  NAMES mkl.h+	  HINTS ${PATH_TO_LOOK_FOR})+      endif()+    endif()+    mark_as_advanced(BLAS_mkl.h_DIRS)++    # If found, add path to cmake variable+    # ------------------------------------+    if (BLAS_mkl.h_DIRS)+      set(BLAS_INCLUDE_DIRS "${BLAS_mkl.h_DIRS}")+    else ()+      set(BLAS_INCLUDE_DIRS "BLAS_INCLUDE_DIRS-NOTFOUND")+      if(NOT BLAS_FIND_QUIETLY)+	message(STATUS "Looking for BLAS -- mkl.h not found")+      endif()+    endif()++    if (WIN32)+      string(REPLACE ":" ";" _libdir "$ENV{LIB}")+    elseif (APPLE)+      string(REPLACE ":" ";" _libdir "$ENV{DYLD_LIBRARY_PATH}")+    else ()+      string(REPLACE ":" ";" _libdir "$ENV{LD_LIBRARY_PATH}")+    endif ()+    list(APPEND _libdir "${CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES}")+    list(APPEND _libdir "${CMAKE_C_IMPLICIT_LINK_DIRECTORIES}")+    # libiomp5+    # --------+    set(OMP_iomp5_LIBRARY "OMP_iomp5_LIBRARY-NOTFOUND")+    find_library(OMP_iomp5_LIBRARY+      NAMES iomp5+      HINTS ${_libdir}+      )+    mark_as_advanced(OMP_iomp5_LIBRARY)+    set(OMP_LIB "")+    # libgomp+    # -------+    set(OMP_gomp_LIBRARY "OMP_gomp_LIBRARY-NOTFOUND")+    find_library(OMP_gomp_LIBRARY+      NAMES gomp+      HINTS ${_libdir}+      )+    mark_as_advanced(OMP_gomp_LIBRARY)+    # choose one or another depending on the compilo+    if (CMAKE_C_COMPILER_ID STREQUAL "GNU")+      if (OMP_gomp_LIBRARY)+	set(OMP_LIB "${OMP_gomp_LIBRARY}")+      endif()+    else(CMAKE_C_COMPILER_ID STREQUAL "Intel")+      if (OMP_iomp5_LIBRARY)+	set(OMP_LIB "${OMP_iomp5_LIBRARY}")+      endif()+    endif()++    if (UNIX AND NOT WIN32)+      # m+      find_library(M_LIBRARY+	NAMES m+	HINTS ${_libdir})+      mark_as_advanced(M_LIBRARY)+      if(M_LIBRARY)+	set(LM "-lm")+      else()+	set(LM "")+      endif()+      # Fortran+      set(LGFORTRAN "")+      if (CMAKE_C_COMPILER_ID MATCHES "GNU")+	find_library(+	  FORTRAN_gfortran_LIBRARY+	  NAMES gfortran+	  HINTS ${_libdir}+	  )+	mark_as_advanced(FORTRAN_gfortran_LIBRARY)+	if (FORTRAN_gfortran_LIBRARY)+	  set(LGFORTRAN "${FORTRAN_gfortran_LIBRARY}")+	endif()+      elseif (CMAKE_C_COMPILER_ID MATCHES "Intel")+	find_library(+	  FORTRAN_ifcore_LIBRARY+	  NAMES ifcore+	  HINTS ${_libdir}+	  )+	mark_as_advanced(FORTRAN_ifcore_LIBRARY)+	if (FORTRAN_ifcore_LIBRARY)+	  set(LGFORTRAN "{FORTRAN_ifcore_LIBRARY}")+	endif()+      endif()+      set(BLAS_COMPILER_FLAGS "")+      if (NOT BLA_VENDOR STREQUAL "Intel10_64lp_seq")+	if (CMAKE_C_COMPILER_ID STREQUAL "Intel")+	  list(APPEND BLAS_COMPILER_FLAGS "-openmp")+	endif()+	if (CMAKE_C_COMPILER_ID STREQUAL "GNU")+	  list(APPEND BLAS_COMPILER_FLAGS "-fopenmp")+	endif()+      endif()+      if (CMAKE_C_COMPILER_ID STREQUAL "GNU")+	if (BLA_VENDOR STREQUAL "Intel10_32")+	  list(APPEND BLAS_COMPILER_FLAGS "-m32")+	else()+	  list(APPEND BLAS_COMPILER_FLAGS "-m64")+	endif()+	if (NOT BLA_VENDOR STREQUAL "Intel10_64lp_seq")+	  list(APPEND OMP_LIB "-ldl")+	endif()+	if (ENV_MKLROOT)+	  list(APPEND BLAS_COMPILER_FLAGS "-I${ENV_MKLROOT}/include")+	endif()+      endif()++      set(additional_flags "")+      if (CMAKE_C_COMPILER_ID STREQUAL "GNU" AND CMAKE_SYSTEM_NAME STREQUAL "Linux")+	set(additional_flags "-Wl,--no-as-needed")+      endif()+    endif ()++    if (_LANGUAGES_ MATCHES C OR _LANGUAGES_ MATCHES CXX)+      if(BLAS_FIND_QUIETLY OR NOT BLAS_FIND_REQUIRED)+	find_package(Threads)+      else()+	find_package(Threads REQUIRED)+      endif()++      set(BLAS_SEARCH_LIBS "")++      if(BLA_F95)++	set(BLAS_mkl_SEARCH_SYMBOL SGEMM)+	set(_LIBRARIES BLAS95_LIBRARIES)+	if (WIN32)+	  if (BLA_STATIC)+	    set(BLAS_mkl_DLL_SUFFIX "")+	  else()+	    set(BLAS_mkl_DLL_SUFFIX "_dll")+	  endif()++	  # Find the main file (32-bit or 64-bit)+	  set(BLAS_SEARCH_LIBS_WIN_MAIN "")+	  if (BLA_VENDOR STREQUAL "Intel10_32" OR BLA_VENDOR STREQUAL "All")+	    list(APPEND BLAS_SEARCH_LIBS_WIN_MAIN+	      "mkl_blas95${BLAS_mkl_DLL_SUFFIX} mkl_intel_c${BLAS_mkl_DLL_SUFFIX}")+	  endif()+	  if (BLA_VENDOR STREQUAL "Intel10_64lp*" OR BLA_VENDOR STREQUAL "All")+	    list(APPEND BLAS_SEARCH_LIBS_WIN_MAIN+	      "mkl_blas95_lp64${BLAS_mkl_DLL_SUFFIX} mkl_intel_lp64${BLAS_mkl_DLL_SUFFIX}")+	  endif ()++	  # Add threading/sequential libs+	  set(BLAS_SEARCH_LIBS_WIN_THREAD "")+	  if (BLA_VENDOR STREQUAL "*_seq" OR BLA_VENDOR STREQUAL "All")+	    list(APPEND BLAS_SEARCH_LIBS_WIN_THREAD+	      "mkl_sequential${BLAS_mkl_DLL_SUFFIX}")+	  endif()+	  if (NOT BLA_VENDOR STREQUAL "*_seq" OR BLA_VENDOR STREQUAL "All")+	    # old version+	    list(APPEND BLAS_SEARCH_LIBS_WIN_THREAD+	      "libguide40 mkl_intel_thread${BLAS_mkl_DLL_SUFFIX}")+	    # mkl >= 10.3+	    list(APPEND BLAS_SEARCH_LIBS_WIN_THREAD+	      "libiomp5md mkl_intel_thread${BLAS_mkl_DLL_SUFFIX}")+	  endif()++	  # Cartesian product of the above+	  foreach (MAIN ${BLAS_SEARCH_LIBS_WIN_MAIN})+	    foreach (THREAD ${BLAS_SEARCH_LIBS_WIN_THREAD})+	      list(APPEND BLAS_SEARCH_LIBS+		"${MAIN} ${THREAD} mkl_core${BLAS_mkl_DLL_SUFFIX}")+	    endforeach()+	  endforeach()+	else (WIN32)+	  if (BLA_VENDOR STREQUAL "Intel10_32" OR BLA_VENDOR STREQUAL "All")+	    list(APPEND BLAS_SEARCH_LIBS+	      "mkl_blas95 mkl_intel mkl_intel_thread mkl_core guide")+	  endif ()+	  if (BLA_VENDOR STREQUAL "Intel10_64lp" OR BLA_VENDOR STREQUAL "All")+	    # old version+	    list(APPEND BLAS_SEARCH_LIBS+	      "mkl_blas95 mkl_intel_lp64 mkl_intel_thread mkl_core guide")+	    # mkl >= 10.3+	    if (CMAKE_C_COMPILER_ID STREQUAL "Intel")+	      list(APPEND BLAS_SEARCH_LIBS+		"mkl_blas95_lp64 mkl_intel_lp64 mkl_intel_thread mkl_core")+	    endif()+	    if (CMAKE_C_COMPILER_ID STREQUAL "GNU")+	      list(APPEND BLAS_SEARCH_LIBS+		"mkl_blas95_lp64 mkl_intel_lp64 mkl_gnu_thread mkl_core")+	    endif()+	  endif ()+	  if (BLA_VENDOR STREQUAL "Intel10_64lp_seq" OR BLA_VENDOR STREQUAL "All")+	    list(APPEND BLAS_SEARCH_LIBS+	      "mkl_intel_lp64 mkl_sequential mkl_core")+	    if (BLA_VENDOR STREQUAL "Intel10_64lp_seq")+	      set(OMP_LIB "")+	    endif()+	  endif ()+	endif (WIN32)++      else (BLA_F95)++	set(BLAS_mkl_SEARCH_SYMBOL sgemm)+	set(_LIBRARIES BLAS_LIBRARIES)+	if (WIN32)+	  if (BLA_STATIC)+	    set(BLAS_mkl_DLL_SUFFIX "")+	  else()+	    set(BLAS_mkl_DLL_SUFFIX "_dll")+	  endif()++	  # Find the main file (32-bit or 64-bit)+	  set(BLAS_SEARCH_LIBS_WIN_MAIN "")+	  if (BLA_VENDOR STREQUAL "Intel10_32" OR BLA_VENDOR STREQUAL "All")+	    list(APPEND BLAS_SEARCH_LIBS_WIN_MAIN+	      "mkl_intel_c${BLAS_mkl_DLL_SUFFIX}")+	  endif()+	  if (BLA_VENDOR STREQUAL "Intel10_64lp*" OR BLA_VENDOR STREQUAL "All")+	    list(APPEND BLAS_SEARCH_LIBS_WIN_MAIN+	      "mkl_intel_lp64${BLAS_mkl_DLL_SUFFIX}")+	  endif ()++	  # Add threading/sequential libs+	  set(BLAS_SEARCH_LIBS_WIN_THREAD "")+	  if (NOT BLA_VENDOR STREQUAL "*_seq" OR BLA_VENDOR STREQUAL "All")+	    # old version+	    list(APPEND BLAS_SEARCH_LIBS_WIN_THREAD+	      "libguide40 mkl_intel_thread${BLAS_mkl_DLL_SUFFIX}")+	    # mkl >= 10.3+	    list(APPEND BLAS_SEARCH_LIBS_WIN_THREAD+	      "libiomp5md mkl_intel_thread${BLAS_mkl_DLL_SUFFIX}")+	  endif()+	  if (BLA_VENDOR STREQUAL "*_seq" OR BLA_VENDOR STREQUAL "All")+	    list(APPEND BLAS_SEARCH_LIBS_WIN_THREAD+	      "mkl_sequential${BLAS_mkl_DLL_SUFFIX}")+	  endif()++	  # Cartesian product of the above+	  foreach (MAIN ${BLAS_SEARCH_LIBS_WIN_MAIN})+	    foreach (THREAD ${BLAS_SEARCH_LIBS_WIN_THREAD})+	      list(APPEND BLAS_SEARCH_LIBS+		"${MAIN} ${THREAD} mkl_core${BLAS_mkl_DLL_SUFFIX}")+	    endforeach()+	  endforeach()+	else (WIN32)+	  if (BLA_VENDOR STREQUAL "Intel10_32" OR BLA_VENDOR STREQUAL "All")+	    list(APPEND BLAS_SEARCH_LIBS+	      "mkl_intel mkl_intel_thread mkl_core guide")+	  endif ()+	  if (BLA_VENDOR STREQUAL "Intel10_64lp" OR BLA_VENDOR STREQUAL "All")+	    # old version+	    list(APPEND BLAS_SEARCH_LIBS+	      "mkl_intel_lp64 mkl_intel_thread mkl_core guide")+	    # mkl >= 10.3+	    if (CMAKE_C_COMPILER_ID STREQUAL "Intel")+	      list(APPEND BLAS_SEARCH_LIBS+		"mkl_intel_lp64 mkl_intel_thread mkl_core")+	    endif()+	    if (CMAKE_C_COMPILER_ID STREQUAL "GNU")+	      list(APPEND BLAS_SEARCH_LIBS+		"mkl_intel_lp64 mkl_gnu_thread mkl_core")+	    endif()+	  endif ()+	  if (BLA_VENDOR STREQUAL "Intel10_64lp_seq" OR BLA_VENDOR STREQUAL "All")+	    list(APPEND BLAS_SEARCH_LIBS+	      "mkl_intel_lp64 mkl_sequential mkl_core")+	    if (BLA_VENDOR STREQUAL "Intel10_64lp_seq")+	      set(OMP_LIB "")+	    endif()+	  endif ()+	  #older vesions of intel mkl libs+	  if (BLA_VENDOR STREQUAL "Intel" OR BLA_VENDOR STREQUAL "All")+	    list(APPEND BLAS_SEARCH_LIBS+	      "mkl")+	    list(APPEND BLAS_SEARCH_LIBS+	      "mkl_ia32")+	    list(APPEND BLAS_SEARCH_LIBS+	      "mkl_em64t")+	  endif ()+	endif (WIN32)++      endif (BLA_F95)++      foreach (IT ${BLAS_SEARCH_LIBS})+	string(REPLACE " " ";" SEARCH_LIBS ${IT})+	if (${_LIBRARIES})+	else ()+	  check_fortran_libraries(+	    ${_LIBRARIES}+	    BLAS+	    ${BLAS_mkl_SEARCH_SYMBOL}+	    "${additional_flags}"+	    "${SEARCH_LIBS}"+	    "${OMP_LIB};${CMAKE_THREAD_LIBS_INIT};${LM}"+	    )+	  if(_LIBRARIES)+	    set(BLAS_LINKER_FLAGS "${additional_flags}")+	  endif()+	endif()+      endforeach ()+      if(NOT BLAS_FIND_QUIETLY)+        if(${_LIBRARIES})+          message(STATUS "Looking for MKL BLAS: found")+        else()+          message(STATUS "Looking for MKL BLAS: not found")+        endif()+      endif()+      if (${_LIBRARIES} AND NOT BLAS_VENDOR_FOUND)+          set (BLAS_VENDOR_FOUND "Intel MKL")+      endif()+    endif (_LANGUAGES_ MATCHES C OR _LANGUAGES_ MATCHES CXX)+  endif(NOT BLAS_LIBRARIES OR BLA_VENDOR MATCHES "Intel*")+endif (BLA_VENDOR MATCHES "Intel*" OR BLA_VENDOR STREQUAL "All")+++if (BLA_VENDOR STREQUAL "Goto" OR BLA_VENDOR STREQUAL "All")++  if(NOT BLAS_LIBRARIES)+    # gotoblas (http://www.tacc.utexas.edu/tacc-projects/gotoblas2)+    check_fortran_libraries(+      BLAS_LIBRARIES+      BLAS+      sgemm+      ""+      "goto2"+      ""+      )+    if(NOT BLAS_FIND_QUIETLY)+      if(BLAS_LIBRARIES)+	message(STATUS "Looking for Goto BLAS: found")+      else()+	message(STATUS "Looking for Goto BLAS: not found")+      endif()+    endif()+  endif()+  if (BLAS_LIBRARIES AND NOT BLAS_VENDOR_FOUND)+      set (BLAS_VENDOR_FOUND "Goto")+  endif()++endif (BLA_VENDOR STREQUAL "Goto" OR BLA_VENDOR STREQUAL "All")+++# OpenBlas+if (BLA_VENDOR STREQUAL "Open" OR BLA_VENDOR STREQUAL "All")++  if(NOT BLAS_LIBRARIES)+    # openblas (http://www.openblas.net/)+    check_fortran_libraries(+      BLAS_LIBRARIES+      BLAS+      sgemm+      ""+      "openblas"+      ""+      )+    if(NOT BLAS_FIND_QUIETLY)+      if(BLAS_LIBRARIES)+	message(STATUS "Looking for Open BLAS: found")+      else()+	message(STATUS "Looking for Open BLAS: not found")+      endif()+    endif()+  endif()+  if (BLAS_LIBRARIES AND NOT BLAS_VENDOR_FOUND)+      set (BLAS_VENDOR_FOUND "Openblas")+  endif()++endif (BLA_VENDOR STREQUAL "Open" OR BLA_VENDOR STREQUAL "All")+++# EigenBlas+if (BLA_VENDOR STREQUAL "Eigen" OR BLA_VENDOR STREQUAL "All")++  if(NOT BLAS_LIBRARIES)+    # eigenblas (http://eigen.tuxfamily.org/index.php?title=Main_Page)+    check_fortran_libraries(+      BLAS_LIBRARIES+      BLAS+      sgemm+      ""+      "eigen_blas"+      ""+      )+    if(NOT BLAS_FIND_QUIETLY)+      if(BLAS_LIBRARIES AND NOT BLAS_VENDOR_FOUND)+	message(STATUS "Looking for Eigen BLAS: found")+      else()+	message(STATUS "Looking for Eigen BLAS: not found")+      endif()+    endif()+  endif()++  if(NOT BLAS_LIBRARIES)+    # eigenblas (http://eigen.tuxfamily.org/index.php?title=Main_Page)+    check_fortran_libraries(+      BLAS_LIBRARIES+      BLAS+      sgemm+      ""+      "eigen_blas_static"+      ""+      )+    if(NOT BLAS_FIND_QUIETLY)+      if(BLAS_LIBRARIES)+	message(STATUS "Looking for Eigen BLAS: found")+      else()+	message(STATUS "Looking for Eigen BLAS: not found")+      endif()+    endif()+  endif()+  if (BLAS_LIBRARIES AND NOT BLAS_VENDOR_FOUND)+      set (BLAS_VENDOR_FOUND "Eigen")+  endif()++endif (BLA_VENDOR STREQUAL "Eigen" OR BLA_VENDOR STREQUAL "All")+++if (BLA_VENDOR STREQUAL "ATLAS" OR BLA_VENDOR STREQUAL "All")++  if(NOT BLAS_LIBRARIES)+    # BLAS in ATLAS library? (http://math-atlas.sourceforge.net/)+    check_fortran_libraries(+      BLAS_LIBRARIES+      BLAS+      dgemm+      ""+      "f77blas;atlas"+      ""+      )+    if(NOT BLAS_FIND_QUIETLY)+      if(BLAS_LIBRARIES)+	message(STATUS "Looking for Atlas BLAS: found")+      else()+	message(STATUS "Looking for Atlas BLAS: not found")+      endif()+    endif()+  endif()++  if (BLAS_LIBRARIES AND NOT BLAS_VENDOR_FOUND)+      set (BLAS_VENDOR_FOUND "Atlas")+  endif()++endif (BLA_VENDOR STREQUAL "ATLAS" OR BLA_VENDOR STREQUAL "All")+++# BLAS in PhiPACK libraries? (requires generic BLAS lib, too)+if (BLA_VENDOR STREQUAL "PhiPACK" OR BLA_VENDOR STREQUAL "All")++  if(NOT BLAS_LIBRARIES)+    check_fortran_libraries(+      BLAS_LIBRARIES+      BLAS+      sgemm+      ""+      "sgemm;dgemm;blas"+      ""+      )+    if(NOT BLAS_FIND_QUIETLY)+      if(BLAS_LIBRARIES)+	message(STATUS "Looking for PhiPACK BLAS: found")+      else()+	message(STATUS "Looking for PhiPACK BLAS: not found")+      endif()+    endif()+  endif()++  if (BLAS_LIBRARIES AND NOT BLAS_VENDOR_FOUND)+      set (BLAS_VENDOR_FOUND "PhiPACK")+  endif()++endif (BLA_VENDOR STREQUAL "PhiPACK" OR BLA_VENDOR STREQUAL "All")+++# BLAS in Alpha CXML library?+if (BLA_VENDOR STREQUAL "CXML" OR BLA_VENDOR STREQUAL "All")++  if(NOT BLAS_LIBRARIES)+    check_fortran_libraries(+      BLAS_LIBRARIES+      BLAS+      sgemm+      ""+      "cxml"+      ""+      )+    if(NOT BLAS_FIND_QUIETLY)+      if(BLAS_LIBRARIES)+	message(STATUS "Looking for CXML BLAS: found")+      else()+	message(STATUS "Looking for CXML BLAS: not found")+      endif()+    endif()+  endif()++  if (BLAS_LIBRARIES AND NOT BLAS_VENDOR_FOUND)+      set (BLAS_VENDOR_FOUND "CXML")+  endif()++endif (BLA_VENDOR STREQUAL "CXML" OR BLA_VENDOR STREQUAL "All")+++# BLAS in Alpha DXML library? (now called CXML, see above)+if (BLA_VENDOR STREQUAL "DXML" OR BLA_VENDOR STREQUAL "All")++  if(NOT BLAS_LIBRARIES)+    check_fortran_libraries(+      BLAS_LIBRARIES+      BLAS+      sgemm+      ""+      "dxml"+      ""+      )+    if(NOT BLAS_FIND_QUIETLY)+      if(BLAS_LIBRARIES)+	message(STATUS "Looking for DXML BLAS: found")+      else()+	message(STATUS "Looking for DXML BLAS: not found")+      endif()+    endif()+  endif()++  if (BLAS_LIBRARIES AND NOT BLAS_VENDOR_FOUND)+      set (BLAS_VENDOR_FOUND "DXML")+  endif()+  +endif (BLA_VENDOR STREQUAL "DXML" OR BLA_VENDOR STREQUAL "All")+++# BLAS in Sun Performance library?+if (BLA_VENDOR STREQUAL "SunPerf" OR BLA_VENDOR STREQUAL "All")++  if(NOT BLAS_LIBRARIES)+    check_fortran_libraries(+      BLAS_LIBRARIES+      BLAS+      sgemm+      "-xlic_lib=sunperf"+      "sunperf;sunmath"+      ""+      )+    if(BLAS_LIBRARIES)+      set(BLAS_LINKER_FLAGS "-xlic_lib=sunperf")+    endif()+    if(NOT BLAS_FIND_QUIETLY)+      if(BLAS_LIBRARIES)+	message(STATUS "Looking for SunPerf BLAS: found")+      else()+	message(STATUS "Looking for SunPerf BLAS: not found")+      endif()+    endif()+  endif()++  if (BLAS_LIBRARIES AND NOT BLAS_VENDOR_FOUND)+      set (BLAS_VENDOR_FOUND "SunPerf")+  endif()++endif ()+++# BLAS in SCSL library?  (SGI/Cray Scientific Library)+if (BLA_VENDOR STREQUAL "SCSL" OR BLA_VENDOR STREQUAL "All")++  if(NOT BLAS_LIBRARIES)+    check_fortran_libraries(+      BLAS_LIBRARIES+      BLAS+      sgemm+      ""+      "scsl"+      ""+      )+    if(NOT BLAS_FIND_QUIETLY)+      if(BLAS_LIBRARIES)+	message(STATUS "Looking for SCSL BLAS: found")+      else()+	message(STATUS "Looking for SCSL BLAS: not found")+      endif()+    endif()+  endif()++  if (BLAS_LIBRARIES AND NOT BLAS_VENDOR_FOUND)+      set (BLAS_VENDOR_FOUND "SunPerf")+  endif()++endif ()+++# BLAS in SGIMATH library?+if (BLA_VENDOR STREQUAL "SGIMATH" OR BLA_VENDOR STREQUAL "All")++  if(NOT BLAS_LIBRARIES)+    check_fortran_libraries(+      BLAS_LIBRARIES+      BLAS+      sgemm+      ""+      "complib.sgimath"+      ""+      )+    if(NOT BLAS_FIND_QUIETLY)+      if(BLAS_LIBRARIES)+	message(STATUS "Looking for SGIMATH BLAS: found")+      else()+	message(STATUS "Looking for SGIMATH BLAS: not found")+      endif()+    endif()+  endif()++  if (BLAS_LIBRARIES AND NOT BLAS_VENDOR_FOUND)+      set (BLAS_VENDOR_FOUND "SGIMATH")+  endif()++endif ()+++# BLAS in IBM ESSL library (requires generic BLAS lib, too)+if (BLA_VENDOR STREQUAL "IBMESSL" OR BLA_VENDOR STREQUAL "All")++  if(NOT BLAS_LIBRARIES)+    check_fortran_libraries(+      BLAS_LIBRARIES+      BLAS+      sgemm+      ""+      "essl;xlfmath;xlf90_r;blas"+      ""+      )+    if(NOT BLAS_FIND_QUIETLY)+      if(BLAS_LIBRARIES)+	message(STATUS "Looking for IBM ESSL BLAS: found")+      else()+	message(STATUS "Looking for IBM ESSL BLAS: not found")+      endif()+    endif()+  endif()++  if (BLAS_LIBRARIES AND NOT BLAS_VENDOR_FOUND)+      set (BLAS_VENDOR_FOUND "IBM ESSL")+  endif()++endif ()++# BLAS in IBM ESSL_MT library (requires generic BLAS lib, too)+if (BLA_VENDOR STREQUAL "IBMESSLMT" OR BLA_VENDOR STREQUAL "All")++  if(NOT BLAS_LIBRARIES)+    check_fortran_libraries(+      BLAS_LIBRARIES+      BLAS+      sgemm+      ""+      "esslsmp;xlsmp;xlfmath;xlf90_r;blas"+      ""+      )+    if(NOT BLAS_FIND_QUIETLY)+      if(BLAS_LIBRARIES)+	message(STATUS "Looking for IBM ESSL MT BLAS: found")+      else()+	message(STATUS "Looking for IBM ESSL MT BLAS: not found")+      endif()+    endif()+  endif()++  if (BLAS_LIBRARIES AND NOT BLAS_VENDOR_FOUND)+      set (BLAS_VENDOR_FOUND "IBM ESSL MT")+  endif()++endif ()+++#BLAS in acml library?+if (BLA_VENDOR MATCHES "ACML.*" OR BLA_VENDOR STREQUAL "All")++  if( ((BLA_VENDOR STREQUAL "ACML") AND (NOT BLAS_ACML_LIB_DIRS)) OR+      ((BLA_VENDOR STREQUAL "ACML_MP") AND (NOT BLAS_ACML_MP_LIB_DIRS)) OR+      ((BLA_VENDOR STREQUAL "ACML_GPU") AND (NOT BLAS_ACML_GPU_LIB_DIRS)))++    # try to find acml in "standard" paths+    if( WIN32 )+      file( GLOB _ACML_ROOT "C:/AMD/acml*/ACML-EULA.txt" )+    else()+      file( GLOB _ACML_ROOT "/opt/acml*/ACML-EULA.txt" )+    endif()+    if( WIN32 )+      file( GLOB _ACML_GPU_ROOT "C:/AMD/acml*/GPGPUexamples" )+    else()+      file( GLOB _ACML_GPU_ROOT "/opt/acml*/GPGPUexamples" )+    endif()+    list(GET _ACML_ROOT 0 _ACML_ROOT)+    list(GET _ACML_GPU_ROOT 0 _ACML_GPU_ROOT)++    if( _ACML_ROOT )++      get_filename_component( _ACML_ROOT ${_ACML_ROOT} PATH )+      if( SIZEOF_INTEGER EQUAL 8 )+	set( _ACML_PATH_SUFFIX "_int64" )+      else()+	set( _ACML_PATH_SUFFIX "" )+      endif()+      if( CMAKE_Fortran_COMPILER_ID STREQUAL "Intel" )+	set( _ACML_COMPILER32 "ifort32" )+	set( _ACML_COMPILER64 "ifort64" )+      elseif( CMAKE_Fortran_COMPILER_ID STREQUAL "SunPro" )+	set( _ACML_COMPILER32 "sun32" )+	set( _ACML_COMPILER64 "sun64" )+      elseif( CMAKE_Fortran_COMPILER_ID STREQUAL "PGI" )+	set( _ACML_COMPILER32 "pgi32" )+	if( WIN32 )+	  set( _ACML_COMPILER64 "win64" )+	else()+	  set( _ACML_COMPILER64 "pgi64" )+	endif()+      elseif( CMAKE_Fortran_COMPILER_ID STREQUAL "Open64" )+	# 32 bit builds not supported on Open64 but for code simplicity+	# We'll just use the same directory twice+	set( _ACML_COMPILER32 "open64_64" )+	set( _ACML_COMPILER64 "open64_64" )+      elseif( CMAKE_Fortran_COMPILER_ID STREQUAL "NAG" )+	set( _ACML_COMPILER32 "nag32" )+	set( _ACML_COMPILER64 "nag64" )+      else()+	set( _ACML_COMPILER32 "gfortran32" )+	set( _ACML_COMPILER64 "gfortran64" )+      endif()++      if( BLA_VENDOR STREQUAL "ACML_MP" )+	set(_ACML_MP_LIB_DIRS+	  "${_ACML_ROOT}/${_ACML_COMPILER32}_mp${_ACML_PATH_SUFFIX}/lib"+	  "${_ACML_ROOT}/${_ACML_COMPILER64}_mp${_ACML_PATH_SUFFIX}/lib" )+      else()+	set(_ACML_LIB_DIRS+	  "${_ACML_ROOT}/${_ACML_COMPILER32}${_ACML_PATH_SUFFIX}/lib"+	  "${_ACML_ROOT}/${_ACML_COMPILER64}${_ACML_PATH_SUFFIX}/lib" )+      endif()++    endif(_ACML_ROOT)++  elseif(BLAS_${BLA_VENDOR}_LIB_DIRS)++    set(_${BLA_VENDOR}_LIB_DIRS ${BLAS_${BLA_VENDOR}_LIB_DIRS})++  endif()++  if( BLA_VENDOR STREQUAL "ACML_MP" )+    foreach( BLAS_ACML_MP_LIB_DIRS ${_ACML_MP_LIB_DIRS})+      check_fortran_libraries (+	BLAS_LIBRARIES+	BLAS+	sgemm+	"" "acml_mp;acml_mv" "" ${BLAS_ACML_MP_LIB_DIRS}+	)+      if( BLAS_LIBRARIES )+	break()+      endif()+    endforeach()+  elseif( BLA_VENDOR STREQUAL "ACML_GPU" )+    foreach( BLAS_ACML_GPU_LIB_DIRS ${_ACML_GPU_LIB_DIRS})+      check_fortran_libraries (+	BLAS_LIBRARIES+	BLAS+	sgemm+	"" "acml;acml_mv;CALBLAS" "" ${BLAS_ACML_GPU_LIB_DIRS}+	)+      if( BLAS_LIBRARIES )+	break()+      endif()+    endforeach()+  else()+    foreach( BLAS_ACML_LIB_DIRS ${_ACML_LIB_DIRS} )+      check_fortran_libraries (+	BLAS_LIBRARIES+	BLAS+	sgemm+	"" "acml;acml_mv" "" ${BLAS_ACML_LIB_DIRS}+	)+      if( BLAS_LIBRARIES )+	break()+      endif()+    endforeach()+  endif()++  # Either acml or acml_mp should be in LD_LIBRARY_PATH but not both+  if(NOT BLAS_LIBRARIES)+    check_fortran_libraries(+      BLAS_LIBRARIES+      BLAS+      sgemm+      ""+      "acml;acml_mv"+      ""+      )+    if(NOT BLAS_FIND_QUIETLY)+      if(BLAS_LIBRARIES)+	message(STATUS "Looking for ACML BLAS: found")+      else()+	message(STATUS "Looking for ACML BLAS: not found")+      endif()+    endif()+  endif()++  if(NOT BLAS_LIBRARIES)+    check_fortran_libraries(+      BLAS_LIBRARIES+      BLAS+      sgemm+      ""+      "acml_mp;acml_mv"+      ""+      )+    if(NOT BLAS_FIND_QUIETLY)+      if(BLAS_LIBRARIES)+	message(STATUS "Looking for ACML BLAS: found")+      else()+	message(STATUS "Looking for ACML BLAS: not found")+      endif()+    endif()+  endif()++  if(NOT BLAS_LIBRARIES)+    check_fortran_libraries(+      BLAS_LIBRARIES+      BLAS+      sgemm+      ""+      "acml;acml_mv;CALBLAS"+      ""+      )+    if(NOT BLAS_FIND_QUIETLY)+      if(BLAS_LIBRARIES)+	message(STATUS "Looking for ACML BLAS: found")+      else()+	message(STATUS "Looking for ACML BLAS: not found")+      endif()+    endif()+  endif()++  if (BLAS_LIBRARIES AND NOT BLAS_VENDOR_FOUND)+      set (BLAS_VENDOR_FOUND "ACML")+  endif()++endif (BLA_VENDOR MATCHES "ACML.*" OR BLA_VENDOR STREQUAL "All") # ACML+++# Apple BLAS library?+if (BLA_VENDOR STREQUAL "Apple" OR BLA_VENDOR STREQUAL "All")++  if(NOT BLAS_LIBRARIES)+    check_fortran_libraries(+      BLAS_LIBRARIES+      BLAS+      dgemm+      ""+      "Accelerate"+      ""+      )+    if(NOT BLAS_FIND_QUIETLY)+      if(BLAS_LIBRARIES)+	message(STATUS "Looking for Apple BLAS: found")+      else()+	message(STATUS "Looking for Apple BLAS: not found")+      endif()+    endif()+  endif()++  if (BLAS_LIBRARIES AND NOT BLAS_VENDOR_FOUND)+      set (BLAS_VENDOR_FOUND "Apple Accelerate")+  endif()++endif (BLA_VENDOR STREQUAL "Apple" OR BLA_VENDOR STREQUAL "All")+++if (BLA_VENDOR STREQUAL "NAS" OR BLA_VENDOR STREQUAL "All")++  if ( NOT BLAS_LIBRARIES )+    check_fortran_libraries(+      BLAS_LIBRARIES+      BLAS+      dgemm+      ""+      "vecLib"+      ""+      )+    if(NOT BLAS_FIND_QUIETLY)+      if(BLAS_LIBRARIES)+	message(STATUS "Looking for NAS BLAS: found")+      else()+	message(STATUS "Looking for NAS BLAS: not found")+      endif()+    endif()+  endif ()++  if (BLAS_LIBRARIES AND NOT BLAS_VENDOR_FOUND)+      set (BLAS_VENDOR_FOUND "NAS")+  endif()++endif (BLA_VENDOR STREQUAL "NAS" OR BLA_VENDOR STREQUAL "All")+++# Generic BLAS library?+if (BLA_VENDOR STREQUAL "Generic" OR BLA_VENDOR STREQUAL "All")++  set(BLAS_SEARCH_LIBS "blas;blas_LINUX;blas_MAC;blas_WINDOWS;refblas")+  foreach (SEARCH_LIB ${BLAS_SEARCH_LIBS})+    if (BLAS_LIBRARIES)+    else ()+      check_fortran_libraries(+	BLAS_LIBRARIES+	BLAS+	sgemm+	""+	"${SEARCH_LIB}"+	"${LGFORTRAN}"+	)+      if(NOT BLAS_FIND_QUIETLY)+	if(BLAS_LIBRARIES)+	  message(STATUS "Looking for Generic BLAS: found")+	else()+	  message(STATUS "Looking for Generic BLAS: not found")+	endif()+      endif()+    endif()+  endforeach ()++  if (BLAS_LIBRARIES AND NOT BLAS_VENDOR_FOUND)+      set (BLAS_VENDOR_FOUND "Netlib or other Generic libblas")+  endif()++endif (BLA_VENDOR STREQUAL "Generic" OR BLA_VENDOR STREQUAL "All")+++if(BLA_F95)++  if(BLAS95_LIBRARIES)+    set(BLAS95_FOUND TRUE)+  else()+    set(BLAS95_FOUND FALSE)+  endif()++  if(NOT BLAS_FIND_QUIETLY)+    if(BLAS95_FOUND)+      message(STATUS "A library with BLAS95 API found.")+      message(STATUS "BLAS_LIBRARIES ${BLAS_LIBRARIES}")+    else(BLAS95_FOUND)+      message(WARNING "BLA_VENDOR has been set to ${BLA_VENDOR} but blas 95 libraries could not be found or check of symbols failed."+	"\nPlease indicate where to find blas libraries. You have three options:\n"+	"- Option 1: Provide the installation directory of BLAS library with cmake option: -DBLAS_DIR=your/path/to/blas\n"+	"- Option 2: Provide the directory where to find BLAS libraries with cmake option: -DBLAS_LIBDIR=your/path/to/blas/libs\n"+	"- Option 3: Update your environment variable (Linux: LD_LIBRARY_PATH, Windows: LIB, Mac: DYLD_LIBRARY_PATH)\n"+	"\nTo follow libraries detection more precisely you can activate a verbose mode with -DBLAS_VERBOSE=ON at cmake configure."+	"\nYou could also specify a BLAS vendor to look for by setting -DBLA_VENDOR=blas_vendor_name."+	"\nList of possible BLAS vendor: Goto, ATLAS PhiPACK, CXML, DXML, SunPerf, SCSL, SGIMATH, IBMESSL, Intel10_32 (intel mkl v10 32 bit),"+	"Intel10_64lp (intel mkl v10 64 bit, lp thread model, lp64 model), Intel10_64lp_seq (intel mkl v10 64 bit, sequential code, lp64 model),"+	"Intel( older versions of mkl 32 and 64 bit), ACML, ACML_MP, ACML_GPU, Apple, NAS, Generic")+      if(BLAS_FIND_REQUIRED)+	message(FATAL_ERROR+	  "A required library with BLAS95 API not found. Please specify library location.")+      else()+	message(STATUS+	  "A library with BLAS95 API not found. Please specify library location.")+      endif()+    endif(BLAS95_FOUND)+  endif(NOT BLAS_FIND_QUIETLY)++  set(BLAS_FOUND TRUE)+  set(BLAS_LIBRARIES "${BLAS95_LIBRARIES}")++else(BLA_F95)++  if(BLAS_LIBRARIES)+    set(BLAS_FOUND TRUE)+  else()+    set(BLAS_FOUND FALSE)+  endif()++  if(NOT BLAS_FIND_QUIETLY)+    if(BLAS_FOUND)+      message(STATUS "A library with BLAS API found.")+      message(STATUS "BLAS_LIBRARIES ${BLAS_LIBRARIES}")+    else(BLAS_FOUND)+      message(WARNING "BLA_VENDOR has been set to ${BLA_VENDOR} but blas libraries could not be found or check of symbols failed."+	"\nPlease indicate where to find blas libraries. You have three options:\n"+	"- Option 1: Provide the installation directory of BLAS library with cmake option: -DBLAS_DIR=your/path/to/blas\n"+	"- Option 2: Provide the directory where to find BLAS libraries with cmake option: -DBLAS_LIBDIR=your/path/to/blas/libs\n"+	"- Option 3: Update your environment variable (Linux: LD_LIBRARY_PATH, Windows: LIB, Mac: DYLD_LIBRARY_PATH)\n"+	"\nTo follow libraries detection more precisely you can activate a verbose mode with -DBLAS_VERBOSE=ON at cmake configure."+	"\nYou could also specify a BLAS vendor to look for by setting -DBLA_VENDOR=blas_vendor_name."+	"\nList of possible BLAS vendor: Goto, ATLAS PhiPACK, CXML, DXML, SunPerf, SCSL, SGIMATH, IBMESSL, Intel10_32 (intel mkl v10 32 bit),"+	"Intel10_64lp (intel mkl v10 64 bit, lp thread model, lp64 model), Intel10_64lp_seq (intel mkl v10 64 bit, sequential code, lp64 model),"+	"Intel( older versions of mkl 32 and 64 bit), ACML, ACML_MP, ACML_GPU, Apple, NAS, Generic")+      if(BLAS_FIND_REQUIRED)+	message(FATAL_ERROR+	  "A required library with BLAS API not found. Please specify library location.")+      else()+	message(STATUS+	  "A library with BLAS API not found. Please specify library location.")+      endif()+    endif(BLAS_FOUND)+  endif(NOT BLAS_FIND_QUIETLY)++endif(BLA_F95)++set(CMAKE_FIND_LIBRARY_SUFFIXES ${_blas_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES})++if (BLAS_FOUND)+  list(GET BLAS_LIBRARIES 0 first_lib)+  get_filename_component(first_lib_path "${first_lib}" PATH)+  if (${first_lib_path} MATCHES "(/lib(32|64)?$)|(/lib/intel64$|/lib/ia32$)")+    string(REGEX REPLACE "(/lib(32|64)?$)|(/lib/intel64$|/lib/ia32$)" "" not_cached_dir "${first_lib_path}")+    set(BLAS_DIR_FOUND "${not_cached_dir}" CACHE PATH "Installation directory of BLAS library" FORCE)+  else()+    set(BLAS_DIR_FOUND "${first_lib_path}" CACHE PATH "Installation directory of BLAS library" FORCE)+  endif()+endif()+mark_as_advanced(BLAS_DIR)+mark_as_advanced(BLAS_DIR_FOUND)
+ eigen3/cmake/FindBLASEXT.cmake view
@@ -0,0 +1,380 @@+###+#+# @copyright (c) 2009-2014 The University of Tennessee and The University+#                          of Tennessee Research Foundation.+#                          All rights reserved.+# @copyright (c) 2012-2016 Inria. All rights reserved.+# @copyright (c) 2012-2014 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, Univ. Bordeaux. All rights reserved.+#+###+#+# - Find BLAS EXTENDED for MORSE projects: find include dirs and libraries+#+# This module allows to find BLAS libraries by calling the official FindBLAS module+# and handles the creation of different library lists whether the user wishes to link+# with a sequential BLAS or a multihreaded (BLAS_SEQ_LIBRARIES and BLAS_PAR_LIBRARIES).+# BLAS is detected with a FindBLAS call then if the BLAS vendor is Intel10_64lp, ACML+# or IBMESSLMT then the module attempts to find the corresponding multithreaded libraries.+#+# The following variables have been added to manage links with sequential or multithreaded+# versions:+#  BLAS_INCLUDE_DIRS  - BLAS include directories+#  BLAS_LIBRARY_DIRS  - Link directories for BLAS libraries+#  BLAS_SEQ_LIBRARIES - BLAS component libraries to be linked (sequential)+#  BLAS_PAR_LIBRARIES - BLAS component libraries to be linked (multithreaded)++#=============================================================================+# Copyright 2012-2013 Inria+# Copyright 2012-2013 Emmanuel Agullo+# Copyright 2012-2013 Mathieu Faverge+# Copyright 2012      Cedric Castagnede+# Copyright 2013-2016 Florent Pruvost+#+# Distributed under the OSI-approved BSD License (the "License");+# see accompanying file MORSE-Copyright.txt for details.+#+# This software is distributed WITHOUT ANY WARRANTY; without even the+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.+# See the License for more information.+#=============================================================================+# (To distribute this file outside of Morse, substitute the full+#  License text for the above reference.)++# macro to factorize this call+macro(find_package_blas)+  if(BLASEXT_FIND_REQUIRED)+    if(BLASEXT_FIND_QUIETLY)+      find_package(BLAS REQUIRED QUIET)+    else()+      find_package(BLAS REQUIRED)+    endif()+  else()+    if(BLASEXT_FIND_QUIETLY)+      find_package(BLAS QUIET)+    else()+      find_package(BLAS)+    endif()+  endif()+endmacro()++# add a cache variable to let the user specify the BLAS vendor+set(BLA_VENDOR "" CACHE STRING "list of possible BLAS vendor:+    Open, Eigen, Goto, ATLAS PhiPACK, CXML, DXML, SunPerf, SCSL, SGIMATH, IBMESSL, IBMESSLMT,+    Intel10_32 (intel mkl v10 32 bit),+    Intel10_64lp (intel mkl v10 64 bit, lp thread model, lp64 model),+    Intel10_64lp_seq (intel mkl v10 64 bit, sequential code, lp64 model),+    Intel( older versions of mkl 32 and 64 bit),+    ACML, ACML_MP, ACML_GPU, Apple, NAS, Generic")++if(NOT BLASEXT_FIND_QUIETLY)+  message(STATUS "In FindBLASEXT")+  message(STATUS "If you want to force the use of one specific library, "+    "\n   please specify the BLAS vendor by setting -DBLA_VENDOR=blas_vendor_name"+    "\n   at cmake configure.")+  message(STATUS "List of possible BLAS vendor: Goto, ATLAS PhiPACK, CXML, "+    "\n   DXML, SunPerf, SCSL, SGIMATH, IBMESSL, IBMESSLMT, Intel10_32 (intel mkl v10 32 bit),"+    "\n   Intel10_64lp (intel mkl v10 64 bit, lp thread model, lp64 model),"+    "\n   Intel10_64lp_seq (intel mkl v10 64 bit, sequential code, lp64 model),"+    "\n   Intel( older versions of mkl 32 and 64 bit),"+    "\n   ACML, ACML_MP, ACML_GPU, Apple, NAS, Generic")+endif()++if (NOT BLAS_FOUND)+  # First try to detect two cases:+  # 1: only SEQ libs are handled+  # 2: both SEQ and PAR libs are handled+  find_package_blas()+endif ()++# detect the cases where SEQ and PAR libs are handled+if(BLA_VENDOR STREQUAL "All" AND+    (BLAS_mkl_core_LIBRARY OR BLAS_mkl_core_dll_LIBRARY)+    )+  set(BLA_VENDOR "Intel")+  if(BLAS_mkl_intel_LIBRARY)+    set(BLA_VENDOR "Intel10_32")+  endif()+  if(BLAS_mkl_intel_lp64_LIBRARY)+    set(BLA_VENDOR "Intel10_64lp")+  endif()+  if(NOT BLASEXT_FIND_QUIETLY)+    message(STATUS "A BLAS library has been found (${BLAS_LIBRARIES}) but we"+      "\n   have also potentially detected some multithreaded BLAS libraries from the MKL."+      "\n   We try to find both libraries lists (Sequential/Multithreaded).")+  endif()+  set(BLAS_FOUND "")+elseif(BLA_VENDOR STREQUAL "All" AND BLAS_acml_LIBRARY)+  set(BLA_VENDOR "ACML")+  if(NOT BLASEXT_FIND_QUIETLY)+    message(STATUS "A BLAS library has been found (${BLAS_LIBRARIES}) but we"+      "\n   have also potentially detected some multithreaded BLAS libraries from the ACML."+      "\n   We try to find both libraries lists (Sequential/Multithreaded).")+  endif()+  set(BLAS_FOUND "")+elseif(BLA_VENDOR STREQUAL "All" AND BLAS_essl_LIBRARY)+  set(BLA_VENDOR "IBMESSL")+  if(NOT BLASEXT_FIND_QUIETLY)+    message(STATUS "A BLAS library has been found (${BLAS_LIBRARIES}) but we"+      "\n   have also potentially detected some multithreaded BLAS libraries from the ESSL."+      "\n   We try to find both libraries lists (Sequential/Multithreaded).")+  endif()+  set(BLAS_FOUND "")+endif()++# Intel case+if(BLA_VENDOR MATCHES "Intel*")++  ###+  # look for include path if the BLAS vendor is Intel+  ###++  # gather system include paths+  unset(_inc_env)+  if(WIN32)+    string(REPLACE ":" ";" _inc_env "$ENV{INCLUDE}")+  else()+    string(REPLACE ":" ";" _path_env "$ENV{INCLUDE}")+    list(APPEND _inc_env "${_path_env}")+    string(REPLACE ":" ";" _path_env "$ENV{C_INCLUDE_PATH}")+    list(APPEND _inc_env "${_path_env}")+    string(REPLACE ":" ";" _path_env "$ENV{CPATH}")+    list(APPEND _inc_env "${_path_env}")+    string(REPLACE ":" ";" _path_env "$ENV{INCLUDE_PATH}")+    list(APPEND _inc_env "${_path_env}")+  endif()+  list(APPEND _inc_env "${CMAKE_PLATFORM_IMPLICIT_INCLUDE_DIRECTORIES}")+  list(APPEND _inc_env "${CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES}")+  set(ENV_MKLROOT "$ENV{MKLROOT}")+  if (ENV_MKLROOT)+    list(APPEND _inc_env "${ENV_MKLROOT}/include")+  endif()+  list(REMOVE_DUPLICATES _inc_env)++  # find mkl.h inside known include paths+  set(BLAS_mkl.h_INCLUDE_DIRS "BLAS_mkl.h_INCLUDE_DIRS-NOTFOUND")+  if(BLAS_INCDIR)+    set(BLAS_mkl.h_INCLUDE_DIRS "BLAS_mkl.h_INCLUDE_DIRS-NOTFOUND")+    find_path(BLAS_mkl.h_INCLUDE_DIRS+      NAMES mkl.h+      HINTS ${BLAS_INCDIR})+  else()+    if(BLAS_DIR)+      set(BLAS_mkl.h_INCLUDE_DIRS "BLAS_mkl.h_INCLUDE_DIRS-NOTFOUND")+      find_path(BLAS_mkl.h_INCLUDE_DIRS+	NAMES mkl.h+	HINTS ${BLAS_DIR}+	PATH_SUFFIXES include)+    else()+      set(BLAS_mkl.h_INCLUDE_DIRS "BLAS_mkl.h_INCLUDE_DIRS-NOTFOUND")+      find_path(BLAS_mkl.h_INCLUDE_DIRS+	NAMES mkl.h+	HINTS ${_inc_env})+    endif()+  endif()+  mark_as_advanced(BLAS_mkl.h_INCLUDE_DIRS)+  ## Print status if not found+  ## -------------------------+  #if (NOT BLAS_mkl.h_INCLUDE_DIRS AND MORSE_VERBOSE)+  #    Print_Find_Header_Status(blas mkl.h)+  #endif ()+  set(BLAS_INCLUDE_DIRS "")+  if(BLAS_mkl.h_INCLUDE_DIRS)+    list(APPEND BLAS_INCLUDE_DIRS "${BLAS_mkl.h_INCLUDE_DIRS}" )+  endif()++  ###+  # look for libs+  ###+  # if Intel 10 64 bit -> look for sequential and multithreaded versions+  if(BLA_VENDOR MATCHES "Intel10_64lp*")++    ## look for the sequential version+    set(BLA_VENDOR "Intel10_64lp_seq")+    if(NOT BLASEXT_FIND_QUIETLY)+      message(STATUS "Look for the sequential version Intel10_64lp_seq")+    endif()+    find_package_blas()+    if(BLAS_FOUND)+      set(BLAS_SEQ_LIBRARIES "${BLAS_LIBRARIES}")+    else()+      set(BLAS_SEQ_LIBRARIES "${BLAS_SEQ_LIBRARIES-NOTFOUND}")+    endif()++    ## look for the multithreaded version+    set(BLA_VENDOR "Intel10_64lp")+    if(NOT BLASEXT_FIND_QUIETLY)+      message(STATUS "Look for the multithreaded version Intel10_64lp")+    endif()+    find_package_blas()+    if(BLAS_FOUND)+      set(BLAS_PAR_LIBRARIES "${BLAS_LIBRARIES}")+    else()+      set(BLAS_PAR_LIBRARIES "${BLAS_PAR_LIBRARIES-NOTFOUND}")+    endif()++  else()++    if(BLAS_FOUND)+      set(BLAS_SEQ_LIBRARIES "${BLAS_LIBRARIES}")+    else()+      set(BLAS_SEQ_LIBRARIES "${BLAS_SEQ_LIBRARIES-NOTFOUND}")+    endif()++  endif()++  # ACML case+elseif(BLA_VENDOR MATCHES "ACML*")++  ## look for the sequential version+  set(BLA_VENDOR "ACML")+  find_package_blas()+  if(BLAS_FOUND)+    set(BLAS_SEQ_LIBRARIES "${BLAS_LIBRARIES}")+  else()+    set(BLAS_SEQ_LIBRARIES "${BLAS_SEQ_LIBRARIES-NOTFOUND}")+  endif()++  ## look for the multithreaded version+  set(BLA_VENDOR "ACML_MP")+  find_package_blas()+  if(BLAS_FOUND)+    set(BLAS_PAR_LIBRARIES "${BLAS_LIBRARIES}")+  else()+    set(BLAS_PAR_LIBRARIES "${BLAS_PAR_LIBRARIES-NOTFOUND}")+  endif()++  # IBMESSL case+elseif(BLA_VENDOR MATCHES "IBMESSL*")++  ## look for the sequential version+  set(BLA_VENDOR "IBMESSL")+  find_package_blas()+  if(BLAS_FOUND)+    set(BLAS_SEQ_LIBRARIES "${BLAS_LIBRARIES}")+  else()+    set(BLAS_SEQ_LIBRARIES "${BLAS_SEQ_LIBRARIES-NOTFOUND}")+  endif()++  ## look for the multithreaded version+  set(BLA_VENDOR "IBMESSLMT")+  find_package_blas()+  if(BLAS_FOUND)+    set(BLAS_PAR_LIBRARIES "${BLAS_LIBRARIES}")+  else()+    set(BLAS_PAR_LIBRARIES "${BLAS_PAR_LIBRARIES-NOTFOUND}")+  endif()++else()++  if(BLAS_FOUND)+    # define the SEQ libs as the BLAS_LIBRARIES+    set(BLAS_SEQ_LIBRARIES "${BLAS_LIBRARIES}")+  else()+    set(BLAS_SEQ_LIBRARIES "${BLAS_SEQ_LIBRARIES-NOTFOUND}")+  endif()+  set(BLAS_PAR_LIBRARIES "${BLAS_PAR_LIBRARIES-NOTFOUND}")++endif()+++if(BLAS_SEQ_LIBRARIES)+  set(BLAS_LIBRARIES "${BLAS_SEQ_LIBRARIES}")+endif()++# extract libs paths+# remark: because it is not given by find_package(BLAS)+set(BLAS_LIBRARY_DIRS "")+string(REPLACE " " ";" BLAS_LIBRARIES "${BLAS_LIBRARIES}")+foreach(blas_lib ${BLAS_LIBRARIES})+  if (EXISTS "${blas_lib}")+    get_filename_component(a_blas_lib_dir "${blas_lib}" PATH)+    list(APPEND BLAS_LIBRARY_DIRS "${a_blas_lib_dir}" )+  else()+    string(REPLACE "-L" "" blas_lib "${blas_lib}")+    if (EXISTS "${blas_lib}")+      list(APPEND BLAS_LIBRARY_DIRS "${blas_lib}" )+    else()+      get_filename_component(a_blas_lib_dir "${blas_lib}" PATH)+      if (EXISTS "${a_blas_lib_dir}")+	list(APPEND BLAS_LIBRARY_DIRS "${a_blas_lib_dir}" )+      endif()+    endif()+  endif()+endforeach()+if (BLAS_LIBRARY_DIRS)+  list(REMOVE_DUPLICATES BLAS_LIBRARY_DIRS)+endif ()++# check that BLAS has been found+# ---------------------------------+include(FindPackageHandleStandardArgs)+if(BLA_VENDOR MATCHES "Intel*")+  if(BLA_VENDOR MATCHES "Intel10_64lp*")+    if(NOT BLASEXT_FIND_QUIETLY)+      message(STATUS "BLAS found is Intel MKL:"+	"\n   we manage two lists of libs, one sequential and one parallel if found"+	"\n   (see BLAS_SEQ_LIBRARIES and BLAS_PAR_LIBRARIES)")+      message(STATUS "BLAS sequential libraries stored in BLAS_SEQ_LIBRARIES")+    endif()+    find_package_handle_standard_args(BLAS DEFAULT_MSG+      BLAS_SEQ_LIBRARIES+      BLAS_LIBRARY_DIRS+      BLAS_INCLUDE_DIRS)+    if(BLAS_PAR_LIBRARIES)+      if(NOT BLASEXT_FIND_QUIETLY)+	message(STATUS "BLAS parallel libraries stored in BLAS_PAR_LIBRARIES")+      endif()+      find_package_handle_standard_args(BLAS DEFAULT_MSG+	BLAS_PAR_LIBRARIES)+    endif()+  else()+    if(NOT BLASEXT_FIND_QUIETLY)+      message(STATUS "BLAS sequential libraries stored in BLAS_SEQ_LIBRARIES")+    endif()+    find_package_handle_standard_args(BLAS DEFAULT_MSG+      BLAS_SEQ_LIBRARIES+      BLAS_LIBRARY_DIRS+      BLAS_INCLUDE_DIRS)+  endif()+elseif(BLA_VENDOR MATCHES "ACML*")+  if(NOT BLASEXT_FIND_QUIETLY)+    message(STATUS "BLAS found is ACML:"+      "\n   we manage two lists of libs, one sequential and one parallel if found"+      "\n   (see BLAS_SEQ_LIBRARIES and BLAS_PAR_LIBRARIES)")+    message(STATUS "BLAS sequential libraries stored in BLAS_SEQ_LIBRARIES")+  endif()+  find_package_handle_standard_args(BLAS DEFAULT_MSG+    BLAS_SEQ_LIBRARIES+    BLAS_LIBRARY_DIRS)+  if(BLAS_PAR_LIBRARIES)+    if(NOT BLASEXT_FIND_QUIETLY)+      message(STATUS "BLAS parallel libraries stored in BLAS_PAR_LIBRARIES")+    endif()+    find_package_handle_standard_args(BLAS DEFAULT_MSG+      BLAS_PAR_LIBRARIES)+  endif()+elseif(BLA_VENDOR MATCHES "IBMESSL*")+  if(NOT BLASEXT_FIND_QUIETLY)+    message(STATUS "BLAS found is ESSL:"+      "\n   we manage two lists of libs, one sequential and one parallel if found"+      "\n   (see BLAS_SEQ_LIBRARIES and BLAS_PAR_LIBRARIES)")+    message(STATUS "BLAS sequential libraries stored in BLAS_SEQ_LIBRARIES")+  endif()+  find_package_handle_standard_args(BLAS DEFAULT_MSG+    BLAS_SEQ_LIBRARIES+    BLAS_LIBRARY_DIRS)+  if(BLAS_PAR_LIBRARIES)+    if(NOT BLASEXT_FIND_QUIETLY)+      message(STATUS "BLAS parallel libraries stored in BLAS_PAR_LIBRARIES")+    endif()+    find_package_handle_standard_args(BLAS DEFAULT_MSG+      BLAS_PAR_LIBRARIES)+  endif()+else()+  if(NOT BLASEXT_FIND_QUIETLY)+    message(STATUS "BLAS sequential libraries stored in BLAS_SEQ_LIBRARIES")+  endif()+  find_package_handle_standard_args(BLAS DEFAULT_MSG+    BLAS_SEQ_LIBRARIES+    BLAS_LIBRARY_DIRS)+endif()
+ eigen3/cmake/FindCholmod.cmake view
@@ -0,0 +1,89 @@+# Cholmod lib usually requires linking to a blas and lapack library.+# It is up to the user of this module to find a BLAS and link to it.++if (CHOLMOD_INCLUDES AND CHOLMOD_LIBRARIES)+  set(CHOLMOD_FIND_QUIETLY TRUE)+endif (CHOLMOD_INCLUDES AND CHOLMOD_LIBRARIES)++find_path(CHOLMOD_INCLUDES+  NAMES+  cholmod.h+  PATHS+  $ENV{CHOLMODDIR}+  ${INCLUDE_INSTALL_DIR}+  PATH_SUFFIXES+  suitesparse+  ufsparse+)++find_library(CHOLMOD_LIBRARIES cholmod PATHS $ENV{CHOLMODDIR} ${LIB_INSTALL_DIR})++if(CHOLMOD_LIBRARIES)++  get_filename_component(CHOLMOD_LIBDIR ${CHOLMOD_LIBRARIES} PATH)++  find_library(AMD_LIBRARY amd PATHS ${CHOLMOD_LIBDIR} $ENV{CHOLMODDIR} ${LIB_INSTALL_DIR})+  if (AMD_LIBRARY)+    set(CHOLMOD_LIBRARIES ${CHOLMOD_LIBRARIES} ${AMD_LIBRARY})+  else ()+    set(CHOLMOD_LIBRARIES FALSE)+  endif ()++endif(CHOLMOD_LIBRARIES)++if(CHOLMOD_LIBRARIES)++  find_library(COLAMD_LIBRARY colamd PATHS ${CHOLMOD_LIBDIR} $ENV{CHOLMODDIR} ${LIB_INSTALL_DIR})+  if (COLAMD_LIBRARY)+    set(CHOLMOD_LIBRARIES ${CHOLMOD_LIBRARIES} ${COLAMD_LIBRARY})+  else ()+    set(CHOLMOD_LIBRARIES FALSE)+  endif ()++endif(CHOLMOD_LIBRARIES)++if(CHOLMOD_LIBRARIES)++  find_library(CAMD_LIBRARY camd PATHS ${CHOLMOD_LIBDIR} $ENV{CHOLMODDIR} ${LIB_INSTALL_DIR})+  if (CAMD_LIBRARY)+    set(CHOLMOD_LIBRARIES ${CHOLMOD_LIBRARIES} ${CAMD_LIBRARY})+  else ()+    set(CHOLMOD_LIBRARIES FALSE)+  endif ()++endif(CHOLMOD_LIBRARIES)++if(CHOLMOD_LIBRARIES)++  find_library(CCOLAMD_LIBRARY ccolamd PATHS ${CHOLMOD_LIBDIR} $ENV{CHOLMODDIR} ${LIB_INSTALL_DIR})+  if (CCOLAMD_LIBRARY)+    set(CHOLMOD_LIBRARIES ${CHOLMOD_LIBRARIES} ${CCOLAMD_LIBRARY})+  else ()+    set(CHOLMOD_LIBRARIES FALSE)+  endif ()++endif(CHOLMOD_LIBRARIES)++if(CHOLMOD_LIBRARIES)++  find_library(CHOLMOD_METIS_LIBRARY metis PATHS ${CHOLMOD_LIBDIR} $ENV{CHOLMODDIR} ${LIB_INSTALL_DIR})+  if (CHOLMOD_METIS_LIBRARY)+    set(CHOLMOD_LIBRARIES ${CHOLMOD_LIBRARIES} ${CHOLMOD_METIS_LIBRARY})+  endif ()++endif(CHOLMOD_LIBRARIES)++if(CHOLMOD_LIBRARIES)++  find_library(SUITESPARSE_LIBRARY SuiteSparse PATHS ${CHOLMOD_LIBDIR} $ENV{CHOLMODDIR} ${LIB_INSTALL_DIR})+  if (SUITESPARSE_LIBRARY)+    set(CHOLMOD_LIBRARIES ${CHOLMOD_LIBRARIES} ${SUITESPARSE_LIBRARY})+  endif (SUITESPARSE_LIBRARY)+  +endif(CHOLMOD_LIBRARIES)++include(FindPackageHandleStandardArgs)+find_package_handle_standard_args(CHOLMOD DEFAULT_MSG+                                  CHOLMOD_INCLUDES CHOLMOD_LIBRARIES)++mark_as_advanced(CHOLMOD_INCLUDES CHOLMOD_LIBRARIES AMD_LIBRARY COLAMD_LIBRARY SUITESPARSE_LIBRARY CAMD_LIBRARY CCOLAMD_LIBRARY CHOLMOD_METIS_LIBRARY)
+ eigen3/cmake/FindComputeCpp.cmake view
@@ -0,0 +1,245 @@+#.rst:+# FindComputeCpp+#---------------+#+#   Copyright 2016 Codeplay Software Ltd.+#+#   Licensed under the Apache License, Version 2.0 (the "License");+#   you may not use these files 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.++#########################+#  FindComputeCpp.cmake+#########################+#+#  Tools for finding and building with ComputeCpp.+#+#  User must define COMPUTECPP_PACKAGE_ROOT_DIR pointing to the ComputeCpp+#   installation.+#+#  Latest version of this file can be found at:+#    https://github.com/codeplaysoftware/computecpp-sdk++# Require CMake version 3.2.2 or higher+cmake_minimum_required(VERSION 3.2.2)++# Check that a supported host compiler can be found+if(CMAKE_COMPILER_IS_GNUCXX)+    # Require at least gcc 4.8+    if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.8)+      message(FATAL_ERROR+        "host compiler - Not found! (gcc version must be at least 4.8)")+    # Require the GCC dual ABI to be disabled for 5.1 or higher+    elseif (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 5.1)+      set(COMPUTECPP_DISABLE_GCC_DUAL_ABI "True")+      message(STATUS+        "host compiler - gcc ${CMAKE_CXX_COMPILER_VERSION} (note pre 5.1 gcc ABI enabled)")+    else()+      message(STATUS "host compiler - gcc ${CMAKE_CXX_COMPILER_VERSION}")+    endif()+elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")+    # Require at least clang 3.6+    if (${CMAKE_CXX_COMPILER_VERSION} VERSION_LESS 3.6)+      message(FATAL_ERROR+        "host compiler - Not found! (clang version must be at least 3.6)")+    else()+      message(STATUS "host compiler - clang ${CMAKE_CXX_COMPILER_VERSION}")+    endif()+else()+  message(WARNING+    "host compiler - Not found! (ComputeCpp supports GCC and Clang, see readme)")+endif()++set(COMPUTECPP_64_BIT_DEFAULT ON)+option(COMPUTECPP_64_BIT_CODE "Compile device code in 64 bit mode"+        ${COMPUTECPP_64_BIT_DEFAULT})+mark_as_advanced(COMPUTECPP_64_BIT_CODE)++# Find OpenCL package+find_package(OpenCL REQUIRED)++# Find ComputeCpp packagee+if(NOT COMPUTECPP_PACKAGE_ROOT_DIR)+  message(FATAL_ERROR+    "ComputeCpp package - Not found! (please set COMPUTECPP_PACKAGE_ROOT_DIR")+else()+  message(STATUS "ComputeCpp package - Found")+endif()+option(COMPUTECPP_PACKAGE_ROOT_DIR "Path to the ComputeCpp Package")++# Obtain the path to compute+++find_program(COMPUTECPP_DEVICE_COMPILER compute++ PATHS+  ${COMPUTECPP_PACKAGE_ROOT_DIR} PATH_SUFFIXES bin)+if (EXISTS ${COMPUTECPP_DEVICE_COMPILER})+  mark_as_advanced(COMPUTECPP_DEVICE_COMPILER)+  message(STATUS "compute++ - Found")+else()+  message(FATAL_ERROR "compute++ - Not found! (${COMPUTECPP_DEVICE_COMPILER})")+endif()++# Obtain the path to computecpp_info+find_program(COMPUTECPP_INFO_TOOL computecpp_info PATHS+  ${COMPUTECPP_PACKAGE_ROOT_DIR} PATH_SUFFIXES bin)+if (EXISTS ${COMPUTECPP_INFO_TOOL})+  mark_as_advanced(${COMPUTECPP_INFO_TOOL})+  message(STATUS "computecpp_info - Found")+else()+  message(FATAL_ERROR "computecpp_info - Not found! (${COMPUTECPP_INFO_TOOL})")+endif()++# Obtain the path to the ComputeCpp runtime library+find_library(COMPUTECPP_RUNTIME_LIBRARY ComputeCpp PATHS ${COMPUTECPP_PACKAGE_ROOT_DIR}+  HINTS ${COMPUTECPP_PACKAGE_ROOT_DIR}/lib PATH_SUFFIXES lib+  DOC "ComputeCpp Runtime Library" NO_DEFAULT_PATH)++if (EXISTS ${COMPUTECPP_RUNTIME_LIBRARY})+  mark_as_advanced(COMPUTECPP_RUNTIME_LIBRARY)+  message(STATUS "libComputeCpp.so - Found")+else()+  message(FATAL_ERROR "libComputeCpp.so - Not found!")+endif()++# Obtain the ComputeCpp include directory+set(COMPUTECPP_INCLUDE_DIRECTORY ${COMPUTECPP_PACKAGE_ROOT_DIR}/include/)+if (NOT EXISTS ${COMPUTECPP_INCLUDE_DIRECTORY})+  message(FATAL_ERROR "ComputeCpp includes - Not found!")+else()+  message(STATUS "ComputeCpp includes - Found")+endif()++# Obtain the package version+execute_process(COMMAND ${COMPUTECPP_INFO_TOOL} "--dump-version"+  OUTPUT_VARIABLE COMPUTECPP_PACKAGE_VERSION+  RESULT_VARIABLE COMPUTECPP_INFO_TOOL_RESULT OUTPUT_STRIP_TRAILING_WHITESPACE)+if(NOT COMPUTECPP_INFO_TOOL_RESULT EQUAL "0")+  message(FATAL_ERROR "Package version - Error obtaining version!")+else()+  mark_as_advanced(COMPUTECPP_PACKAGE_VERSION)+  message(STATUS "Package version - ${COMPUTECPP_PACKAGE_VERSION}")+endif()++# Obtain the device compiler flags+execute_process(COMMAND ${COMPUTECPP_INFO_TOOL} "--dump-device-compiler-flags"+  OUTPUT_VARIABLE COMPUTECPP_DEVICE_COMPILER_FLAGS+  RESULT_VARIABLE COMPUTECPP_INFO_TOOL_RESULT OUTPUT_STRIP_TRAILING_WHITESPACE)+if(NOT COMPUTECPP_INFO_TOOL_RESULT EQUAL "0")+  message(FATAL_ERROR "compute++ flags - Error obtaining compute++ flags!")+else()+  mark_as_advanced(COMPUTECPP_COMPILER_FLAGS)+  message(STATUS "compute++ flags - ${COMPUTECPP_DEVICE_COMPILER_FLAGS}")+endif()++set(COMPUTECPP_DEVICE_COMPILER_FLAGS ${COMPUTECPP_DEVICE_COMPILER_FLAGS} -sycl-compress-name -no-serial-memop -DEIGEN_NO_ASSERTION_CHECKING=1)++# Check if the platform is supported+execute_process(COMMAND ${COMPUTECPP_INFO_TOOL} "--dump-is-supported"+  OUTPUT_VARIABLE COMPUTECPP_PLATFORM_IS_SUPPORTED+  RESULT_VARIABLE COMPUTECPP_INFO_TOOL_RESULT OUTPUT_STRIP_TRAILING_WHITESPACE)+if(NOT COMPUTECPP_INFO_TOOL_RESULT EQUAL "0")+  message(FATAL_ERROR "platform - Error checking platform support!")+else()+  mark_as_advanced(COMPUTECPP_PLATFORM_IS_SUPPORTED)+  if (COMPUTECPP_PLATFORM_IS_SUPPORTED)+    message(STATUS "platform - your system can support ComputeCpp")+  else()+    message(STATUS "platform - your system CANNOT support ComputeCpp")+  endif()+endif()++####################+#   __build_sycl+####################+#+#  Adds a custom target for running compute++ and adding a dependency for the+#  resulting integration header.+#+#  targetName : Name of the target.+#  sourceFile : Source file to be compiled.+#  binaryDir : Intermediate directory to output the integration header.+#+function(__build_spir targetName sourceFile binaryDir)++  # Retrieve source file name.+  get_filename_component(sourceFileName ${sourceFile} NAME)++  # Set the path to the Sycl file.+  set(outputSyclFile ${binaryDir}/${sourceFileName}.sycl)++  # Add any user-defined include to the device compiler+  get_property(includeDirectories DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY+    INCLUDE_DIRECTORIES)+  set(device_compiler_includes "")+  foreach(directory ${includeDirectories})+    set(device_compiler_includes "-I${directory}" ${device_compiler_includes})+  endforeach()+  if (CMAKE_INCLUDE_PATH)+    foreach(directory ${CMAKE_INCLUDE_PATH})+      set(device_compiler_includes "-I${directory}"+        ${device_compiler_includes})+    endforeach()+  endif()++  # Convert argument list format+  separate_arguments(COMPUTECPP_DEVICE_COMPILER_FLAGS)++  # Add custom command for running compute+++  add_custom_command(+    OUTPUT ${outputSyclFile}+    COMMAND ${COMPUTECPP_DEVICE_COMPILER}+            ${COMPUTECPP_DEVICE_COMPILER_FLAGS}+            -isystem ${COMPUTECPP_INCLUDE_DIRECTORY}+            ${COMPUTECPP_PLATFORM_SPECIFIC_ARGS}+            ${device_compiler_includes}+            -o ${outputSyclFile}+            -c ${CMAKE_CURRENT_SOURCE_DIR}/${sourceFile}+    DEPENDS ${sourceFile}+    WORKING_DIRECTORY ${binaryDir}+  COMMENT "Building ComputeCpp integration header file ${outputSyclFile}")++  # Add a custom target for the generated integration header+  add_custom_target(${targetName}_integration_header DEPENDS ${outputSyclFile})++  # Add a dependency on the integration header+  add_dependencies(${targetName} ${targetName}_integration_header)++  # Set the host compiler C++ standard to C++11+  set_property(TARGET ${targetName} PROPERTY CXX_STANDARD 11)++  # Disable GCC dual ABI on GCC 5.1 and higher+  if(COMPUTECPP_DISABLE_GCC_DUAL_ABI)+    set_property(TARGET ${targetName} APPEND PROPERTY COMPILE_DEFINITIONS+      "_GLIBCXX_USE_CXX11_ABI=0")+  endif()++endfunction()++#######################+#  add_sycl_to_target+#######################+#+#  Adds a SYCL compilation custom command associated with an existing+#  target and sets a dependancy on that new command.+#+#  targetName : Name of the target to add a SYCL to.+#  sourceFile : Source file to be compiled for SYCL.+#  binaryDir : Intermediate directory to output the integration header.+#+function(add_sycl_to_target targetName sourceFile binaryDir)++  # Add custom target to run compute++ and generate the integration header+  __build_spir(${targetName} ${sourceFile} ${binaryDir})++  # Link with the ComputeCpp runtime library+  target_link_libraries(${targetName} PUBLIC ${COMPUTECPP_RUNTIME_LIBRARY}+                        PUBLIC ${OpenCL_LIBRARIES})++endfunction(add_sycl_to_target)
+ eigen3/cmake/FindEigen2.cmake view
@@ -0,0 +1,80 @@+# - Try to find Eigen2 lib+#+# This module supports requiring a minimum version, e.g. you can do+#   find_package(Eigen2 2.0.3)+# to require version 2.0.3 to newer of Eigen2.+#+# Once done this will define+#+#  EIGEN2_FOUND - system has eigen lib with correct version+#  EIGEN2_INCLUDE_DIR - the eigen include directory+#  EIGEN2_VERSION - eigen version++# Copyright (c) 2006, 2007 Montel Laurent, <montel@kde.org>+# Copyright (c) 2008, 2009 Gael Guennebaud, <g.gael@free.fr>+# Redistribution and use is allowed according to the terms of the BSD license.++if(NOT Eigen2_FIND_VERSION)+  if(NOT Eigen2_FIND_VERSION_MAJOR)+    set(Eigen2_FIND_VERSION_MAJOR 2)+  endif(NOT Eigen2_FIND_VERSION_MAJOR)+  if(NOT Eigen2_FIND_VERSION_MINOR)+    set(Eigen2_FIND_VERSION_MINOR 0)+  endif(NOT Eigen2_FIND_VERSION_MINOR)+  if(NOT Eigen2_FIND_VERSION_PATCH)+    set(Eigen2_FIND_VERSION_PATCH 0)+  endif(NOT Eigen2_FIND_VERSION_PATCH)++  set(Eigen2_FIND_VERSION "${Eigen2_FIND_VERSION_MAJOR}.${Eigen2_FIND_VERSION_MINOR}.${Eigen2_FIND_VERSION_PATCH}")+endif(NOT Eigen2_FIND_VERSION)++macro(_eigen2_check_version)+  file(READ "${EIGEN2_INCLUDE_DIR}/Eigen/src/Core/util/Macros.h" _eigen2_version_header)++  string(REGEX MATCH "define[ \t]+EIGEN_WORLD_VERSION[ \t]+([0-9]+)" _eigen2_world_version_match "${_eigen2_version_header}")+  set(EIGEN2_WORLD_VERSION "${CMAKE_MATCH_1}")+  string(REGEX MATCH "define[ \t]+EIGEN_MAJOR_VERSION[ \t]+([0-9]+)" _eigen2_major_version_match "${_eigen2_version_header}")+  set(EIGEN2_MAJOR_VERSION "${CMAKE_MATCH_1}")+  string(REGEX MATCH "define[ \t]+EIGEN_MINOR_VERSION[ \t]+([0-9]+)" _eigen2_minor_version_match "${_eigen2_version_header}")+  set(EIGEN2_MINOR_VERSION "${CMAKE_MATCH_1}")++  set(EIGEN2_VERSION ${EIGEN2_WORLD_VERSION}.${EIGEN2_MAJOR_VERSION}.${EIGEN2_MINOR_VERSION})+  if((${EIGEN2_WORLD_VERSION} NOTEQUAL 2) OR (${EIGEN2_MAJOR_VERSION} GREATER 10) OR (${EIGEN2_VERSION} VERSION_LESS ${Eigen2_FIND_VERSION}))+    set(EIGEN2_VERSION_OK FALSE)+  else()+    set(EIGEN2_VERSION_OK TRUE)+  endif()++  if(NOT EIGEN2_VERSION_OK)++    message(STATUS "Eigen2 version ${EIGEN2_VERSION} found in ${EIGEN2_INCLUDE_DIR}, "+                   "but at least version ${Eigen2_FIND_VERSION} is required")+  endif(NOT EIGEN2_VERSION_OK)+endmacro(_eigen2_check_version)++if (EIGEN2_INCLUDE_DIR)++  # in cache already+  _eigen2_check_version()+  set(EIGEN2_FOUND ${EIGEN2_VERSION_OK})++else (EIGEN2_INCLUDE_DIR)++find_path(EIGEN2_INCLUDE_DIR NAMES Eigen/Core+     PATHS+     ${INCLUDE_INSTALL_DIR}+     ${KDE4_INCLUDE_DIR}+     PATH_SUFFIXES eigen2+   )++if(EIGEN2_INCLUDE_DIR)+  _eigen2_check_version()+endif(EIGEN2_INCLUDE_DIR)++include(FindPackageHandleStandardArgs)+find_package_handle_standard_args(Eigen2 DEFAULT_MSG EIGEN2_INCLUDE_DIR EIGEN2_VERSION_OK)++mark_as_advanced(EIGEN2_INCLUDE_DIR)++endif(EIGEN2_INCLUDE_DIR)+
+ eigen3/cmake/FindEigen3.cmake view
@@ -0,0 +1,97 @@+# - Try to find Eigen3 lib+#+# This module supports requiring a minimum version, e.g. you can do+#   find_package(Eigen3 3.1.2)+# to require version 3.1.2 or newer of Eigen3.+#+# Once done this will define+#+#  EIGEN3_FOUND - system has eigen lib with correct version+#  EIGEN3_INCLUDE_DIR - the eigen include directory+#  EIGEN3_VERSION - eigen version+#+# This module reads hints about search locations from +# the following enviroment variables:+#+# EIGEN3_ROOT+# EIGEN3_ROOT_DIR++# Copyright (c) 2006, 2007 Montel Laurent, <montel@kde.org>+# Copyright (c) 2008, 2009 Gael Guennebaud, <g.gael@free.fr>+# Copyright (c) 2009 Benoit Jacob <jacob.benoit.1@gmail.com>+# Redistribution and use is allowed according to the terms of the 2-clause BSD license.++if(NOT Eigen3_FIND_VERSION)+  if(NOT Eigen3_FIND_VERSION_MAJOR)+    set(Eigen3_FIND_VERSION_MAJOR 2)+  endif(NOT Eigen3_FIND_VERSION_MAJOR)+  if(NOT Eigen3_FIND_VERSION_MINOR)+    set(Eigen3_FIND_VERSION_MINOR 91)+  endif(NOT Eigen3_FIND_VERSION_MINOR)+  if(NOT Eigen3_FIND_VERSION_PATCH)+    set(Eigen3_FIND_VERSION_PATCH 0)+  endif(NOT Eigen3_FIND_VERSION_PATCH)++  set(Eigen3_FIND_VERSION "${Eigen3_FIND_VERSION_MAJOR}.${Eigen3_FIND_VERSION_MINOR}.${Eigen3_FIND_VERSION_PATCH}")+endif(NOT Eigen3_FIND_VERSION)++macro(_eigen3_check_version)+  file(READ "${EIGEN3_INCLUDE_DIR}/Eigen/src/Core/util/Macros.h" _eigen3_version_header)++  string(REGEX MATCH "define[ \t]+EIGEN_WORLD_VERSION[ \t]+([0-9]+)" _eigen3_world_version_match "${_eigen3_version_header}")+  set(EIGEN3_WORLD_VERSION "${CMAKE_MATCH_1}")+  string(REGEX MATCH "define[ \t]+EIGEN_MAJOR_VERSION[ \t]+([0-9]+)" _eigen3_major_version_match "${_eigen3_version_header}")+  set(EIGEN3_MAJOR_VERSION "${CMAKE_MATCH_1}")+  string(REGEX MATCH "define[ \t]+EIGEN_MINOR_VERSION[ \t]+([0-9]+)" _eigen3_minor_version_match "${_eigen3_version_header}")+  set(EIGEN3_MINOR_VERSION "${CMAKE_MATCH_1}")++  set(EIGEN3_VERSION ${EIGEN3_WORLD_VERSION}.${EIGEN3_MAJOR_VERSION}.${EIGEN3_MINOR_VERSION})+  if(${EIGEN3_VERSION} VERSION_LESS ${Eigen3_FIND_VERSION})+    set(EIGEN3_VERSION_OK FALSE)+  else(${EIGEN3_VERSION} VERSION_LESS ${Eigen3_FIND_VERSION})+    set(EIGEN3_VERSION_OK TRUE)+  endif(${EIGEN3_VERSION} VERSION_LESS ${Eigen3_FIND_VERSION})++  if(NOT EIGEN3_VERSION_OK)++    message(STATUS "Eigen3 version ${EIGEN3_VERSION} found in ${EIGEN3_INCLUDE_DIR}, "+                   "but at least version ${Eigen3_FIND_VERSION} is required")+  endif(NOT EIGEN3_VERSION_OK)+endmacro(_eigen3_check_version)++if (EIGEN3_INCLUDE_DIR)++  # in cache already+  _eigen3_check_version()+  set(EIGEN3_FOUND ${EIGEN3_VERSION_OK})++else (EIGEN3_INCLUDE_DIR)+  +  # search first if an Eigen3Config.cmake is available in the system,+  # if successful this would set EIGEN3_INCLUDE_DIR and the rest of+  # the script will work as usual+  find_package(Eigen3 ${Eigen3_FIND_VERSION} NO_MODULE QUIET)++  if(NOT EIGEN3_INCLUDE_DIR)+    find_path(EIGEN3_INCLUDE_DIR NAMES signature_of_eigen3_matrix_library+        HINTS+        ENV EIGEN3_ROOT +        ENV EIGEN3_ROOT_DIR+        PATHS+        ${CMAKE_INSTALL_PREFIX}/include+        ${KDE4_INCLUDE_DIR}+        PATH_SUFFIXES eigen3 eigen+      )+  endif(NOT EIGEN3_INCLUDE_DIR)++  if(EIGEN3_INCLUDE_DIR)+    _eigen3_check_version()+  endif(EIGEN3_INCLUDE_DIR)++  include(FindPackageHandleStandardArgs)+  find_package_handle_standard_args(Eigen3 DEFAULT_MSG EIGEN3_INCLUDE_DIR EIGEN3_VERSION_OK)++  mark_as_advanced(EIGEN3_INCLUDE_DIR)++endif(EIGEN3_INCLUDE_DIR)+
+ eigen3/cmake/FindFFTW.cmake view
@@ -0,0 +1,119 @@+# - Find the FFTW library+#+# Usage:+#   find_package(FFTW [REQUIRED] [QUIET] )+#     +# It sets the following variables:+#   FFTW_FOUND               ... true if fftw is found on the system+#   FFTW_LIBRARIES           ... full path to fftw library+#   FFTW_INCLUDES            ... fftw include directory+#+# The following variables will be checked by the function+#   FFTW_USE_STATIC_LIBS    ... if true, only static libraries are found+#   FFTW_ROOT               ... if set, the libraries are exclusively searched+#                               under this path+#   FFTW_LIBRARY            ... fftw library to use+#   FFTW_INCLUDE_DIR        ... fftw include directory+#++#If environment variable FFTWDIR is specified, it has same effect as FFTW_ROOT+if( NOT FFTW_ROOT AND ENV{FFTWDIR} )+  set( FFTW_ROOT $ENV{FFTWDIR} )+endif()++# Check if we can use PkgConfig+find_package(PkgConfig)++#Determine from PKG+if( PKG_CONFIG_FOUND AND NOT FFTW_ROOT )+  pkg_check_modules( PKG_FFTW QUIET "fftw3" )+endif()++#Check whether to search static or dynamic libs+set( CMAKE_FIND_LIBRARY_SUFFIXES_SAV ${CMAKE_FIND_LIBRARY_SUFFIXES} )++if( ${FFTW_USE_STATIC_LIBS} )+  set( CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_STATIC_LIBRARY_SUFFIX} )+else()+  set( CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_SHARED_LIBRARY_SUFFIX} )+endif()++if( FFTW_ROOT )++  #find libs+  find_library(+    FFTW_LIB+    NAMES "fftw3"+    PATHS ${FFTW_ROOT}+    PATH_SUFFIXES "lib" "lib64"+    NO_DEFAULT_PATH+  )++  find_library(+    FFTWF_LIB+    NAMES "fftw3f"+    PATHS ${FFTW_ROOT}+    PATH_SUFFIXES "lib" "lib64"+    NO_DEFAULT_PATH+  )++  find_library(+    FFTWL_LIB+    NAMES "fftw3l"+    PATHS ${FFTW_ROOT}+    PATH_SUFFIXES "lib" "lib64"+    NO_DEFAULT_PATH+  )++  #find includes+  find_path(+    FFTW_INCLUDES+    NAMES "fftw3.h"+    PATHS ${FFTW_ROOT}+    PATH_SUFFIXES "include"+    NO_DEFAULT_PATH+  )++else()++  find_library(+    FFTW_LIB+    NAMES "fftw3"+    PATHS ${PKG_FFTW_LIBRARY_DIRS} ${LIB_INSTALL_DIR}+  )++  find_library(+    FFTWF_LIB+    NAMES "fftw3f"+    PATHS ${PKG_FFTW_LIBRARY_DIRS} ${LIB_INSTALL_DIR}+  )+++  find_library(+    FFTWL_LIB+    NAMES "fftw3l"+    PATHS ${PKG_FFTW_LIBRARY_DIRS} ${LIB_INSTALL_DIR}+  )++  find_path(+    FFTW_INCLUDES+    NAMES "fftw3.h"+    PATHS ${PKG_FFTW_INCLUDE_DIRS} ${INCLUDE_INSTALL_DIR}+  )++endif( FFTW_ROOT )++set(FFTW_LIBRARIES ${FFTW_LIB} ${FFTWF_LIB})++if(FFTWL_LIB)+  set(FFTW_LIBRARIES ${FFTW_LIBRARIES} ${FFTWL_LIB})+endif()++set( CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES_SAV} )++include(FindPackageHandleStandardArgs)+find_package_handle_standard_args(FFTW DEFAULT_MSG+                                  FFTW_INCLUDES FFTW_LIBRARIES)++mark_as_advanced(FFTW_INCLUDES FFTW_LIBRARIES FFTW_LIB FFTWF_LIB FFTWL_LIB)+
+ eigen3/cmake/FindGLEW.cmake view
@@ -0,0 +1,105 @@+# Copyright (c) 2009 Boudewijn Rempt <boud@valdyas.org>                                                                                          +#                                                                                                                                                +# Redistribution and use is allowed according to the terms of the BSD license.                                                                   +# For details see the accompanying COPYING-CMAKE-SCRIPTS file. +# +# - try to find glew library and include files+#  GLEW_INCLUDE_DIR, where to find GL/glew.h, etc.+#  GLEW_LIBRARIES, the libraries to link against+#  GLEW_FOUND, If false, do not try to use GLEW.+# Also defined, but not for general use are:+#  GLEW_GLEW_LIBRARY = the full path to the glew library.++IF (WIN32)++  IF(CYGWIN)++    FIND_PATH( GLEW_INCLUDE_DIR GL/glew.h)++    FIND_LIBRARY( GLEW_GLEW_LIBRARY glew32+      ${OPENGL_LIBRARY_DIR}+      /usr/lib/w32api+      /usr/X11R6/lib+    )+++  ELSE(CYGWIN)+  +    FIND_PATH( GLEW_INCLUDE_DIR GL/glew.h+      $ENV{GLEW_ROOT_PATH}/include+    )++    FIND_LIBRARY( GLEW_GLEW_LIBRARY+      NAMES glew glew32+      PATHS+      $ENV{GLEW_ROOT_PATH}/lib+      ${OPENGL_LIBRARY_DIR}+    )++  ENDIF(CYGWIN)++ELSE (WIN32)++  IF (APPLE)+# These values for Apple could probably do with improvement.+    FIND_PATH( GLEW_INCLUDE_DIR glew.h+      /System/Library/Frameworks/GLEW.framework/Versions/A/Headers+      ${OPENGL_LIBRARY_DIR}+    )+    SET(GLEW_GLEW_LIBRARY "-framework GLEW" CACHE STRING "GLEW library for OSX")+    SET(GLEW_cocoa_LIBRARY "-framework Cocoa" CACHE STRING "Cocoa framework for OSX")+  ELSE (APPLE)++    FIND_PATH( GLEW_INCLUDE_DIR GL/glew.h+      /usr/include/GL+      /usr/openwin/share/include+      /usr/openwin/include+      /usr/X11R6/include+      /usr/include/X11+      /opt/graphics/OpenGL/include+      /opt/graphics/OpenGL/contrib/libglew+    )++    FIND_LIBRARY( GLEW_GLEW_LIBRARY GLEW+      /usr/openwin/lib+      /usr/X11R6/lib+    )++  ENDIF (APPLE)++ENDIF (WIN32)++SET( GLEW_FOUND "NO" )+IF(GLEW_INCLUDE_DIR)+  IF(GLEW_GLEW_LIBRARY)+    # Is -lXi and -lXmu required on all platforms that have it?+    # If not, we need some way to figure out what platform we are on.+    SET( GLEW_LIBRARIES+      ${GLEW_GLEW_LIBRARY}+      ${GLEW_cocoa_LIBRARY}+    )+    SET( GLEW_FOUND "YES" )++#The following deprecated settings are for backwards compatibility with CMake1.4+    SET (GLEW_LIBRARY ${GLEW_LIBRARIES})+    SET (GLEW_INCLUDE_PATH ${GLEW_INCLUDE_DIR})++  ENDIF(GLEW_GLEW_LIBRARY)+ENDIF(GLEW_INCLUDE_DIR)++IF(GLEW_FOUND)+  IF(NOT GLEW_FIND_QUIETLY)+    MESSAGE(STATUS "Found Glew: ${GLEW_LIBRARIES}")+  ENDIF(NOT GLEW_FIND_QUIETLY)+ELSE(GLEW_FOUND)+  IF(GLEW_FIND_REQUIRED)+    MESSAGE(FATAL_ERROR "Could not find Glew")+  ENDIF(GLEW_FIND_REQUIRED)+ENDIF(GLEW_FOUND)++MARK_AS_ADVANCED(+  GLEW_INCLUDE_DIR+  GLEW_GLEW_LIBRARY+  GLEW_Xmu_LIBRARY+  GLEW_Xi_LIBRARY+)
+ eigen3/cmake/FindGMP.cmake view
@@ -0,0 +1,21 @@+# Try to find the GNU Multiple Precision Arithmetic Library (GMP)+# See http://gmplib.org/++if (GMP_INCLUDES AND GMP_LIBRARIES)+  set(GMP_FIND_QUIETLY TRUE)+endif (GMP_INCLUDES AND GMP_LIBRARIES)++find_path(GMP_INCLUDES+  NAMES+  gmp.h+  PATHS+  $ENV{GMPDIR}+  ${INCLUDE_INSTALL_DIR}+)++find_library(GMP_LIBRARIES gmp PATHS $ENV{GMPDIR} ${LIB_INSTALL_DIR})++include(FindPackageHandleStandardArgs)+find_package_handle_standard_args(GMP DEFAULT_MSG+                                  GMP_INCLUDES GMP_LIBRARIES)+mark_as_advanced(GMP_INCLUDES GMP_LIBRARIES)
+ eigen3/cmake/FindGSL.cmake view
@@ -0,0 +1,170 @@+# Try to find gnu scientific library GSL+# See +# http://www.gnu.org/software/gsl/  and+# http://gnuwin32.sourceforge.net/packages/gsl.htm+#+# Once run this will define: +# +# GSL_FOUND       = system has GSL lib+#+# GSL_LIBRARIES   = full path to the libraries+#    on Unix/Linux with additional linker flags from "gsl-config --libs"+# +# CMAKE_GSL_CXX_FLAGS  = Unix compiler flags for GSL, essentially "`gsl-config --cxxflags`"+#+# GSL_INCLUDE_DIR      = where to find headers +#+# GSL_LINK_DIRECTORIES = link directories, useful for rpath on Unix+# GSL_EXE_LINKER_FLAGS = rpath on Unix+#+# Felix Woelk 07/2004+# Jan Woetzel+#+# www.mip.informatik.uni-kiel.de+# --------------------------------++IF(WIN32)+  # JW tested with gsl-1.8, Windows XP, MSVS 7.1+  SET(GSL_POSSIBLE_ROOT_DIRS+    ${GSL_ROOT_DIR}+    $ENV{GSL_ROOT_DIR}+    ${GSL_DIR}+    ${GSL_HOME}    +    $ENV{GSL_DIR}+    $ENV{GSL_HOME}+    $ENV{EXTRA}+    "C:/Program Files/GnuWin32"+    )+  FIND_PATH(GSL_INCLUDE_DIR+    NAMES gsl/gsl_cdf.h gsl/gsl_randist.h+    PATHS ${GSL_POSSIBLE_ROOT_DIRS}+    PATH_SUFFIXES include+    DOC "GSL header include dir"+    )+  +  FIND_LIBRARY(GSL_GSL_LIBRARY+    NAMES libgsl.dll.a gsl libgsl+    PATHS  ${GSL_POSSIBLE_ROOT_DIRS}+    PATH_SUFFIXES lib+    DOC "GSL library" )+  +  if(NOT GSL_GSL_LIBRARY)+	FIND_FILE(GSL_GSL_LIBRARY+		NAMES libgsl.dll.a+		PATHS  ${GSL_POSSIBLE_ROOT_DIRS}+		PATH_SUFFIXES lib+		DOC "GSL library")+  endif(NOT GSL_GSL_LIBRARY)+  +  FIND_LIBRARY(GSL_GSLCBLAS_LIBRARY+    NAMES libgslcblas.dll.a gslcblas libgslcblas+    PATHS  ${GSL_POSSIBLE_ROOT_DIRS}+    PATH_SUFFIXES lib+    DOC "GSL cblas library dir" )+  +  if(NOT GSL_GSLCBLAS_LIBRARY)+	FIND_FILE(GSL_GSLCBLAS_LIBRARY+		NAMES libgslcblas.dll.a+		PATHS  ${GSL_POSSIBLE_ROOT_DIRS}+		PATH_SUFFIXES lib+		DOC "GSL library")+  endif(NOT GSL_GSLCBLAS_LIBRARY)+  +  SET(GSL_LIBRARIES ${GSL_GSL_LIBRARY})++  #MESSAGE("DBG\n"+  #  "GSL_GSL_LIBRARY=${GSL_GSL_LIBRARY}\n"+  #  "GSL_GSLCBLAS_LIBRARY=${GSL_GSLCBLAS_LIBRARY}\n"+  #  "GSL_LIBRARIES=${GSL_LIBRARIES}")+++ELSE(WIN32)+  +  IF(UNIX) +    SET(GSL_CONFIG_PREFER_PATH +      "$ENV{GSL_DIR}/bin"+      "$ENV{GSL_DIR}"+      "$ENV{GSL_HOME}/bin" +      "$ENV{GSL_HOME}" +      CACHE STRING "preferred path to GSL (gsl-config)")+    FIND_PROGRAM(GSL_CONFIG gsl-config+      ${GSL_CONFIG_PREFER_PATH}+      /usr/bin/+      )+    # MESSAGE("DBG GSL_CONFIG ${GSL_CONFIG}")+    +    IF (GSL_CONFIG) +      # set CXXFLAGS to be fed into CXX_FLAGS by the user:+      SET(GSL_CXX_FLAGS "`${GSL_CONFIG} --cflags`")+      +      # set INCLUDE_DIRS to prefix+include+      EXEC_PROGRAM(${GSL_CONFIG}+        ARGS --prefix+        OUTPUT_VARIABLE GSL_PREFIX)+      SET(GSL_INCLUDE_DIR ${GSL_PREFIX}/include CACHE STRING INTERNAL)++      # set link libraries and link flags+      #SET(GSL_LIBRARIES "`${GSL_CONFIG} --libs`")+      EXEC_PROGRAM(${GSL_CONFIG}+        ARGS --libs+        OUTPUT_VARIABLE GSL_LIBRARIES )+        +      # extract link dirs for rpath  +      EXEC_PROGRAM(${GSL_CONFIG}+        ARGS --libs+        OUTPUT_VARIABLE GSL_CONFIG_LIBS )+      +      # extract version+      EXEC_PROGRAM(${GSL_CONFIG}+        ARGS --version+        OUTPUT_VARIABLE GSL_FULL_VERSION )+      +      # split version as major/minor+      STRING(REGEX MATCH "(.)\\..*" GSL_VERSION_MAJOR_ "${GSL_FULL_VERSION}")+      SET(GSL_VERSION_MAJOR ${CMAKE_MATCH_1})+      STRING(REGEX MATCH ".\\.(.*)" GSL_VERSION_MINOR_ "${GSL_FULL_VERSION}")+      SET(GSL_VERSION_MINOR ${CMAKE_MATCH_1})++      # split off the link dirs (for rpath)+      # use regular expression to match wildcard equivalent "-L*<endchar>"+      # with <endchar> is a space or a semicolon+      STRING(REGEX MATCHALL "[-][L]([^ ;])+" +        GSL_LINK_DIRECTORIES_WITH_PREFIX +        "${GSL_CONFIG_LIBS}" )+      #      MESSAGE("DBG  GSL_LINK_DIRECTORIES_WITH_PREFIX=${GSL_LINK_DIRECTORIES_WITH_PREFIX}")++      # remove prefix -L because we need the pure directory for LINK_DIRECTORIES+      +      IF (GSL_LINK_DIRECTORIES_WITH_PREFIX)+        STRING(REGEX REPLACE "[-][L]" "" GSL_LINK_DIRECTORIES ${GSL_LINK_DIRECTORIES_WITH_PREFIX} )+      ENDIF (GSL_LINK_DIRECTORIES_WITH_PREFIX)+      SET(GSL_EXE_LINKER_FLAGS "-Wl,-rpath,${GSL_LINK_DIRECTORIES}" CACHE STRING INTERNAL)+      #      MESSAGE("DBG  GSL_LINK_DIRECTORIES=${GSL_LINK_DIRECTORIES}")+      #      MESSAGE("DBG  GSL_EXE_LINKER_FLAGS=${GSL_EXE_LINKER_FLAGS}")++      #      ADD_DEFINITIONS("-DHAVE_GSL")+      #      SET(GSL_DEFINITIONS "-DHAVE_GSL")+      MARK_AS_ADVANCED(+        GSL_CXX_FLAGS+        GSL_INCLUDE_DIR+        GSL_LIBRARIES+        GSL_LINK_DIRECTORIES+        GSL_DEFINITIONS+        )+      MESSAGE(STATUS "Using GSL from ${GSL_PREFIX}")+      +    ELSE(GSL_CONFIG)+      MESSAGE("FindGSL.cmake: gsl-config not found. Please set it manually. GSL_CONFIG=${GSL_CONFIG}")+    ENDIF(GSL_CONFIG)++  ENDIF(UNIX)+ENDIF(WIN32)+++IF(GSL_LIBRARIES)+  IF(GSL_INCLUDE_DIR OR GSL_CXX_FLAGS)++    SET(GSL_FOUND 1)+    +  ENDIF(GSL_INCLUDE_DIR OR GSL_CXX_FLAGS)+ENDIF(GSL_LIBRARIES)
+ eigen3/cmake/FindGoogleHash.cmake view
@@ -0,0 +1,23 @@++if (GOOGLEHASH_INCLUDES AND GOOGLEHASH_LIBRARIES)+  set(GOOGLEHASH_FIND_QUIETLY TRUE)+endif (GOOGLEHASH_INCLUDES AND GOOGLEHASH_LIBRARIES)++find_path(GOOGLEHASH_INCLUDES+  NAMES+  google/dense_hash_map+  PATHS+  ${INCLUDE_INSTALL_DIR}+)++if(GOOGLEHASH_INCLUDES)+  # let's make sure it compiles with the current compiler+  file(WRITE ${CMAKE_BINARY_DIR}/googlehash_test.cpp+  "#include <google/sparse_hash_map>\n#include <google/dense_hash_map>\nint main(int argc, char** argv) { google::dense_hash_map<int,float> a; google::sparse_hash_map<int,float> b; return 0;}\n")+  try_compile(GOOGLEHASH_COMPILE ${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}/googlehash_test.cpp OUTPUT_VARIABLE GOOGLEHASH_COMPILE_RESULT)+endif(GOOGLEHASH_INCLUDES)++include(FindPackageHandleStandardArgs)+find_package_handle_standard_args(GOOGLEHASH DEFAULT_MSG GOOGLEHASH_INCLUDES GOOGLEHASH_COMPILE)++mark_as_advanced(GOOGLEHASH_INCLUDES)
+ eigen3/cmake/FindHWLOC.cmake view
@@ -0,0 +1,331 @@+###+#+# @copyright (c) 2009-2014 The University of Tennessee and The University+#                          of Tennessee Research Foundation.+#                          All rights reserved.+# @copyright (c) 2012-2014 Inria. All rights reserved.+# @copyright (c) 2012-2014 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, Univ. Bordeaux. All rights reserved.+#+###+#+# - Find HWLOC include dirs and libraries+# Use this module by invoking find_package with the form:+#  find_package(HWLOC+#               [REQUIRED]) # Fail with error if hwloc is not found+#+# This module finds headers and hwloc library.+# Results are reported in variables:+#  HWLOC_FOUND           - True if headers and requested libraries were found+#  HWLOC_INCLUDE_DIRS    - hwloc include directories+#  HWLOC_LIBRARY_DIRS    - Link directories for hwloc libraries+#  HWLOC_LIBRARIES       - hwloc component libraries to be linked+#+# The user can give specific paths where to find the libraries adding cmake+# options at configure (ex: cmake path/to/project -DHWLOC_DIR=path/to/hwloc):+#  HWLOC_DIR             - Where to find the base directory of hwloc+#  HWLOC_INCDIR          - Where to find the header files+#  HWLOC_LIBDIR          - Where to find the library files+# The module can also look for the following environment variables if paths+# are not given as cmake variable: HWLOC_DIR, HWLOC_INCDIR, HWLOC_LIBDIR++#=============================================================================+# Copyright 2012-2013 Inria+# Copyright 2012-2013 Emmanuel Agullo+# Copyright 2012-2013 Mathieu Faverge+# Copyright 2012      Cedric Castagnede+# Copyright 2013      Florent Pruvost+#+# Distributed under the OSI-approved BSD License (the "License");+# see accompanying file MORSE-Copyright.txt for details.+#+# This software is distributed WITHOUT ANY WARRANTY; without even the+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.+# See the License for more information.+#=============================================================================+# (To distribute this file outside of Morse, substitute the full+#  License text for the above reference.)++include(CheckStructHasMember)+include(CheckCSourceCompiles)++if (NOT HWLOC_FOUND)+  set(HWLOC_DIR "" CACHE PATH "Installation directory of HWLOC library")+  if (NOT HWLOC_FIND_QUIETLY)+    message(STATUS "A cache variable, namely HWLOC_DIR, has been set to specify the install directory of HWLOC")+  endif()+endif()++set(ENV_HWLOC_DIR "$ENV{HWLOC_DIR}")+set(ENV_HWLOC_INCDIR "$ENV{HWLOC_INCDIR}")+set(ENV_HWLOC_LIBDIR "$ENV{HWLOC_LIBDIR}")+set(HWLOC_GIVEN_BY_USER "FALSE")+if ( HWLOC_DIR OR ( HWLOC_INCDIR AND HWLOC_LIBDIR) OR ENV_HWLOC_DIR OR (ENV_HWLOC_INCDIR AND ENV_HWLOC_LIBDIR) )+  set(HWLOC_GIVEN_BY_USER "TRUE")+endif()++# Optionally use pkg-config to detect include/library dirs (if pkg-config is available)+# -------------------------------------------------------------------------------------+include(FindPkgConfig)+find_package(PkgConfig QUIET)+if( PKG_CONFIG_EXECUTABLE AND NOT HWLOC_GIVEN_BY_USER )++  pkg_search_module(HWLOC hwloc)+  if (NOT HWLOC_FIND_QUIETLY)+    if (HWLOC_FOUND AND HWLOC_LIBRARIES)+      message(STATUS "Looking for HWLOC - found using PkgConfig")+      #if(NOT HWLOC_INCLUDE_DIRS)+      #    message("${Magenta}HWLOC_INCLUDE_DIRS is empty using PkgConfig."+      #        "Perhaps the path to hwloc headers is already present in your"+      #        "C(PLUS)_INCLUDE_PATH environment variable.${ColourReset}")+      #endif()+    else()+      message(STATUS "${Magenta}Looking for HWLOC - not found using PkgConfig."+	"\n   Perhaps you should add the directory containing hwloc.pc to"+	"\n   the PKG_CONFIG_PATH environment variable.${ColourReset}")+    endif()+  endif()++endif( PKG_CONFIG_EXECUTABLE AND NOT HWLOC_GIVEN_BY_USER )++if( (NOT PKG_CONFIG_EXECUTABLE) OR (PKG_CONFIG_EXECUTABLE AND NOT HWLOC_FOUND) OR (HWLOC_GIVEN_BY_USER) )++  if (NOT HWLOC_FIND_QUIETLY)+    message(STATUS "Looking for HWLOC - PkgConfig not used")+  endif()++  # Looking for include+  # -------------------++  # Add system include paths to search include+  # ------------------------------------------+  unset(_inc_env)+  if(ENV_HWLOC_INCDIR)+    list(APPEND _inc_env "${ENV_HWLOC_INCDIR}")+  elseif(ENV_HWLOC_DIR)+    list(APPEND _inc_env "${ENV_HWLOC_DIR}")+    list(APPEND _inc_env "${ENV_HWLOC_DIR}/include")+    list(APPEND _inc_env "${ENV_HWLOC_DIR}/include/hwloc")+  else()+    if(WIN32)+      string(REPLACE ":" ";" _inc_env "$ENV{INCLUDE}")+    else()+      string(REPLACE ":" ";" _path_env "$ENV{INCLUDE}")+      list(APPEND _inc_env "${_path_env}")+      string(REPLACE ":" ";" _path_env "$ENV{C_INCLUDE_PATH}")+      list(APPEND _inc_env "${_path_env}")+      string(REPLACE ":" ";" _path_env "$ENV{CPATH}")+      list(APPEND _inc_env "${_path_env}")+      string(REPLACE ":" ";" _path_env "$ENV{INCLUDE_PATH}")+      list(APPEND _inc_env "${_path_env}")+    endif()+  endif()+  list(APPEND _inc_env "${CMAKE_PLATFORM_IMPLICIT_INCLUDE_DIRECTORIES}")+  list(APPEND _inc_env "${CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES}")+  list(REMOVE_DUPLICATES _inc_env)++  # set paths where to look for+  set(PATH_TO_LOOK_FOR "${_inc_env}")++  # Try to find the hwloc header in the given paths+  # -------------------------------------------------+  # call cmake macro to find the header path+  if(HWLOC_INCDIR)+    set(HWLOC_hwloc.h_DIRS "HWLOC_hwloc.h_DIRS-NOTFOUND")+    find_path(HWLOC_hwloc.h_DIRS+      NAMES hwloc.h+      HINTS ${HWLOC_INCDIR})+  else()+    if(HWLOC_DIR)+      set(HWLOC_hwloc.h_DIRS "HWLOC_hwloc.h_DIRS-NOTFOUND")+      find_path(HWLOC_hwloc.h_DIRS+	NAMES hwloc.h+	HINTS ${HWLOC_DIR}+	PATH_SUFFIXES "include" "include/hwloc")+    else()+      set(HWLOC_hwloc.h_DIRS "HWLOC_hwloc.h_DIRS-NOTFOUND")+      find_path(HWLOC_hwloc.h_DIRS+	NAMES hwloc.h+	HINTS ${PATH_TO_LOOK_FOR}+	PATH_SUFFIXES "hwloc")+    endif()+  endif()+  mark_as_advanced(HWLOC_hwloc.h_DIRS)++  # Add path to cmake variable+  # ------------------------------------+  if (HWLOC_hwloc.h_DIRS)+    set(HWLOC_INCLUDE_DIRS "${HWLOC_hwloc.h_DIRS}")+  else ()+    set(HWLOC_INCLUDE_DIRS "HWLOC_INCLUDE_DIRS-NOTFOUND")+    if(NOT HWLOC_FIND_QUIETLY)+      message(STATUS "Looking for hwloc -- hwloc.h not found")+    endif()+  endif ()++  if (HWLOC_INCLUDE_DIRS)+    list(REMOVE_DUPLICATES HWLOC_INCLUDE_DIRS)+  endif ()+++  # Looking for lib+  # ---------------++  # Add system library paths to search lib+  # --------------------------------------+  unset(_lib_env)+  if(ENV_HWLOC_LIBDIR)+    list(APPEND _lib_env "${ENV_HWLOC_LIBDIR}")+  elseif(ENV_HWLOC_DIR)+    list(APPEND _lib_env "${ENV_HWLOC_DIR}")+    list(APPEND _lib_env "${ENV_HWLOC_DIR}/lib")+  else()+    if(WIN32)+      string(REPLACE ":" ";" _lib_env "$ENV{LIB}")+    else()+      if(APPLE)+	string(REPLACE ":" ";" _lib_env "$ENV{DYLD_LIBRARY_PATH}")+      else()+	string(REPLACE ":" ";" _lib_env "$ENV{LD_LIBRARY_PATH}")+      endif()+      list(APPEND _lib_env "${CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES}")+      list(APPEND _lib_env "${CMAKE_C_IMPLICIT_LINK_DIRECTORIES}")+    endif()+  endif()+  list(REMOVE_DUPLICATES _lib_env)++  # set paths where to look for+  set(PATH_TO_LOOK_FOR "${_lib_env}")++  # Try to find the hwloc lib in the given paths+  # ----------------------------------------------++  # call cmake macro to find the lib path+  if(HWLOC_LIBDIR)+    set(HWLOC_hwloc_LIBRARY "HWLOC_hwloc_LIBRARY-NOTFOUND")+    find_library(HWLOC_hwloc_LIBRARY+      NAMES hwloc+      HINTS ${HWLOC_LIBDIR})+  else()+    if(HWLOC_DIR)+      set(HWLOC_hwloc_LIBRARY "HWLOC_hwloc_LIBRARY-NOTFOUND")+      find_library(HWLOC_hwloc_LIBRARY+	NAMES hwloc+	HINTS ${HWLOC_DIR}+	PATH_SUFFIXES lib lib32 lib64)+    else()+      set(HWLOC_hwloc_LIBRARY "HWLOC_hwloc_LIBRARY-NOTFOUND")+      find_library(HWLOC_hwloc_LIBRARY+	NAMES hwloc+	HINTS ${PATH_TO_LOOK_FOR})+    endif()+  endif()+  mark_as_advanced(HWLOC_hwloc_LIBRARY)++  # If found, add path to cmake variable+  # ------------------------------------+  if (HWLOC_hwloc_LIBRARY)+    get_filename_component(hwloc_lib_path ${HWLOC_hwloc_LIBRARY} PATH)+    # set cmake variables (respects naming convention)+    set(HWLOC_LIBRARIES    "${HWLOC_hwloc_LIBRARY}")+    set(HWLOC_LIBRARY_DIRS "${hwloc_lib_path}")+  else ()+    set(HWLOC_LIBRARIES    "HWLOC_LIBRARIES-NOTFOUND")+    set(HWLOC_LIBRARY_DIRS "HWLOC_LIBRARY_DIRS-NOTFOUND")+    if(NOT HWLOC_FIND_QUIETLY)+      message(STATUS "Looking for hwloc -- lib hwloc not found")+    endif()+  endif ()++  if (HWLOC_LIBRARY_DIRS)+    list(REMOVE_DUPLICATES HWLOC_LIBRARY_DIRS)+  endif ()++  # check a function to validate the find+  if(HWLOC_LIBRARIES)++    set(REQUIRED_INCDIRS)+    set(REQUIRED_LIBDIRS)+    set(REQUIRED_LIBS)++    # HWLOC+    if (HWLOC_INCLUDE_DIRS)+      set(REQUIRED_INCDIRS "${HWLOC_INCLUDE_DIRS}")+    endif()+    if (HWLOC_LIBRARY_DIRS)+      set(REQUIRED_LIBDIRS "${HWLOC_LIBRARY_DIRS}")+    endif()+    set(REQUIRED_LIBS "${HWLOC_LIBRARIES}")++    # set required libraries for link+    set(CMAKE_REQUIRED_INCLUDES "${REQUIRED_INCDIRS}")+    set(CMAKE_REQUIRED_LIBRARIES)+    foreach(lib_dir ${REQUIRED_LIBDIRS})+      list(APPEND CMAKE_REQUIRED_LIBRARIES "-L${lib_dir}")+    endforeach()+    list(APPEND CMAKE_REQUIRED_LIBRARIES "${REQUIRED_LIBS}")+    string(REGEX REPLACE "^ -" "-" CMAKE_REQUIRED_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES}")++    # test link+    unset(HWLOC_WORKS CACHE)+    include(CheckFunctionExists)+    check_function_exists(hwloc_topology_init HWLOC_WORKS)+    mark_as_advanced(HWLOC_WORKS)++    if(NOT HWLOC_WORKS)+      if(NOT HWLOC_FIND_QUIETLY)+	message(STATUS "Looking for hwloc : test of hwloc_topology_init with hwloc library fails")+	message(STATUS "CMAKE_REQUIRED_LIBRARIES: ${CMAKE_REQUIRED_LIBRARIES}")+	message(STATUS "CMAKE_REQUIRED_INCLUDES: ${CMAKE_REQUIRED_INCLUDES}")+	message(STATUS "Check in CMakeFiles/CMakeError.log to figure out why it fails")+      endif()+    endif()+    set(CMAKE_REQUIRED_INCLUDES)+    set(CMAKE_REQUIRED_FLAGS)+    set(CMAKE_REQUIRED_LIBRARIES)+  endif(HWLOC_LIBRARIES)++endif( (NOT PKG_CONFIG_EXECUTABLE) OR (PKG_CONFIG_EXECUTABLE AND NOT HWLOC_FOUND) OR (HWLOC_GIVEN_BY_USER) )++if (HWLOC_LIBRARIES)+  if (HWLOC_LIBRARY_DIRS)+    list(GET HWLOC_LIBRARY_DIRS 0 first_lib_path)+  else()+    list(GET HWLOC_LIBRARIES 0 first_lib)+    get_filename_component(first_lib_path "${first_lib}" PATH)+  endif()+  if (${first_lib_path} MATCHES "/lib(32|64)?$")+    string(REGEX REPLACE "/lib(32|64)?$" "" not_cached_dir "${first_lib_path}")+    set(HWLOC_DIR_FOUND "${not_cached_dir}" CACHE PATH "Installation directory of HWLOC library" FORCE)+  else()+    set(HWLOC_DIR_FOUND "${first_lib_path}" CACHE PATH "Installation directory of HWLOC library" FORCE)+  endif()+endif()+mark_as_advanced(HWLOC_DIR)+mark_as_advanced(HWLOC_DIR_FOUND)++# check that HWLOC has been found+# -------------------------------+include(FindPackageHandleStandardArgs)+if (PKG_CONFIG_EXECUTABLE AND HWLOC_FOUND)+  find_package_handle_standard_args(HWLOC DEFAULT_MSG+    HWLOC_LIBRARIES)+else()+  find_package_handle_standard_args(HWLOC DEFAULT_MSG+    HWLOC_LIBRARIES+    HWLOC_WORKS)+endif()++if (HWLOC_FOUND)+  set(HWLOC_SAVE_CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES})+  list(APPEND CMAKE_REQUIRED_INCLUDES ${HWLOC_INCLUDE_DIRS})++  # test headers to guess the version+  check_struct_has_member( "struct hwloc_obj" parent hwloc.h HAVE_HWLOC_PARENT_MEMBER )+  check_struct_has_member( "struct hwloc_cache_attr_s" size hwloc.h HAVE_HWLOC_CACHE_ATTR )+  check_c_source_compiles( "#include <hwloc.h>+	    int main(void) { hwloc_obj_t o; o->type = HWLOC_OBJ_PU; return 0;}" HAVE_HWLOC_OBJ_PU)+  include(CheckLibraryExists)+  check_library_exists(${HWLOC_LIBRARIES} hwloc_bitmap_free "" HAVE_HWLOC_BITMAP)++  set(CMAKE_REQUIRED_INCLUDES ${HWLOC_SAVE_CMAKE_REQUIRED_INCLUDES})+endif()
+ eigen3/cmake/FindLAPACK.cmake view
@@ -0,0 +1,273 @@+# Find LAPACK library+#+# This module finds an installed library that implements the LAPACK+# linear-algebra interface (see http://www.netlib.org/lapack/).+# The approach follows mostly that taken for the autoconf macro file, acx_lapack.m4+# (distributed at http://ac-archive.sourceforge.net/ac-archive/acx_lapack.html).+#+# This module sets the following variables:+#  LAPACK_FOUND - set to true if a library implementing the LAPACK interface+#    is found+#  LAPACK_INCLUDE_DIR - Directories containing the LAPACK header files+#  LAPACK_DEFINITIONS - Compilation options to use LAPACK+#  LAPACK_LINKER_FLAGS - Linker flags to use LAPACK (excluding -l+#    and -L).+#  LAPACK_LIBRARIES_DIR - Directories containing the LAPACK libraries.+#     May be null if LAPACK_LIBRARIES contains libraries name using full path.+#  LAPACK_LIBRARIES - List of libraries to link against LAPACK interface.+#     May be null if the compiler supports auto-link (e.g. VC++).+#  LAPACK_USE_FILE - The name of the cmake module to include to compile+#     applications or libraries using LAPACK.+#+# This module was modified by CGAL team:+# - find libraries for a C++ compiler, instead of Fortran+# - added LAPACK_INCLUDE_DIR, LAPACK_DEFINITIONS and LAPACK_LIBRARIES_DIR+# - removed LAPACK95_LIBRARIES+++include(CheckFunctionExists)++# This macro checks for the existence of the combination of fortran libraries+# given by _list.  If the combination is found, this macro checks (using the+# check_function_exists macro) whether can link against that library+# combination using the name of a routine given by _name using the linker+# flags given by _flags.  If the combination of libraries is found and passes+# the link test, LIBRARIES is set to the list of complete library paths that+# have been found and DEFINITIONS to the required definitions.+# Otherwise, LIBRARIES is set to FALSE.+# N.B. _prefix is the prefix applied to the names of all cached variables that+# are generated internally and marked advanced by this macro.+macro(check_lapack_libraries DEFINITIONS LIBRARIES _prefix _name _flags _list _blas _path)+  #message("DEBUG: check_lapack_libraries(${_list} in ${_path} with ${_blas})")++  # Check for the existence of the libraries given by _list+  set(_libraries_found TRUE)+  set(_libraries_work FALSE)+  set(${DEFINITIONS} "")+  set(${LIBRARIES} "")+  set(_combined_name)+  foreach(_library ${_list})+    set(_combined_name ${_combined_name}_${_library})++    if(_libraries_found)+      # search first in ${_path}+      find_library(${_prefix}_${_library}_LIBRARY+                  NAMES ${_library}+                  PATHS ${_path} NO_DEFAULT_PATH+                  )+      # if not found, search in environment variables and system+      if ( WIN32 )+        find_library(${_prefix}_${_library}_LIBRARY+                    NAMES ${_library}+                    PATHS ENV LIB+                    )+      elseif ( APPLE )+        find_library(${_prefix}_${_library}_LIBRARY+                    NAMES ${_library}+                    PATHS /usr/local/lib /usr/lib /usr/local/lib64 /usr/lib64 ENV DYLD_LIBRARY_PATH+                    )+      else ()+        find_library(${_prefix}_${_library}_LIBRARY+                    NAMES ${_library}+                    PATHS /usr/local/lib /usr/lib /usr/local/lib64 /usr/lib64 ENV LD_LIBRARY_PATH+                    )+      endif()+      mark_as_advanced(${_prefix}_${_library}_LIBRARY)+      set(${LIBRARIES} ${${LIBRARIES}} ${${_prefix}_${_library}_LIBRARY})+      set(_libraries_found ${${_prefix}_${_library}_LIBRARY})+    endif(_libraries_found)+  endforeach(_library ${_list})+  if(_libraries_found)+    set(_libraries_found ${${LIBRARIES}})+  endif()++  # Test this combination of libraries with the Fortran/f2c interface.+  # We test the Fortran interface first as it is well standardized.+  if(_libraries_found AND NOT _libraries_work)+    set(${DEFINITIONS}  "-D${_prefix}_USE_F2C")+    set(${LIBRARIES}    ${_libraries_found})+    # Some C++ linkers require the f2c library to link with Fortran libraries.+    # I do not know which ones, thus I just add the f2c library if it is available.+    find_package( F2C QUIET )+    if ( F2C_FOUND )+      set(${DEFINITIONS}  ${${DEFINITIONS}} ${F2C_DEFINITIONS})+      set(${LIBRARIES}    ${${LIBRARIES}} ${F2C_LIBRARIES})+    endif()+    set(CMAKE_REQUIRED_DEFINITIONS  ${${DEFINITIONS}})+    set(CMAKE_REQUIRED_LIBRARIES    ${_flags} ${${LIBRARIES}} ${_blas})+    #message("DEBUG: CMAKE_REQUIRED_DEFINITIONS = ${CMAKE_REQUIRED_DEFINITIONS}")+    #message("DEBUG: CMAKE_REQUIRED_LIBRARIES = ${CMAKE_REQUIRED_LIBRARIES}")+    # Check if function exists with f2c calling convention (ie a trailing underscore)+    check_function_exists(${_name}_ ${_prefix}_${_name}_${_combined_name}_f2c_WORKS)+    set(CMAKE_REQUIRED_DEFINITIONS} "")+    set(CMAKE_REQUIRED_LIBRARIES    "")+    mark_as_advanced(${_prefix}_${_name}_${_combined_name}_f2c_WORKS)+    set(_libraries_work ${${_prefix}_${_name}_${_combined_name}_f2c_WORKS})+  endif(_libraries_found AND NOT _libraries_work)++  # If not found, test this combination of libraries with a C interface.+  # A few implementations (ie ACML) provide a C interface. Unfortunately, there is no standard.+  if(_libraries_found AND NOT _libraries_work)+    set(${DEFINITIONS} "")+    set(${LIBRARIES}   ${_libraries_found})+    set(CMAKE_REQUIRED_DEFINITIONS "")+    set(CMAKE_REQUIRED_LIBRARIES   ${_flags} ${${LIBRARIES}} ${_blas})+    #message("DEBUG: CMAKE_REQUIRED_LIBRARIES = ${CMAKE_REQUIRED_LIBRARIES}")+    check_function_exists(${_name} ${_prefix}_${_name}${_combined_name}_WORKS)+    set(CMAKE_REQUIRED_LIBRARIES "")+    mark_as_advanced(${_prefix}_${_name}${_combined_name}_WORKS)+    set(_libraries_work ${${_prefix}_${_name}${_combined_name}_WORKS})+  endif(_libraries_found AND NOT _libraries_work)++  # on failure+  if(NOT _libraries_work)+    set(${DEFINITIONS} "")+    set(${LIBRARIES}   FALSE)+  endif()+  #message("DEBUG: ${DEFINITIONS} = ${${DEFINITIONS}}")+  #message("DEBUG: ${LIBRARIES} = ${${LIBRARIES}}")+endmacro(check_lapack_libraries)+++#+# main+#++# LAPACK requires BLAS+if(LAPACK_FIND_QUIETLY OR NOT LAPACK_FIND_REQUIRED)+  find_package(BLAS)+else()+  find_package(BLAS REQUIRED)+endif()++if (NOT BLAS_FOUND)++  message(STATUS "LAPACK requires BLAS.")+  set(LAPACK_FOUND FALSE)++# Is it already configured?+elseif (LAPACK_LIBRARIES_DIR OR LAPACK_LIBRARIES)++  set(LAPACK_FOUND TRUE)++else()++  # reset variables+  set( LAPACK_INCLUDE_DIR "" )+  set( LAPACK_DEFINITIONS "" )+  set( LAPACK_LINKER_FLAGS "" ) # unused (yet)+  set( LAPACK_LIBRARIES "" )+  set( LAPACK_LIBRARIES_DIR "" )++    #+    # If Unix, search for LAPACK function in possible libraries+    #++    #intel mkl lapack?+    if(NOT LAPACK_LIBRARIES)+      check_lapack_libraries(+      LAPACK_DEFINITIONS+      LAPACK_LIBRARIES+      LAPACK+      cheev+      ""+      "mkl_lapack"+      "${BLAS_LIBRARIES}"+      "${CGAL_TAUCS_LIBRARIES_DIR} ENV LAPACK_LIB_DIR"+      )+    endif()++    #acml lapack?+    if(NOT LAPACK_LIBRARIES)+      check_lapack_libraries(+      LAPACK_DEFINITIONS+      LAPACK_LIBRARIES+      LAPACK+      cheev+      ""+      "acml"+      "${BLAS_LIBRARIES}"+      "${CGAL_TAUCS_LIBRARIES_DIR} ENV LAPACK_LIB_DIR"+      )+    endif()++    # Apple LAPACK library?+    if(NOT LAPACK_LIBRARIES)+      check_lapack_libraries(+      LAPACK_DEFINITIONS+      LAPACK_LIBRARIES+      LAPACK+      cheev+      ""+      "Accelerate"+      "${BLAS_LIBRARIES}"+      "${CGAL_TAUCS_LIBRARIES_DIR} ENV LAPACK_LIB_DIR"+      )+    endif()++    if ( NOT LAPACK_LIBRARIES )+      check_lapack_libraries(+      LAPACK_DEFINITIONS+      LAPACK_LIBRARIES+      LAPACK+      cheev+      ""+      "vecLib"+      "${BLAS_LIBRARIES}"+      "${CGAL_TAUCS_LIBRARIES_DIR} ENV LAPACK_LIB_DIR"+      )+    endif ( NOT LAPACK_LIBRARIES )++    # Generic LAPACK library?+    # This configuration *must* be the last try as this library is notably slow.+    if ( NOT LAPACK_LIBRARIES )+      check_lapack_libraries(+      LAPACK_DEFINITIONS+      LAPACK_LIBRARIES+      LAPACK+      cheev+      ""+      "lapack"+      "${BLAS_LIBRARIES}"+      "${CGAL_TAUCS_LIBRARIES_DIR} ENV LAPACK_LIB_DIR"+      )+    endif()++  if(LAPACK_LIBRARIES_DIR OR LAPACK_LIBRARIES)+    set(LAPACK_FOUND TRUE)+  else()+    set(LAPACK_FOUND FALSE)+  endif()++  if(NOT LAPACK_FIND_QUIETLY)+    if(LAPACK_FOUND)+      message(STATUS "A library with LAPACK API found.")+    else(LAPACK_FOUND)+      if(LAPACK_FIND_REQUIRED)+        message(FATAL_ERROR "A required library with LAPACK API not found. Please specify library location.")+      else()+        message(STATUS "A library with LAPACK API not found. Please specify library location.")+      endif()+    endif(LAPACK_FOUND)+  endif(NOT LAPACK_FIND_QUIETLY)++  # Add variables to cache+  set( LAPACK_INCLUDE_DIR   "${LAPACK_INCLUDE_DIR}"+                            CACHE PATH "Directories containing the LAPACK header files" FORCE )+  set( LAPACK_DEFINITIONS   "${LAPACK_DEFINITIONS}"+                            CACHE STRING "Compilation options to use LAPACK" FORCE )+  set( LAPACK_LINKER_FLAGS  "${LAPACK_LINKER_FLAGS}"+                            CACHE STRING "Linker flags to use LAPACK" FORCE )+  set( LAPACK_LIBRARIES     "${LAPACK_LIBRARIES}"+                            CACHE FILEPATH "LAPACK libraries name" FORCE )+  set( LAPACK_LIBRARIES_DIR "${LAPACK_LIBRARIES_DIR}"+                            CACHE PATH "Directories containing the LAPACK libraries" FORCE )++  #message("DEBUG: LAPACK_INCLUDE_DIR = ${LAPACK_INCLUDE_DIR}")+  #message("DEBUG: LAPACK_DEFINITIONS = ${LAPACK_DEFINITIONS}")+  #message("DEBUG: LAPACK_LINKER_FLAGS = ${LAPACK_LINKER_FLAGS}")+  #message("DEBUG: LAPACK_LIBRARIES = ${LAPACK_LIBRARIES}")+  #message("DEBUG: LAPACK_LIBRARIES_DIR = ${LAPACK_LIBRARIES_DIR}")+  #message("DEBUG: LAPACK_FOUND = ${LAPACK_FOUND}")++endif(NOT BLAS_FOUND)
+ eigen3/cmake/FindMPFR.cmake view
@@ -0,0 +1,83 @@+# Try to find the MPFR library+# See http://www.mpfr.org/+#+# This module supports requiring a minimum version, e.g. you can do+#   find_package(MPFR 2.3.0)+# to require version 2.3.0 to newer of MPFR.+#+# Once done this will define+#+#  MPFR_FOUND - system has MPFR lib with correct version+#  MPFR_INCLUDES - the MPFR include directory+#  MPFR_LIBRARIES - the MPFR library+#  MPFR_VERSION - MPFR version++# Copyright (c) 2006, 2007 Montel Laurent, <montel@kde.org>+# Copyright (c) 2008, 2009 Gael Guennebaud, <g.gael@free.fr>+# Copyright (c) 2010 Jitse Niesen, <jitse@maths.leeds.ac.uk>+# Redistribution and use is allowed according to the terms of the BSD license.++# Set MPFR_INCLUDES++find_path(MPFR_INCLUDES+  NAMES+  mpfr.h+  PATHS+  $ENV{GMPDIR}+  ${INCLUDE_INSTALL_DIR}+)++# Set MPFR_FIND_VERSION to 1.0.0 if no minimum version is specified++if(NOT MPFR_FIND_VERSION)+  if(NOT MPFR_FIND_VERSION_MAJOR)+    set(MPFR_FIND_VERSION_MAJOR 1)+  endif(NOT MPFR_FIND_VERSION_MAJOR)+  if(NOT MPFR_FIND_VERSION_MINOR)+    set(MPFR_FIND_VERSION_MINOR 0)+  endif(NOT MPFR_FIND_VERSION_MINOR)+  if(NOT MPFR_FIND_VERSION_PATCH)+    set(MPFR_FIND_VERSION_PATCH 0)+  endif(NOT MPFR_FIND_VERSION_PATCH)++  set(MPFR_FIND_VERSION "${MPFR_FIND_VERSION_MAJOR}.${MPFR_FIND_VERSION_MINOR}.${MPFR_FIND_VERSION_PATCH}")+endif(NOT MPFR_FIND_VERSION)+++if(MPFR_INCLUDES)++  # Set MPFR_VERSION+  +  file(READ "${MPFR_INCLUDES}/mpfr.h" _mpfr_version_header)+  +  string(REGEX MATCH "define[ \t]+MPFR_VERSION_MAJOR[ \t]+([0-9]+)" _mpfr_major_version_match "${_mpfr_version_header}")+  set(MPFR_MAJOR_VERSION "${CMAKE_MATCH_1}")+  string(REGEX MATCH "define[ \t]+MPFR_VERSION_MINOR[ \t]+([0-9]+)" _mpfr_minor_version_match "${_mpfr_version_header}")+  set(MPFR_MINOR_VERSION "${CMAKE_MATCH_1}")+  string(REGEX MATCH "define[ \t]+MPFR_VERSION_PATCHLEVEL[ \t]+([0-9]+)" _mpfr_patchlevel_version_match "${_mpfr_version_header}")+  set(MPFR_PATCHLEVEL_VERSION "${CMAKE_MATCH_1}")+  +  set(MPFR_VERSION ${MPFR_MAJOR_VERSION}.${MPFR_MINOR_VERSION}.${MPFR_PATCHLEVEL_VERSION})+  +  # Check whether found version exceeds minimum version+  +  if(${MPFR_VERSION} VERSION_LESS ${MPFR_FIND_VERSION})+    set(MPFR_VERSION_OK FALSE)+    message(STATUS "MPFR version ${MPFR_VERSION} found in ${MPFR_INCLUDES}, "+                   "but at least version ${MPFR_FIND_VERSION} is required")+  else(${MPFR_VERSION} VERSION_LESS ${MPFR_FIND_VERSION})+    set(MPFR_VERSION_OK TRUE)+  endif(${MPFR_VERSION} VERSION_LESS ${MPFR_FIND_VERSION})++endif(MPFR_INCLUDES)++# Set MPFR_LIBRARIES++find_library(MPFR_LIBRARIES mpfr PATHS $ENV{GMPDIR} ${LIB_INSTALL_DIR})++# Epilogue++include(FindPackageHandleStandardArgs)+find_package_handle_standard_args(MPFR DEFAULT_MSG+                                  MPFR_INCLUDES MPFR_LIBRARIES MPFR_VERSION_OK)+mark_as_advanced(MPFR_INCLUDES MPFR_LIBRARIES)
+ eigen3/cmake/FindMetis.cmake view
@@ -0,0 +1,264 @@+###+#+# @copyright (c) 2009-2014 The University of Tennessee and The University+#                          of Tennessee Research Foundation.+#                          All rights reserved.+# @copyright (c) 2012-2014 Inria. All rights reserved.+# @copyright (c) 2012-2014 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, Univ. Bordeaux. All rights reserved.+#+###+#+# - Find METIS include dirs and libraries+# Use this module by invoking find_package with the form:+#  find_package(METIS+#               [REQUIRED]             # Fail with error if metis is not found+#              )+#+# This module finds headers and metis library.+# Results are reported in variables:+#  METIS_FOUND           - True if headers and requested libraries were found+#  METIS_INCLUDE_DIRS    - metis include directories+#  METIS_LIBRARY_DIRS    - Link directories for metis libraries+#  METIS_LIBRARIES       - metis component libraries to be linked+#+# The user can give specific paths where to find the libraries adding cmake+# options at configure (ex: cmake path/to/project -DMETIS_DIR=path/to/metis):+#  METIS_DIR             - Where to find the base directory of metis+#  METIS_INCDIR          - Where to find the header files+#  METIS_LIBDIR          - Where to find the library files+# The module can also look for the following environment variables if paths+# are not given as cmake variable: METIS_DIR, METIS_INCDIR, METIS_LIBDIR++#=============================================================================+# Copyright 2012-2013 Inria+# Copyright 2012-2013 Emmanuel Agullo+# Copyright 2012-2013 Mathieu Faverge+# Copyright 2012      Cedric Castagnede+# Copyright 2013      Florent Pruvost+#+# Distributed under the OSI-approved BSD License (the "License");+# see accompanying file MORSE-Copyright.txt for details.+#+# This software is distributed WITHOUT ANY WARRANTY; without even the+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.+# See the License for more information.+#=============================================================================+# (To distribute this file outside of Morse, substitute the full+#  License text for the above reference.)++if (NOT METIS_FOUND)+  set(METIS_DIR "" CACHE PATH "Installation directory of METIS library")+  if (NOT METIS_FIND_QUIETLY)+    message(STATUS "A cache variable, namely METIS_DIR, has been set to specify the install directory of METIS")+  endif()+endif()++# Looking for include+# -------------------++# Add system include paths to search include+# ------------------------------------------+unset(_inc_env)+set(ENV_METIS_DIR "$ENV{METIS_DIR}")+set(ENV_METIS_INCDIR "$ENV{METIS_INCDIR}")+if(ENV_METIS_INCDIR)+  list(APPEND _inc_env "${ENV_METIS_INCDIR}")+elseif(ENV_METIS_DIR)+  list(APPEND _inc_env "${ENV_METIS_DIR}")+  list(APPEND _inc_env "${ENV_METIS_DIR}/include")+  list(APPEND _inc_env "${ENV_METIS_DIR}/include/metis")+else()+  if(WIN32)+    string(REPLACE ":" ";" _inc_env "$ENV{INCLUDE}")+  else()+    string(REPLACE ":" ";" _path_env "$ENV{INCLUDE}")+    list(APPEND _inc_env "${_path_env}")+    string(REPLACE ":" ";" _path_env "$ENV{C_INCLUDE_PATH}")+    list(APPEND _inc_env "${_path_env}")+    string(REPLACE ":" ";" _path_env "$ENV{CPATH}")+    list(APPEND _inc_env "${_path_env}")+    string(REPLACE ":" ";" _path_env "$ENV{INCLUDE_PATH}")+    list(APPEND _inc_env "${_path_env}")+  endif()+endif()+list(APPEND _inc_env "${CMAKE_PLATFORM_IMPLICIT_INCLUDE_DIRECTORIES}")+list(APPEND _inc_env "${CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES}")+list(REMOVE_DUPLICATES _inc_env)+++# Try to find the metis header in the given paths+# -------------------------------------------------+# call cmake macro to find the header path+if(METIS_INCDIR)+  set(METIS_metis.h_DIRS "METIS_metis.h_DIRS-NOTFOUND")+  find_path(METIS_metis.h_DIRS+    NAMES metis.h+    HINTS ${METIS_INCDIR})+else()+  if(METIS_DIR)+    set(METIS_metis.h_DIRS "METIS_metis.h_DIRS-NOTFOUND")+    find_path(METIS_metis.h_DIRS+      NAMES metis.h+      HINTS ${METIS_DIR}+      PATH_SUFFIXES "include" "include/metis")+  else()+    set(METIS_metis.h_DIRS "METIS_metis.h_DIRS-NOTFOUND")+    find_path(METIS_metis.h_DIRS+      NAMES metis.h+      HINTS ${_inc_env})+  endif()+endif()+mark_as_advanced(METIS_metis.h_DIRS)+++# If found, add path to cmake variable+# ------------------------------------+if (METIS_metis.h_DIRS)+  set(METIS_INCLUDE_DIRS "${METIS_metis.h_DIRS}")+else ()+  set(METIS_INCLUDE_DIRS "METIS_INCLUDE_DIRS-NOTFOUND")+  if(NOT METIS_FIND_QUIETLY)+    message(STATUS "Looking for metis -- metis.h not found")+  endif()+endif()+++# Looking for lib+# ---------------++# Add system library paths to search lib+# --------------------------------------+unset(_lib_env)+set(ENV_METIS_LIBDIR "$ENV{METIS_LIBDIR}")+if(ENV_METIS_LIBDIR)+  list(APPEND _lib_env "${ENV_METIS_LIBDIR}")+elseif(ENV_METIS_DIR)+  list(APPEND _lib_env "${ENV_METIS_DIR}")+  list(APPEND _lib_env "${ENV_METIS_DIR}/lib")+else()+  if(WIN32)+    string(REPLACE ":" ";" _lib_env "$ENV{LIB}")+  else()+    if(APPLE)+      string(REPLACE ":" ";" _lib_env "$ENV{DYLD_LIBRARY_PATH}")+    else()+      string(REPLACE ":" ";" _lib_env "$ENV{LD_LIBRARY_PATH}")+    endif()+    list(APPEND _lib_env "${CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES}")+    list(APPEND _lib_env "${CMAKE_C_IMPLICIT_LINK_DIRECTORIES}")+  endif()+endif()+list(REMOVE_DUPLICATES _lib_env)++# Try to find the metis lib in the given paths+# ----------------------------------------------+# call cmake macro to find the lib path+if(METIS_LIBDIR)+  set(METIS_metis_LIBRARY "METIS_metis_LIBRARY-NOTFOUND")+  find_library(METIS_metis_LIBRARY+    NAMES metis+    HINTS ${METIS_LIBDIR})+else()+  if(METIS_DIR)+    set(METIS_metis_LIBRARY "METIS_metis_LIBRARY-NOTFOUND")+    find_library(METIS_metis_LIBRARY+      NAMES metis+      HINTS ${METIS_DIR}+      PATH_SUFFIXES lib lib32 lib64)+  else()+    set(METIS_metis_LIBRARY "METIS_metis_LIBRARY-NOTFOUND")+    find_library(METIS_metis_LIBRARY+      NAMES metis+      HINTS ${_lib_env})+  endif()+endif()+mark_as_advanced(METIS_metis_LIBRARY)+++# If found, add path to cmake variable+# ------------------------------------+if (METIS_metis_LIBRARY)+  get_filename_component(metis_lib_path "${METIS_metis_LIBRARY}" PATH)+  # set cmake variables+  set(METIS_LIBRARIES    "${METIS_metis_LIBRARY}")+  set(METIS_LIBRARY_DIRS "${metis_lib_path}")+else ()+  set(METIS_LIBRARIES    "METIS_LIBRARIES-NOTFOUND")+  set(METIS_LIBRARY_DIRS "METIS_LIBRARY_DIRS-NOTFOUND")+  if(NOT METIS_FIND_QUIETLY)+    message(STATUS "Looking for metis -- lib metis not found")+  endif()+endif ()++# check a function to validate the find+if(METIS_LIBRARIES)++  set(REQUIRED_INCDIRS)+  set(REQUIRED_LIBDIRS)+  set(REQUIRED_LIBS)++  # METIS+  if (METIS_INCLUDE_DIRS)+    set(REQUIRED_INCDIRS  "${METIS_INCLUDE_DIRS}")+  endif()+  if (METIS_LIBRARY_DIRS)+    set(REQUIRED_LIBDIRS "${METIS_LIBRARY_DIRS}")+  endif()+  set(REQUIRED_LIBS "${METIS_LIBRARIES}")+  # m+  find_library(M_LIBRARY NAMES m)+  mark_as_advanced(M_LIBRARY)+  if(M_LIBRARY)+    list(APPEND REQUIRED_LIBS "-lm")+  endif()++  # set required libraries for link+  set(CMAKE_REQUIRED_INCLUDES "${REQUIRED_INCDIRS}")+  set(CMAKE_REQUIRED_LIBRARIES)+  foreach(lib_dir ${REQUIRED_LIBDIRS})+    list(APPEND CMAKE_REQUIRED_LIBRARIES "-L${lib_dir}")+  endforeach()+  list(APPEND CMAKE_REQUIRED_LIBRARIES "${REQUIRED_LIBS}")+  string(REGEX REPLACE "^ -" "-" CMAKE_REQUIRED_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES}")++  # test link+  unset(METIS_WORKS CACHE)+  include(CheckFunctionExists)+  check_function_exists(METIS_NodeND METIS_WORKS)+  mark_as_advanced(METIS_WORKS)++  if(NOT METIS_WORKS)+    if(NOT METIS_FIND_QUIETLY)+      message(STATUS "Looking for METIS : test of METIS_NodeND with METIS library fails")+      message(STATUS "CMAKE_REQUIRED_LIBRARIES: ${CMAKE_REQUIRED_LIBRARIES}")+      message(STATUS "CMAKE_REQUIRED_INCLUDES: ${CMAKE_REQUIRED_INCLUDES}")+      message(STATUS "Check in CMakeFiles/CMakeError.log to figure out why it fails")+    endif()+  endif()+  set(CMAKE_REQUIRED_INCLUDES)+  set(CMAKE_REQUIRED_FLAGS)+  set(CMAKE_REQUIRED_LIBRARIES)+endif(METIS_LIBRARIES)++if (METIS_LIBRARIES)+  list(GET METIS_LIBRARIES 0 first_lib)+  get_filename_component(first_lib_path "${first_lib}" PATH)+  if (${first_lib_path} MATCHES "/lib(32|64)?$")+    string(REGEX REPLACE "/lib(32|64)?$" "" not_cached_dir "${first_lib_path}")+    set(METIS_DIR_FOUND "${not_cached_dir}" CACHE PATH "Installation directory of METIS library" FORCE)+  else()+    set(METIS_DIR_FOUND "${first_lib_path}" CACHE PATH "Installation directory of METIS library" FORCE)+  endif()+endif()+mark_as_advanced(METIS_DIR)+mark_as_advanced(METIS_DIR_FOUND)++# check that METIS has been found+# ---------------------------------+include(FindPackageHandleStandardArgs)+find_package_handle_standard_args(METIS DEFAULT_MSG+  METIS_LIBRARIES+  METIS_WORKS)+#+# TODO: Add possibility to check for specific functions in the library+#
+ eigen3/cmake/FindPTSCOTCH.cmake view
@@ -0,0 +1,423 @@+###+#+# @copyright (c) 2009-2014 The University of Tennessee and The University+#                          of Tennessee Research Foundation.+#                          All rights reserved.+# @copyright (c) 2012-2016 Inria. All rights reserved.+# @copyright (c) 2012-2014 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, Univ. Bordeaux. All rights reserved.+#+###+#+# - Find PTSCOTCH include dirs and libraries+# Use this module by invoking find_package with the form:+#  find_package(PTSCOTCH+#               [REQUIRED]             # Fail with error if ptscotch is not found+#               [COMPONENTS <comp1> <comp2> ...] # dependencies+#              )+#+#  PTSCOTCH depends on the following libraries:+#   - Threads+#   - MPI+#+#  COMPONENTS can be some of the following:+#   - ESMUMPS: to activate detection of PT-Scotch with the esmumps interface+#+# This module finds headers and ptscotch library.+# Results are reported in variables:+#  PTSCOTCH_FOUND            - True if headers and requested libraries were found+#  PTSCOTCH_LINKER_FLAGS     - list of required linker flags (excluding -l and -L)+#  PTSCOTCH_INCLUDE_DIRS     - ptscotch include directories+#  PTSCOTCH_LIBRARY_DIRS     - Link directories for ptscotch libraries+#  PTSCOTCH_LIBRARIES        - ptscotch component libraries to be linked+#  PTSCOTCH_INCLUDE_DIRS_DEP - ptscotch + dependencies include directories+#  PTSCOTCH_LIBRARY_DIRS_DEP - ptscotch + dependencies link directories+#  PTSCOTCH_LIBRARIES_DEP    - ptscotch libraries + dependencies+#  PTSCOTCH_INTSIZE          - Number of octets occupied by a SCOTCH_Num+#+# The user can give specific paths where to find the libraries adding cmake+# options at configure (ex: cmake path/to/project -DPTSCOTCH=path/to/ptscotch):+#  PTSCOTCH_DIR              - Where to find the base directory of ptscotch+#  PTSCOTCH_INCDIR           - Where to find the header files+#  PTSCOTCH_LIBDIR           - Where to find the library files+# The module can also look for the following environment variables if paths+# are not given as cmake variable: PTSCOTCH_DIR, PTSCOTCH_INCDIR, PTSCOTCH_LIBDIR++#=============================================================================+# Copyright 2012-2013 Inria+# Copyright 2012-2013 Emmanuel Agullo+# Copyright 2012-2013 Mathieu Faverge+# Copyright 2012      Cedric Castagnede+# Copyright 2013-2016 Florent Pruvost+#+# Distributed under the OSI-approved BSD License (the "License");+# see accompanying file MORSE-Copyright.txt for details.+#+# This software is distributed WITHOUT ANY WARRANTY; without even the+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.+# See the License for more information.+#=============================================================================+# (To distribute this file outside of Morse, substitute the full+#  License text for the above reference.)++if (NOT PTSCOTCH_FOUND)+  set(PTSCOTCH_DIR "" CACHE PATH "Installation directory of PTSCOTCH library")+  if (NOT PTSCOTCH_FIND_QUIETLY)+    message(STATUS "A cache variable, namely PTSCOTCH_DIR, has been set to specify the install directory of PTSCOTCH")+  endif()+endif()++# Set the version to find+set(PTSCOTCH_LOOK_FOR_ESMUMPS OFF)++if( PTSCOTCH_FIND_COMPONENTS )+  foreach( component ${PTSCOTCH_FIND_COMPONENTS} )+    if (${component} STREQUAL "ESMUMPS")+      # means we look for esmumps library+      set(PTSCOTCH_LOOK_FOR_ESMUMPS ON)+    endif()+  endforeach()+endif()++# PTSCOTCH depends on Threads, try to find it+if (NOT THREADS_FOUND)+  if (PTSCOTCH_FIND_REQUIRED)+    find_package(Threads REQUIRED)+  else()+    find_package(Threads)+  endif()+endif()++# PTSCOTCH depends on MPI, try to find it+if (NOT MPI_FOUND)+  if (PTSCOTCH_FIND_REQUIRED)+    find_package(MPI REQUIRED)+  else()+    find_package(MPI)+  endif()+endif()++# Looking for include+# -------------------++# Add system include paths to search include+# ------------------------------------------+unset(_inc_env)+set(ENV_PTSCOTCH_DIR "$ENV{PTSCOTCH_DIR}")+set(ENV_PTSCOTCH_INCDIR "$ENV{PTSCOTCH_INCDIR}")+if(ENV_PTSCOTCH_INCDIR)+  list(APPEND _inc_env "${ENV_PTSCOTCH_INCDIR}")+elseif(ENV_PTSCOTCH_DIR)+  list(APPEND _inc_env "${ENV_PTSCOTCH_DIR}")+  list(APPEND _inc_env "${ENV_PTSCOTCH_DIR}/include")+  list(APPEND _inc_env "${ENV_PTSCOTCH_DIR}/include/ptscotch")+else()+  if(WIN32)+    string(REPLACE ":" ";" _inc_env "$ENV{INCLUDE}")+  else()+    string(REPLACE ":" ";" _path_env "$ENV{INCLUDE}")+    list(APPEND _inc_env "${_path_env}")+    string(REPLACE ":" ";" _path_env "$ENV{C_INCLUDE_PATH}")+    list(APPEND _inc_env "${_path_env}")+    string(REPLACE ":" ";" _path_env "$ENV{CPATH}")+    list(APPEND _inc_env "${_path_env}")+    string(REPLACE ":" ";" _path_env "$ENV{INCLUDE_PATH}")+    list(APPEND _inc_env "${_path_env}")+  endif()+endif()+list(APPEND _inc_env "${CMAKE_PLATFORM_IMPLICIT_INCLUDE_DIRECTORIES}")+list(APPEND _inc_env "${CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES}")+list(REMOVE_DUPLICATES _inc_env)+++# Try to find the ptscotch header in the given paths+# -------------------------------------------------++set(PTSCOTCH_hdrs_to_find "ptscotch.h;scotch.h")++# call cmake macro to find the header path+if(PTSCOTCH_INCDIR)+  foreach(ptscotch_hdr ${PTSCOTCH_hdrs_to_find})+    set(PTSCOTCH_${ptscotch_hdr}_DIRS "PTSCOTCH_${ptscotch_hdr}_DIRS-NOTFOUND")+    find_path(PTSCOTCH_${ptscotch_hdr}_DIRS+      NAMES ${ptscotch_hdr}+      HINTS ${PTSCOTCH_INCDIR})+    mark_as_advanced(PTSCOTCH_${ptscotch_hdr}_DIRS)+  endforeach()+else()+  if(PTSCOTCH_DIR)+    foreach(ptscotch_hdr ${PTSCOTCH_hdrs_to_find})+      set(PTSCOTCH_${ptscotch_hdr}_DIRS "PTSCOTCH_${ptscotch_hdr}_DIRS-NOTFOUND")+      find_path(PTSCOTCH_${ptscotch_hdr}_DIRS+	NAMES ${ptscotch_hdr}+	HINTS ${PTSCOTCH_DIR}+	PATH_SUFFIXES "include" "include/scotch")+      mark_as_advanced(PTSCOTCH_${ptscotch_hdr}_DIRS)+    endforeach()+  else()+    foreach(ptscotch_hdr ${PTSCOTCH_hdrs_to_find})+      set(PTSCOTCH_${ptscotch_hdr}_DIRS "PTSCOTCH_${ptscotch_hdr}_DIRS-NOTFOUND")+      find_path(PTSCOTCH_${ptscotch_hdr}_DIRS+	NAMES ${ptscotch_hdr}+	HINTS ${_inc_env}+	PATH_SUFFIXES "scotch")+      mark_as_advanced(PTSCOTCH_${ptscotch_hdr}_DIRS)+    endforeach()+  endif()+endif()++# If found, add path to cmake variable+# ------------------------------------+foreach(ptscotch_hdr ${PTSCOTCH_hdrs_to_find})+  if (PTSCOTCH_${ptscotch_hdr}_DIRS)+    list(APPEND PTSCOTCH_INCLUDE_DIRS "${PTSCOTCH_${ptscotch_hdr}_DIRS}")+  else ()+    set(PTSCOTCH_INCLUDE_DIRS "PTSCOTCH_INCLUDE_DIRS-NOTFOUND")+    if (NOT PTSCOTCH_FIND_QUIETLY)+      message(STATUS "Looking for ptscotch -- ${ptscotch_hdr} not found")+    endif()+  endif()+endforeach()+list(REMOVE_DUPLICATES PTSCOTCH_INCLUDE_DIRS)++# Looking for lib+# ---------------++# Add system library paths to search lib+# --------------------------------------+unset(_lib_env)+set(ENV_PTSCOTCH_LIBDIR "$ENV{PTSCOTCH_LIBDIR}")+if(ENV_PTSCOTCH_LIBDIR)+  list(APPEND _lib_env "${ENV_PTSCOTCH_LIBDIR}")+elseif(ENV_PTSCOTCH_DIR)+  list(APPEND _lib_env "${ENV_PTSCOTCH_DIR}")+  list(APPEND _lib_env "${ENV_PTSCOTCH_DIR}/lib")+else()+  if(WIN32)+    string(REPLACE ":" ";" _lib_env "$ENV{LIB}")+  else()+    if(APPLE)+      string(REPLACE ":" ";" _lib_env "$ENV{DYLD_LIBRARY_PATH}")+    else()+      string(REPLACE ":" ";" _lib_env "$ENV{LD_LIBRARY_PATH}")+    endif()+    list(APPEND _lib_env "${CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES}")+    list(APPEND _lib_env "${CMAKE_C_IMPLICIT_LINK_DIRECTORIES}")+  endif()+endif()+list(REMOVE_DUPLICATES _lib_env)++# Try to find the ptscotch lib in the given paths+# ----------------------------------------------++set(PTSCOTCH_libs_to_find "ptscotch;ptscotcherr")+if (PTSCOTCH_LOOK_FOR_ESMUMPS)+  list(INSERT PTSCOTCH_libs_to_find 0 "ptesmumps")+  list(APPEND PTSCOTCH_libs_to_find   "esmumps"  )+endif()+list(APPEND PTSCOTCH_libs_to_find "scotch;scotcherr")++# call cmake macro to find the lib path+if(PTSCOTCH_LIBDIR)+  foreach(ptscotch_lib ${PTSCOTCH_libs_to_find})+    set(PTSCOTCH_${ptscotch_lib}_LIBRARY "PTSCOTCH_${ptscotch_lib}_LIBRARY-NOTFOUND")+    find_library(PTSCOTCH_${ptscotch_lib}_LIBRARY+      NAMES ${ptscotch_lib}+      HINTS ${PTSCOTCH_LIBDIR})+  endforeach()+else()+  if(PTSCOTCH_DIR)+    foreach(ptscotch_lib ${PTSCOTCH_libs_to_find})+      set(PTSCOTCH_${ptscotch_lib}_LIBRARY "PTSCOTCH_${ptscotch_lib}_LIBRARY-NOTFOUND")+      find_library(PTSCOTCH_${ptscotch_lib}_LIBRARY+	NAMES ${ptscotch_lib}+	HINTS ${PTSCOTCH_DIR}+	PATH_SUFFIXES lib lib32 lib64)+    endforeach()+  else()+    foreach(ptscotch_lib ${PTSCOTCH_libs_to_find})+      set(PTSCOTCH_${ptscotch_lib}_LIBRARY "PTSCOTCH_${ptscotch_lib}_LIBRARY-NOTFOUND")+      find_library(PTSCOTCH_${ptscotch_lib}_LIBRARY+	NAMES ${ptscotch_lib}+	HINTS ${_lib_env})+    endforeach()+  endif()+endif()++set(PTSCOTCH_LIBRARIES "")+set(PTSCOTCH_LIBRARY_DIRS "")+# If found, add path to cmake variable+# ------------------------------------+foreach(ptscotch_lib ${PTSCOTCH_libs_to_find})++  if (PTSCOTCH_${ptscotch_lib}_LIBRARY)+    get_filename_component(${ptscotch_lib}_lib_path "${PTSCOTCH_${ptscotch_lib}_LIBRARY}" PATH)+    # set cmake variables+    list(APPEND PTSCOTCH_LIBRARIES "${PTSCOTCH_${ptscotch_lib}_LIBRARY}")+    list(APPEND PTSCOTCH_LIBRARY_DIRS "${${ptscotch_lib}_lib_path}")+  else ()+    list(APPEND PTSCOTCH_LIBRARIES "${PTSCOTCH_${ptscotch_lib}_LIBRARY}")+    if (NOT PTSCOTCH_FIND_QUIETLY)+      message(STATUS "Looking for ptscotch -- lib ${ptscotch_lib} not found")+    endif()+  endif ()++  mark_as_advanced(PTSCOTCH_${ptscotch_lib}_LIBRARY)++endforeach()+list(REMOVE_DUPLICATES PTSCOTCH_LIBRARY_DIRS)++# check a function to validate the find+if(PTSCOTCH_LIBRARIES)++  set(REQUIRED_LDFLAGS)+  set(REQUIRED_INCDIRS)+  set(REQUIRED_LIBDIRS)+  set(REQUIRED_LIBS)++  # PTSCOTCH+  if (PTSCOTCH_INCLUDE_DIRS)+    set(REQUIRED_INCDIRS  "${PTSCOTCH_INCLUDE_DIRS}")+  endif()+  if (PTSCOTCH_LIBRARY_DIRS)+    set(REQUIRED_LIBDIRS "${PTSCOTCH_LIBRARY_DIRS}")+  endif()+  set(REQUIRED_LIBS "${PTSCOTCH_LIBRARIES}")+  # MPI+  if (MPI_FOUND)+    if (MPI_C_INCLUDE_PATH)+      list(APPEND CMAKE_REQUIRED_INCLUDES "${MPI_C_INCLUDE_PATH}")+    endif()+    if (MPI_C_LINK_FLAGS)+      if (${MPI_C_LINK_FLAGS} MATCHES "  -")+	string(REGEX REPLACE " -" "-" MPI_C_LINK_FLAGS ${MPI_C_LINK_FLAGS})+      endif()+      list(APPEND REQUIRED_LDFLAGS "${MPI_C_LINK_FLAGS}")+    endif()+    list(APPEND REQUIRED_LIBS "${MPI_C_LIBRARIES}")+  endif()+  # THREADS+  if(CMAKE_THREAD_LIBS_INIT)+    list(APPEND REQUIRED_LIBS "${CMAKE_THREAD_LIBS_INIT}")+  endif()+  set(Z_LIBRARY "Z_LIBRARY-NOTFOUND")+  find_library(Z_LIBRARY NAMES z)+  mark_as_advanced(Z_LIBRARY)+  if(Z_LIBRARY)+    list(APPEND REQUIRED_LIBS "-lz")+  endif()+  set(M_LIBRARY "M_LIBRARY-NOTFOUND")+  find_library(M_LIBRARY NAMES m)+  mark_as_advanced(M_LIBRARY)+  if(M_LIBRARY)+    list(APPEND REQUIRED_LIBS "-lm")+  endif()+  set(RT_LIBRARY "RT_LIBRARY-NOTFOUND")+  find_library(RT_LIBRARY NAMES rt)+  mark_as_advanced(RT_LIBRARY)+  if(RT_LIBRARY)+    list(APPEND REQUIRED_LIBS "-lrt")+  endif()++  # set required libraries for link+  set(CMAKE_REQUIRED_INCLUDES "${REQUIRED_INCDIRS}")+  set(CMAKE_REQUIRED_LIBRARIES)+  list(APPEND CMAKE_REQUIRED_LIBRARIES "${REQUIRED_LDFLAGS}")+  foreach(lib_dir ${REQUIRED_LIBDIRS})+    list(APPEND CMAKE_REQUIRED_LIBRARIES "-L${lib_dir}")+  endforeach()+  list(APPEND CMAKE_REQUIRED_LIBRARIES "${REQUIRED_LIBS}")+  list(APPEND CMAKE_REQUIRED_FLAGS "${REQUIRED_FLAGS}")+  string(REGEX REPLACE "^ -" "-" CMAKE_REQUIRED_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES}")++  # test link+  unset(PTSCOTCH_WORKS CACHE)+  include(CheckFunctionExists)+  check_function_exists(SCOTCH_dgraphInit PTSCOTCH_WORKS)+  mark_as_advanced(PTSCOTCH_WORKS)++  if(PTSCOTCH_WORKS)+    # save link with dependencies+    set(PTSCOTCH_LIBRARIES_DEP "${REQUIRED_LIBS}")+    set(PTSCOTCH_LIBRARY_DIRS_DEP "${REQUIRED_LIBDIRS}")+    set(PTSCOTCH_INCLUDE_DIRS_DEP "${REQUIRED_INCDIRS}")+    set(PTSCOTCH_LINKER_FLAGS "${REQUIRED_LDFLAGS}")+    list(REMOVE_DUPLICATES PTSCOTCH_LIBRARY_DIRS_DEP)+    list(REMOVE_DUPLICATES PTSCOTCH_INCLUDE_DIRS_DEP)+    list(REMOVE_DUPLICATES PTSCOTCH_LINKER_FLAGS)+  else()+    if(NOT PTSCOTCH_FIND_QUIETLY)+      message(STATUS "Looking for PTSCOTCH : test of SCOTCH_dgraphInit with PTSCOTCH library fails")+      message(STATUS "CMAKE_REQUIRED_LIBRARIES: ${CMAKE_REQUIRED_LIBRARIES}")+      message(STATUS "CMAKE_REQUIRED_INCLUDES: ${CMAKE_REQUIRED_INCLUDES}")+      message(STATUS "Check in CMakeFiles/CMakeError.log to figure out why it fails")+    endif()+  endif()+  set(CMAKE_REQUIRED_INCLUDES)+  set(CMAKE_REQUIRED_FLAGS)+  set(CMAKE_REQUIRED_LIBRARIES)+endif(PTSCOTCH_LIBRARIES)++if (PTSCOTCH_LIBRARIES)+  list(GET PTSCOTCH_LIBRARIES 0 first_lib)+  get_filename_component(first_lib_path "${first_lib}" PATH)+  if (${first_lib_path} MATCHES "/lib(32|64)?$")+    string(REGEX REPLACE "/lib(32|64)?$" "" not_cached_dir "${first_lib_path}")+    set(PTSCOTCH_DIR_FOUND "${not_cached_dir}" CACHE PATH "Installation directory of PTSCOTCH library" FORCE)+  else()+    set(PTSCOTCH_DIR_FOUND "${first_lib_path}" CACHE PATH "Installation directory of PTSCOTCH library" FORCE)+  endif()+endif()+mark_as_advanced(PTSCOTCH_DIR)+mark_as_advanced(PTSCOTCH_DIR_FOUND)++# Check the size of SCOTCH_Num+# ---------------------------------+set(CMAKE_REQUIRED_INCLUDES ${PTSCOTCH_INCLUDE_DIRS})++include(CheckCSourceRuns)+#stdio.h and stdint.h should be included by scotch.h directly+set(PTSCOTCH_C_TEST_SCOTCH_Num_4 "+#include <stdio.h>+#include <stdint.h>+#include <ptscotch.h>+int main(int argc, char **argv) {+  if (sizeof(SCOTCH_Num) == 4)+    return 0;+  else+    return 1;+}+")++set(PTSCOTCH_C_TEST_SCOTCH_Num_8 "+#include <stdio.h>+#include <stdint.h>+#include <ptscotch.h>+int main(int argc, char **argv) {+  if (sizeof(SCOTCH_Num) == 8)+    return 0;+  else+    return 1;+}+")+check_c_source_runs("${PTSCOTCH_C_TEST_SCOTCH_Num_4}" PTSCOTCH_Num_4)+if(NOT PTSCOTCH_Num_4)+  check_c_source_runs("${PTSCOTCH_C_TEST_SCOTCH_Num_8}" PTSCOTCH_Num_8)+  if(NOT PTSCOTCH_Num_8)+    set(PTSCOTCH_INTSIZE -1)+  else()+    set(PTSCOTCH_INTSIZE 8)+  endif()+else()+  set(PTSCOTCH_INTSIZE 4)+endif()+set(CMAKE_REQUIRED_INCLUDES "")++# check that PTSCOTCH has been found+# ---------------------------------+include(FindPackageHandleStandardArgs)+find_package_handle_standard_args(PTSCOTCH DEFAULT_MSG+  PTSCOTCH_LIBRARIES+  PTSCOTCH_WORKS)+#+# TODO: Add possibility to check for specific functions in the library+#
+ eigen3/cmake/FindPastix.cmake view
@@ -0,0 +1,704 @@+###+#+# @copyright (c) 2009-2014 The University of Tennessee and The University+#                          of Tennessee Research Foundation.+#                          All rights reserved.+# @copyright (c) 2012-2014 Inria. All rights reserved.+# @copyright (c) 2012-2014 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, Univ. Bordeaux. All rights reserved.+#+###+#+# - Find PASTIX include dirs and libraries+# Use this module by invoking find_package with the form:+#  find_package(PASTIX+#               [REQUIRED] # Fail with error if pastix is not found+#               [COMPONENTS <comp1> <comp2> ...] # dependencies+#              )+#+#  PASTIX depends on the following libraries:+#   - Threads, m, rt+#   - MPI+#   - HWLOC+#   - BLAS+#+#  COMPONENTS are optional libraries PASTIX could be linked with,+#  Use it to drive detection of a specific compilation chain+#  COMPONENTS can be some of the following:+#   - MPI: to activate detection of the parallel MPI version (default)+#        it looks for Threads, HWLOC, BLAS, MPI and ScaLAPACK libraries+#   - SEQ: to activate detection of the sequential version (exclude MPI version)+#   - STARPU: to activate detection of StarPU version+#   it looks for MPI version of StarPU (default behaviour)+#   if SEQ and STARPU are given, it looks for a StarPU without MPI+#   - STARPU_CUDA: to activate detection of StarPU with CUDA+#   - STARPU_FXT: to activate detection of StarPU with FxT+#   - SCOTCH: to activate detection of PASTIX linked with SCOTCH+#   - PTSCOTCH: to activate detection of PASTIX linked with SCOTCH+#   - METIS: to activate detection of PASTIX linked with SCOTCH+#+# This module finds headers and pastix library.+# Results are reported in variables:+#  PASTIX_FOUND            - True if headers and requested libraries were found+#  PASTIX_LINKER_FLAGS     - list of required linker flags (excluding -l and -L)+#  PASTIX_INCLUDE_DIRS     - pastix include directories+#  PASTIX_LIBRARY_DIRS     - Link directories for pastix libraries+#  PASTIX_LIBRARIES        - pastix libraries+#  PASTIX_INCLUDE_DIRS_DEP - pastix + dependencies include directories+#  PASTIX_LIBRARY_DIRS_DEP - pastix + dependencies link directories+#  PASTIX_LIBRARIES_DEP    - pastix libraries + dependencies+#+# The user can give specific paths where to find the libraries adding cmake+# options at configure (ex: cmake path/to/project -DPASTIX_DIR=path/to/pastix):+#  PASTIX_DIR              - Where to find the base directory of pastix+#  PASTIX_INCDIR           - Where to find the header files+#  PASTIX_LIBDIR           - Where to find the library files+# The module can also look for the following environment variables if paths+# are not given as cmake variable: PASTIX_DIR, PASTIX_INCDIR, PASTIX_LIBDIR++#=============================================================================+# Copyright 2012-2013 Inria+# Copyright 2012-2013 Emmanuel Agullo+# Copyright 2012-2013 Mathieu Faverge+# Copyright 2012      Cedric Castagnede+# Copyright 2013      Florent Pruvost+#+# Distributed under the OSI-approved BSD License (the "License");+# see accompanying file MORSE-Copyright.txt for details.+#+# This software is distributed WITHOUT ANY WARRANTY; without even the+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.+# See the License for more information.+#=============================================================================+# (To distribute this file outside of Morse, substitute the full+#  License text for the above reference.)+++if (NOT PASTIX_FOUND)+  set(PASTIX_DIR "" CACHE PATH "Installation directory of PASTIX library")+  if (NOT PASTIX_FIND_QUIETLY)+    message(STATUS "A cache variable, namely PASTIX_DIR, has been set to specify the install directory of PASTIX")+  endif()+endif()++# Set the version to find+set(PASTIX_LOOK_FOR_MPI ON)+set(PASTIX_LOOK_FOR_SEQ OFF)+set(PASTIX_LOOK_FOR_STARPU OFF)+set(PASTIX_LOOK_FOR_STARPU_CUDA OFF)+set(PASTIX_LOOK_FOR_STARPU_FXT OFF)+set(PASTIX_LOOK_FOR_SCOTCH ON)+set(PASTIX_LOOK_FOR_PTSCOTCH OFF)+set(PASTIX_LOOK_FOR_METIS OFF)++if( PASTIX_FIND_COMPONENTS )+  foreach( component ${PASTIX_FIND_COMPONENTS} )+    if (${component} STREQUAL "SEQ")+      # means we look for the sequential version of PaStiX (without MPI)+      set(PASTIX_LOOK_FOR_SEQ ON)+      set(PASTIX_LOOK_FOR_MPI OFF)+    endif()+    if (${component} STREQUAL "MPI")+      # means we look for the MPI version of PaStiX (default)+      set(PASTIX_LOOK_FOR_SEQ OFF)+      set(PASTIX_LOOK_FOR_MPI ON)+    endif()+    if (${component} STREQUAL "STARPU")+      # means we look for PaStiX with StarPU+      set(PASTIX_LOOK_FOR_STARPU ON)+    endif()+    if (${component} STREQUAL "STARPU_CUDA")+      # means we look for PaStiX with StarPU + CUDA+      set(PASTIX_LOOK_FOR_STARPU ON)+      set(PASTIX_LOOK_FOR_STARPU_CUDA ON)+    endif()+    if (${component} STREQUAL "STARPU_FXT")+      # means we look for PaStiX with StarPU + FxT+      set(PASTIX_LOOK_FOR_STARPU_FXT ON)+    endif()+    if (${component} STREQUAL "SCOTCH")+      set(PASTIX_LOOK_FOR_SCOTCH ON)+    endif()+    if (${component} STREQUAL "SCOTCH")+      set(PASTIX_LOOK_FOR_PTSCOTCH ON)+    endif()+    if (${component} STREQUAL "METIS")+      set(PASTIX_LOOK_FOR_METIS ON)+    endif()+  endforeach()+endif()++# Dependencies detection+# ----------------------+++# Required dependencies+# ---------------------++if (NOT PASTIX_FIND_QUIETLY)+  message(STATUS "Looking for PASTIX - Try to detect pthread")+endif()+if (PASTIX_FIND_REQUIRED)+  find_package(Threads REQUIRED QUIET)+else()+  find_package(Threads QUIET)+endif()+set(PASTIX_EXTRA_LIBRARIES "")+if( THREADS_FOUND )+  list(APPEND PASTIX_EXTRA_LIBRARIES ${CMAKE_THREAD_LIBS_INIT})+endif ()++# Add math library to the list of extra+# it normally exists on all common systems provided with a C compiler+if (NOT PASTIX_FIND_QUIETLY)+  message(STATUS "Looking for PASTIX - Try to detect libm")+endif()+set(PASTIX_M_LIBRARIES "")+if(UNIX OR WIN32)+  find_library(+    PASTIX_M_m_LIBRARY+    NAMES m+    )+  mark_as_advanced(PASTIX_M_m_LIBRARY)+  if (PASTIX_M_m_LIBRARY)+    list(APPEND PASTIX_M_LIBRARIES "${PASTIX_M_m_LIBRARY}")+    list(APPEND PASTIX_EXTRA_LIBRARIES "${PASTIX_M_m_LIBRARY}")+  else()+    if (PASTIX_FIND_REQUIRED)+      message(FATAL_ERROR "Could NOT find libm on your system."+	"Are you sure to a have a C compiler installed?")+    endif()+  endif()+endif()++# Try to find librt (libposix4 - POSIX.1b Realtime Extensions library)+# on Unix systems except Apple ones because it does not exist on it+if (NOT PASTIX_FIND_QUIETLY)+  message(STATUS "Looking for PASTIX - Try to detect librt")+endif()+set(PASTIX_RT_LIBRARIES "")+if(UNIX AND NOT APPLE)+  find_library(+    PASTIX_RT_rt_LIBRARY+    NAMES rt+    )+  mark_as_advanced(PASTIX_RT_rt_LIBRARY)+  if (PASTIX_RT_rt_LIBRARY)+    list(APPEND PASTIX_RT_LIBRARIES "${PASTIX_RT_rt_LIBRARY}")+    list(APPEND PASTIX_EXTRA_LIBRARIES "${PASTIX_RT_rt_LIBRARY}")+  else()+    if (PASTIX_FIND_REQUIRED)+      message(FATAL_ERROR "Could NOT find librt on your system")+    endif()+  endif()+endif()++# PASTIX depends on HWLOC+#------------------------+if (NOT PASTIX_FIND_QUIETLY)+  message(STATUS "Looking for PASTIX - Try to detect HWLOC")+endif()+if (PASTIX_FIND_REQUIRED)+  find_package(HWLOC REQUIRED QUIET)+else()+  find_package(HWLOC QUIET)+endif()++# PASTIX depends on BLAS+#-----------------------+if (NOT PASTIX_FIND_QUIETLY)+  message(STATUS "Looking for PASTIX - Try to detect BLAS")+endif()+if (PASTIX_FIND_REQUIRED)+  find_package(BLASEXT REQUIRED QUIET)+else()+  find_package(BLASEXT QUIET)+endif()++# Optional dependencies+# ---------------------++# PASTIX may depend on MPI+#-------------------------+if (NOT MPI_FOUND AND PASTIX_LOOK_FOR_MPI)+  if (NOT PASTIX_FIND_QUIETLY)+    message(STATUS "Looking for PASTIX - Try to detect MPI")+  endif()+  # allows to use an external mpi compilation by setting compilers with+  # -DMPI_C_COMPILER=path/to/mpicc -DMPI_Fortran_COMPILER=path/to/mpif90+  # at cmake configure+  if(NOT MPI_C_COMPILER)+    set(MPI_C_COMPILER mpicc)+  endif()+  if (PASTIX_FIND_REQUIRED AND PASTIX_FIND_REQUIRED_MPI)+    find_package(MPI REQUIRED QUIET)+  else()+    find_package(MPI QUIET)+  endif()+  if (MPI_FOUND)+    mark_as_advanced(MPI_LIBRARY)+    mark_as_advanced(MPI_EXTRA_LIBRARY)+  endif()+endif (NOT MPI_FOUND AND PASTIX_LOOK_FOR_MPI)++# PASTIX may depend on STARPU+#----------------------------+if( NOT STARPU_FOUND AND PASTIX_LOOK_FOR_STARPU)++  if (NOT PASTIX_FIND_QUIETLY)+    message(STATUS "Looking for PASTIX - Try to detect StarPU")+  endif()++  set(PASTIX_STARPU_VERSION "1.1" CACHE STRING "oldest STARPU version desired")++  # create list of components in order to make a single call to find_package(starpu...)+  # we explicitly need a StarPU version built with hwloc+  set(STARPU_COMPONENT_LIST "HWLOC")++  # StarPU may depend on MPI+  # allows to use an external mpi compilation by setting compilers with+  # -DMPI_C_COMPILER=path/to/mpicc -DMPI_Fortran_COMPILER=path/to/mpif90+  # at cmake configure+  if (PASTIX_LOOK_FOR_MPI)+    if(NOT MPI_C_COMPILER)+      set(MPI_C_COMPILER mpicc)+    endif()+    list(APPEND STARPU_COMPONENT_LIST "MPI")+  endif()+  if (PASTIX_LOOK_FOR_STARPU_CUDA)+    list(APPEND STARPU_COMPONENT_LIST "CUDA")+  endif()+  if (PASTIX_LOOK_FOR_STARPU_FXT)+    list(APPEND STARPU_COMPONENT_LIST "FXT")+  endif()+  # set the list of optional dependencies we may discover+  if (PASTIX_FIND_REQUIRED AND PASTIX_FIND_REQUIRED_STARPU)+    find_package(STARPU ${PASTIX_STARPU_VERSION} REQUIRED+      COMPONENTS ${STARPU_COMPONENT_LIST})+  else()+    find_package(STARPU ${PASTIX_STARPU_VERSION}+      COMPONENTS ${STARPU_COMPONENT_LIST})+  endif()++endif( NOT STARPU_FOUND AND PASTIX_LOOK_FOR_STARPU)++# PASTIX may depends on SCOTCH+#-----------------------------+if (NOT SCOTCH_FOUND AND PASTIX_LOOK_FOR_SCOTCH)+  if (NOT PASTIX_FIND_QUIETLY)+    message(STATUS "Looking for PASTIX - Try to detect SCOTCH")+  endif()+  if (PASTIX_FIND_REQUIRED AND PASTIX_FIND_REQUIRED_SCOTCH)+    find_package(SCOTCH REQUIRED QUIET)+  else()+    find_package(SCOTCH QUIET)+  endif()+endif()++# PASTIX may depends on PTSCOTCH+#-------------------------------+if (NOT PTSCOTCH_FOUND AND PASTIX_LOOK_FOR_PTSCOTCH)+  if (NOT PASTIX_FIND_QUIETLY)+    message(STATUS "Looking for PASTIX - Try to detect PTSCOTCH")+  endif()+  if (PASTIX_FIND_REQUIRED AND PASTIX_FIND_REQUIRED_PTSCOTCH)+    find_package(PTSCOTCH REQUIRED QUIET)+  else()+    find_package(PTSCOTCH QUIET)+  endif()+endif()++# PASTIX may depends on METIS+#----------------------------+if (NOT METIS_FOUND AND PASTIX_LOOK_FOR_METIS)+  if (NOT PASTIX_FIND_QUIETLY)+    message(STATUS "Looking for PASTIX - Try to detect METIS")+  endif()+  if (PASTIX_FIND_REQUIRED AND PASTIX_FIND_REQUIRED_METIS)+    find_package(METIS REQUIRED QUIET)+  else()+    find_package(METIS QUIET)+  endif()+endif()++# Error if pastix required and no partitioning lib found+if (PASTIX_FIND_REQUIRED AND NOT SCOTCH_FOUND AND NOT PTSCOTCH_FOUND AND NOT METIS_FOUND)+  message(FATAL_ERROR "Could NOT find any partitioning library on your system"+    " (install scotch, ptscotch or metis)")+endif()+++# Looking for PaStiX+# ------------------++# Looking for include+# -------------------++# Add system include paths to search include+# ------------------------------------------+unset(_inc_env)+set(ENV_PASTIX_DIR "$ENV{PASTIX_DIR}")+set(ENV_PASTIX_INCDIR "$ENV{PASTIX_INCDIR}")+if(ENV_PASTIX_INCDIR)+  list(APPEND _inc_env "${ENV_PASTIX_INCDIR}")+elseif(ENV_PASTIX_DIR)+  list(APPEND _inc_env "${ENV_PASTIX_DIR}")+  list(APPEND _inc_env "${ENV_PASTIX_DIR}/include")+  list(APPEND _inc_env "${ENV_PASTIX_DIR}/include/pastix")+else()+  if(WIN32)+    string(REPLACE ":" ";" _inc_env "$ENV{INCLUDE}")+  else()+    string(REPLACE ":" ";" _path_env "$ENV{INCLUDE}")+    list(APPEND _inc_env "${_path_env}")+    string(REPLACE ":" ";" _path_env "$ENV{C_INCLUDE_PATH}")+    list(APPEND _inc_env "${_path_env}")+    string(REPLACE ":" ";" _path_env "$ENV{CPATH}")+    list(APPEND _inc_env "${_path_env}")+    string(REPLACE ":" ";" _path_env "$ENV{INCLUDE_PATH}")+    list(APPEND _inc_env "${_path_env}")+  endif()+endif()+list(APPEND _inc_env "${CMAKE_PLATFORM_IMPLICIT_INCLUDE_DIRECTORIES}")+list(APPEND _inc_env "${CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES}")+list(REMOVE_DUPLICATES _inc_env)+++# Try to find the pastix header in the given paths+# ---------------------------------------------------+# call cmake macro to find the header path+if(PASTIX_INCDIR)+  set(PASTIX_pastix.h_DIRS "PASTIX_pastix.h_DIRS-NOTFOUND")+  find_path(PASTIX_pastix.h_DIRS+    NAMES pastix.h+    HINTS ${PASTIX_INCDIR})+else()+  if(PASTIX_DIR)+    set(PASTIX_pastix.h_DIRS "PASTIX_pastix.h_DIRS-NOTFOUND")+    find_path(PASTIX_pastix.h_DIRS+      NAMES pastix.h+      HINTS ${PASTIX_DIR}+      PATH_SUFFIXES "include" "include/pastix")+  else()+    set(PASTIX_pastix.h_DIRS "PASTIX_pastix.h_DIRS-NOTFOUND")+    find_path(PASTIX_pastix.h_DIRS+      NAMES pastix.h+      HINTS ${_inc_env}+      PATH_SUFFIXES "pastix")+  endif()+endif()+mark_as_advanced(PASTIX_pastix.h_DIRS)++# If found, add path to cmake variable+# ------------------------------------+if (PASTIX_pastix.h_DIRS)+  set(PASTIX_INCLUDE_DIRS "${PASTIX_pastix.h_DIRS}")+else ()+  set(PASTIX_INCLUDE_DIRS "PASTIX_INCLUDE_DIRS-NOTFOUND")+  if(NOT PASTIX_FIND_QUIETLY)+    message(STATUS "Looking for pastix -- pastix.h not found")+  endif()+endif()+++# Looking for lib+# ---------------++# Add system library paths to search lib+# --------------------------------------+unset(_lib_env)+set(ENV_PASTIX_LIBDIR "$ENV{PASTIX_LIBDIR}")+if(ENV_PASTIX_LIBDIR)+  list(APPEND _lib_env "${ENV_PASTIX_LIBDIR}")+elseif(ENV_PASTIX_DIR)+  list(APPEND _lib_env "${ENV_PASTIX_DIR}")+  list(APPEND _lib_env "${ENV_PASTIX_DIR}/lib")+else()+  if(WIN32)+    string(REPLACE ":" ";" _lib_env "$ENV{LIB}")+  else()+    if(APPLE)+      string(REPLACE ":" ";" _lib_env "$ENV{DYLD_LIBRARY_PATH}")+    else()+      string(REPLACE ":" ";" _lib_env "$ENV{LD_LIBRARY_PATH}")+    endif()+    list(APPEND _lib_env "${CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES}")+    list(APPEND _lib_env "${CMAKE_C_IMPLICIT_LINK_DIRECTORIES}")+  endif()+endif()+list(REMOVE_DUPLICATES _lib_env)++# Try to find the pastix lib in the given paths+# ------------------------------------------------++# create list of libs to find+set(PASTIX_libs_to_find "pastix_murge;pastix")++# call cmake macro to find the lib path+if(PASTIX_LIBDIR)+  foreach(pastix_lib ${PASTIX_libs_to_find})+    set(PASTIX_${pastix_lib}_LIBRARY "PASTIX_${pastix_lib}_LIBRARY-NOTFOUND")+    find_library(PASTIX_${pastix_lib}_LIBRARY+      NAMES ${pastix_lib}+      HINTS ${PASTIX_LIBDIR})+  endforeach()+else()+  if(PASTIX_DIR)+    foreach(pastix_lib ${PASTIX_libs_to_find})+      set(PASTIX_${pastix_lib}_LIBRARY "PASTIX_${pastix_lib}_LIBRARY-NOTFOUND")+      find_library(PASTIX_${pastix_lib}_LIBRARY+	NAMES ${pastix_lib}+	HINTS ${PASTIX_DIR}+	PATH_SUFFIXES lib lib32 lib64)+    endforeach()+  else()+    foreach(pastix_lib ${PASTIX_libs_to_find})+      set(PASTIX_${pastix_lib}_LIBRARY "PASTIX_${pastix_lib}_LIBRARY-NOTFOUND")+      find_library(PASTIX_${pastix_lib}_LIBRARY+	NAMES ${pastix_lib}+	HINTS ${_lib_env})+    endforeach()+  endif()+endif()++# If found, add path to cmake variable+# ------------------------------------+foreach(pastix_lib ${PASTIX_libs_to_find})++  get_filename_component(${pastix_lib}_lib_path ${PASTIX_${pastix_lib}_LIBRARY} PATH)+  # set cmake variables (respects naming convention)+  if (PASTIX_LIBRARIES)+    list(APPEND PASTIX_LIBRARIES "${PASTIX_${pastix_lib}_LIBRARY}")+  else()+    set(PASTIX_LIBRARIES "${PASTIX_${pastix_lib}_LIBRARY}")+  endif()+  if (PASTIX_LIBRARY_DIRS)+    list(APPEND PASTIX_LIBRARY_DIRS "${${pastix_lib}_lib_path}")+  else()+    set(PASTIX_LIBRARY_DIRS "${${pastix_lib}_lib_path}")+  endif()+  mark_as_advanced(PASTIX_${pastix_lib}_LIBRARY)++endforeach(pastix_lib ${PASTIX_libs_to_find})++# check a function to validate the find+if(PASTIX_LIBRARIES)++  set(REQUIRED_LDFLAGS)+  set(REQUIRED_INCDIRS)+  set(REQUIRED_LIBDIRS)+  set(REQUIRED_LIBS)++  # PASTIX+  if (PASTIX_INCLUDE_DIRS)+    set(REQUIRED_INCDIRS "${PASTIX_INCLUDE_DIRS}")+  endif()+  foreach(libdir ${PASTIX_LIBRARY_DIRS})+    if (libdir)+      list(APPEND REQUIRED_LIBDIRS "${libdir}")+    endif()+  endforeach()+  set(REQUIRED_LIBS "${PASTIX_LIBRARIES}")+  # STARPU+  if (PASTIX_LOOK_FOR_STARPU AND STARPU_FOUND)+    if (STARPU_INCLUDE_DIRS_DEP)+      list(APPEND REQUIRED_INCDIRS "${STARPU_INCLUDE_DIRS_DEP}")+    elseif (STARPU_INCLUDE_DIRS)+      list(APPEND REQUIRED_INCDIRS "${STARPU_INCLUDE_DIRS}")+    endif()+    if(STARPU_LIBRARY_DIRS_DEP)+      list(APPEND REQUIRED_LIBDIRS "${STARPU_LIBRARY_DIRS_DEP}")+    elseif(STARPU_LIBRARY_DIRS)+      list(APPEND REQUIRED_LIBDIRS "${STARPU_LIBRARY_DIRS}")+    endif()+    if (STARPU_LIBRARIES_DEP)+      list(APPEND REQUIRED_LIBS "${STARPU_LIBRARIES_DEP}")+    elseif (STARPU_LIBRARIES)+      foreach(lib ${STARPU_LIBRARIES})+	if (EXISTS ${lib} OR ${lib} MATCHES "^-")+	  list(APPEND REQUIRED_LIBS "${lib}")+	else()+	  list(APPEND REQUIRED_LIBS "-l${lib}")+	endif()+      endforeach()+    endif()+  endif()+  # CUDA+  if (PASTIX_LOOK_FOR_STARPU_CUDA AND CUDA_FOUND)+    if (CUDA_INCLUDE_DIRS)+      list(APPEND REQUIRED_INCDIRS "${CUDA_INCLUDE_DIRS}")+    endif()+    foreach(libdir ${CUDA_LIBRARY_DIRS})+      if (libdir)+	list(APPEND REQUIRED_LIBDIRS "${libdir}")+      endif()+    endforeach()+    list(APPEND REQUIRED_LIBS "${CUDA_CUBLAS_LIBRARIES};${CUDA_LIBRARIES}")+  endif()+  # MPI+  if (PASTIX_LOOK_FOR_MPI AND MPI_FOUND)+    if (MPI_C_INCLUDE_PATH)+      list(APPEND REQUIRED_INCDIRS "${MPI_C_INCLUDE_PATH}")+    endif()+    if (MPI_C_LINK_FLAGS)+      if (${MPI_C_LINK_FLAGS} MATCHES "  -")+	string(REGEX REPLACE " -" "-" MPI_C_LINK_FLAGS ${MPI_C_LINK_FLAGS})+      endif()+      list(APPEND REQUIRED_LDFLAGS "${MPI_C_LINK_FLAGS}")+    endif()+    list(APPEND REQUIRED_LIBS "${MPI_C_LIBRARIES}")+  endif()+  # HWLOC+  if (HWLOC_FOUND)+    if (HWLOC_INCLUDE_DIRS)+      list(APPEND REQUIRED_INCDIRS "${HWLOC_INCLUDE_DIRS}")+    endif()+    foreach(libdir ${HWLOC_LIBRARY_DIRS})+      if (libdir)+	list(APPEND REQUIRED_LIBDIRS "${libdir}")+      endif()+    endforeach()+    foreach(lib ${HWLOC_LIBRARIES})+      if (EXISTS ${lib} OR ${lib} MATCHES "^-")+	list(APPEND REQUIRED_LIBS "${lib}")+      else()+	list(APPEND REQUIRED_LIBS "-l${lib}")+      endif()+    endforeach()+  endif()+  # BLAS+  if (BLAS_FOUND)+    if (BLAS_INCLUDE_DIRS)+      list(APPEND REQUIRED_INCDIRS "${BLAS_INCLUDE_DIRS}")+    endif()+    foreach(libdir ${BLAS_LIBRARY_DIRS})+      if (libdir)+	list(APPEND REQUIRED_LIBDIRS "${libdir}")+      endif()+    endforeach()+    list(APPEND REQUIRED_LIBS "${BLAS_LIBRARIES}")+    if (BLAS_LINKER_FLAGS)+      list(APPEND REQUIRED_LDFLAGS "${BLAS_LINKER_FLAGS}")+    endif()+  endif()+  # SCOTCH+  if (PASTIX_LOOK_FOR_SCOTCH AND SCOTCH_FOUND)+    if (SCOTCH_INCLUDE_DIRS)+      list(APPEND REQUIRED_INCDIRS "${SCOTCH_INCLUDE_DIRS}")+    endif()+    foreach(libdir ${SCOTCH_LIBRARY_DIRS})+      if (libdir)+	list(APPEND REQUIRED_LIBDIRS "${libdir}")+      endif()+    endforeach()+    list(APPEND REQUIRED_LIBS "${SCOTCH_LIBRARIES}")+  endif()+  # PTSCOTCH+  if (PASTIX_LOOK_FOR_PTSCOTCH AND PTSCOTCH_FOUND)+    if (PTSCOTCH_INCLUDE_DIRS)+      list(APPEND REQUIRED_INCDIRS "${PTSCOTCH_INCLUDE_DIRS}")+    endif()+    foreach(libdir ${PTSCOTCH_LIBRARY_DIRS})+      if (libdir)+	list(APPEND REQUIRED_LIBDIRS "${libdir}")+      endif()+    endforeach()+    list(APPEND REQUIRED_LIBS "${PTSCOTCH_LIBRARIES}")+  endif()+  # METIS+  if (PASTIX_LOOK_FOR_METIS AND METIS_FOUND)+    if (METIS_INCLUDE_DIRS)+      list(APPEND REQUIRED_INCDIRS "${METIS_INCLUDE_DIRS}")+    endif()+    foreach(libdir ${METIS_LIBRARY_DIRS})+      if (libdir)+	list(APPEND REQUIRED_LIBDIRS "${libdir}")+      endif()+    endforeach()+    list(APPEND REQUIRED_LIBS "${METIS_LIBRARIES}")+  endif()+  # Fortran+  if (CMAKE_C_COMPILER_ID MATCHES "GNU")+    find_library(+      FORTRAN_gfortran_LIBRARY+      NAMES gfortran+      HINTS ${_lib_env}+      )+    mark_as_advanced(FORTRAN_gfortran_LIBRARY)+    if (FORTRAN_gfortran_LIBRARY)+      list(APPEND REQUIRED_LIBS "${FORTRAN_gfortran_LIBRARY}")+    endif()+  elseif (CMAKE_C_COMPILER_ID MATCHES "Intel")+    find_library(+      FORTRAN_ifcore_LIBRARY+      NAMES ifcore+      HINTS ${_lib_env}+      )+    mark_as_advanced(FORTRAN_ifcore_LIBRARY)+    if (FORTRAN_ifcore_LIBRARY)+      list(APPEND REQUIRED_LIBS "${FORTRAN_ifcore_LIBRARY}")+    endif()+  endif()+  # EXTRA LIBS such that pthread, m, rt+  list(APPEND REQUIRED_LIBS ${PASTIX_EXTRA_LIBRARIES})++  # set required libraries for link+  set(CMAKE_REQUIRED_INCLUDES "${REQUIRED_INCDIRS}")+  set(CMAKE_REQUIRED_LIBRARIES)+  list(APPEND CMAKE_REQUIRED_LIBRARIES "${REQUIRED_LDFLAGS}")+  foreach(lib_dir ${REQUIRED_LIBDIRS})+    list(APPEND CMAKE_REQUIRED_LIBRARIES "-L${lib_dir}")+  endforeach()+  list(APPEND CMAKE_REQUIRED_LIBRARIES "${REQUIRED_LIBS}")+  list(APPEND CMAKE_REQUIRED_FLAGS "${REQUIRED_FLAGS}")+  string(REGEX REPLACE "^ -" "-" CMAKE_REQUIRED_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES}")++  # test link+  unset(PASTIX_WORKS CACHE)+  include(CheckFunctionExists)+  check_function_exists(pastix PASTIX_WORKS)+  mark_as_advanced(PASTIX_WORKS)++  if(PASTIX_WORKS)+    # save link with dependencies+    set(PASTIX_LIBRARIES_DEP "${REQUIRED_LIBS}")+    set(PASTIX_LIBRARY_DIRS_DEP "${REQUIRED_LIBDIRS}")+    set(PASTIX_INCLUDE_DIRS_DEP "${REQUIRED_INCDIRS}")+    set(PASTIX_LINKER_FLAGS "${REQUIRED_LDFLAGS}")+    list(REMOVE_DUPLICATES PASTIX_LIBRARY_DIRS_DEP)+    list(REMOVE_DUPLICATES PASTIX_INCLUDE_DIRS_DEP)+    list(REMOVE_DUPLICATES PASTIX_LINKER_FLAGS)+  else()+    if(NOT PASTIX_FIND_QUIETLY)+      message(STATUS "Looking for PASTIX : test of pastix() fails")+      message(STATUS "CMAKE_REQUIRED_LIBRARIES: ${CMAKE_REQUIRED_LIBRARIES}")+      message(STATUS "CMAKE_REQUIRED_INCLUDES: ${CMAKE_REQUIRED_INCLUDES}")+      message(STATUS "Check in CMakeFiles/CMakeError.log to figure out why it fails")+      message(STATUS "Maybe PASTIX is linked with specific libraries. "+	"Have you tried with COMPONENTS (MPI/SEQ, STARPU, STARPU_CUDA, SCOTCH, PTSCOTCH, METIS)? "+	"See the explanation in FindPASTIX.cmake.")+    endif()+  endif()+  set(CMAKE_REQUIRED_INCLUDES)+  set(CMAKE_REQUIRED_FLAGS)+  set(CMAKE_REQUIRED_LIBRARIES)+endif(PASTIX_LIBRARIES)++if (PASTIX_LIBRARIES)+  list(GET PASTIX_LIBRARIES 0 first_lib)+  get_filename_component(first_lib_path "${first_lib}" PATH)+  if (${first_lib_path} MATCHES "/lib(32|64)?$")+    string(REGEX REPLACE "/lib(32|64)?$" "" not_cached_dir "${first_lib_path}")+    set(PASTIX_DIR_FOUND "${not_cached_dir}" CACHE PATH "Installation directory of PASTIX library" FORCE)+  else()+    set(PASTIX_DIR_FOUND "${first_lib_path}" CACHE PATH "Installation directory of PASTIX library" FORCE)+  endif()+endif()+mark_as_advanced(PASTIX_DIR)+mark_as_advanced(PASTIX_DIR_FOUND)++# check that PASTIX has been found+# ---------------------------------+include(FindPackageHandleStandardArgs)+find_package_handle_standard_args(PASTIX DEFAULT_MSG+  PASTIX_LIBRARIES+  PASTIX_WORKS)
+ eigen3/cmake/FindSPQR.cmake view
@@ -0,0 +1,41 @@+# SPQR lib usually requires linking to a blas and lapack library.+# It is up to the user of this module to find a BLAS and link to it.++# SPQR lib requires Cholmod, colamd and amd as well. +# FindCholmod.cmake can be used to find those packages before finding spqr++if (SPQR_INCLUDES AND SPQR_LIBRARIES)+  set(SPQR_FIND_QUIETLY TRUE)+endif (SPQR_INCLUDES AND SPQR_LIBRARIES)++find_path(SPQR_INCLUDES+  NAMES+  SuiteSparseQR.hpp+  PATHS+  $ENV{SPQRDIR}+  ${INCLUDE_INSTALL_DIR}+  PATH_SUFFIXES+  suitesparse+  ufsparse+)++find_library(SPQR_LIBRARIES spqr $ENV{SPQRDIR} ${LIB_INSTALL_DIR})++if(SPQR_LIBRARIES)++  find_library(SUITESPARSE_LIBRARY SuiteSparse PATHS $ENV{SPQRDIR} ${LIB_INSTALL_DIR})+  if (SUITESPARSE_LIBRARY)+    set(SPQR_LIBRARIES ${SPQR_LIBRARIES} ${SUITESPARSE_LIBRARY})+  endif()++  find_library(CHOLMOD_LIBRARY cholmod PATHS $ENV{UMFPACK_LIBDIR} $ENV{UMFPACKDIR} ${LIB_INSTALL_DIR})+  if(CHOLMOD_LIBRARY)+    set(SPQR_LIBRARIES ${SPQR_LIBRARIES} ${CHOLMOD_LIBRARY})+  endif()+  +endif(SPQR_LIBRARIES)++include(FindPackageHandleStandardArgs)+find_package_handle_standard_args(SPQR DEFAULT_MSG SPQR_INCLUDES SPQR_LIBRARIES)++mark_as_advanced(SPQR_INCLUDES SPQR_LIBRARIES)
+ eigen3/cmake/FindScotch.cmake view
@@ -0,0 +1,369 @@+###+#+# @copyright (c) 2009-2014 The University of Tennessee and The University+#                          of Tennessee Research Foundation.+#                          All rights reserved.+# @copyright (c) 2012-2014 Inria. All rights reserved.+# @copyright (c) 2012-2014 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, Univ. Bordeaux. All rights reserved.+#+###+#+# - Find SCOTCH include dirs and libraries+# Use this module by invoking find_package with the form:+#  find_package(SCOTCH+#               [REQUIRED]             # Fail with error if scotch is not found+#               [COMPONENTS <comp1> <comp2> ...] # dependencies+#              )+#+#  COMPONENTS can be some of the following:+#   - ESMUMPS: to activate detection of Scotch with the esmumps interface+#+# This module finds headers and scotch library.+# Results are reported in variables:+#  SCOTCH_FOUND           - True if headers and requested libraries were found+#  SCOTCH_INCLUDE_DIRS    - scotch include directories+#  SCOTCH_LIBRARY_DIRS    - Link directories for scotch libraries+#  SCOTCH_LIBRARIES       - scotch component libraries to be linked+#  SCOTCH_INTSIZE         - Number of octets occupied by a SCOTCH_Num+#+# The user can give specific paths where to find the libraries adding cmake+# options at configure (ex: cmake path/to/project -DSCOTCH=path/to/scotch):+#  SCOTCH_DIR             - Where to find the base directory of scotch+#  SCOTCH_INCDIR          - Where to find the header files+#  SCOTCH_LIBDIR          - Where to find the library files+# The module can also look for the following environment variables if paths+# are not given as cmake variable: SCOTCH_DIR, SCOTCH_INCDIR, SCOTCH_LIBDIR++#=============================================================================+# Copyright 2012-2013 Inria+# Copyright 2012-2013 Emmanuel Agullo+# Copyright 2012-2013 Mathieu Faverge+# Copyright 2012      Cedric Castagnede+# Copyright 2013      Florent Pruvost+#+# Distributed under the OSI-approved BSD License (the "License");+# see accompanying file MORSE-Copyright.txt for details.+#+# This software is distributed WITHOUT ANY WARRANTY; without even the+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.+# See the License for more information.+#=============================================================================+# (To distribute this file outside of Morse, substitute the full+#  License text for the above reference.)++if (NOT SCOTCH_FOUND)+  set(SCOTCH_DIR "" CACHE PATH "Installation directory of SCOTCH library")+  if (NOT SCOTCH_FIND_QUIETLY)+    message(STATUS "A cache variable, namely SCOTCH_DIR, has been set to specify the install directory of SCOTCH")+  endif()+endif()++# Set the version to find+set(SCOTCH_LOOK_FOR_ESMUMPS OFF)++if( SCOTCH_FIND_COMPONENTS )+  foreach( component ${SCOTCH_FIND_COMPONENTS} )+    if (${component} STREQUAL "ESMUMPS")+      # means we look for esmumps library+      set(SCOTCH_LOOK_FOR_ESMUMPS ON)+    endif()+  endforeach()+endif()++# SCOTCH may depend on Threads, try to find it+if (NOT THREADS_FOUND)+  if (SCOTCH_FIND_REQUIRED)+    find_package(Threads REQUIRED)+  else()+    find_package(Threads)+  endif()+endif()++# Looking for include+# -------------------++# Add system include paths to search include+# ------------------------------------------+unset(_inc_env)+set(ENV_SCOTCH_DIR "$ENV{SCOTCH_DIR}")+set(ENV_SCOTCH_INCDIR "$ENV{SCOTCH_INCDIR}")+if(ENV_SCOTCH_INCDIR)+  list(APPEND _inc_env "${ENV_SCOTCH_INCDIR}")+elseif(ENV_SCOTCH_DIR)+  list(APPEND _inc_env "${ENV_SCOTCH_DIR}")+  list(APPEND _inc_env "${ENV_SCOTCH_DIR}/include")+  list(APPEND _inc_env "${ENV_SCOTCH_DIR}/include/scotch")+else()+  if(WIN32)+    string(REPLACE ":" ";" _inc_env "$ENV{INCLUDE}")+  else()+    string(REPLACE ":" ";" _path_env "$ENV{INCLUDE}")+    list(APPEND _inc_env "${_path_env}")+    string(REPLACE ":" ";" _path_env "$ENV{C_INCLUDE_PATH}")+    list(APPEND _inc_env "${_path_env}")+    string(REPLACE ":" ";" _path_env "$ENV{CPATH}")+    list(APPEND _inc_env "${_path_env}")+    string(REPLACE ":" ";" _path_env "$ENV{INCLUDE_PATH}")+    list(APPEND _inc_env "${_path_env}")+  endif()+endif()+list(APPEND _inc_env "${CMAKE_PLATFORM_IMPLICIT_INCLUDE_DIRECTORIES}")+list(APPEND _inc_env "${CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES}")+list(REMOVE_DUPLICATES _inc_env)+++# Try to find the scotch header in the given paths+# -------------------------------------------------+# call cmake macro to find the header path+if(SCOTCH_INCDIR)+  set(SCOTCH_scotch.h_DIRS "SCOTCH_scotch.h_DIRS-NOTFOUND")+  find_path(SCOTCH_scotch.h_DIRS+    NAMES scotch.h+    HINTS ${SCOTCH_INCDIR})+else()+  if(SCOTCH_DIR)+    set(SCOTCH_scotch.h_DIRS "SCOTCH_scotch.h_DIRS-NOTFOUND")+    find_path(SCOTCH_scotch.h_DIRS+      NAMES scotch.h+      HINTS ${SCOTCH_DIR}+      PATH_SUFFIXES "include" "include/scotch")+  else()+    set(SCOTCH_scotch.h_DIRS "SCOTCH_scotch.h_DIRS-NOTFOUND")+    find_path(SCOTCH_scotch.h_DIRS+      NAMES scotch.h+      HINTS ${_inc_env}+      PATH_SUFFIXES "scotch")+  endif()+endif()+mark_as_advanced(SCOTCH_scotch.h_DIRS)++# If found, add path to cmake variable+# ------------------------------------+if (SCOTCH_scotch.h_DIRS)+  set(SCOTCH_INCLUDE_DIRS "${SCOTCH_scotch.h_DIRS}")+else ()+  set(SCOTCH_INCLUDE_DIRS "SCOTCH_INCLUDE_DIRS-NOTFOUND")+  if (NOT SCOTCH_FIND_QUIETLY)+    message(STATUS "Looking for scotch -- scotch.h not found")+  endif()+endif()+list(REMOVE_DUPLICATES SCOTCH_INCLUDE_DIRS)++# Looking for lib+# ---------------++# Add system library paths to search lib+# --------------------------------------+unset(_lib_env)+set(ENV_SCOTCH_LIBDIR "$ENV{SCOTCH_LIBDIR}")+if(ENV_SCOTCH_LIBDIR)+  list(APPEND _lib_env "${ENV_SCOTCH_LIBDIR}")+elseif(ENV_SCOTCH_DIR)+  list(APPEND _lib_env "${ENV_SCOTCH_DIR}")+  list(APPEND _lib_env "${ENV_SCOTCH_DIR}/lib")+else()+  if(WIN32)+    string(REPLACE ":" ";" _lib_env "$ENV{LIB}")+  else()+    if(APPLE)+      string(REPLACE ":" ";" _lib_env "$ENV{DYLD_LIBRARY_PATH}")+    else()+      string(REPLACE ":" ";" _lib_env "$ENV{LD_LIBRARY_PATH}")+    endif()+    list(APPEND _lib_env "${CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES}")+    list(APPEND _lib_env "${CMAKE_C_IMPLICIT_LINK_DIRECTORIES}")+  endif()+endif()+list(REMOVE_DUPLICATES _lib_env)++# Try to find the scotch lib in the given paths+# ----------------------------------------------++set(SCOTCH_libs_to_find "scotch;scotcherrexit")+if (SCOTCH_LOOK_FOR_ESMUMPS)+  list(INSERT SCOTCH_libs_to_find 0 "esmumps")+endif()++# call cmake macro to find the lib path+if(SCOTCH_LIBDIR)+  foreach(scotch_lib ${SCOTCH_libs_to_find})+    set(SCOTCH_${scotch_lib}_LIBRARY "SCOTCH_${scotch_lib}_LIBRARY-NOTFOUND")+    find_library(SCOTCH_${scotch_lib}_LIBRARY+      NAMES ${scotch_lib}+      HINTS ${SCOTCH_LIBDIR})+  endforeach()+else()+  if(SCOTCH_DIR)+    foreach(scotch_lib ${SCOTCH_libs_to_find})+      set(SCOTCH_${scotch_lib}_LIBRARY "SCOTCH_${scotch_lib}_LIBRARY-NOTFOUND")+      find_library(SCOTCH_${scotch_lib}_LIBRARY+	NAMES ${scotch_lib}+	HINTS ${SCOTCH_DIR}+	PATH_SUFFIXES lib lib32 lib64)+    endforeach()+  else()+    foreach(scotch_lib ${SCOTCH_libs_to_find})+      set(SCOTCH_${scotch_lib}_LIBRARY "SCOTCH_${scotch_lib}_LIBRARY-NOTFOUND")+      find_library(SCOTCH_${scotch_lib}_LIBRARY+	NAMES ${scotch_lib}+	HINTS ${_lib_env})+    endforeach()+  endif()+endif()++set(SCOTCH_LIBRARIES "")+set(SCOTCH_LIBRARY_DIRS "")+# If found, add path to cmake variable+# ------------------------------------+foreach(scotch_lib ${SCOTCH_libs_to_find})++  if (SCOTCH_${scotch_lib}_LIBRARY)+    get_filename_component(${scotch_lib}_lib_path "${SCOTCH_${scotch_lib}_LIBRARY}" PATH)+    # set cmake variables+    list(APPEND SCOTCH_LIBRARIES "${SCOTCH_${scotch_lib}_LIBRARY}")+    list(APPEND SCOTCH_LIBRARY_DIRS "${${scotch_lib}_lib_path}")+  else ()+    list(APPEND SCOTCH_LIBRARIES "${SCOTCH_${scotch_lib}_LIBRARY}")+    if (NOT SCOTCH_FIND_QUIETLY)+      message(STATUS "Looking for scotch -- lib ${scotch_lib} not found")+    endif()+  endif ()++  mark_as_advanced(SCOTCH_${scotch_lib}_LIBRARY)++endforeach()+list(REMOVE_DUPLICATES SCOTCH_LIBRARY_DIRS)++# check a function to validate the find+if(SCOTCH_LIBRARIES)++  set(REQUIRED_INCDIRS)+  set(REQUIRED_LIBDIRS)+  set(REQUIRED_LIBS)++  # SCOTCH+  if (SCOTCH_INCLUDE_DIRS)+    set(REQUIRED_INCDIRS  "${SCOTCH_INCLUDE_DIRS}")+  endif()+  if (SCOTCH_LIBRARY_DIRS)+    set(REQUIRED_LIBDIRS "${SCOTCH_LIBRARY_DIRS}")+  endif()+  set(REQUIRED_LIBS "${SCOTCH_LIBRARIES}")+  # THREADS+  if(CMAKE_THREAD_LIBS_INIT)+    list(APPEND REQUIRED_LIBS "${CMAKE_THREAD_LIBS_INIT}")+  endif()+  set(Z_LIBRARY "Z_LIBRARY-NOTFOUND")+  find_library(Z_LIBRARY NAMES z)+  mark_as_advanced(Z_LIBRARY)+  if(Z_LIBRARY)+    list(APPEND REQUIRED_LIBS "-lz")+  endif()+  set(M_LIBRARY "M_LIBRARY-NOTFOUND")+  find_library(M_LIBRARY NAMES m)+  mark_as_advanced(M_LIBRARY)+  if(M_LIBRARY)+    list(APPEND REQUIRED_LIBS "-lm")+  endif()+  set(RT_LIBRARY "RT_LIBRARY-NOTFOUND")+  find_library(RT_LIBRARY NAMES rt)+  mark_as_advanced(RT_LIBRARY)+  if(RT_LIBRARY)+    list(APPEND REQUIRED_LIBS "-lrt")+  endif()++  # set required libraries for link+  set(CMAKE_REQUIRED_INCLUDES "${REQUIRED_INCDIRS}")+  set(CMAKE_REQUIRED_LIBRARIES)+  foreach(lib_dir ${REQUIRED_LIBDIRS})+    list(APPEND CMAKE_REQUIRED_LIBRARIES "-L${lib_dir}")+  endforeach()+  list(APPEND CMAKE_REQUIRED_LIBRARIES "${REQUIRED_LIBS}")+  string(REGEX REPLACE "^ -" "-" CMAKE_REQUIRED_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES}")++  # test link+  unset(SCOTCH_WORKS CACHE)+  include(CheckFunctionExists)+  check_function_exists(SCOTCH_graphInit SCOTCH_WORKS)+  mark_as_advanced(SCOTCH_WORKS)++  if(SCOTCH_WORKS)+    # save link with dependencies+    set(SCOTCH_LIBRARIES "${REQUIRED_LIBS}")+  else()+    if(NOT SCOTCH_FIND_QUIETLY)+      message(STATUS "Looking for SCOTCH : test of SCOTCH_graphInit with SCOTCH library fails")+      message(STATUS "CMAKE_REQUIRED_LIBRARIES: ${CMAKE_REQUIRED_LIBRARIES}")+      message(STATUS "CMAKE_REQUIRED_INCLUDES: ${CMAKE_REQUIRED_INCLUDES}")+      message(STATUS "Check in CMakeFiles/CMakeError.log to figure out why it fails")+    endif()+  endif()+  set(CMAKE_REQUIRED_INCLUDES)+  set(CMAKE_REQUIRED_FLAGS)+  set(CMAKE_REQUIRED_LIBRARIES)+endif(SCOTCH_LIBRARIES)++if (SCOTCH_LIBRARIES)+  list(GET SCOTCH_LIBRARIES 0 first_lib)+  get_filename_component(first_lib_path "${first_lib}" PATH)+  if (${first_lib_path} MATCHES "/lib(32|64)?$")+    string(REGEX REPLACE "/lib(32|64)?$" "" not_cached_dir "${first_lib_path}")+    set(SCOTCH_DIR_FOUND "${not_cached_dir}" CACHE PATH "Installation directory of SCOTCH library" FORCE)+  else()+    set(SCOTCH_DIR_FOUND "${first_lib_path}" CACHE PATH "Installation directory of SCOTCH library" FORCE)+  endif()+endif()+mark_as_advanced(SCOTCH_DIR)+mark_as_advanced(SCOTCH_DIR_FOUND)++# Check the size of SCOTCH_Num+# ---------------------------------+set(CMAKE_REQUIRED_INCLUDES ${SCOTCH_INCLUDE_DIRS})++include(CheckCSourceRuns)+#stdio.h and stdint.h should be included by scotch.h directly+set(SCOTCH_C_TEST_SCOTCH_Num_4 "+#include <stdio.h>+#include <stdint.h>+#include <scotch.h>+int main(int argc, char **argv) {+  if (sizeof(SCOTCH_Num) == 4)+    return 0;+  else+    return 1;+}+")++set(SCOTCH_C_TEST_SCOTCH_Num_8 "+#include <stdio.h>+#include <stdint.h>+#include <scotch.h>+int main(int argc, char **argv) {+  if (sizeof(SCOTCH_Num) == 8)+    return 0;+  else+    return 1;+}+")+check_c_source_runs("${SCOTCH_C_TEST_SCOTCH_Num_4}" SCOTCH_Num_4)+if(NOT SCOTCH_Num_4)+  check_c_source_runs("${SCOTCH_C_TEST_SCOTCH_Num_8}" SCOTCH_Num_8)+  if(NOT SCOTCH_Num_8)+    set(SCOTCH_INTSIZE -1)+  else()+    set(SCOTCH_INTSIZE 8)+  endif()+else()+  set(SCOTCH_INTSIZE 4)+endif()+set(CMAKE_REQUIRED_INCLUDES "")++# check that SCOTCH has been found+# ---------------------------------+include(FindPackageHandleStandardArgs)+find_package_handle_standard_args(SCOTCH DEFAULT_MSG+  SCOTCH_LIBRARIES+  SCOTCH_WORKS)+#+# TODO: Add possibility to check for specific functions in the library+#
+ eigen3/cmake/FindStandardMathLibrary.cmake view
@@ -0,0 +1,64 @@+# - Try to find how to link to the standard math library, if anything at all is needed to do.+# On most platforms this is automatic, but for example it's not automatic on QNX.+#+# Once done this will define+#+#  STANDARD_MATH_LIBRARY_FOUND - we found how to successfully link to the standard math library+#  STANDARD_MATH_LIBRARY - the name of the standard library that one has to link to.+#                            -- this will be left empty if it's automatic (most platforms).+#                            -- this will be set to "m" on platforms where one must explicitly+#                               pass the "-lm" linker flag.+#+# Copyright (c) 2010 Benoit Jacob <jacob.benoit.1@gmail.com>+# Redistribution and use is allowed according to the terms of the 2-clause BSD license.+++include(CheckCXXSourceCompiles)++# a little test program for c++ math functions.+# notice the std:: is required on some platforms such as QNX++set(find_standard_math_library_test_program+"#include<cmath>+int main() { std::sin(0.0); std::log(0.0f); }")++# first try compiling/linking the test program without any linker flags++set(CMAKE_REQUIRED_FLAGS "")+set(CMAKE_REQUIRED_LIBRARIES "")+CHECK_CXX_SOURCE_COMPILES(+  "${find_standard_math_library_test_program}"+  standard_math_library_linked_to_automatically+)++if(standard_math_library_linked_to_automatically)++  # the test program linked successfully without any linker flag.+  set(STANDARD_MATH_LIBRARY "")+  set(STANDARD_MATH_LIBRARY_FOUND TRUE)++else()++  # the test program did not link successfully without any linker flag.+  # This is a very uncommon case that so far we only saw on QNX. The next try is the+  # standard name 'm' for the standard math library.++  set(CMAKE_REQUIRED_LIBRARIES "m")+  CHECK_CXX_SOURCE_COMPILES(+    "${find_standard_math_library_test_program}"+    standard_math_library_linked_to_as_m)++  if(standard_math_library_linked_to_as_m)++    # the test program linked successfully when linking to the 'm' library+    set(STANDARD_MATH_LIBRARY "m")+    set(STANDARD_MATH_LIBRARY_FOUND TRUE)++  else()++    # the test program still doesn't link successfully+    set(STANDARD_MATH_LIBRARY_FOUND FALSE)++  endif()++endif()
+ eigen3/cmake/FindSuperLU.cmake view
@@ -0,0 +1,97 @@++# Umfpack lib usually requires linking to a blas library.+# It is up to the user of this module to find a BLAS and link to it.++if (SUPERLU_INCLUDES AND SUPERLU_LIBRARIES)+  set(SUPERLU_FIND_QUIETLY TRUE)+endif (SUPERLU_INCLUDES AND SUPERLU_LIBRARIES)++find_path(SUPERLU_INCLUDES+  NAMES+  supermatrix.h+  PATHS+  $ENV{SUPERLUDIR}+  ${INCLUDE_INSTALL_DIR}+  PATH_SUFFIXES+  superlu+  SRC+)++find_library(SUPERLU_LIBRARIES+  NAMES "superlu_5.2.1" "superlu_5.2" "superlu_5.1.1" "superlu_5.1" "superlu_5.0" "superlu_4.3" "superlu_4.2" "superlu_4.1" "superlu_4.0" "superlu_3.1" "superlu_3.0" "superlu"+  PATHS $ENV{SUPERLUDIR} ${LIB_INSTALL_DIR}+  PATH_SUFFIXES lib)++if(SUPERLU_INCLUDES AND SUPERLU_LIBRARIES)++include(CheckCXXSourceCompiles)+include(CMakePushCheckState)+cmake_push_check_state()++set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES} ${SUPERLU_INCLUDES})++# check whether struct mem_usage_t is globally defined+check_cxx_source_compiles("+typedef int int_t;+#include <supermatrix.h>+#include <slu_util.h>+int main() {+  mem_usage_t mem;+  return 0;+}"+SUPERLU_HAS_GLOBAL_MEM_USAGE_T)+++check_cxx_source_compiles("+typedef int int_t;+#include <supermatrix.h>+#include <superlu_enum_consts.h>+int main() {+  return SLU_SINGLE;+}"+SUPERLU_HAS_CLEAN_ENUMS)++check_cxx_source_compiles("+typedef int int_t;+#include <supermatrix.h>+#include <slu_util.h>+int main(void)+{+  GlobalLU_t glu;+  return 0;+}"+SUPERLU_HAS_GLOBALLU_T)++if(SUPERLU_HAS_GLOBALLU_T)+  # at least 5.0+  set(SUPERLU_VERSION_VAR "5.0")+elseif(SUPERLU_HAS_CLEAN_ENUMS)+  # at least 4.3+  set(SUPERLU_VERSION_VAR "4.3")+elseif(SUPERLU_HAS_GLOBAL_MEM_USAGE_T)+  # at least 4.0+  set(SUPERLU_VERSION_VAR "4.0")+else()+  set(SUPERLU_VERSION_VAR "3.0")+endif()++cmake_pop_check_state()++if(SuperLU_FIND_VERSION)+  if(${SUPERLU_VERSION_VAR} VERSION_LESS ${SuperLU_FIND_VERSION})+    set(SUPERLU_VERSION_OK FALSE)+  else()+    set(SUPERLU_VERSION_OK TRUE)+  endif()+else()+  set(SUPERLU_VERSION_OK TRUE)+endif()++endif()++include(FindPackageHandleStandardArgs)+find_package_handle_standard_args(SUPERLU+                                  REQUIRED_VARS SUPERLU_INCLUDES SUPERLU_LIBRARIES SUPERLU_VERSION_OK+                                  VERSION_VAR SUPERLU_VERSION_VAR)++mark_as_advanced(SUPERLU_INCLUDES SUPERLU_LIBRARIES)
+ eigen3/cmake/FindUmfpack.cmake view
@@ -0,0 +1,53 @@+# Umfpack lib usually requires linking to a blas library.+# It is up to the user of this module to find a BLAS and link to it.++if (UMFPACK_INCLUDES AND UMFPACK_LIBRARIES)+  set(UMFPACK_FIND_QUIETLY TRUE)+endif (UMFPACK_INCLUDES AND UMFPACK_LIBRARIES)++find_path(UMFPACK_INCLUDES+  NAMES+  umfpack.h+  PATHS+  $ENV{UMFPACKDIR}+  ${INCLUDE_INSTALL_DIR}+  PATH_SUFFIXES+  suitesparse+  ufsparse+)++find_library(UMFPACK_LIBRARIES umfpack PATHS $ENV{UMFPACKDIR} ${LIB_INSTALL_DIR})++if(UMFPACK_LIBRARIES)++  if(NOT UMFPACK_LIBDIR)+    get_filename_component(UMFPACK_LIBDIR ${UMFPACK_LIBRARIES} PATH)+  endif(NOT UMFPACK_LIBDIR)++  find_library(COLAMD_LIBRARY colamd PATHS ${UMFPACK_LIBDIR} $ENV{UMFPACKDIR} ${LIB_INSTALL_DIR})+  if(COLAMD_LIBRARY)+    set(UMFPACK_LIBRARIES ${UMFPACK_LIBRARIES} ${COLAMD_LIBRARY})+  endif ()+  +  find_library(AMD_LIBRARY amd PATHS ${UMFPACK_LIBDIR} $ENV{UMFPACKDIR} ${LIB_INSTALL_DIR})+  if(AMD_LIBRARY)+    set(UMFPACK_LIBRARIES ${UMFPACK_LIBRARIES} ${AMD_LIBRARY})+  endif ()++  find_library(SUITESPARSE_LIBRARY SuiteSparse PATHS ${UMFPACK_LIBDIR} $ENV{UMFPACKDIR} ${LIB_INSTALL_DIR})+  if(SUITESPARSE_LIBRARY)+    set(UMFPACK_LIBRARIES ${UMFPACK_LIBRARIES} ${SUITESPARSE_LIBRARY})+  endif ()++  find_library(CHOLMOD_LIBRARY cholmod PATHS $ENV{UMFPACK_LIBDIR} $ENV{UMFPACKDIR} ${LIB_INSTALL_DIR})+  if(CHOLMOD_LIBRARY)+    set(UMFPACK_LIBRARIES ${UMFPACK_LIBRARIES} ${CHOLMOD_LIBRARY})+  endif()++endif(UMFPACK_LIBRARIES)++include(FindPackageHandleStandardArgs)+find_package_handle_standard_args(UMFPACK DEFAULT_MSG+                                  UMFPACK_INCLUDES UMFPACK_LIBRARIES)++mark_as_advanced(UMFPACK_INCLUDES UMFPACK_LIBRARIES AMD_LIBRARY COLAMD_LIBRARY CHOLMOD_LIBRARY SUITESPARSE_LIBRARY)
+ eigen3/cmake/RegexUtils.cmake view
@@ -0,0 +1,19 @@+function(escape_string_as_regex _str_out _str_in)+  STRING(REGEX REPLACE "\\\\" "\\\\\\\\" FILETEST2 "${_str_in}")+  STRING(REGEX REPLACE "([.$+*?|-])" "\\\\\\1" FILETEST2 "${FILETEST2}")+  STRING(REGEX REPLACE "\\^" "\\\\^" FILETEST2 "${FILETEST2}")+  STRING(REGEX REPLACE "\\(" "\\\\(" FILETEST2 "${FILETEST2}")+  STRING(REGEX REPLACE "\\)" "\\\\)" FILETEST2 "${FILETEST2}")+  STRING(REGEX REPLACE "\\[" "\\\\[" FILETEST2 "${FILETEST2}")+  STRING(REGEX REPLACE "\\]" "\\\\]" FILETEST2 "${FILETEST2}")+  SET(${_str_out} "${FILETEST2}" PARENT_SCOPE)+endfunction()++function(test_escape_string_as_regex)+  SET(test1 "\\.^$-+*()[]?|")+  escape_string_as_regex(test2 "${test1}")+  SET(testRef "\\\\\\.\\^\\$\\-\\+\\*\\(\\)\\[\\]\\?\\|")+  if(NOT test2 STREQUAL testRef)+	message("Error in the escape_string_for_regex function : \n   ${test1} was escaped as ${test2}, should be ${testRef}")+  endif(NOT test2 STREQUAL testRef)+endfunction()
+ eigen3/cmake/UseEigen3.cmake view
@@ -0,0 +1,6 @@+#                                               -*- cmake -*-+#+#  UseEigen3.cmake++add_definitions     ( ${EIGEN3_DEFINITIONS} )+include_directories ( ${EIGEN3_INCLUDE_DIRS} )
+ eigen3/cmake/language_support.cmake view
@@ -0,0 +1,67 @@+# cmake/modules/language_support.cmake+#+# Temporary additional general language support is contained within this+# file.  ++# This additional function definition is needed to provide a workaround for+# CMake bug 9220.++# On debian testing (cmake 2.6.2), I get return code zero when calling +# cmake the first time, but cmake crashes when running a second time+# as follows:+#+#  -- The Fortran compiler identification is unknown+#  CMake Error at /usr/share/cmake-2.6/Modules/CMakeFortranInformation.cmake:7 (GET_FILENAME_COMPONENT):+#    get_filename_component called with incorrect number of arguments+#  Call Stack (most recent call first):+#    CMakeLists.txt:3 (enable_language)+#+# My workaround is to invoke cmake twice.  If both return codes are zero, +# it is safe to invoke ENABLE_LANGUAGE(Fortran OPTIONAL)++function(workaround_9220 language language_works)+  #message("DEBUG: language = ${language}")+  set(text+    "project(test NONE)+    cmake_minimum_required(VERSION 2.8.0)+    set (CMAKE_Fortran_FLAGS \"${CMAKE_Fortran_FLAGS}\")+    set (CMAKE_EXE_LINKER_FLAGS \"${CMAKE_EXE_LINKER_FLAGS}\")+    enable_language(${language})+  ")+  file(REMOVE_RECURSE ${CMAKE_BINARY_DIR}/language_tests/${language})+  file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/language_tests/${language})+  file(WRITE ${CMAKE_BINARY_DIR}/language_tests/${language}/CMakeLists.txt+    ${text})+  execute_process(+    COMMAND ${CMAKE_COMMAND} . -G "${CMAKE_GENERATOR}"+    WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/language_tests/${language}+    RESULT_VARIABLE return_code+    OUTPUT_QUIET+    ERROR_QUIET+    )++  if(return_code EQUAL 0)+    # Second run+    execute_process (+      COMMAND ${CMAKE_COMMAND} . -G "${CMAKE_GENERATOR}"+      WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/language_tests/${language}+      RESULT_VARIABLE return_code+      OUTPUT_QUIET+      ERROR_QUIET+      )+    if(return_code EQUAL 0)+      set(${language_works} ON PARENT_SCOPE)+    else(return_code EQUAL 0)+      set(${language_works} OFF PARENT_SCOPE)+    endif(return_code EQUAL 0)+  else(return_code EQUAL 0)+    set(${language_works} OFF PARENT_SCOPE)+  endif(return_code EQUAL 0)+endfunction(workaround_9220)++# Temporary tests of the above function.+#workaround_9220(CXX CXX_language_works)+#message("CXX_language_works = ${CXX_language_works}")+#workaround_9220(CXXp CXXp_language_works)+#message("CXXp_language_works = ${CXXp_language_works}")+
+ eigen3/debug/gdb/__init__.py view
@@ -0,0 +1,1 @@+# Intentionally empty
+ eigen3/debug/gdb/printers.py view
@@ -0,0 +1,214 @@+# -*- coding: utf-8 -*-+# This file is part of Eigen, a lightweight C++ template library+# for linear algebra.+#+# Copyright (C) 2009 Benjamin Schindler <bschindler@inf.ethz.ch>+#+# 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/.++# Pretty printers for Eigen::Matrix+# This is still pretty basic as the python extension to gdb is still pretty basic. +# It cannot handle complex eigen types and it doesn't support any of the other eigen types+# Such as quaternion or some other type. +# This code supports fixed size as well as dynamic size matrices++# To use it:+#+# * Create a directory and put the file as well as an empty __init__.py in +#   that directory.+# * Create a ~/.gdbinit file, that contains the following:+#      python+#      import sys+#      sys.path.insert(0, '/path/to/eigen/printer/directory')+#      from printers import register_eigen_printers+#      register_eigen_printers (None)+#      end++import gdb+import re+import itertools+++class EigenMatrixPrinter:+	"Print Eigen Matrix or Array of some kind"++	def __init__(self, variety, val):+		"Extract all the necessary information"+		+		# Save the variety (presumably "Matrix" or "Array") for later usage+		self.variety = variety+		+		# The gdb extension does not support value template arguments - need to extract them by hand+		type = val.type+		if type.code == gdb.TYPE_CODE_REF:+			type = type.target()+		self.type = type.unqualified().strip_typedefs()+		tag = self.type.tag+		regex = re.compile('\<.*\>')+		m = regex.findall(tag)[0][1:-1]+		template_params = m.split(',')+		template_params = [x.replace(" ", "") for x in template_params]+		+		if template_params[1] == '-0x00000000000000001' or template_params[1] == '-0x000000001' or template_params[1] == '-1':+			self.rows = val['m_storage']['m_rows']+		else:+			self.rows = int(template_params[1])+		+		if template_params[2] == '-0x00000000000000001' or template_params[2] == '-0x000000001' or template_params[2] == '-1':+			self.cols = val['m_storage']['m_cols']+		else:+			self.cols = int(template_params[2])+		+		self.options = 0 # default value+		if len(template_params) > 3:+			self.options = template_params[3];+		+		self.rowMajor = (int(self.options) & 0x1)+		+		self.innerType = self.type.template_argument(0)+		+		self.val = val+		+		# Fixed size matrices have a struct as their storage, so we need to walk through this+		self.data = self.val['m_storage']['m_data']+		if self.data.type.code == gdb.TYPE_CODE_STRUCT:+			self.data = self.data['array']+			self.data = self.data.cast(self.innerType.pointer())+			+	class _iterator:+		def __init__ (self, rows, cols, dataPtr, rowMajor):+			self.rows = rows+			self.cols = cols+			self.dataPtr = dataPtr+			self.currentRow = 0+			self.currentCol = 0+			self.rowMajor = rowMajor+			+		def __iter__ (self):+			return self++		def next(self):+                        return self.__next__()  # Python 2.x compatibility++		def __next__(self):+			+			row = self.currentRow+			col = self.currentCol+			if self.rowMajor == 0:+				if self.currentCol >= self.cols:+					raise StopIteration+					+				self.currentRow = self.currentRow + 1+				if self.currentRow >= self.rows:+					self.currentRow = 0+					self.currentCol = self.currentCol + 1+			else:+				if self.currentRow >= self.rows:+					raise StopIteration+					+				self.currentCol = self.currentCol + 1+				if self.currentCol >= self.cols:+					self.currentCol = 0+					self.currentRow = self.currentRow + 1+				+			+			item = self.dataPtr.dereference()+			self.dataPtr = self.dataPtr + 1+			if (self.cols == 1): #if it's a column vector+				return ('[%d]' % (row,), item)+			elif (self.rows == 1): #if it's a row vector+				return ('[%d]' % (col,), item)+			return ('[%d,%d]' % (row, col), item)+			+	def children(self):+		+		return self._iterator(self.rows, self.cols, self.data, self.rowMajor)+		+	def to_string(self):+		return "Eigen::%s<%s,%d,%d,%s> (data ptr: %s)" % (self.variety, self.innerType, self.rows, self.cols, "RowMajor" if self.rowMajor else  "ColMajor", self.data)++class EigenQuaternionPrinter:+	"Print an Eigen Quaternion"+	+	def __init__(self, val):+		"Extract all the necessary information"+		# The gdb extension does not support value template arguments - need to extract them by hand+		type = val.type+		if type.code == gdb.TYPE_CODE_REF:+			type = type.target()+		self.type = type.unqualified().strip_typedefs()+		self.innerType = self.type.template_argument(0)+		self.val = val+		+		# Quaternions have a struct as their storage, so we need to walk through this+		self.data = self.val['m_coeffs']['m_storage']['m_data']['array']+		self.data = self.data.cast(self.innerType.pointer())+			+	class _iterator:+		def __init__ (self, dataPtr):+			self.dataPtr = dataPtr+			self.currentElement = 0+			self.elementNames = ['x', 'y', 'z', 'w']+			+		def __iter__ (self):+			return self+	+		def next(self):+                        return self.__next__()  # Python 2.x compatibility++		def __next__(self):+			element = self.currentElement+			+			if self.currentElement >= 4: #there are 4 elements in a quanternion+				raise StopIteration+			+			self.currentElement = self.currentElement + 1+			+			item = self.dataPtr.dereference()+			self.dataPtr = self.dataPtr + 1+			return ('[%s]' % (self.elementNames[element],), item)+			+	def children(self):+		+		return self._iterator(self.data)+	+	def to_string(self):+		return "Eigen::Quaternion<%s> (data ptr: %s)" % (self.innerType, self.data)++def build_eigen_dictionary ():+	pretty_printers_dict[re.compile('^Eigen::Quaternion<.*>$')] = lambda val: EigenQuaternionPrinter(val)+	pretty_printers_dict[re.compile('^Eigen::Matrix<.*>$')] = lambda val: EigenMatrixPrinter("Matrix", val)+	pretty_printers_dict[re.compile('^Eigen::Array<.*>$')]  = lambda val: EigenMatrixPrinter("Array",  val)++def register_eigen_printers(obj):+	"Register eigen pretty-printers with objfile Obj"++	if obj == None:+		obj = gdb+	obj.pretty_printers.append(lookup_function)++def lookup_function(val):+	"Look-up and return a pretty-printer that can print va."+	+	type = val.type+	+	if type.code == gdb.TYPE_CODE_REF:+		type = type.target()+	+	type = type.unqualified().strip_typedefs()+	+	typename = type.tag+	if typename == None:+		return None+	+	for function in pretty_printers_dict:+		if function.search(typename):+			return pretty_printers_dict[function](val)+	+	return None++pretty_printers_dict = {}++build_eigen_dictionary ()
+ eigen3/debug/msvc/eigen.natvis view
@@ -0,0 +1,235 @@+<?xml version="1.0" encoding="utf-8"?>
+
+<AutoVisualizer xmlns="http://schemas.microsoft.com/vstudio/debugger/natvis/2010">
+
+  <!-- Fixed x Fixed Matrix -->
+  <Type Name="Eigen::Matrix&lt;*,*,*,*,*,*&gt;">      
+      <AlternativeType Name="Eigen::Array&lt;*,-1,-1,*,*,*&gt;"/>
+      <DisplayString>[{$T2}, {$T3}] (fixed matrix)</DisplayString>
+      <Expand>
+        <ArrayItems Condition="Flags%2"> <!-- row major layout -->
+          <Rank>2</Rank>
+          <Size>$i==0 ? $T2 : $T3</Size>
+          <ValuePointer>m_storage.m_data.array</ValuePointer>
+        </ArrayItems>
+        <ArrayItems Condition="!(Flags%2)"> <!-- column major layout -->
+          <Direction>Backward</Direction>
+          <Rank>2</Rank>
+          <Size>$i==0 ? $T2 : $T3</Size>
+          <ValuePointer>m_storage.m_data.array</ValuePointer>
+        </ArrayItems>
+      </Expand>
+  </Type>
+  
+  <!-- 2 x 2 Matrix -->
+  <Type Name="Eigen::Matrix&lt;*,2,2,*,*,*&gt;">      
+      <AlternativeType Name="Eigen::Array&lt;*,2,2,*,*,*&gt;"/>
+      <DisplayString>[2, 2] (fixed matrix)</DisplayString>
+      <Expand>
+        <Synthetic Name="[row 0]" Condition="Flags%2">
+          <DisplayString>({m_storage.m_data.array[0]}, {m_storage.m_data.array[1]})</DisplayString>
+        </Synthetic>
+        <Synthetic Name="[row 0]" Condition="!(Flags%2)">
+          <DisplayString>({m_storage.m_data.array[0]}, {m_storage.m_data.array[2]})</DisplayString>
+        </Synthetic>
+        <Synthetic Name="[row 1]" Condition="Flags%2">
+          <DisplayString>({m_storage.m_data.array[2]}, {m_storage.m_data.array[3]})</DisplayString>
+        </Synthetic>
+        <Synthetic Name="[row 1]" Condition="!(Flags%2)">
+          <DisplayString>({m_storage.m_data.array[1]}, {m_storage.m_data.array[3]})</DisplayString>
+        </Synthetic>        
+      </Expand>
+  </Type>
+  
+  <!-- 3 x 3 Matrix -->
+  <Type Name="Eigen::Matrix&lt;*,3,3,*,*,*&gt;">      
+      <AlternativeType Name="Eigen::Array&lt;*,3,3,*,*,*&gt;"/>
+      <DisplayString>[3, 3] (fixed matrix)</DisplayString>
+      <Expand>
+        <Synthetic Name="[row 0]" Condition="Flags%2">
+          <DisplayString>({m_storage.m_data.array[0]}, {m_storage.m_data.array[1]}, {m_storage.m_data.array[2]})</DisplayString>
+        </Synthetic>
+        <Synthetic Name="[row 0]" Condition="!(Flags%2)">
+          <DisplayString>({m_storage.m_data.array[0]}, {m_storage.m_data.array[3]}, {m_storage.m_data.array[6]})</DisplayString>
+        </Synthetic>
+        <Synthetic Name="[row 1]" Condition="Flags%2">
+          <DisplayString>({m_storage.m_data.array[3]}, {m_storage.m_data.array[4]}, {m_storage.m_data.array[5]})</DisplayString>
+        </Synthetic>
+        <Synthetic Name="[row 1]" Condition="!(Flags%2)">
+          <DisplayString>({m_storage.m_data.array[1]}, {m_storage.m_data.array[4]}, {m_storage.m_data.array[7]})</DisplayString>
+        </Synthetic>
+        <Synthetic Name="[row 2]" Condition="Flags%2">
+          <DisplayString>({m_storage.m_data.array[6]}, {m_storage.m_data.array[7]}, {m_storage.m_data.array[8]})</DisplayString>
+        </Synthetic>
+        <Synthetic Name="[row 2]" Condition="!(Flags%2)">
+          <DisplayString>({m_storage.m_data.array[2]}, {m_storage.m_data.array[5]}, {m_storage.m_data.array[8]})</DisplayString>
+        </Synthetic>        
+      </Expand>
+  </Type>
+  
+  <!-- 4 x 4 Matrix -->
+  <Type Name="Eigen::Matrix&lt;*,4,4,*,*,*&gt;">      
+      <AlternativeType Name="Eigen::Array&lt;*,4,4,*,*,*&gt;"/>
+      <DisplayString>[4, 4] (fixed matrix)</DisplayString>
+      <Expand>
+        <Synthetic Name="[row 0]" Condition="Flags%2">
+          <DisplayString>({m_storage.m_data.array[0]}, {m_storage.m_data.array[1]}, {m_storage.m_data.array[2]}, {m_storage.m_data.array[3]})</DisplayString>
+        </Synthetic>
+        <Synthetic Name="[row 0]" Condition="!(Flags%2)">
+          <DisplayString>({m_storage.m_data.array[0]}, {m_storage.m_data.array[4]}, {m_storage.m_data.array[8]}, {m_storage.m_data.array[12]})</DisplayString>
+        </Synthetic>
+        <Synthetic Name="[row 1]" Condition="Flags%2">
+          <DisplayString>({m_storage.m_data.array[4]}, {m_storage.m_data.array[5]}, {m_storage.m_data.array[6]}, {m_storage.m_data.array[7]})</DisplayString>
+        </Synthetic>
+        <Synthetic Name="[row 1]" Condition="!(Flags%2)">
+          <DisplayString>({m_storage.m_data.array[1]}, {m_storage.m_data.array[5]}, {m_storage.m_data.array[9]}, {m_storage.m_data.array[13]})</DisplayString>
+        </Synthetic>
+        <Synthetic Name="[row 2]" Condition="Flags%2">
+          <DisplayString>({m_storage.m_data.array[8]}, {m_storage.m_data.array[9]}, {m_storage.m_data.array[10]}, {m_storage.m_data.array[11]})</DisplayString>
+        </Synthetic>
+        <Synthetic Name="[row 2]" Condition="!(Flags%2)">
+          <DisplayString>({m_storage.m_data.array[2]}, {m_storage.m_data.array[6]}, {m_storage.m_data.array[10]}, {m_storage.m_data.array[14]})</DisplayString>
+        </Synthetic>
+        <Synthetic Name="[row 3]" Condition="Flags%2">
+          <DisplayString>({m_storage.m_data.array[12]}, {m_storage.m_data.array[13]}, {m_storage.m_data.array[14]}, {m_storage.m_data.array[15]})</DisplayString>
+        </Synthetic>
+        <Synthetic Name="[row 3]" Condition="!(Flags%2)">
+          <DisplayString>({m_storage.m_data.array[3]}, {m_storage.m_data.array[7]}, {m_storage.m_data.array[11]}, {m_storage.m_data.array[15]})</DisplayString>
+        </Synthetic>        
+      </Expand>
+  </Type>  
+  
+  <!-- Dynamic x Dynamic Matrix -->
+  <Type Name="Eigen::Matrix&lt;*,-1,-1,*,*,*&gt;">      
+      <AlternativeType Name="Eigen::Array&lt;*,-1,-1,*,*,*&gt;"/>
+      <DisplayString Condition="m_storage.m_data == 0">empty</DisplayString>
+      <DisplayString Condition="m_storage.m_data != 0">[{m_storage.m_rows}, {m_storage.m_cols}] (dynamic matrix)</DisplayString>
+      <Expand>
+        <ArrayItems Condition="Flags%2"> <!-- row major layout -->
+          <Rank>2</Rank>
+          <Size>$i==0 ? m_storage.m_rows : m_storage.m_cols</Size>
+          <ValuePointer>m_storage.m_data</ValuePointer>
+        </ArrayItems>
+        <ArrayItems Condition="!(Flags%2)"> <!-- column major layout -->
+          <Direction>Backward</Direction>
+          <Rank>2</Rank>
+          <Size>$i==0 ? m_storage.m_rows : m_storage.m_cols</Size>
+          <ValuePointer>m_storage.m_data</ValuePointer>
+        </ArrayItems>
+      </Expand>
+  </Type>
+  
+  <!-- Fixed x Dynamic Matrix -->
+  <Type Name="Eigen::Matrix&lt;*,*,-1,*,*,*&gt;">
+      <AlternativeType Name="Eigen::Array&lt;*,*,-1,*,*,*&gt;"/>
+      <DisplayString Condition="m_storage.m_data == 0">empty</DisplayString>
+      <DisplayString Condition="m_storage.m_data != 0">[{$T2}, {m_storage.m_cols}] (dynamic column matrix)</DisplayString>
+      <Expand>
+        <ArrayItems Condition="Flags%2"> <!-- row major layout -->
+          <Rank>2</Rank>
+          <Size>$i==0 ? $T2 : m_storage.m_cols</Size>
+          <ValuePointer>m_storage.m_data</ValuePointer>
+        </ArrayItems>
+        <ArrayItems Condition="!(Flags%2)"> <!-- column major layout -->
+          <Direction>Backward</Direction>
+          <Rank>2</Rank>
+          <Size>$i==0 ? $T2 : m_storage.m_cols</Size>
+          <ValuePointer>m_storage.m_data</ValuePointer>
+        </ArrayItems>
+      </Expand>
+  </Type>
+  
+  <!-- Dynamic x Fixed Matrix -->
+  <Type Name="Eigen::Matrix&lt;*,-1,*,*,*,*&gt;">
+      <AlternativeType Name="Eigen::Array&lt;*,-1,*,*,*,*&gt;"/>
+      <DisplayString Condition="m_storage.m_data == 0">empty</DisplayString>
+      <DisplayString Condition="m_storage.m_data != 0">[{m_storage.m_rows}, {$T2}] (dynamic row matrix)</DisplayString>
+      <Expand>
+        <ArrayItems Condition="Flags%2"> <!-- row major layout -->
+          <Rank>2</Rank>
+          <Size>$i==0 ? m_storage.m_rows : $T2</Size>
+          <ValuePointer>m_storage.m_data</ValuePointer>
+        </ArrayItems>
+        <ArrayItems Condition="!(Flags%2)"> <!-- column major layout -->
+          <Direction>Backward</Direction>
+          <Rank>2</Rank>
+          <Size>$i==0 ? m_storage.m_rows : $T2</Size>
+          <ValuePointer>m_storage.m_data</ValuePointer>
+        </ArrayItems>
+      </Expand>
+  </Type>
+  
+  <!-- Dynamic Column Vector -->
+  <Type Name="Eigen::Matrix&lt;*,1,-1,*,*,*&gt;">
+      <AlternativeType Name="Eigen::Array&lt;*,1,-1,*,*,*&gt;"/>
+      <DisplayString Condition="m_storage.m_data == 0">empty</DisplayString>
+      <DisplayString Condition="m_storage.m_data != 0">[{m_storage.m_cols}] (dynamic column vector)</DisplayString>
+      <Expand>
+        <Item Name="[size]">m_storage.m_cols</Item>
+        <ArrayItems>
+          <Size>m_storage.m_cols</Size>
+          <ValuePointer>m_storage.m_data</ValuePointer>
+        </ArrayItems>
+      </Expand>
+  </Type>
+  
+  <!-- Dynamic Row Vector -->
+  <Type Name="Eigen::Matrix&lt;*,-1,1,*,*,*&gt;">
+      <AlternativeType Name="Eigen::Array&lt;*,-1,1,*,*,*&gt;"/>
+      <DisplayString Condition="m_storage.m_data == 0">empty</DisplayString>
+      <DisplayString Condition="m_storage.m_data != 0">[{m_storage.m_rows}] (dynamic row vector)</DisplayString>
+      <Expand>
+        <Item Name="[size]">m_storage.m_rows</Item>
+        <ArrayItems>
+          <Size>m_storage.m_rows</Size>
+          <ValuePointer>m_storage.m_data</ValuePointer>
+        </ArrayItems>
+      </Expand>
+  </Type>
+  
+  <!-- Fixed Vector -->
+  <Type Name="Eigen::Matrix&lt;*,1,1,*,*,*&gt;">
+      <AlternativeType Name="Eigen::Array&lt;*,1,1,*,*,*&gt;"/>
+      <DisplayString>[1] ({m_storage.m_data.array[0]})</DisplayString>
+      <Expand>
+        <Item Name="[x]">m_storage.m_data.array[0]</Item>
+      </Expand>
+  </Type>
+  
+  <Type Name="Eigen::Matrix&lt;*,2,1,*,*,*&gt;">
+      <AlternativeType Name="Eigen::Matrix&lt;*,1,2,*,*,*&gt;"/>
+      <AlternativeType Name="Eigen::Array&lt;*,2,1,*,*,*&gt;"/>
+      <AlternativeType Name="Eigen::Array&lt;*,1,2,*,*,*&gt;"/>
+      <DisplayString>[2] ({m_storage.m_data.array[0]}, {m_storage.m_data.array[1]})</DisplayString>
+      <Expand>
+        <Item Name="[x]">m_storage.m_data.array[0]</Item>
+        <Item Name="[y]">m_storage.m_data.array[1]</Item>
+      </Expand>
+  </Type>
+  
+  <Type Name="Eigen::Matrix&lt;*,3,1,*,*,*&gt;">
+      <AlternativeType Name="Eigen::Matrix&lt;*,1,3,*,*,*&gt;"/>
+      <AlternativeType Name="Eigen::Array&lt;*,3,1,*,*,*&gt;"/>
+      <AlternativeType Name="Eigen::Array&lt;*,1,3,*,*,*&gt;"/>
+      <DisplayString>[3] ({m_storage.m_data.array[0]}, {m_storage.m_data.array[1]}, {m_storage.m_data.array[2]})</DisplayString>
+      <Expand>
+        <Item Name="[x]">m_storage.m_data.array[0]</Item>
+        <Item Name="[y]">m_storage.m_data.array[1]</Item>
+        <Item Name="[z]">m_storage.m_data.array[2]</Item>
+      </Expand>
+  </Type>
+  
+    <Type Name="Eigen::Matrix&lt;*,4,1,*,*,*&gt;">
+      <AlternativeType Name="Eigen::Matrix&lt;*,1,4,*,*,*&gt;"/>
+      <AlternativeType Name="Eigen::Array&lt;*,4,1,*,*,*&gt;"/>
+      <AlternativeType Name="Eigen::Array&lt;*,1,4,*,*,*&gt;"/>
+      <DisplayString>[4] ({m_storage.m_data.array[0]}, {m_storage.m_data.array[1]}, {m_storage.m_data.array[2]}, {m_storage.m_data.array[3]})</DisplayString>
+      <Expand>
+        <Item Name="[x]">m_storage.m_data.array[0]</Item>
+        <Item Name="[y]">m_storage.m_data.array[1]</Item>
+        <Item Name="[z]">m_storage.m_data.array[2]</Item>
+        <Item Name="[w]">m_storage.m_data.array[3]</Item>
+      </Expand>
+  </Type>
+
+</AutoVisualizer>
+ eigen3/debug/msvc/eigen_autoexp_part.dat view
@@ -0,0 +1,295 @@+; ***************************************************************
+; * Eigen Visualizer
+; *
+; * Author: Hauke Heibel <hauke.heibel@gmail.com>
+; *
+; * Support the enhanced debugging of the following Eigen
+; * types (*: any, +:fixed dimension) :
+; *
+; * - Eigen::Matrix<*,4,1,*,*,*> and Eigen::Matrix<*,1,4,*,*,*>
+; * - Eigen::Matrix<*,3,1,*,*,*> and Eigen::Matrix<*,1,3,*,*,*>
+; * - Eigen::Matrix<*,2,1,*,*,*> and Eigen::Matrix<*,1,2,*,*,*>
+; * - Eigen::Matrix<*,-1,-1,*,*,*>
+; * - Eigen::Matrix<*,+,-1,*,*,*>
+; * - Eigen::Matrix<*,-1,+,*,*,*>
+; * - Eigen::Matrix<*,+,+,*,*,*>
+; *
+; * Matrices are displayed properly independantly of the memory
+; * alignment (RowMajor vs. ColMajor).
+; *
+; * This file is distributed WITHOUT ANY WARRANTY. Please ensure
+; * that your original autoexp.dat file is copied to a safe 
+; * place before proceeding with its modification.
+; ***************************************************************
+
+[Visualizer]
+
+; Fixed size 4-vectors
+Eigen::Matrix<*,4,1,*,*,*>|Eigen::Matrix<*,1,4,*,*,*>{
+   children
+   (
+      #(
+        [internals]: [$c,!],
+         x : ($c.m_storage.m_data.array)[0],
+         y : ($c.m_storage.m_data.array)[1],
+         z : ($c.m_storage.m_data.array)[2],
+         w : ($c.m_storage.m_data.array)[3]
+      )
+   )
+
+   preview
+   (
+      #(
+        "[",
+        4,
+        "](",
+        #array(expr: $e.m_storage.m_data.array[$i], size: 4),
+        ")"
+      )
+   )
+}
+
+; Fixed size 3-vectors
+Eigen::Matrix<*,3,1,*,*,*>|Eigen::Matrix<*,1,3,*,*,*>{
+   children
+   (
+      #(
+        [internals]: [$c,!],
+         x : ($c.m_storage.m_data.array)[0],
+         y : ($c.m_storage.m_data.array)[1],
+         z : ($c.m_storage.m_data.array)[2]
+      )
+   )
+
+   preview
+   (
+      #(
+        "[",
+        3,
+        "](",
+        #array(expr: $e.m_storage.m_data.array[$i], size: 3),
+        ")"
+      )
+   )
+}
+
+; Fixed size 2-vectors
+Eigen::Matrix<*,2,1,*,*,*>|Eigen::Matrix<*,1,2,*,*,*>{
+   children
+   (
+      #(
+        [internals]: [$c,!],
+         x : ($c.m_storage.m_data.array)[0],
+         y : ($c.m_storage.m_data.array)[1]
+      )
+   )
+
+   preview
+   (
+      #(
+        "[",
+        2,
+        "](",
+        #array(expr: $e.m_storage.m_data.array[$i], size: 2),
+        ")"
+      )
+   )
+}
+
+; Fixed size 1-vectors
+Eigen::Matrix<*,1,1,*,*,*>|Eigen::Matrix<*,1,1,*,*,*>{
+   children
+   (
+      #(
+        [internals]: [$c,!],
+         x : ($c.m_storage.m_data.array)[0]
+      )
+   )
+
+   preview
+   (
+      #(
+        "[",
+        1,
+        "](",
+        #array(expr: $e.m_storage.m_data.array[$i], size: 1),
+        ")"
+      )
+   )
+}
+
+; Dynamic matrices (ColMajor and RowMajor support)
+Eigen::Matrix<*,-1,-1,*,*,*>{
+  children
+   (
+      #(
+         [internals]: [$c,!],
+         rows: $c.m_storage.m_rows,
+         cols: $c.m_storage.m_cols,
+         ; Check for RowMajorBit
+         #if ($c.Flags & 0x1) (
+             #array(
+                rank: 2,
+                base: 0,
+                expr: ($c.m_storage.m_data)[($i % $c.m_storage.m_rows)*$c.m_storage.m_cols + (($i- $i % $c.m_storage.m_rows)/$c.m_storage.m_rows)], 
+                size: ($r==1)*$c.m_storage.m_rows+($r==0)*$c.m_storage.m_cols
+             )
+         ) #else (
+             #array(
+                rank: 2,
+                base: 0,
+                expr: ($c.m_storage.m_data)[$i],
+                size: ($r==1)*$c.m_storage.m_rows+($r==0)*$c.m_storage.m_cols
+             )
+         )
+      )
+   )
+
+   preview
+   (
+     #(
+         "[",
+           $c.m_storage.m_rows,
+         ",",
+           $c.m_storage.m_cols,
+         "](",
+           #array(
+            expr :    [($c.m_storage.m_data)[$i],g],
+            size :    $c.m_storage.m_rows*$c.m_storage.m_cols
+           ),
+         ")"
+      )
+   )
+}
+
+; Fixed rows, dynamic columns matrix (ColMajor and RowMajor support)
+Eigen::Matrix<*,*,-1,*,*,*>{
+  children
+   (
+      #(
+         [internals]: [$c,!],
+         rows: $c.RowsAtCompileTime,
+         cols: $c.m_storage.m_cols,
+         ; Check for RowMajorBit
+         #if ($c.Flags & 0x1) (
+             #array(
+                rank: 2,
+                base: 0,
+                expr: ($c.m_storage.m_data)[($i % $c.RowsAtCompileTime)*$c.m_storage.m_cols + (($i- $i % $c.RowsAtCompileTime)/$c.RowsAtCompileTime)],
+                size: ($r==1)*$c.RowsAtCompileTime+($r==0)*$c.m_storage.m_cols
+             )
+         ) #else (
+             #array(
+                rank: 2,
+                base: 0,
+                expr: ($c.m_storage.m_data)[$i],
+                size: ($r==1)*$c.RowsAtCompileTime+($r==0)*$c.m_storage.m_cols
+             )
+         )
+      )
+   )
+
+   preview
+   (
+     #(
+         "[",
+           $c.RowsAtCompileTime,
+         ",",
+           $c.m_storage.m_cols,
+         "](",
+           #array(
+            expr :    [($c.m_storage.m_data)[$i],g],
+            size :    $c.RowsAtCompileTime*$c.m_storage.m_cols
+           ),
+         ")"
+      )
+   )
+}
+
+; Dynamic rows, fixed columns matrix (ColMajor and RowMajor support)
+Eigen::Matrix<*,-1,*,*,*,*>{
+  children
+   (
+      #(
+         [internals]: [$c,!],
+         rows: $c.m_storage.m_rows,
+         cols: $c.ColsAtCompileTime,
+         ; Check for RowMajorBit
+         #if ($c.Flags & 0x1) (
+             #array(
+                rank: 2,
+                base: 0,
+                expr: ($c.m_storage.m_data)[($i % $c.m_storage.m_rows)*$c.ColsAtCompileTime + (($i- $i % $c.m_storage.m_rows)/$c.m_storage.m_rows)], 
+                size: ($r==1)*$c.m_storage.m_rows+($r==0)*$c.ColsAtCompileTime
+             )
+         ) #else (
+             #array(
+                rank: 2,
+                base: 0,
+                expr: ($c.m_storage.m_data)[$i],
+                size: ($r==1)*$c.m_storage.m_rows+($r==0)*$c.ColsAtCompileTime
+             )
+         )
+      )
+   )
+
+   preview
+   (
+     #(
+         "[",
+           $c.m_storage.m_rows,
+         ",",
+           $c.ColsAtCompileTime,
+         "](",
+           #array(
+            expr :    [($c.m_storage.m_data)[$i],g],
+            size :    $c.m_storage.m_rows*$c.ColsAtCompileTime
+           ),
+         ")"
+      )
+   )
+}
+
+; Fixed size matrix (ColMajor and RowMajor support)
+Eigen::Matrix<*,*,*,*,*,*>{
+  children
+   (
+      #(
+         [internals]: [$c,!],
+         rows: $c.RowsAtCompileTime,
+         cols: $c.ColsAtCompileTime,
+         ; Check for RowMajorBit
+         #if ($c.Flags & 0x1) (
+             #array(
+                rank: 2,
+                base: 0,
+                expr: ($c.m_storage.m_data.array)[($i % $c.RowsAtCompileTime)*$c.ColsAtCompileTime + (($i- $i % $c.RowsAtCompileTime)/$c.RowsAtCompileTime)], 
+                size: ($r==1)*$c.RowsAtCompileTime+($r==0)*$c.ColsAtCompileTime
+             )
+         ) #else (
+             #array(
+                rank: 2,
+                base: 0,
+                expr: ($c.m_storage.m_data.array)[$i],
+                size: ($r==1)*$c.RowsAtCompileTime+($r==0)*$c.ColsAtCompileTime
+             )
+         )
+      )
+   )
+
+   preview
+   (
+     #(
+         "[",
+           $c.RowsAtCompileTime,
+         ",",
+           $c.ColsAtCompileTime,
+         "](",
+           #array(
+            expr :    [($c.m_storage.m_data.array)[$i],g],
+            size :    $c.RowsAtCompileTime*$c.ColsAtCompileTime
+           ),
+         ")"
+      )
+   )
+}
+ eigen3/demos/CMakeLists.txt view
@@ -0,0 +1,13 @@+project(EigenDemos)++add_custom_target(demos)++if(NOT EIGEN_TEST_NOQT)+  find_package(Qt4)+  if(QT4_FOUND)+    add_subdirectory(mandelbrot)+    add_subdirectory(opengl)+  else(QT4_FOUND)+    message(STATUS "Qt4 not found, so disabling the mandelbrot and opengl demos")+  endif(QT4_FOUND)+endif()
+ eigen3/demos/mandelbrot/CMakeLists.txt view
@@ -0,0 +1,21 @@+find_package(Qt4 REQUIRED)++set(CMAKE_INCLUDE_CURRENT_DIR ON)++if (CMAKE_COMPILER_IS_GNUCXX)+   set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O2")+   add_definitions ( "-DNDEBUG" )+endif (CMAKE_COMPILER_IS_GNUCXX)++include_directories( ${QT_INCLUDE_DIR} )++set(mandelbrot_SRCS+    mandelbrot.cpp+)++qt4_automoc(${mandelbrot_SRCS})++add_executable(mandelbrot ${mandelbrot_SRCS})+add_dependencies(demos mandelbrot)++target_link_libraries(mandelbrot ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY})
+ eigen3/demos/mandelbrot/README view
@@ -0,0 +1,10 @@+*** Mandelbrot demo ***++Controls:+* Left mouse button to center view at a point.+* Drag vertically with left mouse button to zoom in and out.++Be sure to enable SSE2 or AltiVec to improve performance.++The number of iterations, and the choice between single and double precision, are+determined at runtime depending on the zoom level.
+ eigen3/demos/mandelbrot/mandelbrot.cpp view
@@ -0,0 +1,213 @@+// This file is part of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2008 Benoit Jacob <jacob.benoit.1@gmail.com>+//+// 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 "mandelbrot.h"+#include <iostream>+#include<QtGui/QPainter>+#include<QtGui/QImage>+#include<QtGui/QMouseEvent>+#include<QtCore/QTime>++void MandelbrotWidget::resizeEvent(QResizeEvent *)+{+  if(size < width() * height())+  {+    std::cout << "reallocate buffer" << std::endl;+    size = width() * height();+    if(buffer) delete[]buffer;+    buffer = new unsigned char[4*size];+  }+}++template<typename T> struct iters_before_test { enum { ret = 8 }; };+template<> struct iters_before_test<double> { enum { ret = 16 }; };++template<typename Real> void MandelbrotThread::render(int img_width, int img_height)+{+  enum { packetSize = Eigen::internal::packet_traits<Real>::size }; // number of reals in a Packet+  typedef Eigen::Array<Real, packetSize, 1> Packet; // wrap a Packet as a vector++  enum { iters_before_test = iters_before_test<Real>::ret };+  max_iter = (max_iter / iters_before_test) * iters_before_test;+  const int alignedWidth = (img_width/packetSize)*packetSize;+  unsigned char *const buffer = widget->buffer;+  const double xradius = widget->xradius;+  const double yradius = xradius * img_height / img_width;+  const int threadcount = widget->threadcount;+  typedef Eigen::Array<Real, 2, 1> Vector2;+  Vector2 start(widget->center.x() - widget->xradius, widget->center.y() - yradius);+  Vector2 step(2*widget->xradius/img_width, 2*yradius/img_height);+  total_iter = 0;++  for(int y = id; y < img_height; y += threadcount)+  {+    int pix = y * img_width;++    // for each pixel, we're going to do the iteration z := z^2 + c where z and c are complex numbers, +    // starting with z = c = complex coord of the pixel. pzi and pzr denote the real and imaginary parts of z.+    // pci and pcr denote the real and imaginary parts of c.++    Packet pzi_start, pci_start;+    for(int i = 0; i < packetSize; i++) pzi_start[i] = pci_start[i] = start.y() + y * step.y();++    for(int x = 0; x < alignedWidth; x += packetSize, pix += packetSize)+    {+      Packet pcr, pci = pci_start, pzr, pzi = pzi_start, pzr_buf;+      for(int i = 0; i < packetSize; i++) pzr[i] = pcr[i] = start.x() + (x+i) * step.x();++      // do the iterations. Every iters_before_test iterations we check for divergence,+      // in which case we can stop iterating.+      int j = 0;+      typedef Eigen::Matrix<int, packetSize, 1> Packeti;+      Packeti pix_iter = Packeti::Zero(), // number of iteration per pixel in the packet+              pix_dont_diverge; // whether or not each pixel has already diverged+      do+      {+        for(int i = 0; i < iters_before_test/4; i++) // peel the inner loop by 4+        {+#         define ITERATE \+            pzr_buf = pzr; \+            pzr = pzr.square(); \+            pzr -= pzi.square(); \+            pzr += pcr; \+            pzi = (2*pzr_buf)*pzi; \+            pzi += pci;+          ITERATE ITERATE ITERATE ITERATE+        }+        pix_dont_diverge = ((pzr.square() + pzi.square())+                           .eval() // temporary fix as what follows is not yet vectorized by Eigen+                           <= Packet::Constant(4))+                                // the 4 here is not a magic value, it's a math fact that if+                                // the square modulus is >4 then divergence is inevitable.+                           .template cast<int>();+        pix_iter += iters_before_test * pix_dont_diverge;+        j++;+        total_iter += iters_before_test * packetSize;+      }+      while(j < max_iter/iters_before_test && pix_dont_diverge.any()); // any() is not yet vectorized by Eigen++      // compute pixel colors+      for(int i = 0; i < packetSize; i++)+      {+        buffer[4*(pix+i)] = 255*pix_iter[i]/max_iter;+        buffer[4*(pix+i)+1] = 0;+        buffer[4*(pix+i)+2] = 0;+      }+    }++    // if the width is not a multiple of packetSize, fill the remainder in black+    for(int x = alignedWidth; x < img_width; x++, pix++)+      buffer[4*pix] = buffer[4*pix+1] = buffer[4*pix+2] = 0;+  }+  return;+}++void MandelbrotThread::run()+{+  setTerminationEnabled(true);+  double resolution = widget->xradius*2/widget->width();+  max_iter = 128;+  if(resolution < 1e-4f) max_iter += 128 * ( - 4 - std::log10(resolution));+  int img_width = widget->width()/widget->draft;+  int img_height = widget->height()/widget->draft;+  single_precision = resolution > 1e-7f;++  if(single_precision)+    render<float>(img_width, img_height);+  else+    render<double>(img_width, img_height);+}++void MandelbrotWidget::paintEvent(QPaintEvent *)+{+  static float max_speed = 0;+  long long total_iter = 0;++  QTime time;+  time.start();+  for(int th = 0; th < threadcount; th++)+    threads[th]->start(QThread::LowPriority);+  for(int th = 0; th < threadcount; th++)+  {+    threads[th]->wait();+    total_iter += threads[th]->total_iter;+  }+  int elapsed = time.elapsed();++  if(draft == 1)+  {+    float speed = elapsed ? float(total_iter)*1000/elapsed : 0;+    max_speed = std::max(max_speed, speed);+    std::cout << threadcount << " threads, "+              << elapsed << " ms, "+              << speed << " iters/s (max " << max_speed << ")" << std::endl;+    int packetSize = threads[0]->single_precision+                   ? int(Eigen::internal::packet_traits<float>::size)+                   : int(Eigen::internal::packet_traits<double>::size);+    setWindowTitle(QString("resolution ")+QString::number(xradius*2/width(), 'e', 2)+                  +QString(", %1 iterations per pixel, ").arg(threads[0]->max_iter)+                  +(threads[0]->single_precision ? QString("single ") : QString("double "))+                  +QString("precision, ")+                  +(packetSize==1 ? QString("no vectorization")+                                  : QString("vectorized (%1 per packet)").arg(packetSize)));+  }+  +  QImage image(buffer, width()/draft, height()/draft, QImage::Format_RGB32);+  QPainter painter(this);+  painter.drawImage(QPoint(0, 0), image.scaled(width(), height()));++  if(draft>1)+  {+    draft /= 2;+    setWindowTitle(QString("recomputing at 1/%1 resolution...").arg(draft));+    update();+  }+}++void MandelbrotWidget::mousePressEvent(QMouseEvent *event)+{+  if( event->buttons() & Qt::LeftButton )+  {+    lastpos = event->pos();+    double yradius = xradius * height() / width();+    center = Eigen::Vector2d(center.x() + (event->pos().x() - width()/2) * xradius * 2 / width(),+                             center.y() + (event->pos().y() - height()/2) * yradius * 2 / height());+    draft = 16;+    for(int th = 0; th < threadcount; th++)+      threads[th]->terminate();+    update();+  }+}++void MandelbrotWidget::mouseMoveEvent(QMouseEvent *event)+{+  QPoint delta = event->pos() - lastpos;+  lastpos = event->pos();+  if( event->buttons() & Qt::LeftButton )+  {+    double t = 1 + 5 * double(delta.y()) / height();+    if(t < 0.5) t = 0.5;+    if(t > 2) t = 2;+    xradius *= t;+    draft = 16;+    for(int th = 0; th < threadcount; th++)+      threads[th]->terminate();+    update();+  }+}++int main(int argc, char *argv[])+{+  QApplication app(argc, argv);+  MandelbrotWidget w;+  w.show();+  return app.exec();+}++#include "mandelbrot.moc"
+ eigen3/demos/mandelbrot/mandelbrot.h view
@@ -0,0 +1,71 @@+// This file is part of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2008 Benoit Jacob <jacob.benoit.1@gmail.com>+//+// 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 MANDELBROT_H+#define MANDELBROT_H++#include <Eigen/Core>+#include <QtGui/QApplication>+#include <QtGui/QWidget>+#include <QtCore/QThread>++class MandelbrotWidget;++class MandelbrotThread : public QThread+{+    friend class MandelbrotWidget;+    MandelbrotWidget *widget;+    long long total_iter;+    int id, max_iter;+    bool single_precision;++  public:+    MandelbrotThread(MandelbrotWidget *w, int i) : widget(w), id(i) {}+    void run();+    template<typename Real> void render(int img_width, int img_height);+};++class MandelbrotWidget : public QWidget+{+    Q_OBJECT++    friend class MandelbrotThread;+    Eigen::Vector2d center;+    double xradius;+    int size;+    unsigned char *buffer;+    QPoint lastpos;+    int draft;+    MandelbrotThread **threads;+    int threadcount;++  protected:+    void resizeEvent(QResizeEvent *);+    void paintEvent(QPaintEvent *);+    void mousePressEvent(QMouseEvent *event);+    void mouseMoveEvent(QMouseEvent *event);++  public:+    MandelbrotWidget() : QWidget(), center(0,0), xradius(2),+                         size(0), buffer(0), draft(16)+    {+      setAutoFillBackground(false);+      threadcount = QThread::idealThreadCount();+      threads = new MandelbrotThread*[threadcount];+      for(int th = 0; th < threadcount; th++) threads[th] = new MandelbrotThread(this, th);+    }+    ~MandelbrotWidget()+    {+      if(buffer) delete[]buffer;+      for(int th = 0; th < threadcount; th++) delete threads[th];+      delete[] threads;+    }+};++#endif // MANDELBROT_H
+ eigen3/demos/mix_eigen_and_c/README view
@@ -0,0 +1,9 @@+This is an example of how one can wrap some of Eigen into a C library.++To try this with GCC, do:++  g++ -c binary_library.cpp -O2 -msse2 -I ../..+  gcc example.c binary_library.o -o example -lstdc+++  ./example++TODO: add CMakeLists, add more explanations here
+ eigen3/demos/mix_eigen_and_c/binary_library.cpp view
@@ -0,0 +1,185 @@+// This file is part of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2009 Benoit Jacob <jacob.benoit.1@gmail.com>+//+// 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 C++ file compiles to binary code that can be linked to by your C program,+// thanks to the extern "C" syntax used in the declarations in binary_library.h.++#include "binary_library.h"++#include <Eigen/Core>++using namespace Eigen;++/************************* pointer conversion methods **********************************************/++////// class MatrixXd //////++inline MatrixXd& c_to_eigen(C_MatrixXd* ptr)+{+  return *reinterpret_cast<MatrixXd*>(ptr);+}++inline const MatrixXd& c_to_eigen(const C_MatrixXd* ptr)+{+  return *reinterpret_cast<const MatrixXd*>(ptr);+}++inline C_MatrixXd* eigen_to_c(MatrixXd& ref)+{+  return reinterpret_cast<C_MatrixXd*>(&ref);+}++inline const C_MatrixXd* eigen_to_c(const MatrixXd& ref)+{+  return reinterpret_cast<const C_MatrixXd*>(&ref);+}++////// class Map<MatrixXd> //////++inline Map<MatrixXd>& c_to_eigen(C_Map_MatrixXd* ptr)+{+  return *reinterpret_cast<Map<MatrixXd>*>(ptr);+}++inline const Map<MatrixXd>& c_to_eigen(const C_Map_MatrixXd* ptr)+{+  return *reinterpret_cast<const Map<MatrixXd>*>(ptr);+}++inline C_Map_MatrixXd* eigen_to_c(Map<MatrixXd>& ref)+{+  return reinterpret_cast<C_Map_MatrixXd*>(&ref);+}++inline const C_Map_MatrixXd* eigen_to_c(const Map<MatrixXd>& ref)+{+  return reinterpret_cast<const C_Map_MatrixXd*>(&ref);+}+++/************************* implementation of classes **********************************************/+++////// class MatrixXd //////+++C_MatrixXd* MatrixXd_new(int rows, int cols)+{+  return eigen_to_c(*new MatrixXd(rows,cols));+}++void MatrixXd_delete(C_MatrixXd *m)+{+  delete &c_to_eigen(m);+}++double* MatrixXd_data(C_MatrixXd *m)+{+  return c_to_eigen(m).data();+}++void MatrixXd_set_zero(C_MatrixXd *m)+{+  c_to_eigen(m).setZero();+}++void MatrixXd_resize(C_MatrixXd *m, int rows, int cols)+{+  c_to_eigen(m).resize(rows,cols);+}++void MatrixXd_copy(C_MatrixXd *dst, const C_MatrixXd *src)+{+  c_to_eigen(dst) = c_to_eigen(src);+}++void MatrixXd_copy_map(C_MatrixXd *dst, const C_Map_MatrixXd *src)+{+  c_to_eigen(dst) = c_to_eigen(src);+}++void MatrixXd_set_coeff(C_MatrixXd *m, int i, int j, double coeff)+{+  c_to_eigen(m)(i,j) = coeff;+}++double MatrixXd_get_coeff(const C_MatrixXd *m, int i, int j)+{+  return c_to_eigen(m)(i,j);+}++void MatrixXd_print(const C_MatrixXd *m)+{+  std::cout << c_to_eigen(m) << std::endl;+}++void MatrixXd_multiply(const C_MatrixXd *m1, const C_MatrixXd *m2, C_MatrixXd *result)+{+  c_to_eigen(result) = c_to_eigen(m1) * c_to_eigen(m2);+}++void MatrixXd_add(const C_MatrixXd *m1, const C_MatrixXd *m2, C_MatrixXd *result)+{+  c_to_eigen(result) = c_to_eigen(m1) + c_to_eigen(m2);+}++++////// class Map_MatrixXd //////+++C_Map_MatrixXd* Map_MatrixXd_new(double *array, int rows, int cols)+{+  return eigen_to_c(*new Map<MatrixXd>(array,rows,cols));+}++void Map_MatrixXd_delete(C_Map_MatrixXd *m)+{+  delete &c_to_eigen(m);+}++void Map_MatrixXd_set_zero(C_Map_MatrixXd *m)+{+  c_to_eigen(m).setZero();+}++void Map_MatrixXd_copy(C_Map_MatrixXd *dst, const C_Map_MatrixXd *src)+{+  c_to_eigen(dst) = c_to_eigen(src);+}++void Map_MatrixXd_copy_matrix(C_Map_MatrixXd *dst, const C_MatrixXd *src)+{+  c_to_eigen(dst) = c_to_eigen(src);+}++void Map_MatrixXd_set_coeff(C_Map_MatrixXd *m, int i, int j, double coeff)+{+  c_to_eigen(m)(i,j) = coeff;+}++double Map_MatrixXd_get_coeff(const C_Map_MatrixXd *m, int i, int j)+{+  return c_to_eigen(m)(i,j);+}++void Map_MatrixXd_print(const C_Map_MatrixXd *m)+{+  std::cout << c_to_eigen(m) << std::endl;+}++void Map_MatrixXd_multiply(const C_Map_MatrixXd *m1, const C_Map_MatrixXd *m2, C_Map_MatrixXd *result)+{+  c_to_eigen(result) = c_to_eigen(m1) * c_to_eigen(m2);+}++void Map_MatrixXd_add(const C_Map_MatrixXd *m1, const C_Map_MatrixXd *m2, C_Map_MatrixXd *result)+{+  c_to_eigen(result) = c_to_eigen(m1) + c_to_eigen(m2);+}
+ eigen3/demos/mix_eigen_and_c/binary_library.h view
@@ -0,0 +1,71 @@+// This file is part of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2009 Benoit Jacob <jacob.benoit.1@gmail.com>+//+// 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 is a pure C header, no C++ here.+// The functions declared here will be implemented in C++ but+// we don't have to know, because thanks to the extern "C" syntax,+// they will be compiled to C object code.++#ifdef __cplusplus+extern "C"+{+#endif++  // just dummy empty structs to give different pointer types,+  // instead of using void* which would be type unsafe+  struct C_MatrixXd {};+  struct C_Map_MatrixXd {};++  // the C_MatrixXd class, wraps some of the functionality+  // of Eigen::MatrixXd.+  struct C_MatrixXd* MatrixXd_new(int rows, int cols);+  void    MatrixXd_delete     (struct C_MatrixXd *m);+  double* MatrixXd_data       (struct C_MatrixXd *m);+  void    MatrixXd_set_zero   (struct C_MatrixXd *m);+  void    MatrixXd_resize     (struct C_MatrixXd *m, int rows, int cols);+  void    MatrixXd_copy       (struct C_MatrixXd *dst,+                               const struct C_MatrixXd *src);+  void    MatrixXd_copy_map   (struct C_MatrixXd *dst,+                               const struct C_Map_MatrixXd *src);  +  void    MatrixXd_set_coeff  (struct C_MatrixXd *m,+                               int i, int j, double coeff);+  double  MatrixXd_get_coeff  (const struct C_MatrixXd *m,+                               int i, int j);+  void    MatrixXd_print      (const struct C_MatrixXd *m);+  void    MatrixXd_add        (const struct C_MatrixXd *m1,+                               const struct C_MatrixXd *m2,+                               struct C_MatrixXd *result);  +  void    MatrixXd_multiply   (const struct C_MatrixXd *m1,+                               const struct C_MatrixXd *m2,+                               struct C_MatrixXd *result);+  +  // the C_Map_MatrixXd class, wraps some of the functionality+  // of Eigen::Map<MatrixXd>+  struct C_Map_MatrixXd* Map_MatrixXd_new(double *array, int rows, int cols);+  void   Map_MatrixXd_delete     (struct C_Map_MatrixXd *m);+  void   Map_MatrixXd_set_zero   (struct C_Map_MatrixXd *m);+  void   Map_MatrixXd_copy       (struct C_Map_MatrixXd *dst,+                                  const struct C_Map_MatrixXd *src);+  void   Map_MatrixXd_copy_matrix(struct C_Map_MatrixXd *dst,+                                  const struct C_MatrixXd *src);  +  void   Map_MatrixXd_set_coeff  (struct C_Map_MatrixXd *m,+                                  int i, int j, double coeff);+  double Map_MatrixXd_get_coeff  (const struct C_Map_MatrixXd *m,+                                  int i, int j);+  void   Map_MatrixXd_print      (const struct C_Map_MatrixXd *m);+  void   Map_MatrixXd_add        (const struct C_Map_MatrixXd *m1,+                                  const struct C_Map_MatrixXd *m2,+                                  struct C_Map_MatrixXd *result);  +  void   Map_MatrixXd_multiply   (const struct C_Map_MatrixXd *m1,+                                  const struct C_Map_MatrixXd *m2,+                                  struct C_Map_MatrixXd *result);++#ifdef __cplusplus+} // end extern "C"+#endif
+ eigen3/demos/mix_eigen_and_c/example.c view
@@ -0,0 +1,65 @@+// This file is part of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2009 Benoit Jacob <jacob.benoit.1@gmail.com>+//+// 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 "binary_library.h"+#include "stdio.h"++void demo_MatrixXd()+{+  struct C_MatrixXd *matrix1, *matrix2, *result;+  printf("*** demo_MatrixXd ***\n");+  +  matrix1 = MatrixXd_new(3, 3);+  MatrixXd_set_zero(matrix1);+  MatrixXd_set_coeff(matrix1, 0, 1, 2.5);+  MatrixXd_set_coeff(matrix1, 1, 0, 1.4);+  printf("Here is matrix1:\n");+  MatrixXd_print(matrix1);++  matrix2 = MatrixXd_new(3, 3);+  MatrixXd_multiply(matrix1, matrix1, matrix2);+  printf("Here is matrix1*matrix1:\n");+  MatrixXd_print(matrix2);++  MatrixXd_delete(matrix1);+  MatrixXd_delete(matrix2);+}++// this helper function takes a plain C array and prints it in one line+void print_array(double *array, int n)+{+  struct C_Map_MatrixXd *m = Map_MatrixXd_new(array, 1, n);+  Map_MatrixXd_print(m);+  Map_MatrixXd_delete(m);+}++void demo_Map_MatrixXd()+{+  struct C_Map_MatrixXd *map;+  double array[5];+  int i;+  printf("*** demo_Map_MatrixXd ***\n");+  +  for(i = 0; i < 5; ++i) array[i] = i;+  printf("Initially, the array is:\n");+  print_array(array, 5);+  +  map = Map_MatrixXd_new(array, 5, 1);+  Map_MatrixXd_add(map, map, map);+  Map_MatrixXd_delete(map);++  printf("Now the array is:\n");+  print_array(array, 5);+}++int main()+{+  demo_MatrixXd();+  demo_Map_MatrixXd();+}
+ eigen3/demos/opengl/CMakeLists.txt view
@@ -0,0 +1,28 @@+find_package(Qt4)+find_package(OpenGL)++if(QT4_FOUND AND OPENGL_FOUND)++  set(QT_USE_QTOPENGL TRUE)+  include(${QT_USE_FILE})++  set(CMAKE_INCLUDE_CURRENT_DIR ON)++  include_directories( ${QT_INCLUDE_DIR} )++  set(quaternion_demo_SRCS  gpuhelper.cpp icosphere.cpp camera.cpp trackball.cpp quaternion_demo.cpp)++  qt4_automoc(${quaternion_demo_SRCS})++  add_executable(quaternion_demo ${quaternion_demo_SRCS})+  add_dependencies(demos quaternion_demo)++  target_link_libraries(quaternion_demo+    ${QT_QTCORE_LIBRARY}    ${QT_QTGUI_LIBRARY}+    ${QT_QTOPENGL_LIBRARY}  ${OPENGL_LIBRARIES} )++else()++  message(STATUS "OpenGL demo disabled because Qt4 and/or OpenGL have not been found.")++endif()
+ eigen3/demos/opengl/README view
@@ -0,0 +1,13 @@++Navigation:+ left button:           rotate around the target+ middle button:         zoom+ left button + ctrl     quake rotate (rotate around camera position)+ middle button + ctrl   walk (progress along camera's z direction)+ left button:           pan (translate in the XY camera's plane)++R : move the camera to initial position+A : start/stop animation+C : clear the animation+G : add a key frame+
+ eigen3/demos/opengl/camera.cpp view
@@ -0,0 +1,264 @@+// This file is part of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2008 Gael Guennebaud <gael.guennebaud@inria.fr>+//+// 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 "camera.h"++#include "gpuhelper.h"+#include <GL/glu.h>++#include "Eigen/LU"+using namespace Eigen;++Camera::Camera()+    : mViewIsUptodate(false), mProjIsUptodate(false)+{+    mViewMatrix.setIdentity();+    +    mFovY = M_PI/3.;+    mNearDist = 1.;+    mFarDist = 50000.;+    +    mVpX = 0;+    mVpY = 0;++    setPosition(Vector3f::Constant(100.));+    setTarget(Vector3f::Zero());+}++Camera& Camera::operator=(const Camera& other)+{+    mViewIsUptodate = false;+    mProjIsUptodate = false;+    +    mVpX = other.mVpX;+    mVpY = other.mVpY;+    mVpWidth = other.mVpWidth;+    mVpHeight = other.mVpHeight;++    mTarget = other.mTarget;+    mFovY = other.mFovY;+    mNearDist = other.mNearDist;+    mFarDist = other.mFarDist;+    +    mViewMatrix = other.mViewMatrix;+    mProjectionMatrix = other.mProjectionMatrix;++    return *this;+}++Camera::Camera(const Camera& other)+{+    *this = other;+}++Camera::~Camera()+{+}+++void Camera::setViewport(uint offsetx, uint offsety, uint width, uint height)+{+    mVpX = offsetx;+    mVpY = offsety;+    mVpWidth = width;+    mVpHeight = height;+    +    mProjIsUptodate = false;+}++void Camera::setViewport(uint width, uint height)+{+    mVpWidth = width;+    mVpHeight = height;+    +    mProjIsUptodate = false;+}++void Camera::setFovY(float value)+{+    mFovY = value;+    mProjIsUptodate = false;+}++Vector3f Camera::direction(void) const+{+    return - (orientation() * Vector3f::UnitZ());+}+Vector3f Camera::up(void) const+{+    return orientation() * Vector3f::UnitY();+}+Vector3f Camera::right(void) const+{+    return orientation() * Vector3f::UnitX();+}++void Camera::setDirection(const Vector3f& newDirection)+{+    // TODO implement it computing the rotation between newDirection and current dir ?+    Vector3f up = this->up();+    +    Matrix3f camAxes;++    camAxes.col(2) = (-newDirection).normalized();+    camAxes.col(0) = up.cross( camAxes.col(2) ).normalized();+    camAxes.col(1) = camAxes.col(2).cross( camAxes.col(0) ).normalized();+    setOrientation(Quaternionf(camAxes));+    +    mViewIsUptodate = false;+}++void Camera::setTarget(const Vector3f& target)+{+    mTarget = target;+    if (!mTarget.isApprox(position()))+    {+        Vector3f newDirection = mTarget - position();+        setDirection(newDirection.normalized());+    }+}++void Camera::setPosition(const Vector3f& p)+{+    mFrame.position = p;+    mViewIsUptodate = false;+}++void Camera::setOrientation(const Quaternionf& q)+{+    mFrame.orientation = q;+    mViewIsUptodate = false;+}++void Camera::setFrame(const Frame& f)+{+  mFrame = f;+  mViewIsUptodate = false;+}++void Camera::rotateAroundTarget(const Quaternionf& q)+{+    Matrix4f mrot, mt, mtm;+    +    // update the transform matrix+    updateViewMatrix();+    Vector3f t = mViewMatrix * mTarget;++    mViewMatrix = Translation3f(t)+                * q+                * Translation3f(-t)+                * mViewMatrix;+    +    Quaternionf qa(mViewMatrix.linear());+    qa = qa.conjugate();+    setOrientation(qa);+    setPosition(- (qa * mViewMatrix.translation()) );++    mViewIsUptodate = true;+}++void Camera::localRotate(const Quaternionf& q)+{+    float dist = (position() - mTarget).norm();+    setOrientation(orientation() * q);+    mTarget = position() + dist * direction();+    mViewIsUptodate = false;+}++void Camera::zoom(float d)+{+    float dist = (position() - mTarget).norm();+    if(dist > d)+    {+        setPosition(position() + direction() * d);+        mViewIsUptodate = false;+    }+}++void Camera::localTranslate(const Vector3f& t)+{+  Vector3f trans = orientation() * t;+  setPosition( position() + trans );+  setTarget( mTarget + trans );++  mViewIsUptodate = false;+}++void Camera::updateViewMatrix(void) const+{+    if(!mViewIsUptodate)+    {+        Quaternionf q = orientation().conjugate();+        mViewMatrix.linear() = q.toRotationMatrix();+        mViewMatrix.translation() = - (mViewMatrix.linear() * position());++        mViewIsUptodate = true;+    }+}++const Affine3f& Camera::viewMatrix(void) const+{+  updateViewMatrix();+  return mViewMatrix;+}++void Camera::updateProjectionMatrix(void) const+{+  if(!mProjIsUptodate)+  {+    mProjectionMatrix.setIdentity();+    float aspect = float(mVpWidth)/float(mVpHeight);+    float theta = mFovY*0.5;+    float range = mFarDist - mNearDist;+    float invtan = 1./tan(theta);++    mProjectionMatrix(0,0) = invtan / aspect;+    mProjectionMatrix(1,1) = invtan;+    mProjectionMatrix(2,2) = -(mNearDist + mFarDist) / range;+    mProjectionMatrix(3,2) = -1;+    mProjectionMatrix(2,3) = -2 * mNearDist * mFarDist / range;+    mProjectionMatrix(3,3) = 0;+    +    mProjIsUptodate = true;+  }+}++const Matrix4f& Camera::projectionMatrix(void) const+{+  updateProjectionMatrix();+  return mProjectionMatrix;+}++void Camera::activateGL(void)+{+  glViewport(vpX(), vpY(), vpWidth(), vpHeight());+  gpu.loadMatrix(projectionMatrix(),GL_PROJECTION);+  gpu.loadMatrix(viewMatrix().matrix(),GL_MODELVIEW);+}+++Vector3f Camera::unProject(const Vector2f& uv, float depth) const+{+    Matrix4f inv = mViewMatrix.inverse().matrix();+    return unProject(uv, depth, inv);+}++Vector3f Camera::unProject(const Vector2f& uv, float depth, const Matrix4f& invModelview) const+{+    updateViewMatrix();+    updateProjectionMatrix();+    +    Vector3f a(2.*uv.x()/float(mVpWidth)-1., 2.*uv.y()/float(mVpHeight)-1., 1.);+    a.x() *= depth/mProjectionMatrix(0,0);+    a.y() *= depth/mProjectionMatrix(1,1);+    a.z() = -depth;+    // FIXME /\/|+    Vector4f b = invModelview * Vector4f(a.x(), a.y(), a.z(), 1.);+    return Vector3f(b.x(), b.y(), b.z());+}
+ eigen3/demos/opengl/camera.h view
@@ -0,0 +1,118 @@+// This file is part of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2008 Gael Guennebaud <gael.guennebaud@inria.fr>+//+// 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_CAMERA_H+#define EIGEN_CAMERA_H++#include <Eigen/Geometry>+#include <QObject>+// #include <frame.h>++class Frame+{+  public:+    EIGEN_MAKE_ALIGNED_OPERATOR_NEW+    +    inline Frame(const Eigen::Vector3f& pos = Eigen::Vector3f::Zero(),+                 const Eigen::Quaternionf& o = Eigen::Quaternionf())+      : orientation(o), position(pos)+    {}+    Frame lerp(float alpha, const Frame& other) const+    {+      return Frame((1.f-alpha)*position + alpha * other.position,+                   orientation.slerp(alpha,other.orientation));+    }++    Eigen::Quaternionf orientation;+    Eigen::Vector3f position;+};++class Camera+{+  public:+    EIGEN_MAKE_ALIGNED_OPERATOR_NEW++    Camera(void);+    +    Camera(const Camera& other);+    +    virtual ~Camera();+    +    Camera& operator=(const Camera& other);+    +    void setViewport(uint offsetx, uint offsety, uint width, uint height);+    void setViewport(uint width, uint height);+    +    inline uint vpX(void) const { return mVpX; }+    inline uint vpY(void) const { return mVpY; }+    inline uint vpWidth(void) const { return mVpWidth; }+    inline uint vpHeight(void) const { return mVpHeight; }++    inline float fovY(void) const { return mFovY; }+    void setFovY(float value);+    +    void setPosition(const Eigen::Vector3f& pos);+    inline const Eigen::Vector3f& position(void) const { return mFrame.position; }++    void setOrientation(const Eigen::Quaternionf& q);+    inline const Eigen::Quaternionf& orientation(void) const { return mFrame.orientation; }++    void setFrame(const Frame& f);+    const Frame& frame(void) const { return mFrame; }+    +    void setDirection(const Eigen::Vector3f& newDirection);+    Eigen::Vector3f direction(void) const;+    void setUp(const Eigen::Vector3f& vectorUp);+    Eigen::Vector3f up(void) const;+    Eigen::Vector3f right(void) const;+    +    void setTarget(const Eigen::Vector3f& target);+    inline const Eigen::Vector3f& target(void) { return mTarget; }+    +    const Eigen::Affine3f& viewMatrix(void) const;+    const Eigen::Matrix4f& projectionMatrix(void) const;+    +    void rotateAroundTarget(const Eigen::Quaternionf& q);+    void localRotate(const Eigen::Quaternionf& q);+    void zoom(float d);+    +    void localTranslate(const Eigen::Vector3f& t);+    +    /** Setup OpenGL matrices and viewport */+    void activateGL(void);+    +    Eigen::Vector3f unProject(const Eigen::Vector2f& uv, float depth, const Eigen::Matrix4f& invModelview) const;+    Eigen::Vector3f unProject(const Eigen::Vector2f& uv, float depth) const;+    +  protected:+    void updateViewMatrix(void) const;+    void updateProjectionMatrix(void) const;++  protected:++    uint mVpX, mVpY;+    uint mVpWidth, mVpHeight;++    Frame mFrame;+    +    mutable Eigen::Affine3f mViewMatrix;+    mutable Eigen::Matrix4f mProjectionMatrix;++    mutable bool mViewIsUptodate;+    mutable bool mProjIsUptodate;++    // used by rotateAroundTarget+    Eigen::Vector3f mTarget;+    +    float mFovY;+    float mNearDist;+    float mFarDist;+};++#endif // EIGEN_CAMERA_H
+ eigen3/demos/opengl/gpuhelper.cpp view
@@ -0,0 +1,126 @@+// This file is part of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2008 Gael Guennebaud <gael.guennebaud@inria.fr>+//+// 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 "gpuhelper.h"+#include "icosphere.h"+#include <GL/glu.h>+// PLEASE don't look at this old code... ;)++#include <fstream>+#include <algorithm>++GpuHelper gpu;++GpuHelper::GpuHelper()+{+    mVpWidth = mVpHeight = 0;+    mCurrentMatrixTarget = 0;+    mInitialized = false;+}++GpuHelper::~GpuHelper()+{+}++void GpuHelper::pushProjectionMode2D(ProjectionMode2D pm)+{+    // switch to 2D projection+    pushMatrix(Matrix4f::Identity(),GL_PROJECTION);++    if(pm==PM_Normalized)+    {+        //glOrtho(-1., 1., -1., 1., 0., 1.);+    }+    else if(pm==PM_Viewport)+    {+        GLint vp[4];+        glGetIntegerv(GL_VIEWPORT, vp);+        glOrtho(0., vp[2], 0., vp[3], -1., 1.);+    }++    pushMatrix(Matrix4f::Identity(),GL_MODELVIEW);+}++void GpuHelper::popProjectionMode2D(void)+{+    popMatrix(GL_PROJECTION);+    popMatrix(GL_MODELVIEW);+}++void GpuHelper::drawVector(const Vector3f& position, const Vector3f& vec, const Color& color, float aspect /* = 50.*/)+{+    static GLUquadricObj *cylindre = gluNewQuadric();+    glColor4fv(color.data());+    float length = vec.norm();+    pushMatrix(GL_MODELVIEW);+    glTranslatef(position.x(), position.y(), position.z());+    Vector3f ax = Matrix3f::Identity().col(2).cross(vec);+    ax.normalize();+    Vector3f tmp = vec;+    tmp.normalize();+    float angle = 180.f/M_PI * acos(tmp.z());+    if (angle>1e-3)+        glRotatef(angle, ax.x(), ax.y(), ax.z());+    gluCylinder(cylindre, length/aspect, length/aspect, 0.8*length, 10, 10);+    glTranslatef(0.0,0.0,0.8*length);+    gluCylinder(cylindre, 2.0*length/aspect, 0.0, 0.2*length, 10, 10);++    popMatrix(GL_MODELVIEW);+}++void GpuHelper::drawVectorBox(const Vector3f& position, const Vector3f& vec, const Color& color, float aspect)+{+    static GLUquadricObj *cylindre = gluNewQuadric();+    glColor4fv(color.data());+    float length = vec.norm();+    pushMatrix(GL_MODELVIEW);+    glTranslatef(position.x(), position.y(), position.z());+    Vector3f ax = Matrix3f::Identity().col(2).cross(vec);+    ax.normalize();+    Vector3f tmp = vec;+    tmp.normalize();+    float angle = 180.f/M_PI * acos(tmp.z());+    if (angle>1e-3)+        glRotatef(angle, ax.x(), ax.y(), ax.z());+    gluCylinder(cylindre, length/aspect, length/aspect, 0.8*length, 10, 10);+    glTranslatef(0.0,0.0,0.8*length);+    glScalef(4.0*length/aspect,4.0*length/aspect,4.0*length/aspect);+    drawUnitCube();+    popMatrix(GL_MODELVIEW);+}++void GpuHelper::drawUnitCube(void)+{+    static float vertices[][3] = {+        {-0.5,-0.5,-0.5},+        { 0.5,-0.5,-0.5},+        {-0.5, 0.5,-0.5},+        { 0.5, 0.5,-0.5},+        {-0.5,-0.5, 0.5},+        { 0.5,-0.5, 0.5},+        {-0.5, 0.5, 0.5},+        { 0.5, 0.5, 0.5}};++    glBegin(GL_QUADS);+    glNormal3f(0,0,-1); glVertex3fv(vertices[0]); glVertex3fv(vertices[2]); glVertex3fv(vertices[3]); glVertex3fv(vertices[1]);+    glNormal3f(0,0, 1); glVertex3fv(vertices[4]); glVertex3fv(vertices[5]); glVertex3fv(vertices[7]); glVertex3fv(vertices[6]);+    glNormal3f(0,-1,0); glVertex3fv(vertices[0]); glVertex3fv(vertices[1]); glVertex3fv(vertices[5]); glVertex3fv(vertices[4]);+    glNormal3f(0, 1,0); glVertex3fv(vertices[2]); glVertex3fv(vertices[6]); glVertex3fv(vertices[7]); glVertex3fv(vertices[3]);+    glNormal3f(-1,0,0); glVertex3fv(vertices[0]); glVertex3fv(vertices[4]); glVertex3fv(vertices[6]); glVertex3fv(vertices[2]);+    glNormal3f( 1,0,0); glVertex3fv(vertices[1]); glVertex3fv(vertices[3]); glVertex3fv(vertices[7]); glVertex3fv(vertices[5]);+    glEnd();+}++void GpuHelper::drawUnitSphere(int level)+{+  static IcoSphere sphere;+  sphere.draw(level);+}++
+ eigen3/demos/opengl/gpuhelper.h view
@@ -0,0 +1,207 @@+// This file is part of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2008 Gael Guennebaud <gael.guennebaud@inria.fr>+//+// 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_GPUHELPER_H+#define EIGEN_GPUHELPER_H++#include <Eigen/Geometry>+#include <GL/gl.h>+#include <vector>++using namespace Eigen;++typedef Vector4f Color;++class GpuHelper+{+  public:++    GpuHelper();++    ~GpuHelper();++    enum ProjectionMode2D { PM_Normalized = 1, PM_Viewport = 2 };+    void pushProjectionMode2D(ProjectionMode2D pm);+    void popProjectionMode2D();++    /** Multiply the OpenGL matrix \a matrixTarget by the matrix \a mat.+        Essentially, this helper function automatically calls glMatrixMode(matrixTarget) if required+        and does a proper call to the right glMultMatrix*() function according to the scalar type+        and storage order.+        \warning glMatrixMode() must never be called directly. If your're unsure, use forceMatrixMode().+        \sa Matrix, loadMatrix(), forceMatrixMode()+    */+    template<typename Scalar, int _Flags>+    void multMatrix(const Matrix<Scalar,4,4, _Flags, 4,4>& mat, GLenum matrixTarget);++    /** Load the matrix \a mat to the OpenGL matrix \a matrixTarget.+        Essentially, this helper function automatically calls glMatrixMode(matrixTarget) if required+        and does a proper call to the right glLoadMatrix*() or glLoadIdentity() function according to the scalar type+        and storage order.+        \warning glMatrixMode() must never be called directly. If your're unsure, use forceMatrixMode().+        \sa Matrix, multMatrix(), forceMatrixMode()+    */+    template<typename Scalar, int _Flags>+    void loadMatrix(const Eigen::Matrix<Scalar,4,4, _Flags, 4,4>& mat, GLenum matrixTarget);++    template<typename Scalar, typename Derived>+    void loadMatrix(+        const Eigen::CwiseNullaryOp<Eigen::internal::scalar_identity_op<Scalar>,Derived>&,+        GLenum matrixTarget);++    /** Make the matrix \a matrixTarget the current OpenGL matrix target.+        Call this function before loadMatrix() or multMatrix() if you cannot guarantee that glMatrixMode()+        has never been called after the last loadMatrix() or multMatrix() calls.+        \todo provides a debug mode checking the sanity of the cached matrix mode.+    */+    inline void forceMatrixTarget(GLenum matrixTarget) {glMatrixMode(mCurrentMatrixTarget=matrixTarget);}++    inline void setMatrixTarget(GLenum matrixTarget);++    /** Push the OpenGL matrix \a matrixTarget and load \a mat.+    */+    template<typename Scalar, int _Flags>+    inline void pushMatrix(const Matrix<Scalar,4,4, _Flags, 4,4>& mat, GLenum matrixTarget);++    template<typename Scalar, typename Derived>+    void pushMatrix(+        const Eigen::CwiseNullaryOp<Eigen::internal::scalar_identity_op<Scalar>,Derived>&,+        GLenum matrixTarget);++    /** Push and clone the OpenGL matrix \a matrixTarget+    */+    inline void pushMatrix(GLenum matrixTarget);++    /** Pop the OpenGL matrix \a matrixTarget+    */+    inline void popMatrix(GLenum matrixTarget);++    void drawVector(const Vector3f& position, const Vector3f& vec, const Color& color, float aspect = 50.);+    void drawVectorBox(const Vector3f& position, const Vector3f& vec, const Color& color, float aspect = 50.);+    void drawUnitCube(void);+    void drawUnitSphere(int level=0);++    /// draw the \a nofElement first elements+    inline void draw(GLenum mode, uint nofElement);++    /// draw a range of elements+    inline void draw(GLenum mode, uint start, uint end);++    /// draw an indexed subset+    inline void draw(GLenum mode, const std::vector<uint>* pIndexes);++protected:++    void update(void);++    GLuint mColorBufferId;+    int mVpWidth, mVpHeight;+    GLenum mCurrentMatrixTarget;+    bool mInitialized;+};++/** Singleton shortcut+*/+extern GpuHelper gpu;+++/** \internal+*/+template<bool RowMajor, int _Flags> struct GlMatrixHelper;++template<int _Flags> struct GlMatrixHelper<false,_Flags>+{+    static void loadMatrix(const Matrix<float, 4,4, _Flags, 4,4>&  mat) { glLoadMatrixf(mat.data()); }+    static void loadMatrix(const Matrix<double,4,4, _Flags, 4,4>& mat) { glLoadMatrixd(mat.data()); }+    static void multMatrix(const Matrix<float, 4,4, _Flags, 4,4>&  mat) { glMultMatrixf(mat.data()); }+    static void multMatrix(const Matrix<double,4,4, _Flags, 4,4>& mat) { glMultMatrixd(mat.data()); }+};++template<int _Flags> struct GlMatrixHelper<true,_Flags>+{+    static void loadMatrix(const Matrix<float, 4,4, _Flags, 4,4>&  mat) { glLoadMatrixf(mat.transpose().eval().data()); }+    static void loadMatrix(const Matrix<double,4,4, _Flags, 4,4>& mat) { glLoadMatrixd(mat.transpose().eval().data()); }+    static void multMatrix(const Matrix<float, 4,4, _Flags, 4,4>&  mat) { glMultMatrixf(mat.transpose().eval().data()); }+    static void multMatrix(const Matrix<double,4,4, _Flags, 4,4>& mat) { glMultMatrixd(mat.transpose().eval().data()); }+};++inline void GpuHelper::setMatrixTarget(GLenum matrixTarget)+{+    if (matrixTarget != mCurrentMatrixTarget)+        glMatrixMode(mCurrentMatrixTarget=matrixTarget);+}++template<typename Scalar, int _Flags>+void GpuHelper::multMatrix(const Matrix<Scalar,4,4, _Flags, 4,4>& mat, GLenum matrixTarget)+{+    setMatrixTarget(matrixTarget);+    GlMatrixHelper<_Flags&Eigen::RowMajorBit, _Flags>::multMatrix(mat);+}++template<typename Scalar, typename Derived>+void GpuHelper::loadMatrix(+    const Eigen::CwiseNullaryOp<Eigen::internal::scalar_identity_op<Scalar>,Derived>&,+    GLenum matrixTarget)+{+    setMatrixTarget(matrixTarget);+    glLoadIdentity();+}++template<typename Scalar, int _Flags>+void GpuHelper::loadMatrix(const Eigen::Matrix<Scalar,4,4, _Flags, 4,4>& mat, GLenum matrixTarget)+{+    setMatrixTarget(matrixTarget);+    GlMatrixHelper<(_Flags&Eigen::RowMajorBit)!=0, _Flags>::loadMatrix(mat);+}++inline void GpuHelper::pushMatrix(GLenum matrixTarget)+{+    setMatrixTarget(matrixTarget);+    glPushMatrix();+}++template<typename Scalar, int _Flags>+inline void GpuHelper::pushMatrix(const Matrix<Scalar,4,4, _Flags, 4,4>& mat, GLenum matrixTarget)+{+    pushMatrix(matrixTarget);+    GlMatrixHelper<_Flags&Eigen::RowMajorBit,_Flags>::loadMatrix(mat);+}++template<typename Scalar, typename Derived>+void GpuHelper::pushMatrix(+    const Eigen::CwiseNullaryOp<Eigen::internal::scalar_identity_op<Scalar>,Derived>&,+    GLenum matrixTarget)+{+    pushMatrix(matrixTarget);+    glLoadIdentity();+}++inline void GpuHelper::popMatrix(GLenum matrixTarget)+{+    setMatrixTarget(matrixTarget);+    glPopMatrix();+}++inline void GpuHelper::draw(GLenum mode, uint nofElement)+{+    glDrawArrays(mode, 0, nofElement);+}+++inline void GpuHelper::draw(GLenum mode, const std::vector<uint>* pIndexes)+{+    glDrawElements(mode, pIndexes->size(), GL_UNSIGNED_INT, &(pIndexes->front()));+}++inline void GpuHelper::draw(GLenum mode, uint start, uint end)+{+    glDrawArrays(mode, start, end-start);+}++#endif // EIGEN_GPUHELPER_H
+ eigen3/demos/opengl/icosphere.cpp view
@@ -0,0 +1,120 @@+// This file is part of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2008 Gael Guennebaud <gael.guennebaud@inria.fr>+//+// 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 "icosphere.h"++#include <GL/gl.h>+#include <map>++using namespace Eigen;++//--------------------------------------------------------------------------------+// icosahedron data+//--------------------------------------------------------------------------------+#define X .525731112119133606+#define Z .850650808352039932++static GLfloat vdata[12][3] = {+   {-X, 0.0, Z}, {X, 0.0, Z}, {-X, 0.0, -Z}, {X, 0.0, -Z},+   {0.0, Z, X}, {0.0, Z, -X}, {0.0, -Z, X}, {0.0, -Z, -X},+   {Z, X, 0.0}, {-Z, X, 0.0}, {Z, -X, 0.0}, {-Z, -X, 0.0}+};++static GLint tindices[20][3] = {+   {0,4,1}, {0,9,4}, {9,5,4}, {4,5,8}, {4,8,1},+   {8,10,1}, {8,3,10}, {5,3,8}, {5,2,3}, {2,7,3},+   {7,10,3}, {7,6,10}, {7,11,6}, {11,0,6}, {0,1,6},+   {6,1,10}, {9,0,11}, {9,11,2}, {9,2,5}, {7,2,11} };+//--------------------------------------------------------------------------------++IcoSphere::IcoSphere(unsigned int levels)+{+  // init with an icosahedron+  for (int i = 0; i < 12; i++)+    mVertices.push_back(Map<Vector3f>(vdata[i]));+  mIndices.push_back(new std::vector<int>);+  std::vector<int>& indices = *mIndices.back();+  for (int i = 0; i < 20; i++)+  {+    for (int k = 0; k < 3; k++)+      indices.push_back(tindices[i][k]);+  }+  mListIds.push_back(0);++  while(mIndices.size()<levels)+    _subdivide();+}++const std::vector<int>& IcoSphere::indices(int level) const+{+  while (level>=int(mIndices.size()))+    const_cast<IcoSphere*>(this)->_subdivide();+  return *mIndices[level];+}++void IcoSphere::_subdivide(void)+{+  typedef unsigned long long Key;+  std::map<Key,int> edgeMap;+  const std::vector<int>& indices = *mIndices.back();+  mIndices.push_back(new std::vector<int>);+  std::vector<int>& refinedIndices = *mIndices.back();+  int end = indices.size();+  for (int i=0; i<end; i+=3)+  {+    int ids0[3],  // indices of outer vertices+        ids1[3];  // indices of edge vertices+    for (int k=0; k<3; ++k)+    {+      int k1 = (k+1)%3;+      int e0 = indices[i+k];+      int e1 = indices[i+k1];+      ids0[k] = e0;+      if (e1>e0)+        std::swap(e0,e1);+      Key edgeKey = Key(e0) | (Key(e1)<<32);+      std::map<Key,int>::iterator it = edgeMap.find(edgeKey);+      if (it==edgeMap.end())+      {+        ids1[k] = mVertices.size();+        edgeMap[edgeKey] = ids1[k];+        mVertices.push_back( (mVertices[e0]+mVertices[e1]).normalized() );+      }+      else+        ids1[k] = it->second;+    }+    refinedIndices.push_back(ids0[0]); refinedIndices.push_back(ids1[0]); refinedIndices.push_back(ids1[2]);+    refinedIndices.push_back(ids0[1]); refinedIndices.push_back(ids1[1]); refinedIndices.push_back(ids1[0]);+    refinedIndices.push_back(ids0[2]); refinedIndices.push_back(ids1[2]); refinedIndices.push_back(ids1[1]);+    refinedIndices.push_back(ids1[0]); refinedIndices.push_back(ids1[1]); refinedIndices.push_back(ids1[2]);+  }+  mListIds.push_back(0);+}++void IcoSphere::draw(int level)+{+  while (level>=int(mIndices.size()))+    const_cast<IcoSphere*>(this)->_subdivide();+  if (mListIds[level]==0)+  {+    mListIds[level] = glGenLists(1);+    glNewList(mListIds[level], GL_COMPILE);+      glVertexPointer(3, GL_FLOAT, 0, mVertices[0].data());+      glNormalPointer(GL_FLOAT, 0, mVertices[0].data());+      glEnableClientState(GL_VERTEX_ARRAY);+      glEnableClientState(GL_NORMAL_ARRAY);+      glDrawElements(GL_TRIANGLES, mIndices[level]->size(), GL_UNSIGNED_INT, &(mIndices[level]->at(0)));+      glDisableClientState(GL_VERTEX_ARRAY);+      glDisableClientState(GL_NORMAL_ARRAY);+    glEndList();+  }+  glCallList(mListIds[level]);+}++
+ eigen3/demos/opengl/icosphere.h view
@@ -0,0 +1,30 @@+// This file is part of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2008 Gael Guennebaud <gael.guennebaud@inria.fr>+//+// 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_ICOSPHERE_H+#define EIGEN_ICOSPHERE_H++#include <Eigen/Core>+#include <vector>++class IcoSphere+{+  public:+    IcoSphere(unsigned int levels=1);+    const std::vector<Eigen::Vector3f>& vertices() const { return mVertices; }+    const std::vector<int>& indices(int level) const;+    void draw(int level);+  protected:+    void _subdivide();+    std::vector<Eigen::Vector3f> mVertices;+    std::vector<std::vector<int>*> mIndices;+    std::vector<int> mListIds;+};++#endif // EIGEN_ICOSPHERE_H
+ eigen3/demos/opengl/quaternion_demo.cpp view
@@ -0,0 +1,656 @@+// This file is part of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2008 Gael Guennebaud <gael.guennebaud@inria.fr>+//+// 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 "quaternion_demo.h"+#include "icosphere.h"++#include <Eigen/Geometry>+#include <Eigen/QR>+#include <Eigen/LU>++#include <iostream>+#include <QEvent>+#include <QMouseEvent>+#include <QInputDialog>+#include <QGridLayout>+#include <QButtonGroup>+#include <QRadioButton>+#include <QDockWidget>+#include <QPushButton>+#include <QGroupBox>++using namespace Eigen;++class FancySpheres+{+  public:+    EIGEN_MAKE_ALIGNED_OPERATOR_NEW+    +    FancySpheres()+    {+      const int levels = 4;+      const float scale = 0.33;+      float radius = 100;+      std::vector<int> parents;++      // leval 0+      mCenters.push_back(Vector3f::Zero());+      parents.push_back(-1);+      mRadii.push_back(radius);++      // generate level 1 using icosphere vertices+      radius *= 0.45;+      {+        float dist = mRadii[0]*0.9;+        for (int i=0; i<12; ++i)+        {+          mCenters.push_back(mIcoSphere.vertices()[i] * dist);+          mRadii.push_back(radius);+          parents.push_back(0);+        }+      }++      static const float angles [10] = {+        0, 0,+        M_PI, 0.*M_PI,+        M_PI, 0.5*M_PI,+        M_PI, 1.*M_PI,+        M_PI, 1.5*M_PI+      };++      // generate other levels+      int start = 1;+      for (int l=1; l<levels; l++)+      {+        radius *= scale;+        int end = mCenters.size();+        for (int i=start; i<end; ++i)+        {+          Vector3f c = mCenters[i];+          Vector3f ax0 = (c - mCenters[parents[i]]).normalized();+          Vector3f ax1 = ax0.unitOrthogonal();+          Quaternionf q;+          q.setFromTwoVectors(Vector3f::UnitZ(), ax0);+          Affine3f t = Translation3f(c) * q * Scaling(mRadii[i]+radius);+          for (int j=0; j<5; ++j)+          {+            Vector3f newC = c + ( (AngleAxisf(angles[j*2+1], ax0)+                                * AngleAxisf(angles[j*2+0] * (l==1 ? 0.35 : 0.5), ax1)) * ax0)+                                * (mRadii[i] + radius*0.8);+            mCenters.push_back(newC);+            mRadii.push_back(radius);+            parents.push_back(i);+          }+        }+        start = end;+      }+    }++    void draw()+    {+      int end = mCenters.size();+      glEnable(GL_NORMALIZE);+      for (int i=0; i<end; ++i)+      {+        Affine3f t = Translation3f(mCenters[i]) * Scaling(mRadii[i]);+        gpu.pushMatrix(GL_MODELVIEW);+        gpu.multMatrix(t.matrix(),GL_MODELVIEW);+        mIcoSphere.draw(2);+        gpu.popMatrix(GL_MODELVIEW);+      }+      glDisable(GL_NORMALIZE);+    }+  protected:+    std::vector<Vector3f> mCenters;+    std::vector<float> mRadii;+    IcoSphere mIcoSphere;+};+++// generic linear interpolation method+template<typename T> T lerp(float t, const T& a, const T& b)+{+  return a*(1-t) + b*t;+}++// quaternion slerp+template<> Quaternionf lerp(float t, const Quaternionf& a, const Quaternionf& b)+{ return a.slerp(t,b); }++// linear interpolation of a frame using the type OrientationType+// to perform the interpolation of the orientations+template<typename OrientationType>+inline static Frame lerpFrame(float alpha, const Frame& a, const Frame& b)+{+  return Frame(lerp(alpha,a.position,b.position),+               Quaternionf(lerp(alpha,OrientationType(a.orientation),OrientationType(b.orientation))));+}++template<typename _Scalar> class EulerAngles+{+public:+  enum { Dim = 3 };+  typedef _Scalar Scalar;+  typedef Matrix<Scalar,3,3> Matrix3;+  typedef Matrix<Scalar,3,1> Vector3;+  typedef Quaternion<Scalar> QuaternionType;++protected:++  Vector3 m_angles;++public:++  EulerAngles() {}+  inline EulerAngles(Scalar a0, Scalar a1, Scalar a2) : m_angles(a0, a1, a2) {}+  inline EulerAngles(const QuaternionType& q) { *this = q; }++  const Vector3& coeffs() const { return m_angles; }+  Vector3& coeffs() { return m_angles; }++  EulerAngles& operator=(const QuaternionType& q)+  {+    Matrix3 m = q.toRotationMatrix();+    return *this = m;+  }++  EulerAngles& operator=(const Matrix3& m)+  {+    // mat =  cy*cz          -cy*sz           sy+    //        cz*sx*sy+cx*sz  cx*cz-sx*sy*sz -cy*sx+    //       -cx*cz*sy+sx*sz  cz*sx+cx*sy*sz  cx*cy+    m_angles.coeffRef(1) = std::asin(m.coeff(0,2));+    m_angles.coeffRef(0) = std::atan2(-m.coeff(1,2),m.coeff(2,2));+    m_angles.coeffRef(2) = std::atan2(-m.coeff(0,1),m.coeff(0,0));+    return *this;+  }++  Matrix3 toRotationMatrix(void) const+  {+    Vector3 c = m_angles.array().cos();+    Vector3 s = m_angles.array().sin();+    Matrix3 res;+    res <<  c.y()*c.z(),                    -c.y()*s.z(),                   s.y(),+            c.z()*s.x()*s.y()+c.x()*s.z(),  c.x()*c.z()-s.x()*s.y()*s.z(),  -c.y()*s.x(),+            -c.x()*c.z()*s.y()+s.x()*s.z(), c.z()*s.x()+c.x()*s.y()*s.z(),  c.x()*c.y();+    return res;+  }++  operator QuaternionType() { return QuaternionType(toRotationMatrix()); }+};++// Euler angles slerp+template<> EulerAngles<float> lerp(float t, const EulerAngles<float>& a, const EulerAngles<float>& b)+{+  EulerAngles<float> res;+  res.coeffs() = lerp(t, a.coeffs(), b.coeffs());+  return res;+}+++RenderingWidget::RenderingWidget()+{+  mAnimate = false;+  mCurrentTrackingMode = TM_NO_TRACK;+  mNavMode = NavTurnAround;+  mLerpMode = LerpQuaternion;+  mRotationMode = RotationStable;+  mTrackball.setCamera(&mCamera);++  // required to capture key press events+  setFocusPolicy(Qt::ClickFocus);+}++void RenderingWidget::grabFrame(void)+{+    // ask user for a time+    bool ok = false;+    double t = 0;+    if (!m_timeline.empty())+      t = (--m_timeline.end())->first + 1.;+    t = QInputDialog::getDouble(this, "Eigen's RenderingWidget", "time value: ",+      t, 0, 1e3, 1, &ok);+    if (ok)+    {+      Frame aux;+      aux.orientation = mCamera.viewMatrix().linear();+      aux.position = mCamera.viewMatrix().translation();+      m_timeline[t] = aux;+    }+}++void RenderingWidget::drawScene()+{+  static FancySpheres sFancySpheres;+  float length = 50;+  gpu.drawVector(Vector3f::Zero(), length*Vector3f::UnitX(), Color(1,0,0,1));+  gpu.drawVector(Vector3f::Zero(), length*Vector3f::UnitY(), Color(0,1,0,1));+  gpu.drawVector(Vector3f::Zero(), length*Vector3f::UnitZ(), Color(0,0,1,1));++  // draw the fractal object+  float sqrt3 = std::sqrt(3.);+  glLightfv(GL_LIGHT0, GL_AMBIENT, Vector4f(0.5,0.5,0.5,1).data());+  glLightfv(GL_LIGHT0, GL_DIFFUSE, Vector4f(0.5,1,0.5,1).data());+  glLightfv(GL_LIGHT0, GL_SPECULAR, Vector4f(1,1,1,1).data());+  glLightfv(GL_LIGHT0, GL_POSITION, Vector4f(-sqrt3,-sqrt3,sqrt3,0).data());++  glLightfv(GL_LIGHT1, GL_AMBIENT, Vector4f(0,0,0,1).data());+  glLightfv(GL_LIGHT1, GL_DIFFUSE, Vector4f(1,0.5,0.5,1).data());+  glLightfv(GL_LIGHT1, GL_SPECULAR, Vector4f(1,1,1,1).data());+  glLightfv(GL_LIGHT1, GL_POSITION, Vector4f(-sqrt3,sqrt3,-sqrt3,0).data());++  glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT, Vector4f(0.7, 0.7, 0.7, 1).data());+  glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, Vector4f(0.8, 0.75, 0.6, 1).data());+  glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, Vector4f(1, 1, 1, 1).data());+  glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, 64);++  glEnable(GL_LIGHTING);+  glEnable(GL_LIGHT0);+  glEnable(GL_LIGHT1);++  sFancySpheres.draw();+  glVertexPointer(3, GL_FLOAT, 0, mVertices[0].data());+  glNormalPointer(GL_FLOAT, 0, mNormals[0].data());+  glEnableClientState(GL_VERTEX_ARRAY);+  glEnableClientState(GL_NORMAL_ARRAY);+  glDrawArrays(GL_TRIANGLES, 0, mVertices.size());+  glDisableClientState(GL_VERTEX_ARRAY);+  glDisableClientState(GL_NORMAL_ARRAY);++  glDisable(GL_LIGHTING);+}++void RenderingWidget::animate()+{+  m_alpha += double(m_timer.interval()) * 1e-3;++  TimeLine::const_iterator hi = m_timeline.upper_bound(m_alpha);+  TimeLine::const_iterator lo = hi;+  --lo;++  Frame currentFrame;++  if(hi==m_timeline.end())+  {+    // end+    currentFrame = lo->second;+    stopAnimation();+  }+  else if(hi==m_timeline.begin())+  {+    // start+    currentFrame = hi->second;+  }+  else+  {+    float s = (m_alpha - lo->first)/(hi->first - lo->first);+    if (mLerpMode==LerpEulerAngles)+      currentFrame = ::lerpFrame<EulerAngles<float> >(s, lo->second, hi->second);+    else if (mLerpMode==LerpQuaternion)+      currentFrame = ::lerpFrame<Eigen::Quaternionf>(s, lo->second, hi->second);+    else+    {+      std::cerr << "Invalid rotation interpolation mode (abort)\n";+      exit(2);+    }+    currentFrame.orientation.coeffs().normalize();+  }++  currentFrame.orientation = currentFrame.orientation.inverse();+  currentFrame.position = - (currentFrame.orientation * currentFrame.position);+  mCamera.setFrame(currentFrame);++  updateGL();+}++void RenderingWidget::keyPressEvent(QKeyEvent * e)+{+    switch(e->key())+    {+      case Qt::Key_Up:+        mCamera.zoom(2);+        break;+      case Qt::Key_Down:+        mCamera.zoom(-2);+        break;+      // add a frame+      case Qt::Key_G:+        grabFrame();+        break;+      // clear the time line+      case Qt::Key_C:+        m_timeline.clear();+        break;+      // move the camera to initial pos+      case Qt::Key_R:+        resetCamera();+        break;+      // start/stop the animation+      case Qt::Key_A:+        if (mAnimate)+        {+          stopAnimation();+        }+        else+        {+          m_alpha = 0;+          connect(&m_timer, SIGNAL(timeout()), this, SLOT(animate()));+          m_timer.start(1000/30);+          mAnimate = true;+        }+        break;+      default:+        break;+    }++    updateGL();+}++void RenderingWidget::stopAnimation()+{+  disconnect(&m_timer, SIGNAL(timeout()), this, SLOT(animate()));+  m_timer.stop();+  mAnimate = false;+  m_alpha = 0;+}++void RenderingWidget::mousePressEvent(QMouseEvent* e)+{+  mMouseCoords = Vector2i(e->pos().x(), e->pos().y());+  bool fly = (mNavMode==NavFly) || (e->modifiers()&Qt::ControlModifier);+  switch(e->button())+  {+    case Qt::LeftButton:+      if(fly)+      {+        mCurrentTrackingMode = TM_LOCAL_ROTATE;+        mTrackball.start(Trackball::Local);+      }+      else+      {+        mCurrentTrackingMode = TM_ROTATE_AROUND;+        mTrackball.start(Trackball::Around);+      }+      mTrackball.track(mMouseCoords);+      break;+    case Qt::MidButton:+      if(fly)+        mCurrentTrackingMode = TM_FLY_Z;+      else+        mCurrentTrackingMode = TM_ZOOM;+      break;+    case Qt::RightButton:+        mCurrentTrackingMode = TM_FLY_PAN;+      break;+    default:+      break;+  }+}+void RenderingWidget::mouseReleaseEvent(QMouseEvent*)+{+    mCurrentTrackingMode = TM_NO_TRACK;+    updateGL();+}++void RenderingWidget::mouseMoveEvent(QMouseEvent* e)+{+    // tracking+    if(mCurrentTrackingMode != TM_NO_TRACK)+    {+        float dx =   float(e->x() - mMouseCoords.x()) / float(mCamera.vpWidth());+        float dy = - float(e->y() - mMouseCoords.y()) / float(mCamera.vpHeight());++        // speedup the transformations+        if(e->modifiers() & Qt::ShiftModifier)+        {+          dx *= 10.;+          dy *= 10.;+        }++        switch(mCurrentTrackingMode)+        {+          case TM_ROTATE_AROUND:+          case TM_LOCAL_ROTATE:+            if (mRotationMode==RotationStable)+            {+              // use the stable trackball implementation mapping+              // the 2D coordinates to 3D points on a sphere.+              mTrackball.track(Vector2i(e->pos().x(), e->pos().y()));+            }+            else+            {+              // standard approach mapping the x and y displacements as rotations+              // around the camera's X and Y axes.+              Quaternionf q = AngleAxisf( dx*M_PI, Vector3f::UnitY())+                            * AngleAxisf(-dy*M_PI, Vector3f::UnitX());+              if (mCurrentTrackingMode==TM_LOCAL_ROTATE)+                mCamera.localRotate(q);+              else+                mCamera.rotateAroundTarget(q);+            }+            break;+          case TM_ZOOM :+            mCamera.zoom(dy*100);+            break;+          case TM_FLY_Z :+            mCamera.localTranslate(Vector3f(0, 0, -dy*200));+            break;+          case TM_FLY_PAN :+            mCamera.localTranslate(Vector3f(dx*200, dy*200, 0));+            break;+          default:+            break;+        }++        updateGL();+    }++    mMouseCoords = Vector2i(e->pos().x(), e->pos().y());+}++void RenderingWidget::paintGL()+{+  glEnable(GL_DEPTH_TEST);+  glDisable(GL_CULL_FACE);+  glPolygonMode(GL_FRONT_AND_BACK,GL_FILL);+  glDisable(GL_COLOR_MATERIAL);+  glDisable(GL_BLEND);+  glDisable(GL_ALPHA_TEST);+  glDisable(GL_TEXTURE_1D);+  glDisable(GL_TEXTURE_2D);+  glDisable(GL_TEXTURE_3D);++  // Clear buffers+  glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);++  mCamera.activateGL();++  drawScene();+}++void RenderingWidget::initializeGL()+{+  glClearColor(1., 1., 1., 0.);+  glLightModeli(GL_LIGHT_MODEL_LOCAL_VIEWER, 1);+  glDepthMask(GL_TRUE);+  glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);++  mCamera.setPosition(Vector3f(-200, -200, -200));+  mCamera.setTarget(Vector3f(0, 0, 0));+  mInitFrame.orientation = mCamera.orientation().inverse();+  mInitFrame.position = mCamera.viewMatrix().translation();+}++void RenderingWidget::resizeGL(int width, int height)+{+    mCamera.setViewport(width,height);+}++void RenderingWidget::setNavMode(int m)+{+  mNavMode = NavMode(m);+}++void RenderingWidget::setLerpMode(int m)+{+  mLerpMode = LerpMode(m);+}++void RenderingWidget::setRotationMode(int m)+{+  mRotationMode = RotationMode(m);+}++void RenderingWidget::resetCamera()+{+  if (mAnimate)+    stopAnimation();+  m_timeline.clear();+  Frame aux0 = mCamera.frame();+  aux0.orientation = aux0.orientation.inverse();+  aux0.position = mCamera.viewMatrix().translation();+  m_timeline[0] = aux0;++  Vector3f currentTarget = mCamera.target();+  mCamera.setTarget(Vector3f::Zero());++  // compute the rotation duration to move the camera to the target+  Frame aux1 = mCamera.frame();+  aux1.orientation = aux1.orientation.inverse();+  aux1.position = mCamera.viewMatrix().translation();+  float duration = aux0.orientation.angularDistance(aux1.orientation) * 0.9;+  if (duration<0.1) duration = 0.1;++  // put the camera at that time step:+  aux1 = aux0.lerp(duration/2,mInitFrame);+  // and make it look at the target again+  aux1.orientation = aux1.orientation.inverse();+  aux1.position = - (aux1.orientation * aux1.position);+  mCamera.setFrame(aux1);+  mCamera.setTarget(Vector3f::Zero());++  // add this camera keyframe+  aux1.orientation = aux1.orientation.inverse();+  aux1.position = mCamera.viewMatrix().translation();+  m_timeline[duration] = aux1;++  m_timeline[2] = mInitFrame;+  m_alpha = 0;+  animate();+  connect(&m_timer, SIGNAL(timeout()), this, SLOT(animate()));+  m_timer.start(1000/30);+  mAnimate = true;+}++QWidget* RenderingWidget::createNavigationControlWidget()+{+  QWidget* panel = new QWidget();+  QVBoxLayout* layout = new QVBoxLayout();++  {+    QPushButton* but = new QPushButton("reset");+    but->setToolTip("move the camera to initial position (with animation)");+    layout->addWidget(but);+    connect(but, SIGNAL(clicked()), this, SLOT(resetCamera()));+  }+  {+    // navigation mode+    QGroupBox* box = new QGroupBox("navigation mode");+    QVBoxLayout* boxLayout = new QVBoxLayout;+    QButtonGroup* group = new QButtonGroup(panel);+    QRadioButton* but;+    but = new QRadioButton("turn around");+    but->setToolTip("look around an object");+    group->addButton(but, NavTurnAround);+    boxLayout->addWidget(but);+    but = new QRadioButton("fly");+    but->setToolTip("free navigation like a spaceship\n(this mode can also be enabled pressing the \"shift\" key)");+    group->addButton(but, NavFly);+    boxLayout->addWidget(but);+    group->button(mNavMode)->setChecked(true);+    connect(group, SIGNAL(buttonClicked(int)), this, SLOT(setNavMode(int)));+    box->setLayout(boxLayout);+    layout->addWidget(box);+  }+  {+    // track ball, rotation mode+    QGroupBox* box = new QGroupBox("rotation mode");+    QVBoxLayout* boxLayout = new QVBoxLayout;+    QButtonGroup* group = new QButtonGroup(panel);+    QRadioButton* but;+    but = new QRadioButton("stable trackball");+    group->addButton(but, RotationStable);+    boxLayout->addWidget(but);+    but->setToolTip("use the stable trackball implementation mapping\nthe 2D coordinates to 3D points on a sphere");+    but = new QRadioButton("standard rotation");+    group->addButton(but, RotationStandard);+    boxLayout->addWidget(but);+    but->setToolTip("standard approach mapping the x and y displacements\nas rotations around the camera's X and Y axes");+    group->button(mRotationMode)->setChecked(true);+    connect(group, SIGNAL(buttonClicked(int)), this, SLOT(setRotationMode(int)));+    box->setLayout(boxLayout);+    layout->addWidget(box);+  }+  {+    // interpolation mode+    QGroupBox* box = new QGroupBox("spherical interpolation");+    QVBoxLayout* boxLayout = new QVBoxLayout;+    QButtonGroup* group = new QButtonGroup(panel);+    QRadioButton* but;+    but = new QRadioButton("quaternion slerp");+    group->addButton(but, LerpQuaternion);+    boxLayout->addWidget(but);+    but->setToolTip("use quaternion spherical interpolation\nto interpolate orientations");+    but = new QRadioButton("euler angles");+    group->addButton(but, LerpEulerAngles);+    boxLayout->addWidget(but);+    but->setToolTip("use Euler angles to interpolate orientations");+    group->button(mNavMode)->setChecked(true);+    connect(group, SIGNAL(buttonClicked(int)), this, SLOT(setLerpMode(int)));+    box->setLayout(boxLayout);+    layout->addWidget(box);+  }+  layout->addItem(new QSpacerItem(0,0,QSizePolicy::Minimum,QSizePolicy::Expanding));+  panel->setLayout(layout);+  return panel;+}++QuaternionDemo::QuaternionDemo()+{+  mRenderingWidget = new RenderingWidget();+  setCentralWidget(mRenderingWidget);++  QDockWidget* panel = new QDockWidget("navigation", this);+  panel->setAllowedAreas((QFlags<Qt::DockWidgetArea>)(Qt::RightDockWidgetArea | Qt::LeftDockWidgetArea));+  addDockWidget(Qt::RightDockWidgetArea, panel);+  panel->setWidget(mRenderingWidget->createNavigationControlWidget());+}++int main(int argc, char *argv[])+{+  std::cout << "Navigation:\n";+  std::cout << "  left button:           rotate around the target\n";+  std::cout << "  middle button:         zoom\n";+  std::cout << "  left button + ctrl     quake rotate (rotate around camera position)\n";+  std::cout << "  middle button + ctrl   walk (progress along camera's z direction)\n";+  std::cout << "  left button:           pan (translate in the XY camera's plane)\n\n";+  std::cout << "R : move the camera to initial position\n";+  std::cout << "A : start/stop animation\n";+  std::cout << "C : clear the animation\n";+  std::cout << "G : add a key frame\n";++  QApplication app(argc, argv);+  QuaternionDemo demo;+  demo.resize(600,500);+  demo.show();+  return app.exec();+}++#include "quaternion_demo.moc"+
+ eigen3/demos/opengl/quaternion_demo.h view
@@ -0,0 +1,114 @@+// This file is part of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2008 Gael Guennebaud <gael.guennebaud@inria.fr>+//+// 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_DEMO_H+#define EIGEN_QUATERNION_DEMO_H++#include "gpuhelper.h"+#include "camera.h"+#include "trackball.h"+#include <map>+#include <QTimer>+#include <QtGui/QApplication>+#include <QtOpenGL/QGLWidget>+#include <QtGui/QMainWindow>++class RenderingWidget : public QGLWidget+{+  Q_OBJECT++    typedef std::map<float,Frame> TimeLine;+    TimeLine m_timeline;+    Frame lerpFrame(float t);++    Frame mInitFrame;+    bool mAnimate;+    float m_alpha;++    enum TrackMode {+      TM_NO_TRACK=0, TM_ROTATE_AROUND, TM_ZOOM,+      TM_LOCAL_ROTATE, TM_FLY_Z, TM_FLY_PAN+    };++    enum NavMode {+      NavTurnAround,+      NavFly+    };++    enum LerpMode {+      LerpQuaternion,+      LerpEulerAngles+    };++    enum RotationMode {+      RotationStable,+      RotationStandard+    };++    Camera mCamera;+    TrackMode mCurrentTrackingMode;+    NavMode mNavMode;+    LerpMode mLerpMode;+    RotationMode mRotationMode;+    Vector2i mMouseCoords;+    Trackball mTrackball;++    QTimer m_timer;++    void setupCamera();++    std::vector<Vector3f> mVertices;+    std::vector<Vector3f> mNormals;+    std::vector<int> mIndices;++  protected slots:++    virtual void animate(void);+    virtual void drawScene(void);++    virtual void grabFrame(void);+    virtual void stopAnimation();++    virtual void setNavMode(int);+    virtual void setLerpMode(int);+    virtual void setRotationMode(int);+    virtual void resetCamera();++  protected:++    virtual void initializeGL();+    virtual void resizeGL(int width, int height);+    virtual void paintGL();+    +    //--------------------------------------------------------------------------------+    virtual void mousePressEvent(QMouseEvent * e);+    virtual void mouseReleaseEvent(QMouseEvent * e);+    virtual void mouseMoveEvent(QMouseEvent * e);+    virtual void keyPressEvent(QKeyEvent * e);+    //--------------------------------------------------------------------------------++  public: +    EIGEN_MAKE_ALIGNED_OPERATOR_NEW+    +    RenderingWidget();+    ~RenderingWidget() { }++    QWidget* createNavigationControlWidget();+};++class QuaternionDemo : public QMainWindow+{+  Q_OBJECT+  public:+    QuaternionDemo();+  protected:+    RenderingWidget* mRenderingWidget;+};++#endif // EIGEN_QUATERNION_DEMO_H
+ eigen3/demos/opengl/trackball.cpp view
@@ -0,0 +1,59 @@+// This file is part of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2008 Gael Guennebaud <gael.guennebaud@inria.fr>+//+// 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 "trackball.h"+#include "camera.h"++using namespace Eigen;++void Trackball::track(const Vector2i& point2D)+{+  if (mpCamera==0)+    return;+  Vector3f newPoint3D;+  bool newPointOk = mapToSphere(point2D, newPoint3D);++  if (mLastPointOk && newPointOk)+  {+    Vector3f axis = mLastPoint3D.cross(newPoint3D).normalized();+    float cos_angle = mLastPoint3D.dot(newPoint3D);+    if ( std::abs(cos_angle) < 1.0 )+    {+      float angle = 2. * acos(cos_angle);+      if (mMode==Around)+        mpCamera->rotateAroundTarget(Quaternionf(AngleAxisf(angle, axis)));+      else+        mpCamera->localRotate(Quaternionf(AngleAxisf(-angle, axis)));+    }+  }++  mLastPoint3D = newPoint3D;+  mLastPointOk = newPointOk;+}++bool Trackball::mapToSphere(const Vector2i& p2, Vector3f& v3)+{+  if ((p2.x() >= 0) && (p2.x() <= int(mpCamera->vpWidth())) &&+      (p2.y() >= 0) && (p2.y() <= int(mpCamera->vpHeight())) )+  {+    double x  = (double)(p2.x() - 0.5*mpCamera->vpWidth())  / (double)mpCamera->vpWidth();+    double y  = (double)(0.5*mpCamera->vpHeight() - p2.y()) / (double)mpCamera->vpHeight();+    double sinx         = sin(M_PI * x * 0.5);+    double siny         = sin(M_PI * y * 0.5);+    double sinx2siny2   = sinx * sinx + siny * siny;++    v3.x() = sinx;+    v3.y() = siny;+    v3.z() = sinx2siny2 < 1.0 ? sqrt(1.0 - sinx2siny2) : 0.0;++    return true;+  }+  else+    return false;+}
+ eigen3/demos/opengl/trackball.h view
@@ -0,0 +1,42 @@+// This file is part of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2008 Gael Guennebaud <gael.guennebaud@inria.fr>+//+// 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_TRACKBALL_H+#define EIGEN_TRACKBALL_H++#include <Eigen/Geometry>++class Camera;++class Trackball+{+  public:++    enum Mode {Around, Local};++    Trackball() : mpCamera(0) {}++    void start(Mode m = Around) { mMode = m; mLastPointOk = false; }++    void setCamera(Camera* pCam) { mpCamera = pCam; }++    void track(const Eigen::Vector2i& newPoint2D);++  protected:++    bool mapToSphere( const Eigen::Vector2i& p2, Eigen::Vector3f& v3);++    Camera* mpCamera;+    Eigen::Vector3f mLastPoint3D;+    Mode mMode;+    bool mLastPointOk;++};++#endif // EIGEN_TRACKBALL_H
+ eigen3/doc/A05_PortingFrom2To3.dox view
@@ -0,0 +1,299 @@+namespace Eigen {++/** \page Eigen2ToEigen3 Porting from Eigen2 to Eigen3++This page lists the most important API changes between Eigen2 and Eigen3,+and gives tips to help porting your application from Eigen2 to Eigen3.++\eigenAutoToc++\section CompatibilitySupport Eigen2 compatibility support++Up to version 3.2 %Eigen provides <a href="http://eigen.tuxfamily.org/dox-3.2/Eigen2SupportModes.html">Eigen2 support modes</a>. These are removed now, because they were barely used anymore and became hard to maintain after internal re-designs.+You can still use them by first <a href="http://eigen.tuxfamily.org/dox-3.2/Eigen2ToEigen3.html">porting your code to Eigen 3.2</a>.++\section Using The USING_PART_OF_NAMESPACE_EIGEN macro++The USING_PART_OF_NAMESPACE_EIGEN macro has been removed. In Eigen 3, just do:+\code+using namespace Eigen;+\endcode++\section ComplexDot Dot products over complex numbers++This is the single trickiest change between Eigen 2 and Eigen 3. It only affects code using \c std::complex numbers as scalar type.++Eigen 2's dot product was linear in the first variable. Eigen 3's dot product is linear in the second variable. In other words, the Eigen 2 code \code x.dot(y) \endcode is equivalent to the Eigen 3 code \code y.dot(x) \endcode In yet other words, dot products are complex-conjugated in Eigen 3 compared to Eigen 2. The switch to the new convention was commanded by common usage, especially with the notation \f$ x^Ty \f$ for dot products of column-vectors.++\section VectorBlocks Vector blocks++<table class="manual">+<tr><th>Eigen 2</th><th>Eigen 3</th></th>+<tr><td>\code+vector.start(length)+vector.start<length>()+vector.end(length)+vector.end<length>()+\endcode</td><td>\code+vector.head(length)+vector.head<length>()+vector.tail(length)+vector.tail<length>()+\endcode</td></tr>+</table>+++\section Corners Matrix Corners++<table class="manual">+<tr><th>Eigen 2</th><th>Eigen 3</th></th>+<tr><td>\code+matrix.corner(TopLeft,r,c)+matrix.corner(TopRight,r,c)+matrix.corner(BottomLeft,r,c)+matrix.corner(BottomRight,r,c)+matrix.corner<r,c>(TopLeft)+matrix.corner<r,c>(TopRight)+matrix.corner<r,c>(BottomLeft)+matrix.corner<r,c>(BottomRight)+\endcode</td><td>\code+matrix.topLeftCorner(r,c)+matrix.topRightCorner(r,c)+matrix.bottomLeftCorner(r,c)+matrix.bottomRightCorner(r,c)+matrix.topLeftCorner<r,c>()+matrix.topRightCorner<r,c>()+matrix.bottomLeftCorner<r,c>()+matrix.bottomRightCorner<r,c>()+\endcode</td>+</tr>+</table>++Notice that Eigen3 also provides these new convenience methods: topRows(), bottomRows(), leftCols(), rightCols(). See in class DenseBase.++\section CoefficientWiseOperations Coefficient wise operations++In Eigen2, coefficient wise operations which have no proper mathematical definition (as a coefficient wise product)+were achieved using the .cwise() prefix, e.g.:+\code a.cwise() * b \endcode+In Eigen3 this .cwise() prefix has been superseded by a new kind of matrix type called+Array for which all operations are performed coefficient wise. You can easily view a matrix as an array and vice versa using+the MatrixBase::array() and ArrayBase::matrix() functions respectively. Here is an example:+\code+Vector4f a, b, c;+c = a.array() * b.array();+\endcode+Note that the .array() function is not at all a synonym of the deprecated .cwise() prefix.+While the .cwise() prefix changed the behavior of the following operator, the array() function performs+a permanent conversion to the array world. Therefore, for binary operations such as the coefficient wise product,+both sides must be converted to an \em array as in the above example. On the other hand, when you+concatenate multiple coefficient wise operations you only have to do the conversion once, e.g.:+\code+Vector4f a, b, c;+c = a.array().abs().pow(3) * b.array().abs().sin();+\endcode+With Eigen2 you would have written:+\code+c = (a.cwise().abs().cwise().pow(3)).cwise() * (b.cwise().abs().cwise().sin());+\endcode++\section PartAndExtract Triangular and self-adjoint matrices++In Eigen 2 you had to play with the part, extract, and marked functions to deal with triangular and selfadjoint matrices. In Eigen 3, all these functions have been removed in favor of the concept of \em views:++<table class="manual">+<tr><th>Eigen 2</th><th>Eigen 3</th></tr>+<tr><td>\code+A.part<UpperTriangular>();+A.part<StrictlyLowerTriangular>(); \endcode</td>+<td>\code+A.triangularView<Upper>()+A.triangularView<StrictlyLower>()\endcode</td></tr>+<tr><td>\code+A.extract<UpperTriangular>();+A.extract<StrictlyLowerTriangular>();\endcode</td>+<td>\code+A.triangularView<Upper>()+A.triangularView<StrictlyLower>()\endcode</td></tr>+<tr><td>\code+A.marked<UpperTriangular>();+A.marked<StrictlyLowerTriangular>();\endcode</td>+<td>\code+A.triangularView<Upper>()+A.triangularView<StrictlyLower>()\endcode</td></tr>+<tr><td colspan="2"></td></tr>+<tr><td>\code+A.part<SelfAdfjoint|UpperTriangular>();+A.extract<SelfAdfjoint|LowerTriangular>();\endcode</td>+<td>\code+A.selfadjointView<Upper>()+A.selfadjointView<Lower>()\endcode</td></tr>+<tr><td colspan="2"></td></tr>+<tr><td>\code+UpperTriangular+LowerTriangular+UnitUpperTriangular+UnitLowerTriangular+StrictlyUpperTriangular+StrictlyLowerTriangular+\endcode</td><td>\code+Upper+Lower+UnitUpper+UnitLower+StrictlyUpper+StrictlyLower+\endcode</td>+</tr>+</table>++\sa class TriangularView, class SelfAdjointView++\section TriangularSolveInPlace Triangular in-place solving++<table class="manual">+<tr><th>Eigen 2</th><th>Eigen 3</th></tr>+<tr><td>\code A.triangularSolveInPlace<XxxTriangular>(Y);\endcode</td><td>\code A.triangularView<Xxx>().solveInPlace(Y);\endcode</td></tr>+</table>+++\section Decompositions Matrix decompositions++Some of Eigen 2's matrix decompositions have been renamed in Eigen 3, while some others have been removed and are replaced by other decompositions in Eigen 3.++<table class="manual">+  <tr>+    <th>Eigen 2</th>+    <th>Eigen 3</th>+    <th>Notes</th>+  </tr>+  <tr>+    <td>LU</td>+    <td>FullPivLU</td>+    <td class="alt">See also the new PartialPivLU, it's much faster</td>+  </tr>+  <tr>+    <td>QR</td>+    <td>HouseholderQR</td>+    <td class="alt">See also the new ColPivHouseholderQR, it's more reliable</td>+  </tr>+  <tr>+    <td>SVD</td>+    <td>JacobiSVD</td>+    <td class="alt">We currently don't have a bidiagonalizing SVD; of course this is planned.</td>+  </tr>+  <tr>+    <td>EigenSolver and friends</td>+    <td>\code #include<Eigen/Eigenvalues> \endcode </td>+    <td class="alt">Moved to separate module</td>+  </tr>+</table>++\section LinearSolvers Linear solvers++<table class="manual">+<tr><th>Eigen 2</th><th>Eigen 3</th><th>Notes</th></tr>+<tr><td>\code A.lu();\endcode</td>+<td>\code A.fullPivLu();\endcode</td>+<td class="alt">Now A.lu() returns a PartialPivLU</td></tr>+<tr><td>\code A.lu().solve(B,&X);\endcode</td>+<td>\code X = A.lu().solve(B);+ X = A.fullPivLu().solve(B);\endcode</td>+<td class="alt">The returned by value is fully optimized</td></tr>+<tr><td>\code A.llt().solve(B,&X);\endcode</td>+<td>\code X = A.llt().solve(B);+ X = A.selfadjointView<Lower>.llt().solve(B);+ X = A.selfadjointView<Upper>.llt().solve(B);\endcode</td>+<td class="alt">The returned by value is fully optimized and \n+the selfadjointView API allows you to select the \n+triangular part to work on (default is lower part)</td></tr>+<tr><td>\code A.llt().solveInPlace(B);\endcode</td>+<td>\code B = A.llt().solve(B);+ B = A.selfadjointView<Lower>.llt().solve(B);+ B = A.selfadjointView<Upper>.llt().solve(B);\endcode</td>+<td class="alt">In place solving</td></tr>+<tr><td>\code A.ldlt().solve(B,&X);\endcode</td>+<td>\code X = A.ldlt().solve(B);+ X = A.selfadjointView<Lower>.ldlt().solve(B);+ X = A.selfadjointView<Upper>.ldlt().solve(B);\endcode</td>+<td class="alt">The returned by value is fully optimized and \n+the selfadjointView API allows you to select the \n+triangular part to work on</td></tr>+</table>++\section GeometryModule Changes in the Geometry module++The Geometry module is the one that changed the most. If you rely heavily on it, it's probably a good idea to use the <a href="http://eigen.tuxfamily.org/dox-3.2/Eigen2SupportModes.html">"Eigen 2 support modes"</a> to perform your migration.++\section Transform The Transform class++In Eigen 2, the Transform class didn't really know whether it was a projective or affine transformation. In Eigen 3, it takes a new \a Mode template parameter, which indicates whether it's \a Projective or \a Affine transform. There is no default value.++The Transform3f (etc) typedefs are no more. In Eigen 3, the Transform typedefs explicitly refer to the \a Projective and \a Affine modes:++<table class="manual">+<tr><th>Eigen 2</th><th>Eigen 3</th><th>Notes</th></tr>+<tr>+  <td> Transform3f </td>+  <td> Affine3f or Projective3f </td>+  <td> Of course 3f is just an example here </td>+</tr>+</table>+++\section LazyVsNoalias Lazy evaluation and noalias++In Eigen all operations are performed in a lazy fashion except the matrix products which are always evaluated into a temporary by default.+In Eigen2, lazy evaluation could be enforced by tagging a product using the .lazy() function. However, in complex expressions it was not+easy to determine where to put the lazy() function. In Eigen3, the lazy() feature has been superseded by the MatrixBase::noalias() function+which can be used on the left hand side of an assignment when no aliasing can occur. Here is an example:+\code+MatrixXf a, b, c;+...+c.noalias() += 2 * a.transpose() * b;+\endcode+However, the noalias mechanism does not cover all the features of the old .lazy(). Indeed, in some extremely rare cases,+it might be useful to explicit request for a lay product, i.e., for a product which will be evaluated one coefficient at once, on request,+just like any other expressions. To this end you can use the MatrixBase::lazyProduct() function, however we strongly discourage you to+use it unless you are sure of what you are doing, i.e., you have rigourosly measured a speed improvement.++\section AlignMacros Alignment-related macros++The EIGEN_ALIGN_128 macro has been renamed to EIGEN_ALIGN16. Don't be surprised, it's just that we switched to counting in bytes ;-)++The \link TopicPreprocessorDirectivesPerformance EIGEN_DONT_ALIGN \endlink option still exists in Eigen 3, but it has a new cousin: \link TopicPreprocessorDirectivesPerformance  EIGEN_DONT_ALIGN_STATICALLY.\endlink It allows to get rid of all static alignment issues while keeping alignment of dynamic-size heap-allocated arrays. Vectorization of statically allocated arrays is still preserved (unless you define \link TopicPreprocessorDirectivesPerformance EIGEN_UNALIGNED_VECTORIZE \endlink =0), at the cost of unaligned memory stores.++\section AlignedMap Aligned Map objects++A common issue with Eigen 2 was that when mapping an array with Map, there was no way to tell Eigen that your array was aligned. There was a ForceAligned option but it didn't mean that; it was just confusing and has been removed.++New in Eigen3 is the #Aligned option. See the documentation of class Map. Use it like this:+\code+Map<Vector4f, Aligned> myMappedVector(some_aligned_array);+\endcode+There also are related convenience static methods, which actually are the preferred way as they take care of such things as constness:+\code+result = Vector4f::MapAligned(some_aligned_array);+\endcode++\section StdContainers STL Containers++In Eigen2, <tt>\#include\<Eigen/StdVector\></tt> tweaked std::vector to automatically align elements. The problem was that that was quite invasive. In Eigen3, we only override standard behavior if you use Eigen::aligned_allocator<T> as your allocator type. So for example, if you use std::vector<Matrix4f>, you need to do the following change (note that aligned_allocator is under namespace Eigen):++<table class="manual">+<tr><th>Eigen 2</th><th>Eigen 3</th></tr>+<tr>+  <td> \code std::vector<Matrix4f> \endcode </td>+  <td> \code std::vector<Matrix4f, aligned_allocator<Matrix4f> > \endcode </td>+</tr>+</table>++\section eiPrefix Internal ei_ prefix++In Eigen2, global internal functions and structures were prefixed by \c ei_. In Eigen3, they all have been moved into the more explicit \c internal namespace. So, e.g., \c ei_sqrt(x) now becomes \c internal::sqrt(x). Of course it is not recommended to rely on Eigen's internal features.++++*/++}
+ eigen3/doc/AsciiQuickReference.txt view
@@ -0,0 +1,215 @@+// A simple quickref for Eigen. Add anything that's missing.+// Main author: Keir Mierle++#include <Eigen/Dense>++Matrix<double, 3, 3> A;               // Fixed rows and cols. Same as Matrix3d.+Matrix<double, 3, Dynamic> B;         // Fixed rows, dynamic cols.+Matrix<double, Dynamic, Dynamic> C;   // Full dynamic. Same as MatrixXd.+Matrix<double, 3, 3, RowMajor> E;     // Row major; default is column-major.+Matrix3f P, Q, R;                     // 3x3 float matrix.+Vector3f x, y, z;                     // 3x1 float matrix.+RowVector3f a, b, c;                  // 1x3 float matrix.+VectorXd v;                           // Dynamic column vector of doubles+double s;                            ++// Basic usage+// Eigen          // Matlab           // comments+x.size()          // length(x)        // vector size+C.rows()          // size(C,1)        // number of rows+C.cols()          // size(C,2)        // number of columns+x(i)              // x(i+1)           // Matlab is 1-based+C(i,j)            // C(i+1,j+1)       //++A.resize(4, 4);   // Runtime error if assertions are on.+B.resize(4, 9);   // Runtime error if assertions are on.+A.resize(3, 3);   // Ok; size didn't change.+B.resize(3, 9);   // Ok; only dynamic cols changed.+                  +A << 1, 2, 3,     // Initialize A. The elements can also be+     4, 5, 6,     // matrices, which are stacked along cols+     7, 8, 9;     // and then the rows are stacked.+B << A, A, A;     // B is three horizontally stacked A's.+A.fill(10);       // Fill A with all 10's.++// Eigen                                    // Matlab+MatrixXd::Identity(rows,cols)               // eye(rows,cols)+C.setIdentity(rows,cols)                    // C = eye(rows,cols)+MatrixXd::Zero(rows,cols)                   // zeros(rows,cols)+C.setZero(rows,cols)                        // C = zeros(rows,cols)+MatrixXd::Ones(rows,cols)                   // ones(rows,cols)+C.setOnes(rows,cols)                        // C = ones(rows,cols)+MatrixXd::Random(rows,cols)                 // rand(rows,cols)*2-1            // MatrixXd::Random returns uniform random numbers in (-1, 1).+C.setRandom(rows,cols)                      // C = rand(rows,cols)*2-1+VectorXd::LinSpaced(size,low,high)          // linspace(low,high,size)'+v.setLinSpaced(size,low,high)               // v = linspace(low,high,size)'+VectorXi::LinSpaced(((hi-low)/step)+1,      // low:step:hi+                    low,low+step*(size-1))  //+++// Matrix slicing and blocks. All expressions listed here are read/write.+// Templated size versions are faster. Note that Matlab is 1-based (a size N+// vector is x(1)...x(N)).+// Eigen                           // Matlab+x.head(n)                          // x(1:n)+x.head<n>()                        // x(1:n)+x.tail(n)                          // x(end - n + 1: end)+x.tail<n>()                        // x(end - n + 1: end)+x.segment(i, n)                    // x(i+1 : i+n)+x.segment<n>(i)                    // x(i+1 : i+n)+P.block(i, j, rows, cols)          // P(i+1 : i+rows, j+1 : j+cols)+P.block<rows, cols>(i, j)          // P(i+1 : i+rows, j+1 : j+cols)+P.row(i)                           // P(i+1, :)+P.col(j)                           // P(:, j+1)+P.leftCols<cols>()                 // P(:, 1:cols)+P.leftCols(cols)                   // P(:, 1:cols)+P.middleCols<cols>(j)              // P(:, j+1:j+cols)+P.middleCols(j, cols)              // P(:, j+1:j+cols)+P.rightCols<cols>()                // P(:, end-cols+1:end)+P.rightCols(cols)                  // P(:, end-cols+1:end)+P.topRows<rows>()                  // P(1:rows, :)+P.topRows(rows)                    // P(1:rows, :)+P.middleRows<rows>(i)              // P(i+1:i+rows, :)+P.middleRows(i, rows)              // P(i+1:i+rows, :)+P.bottomRows<rows>()               // P(end-rows+1:end, :)+P.bottomRows(rows)                 // P(end-rows+1:end, :)+P.topLeftCorner(rows, cols)        // P(1:rows, 1:cols)+P.topRightCorner(rows, cols)       // P(1:rows, end-cols+1:end)+P.bottomLeftCorner(rows, cols)     // P(end-rows+1:end, 1:cols)+P.bottomRightCorner(rows, cols)    // P(end-rows+1:end, end-cols+1:end)+P.topLeftCorner<rows,cols>()       // P(1:rows, 1:cols)+P.topRightCorner<rows,cols>()      // P(1:rows, end-cols+1:end)+P.bottomLeftCorner<rows,cols>()    // P(end-rows+1:end, 1:cols)+P.bottomRightCorner<rows,cols>()   // P(end-rows+1:end, end-cols+1:end)++// Of particular note is Eigen's swap function which is highly optimized.+// Eigen                           // Matlab+R.row(i) = P.col(j);               // R(i, :) = P(:, j)+R.col(j1).swap(mat1.col(j2));      // R(:, [j1 j2]) = R(:, [j2, j1])++// Views, transpose, etc;+// Eigen                           // Matlab+R.adjoint()                        // R'+R.transpose()                      // R.' or conj(R')       // Read-write+R.diagonal()                       // diag(R)               // Read-write+x.asDiagonal()                     // diag(x)+R.transpose().colwise().reverse()  // rot90(R)              // Read-write+R.rowwise().reverse()              // fliplr(R)+R.colwise().reverse()              // flipud(R)+R.replicate(i,j)                   // repmat(P,i,j)+++// All the same as Matlab, but matlab doesn't have *= style operators.+// Matrix-vector.  Matrix-matrix.   Matrix-scalar.+y  = M*x;          R  = P*Q;        R  = P*s;+a  = b*M;          R  = P - Q;      R  = s*P;+a *= M;            R  = P + Q;      R  = P/s;+                   R *= Q;          R  = s*P;+                   R += Q;          R *= s;+                   R -= Q;          R /= s;++// Vectorized operations on each element independently+// Eigen                       // Matlab+R = P.cwiseProduct(Q);         // R = P .* Q+R = P.array() * s.array();     // R = P .* s+R = P.cwiseQuotient(Q);        // R = P ./ Q+R = P.array() / Q.array();     // R = P ./ Q+R = P.array() + s.array();     // R = P + s+R = P.array() - s.array();     // R = P - s+R.array() += s;                // R = R + s+R.array() -= s;                // R = R - s+R.array() < Q.array();         // R < Q+R.array() <= Q.array();        // R <= Q+R.cwiseInverse();              // 1 ./ P+R.array().inverse();           // 1 ./ P+R.array().sin()                // sin(P)+R.array().cos()                // cos(P)+R.array().pow(s)               // P .^ s+R.array().square()             // P .^ 2+R.array().cube()               // P .^ 3+R.cwiseSqrt()                  // sqrt(P)+R.array().sqrt()               // sqrt(P)+R.array().exp()                // exp(P)+R.array().log()                // log(P)+R.cwiseMax(P)                  // max(R, P)+R.array().max(P.array())       // max(R, P)+R.cwiseMin(P)                  // min(R, P)+R.array().min(P.array())       // min(R, P)+R.cwiseAbs()                   // abs(P)+R.array().abs()                // abs(P)+R.cwiseAbs2()                  // abs(P.^2)+R.array().abs2()               // abs(P.^2)+(R.array() < s).select(P,Q );  // (R < s ? P : Q)+R = (Q.array()==0).select(P,R) // R(Q==0) = P(Q==0)+R = P.unaryExpr(ptr_fun(func)) // R = arrayfun(func, P)   // with: scalar func(const scalar &x);+++// Reductions.+int r, c;+// Eigen                  // Matlab+R.minCoeff()              // min(R(:))+R.maxCoeff()              // max(R(:))+s = R.minCoeff(&r, &c)    // [s, i] = min(R(:)); [r, c] = ind2sub(size(R), i);+s = R.maxCoeff(&r, &c)    // [s, i] = max(R(:)); [r, c] = ind2sub(size(R), i);+R.sum()                   // sum(R(:))+R.colwise().sum()         // sum(R)+R.rowwise().sum()         // sum(R, 2) or sum(R')'+R.prod()                  // prod(R(:))+R.colwise().prod()        // prod(R)+R.rowwise().prod()        // prod(R, 2) or prod(R')'+R.trace()                 // trace(R)+R.all()                   // all(R(:))+R.colwise().all()         // all(R)+R.rowwise().all()         // all(R, 2)+R.any()                   // any(R(:))+R.colwise().any()         // any(R)+R.rowwise().any()         // any(R, 2)++// Dot products, norms, etc.+// Eigen                  // Matlab+x.norm()                  // norm(x).    Note that norm(R) doesn't work in Eigen.+x.squaredNorm()           // dot(x, x)   Note the equivalence is not true for complex+x.dot(y)                  // dot(x, y)+x.cross(y)                // cross(x, y) Requires #include <Eigen/Geometry>++//// Type conversion+// Eigen                  // Matlab+A.cast<double>();         // double(A)+A.cast<float>();          // single(A)+A.cast<int>();            // int32(A)+A.real();                 // real(A)+A.imag();                 // imag(A)+// if the original type equals destination type, no work is done++// Note that for most operations Eigen requires all operands to have the same type:+MatrixXf F = MatrixXf::Zero(3,3);+A += F;                // illegal in Eigen. In Matlab A = A+F is allowed+A += F.cast<double>(); // F converted to double and then added (generally, conversion happens on-the-fly)++// Eigen can map existing memory into Eigen matrices.+float array[3];+Vector3f::Map(array).fill(10);            // create a temporary Map over array and sets entries to 10+int data[4] = {1, 2, 3, 4};+Matrix2i mat2x2(data);                    // copies data into mat2x2+Matrix2i::Map(data) = 2*mat2x2;           // overwrite elements of data with 2*mat2x2+MatrixXi::Map(data, 2, 2) += mat2x2;      // adds mat2x2 to elements of data (alternative syntax if size is not know at compile time)++// Solve Ax = b. Result stored in x. Matlab: x = A \ b.+x = A.ldlt().solve(b));  // A sym. p.s.d.    #include <Eigen/Cholesky>+x = A.llt() .solve(b));  // A sym. p.d.      #include <Eigen/Cholesky>+x = A.lu()  .solve(b));  // Stable and fast. #include <Eigen/LU>+x = A.qr()  .solve(b));  // No pivoting.     #include <Eigen/QR>+x = A.svd() .solve(b));  // Stable, slowest. #include <Eigen/SVD>+// .ldlt() -> .matrixL() and .matrixD()+// .llt()  -> .matrixL()+// .lu()   -> .matrixL() and .matrixU()+// .qr()   -> .matrixQ() and .matrixR()+// .svd()  -> .matrixU(), .singularValues(), and .matrixV()++// Eigenvalue problems+// Eigen                          // Matlab+A.eigenvalues();                  // eig(A);+EigenSolver<Matrix3d> eig(A);     // [vec val] = eig(A)+eig.eigenvalues();                // diag(val)+eig.eigenvectors();               // vec+// For self-adjoint matrices use SelfAdjointEigenSolver<>
+ eigen3/doc/B01_Experimental.dox view
@@ -0,0 +1,52 @@+namespace Eigen {++/** \page Experimental Experimental parts of Eigen++\eigenAutoToc++\section Experimental_summary Summary++With the 2.0 release, Eigen's API is, to a large extent, stable. However, we wish to retain the freedom to make API incompatible changes. To that effect, we call many parts of Eigen "experimental" which means that they are not subject to API stability guarantee.++Our goal is that for the 2.1 release (expected in July 2009) most of these parts become API-stable too.++We are aware that API stability is a major concern for our users. That's why it's a priority for us to reach it, but at the same time we're being serious about not calling Eigen API-stable too early.++Experimental features may at any time:+\li be removed;+\li be subject to an API incompatible change;+\li introduce API or ABI incompatible changes in your own code if you let them affect your API or ABI.++\section Experimental_modules Experimental modules++The following modules are considered entirely experimental, and we make no firm API stability guarantee about them for the time being:+\li SVD+\li QR+\li Cholesky+\li Sparse+\li Geometry (this one should be mostly stable, but it's a little too early to make a formal guarantee)++\section Experimental_core Experimental parts of the Core module++In the Core module, the only classes subject to ABI stability guarantee (meaning that you can use it for data members in your public ABI) is:+\li Matrix+\li Map++All other classes offer no ABI guarantee, e.g. the layout of their data can be changed.++The only classes subject to (even partial) API stability guarantee (meaning that you can safely construct and use objects) are:+\li MatrixBase : partial API stability (see below)+\li Matrix : full API stability (except for experimental stuff inherited from MatrixBase)+\li Map : full API stability (except for experimental stuff inherited from MatrixBase)++All other classes offer no direct API guarantee, e.g. their methods can be changed; however notice that most classes inherit MatrixBase and that this is where most of their API comes from -- so in practice most of the API is stable.++A few MatrixBase methods are considered experimental, hence not part of any API stability guarantee:+\li all methods documented as internal+\li all methods hidden in the Doxygen documentation+\li all methods marked as experimental+\li all methods defined in experimental modules++*/++}
+ eigen3/doc/CMakeLists.txt view
@@ -0,0 +1,112 @@+project(EigenDoc)++set_directory_properties(PROPERTIES EXCLUDE_FROM_ALL TRUE)++project(EigenDoc)++if(CMAKE_COMPILER_IS_GNUCXX)+  if(CMAKE_SYSTEM_NAME MATCHES Linux)+    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O1 -g1")+  endif(CMAKE_SYSTEM_NAME MATCHES Linux)+endif(CMAKE_COMPILER_IS_GNUCXX)++option(EIGEN_INTERNAL_DOCUMENTATION "Build internal documentation" OFF)+++# Set some Doxygen flags+set(EIGEN_DOXY_PROJECT_NAME             "Eigen")+set(EIGEN_DOXY_OUTPUT_DIRECTORY_SUFFIX  "")+set(EIGEN_DOXY_INPUT                    "\"${Eigen_SOURCE_DIR}/Eigen\" \"${Eigen_SOURCE_DIR}/doc\"")+set(EIGEN_DOXY_HTML_COLORSTYLE_HUE      "220")+set(EIGEN_DOXY_TAGFILES                 "")+if(EIGEN_INTERNAL_DOCUMENTATION)+  set(EIGEN_DOXY_INTERNAL                 "YES")+else(EIGEN_INTERNAL_DOCUMENTATION)+  set(EIGEN_DOXY_INTERNAL                 "NO")+endif(EIGEN_INTERNAL_DOCUMENTATION)++configure_file(+  ${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in+  ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile+)++set(EIGEN_DOXY_PROJECT_NAME             "Eigen-unsupported")+set(EIGEN_DOXY_OUTPUT_DIRECTORY_SUFFIX  "/unsupported")+set(EIGEN_DOXY_INPUT                    "\"${Eigen_SOURCE_DIR}/unsupported/Eigen\" \"${Eigen_SOURCE_DIR}/unsupported/doc\"")+set(EIGEN_DOXY_HTML_COLORSTYLE_HUE      "0")+set(EIGEN_DOXY_TAGFILES                 "\"${Eigen_BINARY_DIR}/doc/Eigen.doxytags=..\"")+#set(EIGEN_DOXY_TAGFILES                 "")++configure_file(+  ${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in+  ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile-unsupported+)++configure_file(+  ${CMAKE_CURRENT_SOURCE_DIR}/eigendoxy_header.html.in+  ${CMAKE_CURRENT_BINARY_DIR}/eigendoxy_header.html+)++configure_file(+  ${CMAKE_CURRENT_SOURCE_DIR}/eigendoxy_footer.html.in+  ${CMAKE_CURRENT_BINARY_DIR}/eigendoxy_footer.html+)++configure_file(+  ${CMAKE_CURRENT_SOURCE_DIR}/eigendoxy_layout.xml.in+  ${CMAKE_CURRENT_BINARY_DIR}/eigendoxy_layout.xml+)++configure_file(+  ${Eigen_SOURCE_DIR}/unsupported/doc/eigendoxy_layout.xml.in+  ${Eigen_BINARY_DIR}/doc/unsupported/eigendoxy_layout.xml+)++set(examples_targets "")+set(snippets_targets "")++add_definitions("-DEIGEN_MAKING_DOCS")+add_custom_target(all_examples)++add_subdirectory(examples)+add_subdirectory(special_examples)+add_subdirectory(snippets)++add_custom_target(+  doc-eigen-prerequisites+  ALL+  COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/html/+  COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/eigen_navtree_hacks.js           ${CMAKE_CURRENT_BINARY_DIR}/html/+  COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/Eigen_Silly_Professor_64x64.png  ${CMAKE_CURRENT_BINARY_DIR}/html/+  COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/ftv2pnode.png                    ${CMAKE_CURRENT_BINARY_DIR}/html/+  COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/ftv2node.png                     ${CMAKE_CURRENT_BINARY_DIR}/html/+  COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/AsciiQuickReference.txt          ${CMAKE_CURRENT_BINARY_DIR}/html/+  WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}+)++add_custom_target(+  doc-unsupported-prerequisites+  ALL+  COMMAND ${CMAKE_COMMAND} -E make_directory ${Eigen_BINARY_DIR}/doc/html/unsupported+  COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/eigen_navtree_hacks.js           ${CMAKE_CURRENT_BINARY_DIR}/html/unsupported/+  COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/Eigen_Silly_Professor_64x64.png  ${CMAKE_CURRENT_BINARY_DIR}/html/unsupported/+  COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/ftv2pnode.png                    ${CMAKE_CURRENT_BINARY_DIR}/html/unsupported/+  COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/ftv2node.png                     ${CMAKE_CURRENT_BINARY_DIR}/html/unsupported/+  WORKING_DIRECTORY ${Eigen_BINARY_DIR}/doc+)++add_dependencies(doc-eigen-prerequisites all_snippets all_examples)+add_dependencies(doc-unsupported-prerequisites unsupported_snippets unsupported_examples)++add_custom_target(doc ALL+  COMMAND doxygen+  COMMAND doxygen Doxyfile-unsupported+  COMMAND ${CMAKE_COMMAND} -E copy ${Eigen_BINARY_DIR}/doc/html/group__TopicUnalignedArrayAssert.html ${Eigen_BINARY_DIR}/doc/html/TopicUnalignedArrayAssert.html+  COMMAND ${CMAKE_COMMAND} -E rename html eigen-doc+  COMMAND ${CMAKE_COMMAND} -E remove eigen-doc/eigen-doc.tgz+  COMMAND ${CMAKE_COMMAND} -E tar cfz eigen-doc.tgz eigen-doc+  COMMAND ${CMAKE_COMMAND} -E rename eigen-doc.tgz eigen-doc/eigen-doc.tgz+  COMMAND ${CMAKE_COMMAND} -E rename eigen-doc html+  WORKING_DIRECTORY ${Eigen_BINARY_DIR}/doc)++add_dependencies(doc doc-eigen-prerequisites doc-unsupported-prerequisites)
+ eigen3/doc/ClassHierarchy.dox view
@@ -0,0 +1,129 @@+namespace Eigen {++/** \page TopicClassHierarchy The class hierarchy++This page explains the design of the core classes in Eigen's class hierarchy and how they fit together. Casual+users probably need not concern themselves with these details, but it may be useful for both advanced users+and Eigen developers.++\eigenAutoToc+++\section TopicClassHierarchyPrinciples Principles++Eigen's class hierarchy is designed so that virtual functions are avoided where their overhead would+significantly impair performance. Instead, Eigen achieves polymorphism with the Curiously Recurring Template+Pattern (CRTP). In this pattern, the base class (for instance, \c MatrixBase) is in fact a template class, and+the derived class (for instance, \c Matrix) inherits the base class with the derived class itself as a+template argument (in this case, \c Matrix inherits from \c MatrixBase&lt;Matrix&gt;). This allows Eigen to+resolve the polymorphic function calls at compile time.++In addition, the design avoids multiple inheritance. One reason for this is that in our experience, some+compilers (like MSVC) fail to perform empty base class optimization, which is crucial for our fixed-size+types.+++\section TopicClassHierarchyCoreClasses The core classes++These are the classes that you need to know about if you want to write functions that accept or return Eigen+objects.++  - Matrix means plain dense matrix. If \c m is a \c %Matrix, then, for instance, \c m+m is no longer a +    \c %Matrix, it is a "matrix expression".+  - MatrixBase means dense matrix expression. This means that a \c %MatrixBase is something that can be+    added, matrix-multiplied, LU-decomposed, QR-decomposed... All matrix expression classes, including +    \c %Matrix itself, inherit \c %MatrixBase.+  - Array means plain dense array. If \c x is an \c %Array, then, for instance, \c x+x is no longer an +    \c %Array, it is an "array expression".+  - ArrayBase means dense array expression. This means that an \c %ArrayBase is something that can be+    added, array-multiplied, and on which you can perform all sorts of array operations... All array+    expression classes, including \c %Array itself, inherit \c %ArrayBase.+  - DenseBase means dense (matrix or array) expression. Both \c %ArrayBase and \c %MatrixBase inherit+    \c %DenseBase. \c %DenseBase is where all the methods go that apply to dense expressions regardless of+    whether they are matrix or array expressions. For example, the \link DenseBase::block() block(...) \endlink+    methods are in \c %DenseBase.++\section TopicClassHierarchyBaseClasses Base classes++These classes serve as base classes for the five core classes mentioned above. They are more internal and so+less interesting for users of the Eigen library.++  - PlainObjectBase means dense (matrix or array) plain object, i.e. something that stores its own dense+    array of coefficients. This is where, for instance, the \link PlainObjectBase::resize() resize() \endlink+    methods go. \c %PlainObjectBase is inherited by \c %Matrix and by \c %Array. But above, we said that +    \c %Matrix inherits \c %MatrixBase and \c %Array inherits \c %ArrayBase. So does that mean multiple+    inheritance? No, because \c %PlainObjectBase \e itself inherits \c %MatrixBase or \c %ArrayBase depending+    on whether we are in the matrix or array case. When we said above that \c %Matrix inherited +    \c %MatrixBase, we omitted to say it does so indirectly via \c %PlainObjectBase. Same for \c %Array.+  - DenseCoeffsBase means something that has dense coefficient accessors. It is a base class for+    \c %DenseBase. The reason for \c %DenseCoeffsBase to exist is that the set of available coefficient+    accessors is very different depending on whether a dense expression has direct memory access or not (the+    \c DirectAccessBit flag). For example, if \c x is a plain matrix, then \c x has direct access, and +    \c x.transpose() and \c x.block(...) also have direct access, because their coefficients can be read right+    off memory, but for example, \c x+x does not have direct memory access, because obtaining any of its+    coefficients requires a computation (an addition), it can't be just read off memory.+  - EigenBase means anything that can be evaluated into a plain dense matrix or array (even if that would+    be a bad idea). \c %EigenBase is really the absolute base class for anything that remotely looks like a+    matrix or array. It is a base class for \c %DenseCoeffsBase, so it sits below all our dense class+    hierarchy, but it is not limited to dense expressions. For example, \c %EigenBase is also inherited by+    diagonal matrices, sparse matrices, etc...+++\section TopicClassHierarchyInheritanceDiagrams Inheritance diagrams++The inheritance diagram for Matrix looks as follows:++<pre>+EigenBase&lt;%Matrix&gt;+  <-- DenseCoeffsBase&lt;%Matrix&gt;    (direct access case)+    <-- DenseBase&lt;%Matrix&gt;+      <-- MatrixBase&lt;%Matrix&gt;+        <-- PlainObjectBase&lt;%Matrix&gt;    (matrix case)+          <-- Matrix+</pre>++The inheritance diagram for Array looks as follows:++<pre>+EigenBase&lt;%Array&gt;+  <-- DenseCoeffsBase&lt;%Array&gt;    (direct access case)+    <-- DenseBase&lt;%Array&gt;+      <-- ArrayBase&lt;%Array&gt;+        <-- PlainObjectBase&lt;%Array&gt;    (array case)+          <-- Array+</pre>++The inheritance diagram for some other matrix expression class, here denoted by \c SomeMatrixXpr, looks as+follows:++<pre>+EigenBase&lt;SomeMatrixXpr&gt;+  <-- DenseCoeffsBase&lt;SomeMatrixXpr&gt;    (direct access or no direct access case)+    <-- DenseBase&lt;SomeMatrixXpr&gt;+      <-- MatrixBase&lt;SomeMatrixXpr&gt;+        <-- SomeMatrixXpr+</pre>++The inheritance diagram for some other array expression class, here denoted by \c SomeArrayXpr, looks as+follows:++<pre>+EigenBase&lt;SomeArrayXpr&gt;+  <-- DenseCoeffsBase&lt;SomeArrayXpr&gt;    (direct access or no direct access case)+    <-- DenseBase&lt;SomeArrayXpr&gt;+      <-- ArrayBase&lt;SomeArrayXpr&gt;+        <-- SomeArrayXpr+</pre>++Finally, consider an example of something that is not a dense expression, for instance a diagonal matrix. The+corresponding inheritance diagram is:++<pre>+EigenBase&lt;%DiagonalMatrix&gt;+  <-- DiagonalBase&lt;%DiagonalMatrix&gt;+    <-- DiagonalMatrix+</pre>+++*/+}
+ eigen3/doc/CoeffwiseMathFunctionsTable.dox view
@@ -0,0 +1,526 @@+namespace Eigen {++/** \eigenManualPage CoeffwiseMathFunctions Catalog of coefficient-wise math functions+++<!-- <span style="font-size:300%; color:red; font-weight: 900;">!WORK IN PROGRESS!</span> -->++This table presents a catalog of the coefficient-wise math functions supported by %Eigen.+In this table, \c a, \c b, refer to Array objects or expressions, and \c m refers to a linear algebra Matrix/Vector object. Standard scalar types are abbreviated as follows:+  - \c int: \c i32+  - \c float: \c f+  - \c double: \c d+  - \c std::complex<float>: \c cf+  - \c std::complex<double>: \c cd++For each row, the first column list the equivalent calls for arrays, and matrices when supported. Of course, all functions are available for matrices by first casting it as an array: \c m.array().++The third column gives some hints in the underlying scalar implementation. In most cases, %Eigen does not implement itself the math function but relies on the STL for standard scalar types, or user-provided functions for custom scalar types.+For instance, some simply calls the respective function of the STL while preserving <a href="http://en.cppreference.com/w/cpp/language/adl">argument-dependent lookup</a> for custom types.+The following:+\code+using std::foo;+foo(a[i]);+\endcode+means that the STL's function \c std::foo will be potentially called if it is compatible with the underlying scalar type. If not, then the user must ensure that an overload of the function foo is available for the given scalar type (usually defined in the same namespace as the given scalar type).+This also means that, unless specified, if the function \c std::foo is available only in some recent c++ versions (e.g., c++11), then the respective %Eigen's function/method will be usable on standard types only if the compiler support the required c++ version.++<table class="manual-hl">+<tr>+<th>API</th><th>Description</th><th>Default scalar implementation</th><th>SIMD</th>+</tr>+<tr><td colspan="4"></td></tr>+<tr><th colspan="4">Basic operations</th></tr>+<tr>+  <td class="code">+  \anchor cwisetable_abs+  a.\link ArrayBase::abs abs\endlink(); \n+  \link Eigen::abs abs\endlink(a); \n+  m.\link MatrixBase::cwiseAbs cwiseAbs\endlink();+  </td>+  <td>absolute value (\f$ |a_i| \f$) </td>+  <td class="code">+  using <a href="http://en.cppreference.com/w/cpp/numeric/math/fabs">std::abs</a>; \n+  abs(a[i]);+  </td>+  <td>SSE2, AVX (i32,f,d)</td>+</tr>+<tr>+  <td class="code">+  \anchor cwisetable_inverse+  a.\link ArrayBase::inverse inverse\endlink(); \n+  \link Eigen::inverse inverse\endlink(a); \n+  m.\link MatrixBase::cwiseInverse cwiseInverse\endlink();+  </td>+  <td>inverse value (\f$ 1/a_i \f$) </td>+  <td class="code">+  1/a[i];+  </td>+  <td>All engines (f,d,fc,fd)</td>+</tr>+<tr>+  <td class="code">+  \anchor cwisetable_conj+  a.\link ArrayBase::conjugate conjugate\endlink(); \n+  \link Eigen::conj conj\endlink(a); \n+  m.\link MatrixBase::conjugate conjugate\endlink();+  </td>+  <td><a href="https://en.wikipedia.org/wiki/Complex_conjugate">complex conjugate</a> (\f$ \bar{a_i} \f$),\n+  no-op for real </td>+  <td class="code">+  using <a href="http://en.cppreference.com/w/cpp/numeric/complex/conj">std::conj</a>; \n+  conj(a[i]);+  </td>+  <td>All engines (fc,fd)</td>+</tr>+<tr>+<th colspan="4">Exponential functions</th>+</tr>+<tr>+  <td class="code">+  \anchor cwisetable_exp+  a.\link ArrayBase::exp exp\endlink(); \n+  \link Eigen::exp exp\endlink(a);+  </td>+  <td>\f$ e \f$ raised to the given power (\f$ e^{a_i} \f$) </td>+  <td class="code">+  using <a href="http://en.cppreference.com/w/cpp/numeric/math/exp">std::exp</a>; \n+  exp(a[i]);+  </td>+  <td>SSE2, AVX (f,d)</td>+</tr>+<tr>+  <td class="code">+  \anchor cwisetable_log+  a.\link ArrayBase::log log\endlink(); \n+  \link Eigen::log log\endlink(a);+  </td>+  <td>natural (base \f$ e \f$) logarithm (\f$ \ln({a_i}) \f$)</td>+  <td class="code">+  using <a href="http://en.cppreference.com/w/cpp/numeric/math/log">std::log</a>; \n+  log(a[i]);+  </td>+  <td>SSE2, AVX (f)</td>+</tr>+<tr>+  <td class="code">+  \anchor cwisetable_log1p+  a.\link ArrayBase::log1p log1p\endlink(); \n+  \link Eigen::log1p log1p\endlink(a);+  </td>+  <td>natural (base \f$ e \f$) logarithm of 1 plus \n the given number (\f$ \ln({1+a_i}) \f$)</td>+  <td>built-in generic implementation based on \c log,\n+  plus \c using <a href="http://en.cppreference.com/w/cpp/numeric/math/log1p">\c std::log1p </a>; \cpp11</td>+  <td></td>+</tr>+<tr>+  <td class="code">+  \anchor cwisetable_log10+  a.\link ArrayBase::log10 log10\endlink(); \n+  \link Eigen::log10 log10\endlink(a);+  </td>+  <td>base 10 logarithm (\f$ \log_{10}({a_i}) \f$)</td>+  <td class="code">+  using <a href="http://en.cppreference.com/w/cpp/numeric/math/log10">std::log10</a>; \n+  log10(a[i]);+  </td>+  <td></td>+</tr>+<tr>+<th colspan="4">Power functions</th>+</tr>+<tr>+  <td class="code">+  \anchor cwisetable_pow+  a.\link ArrayBase::pow pow\endlink(b); \n+  \link ArrayBase::pow(const Eigen::ArrayBase< Derived > &x, const Eigen::ArrayBase< ExponentDerived > &exponents) pow\endlink(a,b);+  </td>+  <!-- For some reason Doxygen thinks that pow is in ArrayBase namespace -->+  <td>raises a number to the given power (\f$ a_i ^ {b_i} \f$) \n \c a and \c b can be either an array or scalar.</td>+  <td class="code">+  using <a href="http://en.cppreference.com/w/cpp/numeric/math/pow">std::pow</a>; \n+  pow(a[i],b[i]);\n+  (plus builtin for integer types)</td>+  <td></td>+</tr>+<tr>+  <td class="code">+  \anchor cwisetable_sqrt+  a.\link ArrayBase::sqrt sqrt\endlink(); \n+  \link Eigen::sqrt sqrt\endlink(a);\n+  m.\link MatrixBase::cwiseSqrt cwiseSqrt\endlink();+  </td>+  <td>computes square root (\f$ \sqrt a_i \f$)</td>+  <td class="code">+  using <a href="http://en.cppreference.com/w/cpp/numeric/math/sqrt">std::sqrt</a>; \n+  sqrt(a[i]);</td>+  <td>SSE2, AVX (f,d)</td>+</tr>+<tr>+  <td class="code">+  \anchor cwisetable_rsqrt+  a.\link ArrayBase::rsqrt rsqrt\endlink(); \n+  \link Eigen::rsqrt rsqrt\endlink(a);+  </td>+  <td><a href="https://en.wikipedia.org/wiki/Fast_inverse_square_root">reciprocal square root</a> (\f$ 1/{\sqrt a_i} \f$)</td>+  <td class="code">+  using <a href="http://en.cppreference.com/w/cpp/numeric/math/sqrt">std::sqrt</a>; \n+  1/sqrt(a[i]); \n+  </td>+  <td>SSE2, AVX, AltiVec, ZVector (f,d)\n+  (approx + 1 Newton iteration)</td>+</tr>+<tr>+  <td class="code">+  \anchor cwisetable_square+  a.\link ArrayBase::square square\endlink(); \n+  \link Eigen::square square\endlink(a);+  </td>+  <td>computes square power (\f$ a_i^2 \f$)</td>+  <td class="code">+  a[i]*a[i]</td>+  <td>All (i32,f,d,cf,cd)</td>+</tr>+<tr>+  <td class="code">+  \anchor cwisetable_cube+  a.\link ArrayBase::cube cube\endlink(); \n+  \link Eigen::cube cube\endlink(a);+  </td>+  <td>computes cubic power (\f$ a_i^3 \f$)</td>+  <td class="code">+  a[i]*a[i]*a[i]</td>+  <td>All (i32,f,d,cf,cd)</td>+</tr>+<tr>+  <td class="code">+  \anchor cwisetable_abs2+  a.\link ArrayBase::abs2 abs2\endlink(); \n+  \link Eigen::abs2 abs2\endlink(a);\n+  m.\link MatrixBase::cwiseAbs2 cwiseAbs2\endlink();+  </td>+  <td>computes the squared absolute value (\f$ |a_i|^2 \f$)</td>+  <td class="code">+  real:    a[i]*a[i] \n+  complex:  real(a[i])*real(a[i]) \n+  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; + imag(a[i])*imag(a[i])</td>+  <td>All (i32,f,d)</td>+</tr>+<tr>+<th colspan="4">Trigonometric functions</th>+</tr>+<tr>+  <td class="code">+  \anchor cwisetable_sin+  a.\link ArrayBase::sin sin\endlink(); \n+  \link Eigen::sin sin\endlink(a);+  </td>+  <td>computes sine</td>+  <td class="code">+  using <a href="http://en.cppreference.com/w/cpp/numeric/math/sin">std::sin</a>; \n+  sin(a[i]);</td>+  <td>SSE2, AVX (f)</td>+</tr>+<tr>+  <td class="code">+  \anchor cwisetable_cos+  a.\link ArrayBase::cos cos\endlink(); \n+  \link Eigen::cos cos\endlink(a);+  </td>+  <td>computes cosine</td>+  <td class="code">+  using <a href="http://en.cppreference.com/w/cpp/numeric/math/cos">std::cos</a>; \n+  cos(a[i]);</td>+  <td>SSE2, AVX (f)</td>+</tr>+<tr>+  <td class="code">+  \anchor cwisetable_tan+  a.\link ArrayBase::tan tan\endlink(); \n+  \link Eigen::tan tan\endlink(a);+  </td>+  <td>computes tangent</td>+  <td class="code">+  using <a href="http://en.cppreference.com/w/cpp/numeric/math/tan">std::tan</a>; \n+  tan(a[i]);</td>+  <td></td>+</tr>+<tr>+  <td class="code">+  \anchor cwisetable_asin+  a.\link ArrayBase::asin asin\endlink(); \n+  \link Eigen::asin asin\endlink(a);+  </td>+  <td>computes arc sine (\f$ \sin^{-1} a_i \f$)</td>+  <td class="code">+  using <a href="http://en.cppreference.com/w/cpp/numeric/math/asin">std::asin</a>; \n+  asin(a[i]);</td>+  <td></td>+</tr>+<tr>+  <td class="code">+  \anchor cwisetable_acos+  a.\link ArrayBase::acos acos\endlink(); \n+  \link Eigen::acos acos\endlink(a);+  </td>+  <td>computes arc cosine  (\f$ \cos^{-1} a_i \f$)</td>+  <td class="code">+  using <a href="http://en.cppreference.com/w/cpp/numeric/math/acos">std::acos</a>; \n+  acos(a[i]);</td>+  <td></td>+</tr>+<tr>+  <td class="code">+  \anchor cwisetable_atan+  a.\link ArrayBase::atan atan\endlink(); \n+  \link Eigen::atan atan\endlink(a);+  </td>+  <td>computes arc tangent (\f$ \tan^{-1} a_i \f$)</td>+  <td class="code">+  using <a href="http://en.cppreference.com/w/cpp/numeric/math/atan">std::atan</a>; \n+  atan(a[i]);</td>+  <td></td>+</tr>+<tr>+<th colspan="4">Hyperbolic functions</th>+</tr>+<tr>+  <td class="code">+  \anchor cwisetable_sinh+  a.\link ArrayBase::sinh sinh\endlink(); \n+  \link Eigen::sinh sinh\endlink(a);+  </td>+  <td>computes hyperbolic sine</td>+  <td class="code">+  using <a href="http://en.cppreference.com/w/cpp/numeric/math/sinh">std::sinh</a>; \n+  sinh(a[i]);</td>+  <td></td>+</tr>+<tr>+  <td class="code">+  \anchor cwisetable_cosh+  a.\link ArrayBase::cosh cohs\endlink(); \n+  \link Eigen::cosh cosh\endlink(a);+  </td>+  <td>computes hyperbolic cosine</td>+  <td class="code">+  using <a href="http://en.cppreference.com/w/cpp/numeric/math/cosh">std::cosh</a>; \n+  cosh(a[i]);</td>+  <td></td>+</tr>+<tr>+  <td class="code">+  \anchor cwisetable_tanh+  a.\link ArrayBase::tanh tanh\endlink(); \n+  \link Eigen::tanh tanh\endlink(a);+  </td>+  <td>computes hyperbolic tangent</td>+  <td class="code">+  using <a href="http://en.cppreference.com/w/cpp/numeric/math/tanh">std::tanh</a>; \n+  tanh(a[i]);</td>+  <td></td>+</tr>+<tr>+<th colspan="4">Nearest integer floating point operations</th>+</tr>+<tr>+  <td class="code">+  \anchor cwisetable_ceil+  a.\link ArrayBase::ceil ceil\endlink(); \n+  \link Eigen::ceil ceil\endlink(a);+  </td>+  <td>nearest integer not less than the given value</td>+  <td class="code">+  using <a href="http://en.cppreference.com/w/cpp/numeric/math/ceil">std::ceil</a>; \n+  ceil(a[i]);</td>+  <td>SSE4,AVX,ZVector (f,d)</td>+</tr>+<tr>+  <td class="code">+  \anchor cwisetable_floor+  a.\link ArrayBase::floor floor\endlink(); \n+  \link Eigen::floor floor\endlink(a);+  </td>+  <td>nearest integer not greater than the given value</td>+  <td class="code">+  using <a href="http://en.cppreference.com/w/cpp/numeric/math/floor">std::floor</a>; \n+  floor(a[i]);</td>+  <td>SSE4,AVX,ZVector (f,d)</td>+</tr>+<tr>+  <td class="code">+  \anchor cwisetable_round+  a.\link ArrayBase::round round\endlink(); \n+  \link Eigen::round round\endlink(a);+  </td>+  <td>nearest integer, \n rounding away from zero in halfway cases</td>+  <td>built-in generic implementation \n based on \c floor and \c ceil,\n+  plus \c using <a href="http://en.cppreference.com/w/cpp/numeric/math/round">\c std::round </a>; \cpp11</td>+  <td>SSE4,AVX,ZVector (f,d)</td>+</tr>+<tr>+<th colspan="4">Floating point manipulation functions</th>+</tr>+<tr>+<th colspan="4">Classification and comparison</th>+</tr>+<tr>+  <td class="code">+  \anchor cwisetable_isfinite+  a.\link ArrayBase::isFinite isFinite\endlink(); \n+  \link Eigen::isfinite isfinite\endlink(a);+  </td>+  <td>checks if the given number has finite value</td>+  <td>built-in generic implementation,\n+  plus \c using <a href="http://en.cppreference.com/w/cpp/numeric/math/isfinite">\c std::isfinite </a>; \cpp11</td>+  <td></td>+</tr>+<tr>+  <td class="code">+  \anchor cwisetable_isinf+  a.\link ArrayBase::isInf isInf\endlink(); \n+  \link Eigen::isinf isinf\endlink(a);+  </td>+  <td>checks if the given number is infinite</td>+  <td>built-in generic implementation,\n+  plus \c using <a href="http://en.cppreference.com/w/cpp/numeric/math/isinf">\c std::isinf </a>; \cpp11</td>+  <td></td>+</tr>+<tr>+  <td class="code">+  \anchor cwisetable_isnan+  a.\link ArrayBase::isNaN isNaN\endlink(); \n+  \link Eigen::isnan isnan\endlink(a);+  </td>+  <td>checks if the given number is not a number</td>+  <td>built-in generic implementation,\n+  plus \c using <a href="http://en.cppreference.com/w/cpp/numeric/math/isnan">\c std::isnan </a>; \cpp11</td>+  <td></td>+</tr>+<tr>+<th colspan="4">Error and gamma functions</th>+</tr>+<tr> <td colspan="4">  Require \c \#include \c <unsupported/Eigen/SpecialFunctions> </td></tr>+<tr>+  <td class="code">+  \anchor cwisetable_erf+  a.\link ArrayBase::erf erf\endlink(); \n+  \link Eigen::erf erf\endlink(a);+  </td>+  <td>error function</td>+  <td class="code">+  using <a href="http://en.cppreference.com/w/cpp/numeric/math/erf">std::erf</a>; \cpp11 \n+  erf(a[i]);+  </td>+  <td></td>+</tr>+<tr>+  <td class="code">+  \anchor cwisetable_erfc+  a.\link ArrayBase::erfc erfc\endlink(); \n+  \link Eigen::erfc erfc\endlink(a);+  </td>+  <td>complementary error function</td>+  <td class="code">+  using <a href="http://en.cppreference.com/w/cpp/numeric/math/erfc">std::erfc</a>; \cpp11 \n+  erfc(a[i]);+  </td>+  <td></td>+</tr>+<tr>+  <td class="code">+  \anchor cwisetable_lgamma+  a.\link ArrayBase::lgamma lgamma\endlink(); \n+  \link Eigen::lgamma lgamma\endlink(a);+  </td>+  <td>natural logarithm of the gamma function</td>+  <td class="code">+  using <a href="http://en.cppreference.com/w/cpp/numeric/math/lgamma">std::lgamma</a>; \cpp11 \n+  lgamma(a[i]);+  </td>+  <td></td>+</tr>+<tr>+  <td class="code">+  \anchor cwisetable_digamma+  a.\link ArrayBase::digamma digamma\endlink(); \n+  \link Eigen::digamma digamma\endlink(a);+  </td>+  <td><a href="https://en.wikipedia.org/wiki/Digamma_function">logarithmic derivative of the gamma function</a></td>+  <td>+  built-in for float and double+  </td>+  <td></td>+</tr>+<tr>+  <td class="code">+  \anchor cwisetable_igamma+  \link Eigen::igamma igamma\endlink(a,x);+  </td>+  <td><a href="https://en.wikipedia.org/wiki/Incomplete_gamma_function">lower incomplete gamma integral</a>+  \n \f$ \gamma(a_i,x_i)= \frac{1}{|a_i|} \int_{0}^{x_i}e^{\text{-}t} t^{a_i-1} \mathrm{d} t \f$</td>+  <td>+  built-in for float and double,\n but requires \cpp11+  </td>+  <td></td>+</tr>+<tr>+  <td class="code">+  \anchor cwisetable_igammac+  \link Eigen::igammac igammac\endlink(a,x);+  </td>+  <td><a href="https://en.wikipedia.org/wiki/Incomplete_gamma_function">upper incomplete gamma integral</a>+  \n \f$ \Gamma(a_i,x_i) = \frac{1}{|a_i|} \int_{x_i}^{\infty}e^{\text{-}t} t^{a_i-1} \mathrm{d} t \f$</td>+  <td>+  built-in for float and double,\n but requires \cpp11+  </td>+  <td></td>+</tr>+<tr>+<th colspan="4">Special functions</th>+</tr>+<tr> <td colspan="4">  Require \c \#include \c <unsupported/Eigen/SpecialFunctions> </td></tr>+<tr>+  <td class="code">+  \anchor cwisetable_polygamma+  \link Eigen::polygamma polygamma\endlink(n,x);+  </td>+  <td><a href="https://en.wikipedia.org/wiki/Polygamma_function">n-th derivative of digamma at x</a></td>+  <td>+  built-in generic based on\n <a href="#cwisetable_lgamma">\c lgamma </a>,+  <a href="#cwisetable_digamma"> \c digamma </a>+  and <a href="#cwisetable_zeta">\c zeta </a>.+  </td>+  <td></td>+</tr>+<tr>+  <td class="code">+  \anchor cwisetable_betainc+  \link Eigen::betainc betainc\endlink(a,b,x);+  </td>+  <td><a href="https://en.wikipedia.org/wiki/Beta_function#Incomplete_beta_function">Incomplete beta function</a></td>+  <td>+  built-in for float and double,\n but requires \cpp11+  </td>+  <td></td>+</tr>+<tr>+  <td class="code">+  \anchor cwisetable_zeta+  \link Eigen::zeta zeta\endlink(a,b);+  </td>+  <td><a href="https://en.wikipedia.org/wiki/Hurwitz_zeta_function">Hurwitz zeta function</a>+  \n \f$ \zeta(a_i,b_i)=\sum_{k=0}^{\infty}(b_i+k)^{\text{-}a_i} \f$</td>+  <td>+  built-in for float and double+  </td>+  <td></td>+</tr>+<tr><td colspan="4"></td></tr>+</table>++\n++*/++}
+ eigen3/doc/CustomizingEigen_CustomScalar.dox view
@@ -0,0 +1,120 @@+namespace Eigen {++/** \page TopicCustomizing_CustomScalar Using custom scalar types+\anchor user_defined_scalars++By default, Eigen currently supports standard floating-point types (\c float, \c double, \c std::complex<float>, \c std::complex<double>, \c long \c double), as well as all native integer types (e.g., \c int, \c unsigned \c int, \c short, etc.), and \c bool.+On x86-64 systems, \c long \c double permits to locally enforces the use of x87 registers with extended accuracy (in comparison to SSE).++In order to add support for a custom type \c T you need:+-# make sure the common operator (+,-,*,/,etc.) are supported by the type \c T+-# add a specialization of struct Eigen::NumTraits<T> (see \ref NumTraits)+-# define the math functions that makes sense for your type. This includes standard ones like sqrt, pow, sin, tan, conj, real, imag, etc, as well as abs2 which is Eigen specific.+     (see the file Eigen/src/Core/MathFunctions.h)++The math function should be defined in the same namespace than \c T, or in the \c std namespace though that second approach is not recommended.++Here is a concrete example adding support for the Adolc's \c adouble type. <a href="https://projects.coin-or.org/ADOL-C">Adolc</a> is an automatic differentiation library. The type \c adouble is basically a real value tracking the values of any number of partial derivatives.++\code+#ifndef ADOLCSUPPORT_H+#define ADOLCSUPPORT_H++#define ADOLC_TAPELESS+#include <adolc/adouble.h>+#include <Eigen/Core>++namespace Eigen {++template<> struct NumTraits<adtl::adouble>+ : NumTraits<double> // permits to get the epsilon, dummy_precision, lowest, highest functions+{+  typedef adtl::adouble Real;+  typedef adtl::adouble NonInteger;+  typedef adtl::adouble Nested;++  enum {+    IsComplex = 0,+    IsInteger = 0,+    IsSigned = 1,+    RequireInitialization = 1,+    ReadCost = 1,+    AddCost = 3,+    MulCost = 3+  };+};++}++namespace adtl {++inline const adouble& conj(const adouble& x)  { return x; }+inline const adouble& real(const adouble& x)  { return x; }+inline adouble imag(const adouble&)    { return 0.; }+inline adouble abs(const adouble&  x)  { return fabs(x); }+inline adouble abs2(const adouble& x)  { return x*x; }++}++#endif // ADOLCSUPPORT_H+\endcode++This other example adds support for the \c mpq_class type from <a href="https://gmplib.org/">GMP</a>. It shows in particular how to change the way Eigen picks the best pivot during LU factorization. It selects the coefficient with the highest score, where the score is by default the absolute value of a number, but we can define a different score, for instance to prefer pivots with a more compact representation (this is an example, not a recommendation). Note that the scores should always be non-negative and only zero is allowed to have a score of zero. Also, this can interact badly with thresholds for inexact scalar types.++\code+#include <gmpxx.h>+#include <Eigen/Core>+#include <boost/operators.hpp>++namespace Eigen {+  template<> struct NumTraits<mpq_class> : GenericNumTraits<mpq_class>+  {+    typedef mpq_class Real;+    typedef mpq_class NonInteger;+    typedef mpq_class Nested;++    static inline Real epsilon() { return 0; }+    static inline Real dummy_precision() { return 0; }+    static inline Real digits10() { return 0; }++    enum {+      IsInteger = 0,+      IsSigned = 1,+      IsComplex = 0,+      RequireInitialization = 1,+      ReadCost = 6,+      AddCost = 150,+      MulCost = 100+    };+  };++  namespace internal {++    template<> struct scalar_score_coeff_op<mpq_class> {+      struct result_type : boost::totally_ordered1<result_type> {+        std::size_t len;+        result_type(int i = 0) : len(i) {} // Eigen uses Score(0) and Score()+        result_type(mpq_class const& q) :+          len(mpz_size(q.get_num_mpz_t())++              mpz_size(q.get_den_mpz_t())-1) {}+        friend bool operator<(result_type x, result_type y) {+          // 0 is the worst possible pivot+          if (x.len == 0) return y.len > 0;+          if (y.len == 0) return false;+          // Prefer a pivot with a small representation+          return x.len > y.len;+        }+        friend bool operator==(result_type x, result_type y) {+          // Only used to test if the score is 0+          return x.len == y.len;+        }+      };+      result_type operator()(mpq_class const& x) const { return x; }+    };+  }+}+\endcode++*/++}
+ eigen3/doc/CustomizingEigen_InheritingMatrix.dox view
@@ -0,0 +1,34 @@+namespace Eigen {++/** \page TopicCustomizing_InheritingMatrix Inheriting from Matrix++Before inheriting from Matrix, be really, I mean REALLY, sure that using+EIGEN_MATRIX_PLUGIN is not what you really want (see previous section).+If you just need to add few members to Matrix, this is the way to go.++An example of when you actually need to inherit Matrix, is when you+have several layers of heritage such as +MyVerySpecificVector1, MyVerySpecificVector2 -> MyVector1 -> Matrix and+MyVerySpecificVector3, MyVerySpecificVector4 -> MyVector2 -> Matrix.++In order for your object to work within the %Eigen framework, you need to+define a few members in your inherited class.++Here is a minimalistic example:++\include CustomizingEigen_Inheritance.cpp++Output: \verbinclude CustomizingEigen_Inheritance.out++This is the kind of error you can get if you don't provide those methods+\verbatim+error: no match for ‘operator=’ in ‘v = Eigen::operator*(+const Eigen::MatrixBase<Eigen::Matrix<double, -0x000000001, 1, 0, -0x000000001, 1> >::Scalar&, +const Eigen::MatrixBase<Eigen::Matrix<double, -0x000000001, 1> >::StorageBaseType&)+(((const Eigen::MatrixBase<Eigen::Matrix<double, -0x000000001, 1> >::StorageBaseType&)+((const Eigen::MatrixBase<Eigen::Matrix<double, -0x000000001, 1> >::StorageBaseType*)(& v))))’+\endverbatim++*/++}
+ eigen3/doc/CustomizingEigen_NullaryExpr.dox view
@@ -0,0 +1,86 @@+namespace Eigen {++/** \page TopicCustomizing_NullaryExpr Matrix manipulation via nullary-expressions+++The main purpose of the class CwiseNullaryOp is to define \em procedural matrices such as constant or random matrices as returned by the Ones(), Zero(), Constant(), Identity() and Random() methods.+Nevertheless, with some imagination it is possible to accomplish very sophisticated matrix manipulation with minimal efforts such that \ref TopicNewExpressionType "implementing new expression" is rarely needed.++\section NullaryExpr_Circulant Example 1: circulant matrix++To explore these possibilities let us start with the  \em circulant example of the \ref TopicNewExpressionType "implementing new expression" topic.+Let us recall that a circulant matrix is a matrix where each column is the same as the+column to the left, except that it is cyclically shifted downwards.+For example, here is a 4-by-4 circulant matrix:+\f[ \begin{bmatrix}+    1 & 8 & 4 & 2 \\+    2 & 1 & 8 & 4 \\+    4 & 2 & 1 & 8 \\+    8 & 4 & 2 & 1+\end{bmatrix} \f]+A circulant matrix is uniquely determined by its first column. We wish+to write a function \c makeCirculant which, given the first column,+returns an expression representing the circulant matrix.++For this exercise, the return type of \c makeCirculant will be a CwiseNullaryOp that we need to instantiate with:+1 - a proper \c circulant_functor storing the input vector and implementing the adequate coefficient accessor \c operator(i,j)+2 - a template instantiation of class Matrix conveying compile-time information such as the scalar type, sizes, and preferred storage layout.++Calling \c ArgType the type of the input vector, we can construct the equivalent squared Matrix type as follows:++\snippet make_circulant2.cpp square++This little helper structure will help us to implement our \c makeCirculant function as follows:++\snippet make_circulant2.cpp makeCirculant++As usual, our function takes as argument a \c MatrixBase (see this \ref TopicFunctionTakingEigenTypes "page" for more details).+Then, the CwiseNullaryOp object is constructed through the DenseBase::NullaryExpr static method with the adequate runtime sizes.++Then, we need to implement our \c circulant_functor, which is a straightforward exercise:++\snippet make_circulant2.cpp circulant_func++We are now all set to try our new feature:++\snippet make_circulant2.cpp main+++If all the fragments are combined, the following output is produced,+showing that the program works as expected:++\include make_circulant2.out++This implementation of \c makeCirculant is much simpler than \ref TopicNewExpressionType "defining a new expression" from scratch.+++\section NullaryExpr_Indexing Example 2: indexing rows and columns++The goal here is to mimic MatLab's ability to index a matrix through two vectors of indices referencing the rows and columns to be picked respectively, like this:++\snippet nullary_indexing.out main1++To this end, let us first write a nullary-functor storing references to the input matrix and to the two arrays of indices, and implementing the required \c operator()(i,j):++\snippet nullary_indexing.cpp functor++Then, let's create an \c indexing(A,rows,cols) function creating the nullary expression:++\snippet nullary_indexing.cpp function++Finally, here is an example of how this function can be used:++\snippet nullary_indexing.cpp main1++This straightforward implementation is already quite powerful as the row or column index arrays can also be expressions to perform offsetting, modulo, striding, reverse, etc.++\snippet nullary_indexing.cpp main2++and the output is:++\snippet nullary_indexing.out main2++*/++}+
+ eigen3/doc/CustomizingEigen_Plugins.dox view
@@ -0,0 +1,69 @@+namespace Eigen {++/** \page TopicCustomizing_Plugins Extending MatrixBase (and other classes)++In this section we will see how to add custom methods to MatrixBase. Since all expressions and matrix types inherit MatrixBase, adding a method to MatrixBase make it immediately available to all expressions ! A typical use case is, for instance, to make Eigen compatible with another API.++You certainly know that in C++ it is not possible to add methods to an existing class. So how that's possible ? Here the trick is to include in the declaration of MatrixBase a file defined by the preprocessor token \c EIGEN_MATRIXBASE_PLUGIN:+\code+class MatrixBase {+  // ...+  #ifdef EIGEN_MATRIXBASE_PLUGIN+  #include EIGEN_MATRIXBASE_PLUGIN+  #endif+};+\endcode+Therefore to extend MatrixBase with your own methods you just have to create a file with your method declaration and define EIGEN_MATRIXBASE_PLUGIN before you include any Eigen's header file.++You can extend many of the other classes used in Eigen by defining similarly named preprocessor symbols. For instance, define \c EIGEN_ARRAYBASE_PLUGIN if you want to extend the ArrayBase class. A full list of classes that can be extended in this way and the corresponding preprocessor symbols can be found on our page \ref TopicPreprocessorDirectives.++Here is an example of an extension file for adding methods to MatrixBase: \n+\b MatrixBaseAddons.h+\code+inline Scalar at(uint i, uint j) const { return this->operator()(i,j); }+inline Scalar& at(uint i, uint j) { return this->operator()(i,j); }+inline Scalar at(uint i) const { return this->operator[](i); }+inline Scalar& at(uint i) { return this->operator[](i); }++inline RealScalar squaredLength() const { return squaredNorm(); }+inline RealScalar length() const { return norm(); }+inline RealScalar invLength(void) const { return fast_inv_sqrt(squaredNorm()); }++template<typename OtherDerived>+inline Scalar squaredDistanceTo(const MatrixBase<OtherDerived>& other) const+{ return (derived() - other.derived()).squaredNorm(); }++template<typename OtherDerived>+inline RealScalar distanceTo(const MatrixBase<OtherDerived>& other) const+{ return internal::sqrt(derived().squaredDistanceTo(other)); }++inline void scaleTo(RealScalar l) { RealScalar vl = norm(); if (vl>1e-9) derived() *= (l/vl); }++inline Transpose<Derived> transposed() {return this->transpose();}+inline const Transpose<Derived> transposed() const {return this->transpose();}++inline uint minComponentId(void) const  { int i; this->minCoeff(&i); return i; }+inline uint maxComponentId(void) const  { int i; this->maxCoeff(&i); return i; }++template<typename OtherDerived>+void makeFloor(const MatrixBase<OtherDerived>& other) { derived() = derived().cwiseMin(other.derived()); }+template<typename OtherDerived>+void makeCeil(const MatrixBase<OtherDerived>& other) { derived() = derived().cwiseMax(other.derived()); }++const CwiseBinaryOp<internal::scalar_sum_op<Scalar>, const Derived, const ConstantReturnType>+operator+(const Scalar& scalar) const+{ return CwiseBinaryOp<internal::scalar_sum_op<Scalar>, const Derived, const ConstantReturnType>(derived(), Constant(rows(),cols(),scalar)); }++friend const CwiseBinaryOp<internal::scalar_sum_op<Scalar>, const ConstantReturnType, Derived>+operator+(const Scalar& scalar, const MatrixBase<Derived>& mat)+{ return CwiseBinaryOp<internal::scalar_sum_op<Scalar>, const ConstantReturnType, Derived>(Constant(rows(),cols(),scalar), mat.derived()); }+\endcode++Then one can the following declaration in the config.h or whatever prerequisites header file of his project:+\code+#define EIGEN_MATRIXBASE_PLUGIN "MatrixBaseAddons.h"+\endcode++*/++}
+ eigen3/doc/DenseDecompositionBenchmark.dox view
@@ -0,0 +1,42 @@+namespace Eigen {++/** \eigenManualPage DenseDecompositionBenchmark Benchmark of dense decompositions++This page presents a speed comparison of the dense matrix decompositions offered by %Eigen for a wide range of square matrices and overconstrained problems.++For a more general overview on the features and numerical robustness of linear solvers and decompositions, check this \link TopicLinearAlgebraDecompositions table \endlink.++This benchmark has been run on a laptop equipped with an Intel core i7 \@ 2,6 GHz, and compiled with clang with \b AVX and \b FMA instruction sets enabled but without multi-threading.+It uses \b single \b precision \b float numbers. For double, you can get a good estimate by multiplying the timings by a factor 2.++The square matrices are symmetric, and for the overconstrained matrices, the reported timmings include the cost to compute the symmetric covariance matrix \f$ A^T A \f$ for the first four solvers based on Cholesky and LU, as denoted by the \b * symbol (top-right corner part of the table).+Timings are in \b milliseconds, and factors are relative to the LLT decomposition which is the fastest but also the least general and robust.++<table class="manual">+<tr><th>solver/size</th>+  <th>8x8</th>  <th>100x100</th>  <th>1000x1000</th>  <th>4000x4000</th>  <th>10000x8</th>  <th>10000x100</th>  <th>10000x1000</th>  <th>10000x4000</th></tr>+<tr><td>LLT</td><td>0.05</td><td>0.42</td><td>5.83</td><td>374.55</td><td>6.79 <sup><a href="#note_ls">*</a></sup></td><td>30.15 <sup><a href="#note_ls">*</a></sup></td><td>236.34 <sup><a href="#note_ls">*</a></sup></td><td>3847.17 <sup><a href="#note_ls">*</a></sup></td></tr>+<tr class="alt"><td>LDLT</td><td>0.07 (x1.3)</td><td>0.65 (x1.5)</td><td>26.86 (x4.6)</td><td>2361.18 (x6.3)</td><td>6.81 (x1) <sup><a href="#note_ls">*</a></sup></td><td>31.91 (x1.1) <sup><a href="#note_ls">*</a></sup></td><td>252.61 (x1.1) <sup><a href="#note_ls">*</a></sup></td><td>5807.66 (x1.5) <sup><a href="#note_ls">*</a></sup></td></tr>+<tr><td>PartialPivLU</td><td>0.08 (x1.5)</td><td>0.69 (x1.6)</td><td>15.63 (x2.7)</td><td>709.32 (x1.9)</td><td>6.81 (x1) <sup><a href="#note_ls">*</a></sup></td><td>31.32 (x1) <sup><a href="#note_ls">*</a></sup></td><td>241.68 (x1) <sup><a href="#note_ls">*</a></sup></td><td>4270.48 (x1.1) <sup><a href="#note_ls">*</a></sup></td></tr>+<tr class="alt"><td>FullPivLU</td><td>0.1 (x1.9)</td><td>4.48 (x10.6)</td><td>281.33 (x48.2)</td><td>-</td><td>6.83 (x1) <sup><a href="#note_ls">*</a></sup></td><td>32.67 (x1.1) <sup><a href="#note_ls">*</a></sup></td><td>498.25 (x2.1) <sup><a href="#note_ls">*</a></sup></td><td>-</td></tr>+<tr><td>HouseholderQR</td><td>0.19 (x3.5)</td><td>2.18 (x5.2)</td><td>23.42 (x4)</td><td>1337.52 (x3.6)</td><td>34.26 (x5)</td><td>129.01 (x4.3)</td><td>377.37 (x1.6)</td><td>4839.1 (x1.3)</td></tr>+<tr class="alt"><td>ColPivHouseholderQR</td><td>0.23 (x4.3)</td><td>2.23 (x5.3)</td><td>103.34 (x17.7)</td><td>9987.16 (x26.7)</td><td>36.05 (x5.3)</td><td>163.18 (x5.4)</td><td>2354.08 (x10)</td><td>37860.5 (x9.8)</td></tr>+<tr><td>CompleteOrthogonalDecomposition</td><td>0.23 (x4.3)</td><td>2.22 (x5.2)</td><td>99.44 (x17.1)</td><td>10555.3 (x28.2)</td><td>35.75 (x5.3)</td><td>169.39 (x5.6)</td><td>2150.56 (x9.1)</td><td>36981.8 (x9.6)</td></tr>+<tr class="alt"><td>FullPivHouseholderQR</td><td>0.23 (x4.3)</td><td>4.64 (x11)</td><td>289.1 (x49.6)</td><td>-</td><td>69.38 (x10.2)</td><td>446.73 (x14.8)</td><td>4852.12 (x20.5)</td><td>-</td></tr>+<tr><td>JacobiSVD</td><td>1.01 (x18.6)</td><td>71.43 (x168.4)</td><td>-</td><td>-</td><td>113.81 (x16.7)</td><td>1179.66 (x39.1)</td><td>-</td><td>-</td></tr>+<tr class="alt"><td>BDCSVD</td><td>1.07 (x19.7)</td><td>21.83 (x51.5)</td><td>331.77 (x56.9)</td><td>18587.9 (x49.6)</td><td>110.53 (x16.3)</td><td>397.67 (x13.2)</td><td>2975 (x12.6)</td><td>48593.2 (x12.6)</td></tr>+</table>++<a name="note_ls">\b *: </a> This decomposition do not support direct least-square solving for over-constrained problems, and the reported timing include the cost to form the symmetric covariance matrix \f$ A^T A \f$.++\b Observations:+ + LLT is always the fastest solvers.+ + For largely over-constrained problems, the cost of Cholesky/LU decompositions is dominated by the computation of the symmetric covariance matrix.+ + For large problem sizes, only the decomposition implementing a cache-friendly blocking strategy scale well. Those include LLT, PartialPivLU, HouseholderQR, and BDCSVD. This explain why for a 4k x 4k matrix, HouseholderQR is faster than LDLT. In the future, LDLT and ColPivHouseholderQR will also implement blocking strategies.+ + CompleteOrthogonalDecomposition is based on ColPivHouseholderQR and they thus achieve the same level of performance.++The above table has been generated by the <a href="https://bitbucket.org/eigen/eigen/raw/default/bench/dense_solvers.cpp">bench/dense_solvers.cpp</a> file, feel-free to hack it to generate a table matching your hardware, compiler, and favorite problem sizes.++*/++}
+ eigen3/doc/Doxyfile.in view
@@ -0,0 +1,1901 @@+# Doxyfile 1.8.1.1++# This file describes the settings to be used by the documentation system+# doxygen (www.doxygen.org) for a project.+#+# All text after a hash (#) is considered a comment and will be ignored.+# The format is:+#       TAG = value [value, ...]+# For lists items can also be appended using:+#       TAG += value [value, ...]+# Values that contain spaces should be placed between quotes (" ").++#---------------------------------------------------------------------------+# Project related configuration options+#---------------------------------------------------------------------------++# This tag specifies the encoding used for all characters in the config file+# that follow. The default is UTF-8 which is also the encoding used for all+# text before the first occurrence of this tag. Doxygen uses libiconv (or the+# iconv built into libc) for the transcoding. See+# http://www.gnu.org/software/libiconv for the list of possible encodings.++DOXYFILE_ENCODING      = UTF-8++# The PROJECT_NAME tag is a single word (or sequence of words) that should+# identify the project. Note that if you do not use Doxywizard you need+# to put quotes around the project name if it contains spaces.++PROJECT_NAME           = ${EIGEN_DOXY_PROJECT_NAME}++# The PROJECT_NUMBER tag can be used to enter a project or revision number.+# This could be handy for archiving the generated documentation or+# if some version control system is used.++# EIGEN_VERSION is set in the root CMakeLists.txt++PROJECT_NUMBER         = "${EIGEN_VERSION}"++# Using the PROJECT_BRIEF tag one can provide an optional one line description+# for a project that appears at the top of each page and should give viewer+# a quick idea about the purpose of the project. Keep the description short.++PROJECT_BRIEF          =++# With the PROJECT_LOGO tag one can specify an logo or icon that is+# included in the documentation. The maximum height of the logo should not+# exceed 55 pixels and the maximum width should not exceed 200 pixels.+# Doxygen will copy the logo to the output directory.++PROJECT_LOGO           = "${Eigen_SOURCE_DIR}/doc/Eigen_Silly_Professor_64x64.png"++# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)+# base path where the generated documentation will be put.+# If a relative path is entered, it will be relative to the location+# where doxygen was started. If left blank the current directory will be used.++OUTPUT_DIRECTORY       = "${Eigen_BINARY_DIR}/doc${EIGEN_DOXY_OUTPUT_DIRECTORY_SUFFIX}"++# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create+# 4096 sub-directories (in 2 levels) under the output directory of each output+# format and will distribute the generated files over these directories.+# Enabling this option can be useful when feeding doxygen a huge amount of+# source files, where putting all generated files in the same directory would+# otherwise cause performance problems for the file system.++CREATE_SUBDIRS         = NO++# The OUTPUT_LANGUAGE tag is used to specify the language in which all+# documentation generated by doxygen is written. Doxygen will use this+# information to generate all constant output in the proper language.+# The default language is English, other supported languages are:+# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional,+# Croatian, Czech, Danish, Dutch, Esperanto, Farsi, Finnish, French, German,+# Greek, Hungarian, Italian, Japanese, Japanese-en (Japanese with English+# messages), Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian,+# Polish, Portuguese, Romanian, Russian, Serbian, Serbian-Cyrillic, Slovak,+# Slovene, Spanish, Swedish, Ukrainian, and Vietnamese.++OUTPUT_LANGUAGE        = English++# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will+# include brief member descriptions after the members that are listed in+# the file and class documentation (similar to JavaDoc).+# Set to NO to disable this.++BRIEF_MEMBER_DESC      = YES++# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend+# the brief description of a member or function before the detailed description.+# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the+# brief descriptions will be completely suppressed.++REPEAT_BRIEF           = YES++# This tag implements a quasi-intelligent brief description abbreviator+# that is used to form the text in various listings. Each string+# in this list, if found as the leading text of the brief description, will be+# stripped from the text and the result after processing the whole list, is+# used as the annotated text. Otherwise, the brief description is used as-is.+# If left blank, the following values are used ("$name" is automatically+# replaced with the name of the entity): "The $name class" "The $name widget"+# "The $name file" "is" "provides" "specifies" "contains"+# "represents" "a" "an" "the"++ABBREVIATE_BRIEF       = "The $name class" \+                         "The $name widget" \+                         "The $name file" \+                         is \+                         provides \+                         specifies \+                         contains \+                         represents \+                         a \+                         an \+                         the++# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then+# Doxygen will generate a detailed section even if there is only a brief+# description.++ALWAYS_DETAILED_SEC    = NO++# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all+# inherited members of a class in the documentation of that class as if those+# members were ordinary class members. Constructors, destructors and assignment+# operators of the base classes will not be shown.++INLINE_INHERITED_MEMB  = NO++# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full+# path before files name in the file list and in the header files. If set+# to NO the shortest path that makes the file name unique will be used.++FULL_PATH_NAMES        = NO++# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag+# can be used to strip a user-defined part of the path. Stripping is+# only done if one of the specified strings matches the left-hand part of+# the path. The tag can be used to show relative paths in the file list.+# If left blank the directory from which doxygen is run is used as the+# path to strip.++STRIP_FROM_PATH        =++# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of+# the path mentioned in the documentation of a class, which tells+# the reader which header file to include in order to use a class.+# If left blank only the name of the header file containing the class+# definition is used. Otherwise one should specify the include paths that+# are normally passed to the compiler using the -I flag.++STRIP_FROM_INC_PATH    =++# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter+# (but less readable) file names. This can be useful if your file system+# doesn't support long names like on DOS, Mac, or CD-ROM.++SHORT_NAMES            = NO++# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen+# will interpret the first line (until the first dot) of a JavaDoc-style+# comment as the brief description. If set to NO, the JavaDoc+# comments will behave just like regular Qt-style comments+# (thus requiring an explicit @brief command for a brief description.)++JAVADOC_AUTOBRIEF      = NO++# If the QT_AUTOBRIEF tag is set to YES then Doxygen will+# interpret the first line (until the first dot) of a Qt-style+# comment as the brief description. If set to NO, the comments+# will behave just like regular Qt-style comments (thus requiring+# an explicit \brief command for a brief description.)++QT_AUTOBRIEF           = NO++# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen+# treat a multi-line C++ special comment block (i.e. a block of //! or ///+# comments) as a brief description. This used to be the default behaviour.+# The new default is to treat a multi-line C++ comment block as a detailed+# description. Set this tag to YES if you prefer the old behaviour instead.++MULTILINE_CPP_IS_BRIEF = NO++# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented+# member inherits the documentation from any documented member that it+# re-implements.++INHERIT_DOCS           = YES++# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce+# a new page for each member. If set to NO, the documentation of a member will+# be part of the file/class/namespace that contains it.++SEPARATE_MEMBER_PAGES  = NO++# The TAB_SIZE tag can be used to set the number of spaces in a tab.+# Doxygen uses this value to replace tabs by spaces in code fragments.++TAB_SIZE               = 8++# This tag can be used to specify a number of aliases that acts+# as commands in the documentation. An alias has the form "name=value".+# For example adding "sideeffect=\par Side Effects:\n" will allow you to+# put the command \sideeffect (or @sideeffect) in the documentation, which+# will result in a user-defined paragraph with heading "Side Effects:".+# You can put \n's in the value part of an alias to insert newlines.++ALIASES                = "only_for_vectors=This is only for vectors (either row-vectors or column-vectors), i.e. matrices which are known at compile-time to have either one row or one column." \+                         "not_reentrant=\warning This function is not re-entrant." \+                         "array_module=This is defined in the %Array module. \code #include <Eigen/Array> \endcode" \+                         "cholesky_module=This is defined in the %Cholesky module. \code #include <Eigen/Cholesky> \endcode" \+                         "eigenvalues_module=This is defined in the %Eigenvalues module. \code #include <Eigen/Eigenvalues> \endcode" \+                         "geometry_module=This is defined in the %Geometry module. \code #include <Eigen/Geometry> \endcode" \+                         "householder_module=This is defined in the %Householder module. \code #include <Eigen/Householder> \endcode" \+                         "jacobi_module=This is defined in the %Jacobi module. \code #include <Eigen/Jacobi> \endcode" \+                         "lu_module=This is defined in the %LU module. \code #include <Eigen/LU> \endcode" \+                         "qr_module=This is defined in the %QR module. \code #include <Eigen/QR> \endcode" \+                         "svd_module=This is defined in the %SVD module. \code #include <Eigen/SVD> \endcode" \+                         "specialfunctions_module=This is defined in the \b unsupported SpecialFunctions module. \code #include <Eigen/SpecialFunctions> \endcode" \+                         "label=\bug" \+                         "matrixworld=<a href='#matrixonly' style='color:green;text-decoration: none;'>*</a>" \+                         "arrayworld=<a href='#arrayonly' style='color:blue;text-decoration: none;'>*</a>" \+                         "note_about_arbitrary_choice_of_solution=If there exists more than one solution, this method will arbitrarily choose one." \+                         "note_about_using_kernel_to_study_multiple_solutions=If you need a complete analysis of the space of solutions, take the one solution obtained by this method and add to it elements of the kernel, as determined by kernel()." \+                         "note_about_checking_solutions=This method just tries to find as good a solution as possible. If you want to check whether a solution exists or if it is accurate, just call this function to get a result and then compute the error of this result, or use MatrixBase::isApprox() directly, for instance like this: \code bool a_solution_exists = (A*result).isApprox(b, precision); \endcode This method avoids dividing by zero, so that the non-existence of a solution doesn't by itself mean that you'll get \c inf or \c nan values." \+                         "note_try_to_help_rvo=This function returns the result by value. In order to make that efficient, it is implemented as just a return statement using a special constructor, hopefully allowing the compiler to perform a RVO (return value optimization)." \+                         "nonstableyet=\warning This is not considered to be part of the stable public API yet. Changes may happen in future releases. See \ref Experimental \"Experimental parts of Eigen\"" \+                         "implsparsesolverconcept=This class follows the \link TutorialSparseSolverConcept sparse solver concept \endlink." \+                         "blank= " \+                         "cpp11=<span class='cpp11'>[c++11]</span>" \+                         "cpp14=<span class='cpp14'>[c++14]</span>" \+                         "cpp17=<span class='cpp17'>[c++17]</span>"+                         ++ALIASES += "eigenAutoToc=  "+ALIASES += "eigenManualPage=\defgroup"++# This tag can be used to specify a number of word-keyword mappings (TCL only).+# A mapping has the form "name=value". For example adding+# "class=itcl::class" will allow you to use the command class in the+# itcl::class meaning.++TCL_SUBST              =++# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C+# sources only. Doxygen will then generate output that is more tailored for C.+# For instance, some of the names that are used will be different. The list+# of all members will be omitted, etc.++OPTIMIZE_OUTPUT_FOR_C  = NO++# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java+# sources only. Doxygen will then generate output that is more tailored for+# Java. For instance, namespaces will be presented as packages, qualified+# scopes will look different, etc.++OPTIMIZE_OUTPUT_JAVA   = NO++# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran+# sources only. Doxygen will then generate output that is more tailored for+# Fortran.++OPTIMIZE_FOR_FORTRAN   = NO++# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL+# sources. Doxygen will then generate output that is tailored for+# VHDL.++OPTIMIZE_OUTPUT_VHDL   = NO++# Doxygen selects the parser to use depending on the extension of the files it+# parses. With this tag you can assign which parser to use for a given extension.+# Doxygen has a built-in mapping, but you can override or extend it using this+# tag. The format is ext=language, where ext is a file extension, and language+# is one of the parsers supported by doxygen: IDL, Java, Javascript, CSharp, C,+# C++, D, PHP, Objective-C, Python, Fortran, VHDL, C, C++. For instance to make+# doxygen treat .inc files as Fortran files (default is PHP), and .f files as C+# (default is Fortran), use: inc=Fortran f=C. Note that for custom extensions+# you also need to set FILE_PATTERNS otherwise the files are not read by doxygen.++EXTENSION_MAPPING      = .h=C++ no_extension=C++++# If MARKDOWN_SUPPORT is enabled (the default) then doxygen pre-processes all+# comments according to the Markdown format, which allows for more readable+# documentation. See http://daringfireball.net/projects/markdown/ for details.+# The output of markdown processing is further processed by doxygen, so you+# can mix doxygen, HTML, and XML commands with Markdown formatting.+# Disable only in case of backward compatibilities issues.++MARKDOWN_SUPPORT       = YES++# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want+# to include (a tag file for) the STL sources as input, then you should+# set this tag to YES in order to let doxygen match functions declarations and+# definitions whose arguments contain STL classes (e.g. func(std::string); v.s.+# func(std::string) {}). This also makes the inheritance and collaboration+# diagrams that involve STL classes more complete and accurate.++BUILTIN_STL_SUPPORT    = NO++# If you use Microsoft's C++/CLI language, you should set this option to YES to+# enable parsing support.++CPP_CLI_SUPPORT        = NO++# Set the SIP_SUPPORT tag to YES if your project consists of sip sources only.+# Doxygen will parse them like normal C++ but will assume all classes use public+# instead of private inheritance when no explicit protection keyword is present.++SIP_SUPPORT            = NO++# For Microsoft's IDL there are propget and propput attributes to indicate getter+# and setter methods for a property. Setting this option to YES (the default)+# will make doxygen replace the get and set methods by a property in the+# documentation. This will only work if the methods are indeed getting or+# setting a simple type. If this is not the case, or you want to show the+# methods anyway, you should set this option to NO.++IDL_PROPERTY_SUPPORT   = YES++# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC+# tag is set to YES, then doxygen will reuse the documentation of the first+# member in the group (if any) for the other members of the group. By default+# all members of a group must be documented explicitly.++DISTRIBUTE_GROUP_DOC   = YES++# Set the SUBGROUPING tag to YES (the default) to allow class member groups of+# the same type (for instance a group of public functions) to be put as a+# subgroup of that type (e.g. under the Public Functions section). Set it to+# NO to prevent subgrouping. Alternatively, this can be done per class using+# the \nosubgrouping command.++SUBGROUPING            = YES++# When the INLINE_GROUPED_CLASSES tag is set to YES, classes, structs and+# unions are shown inside the group in which they are included (e.g. using+# @ingroup) instead of on a separate page (for HTML and Man pages) or+# section (for LaTeX and RTF).++INLINE_GROUPED_CLASSES = NO++# When the INLINE_SIMPLE_STRUCTS tag is set to YES, structs, classes, and+# unions with only public data fields will be shown inline in the documentation+# of the scope in which they are defined (i.e. file, namespace, or group+# documentation), provided this scope is documented. If set to NO (the default),+# structs, classes, and unions are shown on a separate page (for HTML and Man+# pages) or section (for LaTeX and RTF).++INLINE_SIMPLE_STRUCTS  = NO++# When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum+# is documented as struct, union, or enum with the name of the typedef. So+# typedef struct TypeS {} TypeT, will appear in the documentation as a struct+# with name TypeT. When disabled the typedef will appear as a member of a file,+# namespace, or class. And the struct will be named TypeS. This can typically+# be useful for C code in case the coding convention dictates that all compound+# types are typedef'ed and only the typedef is referenced, never the tag name.++TYPEDEF_HIDES_STRUCT   = NO++# The SYMBOL_CACHE_SIZE determines the size of the internal cache use to+# determine which symbols to keep in memory and which to flush to disk.+# When the cache is full, less often used symbols will be written to disk.+# For small to medium size projects (<1000 input files) the default value is+# probably good enough. For larger projects a too small cache size can cause+# doxygen to be busy swapping symbols to and from disk most of the time+# causing a significant performance penalty.+# If the system has enough physical memory increasing the cache will improve the+# performance by keeping more symbols in memory. Note that the value works on+# a logarithmic scale so increasing the size by one will roughly double the+# memory usage. The cache size is given by this formula:+# 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0,+# corresponding to a cache size of 2^16 = 65536 symbols.++# SYMBOL_CACHE_SIZE      = 0++# Similar to the SYMBOL_CACHE_SIZE the size of the symbol lookup cache can be+# set using LOOKUP_CACHE_SIZE. This cache is used to resolve symbols given+# their name and scope. Since this can be an expensive process and often the+# same symbol appear multiple times in the code, doxygen keeps a cache of+# pre-resolved symbols. If the cache is too small doxygen will become slower.+# If the cache is too large, memory is wasted. The cache size is given by this+# formula: 2^(16+LOOKUP_CACHE_SIZE). The valid range is 0..9, the default is 0,+# corresponding to a cache size of 2^16 = 65536 symbols.++LOOKUP_CACHE_SIZE      = 0++#---------------------------------------------------------------------------+# Build related configuration options+#---------------------------------------------------------------------------++# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in+# documentation are documented, even if no documentation was available.+# Private class members and static file members will be hidden unless+# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES++EXTRACT_ALL            = NO++# If the EXTRACT_PRIVATE tag is set to YES all private members of a class+# will be included in the documentation.++EXTRACT_PRIVATE        = NO++# If the EXTRACT_PACKAGE tag is set to YES all members with package or internal scope will be included in the documentation.++EXTRACT_PACKAGE        = NO++# If the EXTRACT_STATIC tag is set to YES all static members of a file+# will be included in the documentation.++EXTRACT_STATIC         = NO++# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs)+# defined locally in source files will be included in the documentation.+# If set to NO only classes defined in header files are included.++EXTRACT_LOCAL_CLASSES  = NO++# This flag is only useful for Objective-C code. When set to YES local+# methods, which are defined in the implementation section but not in+# the interface are included in the documentation.+# If set to NO (the default) only methods in the interface are included.++EXTRACT_LOCAL_METHODS  = NO++# If this flag is set to YES, the members of anonymous namespaces will be+# extracted and appear in the documentation as a namespace called+# 'anonymous_namespace{file}', where file will be replaced with the base+# name of the file that contains the anonymous namespace. By default+# anonymous namespaces are hidden.++EXTRACT_ANON_NSPACES   = NO++# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all+# undocumented members of documented classes, files or namespaces.+# If set to NO (the default) these members will be included in the+# various overviews, but no documentation section is generated.+# This option has no effect if EXTRACT_ALL is enabled.++HIDE_UNDOC_MEMBERS     = YES++# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all+# undocumented classes that are normally visible in the class hierarchy.+# If set to NO (the default) these classes will be included in the various+# overviews. This option has no effect if EXTRACT_ALL is enabled.++HIDE_UNDOC_CLASSES     = YES++# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all+# friend (class|struct|union) declarations.+# If set to NO (the default) these declarations will be included in the+# documentation.++HIDE_FRIEND_COMPOUNDS  = YES++# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any+# documentation blocks found inside the body of a function.+# If set to NO (the default) these blocks will be appended to the+# function's detailed documentation block.++HIDE_IN_BODY_DOCS      = NO++# The INTERNAL_DOCS tag determines if documentation+# that is typed after a \internal command is included. If the tag is set+# to NO (the default) then the documentation will be excluded.+# Set it to YES to include the internal documentation.++INTERNAL_DOCS          = ${EIGEN_DOXY_INTERNAL}++# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate+# file names in lower-case letters. If set to YES upper-case letters are also+# allowed. This is useful if you have classes or files whose names only differ+# in case and if your file system supports case sensitive file names. Windows+# and Mac users are advised to set this option to NO.++CASE_SENSE_NAMES       = YES++# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen+# will show members with their full class and namespace scopes in the+# documentation. If set to YES the scope will be hidden.++HIDE_SCOPE_NAMES       = NO++# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen+# will put a list of the files that are included by a file in the documentation+# of that file.++SHOW_INCLUDE_FILES     = ${EIGEN_DOXY_INTERNAL}++# If the FORCE_LOCAL_INCLUDES tag is set to YES then Doxygen+# will list include files with double quotes in the documentation+# rather than with sharp brackets.++FORCE_LOCAL_INCLUDES   = NO++# If the INLINE_INFO tag is set to YES (the default) then a tag [inline]+# is inserted in the documentation for inline members.++INLINE_INFO            = YES++# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen+# will sort the (detailed) documentation of file and class members+# alphabetically by member name. If set to NO the members will appear in+# declaration order.++SORT_MEMBER_DOCS       = YES++# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the+# brief documentation of file, namespace and class members alphabetically+# by member name. If set to NO (the default) the members will appear in+# declaration order.++SORT_BRIEF_DOCS        = YES++# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen+# will sort the (brief and detailed) documentation of class members so that+# constructors and destructors are listed first. If set to NO (the default)+# the constructors will appear in the respective orders defined by+# SORT_MEMBER_DOCS and SORT_BRIEF_DOCS.+# This tag will be ignored for brief docs if SORT_BRIEF_DOCS is set to NO+# and ignored for detailed docs if SORT_MEMBER_DOCS is set to NO.++SORT_MEMBERS_CTORS_1ST = NO++# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the+# hierarchy of group names into alphabetical order. If set to NO (the default)+# the group names will appear in their defined order.++SORT_GROUP_NAMES       = NO++# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be+# sorted by fully-qualified names, including namespaces. If set to+# NO (the default), the class list will be sorted only by class name,+# not including the namespace part.+# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES.+# Note: This option applies only to the class list, not to the+# alphabetical list.++SORT_BY_SCOPE_NAME     = NO++# If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to+# do proper type resolution of all parameters of a function it will reject a+# match between the prototype and the implementation of a member function even+# if there is only one candidate or it is obvious which candidate to choose+# by doing a simple string match. By disabling STRICT_PROTO_MATCHING doxygen+# will still accept a match between prototype and implementation in such cases.++STRICT_PROTO_MATCHING  = NO++# The GENERATE_TODOLIST tag can be used to enable (YES) or+# disable (NO) the todo list. This list is created by putting \todo+# commands in the documentation.++GENERATE_TODOLIST      = ${EIGEN_DOXY_INTERNAL}++# The GENERATE_TESTLIST tag can be used to enable (YES) or+# disable (NO) the test list. This list is created by putting \test+# commands in the documentation.++GENERATE_TESTLIST      = NO++# The GENERATE_BUGLIST tag can be used to enable (YES) or+# disable (NO) the bug list. This list is created by putting \bug+# commands in the documentation.++GENERATE_BUGLIST       = ${EIGEN_DOXY_INTERNAL}++# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or+# disable (NO) the deprecated list. This list is created by putting+# \deprecated commands in the documentation.++GENERATE_DEPRECATEDLIST= YES++# The ENABLED_SECTIONS tag can be used to enable conditional+# documentation sections, marked by \if sectionname ... \endif.++ENABLED_SECTIONS       =++# The MAX_INITIALIZER_LINES tag determines the maximum number of lines+# the initial value of a variable or macro consists of for it to appear in+# the documentation. If the initializer consists of more lines than specified+# here it will be hidden. Use a value of 0 to hide initializers completely.+# The appearance of the initializer of individual variables and macros in the+# documentation can be controlled using \showinitializer or \hideinitializer+# command in the documentation regardless of this setting.++MAX_INITIALIZER_LINES  = 0++# Set the SHOW_USED_FILES tag to NO to disable the list of files generated+# at the bottom of the documentation of classes and structs. If set to YES the+# list will mention the files that were used to generate the documentation.++SHOW_USED_FILES        = YES++# Set the SHOW_FILES tag to NO to disable the generation of the Files page.+# This will remove the Files entry from the Quick Index and from the+# Folder Tree View (if specified). The default is YES.++SHOW_FILES             = YES++# Set the SHOW_NAMESPACES tag to NO to disable the generation of the+# Namespaces page.+# This will remove the Namespaces entry from the Quick Index+# and from the Folder Tree View (if specified). The default is YES.++SHOW_NAMESPACES        = NO++# The FILE_VERSION_FILTER tag can be used to specify a program or script that+# doxygen should invoke to get the current version for each file (typically from+# the version control system). Doxygen will invoke the program by executing (via+# popen()) the command <command> <input-file>, where <command> is the value of+# the FILE_VERSION_FILTER tag, and <input-file> is the name of an input file+# provided by doxygen. Whatever the program writes to standard output+# is used as the file version. See the manual for examples.++FILE_VERSION_FILTER    =++# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed+# by doxygen. The layout file controls the global structure of the generated+# output files in an output format independent way. To create the layout file+# that represents doxygen's defaults, run doxygen with the -l option.+# You can optionally specify a file name after the option, if omitted+# DoxygenLayout.xml will be used as the name of the layout file.++LAYOUT_FILE            = "${Eigen_BINARY_DIR}/doc${EIGEN_DOXY_OUTPUT_DIRECTORY_SUFFIX}/eigendoxy_layout.xml"++# The CITE_BIB_FILES tag can be used to specify one or more bib files+# containing the references data. This must be a list of .bib files. The+# .bib extension is automatically appended if omitted. Using this command+# requires the bibtex tool to be installed. See also+# http://en.wikipedia.org/wiki/BibTeX for more info. For LaTeX the style+# of the bibliography can be controlled using LATEX_BIB_STYLE. To use this+# feature you need bibtex and perl available in the search path.++CITE_BIB_FILES         =++#---------------------------------------------------------------------------+# configuration options related to warning and progress messages+#---------------------------------------------------------------------------++# The QUIET tag can be used to turn on/off the messages that are generated+# by doxygen. Possible values are YES and NO. If left blank NO is used.++QUIET                  = NO++# The WARNINGS tag can be used to turn on/off the warning messages that are+# generated by doxygen. Possible values are YES and NO. If left blank+# NO is used.++WARNINGS               = YES++# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings+# for undocumented members. If EXTRACT_ALL is set to YES then this flag will+# automatically be disabled.++WARN_IF_UNDOCUMENTED   = NO++# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for+# potential errors in the documentation, such as not documenting some+# parameters in a documented function, or documenting parameters that+# don't exist or using markup commands wrongly.++WARN_IF_DOC_ERROR      = YES++# The WARN_NO_PARAMDOC option can be enabled to get warnings for+# functions that are documented, but have no documentation for their parameters+# or return value. If set to NO (the default) doxygen will only warn about+# wrong or incomplete parameter documentation, but not about the absence of+# documentation.++WARN_NO_PARAMDOC       = NO++# The WARN_FORMAT tag determines the format of the warning messages that+# doxygen can produce. The string should contain the $file, $line, and $text+# tags, which will be replaced by the file and line number from which the+# warning originated and the warning text. Optionally the format may contain+# $version, which will be replaced by the version of the file (if it could+# be obtained via FILE_VERSION_FILTER)++WARN_FORMAT            = "$file:$line: $text"++# The WARN_LOGFILE tag can be used to specify a file to which warning+# and error messages should be written. If left blank the output is written+# to stderr.++WARN_LOGFILE           =++#---------------------------------------------------------------------------+# configuration options related to the input files+#---------------------------------------------------------------------------++# The INPUT tag can be used to specify the files and/or directories that contain+# documented source files. You may enter file names like "myfile.cpp" or+# directories like "/usr/src/myproject". Separate the files or directories+# with spaces.++INPUT                  = ${EIGEN_DOXY_INPUT}++# This tag can be used to specify the character encoding of the source files+# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is+# also the default input encoding. Doxygen uses libiconv (or the iconv built+# into libc) for the transcoding. See http://www.gnu.org/software/libiconv for+# the list of possible encodings.++INPUT_ENCODING         = UTF-8++# If the value of the INPUT tag contains directories, you can use the+# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp+# and *.h) to filter out the source-files in the directories. If left+# blank the following patterns are tested:+# *.c *.cc *.cxx *.cpp *.c++ *.d *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh+# *.hxx *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.dox *.py+# *.f90 *.f *.for *.vhd *.vhdl++FILE_PATTERNS          = *++# The RECURSIVE tag can be used to turn specify whether or not subdirectories+# should be searched for input files as well. Possible values are YES and NO.+# If left blank NO is used.++RECURSIVE              = YES++# The EXCLUDE tag can be used to specify files and/or directories that should be+# excluded from the INPUT source files. This way you can easily exclude a+# subdirectory from a directory tree whose root is specified with the INPUT tag.+# Note that relative paths are relative to the directory from which doxygen is+# run.++EXCLUDE                = "${Eigen_SOURCE_DIR}/Eigen/src/Core/products" \+                         "${Eigen_SOURCE_DIR}/Eigen/Eigen2Support" \+                         "${Eigen_SOURCE_DIR}/Eigen/src/Eigen2Support" \+                         "${Eigen_SOURCE_DIR}/doc/examples" \+                         "${Eigen_SOURCE_DIR}/doc/special_examples" \+                         "${Eigen_SOURCE_DIR}/doc/snippets" \+                         "${Eigen_SOURCE_DIR}/unsupported/doc/examples" \+                         "${Eigen_SOURCE_DIR}/unsupported/doc/snippets"++# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or+# directories that are symbolic links (a Unix file system feature) are excluded+# from the input.++EXCLUDE_SYMLINKS       = NO++# If the value of the INPUT tag contains directories, you can use the+# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude+# certain files from those directories. Note that the wildcards are matched+# against the file with absolute path, so to exclude all test directories+# for example use the pattern */test/*++EXCLUDE_PATTERNS       = CMake* \+                         *.txt \+                         *.sh \+                         *.orig \+                         *.diff \+                         diff \+                         *~ \+                         *. \+                         *.sln \+                         *.sdf \+                         *.tmp \+                         *.vcxproj \+                         *.filters \+                         *.user \+                         *.suo++# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names+# (namespaces, classes, functions, etc.) that should be excluded from the+# output. The symbol name can be a fully qualified name, a word, or if the+# wildcard * is used, a substring. Examples: ANamespace, AClass,+# AClass::ANamespace, ANamespace::*Test++EXCLUDE_SYMBOLS        = internal::* \+                         Flagged* \+                         *InnerIterator* \+                         DenseStorage<* \+                         ++# The EXAMPLE_PATH tag can be used to specify one or more files or+# directories that contain example code fragments that are included (see+# the \include command).++EXAMPLE_PATH           = "${Eigen_SOURCE_DIR}/doc/snippets" \+                         "${Eigen_BINARY_DIR}/doc/snippets" \+                         "${Eigen_SOURCE_DIR}/doc/examples" \+                         "${Eigen_BINARY_DIR}/doc/examples" \+                         "${Eigen_SOURCE_DIR}/doc/special_examples" \+                         "${Eigen_BINARY_DIR}/doc/special_examples" \+                         "${Eigen_SOURCE_DIR}/unsupported/doc/snippets" \+                         "${Eigen_BINARY_DIR}/unsupported/doc/snippets" \+                         "${Eigen_SOURCE_DIR}/unsupported/doc/examples" \+                         "${Eigen_BINARY_DIR}/unsupported/doc/examples"++# If the value of the EXAMPLE_PATH tag contains directories, you can use the+# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp+# and *.h) to filter out the source-files in the directories. If left+# blank all files are included.++EXAMPLE_PATTERNS       = *++# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be+# searched for input files to be used with the \include or \dontinclude+# commands irrespective of the value of the RECURSIVE tag.+# Possible values are YES and NO. If left blank NO is used.++EXAMPLE_RECURSIVE      = NO++# The IMAGE_PATH tag can be used to specify one or more files or+# directories that contain image that are included in the documentation (see+# the \image command).++IMAGE_PATH             = ${Eigen_BINARY_DIR}/doc/html++# The INPUT_FILTER tag can be used to specify a program that doxygen should+# invoke to filter for each input file. Doxygen will invoke the filter program+# by executing (via popen()) the command <filter> <input-file>, where <filter>+# is the value of the INPUT_FILTER tag, and <input-file> is the name of an+# input file. Doxygen will then use the output that the filter program writes+# to standard output.+# If FILTER_PATTERNS is specified, this tag will be+# ignored.++INPUT_FILTER           =++# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern+# basis.+# Doxygen will compare the file name with each pattern and apply the+# filter if there is a match.+# The filters are a list of the form:+# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further+# info on how filters are used. If FILTER_PATTERNS is empty or if+# non of the patterns match the file name, INPUT_FILTER is applied.++FILTER_PATTERNS        =++# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using+# INPUT_FILTER) will be used to filter the input files when producing source+# files to browse (i.e. when SOURCE_BROWSER is set to YES).++FILTER_SOURCE_FILES    = NO++# The FILTER_SOURCE_PATTERNS tag can be used to specify source filters per file+# pattern. A pattern will override the setting for FILTER_PATTERN (if any)+# and it is also possible to disable source filtering for a specific pattern+# using *.ext= (so without naming a filter). This option only has effect when+# FILTER_SOURCE_FILES is enabled.++FILTER_SOURCE_PATTERNS =++#---------------------------------------------------------------------------+# configuration options related to source browsing+#---------------------------------------------------------------------------++# If the SOURCE_BROWSER tag is set to YES then a list of source files will+# be generated. Documented entities will be cross-referenced with these sources.+# Note: To get rid of all source code in the generated output, make sure also+# VERBATIM_HEADERS is set to NO.++SOURCE_BROWSER         = NO++# Setting the INLINE_SOURCES tag to YES will include the body+# of functions and classes directly in the documentation.++INLINE_SOURCES         = NO++# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct+# doxygen to hide any special comment blocks from generated source code+# fragments. Normal C, C++ and Fortran comments will always remain visible.++STRIP_CODE_COMMENTS    = YES++# If the REFERENCED_BY_RELATION tag is set to YES+# then for each documented function all documented+# functions referencing it will be listed.++REFERENCED_BY_RELATION = NO++# If the REFERENCES_RELATION tag is set to YES+# then for each documented function all documented entities+# called/used by that function will be listed.++REFERENCES_RELATION    = NO++# If the REFERENCES_LINK_SOURCE tag is set to YES (the default)+# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from+# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will+# link to the source code.+# Otherwise they will link to the documentation.++REFERENCES_LINK_SOURCE = YES++# If the USE_HTAGS tag is set to YES then the references to source code+# will point to the HTML generated by the htags(1) tool instead of doxygen+# built-in source browser. The htags tool is part of GNU's global source+# tagging system (see http://www.gnu.org/software/global/global.html). You+# will need version 4.8.6 or higher.++USE_HTAGS              = NO++# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen+# will generate a verbatim copy of the header file for each class for+# which an include is specified. Set to NO to disable this.++VERBATIM_HEADERS       = YES++#---------------------------------------------------------------------------+# configuration options related to the alphabetical class index+#---------------------------------------------------------------------------++# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index+# of all compounds will be generated. Enable this if the project+# contains a lot of classes, structs, unions or interfaces.++ALPHABETICAL_INDEX     = NO++# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then+# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns+# in which this list will be split (can be a number in the range [1..20])++COLS_IN_ALPHA_INDEX    = 5++# In case all classes in a project start with a common prefix, all+# classes will be put under the same header in the alphabetical index.+# The IGNORE_PREFIX tag can be used to specify one or more prefixes that+# should be ignored while generating the index headers.++IGNORE_PREFIX          =++#---------------------------------------------------------------------------+# configuration options related to the HTML output+#---------------------------------------------------------------------------++# If the GENERATE_HTML tag is set to YES (the default) Doxygen will+# generate HTML output.++GENERATE_HTML          = YES++# The HTML_OUTPUT tag is used to specify where the HTML docs will be put.+# If a relative path is entered the value of OUTPUT_DIRECTORY will be+# put in front of it. If left blank `html' will be used as the default path.++HTML_OUTPUT            = "${Eigen_BINARY_DIR}/doc/html${EIGEN_DOXY_OUTPUT_DIRECTORY_SUFFIX}"++# The HTML_FILE_EXTENSION tag can be used to specify the file extension for+# each generated HTML page (for example: .htm,.php,.asp). If it is left blank+# doxygen will generate files with .html extension.++HTML_FILE_EXTENSION    = .html++# The HTML_HEADER tag can be used to specify a personal HTML header for+# each generated HTML page. If it is left blank doxygen will generate a+# standard header. Note that when using a custom header you are responsible+#  for the proper inclusion of any scripts and style sheets that doxygen+# needs, which is dependent on the configuration options used.+# It is advised to generate a default header using "doxygen -w html+# header.html footer.html stylesheet.css YourConfigFile" and then modify+# that header. Note that the header is subject to change so you typically+# have to redo this when upgrading to a newer version of doxygen or when+# changing the value of configuration settings such as GENERATE_TREEVIEW!++HTML_HEADER            = "${Eigen_BINARY_DIR}/doc/eigendoxy_header.html"++# The HTML_FOOTER tag can be used to specify a personal HTML footer for+# each generated HTML page. If it is left blank doxygen will generate a+# standard footer.++HTML_FOOTER            = "${Eigen_BINARY_DIR}/doc/eigendoxy_footer.html"++# The HTML_STYLESHEET tag can be used to specify a user-defined cascading+# style sheet that is used by each HTML page. It can be used to+# fine-tune the look of the HTML output. If the tag is left blank doxygen+# will generate a default style sheet. Note that doxygen will try to copy+# the style sheet file to the HTML output directory, so don't put your own+# style sheet in the HTML output directory as well, or it will be erased!++HTML_STYLESHEET        = ++# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or+# other source files which should be copied to the HTML output directory. Note+# that these files will be copied to the base HTML output directory. Use the+# $relpath$ marker in the HTML_HEADER and/or HTML_FOOTER files to load these+# files. In the HTML_STYLESHEET file, use the file name only. Also note that+# the files will be copied as-is; there are no commands or markers available.++HTML_EXTRA_FILES       = "${Eigen_SOURCE_DIR}/doc/eigendoxy.css"++# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output.+# Doxygen will adjust the colors in the style sheet and background images+# according to this color. Hue is specified as an angle on a colorwheel,+# see http://en.wikipedia.org/wiki/Hue for more information.+# For instance the value 0 represents red, 60 is yellow, 120 is green,+# 180 is cyan, 240 is blue, 300 purple, and 360 is red again.+# The allowed range is 0 to 359.+# The default is 220.++HTML_COLORSTYLE_HUE    = ${EIGEN_DOXY_HTML_COLORSTYLE_HUE}++# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of+# the colors in the HTML output. For a value of 0 the output will use+# grayscales only. A value of 255 will produce the most vivid colors.++HTML_COLORSTYLE_SAT    = 100++# The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to+# the luminance component of the colors in the HTML output. Values below+# 100 gradually make the output lighter, whereas values above 100 make+# the output darker. The value divided by 100 is the actual gamma applied,+# so 80 represents a gamma of 0.8, The value 220 represents a gamma of 2.2,+# and 100 does not change the gamma.++HTML_COLORSTYLE_GAMMA  = 80++# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML+# page will contain the date and time when the page was generated. Setting+# this to NO can help when comparing the output of multiple runs.++HTML_TIMESTAMP         = YES++# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML+# documentation will contain sections that can be hidden and shown after the+# page has loaded.++HTML_DYNAMIC_SECTIONS  = YES++# With HTML_INDEX_NUM_ENTRIES one can control the preferred number of+# entries shown in the various tree structured indices initially; the user+# can expand and collapse entries dynamically later on. Doxygen will expand+# the tree to such a level that at most the specified number of entries are+# visible (unless a fully collapsed tree already exceeds this amount).+# So setting the number of entries 1 will produce a full collapsed tree by+# default. 0 is a special value representing an infinite number of entries+# and will result in a full expanded tree by default.++HTML_INDEX_NUM_ENTRIES = 100++# If the GENERATE_DOCSET tag is set to YES, additional index files+# will be generated that can be used as input for Apple's Xcode 3+# integrated development environment, introduced with OSX 10.5 (Leopard).+# To create a documentation set, doxygen will generate a Makefile in the+# HTML output directory. Running make will produce the docset in that+# directory and running "make install" will install the docset in+# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find+# it at startup.+# See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html+# for more information.++GENERATE_DOCSET        = NO++# When GENERATE_DOCSET tag is set to YES, this tag determines the name of the+# feed. A documentation feed provides an umbrella under which multiple+# documentation sets from a single provider (such as a company or product suite)+# can be grouped.++DOCSET_FEEDNAME        = "Doxygen generated docs"++# When GENERATE_DOCSET tag is set to YES, this tag specifies a string that+# should uniquely identify the documentation set bundle. This should be a+# reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen+# will append .docset to the name.++DOCSET_BUNDLE_ID       = org.doxygen.Project++# When GENERATE_PUBLISHER_ID tag specifies a string that should uniquely identify+# the documentation publisher. This should be a reverse domain-name style+# string, e.g. com.mycompany.MyDocSet.documentation.++DOCSET_PUBLISHER_ID    = org.doxygen.Publisher++# The GENERATE_PUBLISHER_NAME tag identifies the documentation publisher.++DOCSET_PUBLISHER_NAME  = Publisher++# If the GENERATE_HTMLHELP tag is set to YES, additional index files+# will be generated that can be used as input for tools like the+# Microsoft HTML help workshop to generate a compiled HTML help file (.chm)+# of the generated HTML documentation.++GENERATE_HTMLHELP      = NO++# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can+# be used to specify the file name of the resulting .chm file. You+# can add a path in front of the file if the result should not be+# written to the html output directory.++CHM_FILE               =++# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can+# be used to specify the location (absolute path including file name) of+# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run+# the HTML help compiler on the generated index.hhp.++HHC_LOCATION           =++# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag+# controls if a separate .chi index file is generated (YES) or that+# it should be included in the master .chm file (NO).++GENERATE_CHI           = NO++# If the GENERATE_HTMLHELP tag is set to YES, the CHM_INDEX_ENCODING+# is used to encode HtmlHelp index (hhk), content (hhc) and project file+# content.++CHM_INDEX_ENCODING     =++# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag+# controls whether a binary table of contents is generated (YES) or a+# normal table of contents (NO) in the .chm file.++BINARY_TOC             = NO++# The TOC_EXPAND flag can be set to YES to add extra items for group members+# to the contents of the HTML help documentation and to the tree view.++TOC_EXPAND             = NO++# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and+# QHP_VIRTUAL_FOLDER are set, an additional index file will be generated+# that can be used as input for Qt's qhelpgenerator to generate a+# Qt Compressed Help (.qch) of the generated HTML documentation.++GENERATE_QHP           = NO++# If the QHG_LOCATION tag is specified, the QCH_FILE tag can+# be used to specify the file name of the resulting .qch file.+# The path specified is relative to the HTML output folder.++QCH_FILE               =++# The QHP_NAMESPACE tag specifies the namespace to use when generating+# Qt Help Project output. For more information please see+# http://doc.trolltech.com/qthelpproject.html#namespace++QHP_NAMESPACE          = org.doxygen.Project++# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating+# Qt Help Project output. For more information please see+# http://doc.trolltech.com/qthelpproject.html#virtual-folders++QHP_VIRTUAL_FOLDER     = doc++# If QHP_CUST_FILTER_NAME is set, it specifies the name of a custom filter to+# add. For more information please see+# http://doc.trolltech.com/qthelpproject.html#custom-filters++QHP_CUST_FILTER_NAME   =++# The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the+# custom filter to add. For more information please see+# <a href="http://doc.trolltech.com/qthelpproject.html#custom-filters">+# Qt Help Project / Custom Filters</a>.++QHP_CUST_FILTER_ATTRS  =++# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this+# project's+# filter section matches.+# <a href="http://doc.trolltech.com/qthelpproject.html#filter-attributes">+# Qt Help Project / Filter Attributes</a>.++QHP_SECT_FILTER_ATTRS  =++# If the GENERATE_QHP tag is set to YES, the QHG_LOCATION tag can+# be used to specify the location of Qt's qhelpgenerator.+# If non-empty doxygen will try to run qhelpgenerator on the generated+# .qhp file.++QHG_LOCATION           =++# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files+#  will be generated, which together with the HTML files, form an Eclipse help+# plugin. To install this plugin and make it available under the help contents+# menu in Eclipse, the contents of the directory containing the HTML and XML+# files needs to be copied into the plugins directory of eclipse. The name of+# the directory within the plugins directory should be the same as+# the ECLIPSE_DOC_ID value. After copying Eclipse needs to be restarted before+# the help appears.++GENERATE_ECLIPSEHELP   = NO++# A unique identifier for the eclipse help plugin. When installing the plugin+# the directory name containing the HTML and XML files should also have+# this name.++ECLIPSE_DOC_ID         = org.doxygen.Project++# The DISABLE_INDEX tag can be used to turn on/off the condensed index (tabs)+# at top of each HTML page. The value NO (the default) enables the index and+# the value YES disables it. Since the tabs have the same information as the+# navigation tree you can set this option to NO if you already set+# GENERATE_TREEVIEW to YES.++DISABLE_INDEX          = YES++# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index+# structure should be generated to display hierarchical information.+# If the tag value is set to YES, a side panel will be generated+# containing a tree-like index structure (just like the one that+# is generated for HTML Help). For this to work a browser that supports+# JavaScript, DHTML, CSS and frames is required (i.e. any modern browser).+# Windows users are probably better off using the HTML help feature.+# Since the tree basically has the same information as the tab index you+# could consider to set DISABLE_INDEX to NO when enabling this option.++GENERATE_TREEVIEW      = YES++# The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values+# (range [0,1..20]) that doxygen will group on one line in the generated HTML+# documentation. Note that a value of 0 will completely suppress the enum+# values from appearing in the overview section.++ENUM_VALUES_PER_LINE   = 1++# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be+# used to set the initial width (in pixels) of the frame in which the tree+# is shown.++TREEVIEW_WIDTH         = 250++# When the EXT_LINKS_IN_WINDOW option is set to YES doxygen will open+# links to external symbols imported via tag files in a separate window.++EXT_LINKS_IN_WINDOW    = NO++# Use this tag to change the font size of Latex formulas included+# as images in the HTML documentation. The default is 10. Note that+# when you change the font size after a successful doxygen run you need+# to manually remove any form_*.png images from the HTML output directory+# to force them to be regenerated.++FORMULA_FONTSIZE       = 12++# Use the FORMULA_TRANPARENT tag to determine whether or not the images+# generated for formulas are transparent PNGs. Transparent PNGs are+# not supported properly for IE 6.0, but are supported on all modern browsers.+# Note that when changing this option you need to delete any form_*.png files+# in the HTML output before the changes have effect.++FORMULA_TRANSPARENT    = YES++# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax+# (see http://www.mathjax.org) which uses client side Javascript for the+# rendering instead of using prerendered bitmaps. Use this if you do not+# have LaTeX installed or if you want to formulas look prettier in the HTML+# output. When enabled you may also need to install MathJax separately and+# configure the path to it using the MATHJAX_RELPATH option.++USE_MATHJAX            = NO++# When MathJax is enabled you need to specify the location relative to the+# HTML output directory using the MATHJAX_RELPATH option. The destination+# directory should contain the MathJax.js script. For instance, if the mathjax+# directory is located at the same level as the HTML output directory, then+# MATHJAX_RELPATH should be ../mathjax. The default value points to+# the MathJax Content Delivery Network so you can quickly see the result without+# installing MathJax.+# However, it is strongly recommended to install a local+# copy of MathJax from http://www.mathjax.org before deployment.++MATHJAX_RELPATH        = http://cdn.mathjax.org/mathjax/latest++# The MATHJAX_EXTENSIONS tag can be used to specify one or MathJax extension+# names that should be enabled during MathJax rendering.++MATHJAX_EXTENSIONS     =++# When the SEARCHENGINE tag is enabled doxygen will generate a search box+# for the HTML output. The underlying search engine uses javascript+# and DHTML and should work on any modern browser. Note that when using+# HTML help (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets+# (GENERATE_DOCSET) there is already a search function so this one should+# typically be disabled. For large projects the javascript based search engine+# can be slow, then enabling SERVER_BASED_SEARCH may provide a better solution.++SEARCHENGINE           = YES++# When the SERVER_BASED_SEARCH tag is enabled the search engine will be+# implemented using a PHP enabled web server instead of at the web client+# using Javascript. Doxygen will generate the search PHP script and index+# file to put on the web server. The advantage of the server+# based approach is that it scales better to large projects and allows+# full text search. The disadvantages are that it is more difficult to setup+# and does not have live searching capabilities.++SERVER_BASED_SEARCH    = NO++#---------------------------------------------------------------------------+# configuration options related to the LaTeX output+#---------------------------------------------------------------------------++# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will+# generate Latex output.++GENERATE_LATEX         = NO++# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put.+# If a relative path is entered the value of OUTPUT_DIRECTORY will be+# put in front of it. If left blank `latex' will be used as the default path.++LATEX_OUTPUT           = latex++# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be+# invoked. If left blank `latex' will be used as the default command name.+# Note that when enabling USE_PDFLATEX this option is only used for+# generating bitmaps for formulas in the HTML output, but not in the+# Makefile that is written to the output directory.++LATEX_CMD_NAME         = latex++# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to+# generate index for LaTeX. If left blank `makeindex' will be used as the+# default command name.++MAKEINDEX_CMD_NAME     = makeindex++# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact+# LaTeX documents. This may be useful for small projects and may help to+# save some trees in general.++COMPACT_LATEX          = NO++# The PAPER_TYPE tag can be used to set the paper type that is used+# by the printer. Possible values are: a4, letter, legal and+# executive. If left blank a4wide will be used.++PAPER_TYPE             = a4wide++# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX+# packages that should be included in the LaTeX output.++EXTRA_PACKAGES         = amssymb \+                         amsmath++# The LATEX_HEADER tag can be used to specify a personal LaTeX header for+# the generated latex document. The header should contain everything until+# the first chapter. If it is left blank doxygen will generate a+# standard header. Notice: only use this tag if you know what you are doing!++LATEX_HEADER           =++# The LATEX_FOOTER tag can be used to specify a personal LaTeX footer for+# the generated latex document. The footer should contain everything after+# the last chapter. If it is left blank doxygen will generate a+# standard footer. Notice: only use this tag if you know what you are doing!++LATEX_FOOTER           =++# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated+# is prepared for conversion to pdf (using ps2pdf). The pdf file will+# contain links (just like the HTML output) instead of page references+# This makes the output suitable for online browsing using a pdf viewer.++PDF_HYPERLINKS         = NO++# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of+# plain latex in the generated Makefile. Set this option to YES to get a+# higher quality PDF documentation.++USE_PDFLATEX           = NO++# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode.+# command to the generated LaTeX files. This will instruct LaTeX to keep+# running if errors occur, instead of asking the user for help.+# This option is also used when generating formulas in HTML.++LATEX_BATCHMODE        = NO++# If LATEX_HIDE_INDICES is set to YES then doxygen will not+# include the index chapters (such as File Index, Compound Index, etc.)+# in the output.++LATEX_HIDE_INDICES     = NO++# If LATEX_SOURCE_CODE is set to YES then doxygen will include+# source code with syntax highlighting in the LaTeX output.+# Note that which sources are shown also depends on other settings+# such as SOURCE_BROWSER.++LATEX_SOURCE_CODE      = NO++# The LATEX_BIB_STYLE tag can be used to specify the style to use for the+# bibliography, e.g. plainnat, or ieeetr. The default style is "plain". See+# http://en.wikipedia.org/wiki/BibTeX for more info.++LATEX_BIB_STYLE        = plain++#---------------------------------------------------------------------------+# configuration options related to the RTF output+#---------------------------------------------------------------------------++# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output+# The RTF output is optimized for Word 97 and may not look very pretty with+# other RTF readers or editors.++GENERATE_RTF           = NO++# The RTF_OUTPUT tag is used to specify where the RTF docs will be put.+# If a relative path is entered the value of OUTPUT_DIRECTORY will be+# put in front of it. If left blank `rtf' will be used as the default path.++RTF_OUTPUT             = rtf++# If the COMPACT_RTF tag is set to YES Doxygen generates more compact+# RTF documents. This may be useful for small projects and may help to+# save some trees in general.++COMPACT_RTF            = NO++# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated+# will contain hyperlink fields. The RTF file will+# contain links (just like the HTML output) instead of page references.+# This makes the output suitable for online browsing using WORD or other+# programs which support those fields.+# Note: wordpad (write) and others do not support links.++RTF_HYPERLINKS         = NO++# Load style sheet definitions from file. Syntax is similar to doxygen's+# config file, i.e. a series of assignments. You only have to provide+# replacements, missing definitions are set to their default value.++RTF_STYLESHEET_FILE    =++# Set optional variables used in the generation of an rtf document.+# Syntax is similar to doxygen's config file.++RTF_EXTENSIONS_FILE    =++#---------------------------------------------------------------------------+# configuration options related to the man page output+#---------------------------------------------------------------------------++# If the GENERATE_MAN tag is set to YES (the default) Doxygen will+# generate man pages++GENERATE_MAN           = NO++# The MAN_OUTPUT tag is used to specify where the man pages will be put.+# If a relative path is entered the value of OUTPUT_DIRECTORY will be+# put in front of it. If left blank `man' will be used as the default path.++MAN_OUTPUT             = man++# The MAN_EXTENSION tag determines the extension that is added to+# the generated man pages (default is the subroutine's section .3)++MAN_EXTENSION          = .3++# If the MAN_LINKS tag is set to YES and Doxygen generates man output,+# then it will generate one additional man file for each entity+# documented in the real man page(s). These additional files+# only source the real man page, but without them the man command+# would be unable to find the correct page. The default is NO.++MAN_LINKS              = NO++#---------------------------------------------------------------------------+# configuration options related to the XML output+#---------------------------------------------------------------------------++# If the GENERATE_XML tag is set to YES Doxygen will+# generate an XML file that captures the structure of+# the code including all documentation.++GENERATE_XML           = NO++# The XML_OUTPUT tag is used to specify where the XML pages will be put.+# If a relative path is entered the value of OUTPUT_DIRECTORY will be+# put in front of it. If left blank `xml' will be used as the default path.++XML_OUTPUT             = xml++# The XML_SCHEMA tag can be used to specify an XML schema,+# which can be used by a validating XML parser to check the+# syntax of the XML files.++# XML_SCHEMA             =++# The XML_DTD tag can be used to specify an XML DTD,+# which can be used by a validating XML parser to check the+# syntax of the XML files.++# XML_DTD                =++# If the XML_PROGRAMLISTING tag is set to YES Doxygen will+# dump the program listings (including syntax highlighting+# and cross-referencing information) to the XML output. Note that+# enabling this will significantly increase the size of the XML output.++XML_PROGRAMLISTING     = YES++#---------------------------------------------------------------------------+# configuration options for the AutoGen Definitions output+#---------------------------------------------------------------------------++# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will+# generate an AutoGen Definitions (see autogen.sf.net) file+# that captures the structure of the code including all+# documentation. Note that this feature is still experimental+# and incomplete at the moment.++GENERATE_AUTOGEN_DEF   = NO++#---------------------------------------------------------------------------+# configuration options related to the Perl module output+#---------------------------------------------------------------------------++# If the GENERATE_PERLMOD tag is set to YES Doxygen will+# generate a Perl module file that captures the structure of+# the code including all documentation. Note that this+# feature is still experimental and incomplete at the+# moment.++GENERATE_PERLMOD       = NO++# If the PERLMOD_LATEX tag is set to YES Doxygen will generate+# the necessary Makefile rules, Perl scripts and LaTeX code to be able+# to generate PDF and DVI output from the Perl module output.++PERLMOD_LATEX          = NO++# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be+# nicely formatted so it can be parsed by a human reader.+# This is useful+# if you want to understand what is going on.+# On the other hand, if this+# tag is set to NO the size of the Perl module output will be much smaller+# and Perl will parse it just the same.++PERLMOD_PRETTY         = YES++# The names of the make variables in the generated doxyrules.make file+# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX.+# This is useful so different doxyrules.make files included by the same+# Makefile don't overwrite each other's variables.++PERLMOD_MAKEVAR_PREFIX =++#---------------------------------------------------------------------------+# Configuration options related to the preprocessor+#---------------------------------------------------------------------------++# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will+# evaluate all C-preprocessor directives found in the sources and include+# files.++ENABLE_PREPROCESSING   = YES++# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro+# names in the source code. If set to NO (the default) only conditional+# compilation will be performed. Macro expansion can be done in a controlled+# way by setting EXPAND_ONLY_PREDEF to YES.++MACRO_EXPANSION        = YES++# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES+# then the macro expansion is limited to the macros specified with the+# PREDEFINED and EXPAND_AS_DEFINED tags.++EXPAND_ONLY_PREDEF     = YES++# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files+# pointed to by INCLUDE_PATH will be searched when a #include is found.++SEARCH_INCLUDES        = YES++# The INCLUDE_PATH tag can be used to specify one or more directories that+# contain include files that are not input files but should be processed by+# the preprocessor.++INCLUDE_PATH           = "${Eigen_SOURCE_DIR}/Eigen/src/plugins"++# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard+# patterns (like *.h and *.hpp) to filter out the header-files in the+# directories. If left blank, the patterns specified with FILE_PATTERNS will+# be used.++INCLUDE_FILE_PATTERNS  =++# The PREDEFINED tag can be used to specify one or more macro names that+# are defined before the preprocessor is started (similar to the -D option of+# gcc). The argument of the tag is a list of macros of the form: name+# or name=definition (no spaces). If the definition and the = are+# omitted =1 is assumed. To prevent a macro definition from being+# undefined via #undef or recursively expanded use the := operator+# instead of the = operator.++PREDEFINED             = EIGEN_EMPTY_STRUCT \+                         EIGEN_PARSED_BY_DOXYGEN \+                         EIGEN_VECTORIZE \+                         EIGEN_QT_SUPPORT \+                         EIGEN_STRONG_INLINE=inline \+                         EIGEN_DEVICE_FUNC= \+                         "EIGEN_MAKE_CWISE_BINARY_OP(METHOD,FUNCTOR)=template<typename OtherDerived> const CwiseBinaryOp<FUNCTOR<Scalar>, const Derived, const OtherDerived> METHOD(const EIGEN_CURRENT_STORAGE_BASE_CLASS<OtherDerived> &other) const;" \+                         "EIGEN_CWISE_PRODUCT_RETURN_TYPE(LHS,RHS)=CwiseBinaryOp<internal::scalar_product_op<LHS::Scalar,RHS::Scalar>, const LHS, const RHS>"\+                         "EIGEN_CAT2(a,b)= a ## b"\+                         "EIGEN_CAT(a,b)=EIGEN_CAT2(a,b)"\+                         "EIGEN_CWISE_BINARY_RETURN_TYPE(LHS,RHS,OPNAME)=CwiseBinaryOp<EIGEN_CAT(EIGEN_CAT(internal::scalar_,OPNAME),_op)<LHS::Scalar, RHS::Scalar>, const LHS, const RHS>"\+                         "EIGEN_ALIGN_TO_BOUNDARY(x)="\+                         DOXCOMMA=,+++# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then+# this tag can be used to specify a list of macro names that should be expanded.+# The macro definition that is found in the sources will be used.+# Use the PREDEFINED tag if you want to use a different macro definition that+# overrules the definition found in the source code.++EXPAND_AS_DEFINED      = EIGEN_MAKE_TYPEDEFS \+                         EIGEN_MAKE_FIXED_TYPEDEFS \+                         EIGEN_MAKE_TYPEDEFS_ALL_SIZES \+                         EIGEN_CWISE_UNOP_RETURN_TYPE \+                         EIGEN_CWISE_BINOP_RETURN_TYPE \+                         EIGEN_CURRENT_STORAGE_BASE_CLASS \+                         EIGEN_MATHFUNC_IMPL \+                         _EIGEN_GENERIC_PUBLIC_INTERFACE \+                         EIGEN_ARRAY_DECLARE_GLOBAL_UNARY \+                         EIGEN_EMPTY \+                         EIGEN_EULER_ANGLES_TYPEDEFS \+                         EIGEN_EULER_ANGLES_SINGLE_TYPEDEF \+                         EIGEN_EULER_SYSTEM_TYPEDEF \+                         EIGEN_AUTODIFF_DECLARE_GLOBAL_UNARY \+                         EIGEN_MATRIX_FUNCTION \+                         EIGEN_MATRIX_FUNCTION_1 \+                         EIGEN_DOC_UNARY_ADDONS \+                         EIGEN_DOC_BLOCK_ADDONS_NOT_INNER_PANEL \+                         EIGEN_DOC_BLOCK_ADDONS_INNER_PANEL_IF+++# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then+# doxygen's preprocessor will remove all references to function-like macros+# that are alone on a line, have an all uppercase name, and do not end with a+# semicolon, because these will confuse the parser if not removed.++SKIP_FUNCTION_MACROS   = YES++#---------------------------------------------------------------------------+# Configuration::additions related to external references+#---------------------------------------------------------------------------++# The TAGFILES option can be used to specify one or more tagfiles. For each+# tag file the location of the external documentation should be added. The+# format of a tag file without this location is as follows:+#+# TAGFILES = file1 file2 ...+# Adding location for the tag files is done as follows:+#+# TAGFILES = file1=loc1 "file2 = loc2" ...+# where "loc1" and "loc2" can be relative or absolute paths+# or URLs. Note that each tag file must have a unique name (where the name does+# NOT include the path). If a tag file is not located in the directory in which+# doxygen is run, you must also specify the path to the tagfile here.++TAGFILES               = ${EIGEN_DOXY_TAGFILES}+# "${Eigen_BINARY_DIR}/doc/eigen-unsupported.doxytags =unsupported"++# When a file name is specified after GENERATE_TAGFILE, doxygen will create+# a tag file that is based on the input files it reads.++GENERATE_TAGFILE       = "${Eigen_BINARY_DIR}/doc/${EIGEN_DOXY_PROJECT_NAME}.doxytags"++# If the ALLEXTERNALS tag is set to YES all external classes will be listed+# in the class index. If set to NO only the inherited external classes+# will be listed.++ALLEXTERNALS           = NO++# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed+# in the modules index. If set to NO, only the current project's groups will+# be listed.++EXTERNAL_GROUPS        = NO++# The PERL_PATH should be the absolute path and name of the perl script+# interpreter (i.e. the result of `which perl').++PERL_PATH              = /usr/bin/perl++#---------------------------------------------------------------------------+# Configuration options related to the dot tool+#---------------------------------------------------------------------------++# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will+# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base+# or super classes. Setting the tag to NO turns the diagrams off. Note that+# this option also works with HAVE_DOT disabled, but it is recommended to+# install and use dot, since it yields more powerful graphs.++CLASS_DIAGRAMS         = YES++# You can define message sequence charts within doxygen comments using the \msc+# command. Doxygen will then run the mscgen tool (see+# http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the+# documentation. The MSCGEN_PATH tag allows you to specify the directory where+# the mscgen tool resides. If left empty the tool is assumed to be found in the+# default search path.++MSCGEN_PATH            =++# If set to YES, the inheritance and collaboration graphs will hide+# inheritance and usage relations if the target is undocumented+# or is not a class.++HIDE_UNDOC_RELATIONS   = NO++# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is+# available from the path. This tool is part of Graphviz, a graph visualization+# toolkit from AT&T and Lucent Bell Labs. The other options in this section+# have no effect if this option is set to NO (the default)++HAVE_DOT               = YES++# The DOT_NUM_THREADS specifies the number of dot invocations doxygen is+# allowed to run in parallel. When set to 0 (the default) doxygen will+# base this on the number of processors available in the system. You can set it+# explicitly to a value larger than 0 to get control over the balance+# between CPU load and processing speed.++DOT_NUM_THREADS        = 0++# By default doxygen will use the Helvetica font for all dot files that+# doxygen generates. When you want a differently looking font you can specify+# the font name using DOT_FONTNAME. You need to make sure dot is able to find+# the font, which can be done by putting it in a standard location or by setting+# the DOTFONTPATH environment variable or by setting DOT_FONTPATH to the+# directory containing the font.++DOT_FONTNAME           = ++# The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs.+# The default size is 10pt.++DOT_FONTSIZE           = 10++# By default doxygen will tell dot to use the Helvetica font.+# If you specify a different font using DOT_FONTNAME you can use DOT_FONTPATH to+# set the path where dot can find it.++DOT_FONTPATH           =++# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen+# will generate a graph for each documented class showing the direct and+# indirect inheritance relations. Setting this tag to YES will force the+# CLASS_DIAGRAMS tag to NO.++CLASS_GRAPH            = YES++# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen+# will generate a graph for each documented class showing the direct and+# indirect implementation dependencies (inheritance, containment, and+# class references variables) of the class with other documented classes.++COLLABORATION_GRAPH    = NO++# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen+# will generate a graph for groups, showing the direct groups dependencies++GROUP_GRAPHS           = NO++# If the UML_LOOK tag is set to YES doxygen will generate inheritance and+# collaboration diagrams in a style similar to the OMG's Unified Modeling+# Language.++UML_LOOK               = YES++# If the UML_LOOK tag is enabled, the fields and methods are shown inside+# the class node. If there are many fields or methods and many nodes the+# graph may become too big to be useful. The UML_LIMIT_NUM_FIELDS+# threshold limits the number of items for each type to make the size more+# managable. Set this to 0 for no limit. Note that the threshold may be+# exceeded by 50% before the limit is enforced.++UML_LIMIT_NUM_FIELDS   = 10++# If set to YES, the inheritance and collaboration graphs will show the+# relations between templates and their instances.++TEMPLATE_RELATIONS     = NO++# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT+# tags are set to YES then doxygen will generate a graph for each documented+# file showing the direct and indirect include dependencies of the file with+# other documented files.++INCLUDE_GRAPH          = NO++# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and+# HAVE_DOT tags are set to YES then doxygen will generate a graph for each+# documented header file showing the documented files that directly or+# indirectly include this file.++INCLUDED_BY_GRAPH      = NO++# If the CALL_GRAPH and HAVE_DOT options are set to YES then+# doxygen will generate a call dependency graph for every global function+# or class method. Note that enabling this option will significantly increase+# the time of a run. So in most cases it will be better to enable call graphs+# for selected functions only using the \callgraph command.++CALL_GRAPH             = NO++# If the CALLER_GRAPH and HAVE_DOT tags are set to YES then+# doxygen will generate a caller dependency graph for every global function+# or class method. Note that enabling this option will significantly increase+# the time of a run. So in most cases it will be better to enable caller+# graphs for selected functions only using the \callergraph command.++CALLER_GRAPH           = NO++# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen+# will generate a graphical hierarchy of all classes instead of a textual one.++GRAPHICAL_HIERARCHY    = NO++# If the DIRECTORY_GRAPH and HAVE_DOT tags are set to YES+# then doxygen will show the dependencies a directory has on other directories+# in a graphical way. The dependency relations are determined by the #include+# relations between the files in the directories.++DIRECTORY_GRAPH        = NO++# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images+# generated by dot. Possible values are svg, png, jpg, or gif.+# If left blank png will be used. If you choose svg you need to set+# HTML_FILE_EXTENSION to xhtml in order to make the SVG files+# visible in IE 9+ (other browsers do not have this requirement).++DOT_IMAGE_FORMAT       = png++# If DOT_IMAGE_FORMAT is set to svg, then this option can be set to YES to+# enable generation of interactive SVG images that allow zooming and panning.+# Note that this requires a modern browser other than Internet Explorer.+# Tested and working are Firefox, Chrome, Safari, and Opera. For IE 9+ you+# need to set HTML_FILE_EXTENSION to xhtml in order to make the SVG files+# visible. Older versions of IE do not have SVG support.++INTERACTIVE_SVG        = NO++# The tag DOT_PATH can be used to specify the path where the dot tool can be+# found. If left blank, it is assumed the dot tool can be found in the path.++DOT_PATH               =++# The DOTFILE_DIRS tag can be used to specify one or more directories that+# contain dot files that are included in the documentation (see the+# \dotfile command).++DOTFILE_DIRS           =++# The MSCFILE_DIRS tag can be used to specify one or more directories that+# contain msc files that are included in the documentation (see the+# \mscfile command).++MSCFILE_DIRS           =++# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of+# nodes that will be shown in the graph. If the number of nodes in a graph+# becomes larger than this value, doxygen will truncate the graph, which is+# visualized by representing a node as a red box. Note that doxygen if the+# number of direct children of the root node in a graph is already larger than+# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note+# that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH.++DOT_GRAPH_MAX_NODES    = 50++# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the+# graphs generated by dot. A depth value of 3 means that only nodes reachable+# from the root by following a path via at most 3 edges will be shown. Nodes+# that lay further from the root node will be omitted. Note that setting this+# option to 1 or 2 may greatly reduce the computation time needed for large+# code bases. Also note that the size of a graph can be further restricted by+# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction.++MAX_DOT_GRAPH_DEPTH    = 0++# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent+# background. This is disabled by default, because dot on Windows does not+# seem to support this out of the box. Warning: Depending on the platform used,+# enabling this option may lead to badly anti-aliased labels on the edges of+# a graph (i.e. they become hard to read).++DOT_TRANSPARENT        = NO++# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output+# files in one run (i.e. multiple -o and -T options on the command line). This+# makes dot run faster, but since only newer versions of dot (>1.8.10)+# support this, this feature is disabled by default.++DOT_MULTI_TARGETS      = NO++# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will+# generate a legend page explaining the meaning of the various boxes and+# arrows in the dot generated graphs.++GENERATE_LEGEND        = YES++# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will+# remove the intermediate dot files that are used to generate+# the various graphs.++DOT_CLEANUP            = YES
+ eigen3/doc/Eigen_Silly_Professor_64x64.png view

binary file changed (absent → 8355 bytes)

+ eigen3/doc/FixedSizeVectorizable.dox view
@@ -0,0 +1,38 @@+namespace Eigen {++/** \eigenManualPage TopicFixedSizeVectorizable Fixed-size vectorizable Eigen objects++The goal of this page is to explain what we mean by "fixed-size vectorizable".++\section FixedSizeVectorizable_summary Executive Summary++An Eigen object is called "fixed-size vectorizable" if it has fixed size and that size is a multiple of 16 bytes.++Examples include:+\li Eigen::Vector2d+\li Eigen::Vector4d+\li Eigen::Vector4f+\li Eigen::Matrix2d+\li Eigen::Matrix2f+\li Eigen::Matrix4d+\li Eigen::Matrix4f+\li Eigen::Affine3d+\li Eigen::Affine3f+\li Eigen::Quaterniond+\li Eigen::Quaternionf++\section FixedSizeVectorizable_explanation Explanation++First, "fixed-size" should be clear: an Eigen object has fixed size if its number of rows and its number of columns are fixed at compile-time. So for example Matrix3f has fixed size, but MatrixXf doesn't (the opposite of fixed-size is dynamic-size).++The array of coefficients of a fixed-size Eigen object is a plain "static array", it is not dynamically allocated. For example, the data behind a Matrix4f is just a "float array[16]".++Fixed-size objects are typically very small, which means that we want to handle them with zero runtime overhead -- both in terms of memory usage and of speed.++Now, vectorization (both SSE and AltiVec) works with 128-bit packets. Moreover, for performance reasons, these packets need to be have 128-bit alignment.++So it turns out that the only way that fixed-size Eigen objects can be vectorized, is if their size is a multiple of 128 bits, or 16 bytes. Eigen will then request 16-byte alignment for these objects, and henceforth rely on these objects being aligned so no runtime check for alignment is performed.++*/++}
+ eigen3/doc/FunctionsTakingEigenTypes.dox view
@@ -0,0 +1,217 @@+namespace Eigen {++/** \page TopicFunctionTakingEigenTypes Writing Functions Taking %Eigen Types as Parameters++%Eigen's use of expression templates results in potentially every expression being of a different type. If you pass such an expression to a function taking a parameter of type Matrix, your expression will implicitly be evaluated into a temporary Matrix, which will then be passed to the function. This means that you lose the benefit of expression templates. Concretely, this has two drawbacks:+ \li The evaluation into a temporary may be useless and inefficient;+ \li This only allows the function to read from the expression, not to write to it.++Fortunately, all this myriad of expression types have in common that they all inherit a few common, templated base classes. By letting your function take templated parameters of these base types, you can let them play nicely with %Eigen's expression templates.++\eigenAutoToc++\section TopicFirstExamples Some First Examples++This section will provide simple examples for different types of objects %Eigen is offering. Before starting with the actual examples, we need to recapitulate which base objects we can work with (see also \ref TopicClassHierarchy).++ \li MatrixBase: The common base class for all dense matrix expressions (as opposed to array expressions, as opposed to sparse and special matrix classes). Use it in functions that are meant to work only on dense matrices.+ \li ArrayBase: The common base class for all dense array expressions (as opposed to matrix expressions, etc). Use it in functions that are meant to work only on arrays.+ \li DenseBase: The common base class for all dense matrix expression, that is, the base class for both \c MatrixBase and \c ArrayBase. It can be used in functions that are meant to work on both matrices and arrays.+ \li EigenBase: The base class unifying all types of objects that can be evaluated into dense matrices or arrays, for example special matrix classes such as diagonal matrices, permutation matrices, etc. It can be used in functions that are meant to work on any such general type.++<b> %EigenBase Example </b><br/><br/>+Prints the dimensions of the most generic object present in %Eigen. It could be any matrix expressions, any dense or sparse matrix and any array.+<table class="example">+<tr><th>Example:</th><th>Output:</th></tr>+<tr><td>+\include function_taking_eigenbase.cpp+</td>+<td>+\verbinclude function_taking_eigenbase.out+</td></tr></table>+<b> %DenseBase Example </b><br/><br/>+Prints a sub-block of the dense expression. Accepts any dense matrix or array expression, but no sparse objects and no special matrix classes such as DiagonalMatrix.+\code+template <typename Derived>+void print_block(const DenseBase<Derived>& b, int x, int y, int r, int c)+{+  std::cout << "block: " << b.block(x,y,r,c) << std::endl;+}+\endcode+<b> %ArrayBase Example </b><br/><br/>+Prints the maximum coefficient of the array or array-expression.+\code+template <typename Derived>+void print_max_coeff(const ArrayBase<Derived> &a)+{+  std::cout << "max: " << a.maxCoeff() << std::endl;+}+\endcode+<b> %MatrixBase Example </b><br/><br/>+Prints the inverse condition number of the given matrix or matrix-expression.+\code+template <typename Derived>+void print_inv_cond(const MatrixBase<Derived>& a)+{+  const typename JacobiSVD<typename Derived::PlainObject>::SingularValuesType&+    sing_vals = a.jacobiSvd().singularValues();+  std::cout << "inv cond: " << sing_vals(sing_vals.size()-1) / sing_vals(0) << std::endl;+}+\endcode+<b> Multiple templated arguments example </b><br/><br/>+Calculate the Euclidean distance between two points.+\code+template <typename DerivedA,typename DerivedB>+typename DerivedA::Scalar squaredist(const MatrixBase<DerivedA>& p1,const MatrixBase<DerivedB>& p2)+{+  return (p1-p2).squaredNorm();+}+\endcode+Notice that we used two template parameters, one per argument. This permits the function to handle inputs of different types, e.g.,+\code+squaredist(v1,2*v2)+\endcode+where the first argument \c v1 is a vector and the second argument \c 2*v2 is an expression.+<br/><br/>++These examples are just intended to give the reader a first impression of how functions can be written which take a plain and constant Matrix or Array argument. They are also intended to give the reader an idea about the most common base classes being the optimal candidates for functions. In the next section we will look in more detail at an example and the different ways it can be implemented, while discussing each implementation's problems and advantages. For the discussion below, Matrix and Array as well as MatrixBase and ArrayBase can be exchanged and all arguments still hold.+++\section TopicUsingRefClass How to write generic, but non-templated function?++In all the previous examples, the functions had to be template functions. This approach allows to write very generic code, but it is often desirable to write non templated function and still keep some level of genericity to avoid stupid copies of the arguments. The typical example is to write functions accepting both a MatrixXf or a block of a MatrixXf. This exactly the purpose of the Ref class. Here is a simple example:++<table class="example">+<tr><th>Example:</th><th>Output:</th></tr>+<tr><td>+\include function_taking_ref.cpp+</td>+<td>+\verbinclude function_taking_ref.out+</td></tr></table>+In the first two calls to inv_cond, no copy occur because the memory layout of the arguments matches the memory layout accepted by Ref<MatrixXf>. However, in the last call, we have a generic expression that will be automatically evaluated into a temporary MatrixXf by the Ref<> object.++A Ref object can also be writable. Here is an example of a function computing the covariance matrix of two input matrices where each row is an observation:+\code+void cov(const Ref<const MatrixXf> x, const Ref<const MatrixXf> y, Ref<MatrixXf> C)+{+  const float num_observations = static_cast<float>(x.rows());+  const RowVectorXf x_mean = x.colwise().sum() / num_observations;+  const RowVectorXf y_mean = y.colwise().sum() / num_observations;+  C = (x.rowwise() - x_mean).transpose() * (y.rowwise() - y_mean) / num_observations;+}+\endcode+and here are two examples calling cov without any copy:+\code+MatrixXf m1, m2, m3+cov(m1, m2, m3);+cov(m1.leftCols<3>(), m2.leftCols<3>(), m3.topLeftCorner<3,3>());+\endcode+The Ref<> class has two other optional template arguments allowing to control the kind of memory layout that can be accepted without any copy. See the class Ref documentation for the details.++\section TopicPlainFunctionsWorking In which cases do functions taking plain Matrix or Array arguments work?++Without using template functions, and without the Ref class, a naive implementation of the previous cov function might look like this+\code+MatrixXf cov(const MatrixXf& x, const MatrixXf& y)+{+  const float num_observations = static_cast<float>(x.rows());+  const RowVectorXf x_mean = x.colwise().sum() / num_observations;+  const RowVectorXf y_mean = y.colwise().sum() / num_observations;+  return (x.rowwise() - x_mean).transpose() * (y.rowwise() - y_mean) / num_observations;+}+\endcode+and contrary to what one might think at first, this implementation is fine unless you require a generic implementation that works with double matrices too and unless you do not care about temporary objects. Why is that the case? Where are temporaries involved? How can code as given below compile?+\code+MatrixXf x,y,z;+MatrixXf C = cov(x,y+z);+\endcode+In this special case, the example is fine and will be working because both parameters are declared as \e const references. The compiler creates a temporary and evaluates the expression x+z into this temporary. Once the function is processed, the temporary is released and the result is assigned to C.++\b Note: Functions taking \e const references to Matrix (or Array) can process expressions at the cost of temporaries.+++\section TopicPlainFunctionsFailing In which cases do functions taking a plain Matrix or Array argument fail?++Here, we consider a slightly modified version of the function given above. This time, we do not want to return the result but pass an additional non-const paramter which allows us to store the result. A first naive implementation might look as follows.+\code+// Note: This code is flawed!+void cov(const MatrixXf& x, const MatrixXf& y, MatrixXf& C)+{+  const float num_observations = static_cast<float>(x.rows());+  const RowVectorXf x_mean = x.colwise().sum() / num_observations;+  const RowVectorXf y_mean = y.colwise().sum() / num_observations;+  C = (x.rowwise() - x_mean).transpose() * (y.rowwise() - y_mean) / num_observations;+}+\endcode+When trying to execute the following code+\code+MatrixXf C = MatrixXf::Zero(3,6);+cov(x,y, C.block(0,0,3,3));+\endcode+the compiler will fail, because it is not possible to convert the expression returned by \c MatrixXf::block() into a non-const \c MatrixXf&. This is the case because the compiler wants to protect you from writing your result to a temporary object. In this special case this protection is not intended -- we want to write to a temporary object. So how can we overcome this problem? ++The solution which is preferred at the moment is based on a little \em hack. One needs to pass a const reference to the matrix and internally the constness needs to be cast away. The correct implementation for C98 compliant compilers would be+\code+template <typename Derived, typename OtherDerived>+void cov(const MatrixBase<Derived>& x, const MatrixBase<Derived>& y, MatrixBase<OtherDerived> const & C)+{+  typedef typename Derived::Scalar Scalar;+  typedef typename internal::plain_row_type<Derived>::type RowVectorType;++  const Scalar num_observations = static_cast<Scalar>(x.rows());++  const RowVectorType x_mean = x.colwise().sum() / num_observations;+  const RowVectorType y_mean = y.colwise().sum() / num_observations;++  const_cast< MatrixBase<OtherDerived>& >(C) =+    (x.rowwise() - x_mean).transpose() * (y.rowwise() - y_mean) / num_observations;+}+\endcode+The implementation above does now not only work with temporary expressions but it also allows to use the function with matrices of arbitrary floating point scalar types.++\b Note: The const cast hack will only work with templated functions. It will not work with the MatrixXf implementation because it is not possible to cast a Block expression to a Matrix reference!++++\section TopicResizingInGenericImplementations How to resize matrices in generic implementations?++One might think we are done now, right? This is not completely true because in order for our covariance function to be generically applicable, we want the follwing code to work+\code+MatrixXf x = MatrixXf::Random(100,3);+MatrixXf y = MatrixXf::Random(100,3);+MatrixXf C;+cov(x, y, C);+\endcode+This is not the case anymore, when we are using an implementation taking MatrixBase as a parameter. In general, %Eigen supports automatic resizing but it is not possible to do so on expressions. Why should resizing of a matrix Block be allowed? It is a reference to a sub-matrix and we definitely don't want to resize that. So how can we incorporate resizing if we cannot resize on MatrixBase? The solution is to resize the derived object as in this implementation.+\code+template <typename Derived, typename OtherDerived>+void cov(const MatrixBase<Derived>& x, const MatrixBase<Derived>& y, MatrixBase<OtherDerived> const & C_)+{+  typedef typename Derived::Scalar Scalar;+  typedef typename internal::plain_row_type<Derived>::type RowVectorType;++  const Scalar num_observations = static_cast<Scalar>(x.rows());++  const RowVectorType x_mean = x.colwise().sum() / num_observations;+  const RowVectorType y_mean = y.colwise().sum() / num_observations;++  MatrixBase<OtherDerived>& C = const_cast< MatrixBase<OtherDerived>& >(C_);+  +  C.derived().resize(x.cols(),x.cols()); // resize the derived object+  C = (x.rowwise() - x_mean).transpose() * (y.rowwise() - y_mean) / num_observations;+}+\endcode+This implementation is now working for parameters being expressions and for parameters being matrices and having the wrong size. Resizing the expressions does not do any harm in this case unless they actually require resizing. That means, passing an expression with the wrong dimensions will result in a run-time error (in debug mode only) while passing expressions of the correct size will just work fine.++\b Note: In the above discussion the terms Matrix and Array and MatrixBase and ArrayBase can be exchanged and all arguments still hold.++\section TopicSummary Summary++  - To summarize, the implementation of functions taking non-writable (const referenced) objects is not a big issue and does not lead to problematic situations in terms of compiling and running your program. However, a naive implementation is likely to introduce unnecessary temporary objects in your code. In order to avoid evaluating parameters into temporaries, pass them as (const) references to MatrixBase or ArrayBase (so templatize your function).++  - Functions taking writable (non-const) parameters must take const references and cast away constness within the function body.++  - Functions that take as parameters MatrixBase (or ArrayBase) objects, and potentially need to resize them (in the case where they are resizable), must call resize() on the derived class, as returned by derived().+*/+}
+ eigen3/doc/HiPerformance.dox view
@@ -0,0 +1,128 @@++namespace Eigen {++/** \page TopicWritingEfficientProductExpression Writing efficient matrix product expressions++In general achieving good performance with Eigen does no require any special effort:+simply write your expressions in the most high level way. This is especially true+for small fixed size matrices. For large matrices, however, it might be useful to+take some care when writing your expressions in order to minimize useless evaluations+and optimize the performance.+In this page we will give a brief overview of the Eigen's internal mechanism to simplify+and evaluate complex product expressions, and discuss the current limitations.+In particular we will focus on expressions matching level 2 and 3 BLAS routines, i.e,+all kind of matrix products and triangular solvers.++Indeed, in Eigen we have implemented a set of highly optimized routines which are very similar+to BLAS's ones. Unlike BLAS, those routines are made available to user via a high level and+natural API. Each of these routines can compute in a single evaluation a wide variety of expressions.+Given an expression, the challenge is then to map it to a minimal set of routines.+As explained latter, this mechanism has some limitations, and knowing them will allow+you to write faster code by making your expressions more Eigen friendly.++\section GEMM General Matrix-Matrix product (GEMM)++Let's start with the most common primitive: the matrix product of general dense matrices.+In the BLAS world this corresponds to the GEMM routine. Our equivalent primitive can+perform the following operation:+\f$ C.noalias() += \alpha op1(A) op2(B) \f$+where A, B, and C are column and/or row major matrices (or sub-matrices),+alpha is a scalar value, and op1, op2 can be transpose, adjoint, conjugate, or the identity.+When Eigen detects a matrix product, it analyzes both sides of the product to extract a+unique scalar factor alpha, and for each side, its effective storage order, shape, and conjugation states.+More precisely each side is simplified by iteratively removing trivial expressions such as scalar multiple,+negation and conjugation. Transpose and Block expressions are not evaluated and they only modify the storage order+and shape. All other expressions are immediately evaluated.+For instance, the following expression:+\code m1.noalias() -= s4 * (s1 * m2.adjoint() * (-(s3*m3).conjugate()*s2))  \endcode+is automatically simplified to:+\code m1.noalias() += (s1*s2*conj(s3)*s4) * m2.adjoint() * m3.conjugate() \endcode+which exactly matches our GEMM routine.++\subsection GEMM_Limitations Limitations+Unfortunately, this simplification mechanism is not perfect yet and not all expressions which could be+handled by a single GEMM-like call are correctly detected.+<table class="manual" style="width:100%">+<tr>+<th>Not optimal expression</th>+<th>Evaluated as</th>+<th>Optimal version (single evaluation)</th>+<th>Comments</th>+</tr>+<tr>+<td>\code+m1 += m2 * m3; \endcode</td>+<td>\code+temp = m2 * m3;+m1 += temp; \endcode</td>+<td>\code+m1.noalias() += m2 * m3; \endcode</td>+<td>Use .noalias() to tell Eigen the result and right-hand-sides do not alias. +    Otherwise the product m2 * m3 is evaluated into a temporary.</td>+</tr>+<tr class="alt">+<td></td>+<td></td>+<td>\code+m1.noalias() += s1 * (m2 * m3); \endcode</td>+<td>This is a special feature of Eigen. Here the product between a scalar+    and a matrix product does not evaluate the matrix product but instead it+    returns a matrix product expression tracking the scalar scaling factor. <br>+    Without this optimization, the matrix product would be evaluated into a+    temporary as in the next example.</td>+</tr>+<tr>+<td>\code+m1.noalias() += (m2 * m3).adjoint(); \endcode</td>+<td>\code+temp = m2 * m3;+m1 += temp.adjoint(); \endcode</td>+<td>\code+m1.noalias() += m3.adjoint()+*              * m2.adjoint(); \endcode</td>+<td>This is because the product expression has the EvalBeforeNesting bit which+    enforces the evaluation of the product by the Tranpose expression.</td>+</tr>+<tr class="alt">+<td>\code+m1 = m1 + m2 * m3; \endcode</td>+<td>\code+temp = m2 * m3;+m1 = m1 + temp; \endcode</td>+<td>\code m1.noalias() += m2 * m3; \endcode</td>+<td>Here there is no way to detect at compile time that the two m1 are the same,+    and so the matrix product will be immediately evaluated.</td>+</tr>+<tr>+<td>\code+m1.noalias() = m4 + m2 * m3; \endcode</td>+<td>\code+temp = m2 * m3;+m1 = m4 + temp; \endcode</td>+<td>\code+m1 = m4;+m1.noalias() += m2 * m3; \endcode</td>+<td>First of all, here the .noalias() in the first expression is useless because+    m2*m3 will be evaluated anyway. However, note how this expression can be rewritten+    so that no temporary is required. (tip: for very small fixed size matrix+    it is slighlty better to rewrite it like this: m1.noalias() = m2 * m3; m1 += m4;</td>+</tr>+<tr class="alt">+<td>\code+m1.noalias() += (s1*m2).block(..) * m3; \endcode</td>+<td>\code+temp = (s1*m2).block(..);+m1 += temp * m3; \endcode</td>+<td>\code+m1.noalias() += s1 * m2.block(..) * m3; \endcode</td>+<td>This is because our expression analyzer is currently not able to extract trivial+    expressions nested in a Block expression. Therefore the nested scalar+    multiple cannot be properly extracted.</td>+</tr>+</table>++Of course all these remarks hold for all other kind of products involving triangular or selfadjoint matrices.++*/++}
+ eigen3/doc/InplaceDecomposition.dox view
@@ -0,0 +1,115 @@+namespace Eigen {++/** \eigenManualPage InplaceDecomposition Inplace matrix decompositions++Starting from %Eigen 3.3, the LU, Cholesky, and QR decompositions can operate \em inplace, that is, directly within the given input matrix.+This feature is especially useful when dealing with huge matrices, and or when the available memory is very limited (embedded systems).++To this end, the respective decomposition class must be instantiated with a Ref<> matrix type, and the decomposition object must be constructed with the input matrix as argument. As an example, let us consider an inplace LU decomposition with partial pivoting.++Let's start with the basic inclusions, and declaration of a 2x2 matrix \c A:++<table class="example">+<tr><th>code</th><th>output</th></tr>+<tr>+  <td>\snippet TutorialInplaceLU.cpp init+  </td>+  <td>\snippet TutorialInplaceLU.out init+  </td>+</tr>+</table>++No surprise here! Then, let's declare our inplace LU object \c lu, and check the content of the matrix \c A:++<table class="example">+<tr>+  <td>\snippet TutorialInplaceLU.cpp declaration+  </td>+  <td>\snippet TutorialInplaceLU.out declaration+  </td>+</tr>+</table>++Here, the \c lu object computes and stores the \c L and \c U factors within the memory held by the matrix \c A.+The coefficients of \c A have thus been destroyed during the factorization, and replaced by the L and U factors as one can verify:++<table class="example">+<tr>+  <td>\snippet TutorialInplaceLU.cpp matrixLU+  </td>+  <td>\snippet TutorialInplaceLU.out matrixLU+  </td>+</tr>+</table>++Then, one can use the \c lu object as usual, for instance to solve the Ax=b problem:+<table class="example">+<tr>+  <td>\snippet TutorialInplaceLU.cpp solve+  </td>+  <td>\snippet TutorialInplaceLU.out solve+  </td>+</tr>+</table>++Here, since the content of the original matrix \c A has been lost, we had to declared a new matrix \c A0 to verify the result.++Since the memory is shared between \c A and \c lu, modifying the matrix \c A will make \c lu invalid.+This can easily be verified by modifying the content of \c A and trying to solve the initial problem again:++<table class="example">+<tr>+  <td>\snippet TutorialInplaceLU.cpp modifyA+  </td>+  <td>\snippet TutorialInplaceLU.out modifyA+  </td>+</tr>+</table>++Note that there is no shared pointer under the hood, it is the \b responsibility \b of \b the \b user to keep the input matrix \c A in life as long as \c lu is living.++If one wants to update the factorization with the modified A, one has to call the compute method as usual:+<table class="example">+<tr>+  <td>\snippet TutorialInplaceLU.cpp recompute+  </td>+  <td>\snippet TutorialInplaceLU.out recompute+  </td>+</tr>+</table>++Note that calling compute does not change the memory which is referenced by the \c lu object. Therefore, if the compute method is called with another matrix \c A1 different than \c A, then the content of \c A1 won't be modified. This is still the content of \c A that will be used to store the L and U factors of the matrix \c A1.+This can easily be verified as follows:+<table class="example">+<tr>+  <td>\snippet TutorialInplaceLU.cpp recompute_bis0+ </td>+  <td>\snippet TutorialInplaceLU.out recompute_bis0+ </td>+</tr>+</table>+The matrix \c A1 is unchanged, and one can thus solve A1*x=b, and directly check the residual without any copy of \c A1:+<table class="example">+<tr>+  <td>\snippet TutorialInplaceLU.cpp recompute_bis1+  </td>+  <td>\snippet TutorialInplaceLU.out recompute_bis1+ </td>+</tr>+</table>+++Here is the list of matrix decompositions supporting this inplace mechanism:++- class LLT+- class LDLT+- class PartialPivLU+- class FullPivLU+- class HouseholderQR+- class ColPivHouseholderQR+- class FullPivHouseholderQR+- class CompleteOrthogonalDecomposition++*/++}
+ eigen3/doc/InsideEigenExample.dox view
@@ -0,0 +1,495 @@+namespace Eigen {++/** \page TopicInsideEigenExample What happens inside Eigen, on a simple example++\eigenAutoToc++<hr>+++Consider the following example program:++\code+#include<Eigen/Core>++int main()+{+  int size = 50;+  // VectorXf is a vector of floats, with dynamic size.+  Eigen::VectorXf u(size), v(size), w(size);+  u = v + w;+}+\endcode++The goal of this page is to understand how Eigen compiles it, assuming that SSE2 vectorization is enabled (GCC option -msse2).++\section WhyInteresting Why it's interesting++Maybe you think, that the above example program is so simple, that compiling it shouldn't involve anything interesting. So before starting, let us explain what is nontrivial in compiling it correctly -- that is, producing optimized code -- so that the complexity of Eigen, that we'll explain here, is really useful.++Look at the line of code+\code+  u = v + w;   //   (*)+\endcode++The first important thing about compiling it, is that the arrays should be traversed only once, like+\code+  for(int i = 0; i < size; i++) u[i] = v[i] + w[i];+\endcode+The problem is that if we make a naive C++ library where the VectorXf class has an operator+ returning a VectorXf, then the line of code (*) will amount to:+\code+  VectorXf tmp = v + w;+  VectorXf u = tmp;+\endcode+Obviously, the introduction of the temporary \a tmp here is useless. It has a very bad effect on performance, first because the creation of \a tmp requires a dynamic memory allocation in this context, and second as there are now two for loops:+\code+  for(int i = 0; i < size; i++) tmp[i] = v[i] + w[i];+  for(int i = 0; i < size; i++) u[i] = tmp[i];+\endcode+Traversing the arrays twice instead of once is terrible for performance, as it means that we do many redundant memory accesses.++The second important thing about compiling the above program, is to make correct use of SSE2 instructions. Notice that Eigen also supports AltiVec and that all the discussion that we make here applies also to AltiVec.++SSE2, like AltiVec, is a set of instructions allowing to perform computations on packets of 128 bits at once. Since a float is 32 bits, this means that SSE2 instructions can handle 4 floats at once. This means that, if correctly used, they can make our computation go up to 4x faster.++However, in the above program, we have chosen size=50, so our vectors consist of 50 float's, and 50 is not a multiple of 4. This means that we cannot hope to do all of that computation using SSE2 instructions. The second best thing, to which we should aim, is to handle the 48 first coefficients with SSE2 instructions, since 48 is the biggest multiple of 4 below 50, and then handle separately, without SSE2, the 49th and 50th coefficients. Something like this:++\code+  for(int i = 0; i < 4*(size/4); i+=4) u.packet(i)  = v.packet(i) + w.packet(i);+  for(int i = 4*(size/4); i < size; i++) u[i] = v[i] + w[i];+\endcode++So let us look line by line at our example program, and let's follow Eigen as it compiles it.++\section ConstructingVectors Constructing vectors++Let's analyze the first line:++\code+  Eigen::VectorXf u(size), v(size), w(size);+\endcode++First of all, VectorXf is the following typedef:+\code+  typedef Matrix<float, Dynamic, 1> VectorXf;+\endcode++The class template Matrix is declared in src/Core/util/ForwardDeclarations.h with 6 template parameters, but the last 3 are automatically determined by the first 3. So you don't need to worry about them for now. Here, Matrix\<float, Dynamic, 1\> means a matrix of floats, with a dynamic number of rows and 1 column.++The Matrix class inherits a base class, MatrixBase. Don't worry about it, for now it suffices to say that MatrixBase is what unifies matrices/vectors and all the expressions types -- more on that below.++When we do+\code+  Eigen::VectorXf u(size);+\endcode+the constructor that is called is Matrix::Matrix(int), in src/Core/Matrix.h. Besides some assertions, all it does is to construct the \a m_storage member, which is of type DenseStorage\<float, Dynamic, Dynamic, 1\>.++You may wonder, isn't it overengineering to have the storage in a separate class? The reason is that the Matrix class template covers all kinds of matrices and vector: both fixed-size and dynamic-size. The storage method is not the same in these two cases. For fixed-size, the matrix coefficients are stored as a plain member array. For dynamic-size, the coefficients will be stored as a pointer to a dynamically-allocated array. Because of this, we need to abstract storage away from the Matrix class. That's DenseStorage.++Let's look at this constructor, in src/Core/DenseStorage.h. You can see that there are many partial template specializations of DenseStorages here, treating separately the cases where dimensions are Dynamic or fixed at compile-time. The partial specialization that we are looking at is:+\code+template<typename T, int _Cols> class DenseStorage<T, Dynamic, Dynamic, _Cols>+\endcode++Here, the constructor called is DenseStorage::DenseStorage(int size, int rows, int columns)+with size=50, rows=50, columns=1.++Here is this constructor:+\code+inline DenseStorage(int size, int rows, int) : m_data(internal::aligned_new<T>(size)), m_rows(rows) {}+\endcode++Here, the \a m_data member is the actual array of coefficients of the matrix. As you see, it is dynamically allocated. Rather than calling new[] or malloc(), as you can see, we have our own internal::aligned_new defined in src/Core/util/Memory.h. What it does is that if vectorization is enabled, then it uses a platform-specific call to allocate a 128-bit-aligned array, as that is very useful for vectorization with both SSE2 and AltiVec. If vectorization is disabled, it amounts to the standard new[].++As you can see, the constructor also sets the \a m_rows member to \a size. Notice that there is no \a m_columns member: indeed, in this partial specialization of DenseStorage, we know the number of columns at compile-time, since the _Cols template parameter is different from Dynamic. Namely, in our case, _Cols is 1, which is to say that our vector is just a matrix with 1 column. Hence, there is no need to store the number of columns as a runtime variable.++When you call VectorXf::data() to get the pointer to the array of coefficients, it returns DenseStorage::data() which returns the \a m_data member.++When you call VectorXf::size() to get the size of the vector, this is actually a method in the base class MatrixBase. It determines that the vector is a column-vector, since ColsAtCompileTime==1 (this comes from the template parameters in the typedef VectorXf). It deduces that the size is the number of rows, so it returns VectorXf::rows(), which returns DenseStorage::rows(), which returns the \a m_rows member, which was set to \a size by the constructor.++\section ConstructionOfSumXpr Construction of the sum expression++Now that our vectors are constructed, let's move on to the next line:++\code+u = v + w;+\endcode++The executive summary is that operator+ returns a "sum of vectors" expression, but doesn't actually perform the computation. It is the operator=, whose call occurs thereafter, that does the computation.++Let us now see what Eigen does when it sees this:++\code+v + w+\endcode++Here, v and w are of type VectorXf, which is a typedef for a specialization of Matrix (as we explained above), which is a subclass of MatrixBase. So what is being called is++\code+MatrixBase::operator+(const MatrixBase&)+\endcode++The return type of this operator is+\code+CwiseBinaryOp<internal::scalar_sum_op<float>, VectorXf, VectorXf>+\endcode+The CwiseBinaryOp class is our first encounter with an expression template. As we said, the operator+ doesn't by itself perform any computation, it just returns an abstract "sum of vectors" expression. Since there are also "difference of vectors" and "coefficient-wise product of vectors" expressions, we unify them all as "coefficient-wise binary operations", which we abbreviate as "CwiseBinaryOp". "Coefficient-wise" means that the operations is performed coefficient by coefficient. "binary" means that there are two operands -- we are adding two vectors with one another.++Now you might ask, what if we did something like++\code+v + w + u;+\endcode++The first v + w would return a CwiseBinaryOp as above, so in order for this to compile, we'd need to define an operator+ also in the class CwiseBinaryOp... at this point it starts looking like a nightmare: are we going to have to define all operators in each of the expression classes (as you guessed, CwiseBinaryOp is only one of many) ? This looks like a dead end!++The solution is that CwiseBinaryOp itself, as well as Matrix and all the other expression types, is a subclass of MatrixBase. So it is enough to define once and for all the operators in class MatrixBase.++Since MatrixBase is the common base class of different subclasses, the aspects that depend on the subclass must be abstracted from MatrixBase. This is called polymorphism.++The classical approach to polymorphism in C++ is by means of virtual functions. This is dynamic polymorphism. Here we don't want dynamic polymorphism because the whole design of Eigen is based around the assumption that all the complexity, all the abstraction, gets resolved at compile-time. This is crucial: if the abstraction can't get resolved at compile-time, Eigen's compile-time optimization mechanisms become useless, not to mention that if that abstraction has to be resolved at runtime it'll incur an overhead by itself.++Here, what we want is to have a single class MatrixBase as the base of many subclasses, in such a way that each MatrixBase object (be it a matrix, or vector, or any kind of expression) knows at compile-time (as opposed to run-time) of which particular subclass it is an object (i.e. whether it is a matrix, or an expression, and what kind of expression).++The solution is the <a href="http://en.wikipedia.org/wiki/Curiously_Recurring_Template_Pattern">Curiously Recurring Template Pattern</a>. Let's do the break now. Hopefully you can read this wikipedia page during the break if needed, but it won't be allowed during the exam.++In short, MatrixBase takes a template parameter \a Derived. Whenever we define a subclass Subclass, we actually make Subclass inherit MatrixBase\<Subclass\>. The point is that different subclasses inherit different MatrixBase types. Thanks to this, whenever we have an object of a subclass, and we call on it some MatrixBase method, we still remember even from inside the MatrixBase method which particular subclass we're talking about.++This means that we can put almost all the methods and operators in the base class MatrixBase, and have only the bare minimum in the subclasses. If you look at the subclasses in Eigen, like for instance the CwiseBinaryOp class, they have very few methods. There are coeff() and sometimes coeffRef() methods for access to the coefficients, there are rows() and cols() methods returning the number of rows and columns, but there isn't much more than that. All the meat is in MatrixBase, so it only needs to be coded once for all kinds of expressions, matrices, and vectors.++So let's end this digression and come back to the piece of code from our example program that we were currently analyzing,++\code+v + w+\endcode++Now that MatrixBase is a good friend, let's write fully the prototype of the operator+ that gets called here (this code is from src/Core/MatrixBase.h):++\code+template<typename Derived>+class MatrixBase+{+  // ...++  template<typename OtherDerived>+  const CwiseBinaryOp<internal::scalar_sum_op<typename internal::traits<Derived>::Scalar>, Derived, OtherDerived>+  operator+(const MatrixBase<OtherDerived> &other) const;++  // ...+};+\endcode++Here of course, \a Derived and \a OtherDerived are VectorXf.++As we said, CwiseBinaryOp is also used for other operations such as substration, so it takes another template parameter determining the operation that will be applied to coefficients. This template parameter is a functor, that is, a class in which we have an operator() so it behaves like a function. Here, the functor used is internal::scalar_sum_op. It is defined in src/Core/Functors.h.++Let us now explain the internal::traits here. The internal::scalar_sum_op class takes one template parameter: the type of the numbers to handle. Here of course we want to pass the scalar type (a.k.a. numeric type) of VectorXf, which is \c float. How do we determine which is the scalar type of \a Derived ? Throughout Eigen, all matrix and expression types define a typedef \a Scalar which gives its scalar type. For example, VectorXf::Scalar is a typedef for \c float. So here, if life was easy, we could find the numeric type of \a Derived as just+\code+typename Derived::Scalar+\endcode+Unfortunately, we can't do that here, as the compiler would complain that the type Derived hasn't yet been defined. So we use a workaround: in src/Core/util/ForwardDeclarations.h, we declared (not defined!) all our subclasses, like Matrix, and we also declared the following class template:+\code+template<typename T> struct internal::traits;+\endcode+In src/Core/Matrix.h, right \em before the definition of class Matrix, we define a partial specialization of internal::traits for T=Matrix\<any template parameters\>. In this specialization of internal::traits, we define the Scalar typedef. So when we actually define Matrix, it is legal to refer to "typename internal::traits\<Matrix\>::Scalar".++Anyway, we have declared our operator+. In our case, where \a Derived and \a OtherDerived are VectorXf, the above declaration amounts to:+\code+class MatrixBase<VectorXf>+{+  // ...++  const CwiseBinaryOp<internal::scalar_sum_op<float>, VectorXf, VectorXf>+  operator+(const MatrixBase<VectorXf> &other) const;++  // ...+};+\endcode++Let's now jump to src/Core/CwiseBinaryOp.h to see how it is defined. As you can see there, all it does is to return a CwiseBinaryOp object, and this object is just storing references to the left-hand-side and right-hand-side expressions -- here, these are the vectors \a v and \a w. Well, the CwiseBinaryOp object is also storing an instance of the (empty) functor class, but you shouldn't worry about it as that is a minor implementation detail.++Thus, the operator+ hasn't performed any actual computation. To summarize, the operation \a v + \a w just returned an object of type CwiseBinaryOp which did nothing else than just storing references to \a v and \a w.++\section Assignment The assignment++At this point, the expression \a v + \a w has finished evaluating, so, in the process of compiling the line of code+\code+u = v + w;+\endcode+we now enter the operator=.++What operator= is being called here? The vector u is an object of class VectorXf, i.e. Matrix. In src/Core/Matrix.h, inside the definition of class Matrix, we see this:+\code+    template<typename OtherDerived>+    inline Matrix& operator=(const MatrixBase<OtherDerived>& other)+    {+      eigen_assert(m_storage.data()!=0 && "you cannot use operator= with a non initialized matrix (instead use set()");+      return Base::operator=(other.derived());+    }+\endcode+Here, Base is a typedef for MatrixBase\<Matrix\>. So, what is being called is the operator= of MatrixBase. Let's see its prototype in src/Core/MatrixBase.h:+\code+    template<typename OtherDerived>+    Derived& operator=(const MatrixBase<OtherDerived>& other);+\endcode+Here, \a Derived is VectorXf (since u is a VectorXf) and \a OtherDerived is CwiseBinaryOp. More specifically, as explained in the previous section, \a OtherDerived is:+\code+CwiseBinaryOp<internal::scalar_sum_op<float>, VectorXf, VectorXf>+\endcode+So the full prototype of the operator= being called is:+\code+VectorXf& MatrixBase<VectorXf>::operator=(const MatrixBase<CwiseBinaryOp<internal::scalar_sum_op<float>, VectorXf, VectorXf> > & other);+\endcode+This operator= literally reads "copying a sum of two VectorXf's into another VectorXf".++Let's now look at the implementation of this operator=. It resides in the file src/Core/Assign.h.++What we can see there is:+\code+template<typename Derived>+template<typename OtherDerived>+inline Derived& MatrixBase<Derived>+  ::operator=(const MatrixBase<OtherDerived>& other)+{+  return internal::assign_selector<Derived,OtherDerived>::run(derived(), other.derived());+}+\endcode++OK so our next task is to understand internal::assign_selector :)++Here is its declaration (all that is still in the same file src/Core/Assign.h)+\code+template<typename Derived, typename OtherDerived,+         bool EvalBeforeAssigning = int(OtherDerived::Flags) & EvalBeforeAssigningBit,+         bool NeedToTranspose = Derived::IsVectorAtCompileTime+                && OtherDerived::IsVectorAtCompileTime+                && int(Derived::RowsAtCompileTime) == int(OtherDerived::ColsAtCompileTime)+                && int(Derived::ColsAtCompileTime) == int(OtherDerived::RowsAtCompileTime)+                && int(Derived::SizeAtCompileTime) != 1>+struct internal::assign_selector;+\endcode++So internal::assign_selector takes 4 template parameters, but the 2 last ones are automatically determined by the 2 first ones.++EvalBeforeAssigning is here to enforce the EvalBeforeAssigningBit. As explained <a href="TopicLazyEvaluation.html">here</a>, certain expressions have this flag which makes them automatically evaluate into temporaries before assigning them to another expression. This is the case of the Product expression, in order to avoid strange aliasing effects when doing "m = m * m;" However, of course here our CwiseBinaryOp expression doesn't have the EvalBeforeAssigningBit: we said since the beginning that we didn't want a temporary to be introduced here. So if you go to src/Core/CwiseBinaryOp.h, you'll see that the Flags in internal::traits\<CwiseBinaryOp\> don't include the EvalBeforeAssigningBit. The Flags member of CwiseBinaryOp is then imported from the internal::traits by the EIGEN_GENERIC_PUBLIC_INTERFACE macro. Anyway, here the template parameter EvalBeforeAssigning has the value \c false.++NeedToTranspose is here for the case where the user wants to copy a row-vector into a column-vector. We allow this as a special exception to the general rule that in assignments we require the dimesions to match. Anyway, here both the left-hand and right-hand sides are column vectors, in the sense that ColsAtCompileTime is equal to 1. So NeedToTranspose is \c false too.++So, here we are in the partial specialization:+\code+internal::assign_selector<Derived, OtherDerived, false, false>+\endcode++Here's how it is defined:+\code+template<typename Derived, typename OtherDerived>+struct internal::assign_selector<Derived,OtherDerived,false,false> {+  static Derived& run(Derived& dst, const OtherDerived& other) { return dst.lazyAssign(other.derived()); }+};+\endcode++OK so now our next job is to understand how lazyAssign works :)++\code+template<typename Derived>+template<typename OtherDerived>+inline Derived& MatrixBase<Derived>+  ::lazyAssign(const MatrixBase<OtherDerived>& other)+{+  EIGEN_STATIC_ASSERT_SAME_MATRIX_SIZE(Derived,OtherDerived)+  eigen_assert(rows() == other.rows() && cols() == other.cols());+  internal::assign_impl<Derived, OtherDerived>::run(derived(),other.derived());+  return derived();+}+\endcode++What do we see here? Some assertions, and then the only interesting line is:+\code+  internal::assign_impl<Derived, OtherDerived>::run(derived(),other.derived());+\endcode++OK so now we want to know what is inside internal::assign_impl.++Here is its declaration:+\code+template<typename Derived1, typename Derived2,+         int Vectorization = internal::assign_traits<Derived1, Derived2>::Vectorization,+         int Unrolling = internal::assign_traits<Derived1, Derived2>::Unrolling>+struct internal::assign_impl;+\endcode+Again, internal::assign_selector takes 4 template parameters, but the 2 last ones are automatically determined by the 2 first ones.++These two parameters \a Vectorization and \a Unrolling are determined by a helper class internal::assign_traits. Its job is to determine which vectorization strategy to use (that is \a Vectorization) and which unrolling strategy to use (that is \a Unrolling).++We'll not enter into the details of how these strategies are chosen (this is in the implementation of internal::assign_traits at the top of the same file). Let's just say that here \a Vectorization has the value \a LinearVectorization, and \a Unrolling has the value \a NoUnrolling (the latter is obvious since our vectors have dynamic size so there's no way to unroll the loop at compile-time).++So the partial specialization of internal::assign_impl that we're looking at is:+\code+internal::assign_impl<Derived1, Derived2, LinearVectorization, NoUnrolling>+\endcode++Here is how it's defined:+\code+template<typename Derived1, typename Derived2>+struct internal::assign_impl<Derived1, Derived2, LinearVectorization, NoUnrolling>+{+  static void run(Derived1 &dst, const Derived2 &src)+  {+    const int size = dst.size();+    const int packetSize = internal::packet_traits<typename Derived1::Scalar>::size;+    const int alignedStart = internal::assign_traits<Derived1,Derived2>::DstIsAligned ? 0+                           : internal::first_aligned(&dst.coeffRef(0), size);+    const int alignedEnd = alignedStart + ((size-alignedStart)/packetSize)*packetSize;++    for(int index = 0; index < alignedStart; index++)+      dst.copyCoeff(index, src);++    for(int index = alignedStart; index < alignedEnd; index += packetSize)+    {+      dst.template copyPacket<Derived2, Aligned, internal::assign_traits<Derived1,Derived2>::SrcAlignment>(index, src);+    }++    for(int index = alignedEnd; index < size; index++)+      dst.copyCoeff(index, src);+  }+};+\endcode++Here's how it works. \a LinearVectorization means that the left-hand and right-hand side expression can be accessed linearly i.e. you can refer to their coefficients by one integer \a index, as opposed to having to refer to its coefficients by two integers \a row, \a column.++As we said at the beginning, vectorization works with blocks of 4 floats. Here, \a PacketSize is 4.++There are two potential problems that we need to deal with:+\li first, vectorization works much better if the packets are 128-bit-aligned. This is especially important for write access. So when writing to the coefficients of \a dst, we want to group these coefficients by packets of 4 such that each of these packets is 128-bit-aligned. In general, this requires to skip a few coefficients at the beginning of \a dst. This is the purpose of \a alignedStart. We then copy these first few coefficients one by one, not by packets. However, in our case, the \a dst expression is a VectorXf and remember that in the construction of the vectors we allocated aligned arrays. Thanks to \a DstIsAligned, Eigen remembers that without having to do any runtime check, so \a alignedStart is zero and this part is avoided altogether.+\li second, the number of coefficients to copy is not in general a multiple of \a packetSize. Here, there are 50 coefficients to copy and \a packetSize is 4. So we'll have to copy the last 2 coefficients one by one, not by packets. Here, \a alignedEnd is 48.++Now come the actual loops.++First, the vectorized part: the 48 first coefficients out of 50 will be copied by packets of 4:+\code+  for(int index = alignedStart; index < alignedEnd; index += packetSize)+  {+    dst.template copyPacket<Derived2, Aligned, internal::assign_traits<Derived1,Derived2>::SrcAlignment>(index, src);+  }+\endcode++What is copyPacket? It is defined in src/Core/Coeffs.h:+\code+template<typename Derived>+template<typename OtherDerived, int StoreMode, int LoadMode>+inline void MatrixBase<Derived>::copyPacket(int index, const MatrixBase<OtherDerived>& other)+{+  eigen_internal_assert(index >= 0 && index < size());+  derived().template writePacket<StoreMode>(index,+    other.derived().template packet<LoadMode>(index));+}+\endcode++OK, what are writePacket() and packet() here?++First, writePacket() here is a method on the left-hand side VectorXf. So we go to src/Core/Matrix.h to look at its definition:+\code+template<int StoreMode>+inline void writePacket(int index, const PacketScalar& x)+{+  internal::pstoret<Scalar, PacketScalar, StoreMode>(m_storage.data() + index, x);+}+\endcode+Here, \a StoreMode is \a #Aligned, indicating that we are doing a 128-bit-aligned write access, \a PacketScalar is a type representing a "SSE packet of 4 floats" and internal::pstoret is a function writing such a packet in memory. Their definitions are architecture-specific, we find them in src/Core/arch/SSE/PacketMath.h:++The line in src/Core/arch/SSE/PacketMath.h that determines the PacketScalar type (via a typedef in Matrix.h) is:+\code+template<> struct internal::packet_traits<float>  { typedef __m128  type; enum {size=4}; };+\endcode+Here, __m128 is a SSE-specific type. Notice that the enum \a size here is what was used to define \a packetSize above.++And here is the implementation of internal::pstoret:+\code+template<> inline void internal::pstore(float*  to, const __m128&  from) { _mm_store_ps(to, from); }+\endcode+Here, __mm_store_ps is a SSE-specific intrinsic function, representing a single SSE instruction. The difference between internal::pstore and internal::pstoret is that internal::pstoret is a dispatcher handling both the aligned and unaligned cases, you find its definition in src/Core/GenericPacketMath.h:+\code+template<typename Scalar, typename Packet, int LoadMode>+inline void internal::pstoret(Scalar* to, const Packet& from)+{+  if(LoadMode == Aligned)+    internal::pstore(to, from);+  else+    internal::pstoreu(to, from);+}+\endcode++OK, that explains how writePacket() works. Now let's look into the packet() call. Remember that we are analyzing this line of code inside copyPacket():+\code+derived().template writePacket<StoreMode>(index,+    other.derived().template packet<LoadMode>(index));+\endcode++Here, \a other is our sum expression \a v + \a w. The .derived() is just casting from MatrixBase to the subclass which here is CwiseBinaryOp. So let's go to src/Core/CwiseBinaryOp.h:+\code+class CwiseBinaryOp+{+  // ...+    template<int LoadMode>+    inline PacketScalar packet(int index) const+    {+      return m_functor.packetOp(m_lhs.template packet<LoadMode>(index), m_rhs.template packet<LoadMode>(index));+    }+};+\endcode+Here, \a m_lhs is the vector \a v, and \a m_rhs is the vector \a w. So the packet() function here is Matrix::packet(). The template parameter \a LoadMode is \a #Aligned. So we're looking at+\code+class Matrix+{+  // ...+    template<int LoadMode>+    inline PacketScalar packet(int index) const+    {+      return internal::ploadt<Scalar, LoadMode>(m_storage.data() + index);+    }+};+\endcode+We let you look up the definition of internal::ploadt in GenericPacketMath.h and the internal::pload in src/Core/arch/SSE/PacketMath.h. It is very similar to the above for internal::pstore.++Let's go back to CwiseBinaryOp::packet(). Once the packets from the vectors \a v and \a w have been returned, what does this function do? It calls m_functor.packetOp() on them. What is m_functor? Here we must remember what particular template specialization of CwiseBinaryOp we're dealing with:+\code+CwiseBinaryOp<internal::scalar_sum_op<float>, VectorXf, VectorXf>+\endcode+So m_functor is an object of the empty class internal::scalar_sum_op<float>. As we mentioned above, don't worry about why we constructed an object of this empty class at all -- it's an implementation detail, the point is that some other functors need to store member data.++Anyway, internal::scalar_sum_op is defined in src/Core/Functors.h:+\code+template<typename Scalar> struct internal::scalar_sum_op EIGEN_EMPTY_STRUCT {+  inline const Scalar operator() (const Scalar& a, const Scalar& b) const { return a + b; }+  template<typename PacketScalar>+  inline const PacketScalar packetOp(const PacketScalar& a, const PacketScalar& b) const+  { return internal::padd(a,b); }+};+\endcode+As you can see, all what packetOp() does is to call internal::padd on the two packets. Here is the definition of internal::padd from src/Core/arch/SSE/PacketMath.h:+\code+template<> inline __m128  internal::padd(const __m128&  a, const __m128&  b) { return _mm_add_ps(a,b); }+\endcode+Here, _mm_add_ps is a SSE-specific intrinsic function, representing a single SSE instruction.++To summarize, the loop+\code+  for(int index = alignedStart; index < alignedEnd; index += packetSize)+  {+    dst.template copyPacket<Derived2, Aligned, internal::assign_traits<Derived1,Derived2>::SrcAlignment>(index, src);+  }+\endcode+has been compiled to the following code: for \a index going from 0 to the 11 ( = 48/4 - 1), read the i-th packet (of 4 floats) from the vector v and the i-th packet from the vector w using two __mm_load_ps SSE instructions, then add them together using a __mm_add_ps instruction, then store the result using a __mm_store_ps instruction.++There remains the second loop handling the last few (here, the last 2) coefficients:+\code+  for(int index = alignedEnd; index < size; index++)+    dst.copyCoeff(index, src);+\endcode+However, it works just like the one we just explained, it is just simpler because there is no SSE vectorization involved here. copyPacket() becomes copyCoeff(), packet() becomes coeff(), writePacket() becomes coeffRef(). If you followed us this far, you can probably understand this part by yourself.++We see that all the C++ abstraction of Eigen goes away during compilation and that we indeed are precisely controlling which assembly instructions we emit. Such is the beauty of C++! Since we have such precise control over the emitted assembly instructions, but such complex logic to choose the right instructions, we can say that Eigen really behaves like an optimizing compiler. If you prefer, you could say that Eigen behaves like a script for the compiler. In a sense, C++ template metaprogramming is scripting the compiler -- and it's been shown that this scripting language is Turing-complete. See <a href="http://en.wikipedia.org/wiki/Template_metaprogramming"> Wikipedia</a>.++*/++}
+ eigen3/doc/LeastSquares.dox view
@@ -0,0 +1,70 @@+namespace Eigen {++/** \eigenManualPage LeastSquares Solving linear least squares systems++This page describes how to solve linear least squares systems using %Eigen. An overdetermined system+of equations, say \a Ax = \a b, has no solutions. In this case, it makes sense to search for the+vector \a x which is closest to being a solution, in the sense that the difference \a Ax - \a b is+as small as possible. This \a x is called the least square solution (if the Euclidean norm is used).++The three methods discussed on this page are the SVD decomposition, the QR decomposition and normal+equations. Of these, the SVD decomposition is generally the most accurate but the slowest, normal+equations is the fastest but least accurate, and the QR decomposition is in between.++\eigenAutoToc+++\section LeastSquaresSVD Using the SVD decomposition++The \link BDCSVD::solve() solve() \endlink method in the BDCSVD class can be directly used to+solve linear squares systems. It is not enough to compute only the singular values (the default for+this class); you also need the singular vectors but the thin SVD decomposition suffices for+computing least squares solutions:++<table class="example">+<tr><th>Example:</th><th>Output:</th></tr>+<tr>+  <td>\include TutorialLinAlgSVDSolve.cpp </td>+  <td>\verbinclude TutorialLinAlgSVDSolve.out </td>+</tr>+</table>++This is example from the page \link TutorialLinearAlgebra Linear algebra and decompositions \endlink.+++\section LeastSquaresQR Using the QR decomposition++The solve() method in QR decomposition classes also computes the least squares solution. There are+three QR decomposition classes: HouseholderQR (no pivoting, so fast but unstable),+ColPivHouseholderQR (column pivoting, thus a bit slower but more accurate) and FullPivHouseholderQR+(full pivoting, so slowest and most stable). Here is an example with column pivoting:++<table class="example">+<tr><th>Example:</th><th>Output:</th></tr>+<tr>+  <td>\include LeastSquaresQR.cpp </td>+  <td>\verbinclude LeastSquaresQR.out </td>+</tr>+</table>+++\section LeastSquaresNormalEquations Using normal equations++Finding the least squares solution of \a Ax = \a b is equivalent to solving the normal equation+<i>A</i><sup>T</sup><i>Ax</i> = <i>A</i><sup>T</sup><i>b</i>. This leads to the following code++<table class="example">+<tr><th>Example:</th><th>Output:</th></tr>+<tr>+  <td>\include LeastSquaresNormalEquations.cpp </td>+  <td>\verbinclude LeastSquaresNormalEquations.out </td>+</tr>+</table>++If the matrix \a A is ill-conditioned, then this is not a good method, because the condition number+of <i>A</i><sup>T</sup><i>A</i> is the square of the condition number of \a A. This means that you+lose twice as many digits using normal equation than if you use the other methods.++*/++}
+ eigen3/doc/Manual.dox view
@@ -0,0 +1,189 @@++// This file strutures pages and modules into a convenient hierarchical structure.++namespace Eigen {++/** \page UserManual_CustomizingEigen Extending/Customizing Eigen+  %Eigen can be extended in several ways, for instance, by defining global methods, by inserting custom methods within main %Eigen's classes through the \ref TopicCustomizing_Plugins "plugin" mechanism, by adding support to \ref TopicCustomizing_CustomScalar "custom scalar types" etc. See below for the respective sub-topics.+  - \subpage TopicCustomizing_Plugins+  - \subpage TopicCustomizing_InheritingMatrix+  - \subpage TopicCustomizing_CustomScalar+  - \subpage TopicCustomizing_NullaryExpr+  - \subpage TopicNewExpressionType+  \sa \ref TopicPreprocessorDirectives+*/+++/** \page UserManual_Generalities General topics+  - \subpage Eigen2ToEigen3+  - \subpage TopicFunctionTakingEigenTypes+  - \subpage TopicPreprocessorDirectives+  - \subpage TopicAssertions+  - \subpage TopicMultiThreading+  - \subpage TopicUsingBlasLapack+  - \subpage TopicUsingIntelMKL+  - \subpage TopicCUDA+  - \subpage TopicPitfalls+  - \subpage TopicTemplateKeyword+  - \subpage UserManual_UnderstandingEigen+  - \subpage TopicCMakeGuide+*/++/** \page UserManual_UnderstandingEigen Understanding Eigen+  - \subpage TopicInsideEigenExample+  - \subpage TopicClassHierarchy+  - \subpage TopicLazyEvaluation+*/++/** \page UnclassifiedPages Unclassified pages+  - \subpage TopicResizing+  - \subpage TopicVectorization+  - \subpage TopicEigenExpressionTemplates+  - \subpage TopicScalarTypes+  - \subpage GettingStarted+  - \subpage TutorialSparse_example_details+  - \subpage TopicWritingEfficientProductExpression+  - \subpage Experimental+*/+++/** \defgroup Support_modules Support modules+  * Category of modules which add support for external libraries.+  */+++/** \defgroup DenseMatrixManipulation_chapter Dense matrix and array manipulation */+/** \defgroup DenseMatrixManipulation_Alignement Alignment issues */+/** \defgroup DenseMatrixManipulation_Reference Reference */++/** \addtogroup TutorialMatrixClass+    \ingroup DenseMatrixManipulation_chapter */+/** \addtogroup TutorialMatrixArithmetic+    \ingroup DenseMatrixManipulation_chapter */+/** \addtogroup TutorialArrayClass+    \ingroup DenseMatrixManipulation_chapter */+/** \addtogroup TutorialBlockOperations+    \ingroup DenseMatrixManipulation_chapter */+/** \addtogroup TutorialAdvancedInitialization+    \ingroup DenseMatrixManipulation_chapter */+/** \addtogroup TutorialReductionsVisitorsBroadcasting+    \ingroup DenseMatrixManipulation_chapter */+/** \addtogroup TutorialMapClass+    \ingroup DenseMatrixManipulation_chapter */+/** \addtogroup TutorialReshapeSlicing+    \ingroup DenseMatrixManipulation_chapter */+/** \addtogroup TopicAliasing+    \ingroup DenseMatrixManipulation_chapter */+/** \addtogroup TopicStorageOrders+    \ingroup DenseMatrixManipulation_chapter */+    +/** \addtogroup DenseMatrixManipulation_Alignement+    \ingroup DenseMatrixManipulation_chapter */+/** \addtogroup TopicUnalignedArrayAssert+    \ingroup DenseMatrixManipulation_Alignement */+/** \addtogroup TopicFixedSizeVectorizable+    \ingroup DenseMatrixManipulation_Alignement */+/** \addtogroup TopicStructHavingEigenMembers+    \ingroup DenseMatrixManipulation_Alignement */+/** \addtogroup TopicStlContainers+    \ingroup DenseMatrixManipulation_Alignement */+/** \addtogroup TopicPassingByValue+    \ingroup DenseMatrixManipulation_Alignement */+/** \addtogroup TopicWrongStackAlignment+    \ingroup DenseMatrixManipulation_Alignement */+    +/** \addtogroup DenseMatrixManipulation_Reference+    \ingroup DenseMatrixManipulation_chapter */+/** \addtogroup Core_Module+    \ingroup DenseMatrixManipulation_Reference */  +/** \addtogroup Jacobi_Module+    \ingroup DenseMatrixManipulation_Reference */ +/** \addtogroup Householder_Module+    \ingroup DenseMatrixManipulation_Reference */ ++/** \addtogroup CoeffwiseMathFunctions+    \ingroup DenseMatrixManipulation_chapter */++/** \addtogroup QuickRefPage+    \ingroup DenseMatrixManipulation_chapter */+++/** \defgroup DenseLinearSolvers_chapter Dense linear problems and decompositions */+/** \defgroup DenseLinearSolvers_Reference Reference */++/** \addtogroup TutorialLinearAlgebra+    \ingroup DenseLinearSolvers_chapter */+/** \addtogroup TopicLinearAlgebraDecompositions+    \ingroup DenseLinearSolvers_chapter */+/** \addtogroup LeastSquares +    \ingroup DenseLinearSolvers_chapter */+/** \addtogroup InplaceDecomposition+    \ingroup DenseLinearSolvers_chapter */+/** \addtogroup DenseDecompositionBenchmark+    \ingroup DenseLinearSolvers_chapter */++/** \addtogroup DenseLinearSolvers_Reference+    \ingroup DenseLinearSolvers_chapter */+/** \addtogroup Cholesky_Module+    \ingroup DenseLinearSolvers_Reference */+/** \addtogroup LU_Module+    \ingroup DenseLinearSolvers_Reference */+/** \addtogroup QR_Module+    \ingroup DenseLinearSolvers_Reference */+/** \addtogroup SVD_Module+    \ingroup DenseLinearSolvers_Reference*/+/** \addtogroup Eigenvalues_Module+    \ingroup DenseLinearSolvers_Reference */+++++/** \defgroup Sparse_chapter Sparse linear algebra */+/** \defgroup Sparse_Reference Reference */++/** \addtogroup TutorialSparse+    \ingroup Sparse_chapter */+/** \addtogroup TopicSparseSystems+    \ingroup Sparse_chapter */+/** \addtogroup MatrixfreeSolverExample+    \ingroup Sparse_chapter */++/** \addtogroup Sparse_Reference+    \ingroup Sparse_chapter */+/** \addtogroup SparseCore_Module+    \ingroup Sparse_Reference */+/** \addtogroup OrderingMethods_Module+    \ingroup Sparse_Reference */+/** \addtogroup SparseCholesky_Module+    \ingroup Sparse_Reference */+/** \addtogroup SparseLU_Module+    \ingroup Sparse_Reference */+/** \addtogroup SparseQR_Module+    \ingroup Sparse_Reference */+/** \addtogroup IterativeLinearSolvers_Module+    \ingroup Sparse_Reference */+/** \addtogroup Sparse_Module+    \ingroup Sparse_Reference */+/** \addtogroup Support_modules+    \ingroup Sparse_Reference */    ++/** \addtogroup SparseQuickRefPage+    \ingroup Sparse_chapter */+++/** \defgroup Geometry_chapter Geometry */+/** \defgroup Geometry_Reference Reference */++/** \addtogroup TutorialGeometry+    \ingroup Geometry_chapter */+    +/** \addtogroup Geometry_Reference+    \ingroup Geometry_chapter */+/** \addtogroup Geometry_Module+    \ingroup Geometry_Reference */+/** \addtogroup Splines_Module+    \ingroup Geometry_Reference */++/** \internal \brief Namespace containing low-level routines from the %Eigen library. */+namespace internal {}+}
+ eigen3/doc/MatrixfreeSolverExample.dox view
@@ -0,0 +1,20 @@++namespace Eigen {++/**++\eigenManualPage MatrixfreeSolverExample Matrix-free solvers++Iterative solvers such as ConjugateGradient and BiCGSTAB can be used in a matrix free context. To this end, user must provide a wrapper class inheriting EigenBase<> and implementing the following methods:+ - \c Index \c rows() and \c Index \c cols(): returns number of rows and columns respectively+ - \c operator* with your type and an %Eigen dense column vector (its actual implementation goes in a specialization of the internal::generic_product_impl class)++\c Eigen::internal::traits<> must also be specialized for the wrapper type.++Here is a complete example wrapping an Eigen::SparseMatrix:+\include matrixfree_cg.cpp+Output: \verbinclude matrixfree_cg.out++*/++}
+ eigen3/doc/NewExpressionType.dox view
@@ -0,0 +1,143 @@+namespace Eigen {++/** \page TopicNewExpressionType Adding a new expression type++<!--<span style="font-size:130%; color:red; font-weight: 900;"></span>-->+\warning+Disclaimer: this page is tailored to very advanced users who are not afraid of dealing with some %Eigen's internal aspects.+In most cases, a custom expression can be avoided by either using custom \ref MatrixBase::unaryExpr "unary" or \ref MatrixBase::binaryExpr "binary" functors,+while extremely complex matrix manipulations can be achieved by a nullary functors as described in the \ref TopicCustomizing_NullaryExpr "previous page".++This page describes with the help of an example how to implement a new+light-weight expression type in %Eigen. This consists of three parts:+the expression type itself, a traits class containing compile-time+information about the expression, and the evaluator class which is+used to evaluate the expression to a matrix.++\b TO \b DO: Write a page explaining the design, with details on+vectorization etc., and refer to that page here.+++\eigenAutoToc++\section TopicSetting The setting++A circulant matrix is a matrix where each column is the same as the+column to the left, except that it is cyclically shifted downwards.+For example, here is a 4-by-4 circulant matrix:+\f[ \begin{bmatrix} +    1 & 8 & 4 & 2 \\ +    2 & 1 & 8 & 4 \\+    4 & 2 & 1 & 8 \\+    8 & 4 & 2 & 1+\end{bmatrix} \f]+A circulant matrix is uniquely determined by its first column. We wish+to write a function \c makeCirculant which, given the first column,+returns an expression representing the circulant matrix.++For simplicity, we restrict the \c makeCirculant function to dense+matrices. It may make sense to also allow arrays, or sparse matrices,+but we will not do so here. We also do not want to support+vectorization.+++\section TopicPreamble Getting started++We will present the file implementing the \c makeCirculant function+part by part. We start by including the appropriate header files and+forward declaring the expression class, which we will call+\c Circulant. The \c makeCirculant function will return an object of+this type. The class \c Circulant is in fact a class template; the+template argument \c ArgType refers to the type of the vector passed+to the \c makeCirculant function.++\include make_circulant.cpp.preamble+++\section TopicTraits The traits class++For every expression class \c X, there should be a traits class +\c Traits<X> in the \c Eigen::internal namespace containing+information about \c X known as compile time.++As explained in \ref TopicSetting, we designed the \c Circulant+expression class to refer to dense matrices. The entries of the+circulant matrix have the same type as the entries of the vector+passed to the \c makeCirculant function. The type used to index the+entries is also the same. Again for simplicity, we will only return+column-major matrices. Finally, the circulant matrix is a square+matrix (number of rows equals number of columns), and the number of+rows equals the number of rows of the column vector passed to the+\c makeCirculant function. If this is a dynamic-size vector, then the+size of the circulant matrix is not known at compile-time.++This leads to the following code:++\include make_circulant.cpp.traits+++\section TopicExpression The expression class++The next step is to define the expression class itself. In our case,+we want to inherit from \c MatrixBase in order to expose the interface+for dense matrices. In the constructor, we check that we are passed a+column vector (see \ref TopicAssertions) and we store the vector from+which we are going to build the circulant matrix in the member+variable \c m_arg. Finally, the expression class should compute the+size of the corresponding circulant matrix. As explained above, this+is a square matrix with as many columns as the vector used to+construct the matrix.++\b TO \b DO: What about the \c Nested typedef? It seems to be+necessary; is this only temporary?++\include make_circulant.cpp.expression+++\section TopicEvaluator The evaluator++The last big fragment implements the evaluator for the \c Circulant+expression. The evaluator computes the entries of the circulant+matrix; this is done in the \c .coeff() member function. The entries+are computed by finding the corresponding entry of the vector from+which the circulant matrix is constructed. Getting this entry may+actually be non-trivial when the circulant matrix is constructed from+a vector which is given by a complicated expression, so we use the+evaluator which corresponds to the vector.++The \c CoeffReadCost constant records the cost of computing an entry+of the circulant matrix; we ignore the index computation and say that+this is the same as the cost of computing an entry of the vector from+which the circulant matrix is constructed.++In the constructor, we save the evaluator for the column vector which+defined the circulant matrix. We also save the size of that vector;+remember that we can query an expression object to find the size but+not the evaluator. ++\include make_circulant.cpp.evaluator+++\section TopicEntry The entry point++After all this, the \c makeCirculant function is very simple. It+simply creates an expression object and returns it.++\include make_circulant.cpp.entry+++\section TopicMain A simple main function for testing++Finally, a short \c main function that shows how the \c makeCirculant+function can be called.++\include make_circulant.cpp.main++If all the fragments are combined, the following output is produced,+showing that the program works as expected:++\include make_circulant.out++*/+}+
+ eigen3/doc/Overview.dox view
@@ -0,0 +1,30 @@+namespace Eigen {++/** \mainpage notitle++This is the API documentation for Eigen3. You can <a href="eigen-doc.tgz">download</a> it as a tgz archive for offline reading.++You're already an Eigen2 user? Here is a \link Eigen2ToEigen3 Eigen2 to Eigen3 guide \endlink to help porting your application.++For a first contact with Eigen, the best place is to have a look at the \link GettingStarted getting started \endlink page that show you how to write and compile your first program with Eigen.++Then, the \b quick \b reference \b pages give you a quite complete description of the API in a very condensed format that is specially useful to recall the syntax of a particular feature, or to have a quick look at the API. They currently cover the two following feature sets, and more will come in the future:+  - \link QuickRefPage [QuickRef] Dense matrix and array manipulations \endlink+  - \link SparseQuickRefPage [QuickRef] Sparse linear algebra \endlink++You're a MatLab user? There is also a <a href="AsciiQuickReference.txt">short ASCII reference</a> with Matlab translations.+  +The \b main \b documentation is organized into \em chapters covering different domains of features.+They are themselves composed of \em user \em manual pages describing the different features in a comprehensive way, and \em reference pages that gives you access to the API documentation through the related Eigen's \em modules and \em classes.++Under the \subpage UserManual_CustomizingEigen section, you will find discussions and examples on extending %Eigen's features and supporting custom scalar types.++Under the \subpage UserManual_Generalities section, you will find documentation on more general topics such as preprocessor directives, controlling assertions, multi-threading, MKL support, some Eigen's internal insights, and much more...++Finally, do not miss the search engine, useful to quickly get to the documentation of a given class or function.++Want more? Checkout the <a href="unsupported/index.html">\em unsupported \em modules </a> documentation.++*/++}
+ eigen3/doc/PassingByValue.dox view
@@ -0,0 +1,40 @@+namespace Eigen {++/** \eigenManualPage TopicPassingByValue Passing Eigen objects by value to functions++Passing objects by value is almost always a very bad idea in C++, as this means useless copies, and one should pass them by reference instead.++With Eigen, this is even more important: passing \ref TopicFixedSizeVectorizable "fixed-size vectorizable Eigen objects" by value is not only inefficient, it can be illegal or make your program crash! And the reason is that these Eigen objects have alignment modifiers that aren't respected when they are passed by value.++So for example, a function like this, where v is passed by value:++\code+void my_function(Eigen::Vector2d v);+\endcode++needs to be rewritten as follows, passing v by reference:++\code+void my_function(const Eigen::Vector2d& v);+\endcode++Likewise if you have a class having a Eigen object as member:++\code+struct Foo+{+  Eigen::Vector2d v;+};+void my_function(Foo v);+\endcode++This function also needs to be rewritten like this:+\code+void my_function(const Foo& v);+\endcode++Note that on the other hand, there is no problem with functions that return objects by value.++*/++}
+ eigen3/doc/Pitfalls.dox view
@@ -0,0 +1,44 @@+namespace Eigen {++/** \page TopicPitfalls Common pitfalls+++\section TopicPitfalls_template_keyword Compilation error with template methods++See this \link TopicTemplateKeyword page \endlink.++\section TopicPitfalls_aliasing Aliasing++Don't miss this \link TopicAliasing page \endlink on aliasing,+especially if you got wrong results in statements where the destination appears on the right hand side of the expression.++\section TopicPitfalls_auto_keyword C++11 and the auto keyword++In short: do not use the auto keywords with Eigen's expressions, unless you are 100% sure about what you are doing. In particular, do not use the auto keyword as a replacement for a Matrix<> type. Here is an example:++\code+MatrixXd A, B;+auto C = A*B;+for(...) { ... w = C * v;  ...}+\endcode++In this example, the type of C is not a MatrixXd but an abstract expression representing a matrix product and storing references to A and B. Therefore, the product of A*B will be carried out multiple times, once per iteration of the for loop. Moreover, if the coefficients of A or B change during the iteration, then C will evaluate to different values.++Here is another example leading to a segfault:+\code+auto C = ((A+B).eval()).transpose();+// do something with C+\endcode+The problem is that eval() returns a temporary object (in this case a MatrixXd) which is then referenced by the Transpose<> expression. However, this temporary is deleted right after the first line, and there the C expression reference a dead object. The same issue might occur when sub expressions are automatically evaluated by Eigen as in the following example:+\code+VectorXd u, v;+auto C = u + (A*v).normalized();+// do something with C+\endcode+where the normalized() method has to evaluate the expensive product A*v to avoid evaluating it twice. On the other hand, the following example is perfectly fine:+\code+auto C = (u + (A*v).normalized()).eval();+\endcode+In this case, C will be a regular VectorXd object.+*/+}
+ eigen3/doc/PreprocessorDirectives.dox view
@@ -0,0 +1,174 @@+namespace Eigen {++/** \page TopicPreprocessorDirectives Preprocessor directives++You can control some aspects of %Eigen by defining the preprocessor tokens using \c \#define. These macros+should be defined before any %Eigen headers are included. Often they are best set in the project options.++This page lists the preprocessor tokens recognized by %Eigen.++\eigenAutoToc+++\section TopicPreprocessorDirectivesMajor Macros with major effects++These macros have a major effect and typically break the API (Application Programming Interface) and/or the+ABI (Application Binary Interface). This can be rather dangerous: if parts of your program are compiled with+one option, and other parts (or libraries that you use) are compiled with another option, your program may+fail to link or exhibit subtle bugs. Nevertheless, these options can be useful for people who know what they+are doing.++ - \b EIGEN2_SUPPORT and \b EIGEN2_SUPPORT_STAGEnn_xxx are disabled starting from the 3.3 release.+   Defining one of these will raise a compile-error. If you need to compile Eigen2 code,+   <a href="http://eigen.tuxfamily.org/index.php?title=Eigen2">check this site</a>.+ - \b EIGEN_DEFAULT_DENSE_INDEX_TYPE - the type for column and row indices in matrices, vectors and array+   (DenseBase::Index). Set to \c std::ptrdiff_t by default.+ - \b EIGEN_DEFAULT_IO_FORMAT - the IOFormat to use when printing a matrix if no %IOFormat is specified.+   Defaults to the %IOFormat constructed by the default constructor IOFormat::IOFormat().+ - \b EIGEN_INITIALIZE_MATRICES_BY_ZERO - if defined, all entries of newly constructed matrices and arrays are+   initialized to zero, as are new entries in matrices and arrays after resizing. Not defined by default.+   \warning The unary (resp. binary) constructor of \c 1x1 (resp. \c 2x1 or \c 1x2) fixed size matrices is+   always interpreted as an initialization constructor where the argument(s) are the coefficient values+   and not the sizes. For instance, \code Vector2d v(2,1); \endcode will create a vector with coeficients [2,1],+   and \b not a \c 2x1 vector initialized with zeros (i.e., [0,0]). If such cases might occur, then it is+   recommended to use the default constructor with a explicit call to resize:+   \code+   Matrix<?,SizeAtCompileTime,1> v;+   v.resize(size);+   Matrix<?,RowsAtCompileTime,ColsAtCompileTime> m;+   m.resize(rows,cols);+   \endcode+ - \b EIGEN_INITIALIZE_MATRICES_BY_NAN - if defined, all entries of newly constructed matrices and arrays are+   initialized to NaN, as are new entries in matrices and arrays after resizing. This option is especially+   useful for debugging purpose, though a memory tool like <a href="http://valgrind.org/">valgrind</a> is+   preferable. Not defined by default.+   \warning See the documentation of \c EIGEN_INITIALIZE_MATRICES_BY_ZERO for a discussion on a limitations+   of these macros when applied to \c 1x1, \c 1x2, and \c 2x1 fixed-size matrices.+ - \b EIGEN_NO_AUTOMATIC_RESIZING - if defined, the matrices (or arrays) on both sides of an assignment +   <tt>a = b</tt> have to be of the same size; otherwise, %Eigen automatically resizes \c a so that it is of+   the correct size. Not defined by default.+++\section TopicPreprocessorDirectivesCppVersion C++ standard features++By default, %Eigen strive to automatically detect and enable langage features at compile-time based on+the information provided by the compiler.++ - \b EIGEN_MAX_CPP_VER - disables usage of C++ features requiring a version greater than EIGEN_MAX_CPP_VER.+   Possible values are: 03, 11, 14, 17, etc. If not defined (the default), %Eigen enables all features supported+   by the compiler.++Individual features can be explicitly enabled or disabled by defining the following token to 0 or 1 respectively.+For instance, one might limit the C++ version to C++03 by defining EIGEN_MAX_CPP_VER=03, but still enable C99 math+functions by defining EIGEN_HAS_C99_MATH=1.++ - \b EIGEN_HAS_C99_MATH - controls the usage of C99 math functions such as erf, erfc, lgamma, etc.+   Automatic detection disabled if EIGEN_MAX_CPP_VER<11.+ - \b EIGEN_HAS_CXX11_MATH - controls the implementation of some functions such as round, logp1, isinf, isnan, etc.+   Automatic detection disabled if EIGEN_MAX_CPP_VER<11.+ - \b EIGEN_HAS_RVALUE_REFERENCES - defines whetehr rvalue references are supported+   Automatic detection disabled if EIGEN_MAX_CPP_VER<11.+ - \b EIGEN_HAS_STD_RESULT_OF - defines whether std::result_of is supported+   Automatic detection disabled if EIGEN_MAX_CPP_VER<11.+ - \b EIGEN_HAS_VARIADIC_TEMPLATES - defines whether variadic templates are supported+   Automatic detection disabled if EIGEN_MAX_CPP_VER<11.+ - \b EIGEN_HAS_CONSTEXPR - defines whether relaxed const expression are supported+   Automatic detection disabled if EIGEN_MAX_CPP_VER<14.+ - \b EIGEN_HAS_CXX11_CONTAINERS - defines whether STL's containers follows C++11 specifications+   Automatic detection disabled if EIGEN_MAX_CPP_VER<11.+ - \b EIGEN_HAS_CXX11_NOEXCEPT - defines whether noexcept is supported+   Automatic detection disabled if EIGEN_MAX_CPP_VER<11.++\section TopicPreprocessorDirectivesAssertions Assertions++The %Eigen library contains many assertions to guard against programming errors, both at compile time and at+run time. However, these assertions do cost time and can thus be turned off.++ - \b EIGEN_NO_DEBUG - disables %Eigen's assertions if defined. Not defined by default, unless the+   \c NDEBUG macro is defined (this is a standard C++ macro which disables all asserts). + - \b EIGEN_NO_STATIC_ASSERT - if defined, compile-time static assertions are replaced by runtime assertions; +   this saves compilation time. Not defined by default.+ - \b eigen_assert - macro with one argument that is used inside %Eigen for assertions. By default, it is+   basically defined to be \c assert, which aborts the program if the assertion is violated. Redefine this+   macro if you want to do something else, like throwing an exception.+ - \b EIGEN_MPL2_ONLY - disable non MPL2 compatible features, or in other words disable the features which+   are still under the LGPL.+++\section TopicPreprocessorDirectivesPerformance Alignment, vectorization and performance tweaking++ - \b \c EIGEN_MALLOC_ALREADY_ALIGNED - Can be set to 0 or 1 to tell whether default system \c malloc already+   returns aligned buffers. In not defined, then this information is automatically deduced from the compiler+   and system preprocessor tokens.+ - \b \c EIGEN_MAX_ALIGN_BYTES - Must be a power of two, or 0. Defines an upper bound on the memory boundary in bytes on which dynamically and statically allocated data may be aligned by %Eigen. If not defined, a default value is automatically computed based on architecture, compiler, and OS.+ This option is typically used to enforce binary compatibility between code/libraries compiled with different SIMD options. For instance, one may compile AVX code and enforce ABI compatibility with existing SSE code by defining \c EIGEN_MAX_ALIGN_BYTES=16. In the other way round, since by default AVX implies 32 bytes alignment for best performance, one can compile SSE code to be ABI compatible with AVX code by defining \c EIGEN_MAX_ALIGN_BYTES=32.+ - \b \c EIGEN_MAX_STATIC_ALIGN_BYTES - Same as \c EIGEN_MAX_ALIGN_BYTES but for statically allocated data only. By default, if only  \c EIGEN_MAX_ALIGN_BYTES is defined, then \c EIGEN_MAX_STATIC_ALIGN_BYTES == \c EIGEN_MAX_ALIGN_BYTES, otherwise a default value is automatically computed based on architecture, compiler, and OS (can be smaller than the default value of EIGEN_MAX_ALIGN_BYTES on architectures that do not support stack alignment).+ Let us emphasize that \c EIGEN_MAX_*_ALIGN_BYTES define only a diserable upper bound. In practice data is aligned to largest power-of-two common divisor of \c EIGEN_MAX_STATIC_ALIGN_BYTES and the size of the data, such that memory is not wasted.+ - \b \c EIGEN_DONT_PARALLELIZE - if defined, this disables multi-threading. This is only relevant if you enabled OpenMP.+   See \ref TopicMultiThreading for details.+ - \b EIGEN_DONT_VECTORIZE - disables explicit vectorization when defined. Not defined by default, unless +   alignment is disabled by %Eigen's platform test or the user defining \c EIGEN_DONT_ALIGN.+ - \b \c EIGEN_UNALIGNED_VECTORIZE - disables/enables vectorization with unaligned stores. Default is 1 (enabled).+   If set to 0 (disabled), then expression for which the destination cannot be aligned are not vectorized (e.g., unaligned+   small fixed size vectors or matrices)+ - \b \c EIGEN_FAST_MATH - enables some optimizations which might affect the accuracy of the result. This currently+   enables the SSE vectorization of sin() and cos(), and speedups sqrt() for single precision. Defined to 1 by default.+   Define it to 0 to disable.+ - \b \c EIGEN_UNROLLING_LIMIT - defines the size of a loop to enable meta unrolling. Set it to zero to disable+   unrolling. The size of a loop here is expressed in %Eigen's own notion of "number of FLOPS", it does not+   correspond to the number of iterations or the number of instructions. The default is value 100.+ - \b \c EIGEN_STACK_ALLOCATION_LIMIT - defines the maximum bytes for a buffer to be allocated on the stack. For internal+   temporary buffers, dynamic memory allocation is employed as a fall back. For fixed-size matrices or arrays, exceeding+   this threshold raises a compile time assertion. Use 0 to set no limit. Default is 128 KB.+ - \b \c EIGEN_STRONG_INLINE - This macro is used to qualify critical functions and methods that we expect the compiler to inline.+   By default it is defined to \c __forceinline for MSVC and ICC, and to \c inline for other compilers. A tipical usage is to+   define it to \c inline for MSVC users wanting faster compilation times, at the risk of performance degradations in some rare+   cases for which MSVC inliner fails to do a good job.+++ - \c EIGEN_DONT_ALIGN - Deprecated, it is a synonym for \c EIGEN_MAX_ALIGN_BYTES=0. It disables alignment completely. %Eigen will not try to align its objects and does not expect that any objects passed to it are aligned. This will turn off vectorization if \b EIGEN_UNALIGNED_VECTORIZE=1. Not defined by default.+ - \c EIGEN_DONT_ALIGN_STATICALLY - Deprecated, it is a synonym for \c EIGEN_MAX_STATIC_ALIGN_BYTES=0. It disables alignment of arrays on the stack. Not defined by default, unless \c EIGEN_DONT_ALIGN is defined.+++\section TopicPreprocessorDirectivesPlugins Plugins++It is possible to add new methods to many fundamental classes in %Eigen by writing a plugin. As explained in+the section \ref TopicCustomizing_Plugins, the plugin is specified by defining a \c EIGEN_xxx_PLUGIN macro. The+following macros are supported; none of them are defined by default.++ - \b EIGEN_ARRAY_PLUGIN - filename of plugin for extending the Array class.+ - \b EIGEN_ARRAYBASE_PLUGIN - filename of plugin for extending the ArrayBase class.+ - \b EIGEN_CWISE_PLUGIN - filename of plugin for extending the Cwise class.+ - \b EIGEN_DENSEBASE_PLUGIN - filename of plugin for extending the DenseBase class.+ - \b EIGEN_DYNAMICSPARSEMATRIX_PLUGIN - filename of plugin for extending the DynamicSparseMatrix class.+ - \b EIGEN_MATRIX_PLUGIN - filename of plugin for extending the Matrix class.+ - \b EIGEN_MATRIXBASE_PLUGIN - filename of plugin for extending the MatrixBase class.+ - \b EIGEN_PLAINOBJECTBASE_PLUGIN - filename of plugin for extending the PlainObjectBase class.+ - \b EIGEN_MAPBASE_PLUGIN - filename of plugin for extending the MapBase class.+ - \b EIGEN_QUATERNION_PLUGIN - filename of plugin for extending the Quaternion class.+ - \b EIGEN_QUATERNIONBASE_PLUGIN - filename of plugin for extending the QuaternionBase class.+ - \b EIGEN_SPARSEMATRIX_PLUGIN - filename of plugin for extending the SparseMatrix class.+ - \b EIGEN_SPARSEMATRIXBASE_PLUGIN - filename of plugin for extending the SparseMatrixBase class.+ - \b EIGEN_SPARSEVECTOR_PLUGIN - filename of plugin for extending the SparseVector class.+ - \b EIGEN_TRANSFORM_PLUGIN - filename of plugin for extending the Transform class.+ - \b EIGEN_FUNCTORS_PLUGIN - filename of plugin for adding new functors and specializations of functor_traits.+++\section TopicPreprocessorDirectivesDevelopers Macros for Eigen developers++These macros are mainly meant for people developing %Eigen and for testing purposes. Even though, they might be useful for power users and the curious for debugging and testing purpose, they \b should \b not \b be \b used by real-word code.++ - \b EIGEN_DEFAULT_TO_ROW_MAJOR - when defined, the default storage order for matrices becomes row-major+   instead of column-major. Not defined by default.+ - \b EIGEN_INTERNAL_DEBUGGING - if defined, enables assertions in %Eigen's internal routines. This is useful+   for debugging %Eigen itself. Not defined by default.+ - \b EIGEN_NO_MALLOC - if defined, any request from inside the %Eigen to allocate memory from the heap+   results in an assertion failure. This is useful to check that some routine does not allocate memory+   dynamically. Not defined by default.+ - \b EIGEN_RUNTIME_NO_MALLOC - if defined, a new switch is introduced which can be turned on and off by+   calling <tt>set_is_malloc_allowed(bool)</tt>. If malloc is not allowed and %Eigen tries to allocate memory+   dynamically anyway, an assertion failure results. Not defined by default.++*/++}
+ eigen3/doc/QuickReference.dox view
@@ -0,0 +1,785 @@+namespace Eigen {++/** \eigenManualPage QuickRefPage Quick reference guide++\eigenAutoToc++<hr>++<a href="#" class="top">top</a>+\section QuickRef_Headers Modules and Header files++The Eigen library is divided in a Core module and several additional modules. Each module has a corresponding header file which has to be included in order to use the module. The \c %Dense and \c Eigen header files are provided to conveniently gain access to several modules at once.++<table class="manual">+<tr><th>Module</th><th>Header file</th><th>Contents</th></tr>+<tr            ><td>\link Core_Module Core \endlink</td><td>\code#include <Eigen/Core>\endcode</td><td>Matrix and Array classes, basic linear algebra (including triangular and selfadjoint products), array manipulation</td></tr>+<tr class="alt"><td>\link Geometry_Module Geometry \endlink</td><td>\code#include <Eigen/Geometry>\endcode</td><td>Transform, Translation, Scaling, Rotation2D and 3D rotations (Quaternion, AngleAxis)</td></tr>+<tr            ><td>\link LU_Module LU \endlink</td><td>\code#include <Eigen/LU>\endcode</td><td>Inverse, determinant, LU decompositions with solver (FullPivLU, PartialPivLU)</td></tr>+<tr class="alt"><td>\link Cholesky_Module Cholesky \endlink</td><td>\code#include <Eigen/Cholesky>\endcode</td><td>LLT and LDLT Cholesky factorization with solver</td></tr>+<tr            ><td>\link Householder_Module Householder \endlink</td><td>\code#include <Eigen/Householder>\endcode</td><td>Householder transformations; this module is used by several linear algebra modules</td></tr>+<tr class="alt"><td>\link SVD_Module SVD \endlink</td><td>\code#include <Eigen/SVD>\endcode</td><td>SVD decompositions with least-squares solver (JacobiSVD, BDCSVD)</td></tr>+<tr            ><td>\link QR_Module QR \endlink</td><td>\code#include <Eigen/QR>\endcode</td><td>QR decomposition with solver (HouseholderQR, ColPivHouseholderQR, FullPivHouseholderQR)</td></tr>+<tr class="alt"><td>\link Eigenvalues_Module Eigenvalues \endlink</td><td>\code#include <Eigen/Eigenvalues>\endcode</td><td>Eigenvalue, eigenvector decompositions (EigenSolver, SelfAdjointEigenSolver, ComplexEigenSolver)</td></tr>+<tr            ><td>\link Sparse_Module Sparse \endlink</td><td>\code#include <Eigen/Sparse>\endcode</td><td>%Sparse matrix storage and related basic linear algebra (SparseMatrix, SparseVector) \n (see \ref SparseQuickRefPage for details on sparse modules)</td></tr>+<tr class="alt"><td></td><td>\code#include <Eigen/Dense>\endcode</td><td>Includes Core, Geometry, LU, Cholesky, SVD, QR, and Eigenvalues header files</td></tr>+<tr            ><td></td><td>\code#include <Eigen/Eigen>\endcode</td><td>Includes %Dense and %Sparse header files (the whole Eigen library)</td></tr>+</table>++<a href="#" class="top">top</a>+\section QuickRef_Types Array, matrix and vector types+++\b Recall: Eigen provides two kinds of dense objects: mathematical matrices and vectors which are both represented by the template class Matrix, and general 1D and 2D arrays represented by the template class Array:+\code+typedef Matrix<Scalar, RowsAtCompileTime, ColsAtCompileTime, Options> MyMatrixType;+typedef Array<Scalar, RowsAtCompileTime, ColsAtCompileTime, Options> MyArrayType;+\endcode++\li \c Scalar is the scalar type of the coefficients (e.g., \c float, \c double, \c bool, \c int, etc.).+\li \c RowsAtCompileTime and \c ColsAtCompileTime are the number of rows and columns of the matrix as known at compile-time or \c Dynamic.+\li \c Options can be \c ColMajor or \c RowMajor, default is \c ColMajor. (see class Matrix for more options)++All combinations are allowed: you can have a matrix with a fixed number of rows and a dynamic number of columns, etc. The following are all valid:+\code+Matrix<double, 6, Dynamic>                  // Dynamic number of columns (heap allocation)+Matrix<double, Dynamic, 2>                  // Dynamic number of rows (heap allocation)+Matrix<double, Dynamic, Dynamic, RowMajor>  // Fully dynamic, row major (heap allocation)+Matrix<double, 13, 3>                       // Fully fixed (usually allocated on stack)+\endcode++In most cases, you can simply use one of the convenience typedefs for \ref matrixtypedefs "matrices" and \ref arraytypedefs "arrays". Some examples:+<table class="example">+<tr><th>Matrices</th><th>Arrays</th></tr>+<tr><td>\code+Matrix<float,Dynamic,Dynamic>   <=>   MatrixXf+Matrix<double,Dynamic,1>        <=>   VectorXd+Matrix<int,1,Dynamic>           <=>   RowVectorXi+Matrix<float,3,3>               <=>   Matrix3f+Matrix<float,4,1>               <=>   Vector4f+\endcode</td><td>\code+Array<float,Dynamic,Dynamic>    <=>   ArrayXXf+Array<double,Dynamic,1>         <=>   ArrayXd+Array<int,1,Dynamic>            <=>   RowArrayXi+Array<float,3,3>                <=>   Array33f+Array<float,4,1>                <=>   Array4f+\endcode</td></tr>+</table>++Conversion between the matrix and array worlds:+\code+Array44f a1, a1;+Matrix4f m1, m2;+m1 = a1 * a2;                     // coeffwise product, implicit conversion from array to matrix.+a1 = m1 * m2;                     // matrix product, implicit conversion from matrix to array.+a2 = a1 + m1.array();             // mixing array and matrix is forbidden+m2 = a1.matrix() + m1;            // and explicit conversion is required.+ArrayWrapper<Matrix4f> m1a(m1);   // m1a is an alias for m1.array(), they share the same coefficients+MatrixWrapper<Array44f> a1m(a1);+\endcode++In the rest of this document we will use the following symbols to emphasize the features which are specifics to a given kind of object:+\li <a name="matrixonly"></a>\matrixworld linear algebra matrix and vector only+\li <a name="arrayonly"></a>\arrayworld array objects only++\subsection QuickRef_Basics Basic matrix manipulation++<table class="manual">+<tr><th></th><th>1D objects</th><th>2D objects</th><th>Notes</th></tr>+<tr><td>Constructors</td>+<td>\code+Vector4d  v4;+Vector2f  v1(x, y);+Array3i   v2(x, y, z);+Vector4d  v3(x, y, z, w);++VectorXf  v5; // empty object+ArrayXf   v6(size);+\endcode</td><td>\code+Matrix4f  m1;+++++MatrixXf  m5; // empty object+MatrixXf  m6(nb_rows, nb_columns);+\endcode</td><td class="note">+By default, the coefficients \n are left uninitialized</td></tr>+<tr class="alt"><td>Comma initializer</td>+<td>\code+Vector3f  v1;     v1 << x, y, z;+ArrayXf   v2(4);  v2 << 1, 2, 3, 4;++\endcode</td><td>\code+Matrix3f  m1;   m1 << 1, 2, 3,+                      4, 5, 6,+                      7, 8, 9;+\endcode</td><td></td></tr>++<tr><td>Comma initializer (bis)</td>+<td colspan="2">+\include Tutorial_commainit_02.cpp+</td>+<td>+output:+\verbinclude Tutorial_commainit_02.out+</td>+</tr>++<tr class="alt"><td>Runtime info</td>+<td>\code+vector.size();++vector.innerStride();+vector.data();+\endcode</td><td>\code+matrix.rows();          matrix.cols();+matrix.innerSize();     matrix.outerSize();+matrix.innerStride();   matrix.outerStride();+matrix.data();+\endcode</td><td class="note">Inner/Outer* are storage order dependent</td></tr>+<tr><td>Compile-time info</td>+<td colspan="2">\code+ObjectType::Scalar              ObjectType::RowsAtCompileTime+ObjectType::RealScalar          ObjectType::ColsAtCompileTime+ObjectType::Index               ObjectType::SizeAtCompileTime+\endcode</td><td></td></tr>+<tr class="alt"><td>Resizing</td>+<td>\code+vector.resize(size);+++vector.resizeLike(other_vector);+vector.conservativeResize(size);+\endcode</td><td>\code+matrix.resize(nb_rows, nb_cols);+matrix.resize(Eigen::NoChange, nb_cols);+matrix.resize(nb_rows, Eigen::NoChange);+matrix.resizeLike(other_matrix);+matrix.conservativeResize(nb_rows, nb_cols);+\endcode</td><td class="note">no-op if the new sizes match,<br/>otherwise data are lost<br/><br/>resizing with data preservation</td></tr>++<tr><td>Coeff access with \n range checking</td>+<td>\code+vector(i)     vector.x()+vector[i]     vector.y()+              vector.z()+              vector.w()+\endcode</td><td>\code+matrix(i,j)+\endcode</td><td class="note">Range checking is disabled if \n NDEBUG or EIGEN_NO_DEBUG is defined</td></tr>++<tr class="alt"><td>Coeff access without \n range checking</td>+<td>\code+vector.coeff(i)+vector.coeffRef(i)+\endcode</td><td>\code+matrix.coeff(i,j)+matrix.coeffRef(i,j)+\endcode</td><td></td></tr>++<tr><td>Assignment/copy</td>+<td colspan="2">\code+object = expression;+object_of_float = expression_of_double.cast<float>();+\endcode</td><td class="note">the destination is automatically resized (if possible)</td></tr>++</table>++\subsection QuickRef_PredefMat Predefined Matrices++<table class="manual">+<tr>+  <th>Fixed-size matrix or vector</th>+  <th>Dynamic-size matrix</th>+  <th>Dynamic-size vector</th>+</tr>+<tr style="border-bottom-style: none;">+  <td>+\code+typedef {Matrix3f|Array33f} FixedXD;+FixedXD x;++x = FixedXD::Zero();+x = FixedXD::Ones();+x = FixedXD::Constant(value);+x = FixedXD::Random();+x = FixedXD::LinSpaced(size, low, high);++x.setZero();+x.setOnes();+x.setConstant(value);+x.setRandom();+x.setLinSpaced(size, low, high);+\endcode+  </td>+  <td>+\code+typedef {MatrixXf|ArrayXXf} Dynamic2D;+Dynamic2D x;++x = Dynamic2D::Zero(rows, cols);+x = Dynamic2D::Ones(rows, cols);+x = Dynamic2D::Constant(rows, cols, value);+x = Dynamic2D::Random(rows, cols);+N/A++x.setZero(rows, cols);+x.setOnes(rows, cols);+x.setConstant(rows, cols, value);+x.setRandom(rows, cols);+N/A+\endcode+  </td>+  <td>+\code+typedef {VectorXf|ArrayXf} Dynamic1D;+Dynamic1D x;++x = Dynamic1D::Zero(size);+x = Dynamic1D::Ones(size);+x = Dynamic1D::Constant(size, value);+x = Dynamic1D::Random(size);+x = Dynamic1D::LinSpaced(size, low, high);++x.setZero(size);+x.setOnes(size);+x.setConstant(size, value);+x.setRandom(size);+x.setLinSpaced(size, low, high);+\endcode+  </td>+</tr>++<tr><td colspan="3">Identity and \link MatrixBase::Unit basis vectors \endlink \matrixworld</td></tr>+<tr style="border-bottom-style: none;">+  <td>+\code+x = FixedXD::Identity();+x.setIdentity();++Vector3f::UnitX() // 1 0 0+Vector3f::UnitY() // 0 1 0+Vector3f::UnitZ() // 0 0 1+\endcode+  </td>+  <td>+\code+x = Dynamic2D::Identity(rows, cols);+x.setIdentity(rows, cols);++++N/A+\endcode+  </td>+  <td>\code+N/A+++VectorXf::Unit(size,i)+VectorXf::Unit(4,1) == Vector4f(0,1,0,0)+                    == Vector4f::UnitY()+\endcode+  </td>+</tr>+</table>++++\subsection QuickRef_Map Mapping external arrays++<table class="manual">+<tr>+<td>Contiguous \n memory</td>+<td>\code+float data[] = {1,2,3,4};+Map<Vector3f> v1(data);       // uses v1 as a Vector3f object+Map<ArrayXf>  v2(data,3);     // uses v2 as a ArrayXf object+Map<Array22f> m1(data);       // uses m1 as a Array22f object+Map<MatrixXf> m2(data,2,2);   // uses m2 as a MatrixXf object+\endcode</td>+</tr>+<tr>+<td>Typical usage \n of strides</td>+<td>\code+float data[] = {1,2,3,4,5,6,7,8,9};+Map<VectorXf,0,InnerStride<2> >  v1(data,3);                      // = [1,3,5]+Map<VectorXf,0,InnerStride<> >   v2(data,3,InnerStride<>(3));     // = [1,4,7]+Map<MatrixXf,0,OuterStride<3> >  m2(data,2,3);                    // both lines     |1,4,7|+Map<MatrixXf,0,OuterStride<> >   m1(data,2,3,OuterStride<>(3));   // are equal to:  |2,5,8|+\endcode</td>+</tr>+</table>+++<a href="#" class="top">top</a>+\section QuickRef_ArithmeticOperators Arithmetic Operators++<table class="manual">+<tr><td>+add \n subtract</td><td>\code+mat3 = mat1 + mat2;           mat3 += mat1;+mat3 = mat1 - mat2;           mat3 -= mat1;\endcode+</td></tr>+<tr class="alt"><td>+scalar product</td><td>\code+mat3 = mat1 * s1;             mat3 *= s1;           mat3 = s1 * mat1;+mat3 = mat1 / s1;             mat3 /= s1;\endcode+</td></tr>+<tr><td>+matrix/vector \n products \matrixworld</td><td>\code+col2 = mat1 * col1;+row2 = row1 * mat1;           row1 *= mat1;+mat3 = mat1 * mat2;           mat3 *= mat1; \endcode+</td></tr>+<tr class="alt"><td>+transposition \n adjoint \matrixworld</td><td>\code+mat1 = mat2.transpose();      mat1.transposeInPlace();+mat1 = mat2.adjoint();        mat1.adjointInPlace();+\endcode+</td></tr>+<tr><td>+\link MatrixBase::dot dot \endlink product \n inner product \matrixworld</td><td>\code+scalar = vec1.dot(vec2);+scalar = col1.adjoint() * col2;+scalar = (col1.adjoint() * col2).value();\endcode+</td></tr>+<tr class="alt"><td>+outer product \matrixworld</td><td>\code+mat = col1 * col2.transpose();\endcode+</td></tr>++<tr><td>+\link MatrixBase::norm() norm \endlink \n \link MatrixBase::normalized() normalization \endlink \matrixworld</td><td>\code+scalar = vec1.norm();         scalar = vec1.squaredNorm()+vec2 = vec1.normalized();     vec1.normalize(); // inplace \endcode+</td></tr>++<tr class="alt"><td>+\link MatrixBase::cross() cross product \endlink \matrixworld</td><td>\code+#include <Eigen/Geometry>+vec3 = vec1.cross(vec2);\endcode</td></tr>+</table>++<a href="#" class="top">top</a>+\section QuickRef_Coeffwise Coefficient-wise \& Array operators++In addition to the aforementioned operators, Eigen supports numerous coefficient-wise operator and functions.+Most of them unambiguously makes sense in array-world\arrayworld. The following operators are readily available for arrays,+or available through .array() for vectors and matrices:++<table class="manual">+<tr><td>Arithmetic operators</td><td>\code+array1 * array2     array1 / array2     array1 *= array2    array1 /= array2+array1 + scalar     array1 - scalar     array1 += scalar    array1 -= scalar+\endcode</td></tr>+<tr><td>Comparisons</td><td>\code+array1 < array2     array1 > array2     array1 < scalar     array1 > scalar+array1 <= array2    array1 >= array2    array1 <= scalar    array1 >= scalar+array1 == array2    array1 != array2    array1 == scalar    array1 != scalar+array1.min(array2)  array1.max(array2)  array1.min(scalar)  array1.max(scalar)+\endcode</td></tr>+<tr><td>Trigo, power, and \n misc functions \n and the STL-like variants</td><td>\code+array1.abs2()+array1.abs()                  abs(array1)+array1.sqrt()                 sqrt(array1)+array1.log()                  log(array1)+array1.log10()                log10(array1)+array1.exp()                  exp(array1)+array1.pow(array2)            pow(array1,array2)+array1.pow(scalar)            pow(array1,scalar)+                              pow(scalar,array2)+array1.square()+array1.cube()+array1.inverse()++array1.sin()                  sin(array1)+array1.cos()                  cos(array1)+array1.tan()                  tan(array1)+array1.asin()                 asin(array1)+array1.acos()                 acos(array1)+array1.atan()                 atan(array1)+array1.sinh()                 sinh(array1)+array1.cosh()                 cosh(array1)+array1.tanh()                 tanh(array1)+array1.arg()                  arg(array1)++array1.floor()                floor(array1)+array1.ceil()                 ceil(array1)+array1.round()                round(aray1)++array1.isFinite()             isfinite(array1)+array1.isInf()                isinf(array1)+array1.isNaN()                isnan(array1)+\endcode+</td></tr>+</table>+++The following coefficient-wise operators are available for all kind of expressions (matrices, vectors, and arrays), and for both real or complex scalar types:++<table class="manual">+<tr><th>Eigen's API</th><th>STL-like APIs\arrayworld </th><th>Comments</th></tr>+<tr><td>\code+mat1.real()+mat1.imag()+mat1.conjugate()+\endcode+</td><td>\code+real(array1)+imag(array1)+conj(array1)+\endcode+</td><td>+\code+ // read-write, no-op for real expressions+ // read-only for real, read-write for complexes+ // no-op for real expressions+\endcode+</td></tr>+</table>++Some coefficient-wise operators are readily available for for matrices and vectors through the following cwise* methods:+<table class="manual">+<tr><th>Matrix API \matrixworld</th><th>Via Array conversions</th></tr>+<tr><td>\code+mat1.cwiseMin(mat2)         mat1.cwiseMin(scalar)+mat1.cwiseMax(mat2)         mat1.cwiseMax(scalar)+mat1.cwiseAbs2()+mat1.cwiseAbs()+mat1.cwiseSqrt()+mat1.cwiseInverse()+mat1.cwiseProduct(mat2)+mat1.cwiseQuotient(mat2)+mat1.cwiseEqual(mat2)       mat1.cwiseEqual(scalar)+mat1.cwiseNotEqual(mat2)+\endcode+</td><td>\code+mat1.array().min(mat2.array())    mat1.array().min(scalar)+mat1.array().max(mat2.array())    mat1.array().max(scalar)+mat1.array().abs2()+mat1.array().abs()+mat1.array().sqrt()+mat1.array().inverse()+mat1.array() * mat2.array()+mat1.array() / mat2.array()+mat1.array() == mat2.array()      mat1.array() == scalar+mat1.array() != mat2.array()+\endcode</td></tr>+</table>+The main difference between the two API is that the one based on cwise* methods returns an expression in the matrix world,+while the second one (based on .array()) returns an array expression.+Recall that .array() has no cost, it only changes the available API and interpretation of the data.++It is also very simple to apply any user defined function \c foo using DenseBase::unaryExpr together with <a href="http://en.cppreference.com/w/cpp/utility/functional/ptr_fun">std::ptr_fun</a> (c++03), <a href="http://en.cppreference.com/w/cpp/utility/functional/ref">std::ref</a> (c++11), or <a href="http://en.cppreference.com/w/cpp/language/lambda">lambdas</a> (c++11):+\code+mat1.unaryExpr(std::ptr_fun(foo));+mat1.unaryExpr(std::ref(foo));+mat1.unaryExpr([](double x) { return foo(x); });+\endcode+++<a href="#" class="top">top</a>+\section QuickRef_Reductions Reductions++Eigen provides several reduction methods such as:+\link DenseBase::minCoeff() minCoeff() \endlink, \link DenseBase::maxCoeff() maxCoeff() \endlink,+\link DenseBase::sum() sum() \endlink, \link DenseBase::prod() prod() \endlink,+\link MatrixBase::trace() trace() \endlink \matrixworld,+\link MatrixBase::norm() norm() \endlink \matrixworld, \link MatrixBase::squaredNorm() squaredNorm() \endlink \matrixworld,+\link DenseBase::all() all() \endlink, and \link DenseBase::any() any() \endlink.+All reduction operations can be done matrix-wise,+\link DenseBase::colwise() column-wise \endlink or+\link DenseBase::rowwise() row-wise \endlink. Usage example:+<table class="manual">+<tr><td rowspan="3" style="border-right-style:dashed;vertical-align:middle">\code+      5 3 1+mat = 2 7 8+      9 4 6 \endcode+</td> <td>\code mat.minCoeff(); \endcode</td><td>\code 1 \endcode</td></tr>+<tr class="alt"><td>\code mat.colwise().minCoeff(); \endcode</td><td>\code 2 3 1 \endcode</td></tr>+<tr style="vertical-align:middle"><td>\code mat.rowwise().minCoeff(); \endcode</td><td>\code+1+2+4+\endcode</td></tr>+</table>++Special versions of \link DenseBase::minCoeff(IndexType*,IndexType*) const minCoeff \endlink and \link DenseBase::maxCoeff(IndexType*,IndexType*) const maxCoeff \endlink:+\code+int i, j;+s = vector.minCoeff(&i);        // s == vector[i]+s = matrix.maxCoeff(&i, &j);    // s == matrix(i,j)+\endcode+Typical use cases of all() and any():+\code+if((array1 > 0).all()) ...      // if all coefficients of array1 are greater than 0 ...+if((array1 < array2).any()) ... // if there exist a pair i,j such that array1(i,j) < array2(i,j) ...+\endcode+++<a href="#" class="top">top</a>\section QuickRef_Blocks Sub-matrices++Read-write access to a \link DenseBase::col(Index) column \endlink+or a \link DenseBase::row(Index) row \endlink of a matrix (or array):+\code+mat1.row(i) = mat2.col(j);+mat1.col(j1).swap(mat1.col(j2));+\endcode++Read-write access to sub-vectors:+<table class="manual">+<tr>+<th>Default versions</th>+<th>Optimized versions when the size \n is known at compile time</th></tr>+<th></th>++<tr><td>\code vec1.head(n)\endcode</td><td>\code vec1.head<n>()\endcode</td><td>the first \c n coeffs </td></tr>+<tr><td>\code vec1.tail(n)\endcode</td><td>\code vec1.tail<n>()\endcode</td><td>the last \c n coeffs </td></tr>+<tr><td>\code vec1.segment(pos,n)\endcode</td><td>\code vec1.segment<n>(pos)\endcode</td>+    <td>the \c n coeffs in the \n range [\c pos : \c pos + \c n - 1]</td></tr>+<tr class="alt"><td colspan="3">++Read-write access to sub-matrices:</td></tr>+<tr>+  <td>\code mat1.block(i,j,rows,cols)\endcode+      \link DenseBase::block(Index,Index,Index,Index) (more) \endlink</td>+  <td>\code mat1.block<rows,cols>(i,j)\endcode+      \link DenseBase::block(Index,Index) (more) \endlink</td>+  <td>the \c rows x \c cols sub-matrix \n starting from position (\c i,\c j)</td></tr>+<tr><td>\code+ mat1.topLeftCorner(rows,cols)+ mat1.topRightCorner(rows,cols)+ mat1.bottomLeftCorner(rows,cols)+ mat1.bottomRightCorner(rows,cols)\endcode+ <td>\code+ mat1.topLeftCorner<rows,cols>()+ mat1.topRightCorner<rows,cols>()+ mat1.bottomLeftCorner<rows,cols>()+ mat1.bottomRightCorner<rows,cols>()\endcode+ <td>the \c rows x \c cols sub-matrix \n taken in one of the four corners</td></tr>+ <tr><td>\code+ mat1.topRows(rows)+ mat1.bottomRows(rows)+ mat1.leftCols(cols)+ mat1.rightCols(cols)\endcode+ <td>\code+ mat1.topRows<rows>()+ mat1.bottomRows<rows>()+ mat1.leftCols<cols>()+ mat1.rightCols<cols>()\endcode+ <td>specialized versions of block() \n when the block fit two corners</td></tr>+</table>++++<a href="#" class="top">top</a>\section QuickRef_Misc Miscellaneous operations++\subsection QuickRef_Reverse Reverse+Vectors, rows, and/or columns of a matrix can be reversed (see DenseBase::reverse(), DenseBase::reverseInPlace(), VectorwiseOp::reverse()).+\code+vec.reverse()           mat.colwise().reverse()   mat.rowwise().reverse()+vec.reverseInPlace()+\endcode++\subsection QuickRef_Replicate Replicate+Vectors, matrices, rows, and/or columns can be replicated in any direction (see DenseBase::replicate(), VectorwiseOp::replicate())+\code+vec.replicate(times)                                          vec.replicate<Times>+mat.replicate(vertical_times, horizontal_times)               mat.replicate<VerticalTimes, HorizontalTimes>()+mat.colwise().replicate(vertical_times, horizontal_times)     mat.colwise().replicate<VerticalTimes, HorizontalTimes>()+mat.rowwise().replicate(vertical_times, horizontal_times)     mat.rowwise().replicate<VerticalTimes, HorizontalTimes>()+\endcode+++<a href="#" class="top">top</a>\section QuickRef_DiagTriSymm Diagonal, Triangular, and Self-adjoint matrices+(matrix world \matrixworld)++\subsection QuickRef_Diagonal Diagonal matrices++<table class="example">+<tr><th>Operation</th><th>Code</th></tr>+<tr><td>+view a vector \link MatrixBase::asDiagonal() as a diagonal matrix \endlink \n </td><td>\code+mat1 = vec1.asDiagonal();\endcode+</td></tr>+<tr><td>+Declare a diagonal matrix</td><td>\code+DiagonalMatrix<Scalar,SizeAtCompileTime> diag1(size);+diag1.diagonal() = vector;\endcode+</td></tr>+<tr><td>Access the \link MatrixBase::diagonal() diagonal \endlink and \link MatrixBase::diagonal(Index) super/sub diagonals \endlink of a matrix as a vector (read/write)</td>+ <td>\code+vec1 = mat1.diagonal();        mat1.diagonal() = vec1;      // main diagonal+vec1 = mat1.diagonal(+n);      mat1.diagonal(+n) = vec1;    // n-th super diagonal+vec1 = mat1.diagonal(-n);      mat1.diagonal(-n) = vec1;    // n-th sub diagonal+vec1 = mat1.diagonal<1>();     mat1.diagonal<1>() = vec1;   // first super diagonal+vec1 = mat1.diagonal<-2>();    mat1.diagonal<-2>() = vec1;  // second sub diagonal+\endcode</td>+</tr>++<tr><td>Optimized products and inverse</td>+ <td>\code+mat3  = scalar * diag1 * mat1;+mat3 += scalar * mat1 * vec1.asDiagonal();+mat3 = vec1.asDiagonal().inverse() * mat1+mat3 = mat1 * diag1.inverse()+\endcode</td>+</tr>++</table>++\subsection QuickRef_TriangularView Triangular views++TriangularView gives a view on a triangular part of a dense matrix and allows to perform optimized operations on it. The opposite triangular part is never referenced and can be used to store other information.++\note The .triangularView() template member function requires the \c template keyword if it is used on an+object of a type that depends on a template parameter; see \ref TopicTemplateKeyword for details.++<table class="example">+<tr><th>Operation</th><th>Code</th></tr>+<tr><td>+Reference to a triangular with optional \n+unit or null diagonal (read/write):+</td><td>\code+m.triangularView<Xxx>()+\endcode \n+\c Xxx = ::Upper, ::Lower, ::StrictlyUpper, ::StrictlyLower, ::UnitUpper, ::UnitLower+</td></tr>+<tr><td>+Writing to a specific triangular part:\n (only the referenced triangular part is evaluated)+</td><td>\code+m1.triangularView<Eigen::Lower>() = m2 + m3 \endcode+</td></tr>+<tr><td>+Conversion to a dense matrix setting the opposite triangular part to zero:+</td><td>\code+m2 = m1.triangularView<Eigen::UnitUpper>()\endcode+</td></tr>+<tr><td>+Products:+</td><td>\code+m3 += s1 * m1.adjoint().triangularView<Eigen::UnitUpper>() * m2+m3 -= s1 * m2.conjugate() * m1.adjoint().triangularView<Eigen::Lower>() \endcode+</td></tr>+<tr><td>+Solving linear equations:\n+\f$ M_2 := L_1^{-1} M_2 \f$ \n+\f$ M_3 := {L_1^*}^{-1} M_3 \f$ \n+\f$ M_4 := M_4 U_1^{-1} \f$+</td><td>\n \code+L1.triangularView<Eigen::UnitLower>().solveInPlace(M2)+L1.triangularView<Eigen::Lower>().adjoint().solveInPlace(M3)+U1.triangularView<Eigen::Upper>().solveInPlace<OnTheRight>(M4)\endcode+</td></tr>+</table>++\subsection QuickRef_SelfadjointMatrix Symmetric/selfadjoint views++Just as for triangular matrix, you can reference any triangular part of a square matrix to see it as a selfadjoint+matrix and perform special and optimized operations. Again the opposite triangular part is never referenced and can be+used to store other information.++\note The .selfadjointView() template member function requires the \c template keyword if it is used on an+object of a type that depends on a template parameter; see \ref TopicTemplateKeyword for details.++<table class="example">+<tr><th>Operation</th><th>Code</th></tr>+<tr><td>+Conversion to a dense matrix:+</td><td>\code+m2 = m.selfadjointView<Eigen::Lower>();\endcode+</td></tr>+<tr><td>+Product with another general matrix or vector:+</td><td>\code+m3  = s1 * m1.conjugate().selfadjointView<Eigen::Upper>() * m3;+m3 -= s1 * m3.adjoint() * m1.selfadjointView<Eigen::Lower>();\endcode+</td></tr>+<tr><td>+Rank 1 and rank K update: \n+\f$ upper(M_1) \mathrel{{+}{=}} s_1 M_2 M_2^* \f$ \n+\f$ lower(M_1) \mathbin{{-}{=}} M_2^* M_2 \f$+</td><td>\n \code+M1.selfadjointView<Eigen::Upper>().rankUpdate(M2,s1);+M1.selfadjointView<Eigen::Lower>().rankUpdate(M2.adjoint(),-1); \endcode+</td></tr>+<tr><td>+Rank 2 update: (\f$ M \mathrel{{+}{=}} s u v^* + s v u^* \f$)+</td><td>\code+M.selfadjointView<Eigen::Upper>().rankUpdate(u,v,s);+\endcode+</td></tr>+<tr><td>+Solving linear equations:\n(\f$ M_2 := M_1^{-1} M_2 \f$)+</td><td>\code+// via a standard Cholesky factorization+m2 = m1.selfadjointView<Eigen::Upper>().llt().solve(m2);+// via a Cholesky factorization with pivoting+m2 = m1.selfadjointView<Eigen::Lower>().ldlt().solve(m2);+\endcode+</td></tr>+</table>++*/++/*+<table class="tutorial_code">+<tr><td>+\link MatrixBase::asDiagonal() make a diagonal matrix \endlink \n from a vector </td><td>\code+mat1 = vec1.asDiagonal();\endcode+</td></tr>+<tr><td>+Declare a diagonal matrix</td><td>\code+DiagonalMatrix<Scalar,SizeAtCompileTime> diag1(size);+diag1.diagonal() = vector;\endcode+</td></tr>+<tr><td>Access \link MatrixBase::diagonal() the diagonal and super/sub diagonals of a matrix \endlink as a vector (read/write)</td>+ <td>\code+vec1 = mat1.diagonal();            mat1.diagonal() = vec1;      // main diagonal+vec1 = mat1.diagonal(+n);          mat1.diagonal(+n) = vec1;    // n-th super diagonal+vec1 = mat1.diagonal(-n);          mat1.diagonal(-n) = vec1;    // n-th sub diagonal+vec1 = mat1.diagonal<1>();         mat1.diagonal<1>() = vec1;   // first super diagonal+vec1 = mat1.diagonal<-2>();        mat1.diagonal<-2>() = vec1;  // second sub diagonal+\endcode</td>+</tr>++<tr><td>View on a triangular part of a matrix (read/write)</td>+ <td>\code+mat2 = mat1.triangularView<Xxx>();+// Xxx = Upper, Lower, StrictlyUpper, StrictlyLower, UnitUpper, UnitLower+mat1.triangularView<Upper>() = mat2 + mat3; // only the upper part is evaluated and referenced+\endcode</td></tr>++<tr><td>View a triangular part as a symmetric/self-adjoint matrix (read/write)</td>+ <td>\code+mat2 = mat1.selfadjointView<Xxx>();     // Xxx = Upper or Lower+mat1.selfadjointView<Upper>() = mat2 + mat2.adjoint();  // evaluated and write to the upper triangular part only+\endcode</td></tr>++</table>++Optimized products:+\code+mat3 += scalar * vec1.asDiagonal() * mat1+mat3 += scalar * mat1 * vec1.asDiagonal()+mat3.noalias() += scalar * mat1.triangularView<Xxx>() * mat2+mat3.noalias() += scalar * mat2 * mat1.triangularView<Xxx>()+mat3.noalias() += scalar * mat1.selfadjointView<Upper or Lower>() * mat2+mat3.noalias() += scalar * mat2 * mat1.selfadjointView<Upper or Lower>()+mat1.selfadjointView<Upper or Lower>().rankUpdate(mat2);+mat1.selfadjointView<Upper or Lower>().rankUpdate(mat2.adjoint(), scalar);+\endcode++Inverse products: (all are optimized)+\code+mat3 = vec1.asDiagonal().inverse() * mat1+mat3 = mat1 * diag1.inverse()+mat1.triangularView<Xxx>().solveInPlace(mat2)+mat1.triangularView<Xxx>().solveInPlace<OnTheRight>(mat2)+mat2 = mat1.selfadjointView<Upper or Lower>().llt().solve(mat2)+\endcode++*/+}
+ eigen3/doc/QuickStartGuide.dox view
@@ -0,0 +1,100 @@+namespace Eigen {++/** \page GettingStarted Getting started++\eigenAutoToc++This is a very short guide on how to get started with Eigen. It has a dual purpose. It serves as a minimal introduction to the Eigen library for people who want to start coding as soon as possible. You can also read this page as the first part of the Tutorial, which explains the library in more detail; in this case you will continue with \ref TutorialMatrixClass.++\section GettingStartedInstallation How to "install" Eigen?++In order to use Eigen, you just need to download and extract Eigen's source code (see <a href="http://eigen.tuxfamily.org/index.php?title=Main_Page#Download">the wiki</a> for download instructions). In fact, the header files in the \c Eigen subdirectory are the only files required to compile programs using Eigen. The header files are the same for all platforms. It is not necessary to use CMake or install anything.+++\section GettingStartedFirstProgram A simple first program++Here is a rather simple program to get you started.++\include QuickStart_example.cpp++We will explain the program after telling you how to compile it.+++\section GettingStartedCompiling Compiling and running your first program++There is no library to link to. The only thing that you need to keep in mind when compiling the above program is that the compiler must be able to find the Eigen header files. The directory in which you placed Eigen's source code must be in the include path. With GCC you use the -I option to achieve this, so you can compile the program with a command like this:++\code g++ -I /path/to/eigen/ my_program.cpp -o my_program \endcode++On Linux or Mac OS X, another option is to symlink or copy the Eigen folder into /usr/local/include/. This way, you can compile the program with:++\code g++ my_program.cpp -o my_program \endcode++When you run the program, it produces the following output:++\include QuickStart_example.out+++\section GettingStartedExplanation Explanation of the first program++The Eigen header files define many types, but for simple applications it may be enough to use only the \c MatrixXd type. This represents a matrix of arbitrary size (hence the \c X in \c MatrixXd), in which every entry is a \c double (hence the \c d in \c MatrixXd). See the \ref QuickRef_Types "quick reference guide" for an overview of the different types you can use to represent a matrix.++The \c Eigen/Dense header file defines all member functions for the MatrixXd type and related types (see also the \ref QuickRef_Headers "table of header files"). All classes and functions defined in this header file (and other Eigen header files) are in the \c Eigen namespace. ++The first line of the \c main function declares a variable of type \c MatrixXd and specifies that it is a matrix with 2 rows and 2 columns (the entries are not initialized). The statement <tt>m(0,0) = 3</tt> sets the entry in the top-left corner to 3. You need to use round parentheses to refer to entries in the matrix. As usual in computer science, the index of the first index is 0, as opposed to the convention in mathematics that the first index is 1.++The following three statements sets the other three entries. The final line outputs the matrix \c m to the standard output stream.+++\section GettingStartedExample2 Example 2: Matrices and vectors++Here is another example, which combines matrices with vectors. Concentrate on the left-hand program for now; we will talk about the right-hand program later.++<table class="manual">+<tr><th>Size set at run time:</th><th>Size set at compile time:</th></tr>+<tr><td>+\include QuickStart_example2_dynamic.cpp+</td>+<td>+\include QuickStart_example2_fixed.cpp+</td></tr></table>++The output is as follows:++\include QuickStart_example2_dynamic.out+++\section GettingStartedExplanation2 Explanation of the second example++The second example starts by declaring a 3-by-3 matrix \c m which is initialized using the \link DenseBase::Random(Index,Index) Random() \endlink method with random values between -1 and 1. The next line applies a linear mapping such that the values are between 10 and 110. The function call \link DenseBase::Constant(Index,Index,const Scalar&) MatrixXd::Constant\endlink(3,3,1.2) returns a 3-by-3 matrix expression having all coefficients equal to 1.2. The rest is standard arithmetics.++The next line of the \c main function introduces a new type: \c VectorXd. This represents a (column) vector of arbitrary size. Here, the vector \c v is created to contain \c 3 coefficients which are left unitialized. The one but last line uses the so-called comma-initializer, explained in \ref TutorialAdvancedInitialization, to set all coefficients of the vector \c v to be as follows:++\f[+v =+\begin{bmatrix}+  1 \\+  2 \\+  3+\end{bmatrix}.+\f]++The final line of the program multiplies the matrix \c m with the vector \c v and outputs the result.++Now look back at the second example program. We presented two versions of it. In the version in the left column, the matrix is of type \c MatrixXd which represents matrices of arbitrary size. The version in the right column is similar, except that the matrix is of type \c Matrix3d, which represents matrices of a fixed size (here 3-by-3). Because the type already encodes the size of the matrix, it is not necessary to specify the size in the constructor; compare <tt>MatrixXd m(3,3)</tt> with <tt>Matrix3d m</tt>. Similarly, we have \c VectorXd on the left (arbitrary size) versus \c Vector3d on the right (fixed size). Note that here the coefficients of vector \c v are directly set in the constructor, though the same syntax of the left example could be used too.++The use of fixed-size matrices and vectors has two advantages. The compiler emits better (faster) code because it knows the size of the matrices and vectors. Specifying the size in the type also allows for more rigorous checking at compile-time. For instance, the compiler will complain if you try to multiply a \c Matrix4d (a 4-by-4 matrix) with a \c Vector3d (a vector of size 3). However, the use of many types increases compilation time and the size of the executable. The size of the matrix may also not be known at compile-time. A rule of thumb is to use fixed-size matrices for size 4-by-4 and smaller.+++\section GettingStartedConclusion Where to go from here?++It's worth taking the time to read the  \ref TutorialMatrixClass "long tutorial".++However if you think you don't need it, you can directly use the classes documentation and our \ref QuickRefPage.++\li \b Next: \ref TutorialMatrixClass++*/++}+
+ eigen3/doc/SparseLinearSystems.dox view
@@ -0,0 +1,229 @@+namespace Eigen {+/** \eigenManualPage TopicSparseSystems Solving Sparse Linear Systems+In Eigen, there are several methods available to solve linear systems when the coefficient matrix is sparse. Because of the special representation of this class of matrices, special care should be taken in order to get a good performance. See \ref TutorialSparse for a detailed introduction about sparse matrices in Eigen. This page lists the sparse solvers available in Eigen. The main steps that are common to all these linear solvers are introduced as well. Depending on the properties of the matrix, the desired accuracy, the end-user is able to tune those steps in order to improve the performance of its code. Note that it is not required to know deeply what's hiding behind these steps: the last section presents a benchmark routine that can be easily used to get an insight on the performance of all the available solvers. ++\eigenAutoToc++\section TutorialSparseSolverList List of sparse solvers++%Eigen currently provides a wide set of built-in solvers, as well as wrappers to external solver libraries.+They are summarized in the following tables:++\subsection TutorialSparseSolverList_Direct Built-in direct solvers++<table class="manual">+<tr><th>Class</th><th>Solver kind</th><th>Matrix kind</th><th>Features related to performance</th>+    <th>License</th><th class="width20em"><p>Notes</p></th></tr>++<tr><td>SimplicialLLT \n <tt>\#include<Eigen/\link SparseCholesky_Module SparseCholesky\endlink></tt></td><td>Direct LLt factorization</td><td>SPD</td><td>Fill-in reducing</td>+    <td>LGPL</td>+    <td>SimplicialLDLT is often preferable</td></tr>++<tr><td>SimplicialLDLT \n <tt>\#include<Eigen/\link SparseCholesky_Module SparseCholesky\endlink></tt></td><td>Direct LDLt factorization</td><td>SPD</td><td>Fill-in reducing</td>+    <td>LGPL</td>+    <td>Recommended for very sparse and not too large problems (e.g., 2D Poisson eq.)</td></tr>++<tr><td>SparseLU \n <tt>\#include<Eigen/\link SparseLU_Module SparseLU\endlink></tt></td> <td>LU factorization </td>+    <td>Square </td><td>Fill-in reducing, Leverage fast dense algebra</td>+    <td>MPL2</td>+    <td>optimized for small and large problems with irregular patterns </td></tr>++<tr><td>SparseQR \n <tt>\#include<Eigen/\link SparseQR_Module SparseQR\endlink></tt></td> <td> QR factorization</td>+    <td>Any, rectangular</td><td> Fill-in reducing</td>+    <td>MPL2</td>+    <td>recommended for least-square problems, has a basic rank-revealing feature</td></tr>+ </table>++\subsection TutorialSparseSolverList_Iterative Built-in iterative solvers++<table class="manual">+<tr><th>Class</th><th>Solver kind</th><th>Matrix kind</th><th>Supported preconditioners, [default]</th>+    <th>License</th><th class="width20em"><p>Notes</p></th></tr>++<tr><td>ConjugateGradient \n <tt>\#include<Eigen/\link IterativeLinearSolvers_Module IterativeLinearSolvers\endlink></tt></td> <td>Classic iterative CG</td><td>SPD</td>+    <td>IdentityPreconditioner, [DiagonalPreconditioner], IncompleteCholesky</td>+    <td>MPL2</td>+    <td>Recommended for large symmetric problems (e.g., 3D Poisson eq.)</td></tr>++<tr><td>LeastSquaresConjugateGradient \n <tt>\#include<Eigen/\link IterativeLinearSolvers_Module IterativeLinearSolvers\endlink></tt></td><td>CG for rectangular least-square problem</td><td>Rectangular</td>+    <td>IdentityPreconditioner, [LeastSquareDiagonalPreconditioner]</td>+    <td>MPL2</td>+    <td>Solve for min |A'Ax-b|^2 without forming A'A</td></tr>++<tr><td>BiCGSTAB \n <tt>\#include<Eigen/\link IterativeLinearSolvers_Module IterativeLinearSolvers\endlink></tt></td><td>Iterative stabilized bi-conjugate gradient</td><td>Square</td>+    <td>IdentityPreconditioner, [DiagonalPreconditioner], IncompleteLUT</td>+    <td>MPL2</td>+    <td>To speedup the convergence, try it with the \ref IncompleteLUT preconditioner.</td></tr>+</table>++\subsection TutorialSparseSolverList_Wrapper Wrappers to external solvers++<table class="manual">+<tr><th>Class</th><th>Module</th><th>Solver kind</th><th>Matrix kind</th><th>Features related to performance</th>+    <th>Dependencies,License</th><th class="width20em"><p>Notes</p></th></tr>+<tr><td>PastixLLT \n PastixLDLT \n PastixLU</td><td>\link PaStiXSupport_Module PaStiXSupport \endlink</td><td>Direct LLt, LDLt, LU factorizations</td><td>SPD \n SPD \n Square</td><td>Fill-in reducing, Leverage fast dense algebra, Multithreading</td>+    <td>Requires the <a href="http://pastix.gforge.inria.fr">PaStiX</a> package, \b CeCILL-C </td>+    <td>optimized for tough problems and symmetric patterns</td></tr>+<tr><td>CholmodSupernodalLLT</td><td>\link CholmodSupport_Module CholmodSupport \endlink</td><td>Direct LLt factorization</td><td>SPD</td><td>Fill-in reducing, Leverage fast dense algebra</td>+    <td>Requires the <a href="http://www.suitesparse.com">SuiteSparse</a> package, \b GPL </td>+    <td></td></tr>+<tr><td>UmfPackLU</td><td>\link UmfPackSupport_Module UmfPackSupport \endlink</td><td>Direct LU factorization</td><td>Square</td><td>Fill-in reducing, Leverage fast dense algebra</td>+    <td>Requires the <a href="http://www.suitesparse.com">SuiteSparse</a> package, \b GPL </td>+    <td></td></tr>+<tr><td>SuperLU</td><td>\link SuperLUSupport_Module SuperLUSupport \endlink</td><td>Direct LU factorization</td><td>Square</td><td>Fill-in reducing, Leverage fast dense algebra</td>+    <td>Requires the <a href="http://crd-legacy.lbl.gov/~xiaoye/SuperLU/">SuperLU</a> library, (BSD-like)</td>+    <td></td></tr>+<tr><td>SPQR</td><td>\link SPQRSupport_Module SPQRSupport \endlink  </td> <td> QR factorization </td> +    <td> Any, rectangular</td><td>fill-in reducing, multithreaded, fast dense algebra</td>+    <td> requires the <a href="http://www.suitesparse.com">SuiteSparse</a> package, \b GPL </td><td>recommended for linear least-squares problems, has a rank-revealing feature</tr>+<tr><td>PardisoLLT \n PardisoLDLT \n PardisoLU</td><td>\link PardisoSupport_Module PardisoSupport \endlink</td><td>Direct LLt, LDLt, LU factorizations</td><td>SPD \n SPD \n Square</td><td>Fill-in reducing, Leverage fast dense algebra, Multithreading</td>+    <td>Requires the <a href="http://eigen.tuxfamily.org/Counter/redirect_to_mkl.php">Intel MKL</a> package, \b Proprietary </td>+    <td>optimized for tough problems patterns, see also \link TopicUsingIntelMKL using MKL with Eigen \endlink</td></tr>+</table>++Here \c SPD means symmetric positive definite.++\section TutorialSparseSolverConcept Sparse solver concept++All these solvers follow the same general concept.+Here is a typical and general example:+\code+#include <Eigen/RequiredModuleName>+// ...+SparseMatrix<double> A;+// fill A+VectorXd b, x;+// fill b+// solve Ax = b+SolverClassName<SparseMatrix<double> > solver;+solver.compute(A);+if(solver.info()!=Success) {+  // decomposition failed+  return;+}+x = solver.solve(b);+if(solver.info()!=Success) {+  // solving failed+  return;+}+// solve for another right hand side:+x1 = solver.solve(b1);+\endcode++For \c SPD solvers, a second optional template argument allows to specify which triangular part have to be used, e.g.:++\code+#include <Eigen/IterativeLinearSolvers>++ConjugateGradient<SparseMatrix<double>, Eigen::Upper> solver;+x = solver.compute(A).solve(b);+\endcode+In the above example, only the upper triangular part of the input matrix A is considered for solving. The opposite triangle might either be empty or contain arbitrary values.++In the case where multiple problems with the same sparsity pattern have to be solved, then the "compute" step can be decomposed as follow:+\code+SolverClassName<SparseMatrix<double> > solver;+solver.analyzePattern(A);   // for this step the numerical values of A are not used+solver.factorize(A);+x1 = solver.solve(b1);+x2 = solver.solve(b2);+...+A = ...;                    // modify the values of the nonzeros of A, the nonzeros pattern must stay unchanged+solver.factorize(A);+x1 = solver.solve(b1);+x2 = solver.solve(b2);+...+\endcode+The compute() method is equivalent to calling both analyzePattern() and factorize().++Each solver provides some specific features, such as determinant, access to the factors, controls of the iterations, and so on.+More details are available in the documentations of the respective classes.++Finally, most of the iterative solvers, can also be used in a \b matrix-free context, see the following \link MatrixfreeSolverExample example \endlink.++\section TheSparseCompute The Compute Step+In the compute() function, the matrix is generally factorized: LLT for self-adjoint matrices, LDLT for general hermitian matrices, LU for non hermitian matrices and QR for rectangular matrices. These are the results of using direct solvers. For this class of solvers precisely, the compute step is further subdivided into analyzePattern() and factorize(). ++The goal of analyzePattern() is to reorder the nonzero elements of the matrix, such that the factorization step creates less fill-in. This step exploits only the structure of the matrix. Hence, the results of this step can be used for other linear systems where the matrix has the same structure. Note however that sometimes, some external solvers (like SuperLU) require that the values of the matrix are set in this step, for instance to equilibrate the rows and columns of the matrix. In this situation, the results of this step should not be used with other matrices.++Eigen provides a limited set of methods to reorder the matrix in this step, either built-in (COLAMD, AMD) or external (METIS). These methods are set in template parameter list of the solver :+\code+DirectSolverClassName<SparseMatrix<double>, OrderingMethod<IndexType> > solver;+\endcode ++See the \link OrderingMethods_Module OrderingMethods module \endlink for the list of available methods and the associated options. ++In factorize(), the factors of the coefficient matrix are computed. This step should be called each time the values of the matrix change. However, the structural pattern of the matrix should not change between multiple calls. ++For iterative solvers, the compute step is used to eventually setup a preconditioner. For instance, with the ILUT preconditioner, the incomplete factors L and U are computed in this step. Remember that, basically, the goal of the preconditioner is to speedup the convergence of an iterative method by solving a modified linear system where the coefficient matrix has more clustered eigenvalues. For real problems, an iterative solver should always be used with a preconditioner. In Eigen, a preconditioner is  selected by simply adding it as a template parameter to the iterative solver object. +\code+IterativeSolverClassName<SparseMatrix<double>, PreconditionerName<SparseMatrix<double> > solver; +\endcode+The member function preconditioner() returns a read-write reference to the preconditioner + to directly interact with it. See the \link IterativeLinearSolvers_Module Iterative solvers module \endlink and the documentation of each class for the list of available methods.++\section TheSparseSolve The Solve step+The solve() function computes the solution of the linear systems with one or many right hand sides.+\code+X = solver.solve(B);+\endcode +Here, B  can be a vector or a matrix where the columns form the different right hand sides. The solve() function can be called several times as well, for instance when all the right hand sides are not available at once. +\code+x1 = solver.solve(b1);+// Get the second right hand side b2+x2 = solver.solve(b2); +//  ...+\endcode+For direct methods, the solution are computed at the machine precision. Sometimes, the solution need not be too accurate. In this case, the iterative methods are more suitable and the desired accuracy can be set before the solve step using \b setTolerance(). For all the available functions, please, refer to the documentation of the \link IterativeLinearSolvers_Module Iterative solvers module \endlink. ++\section BenchmarkRoutine+Most of the time, all you need is to know how much time it will take to solve your system, and hopefully, what is the most suitable solver. In Eigen, we provide a benchmark routine that can be used for this purpose. It is very easy to use. In the build directory, navigate to bench/spbench and compile the routine by typing \b make \e spbenchsolver. Run it with --help option to get the list of all available options. Basically, the matrices to test should be in <a href="http://math.nist.gov/MatrixMarket/formats.html">MatrixMarket Coordinate format</a>, and the routine returns the statistics from all available solvers in Eigen.++To export your matrices and right-hand-side vectors in the matrix-market format, you can the the unsupported SparseExtra module:+\code+#include <unsupported/Eigen/SparseExtra>+...+Eigen::saveMarket(A, "filename.mtx");+Eigen::saveMarket(A, "filename_SPD.mtx", Eigen::Symmetric); // if A is symmetric-positive-definite+Eigen::saveMarketVector(B, "filename_b.mtx");+\endcode++The following table gives an example of XML statistics from several Eigen built-in and external solvers. +<TABLE border="1">+ <TR><TH>Matrix <TH> N <TH> NNZ <TH>  <TH > UMFPACK <TH > SUPERLU <TH > PASTIX LU <TH >BiCGSTAB <TH > BiCGSTAB+ILUT <TH >GMRES+ILUT<TH > LDLT <TH> CHOLMOD LDLT <TH > PASTIX LDLT <TH > LLT <TH > CHOLMOD SP LLT <TH > CHOLMOD LLT <TH > PASTIX LLT <TH> CG</TR>+<TR><TH rowspan="4">vector_graphics <TD rowspan="4"> 12855 <TD rowspan="4"> 72069 <TH>Compute Time <TD>0.0254549<TD>0.0215677<TD>0.0701827<TD>0.000153388<TD>0.0140107<TD>0.0153709<TD>0.0101601<TD style="background-color:red">0.00930502<TD>0.0649689+<TR><TH>Solve Time <TD>0.00337835<TD>0.000951826<TD>0.00484373<TD>0.0374886<TD>0.0046445<TD>0.00847754<TD>0.000541813<TD style="background-color:red">0.000293696<TD>0.00485376+<TR><TH>Total Time <TD>0.0288333<TD>0.0225195<TD>0.0750265<TD>0.037642<TD>0.0186552<TD>0.0238484<TD>0.0107019<TD style="background-color:red">0.00959871<TD>0.0698227+<TR><TH>Error(Iter) <TD> 1.299e-16 <TD> 2.04207e-16 <TD> 4.83393e-15 <TD> 3.94856e-11 (80)  <TD> 1.03861e-12 (3)  <TD> 5.81088e-14 (6)  <TD> 1.97578e-16 <TD> 1.83927e-16 <TD> 4.24115e-15+<TR><TH rowspan="4">poisson_SPD <TD rowspan="4"> 19788 <TD rowspan="4"> 308232 <TH>Compute Time <TD>0.425026<TD>1.82378<TD>0.617367<TD>0.000478921<TD>1.34001<TD>1.33471<TD>0.796419<TD>0.857573<TD>0.473007<TD>0.814826<TD style="background-color:red">0.184719<TD>0.861555<TD>0.470559<TD>0.000458188+<TR><TH>Solve Time <TD>0.0280053<TD>0.0194402<TD>0.0268747<TD>0.249437<TD>0.0548444<TD>0.0926991<TD>0.00850204<TD>0.0053171<TD>0.0258932<TD>0.00874603<TD style="background-color:red">0.00578155<TD>0.00530361<TD>0.0248942<TD>0.239093+<TR><TH>Total Time <TD>0.453031<TD>1.84322<TD>0.644241<TD>0.249916<TD>1.39486<TD>1.42741<TD>0.804921<TD>0.862891<TD>0.4989<TD>0.823572<TD style="background-color:red">0.190501<TD>0.866859<TD>0.495453<TD>0.239551+<TR><TH>Error(Iter) <TD> 4.67146e-16 <TD> 1.068e-15 <TD> 1.3397e-15 <TD> 6.29233e-11 (201)  <TD> 3.68527e-11 (6)  <TD> 3.3168e-15 (16)  <TD> 1.86376e-15 <TD> 1.31518e-16 <TD> 1.42593e-15 <TD> 3.45361e-15 <TD> 3.14575e-16 <TD> 2.21723e-15 <TD> 7.21058e-16 <TD> 9.06435e-12 (261) +<TR><TH rowspan="4">sherman2 <TD rowspan="4"> 1080 <TD rowspan="4"> 23094 <TH>Compute Time <TD style="background-color:red">0.00631754<TD>0.015052<TD>0.0247514 <TD> -<TD>0.0214425<TD>0.0217988+<TR><TH>Solve Time <TD style="background-color:red">0.000478424<TD>0.000337998<TD>0.0010291 <TD> -<TD>0.00243152<TD>0.00246152+<TR><TH>Total Time <TD style="background-color:red">0.00679597<TD>0.01539<TD>0.0257805 <TD> -<TD>0.023874<TD>0.0242603+<TR><TH>Error(Iter) <TD> 1.83099e-15 <TD> 8.19351e-15 <TD> 2.625e-14 <TD> 1.3678e+69 (1080)  <TD> 4.1911e-12 (7)  <TD> 5.0299e-13 (12) +<TR><TH rowspan="4">bcsstk01_SPD <TD rowspan="4"> 48 <TD rowspan="4"> 400 <TH>Compute Time <TD>0.000169079<TD>0.00010789<TD>0.000572538<TD>1.425e-06<TD>9.1612e-05<TD>8.3985e-05<TD style="background-color:red">5.6489e-05<TD>7.0913e-05<TD>0.000468251<TD>5.7389e-05<TD>8.0212e-05<TD>5.8394e-05<TD>0.000463017<TD>1.333e-06+<TR><TH>Solve Time <TD>1.2288e-05<TD>1.1124e-05<TD>0.000286387<TD>8.5896e-05<TD>1.6381e-05<TD>1.6984e-05<TD style="background-color:red">3.095e-06<TD>4.115e-06<TD>0.000325438<TD>3.504e-06<TD>7.369e-06<TD>3.454e-06<TD>0.000294095<TD>6.0516e-05+<TR><TH>Total Time <TD>0.000181367<TD>0.000119014<TD>0.000858925<TD>8.7321e-05<TD>0.000107993<TD>0.000100969<TD style="background-color:red">5.9584e-05<TD>7.5028e-05<TD>0.000793689<TD>6.0893e-05<TD>8.7581e-05<TD>6.1848e-05<TD>0.000757112<TD>6.1849e-05+<TR><TH>Error(Iter) <TD> 1.03474e-16 <TD> 2.23046e-16 <TD> 2.01273e-16 <TD> 4.87455e-07 (48)  <TD> 1.03553e-16 (2)  <TD> 3.55965e-16 (2)  <TD> 2.48189e-16 <TD> 1.88808e-16 <TD> 1.97976e-16 <TD> 2.37248e-16 <TD> 1.82701e-16 <TD> 2.71474e-16 <TD> 2.11322e-16 <TD> 3.547e-09 (48) +<TR><TH rowspan="4">sherman1 <TD rowspan="4"> 1000 <TD rowspan="4"> 3750 <TH>Compute Time <TD>0.00228805<TD>0.00209231<TD>0.00528268<TD>9.846e-06<TD>0.00163522<TD>0.00162155<TD>0.000789259<TD style="background-color:red">0.000804495<TD>0.00438269+<TR><TH>Solve Time <TD>0.000213788<TD>9.7983e-05<TD>0.000938831<TD>0.00629835<TD>0.000361764<TD>0.00078794<TD>4.3989e-05<TD style="background-color:red">2.5331e-05<TD>0.000917166+<TR><TH>Total Time <TD>0.00250184<TD>0.00219029<TD>0.00622151<TD>0.0063082<TD>0.00199698<TD>0.00240949<TD>0.000833248<TD style="background-color:red">0.000829826<TD>0.00529986+<TR><TH>Error(Iter) <TD> 1.16839e-16 <TD> 2.25968e-16 <TD> 2.59116e-16 <TD> 3.76779e-11 (248)  <TD> 4.13343e-11 (4)  <TD> 2.22347e-14 (10)  <TD> 2.05861e-16 <TD> 1.83555e-16 <TD> 1.02917e-15+<TR><TH rowspan="4">young1c <TD rowspan="4"> 841 <TD rowspan="4"> 4089 <TH>Compute Time <TD>0.00235843<TD style="background-color:red">0.00217228<TD>0.00568075<TD>1.2735e-05<TD>0.00264866<TD>0.00258236+<TR><TH>Solve Time <TD>0.000329599<TD style="background-color:red">0.000168634<TD>0.00080118<TD>0.0534738<TD>0.00187193<TD>0.00450211+<TR><TH>Total Time <TD>0.00268803<TD style="background-color:red">0.00234091<TD>0.00648193<TD>0.0534865<TD>0.00452059<TD>0.00708447+<TR><TH>Error(Iter) <TD> 1.27029e-16 <TD> 2.81321e-16 <TD> 5.0492e-15 <TD> 8.0507e-11 (706)  <TD> 3.00447e-12 (8)  <TD> 1.46532e-12 (16) +<TR><TH rowspan="4">mhd1280b <TD rowspan="4"> 1280 <TD rowspan="4"> 22778 <TH>Compute Time <TD>0.00234898<TD>0.00207079<TD>0.00570918<TD>2.5976e-05<TD>0.00302563<TD>0.00298036<TD>0.00144525<TD style="background-color:red">0.000919922<TD>0.00426444+<TR><TH>Solve Time <TD>0.00103392<TD>0.000211911<TD>0.00105<TD>0.0110432<TD>0.000628287<TD>0.00392089<TD>0.000138303<TD style="background-color:red">6.2446e-05<TD>0.00097564+<TR><TH>Total Time <TD>0.0033829<TD>0.0022827<TD>0.00675918<TD>0.0110692<TD>0.00365392<TD>0.00690124<TD>0.00158355<TD style="background-color:red">0.000982368<TD>0.00524008+<TR><TH>Error(Iter) <TD> 1.32953e-16 <TD> 3.08646e-16 <TD> 6.734e-16 <TD> 8.83132e-11 (40)  <TD> 1.51153e-16 (1)  <TD> 6.08556e-16 (8)  <TD> 1.89264e-16 <TD> 1.97477e-16 <TD> 6.68126e-09+<TR><TH rowspan="4">crashbasis <TD rowspan="4"> 160000 <TD rowspan="4"> 1750416 <TH>Compute Time <TD>3.2019<TD>5.7892<TD>15.7573<TD style="background-color:red">0.00383515<TD>3.1006<TD>3.09921+<TR><TH>Solve Time <TD>0.261915<TD>0.106225<TD>0.402141<TD style="background-color:red">1.49089<TD>0.24888<TD>0.443673+<TR><TH>Total Time <TD>3.46381<TD>5.89542<TD>16.1594<TD style="background-color:red">1.49473<TD>3.34948<TD>3.54288+<TR><TH>Error(Iter) <TD> 1.76348e-16 <TD> 4.58395e-16 <TD> 1.67982e-14 <TD> 8.64144e-11 (61)  <TD> 8.5996e-12 (2)  <TD> 6.04042e-14 (5) ++</TABLE>+*/+}
+ eigen3/doc/SparseQuickReference.dox view
@@ -0,0 +1,272 @@+namespace Eigen {+/** \eigenManualPage SparseQuickRefPage Quick reference guide for sparse matrices+\eigenAutoToc++<hr>++In this page, we give a quick summary of the main operations available for sparse matrices in the class SparseMatrix. First, it is recommended to read  the introductory tutorial at \ref TutorialSparse. The important point to have in mind when working on sparse matrices is how they are stored : +i.e either row major or column major. The default is column major. Most arithmetic operations on sparse matrices will assert that they have the same storage order. ++\section SparseMatrixInit Sparse Matrix Initialization+<table class="manual">+<tr><th> Category </th> <th> Operations</th> <th>Notes</th></tr>+<tr><td>Constructor</td>+<td>+\code+  SparseMatrix<double> sm1(1000,1000); +  SparseMatrix<std::complex<double>,RowMajor> sm2;+\endcode+</td> <td> Default is ColMajor</td> </tr>+<tr class="alt">+<td> Resize/Reserve</td>+<td> + \code+    sm1.resize(m,n);      // Change sm1 to a m x n matrix.+    sm1.reserve(nnz);     // Allocate room for nnz nonzeros elements.   +  \endcode +</td>+<td> Note that when calling reserve(), it is not required that nnz is the exact number of nonzero elements in the final matrix. However, an exact estimation will avoid multiple reallocations during the insertion phase. </td>+</tr>+<tr> +<td> Assignment </td>+<td> +\code +  SparseMatrix<double,Colmajor> sm1;+ // Initialize sm2 with sm1.+  SparseMatrix<double,Rowmajor> sm2(sm1), sm3;        +  // Assignment and evaluations modify the storage order.+  sm3 = sm1; + \endcode+</td>+<td> The copy constructor can be used to convert from a storage order to another</td>+</tr>+<tr class="alt">+<td> Element-wise Insertion</td>+<td>+\code +// Insert a new element; + sm1.insert(i, j) = v_ij;  ++// Update the value v_ij+ sm1.coeffRef(i,j) = v_ij;+ sm1.coeffRef(i,j) += v_ij;+ sm1.coeffRef(i,j) -= v_ij;+\endcode+</td>+<td> insert() assumes that the element does not already exist; otherwise, use coeffRef()</td>+</tr>+<tr> +<td> Batch insertion</td>+<td>+\code+  std::vector< Eigen::Triplet<double> > tripletList;+  tripletList.reserve(estimation_of_entries);+  // -- Fill tripletList with nonzero elements...+  sm1.setFromTriplets(TripletList.begin(), TripletList.end());+\endcode+</td>+<td>A complete example is available at \link TutorialSparseFilling Triplet Insertion \endlink.</td>+</tr>+<tr class="alt"> +<td> Constant or Random Insertion</td>+<td>+\code+sm1.setZero();+\endcode+</td>+<td>Remove all non-zero coefficients</td>+</tr>+</table>+++\section SparseBasicInfos Matrix properties+Beyond the basic functions rows() and cols(), there are some useful functions that are available to easily get some informations from the matrix. +<table class="manual">+<tr>+  <td> \code+  sm1.rows();         // Number of rows+  sm1.cols();         // Number of columns +  sm1.nonZeros();     // Number of non zero values   +  sm1.outerSize();    // Number of columns (resp. rows) for a column major (resp. row major )+  sm1.innerSize();    // Number of rows (resp. columns) for a row major (resp. column major)+  sm1.norm();         // Euclidian norm of the matrix+  sm1.squaredNorm();  // Squared norm of the matrix+  sm1.blueNorm();+  sm1.isVector();     // Check if sm1 is a sparse vector or a sparse matrix+  sm1.isCompressed(); // Check if sm1 is in compressed form+  ...+  \endcode </td>+</tr>+</table>++\section SparseBasicOps Arithmetic operations+It is easy to perform arithmetic operations on sparse matrices provided that the dimensions are adequate and that the matrices have the same storage order. Note that the evaluation can always be done in a matrix with a different storage order. In the following, \b sm denotes a sparse matrix, \b dm a dense matrix and \b dv a dense vector.+<table class="manual">+<tr><th> Operations </th> <th> Code </th> <th> Notes </th></tr>++<tr>+  <td> add subtract </td> +  <td> \code+  sm3 = sm1 + sm2; +  sm3 = sm1 - sm2;+  sm2 += sm1; +  sm2 -= sm1; \endcode+  </td>+  <td> +  sm1 and sm2 should have the same storage order+  </td> +</tr>++<tr class="alt"><td>+  scalar product</td><td>\code+  sm3 = sm1 * s1;   sm3 *= s1; +  sm3 = s1 * sm1 + s2 * sm2; sm3 /= s1;\endcode+  </td>+  <td>+    Many combinations are possible if the dimensions and the storage order agree.+</tr>++<tr>+  <td> %Sparse %Product </td>+  <td> \code+  sm3 = sm1 * sm2;+  dm2 = sm1 * dm1;+  dv2 = sm1 * dv1;+  \endcode </td>+  <td>+  </td>+</tr> ++<tr class='alt'>+  <td> transposition, adjoint</td>+  <td> \code+  sm2 = sm1.transpose();+  sm2 = sm1.adjoint();+  \endcode </td>+  <td>+  Note that the transposition change the storage order. There is no support for transposeInPlace().+  </td>+</tr> +<tr>+<td> Permutation </td>+<td> +\code +perm.indices();      // Reference to the vector of indices+sm1.twistedBy(perm); // Permute rows and columns+sm2 = sm1 * perm;    // Permute the columns+sm2 = perm * sm1;    // Permute the columns+\endcode +</td>+<td> ++</td>+</tr>+<tr>+  <td>+  Component-wise ops+  </td>+  <td>\code +  sm1.cwiseProduct(sm2);+  sm1.cwiseQuotient(sm2);+  sm1.cwiseMin(sm2);+  sm1.cwiseMax(sm2);+  sm1.cwiseAbs();+  sm1.cwiseSqrt();+  \endcode</td>+  <td>+  sm1 and sm2 should have the same storage order+  </td>+</tr>+</table>++\section sparseotherops Other supported operations+<table class="manual">+<tr><th style="min-width:initial"> Code </th> <th> Notes</th> </tr>+<tr><td colspan="2">Sub-matrices</td></tr>+<tr>+<td> +\code +  sm1.block(startRow, startCol, rows, cols); +  sm1.block(startRow, startCol); +  sm1.topLeftCorner(rows, cols); +  sm1.topRightCorner(rows, cols);+  sm1.bottomLeftCorner( rows, cols);+  sm1.bottomRightCorner( rows, cols);+  \endcode+</td><td>+Contrary to dense matrices, here <strong>all these methods are read-only</strong>.\n+See \ref TutorialSparse_SubMatrices and below for read-write sub-matrices.+</td>+</tr>+<tr class="alt"><td colspan="2"> Range </td></tr>+<tr class="alt">+<td> +\code +  sm1.innerVector(outer);           // RW+  sm1.innerVectors(start, size);    // RW+  sm1.leftCols(size);               // RW+  sm2.rightCols(size);              // RO because sm2 is row-major+  sm1.middleRows(start, numRows);   // RO because sm1 is column-major+  sm1.middleCols(start, numCols);   // RW+  sm1.col(j);                       // RW+\endcode+</td>+<td>+A inner vector is either a row (for row-major) or a column (for column-major).\n+As stated earlier, for a read-write sub-matrix (RW), the evaluation can be done in a matrix with different storage order.+</td>+</tr>+<tr><td colspan="2"> Triangular and selfadjoint views</td></tr>+<tr>+<td> +\code+  sm2 = sm1.triangularview<Lower>();+  sm2 = sm1.selfadjointview<Lower>();+\endcode+</td>+<td> Several combination between triangular views and blocks views are possible+\code +  \endcode </td>+</tr>+<tr class="alt"><td colspan="2">Triangular solve </td></tr>+<tr class="alt">+<td> +\code + dv2 = sm1.triangularView<Upper>().solve(dv1);+ dv2 = sm1.topLeftCorner(size, size)+          .triangularView<Lower>().solve(dv1);+\endcode +</td>+<td> For general sparse solve, Use any suitable module described at \ref TopicSparseSystems </td>+</tr>+<tr><td colspan="2"> Low-level API</td></tr>+<tr>+<td>+\code+sm1.valuePtr();      // Pointer to the values+sm1.innerIndextr();  // Pointer to the indices.+sm1.outerIndexPtr(); // Pointer to the beginning of each inner vector+\endcode+</td>+<td>+If the matrix is not in compressed form, makeCompressed() should be called before.\n+Note that these functions are mostly provided for interoperability purposes with external libraries.\n+A better access to the values of the matrix is done by using the InnerIterator class as described in \link TutorialSparse the Tutorial Sparse \endlink section</td>+</tr>+<tr class="alt"><td colspan="2">Mapping external buffers</td></tr>+<tr class="alt">+<td>+\code+int outerIndexPtr[cols+1];+int innerIndices[nnz];+double values[nnz];+Map<SparseMatrix<double> > sm1(rows,cols,nnz,outerIndexPtr, // read-write+                               innerIndices,values);+Map<const SparseMatrix<double> > sm2(...);                  // read-only+\endcode+</td>+<td>As for dense matrices, class Map<SparseMatrixType> can be used to see external buffers as an %Eigen's SparseMatrix object. </td>+</tr>+</table>+*/+}
+ eigen3/doc/StlContainers.dox view
@@ -0,0 +1,62 @@+namespace Eigen {++/** \eigenManualPage TopicStlContainers Using STL Containers with Eigen++\eigenAutoToc++\section StlContainers_summary Executive summary++Using STL containers on \ref TopicFixedSizeVectorizable "fixed-size vectorizable Eigen types", or classes having members of such types, requires taking the following two steps:++\li A 16-byte-aligned allocator must be used. Eigen does provide one ready for use: aligned_allocator.+\li If you want to use the std::vector container, you need to \#include <Eigen/StdVector>.++These issues arise only with \ref TopicFixedSizeVectorizable "fixed-size vectorizable Eigen types" and \ref TopicStructHavingEigenMembers "structures having such Eigen objects as member". For other Eigen types, such as Vector3f or MatrixXd, no special care is needed when using STL containers.++\section allocator Using an aligned allocator++STL containers take an optional template parameter, the allocator type. When using STL containers on \ref TopicFixedSizeVectorizable "fixed-size vectorizable Eigen types", you need tell the container to use an allocator that will always allocate memory at 16-byte-aligned locations. Fortunately, Eigen does provide such an allocator: Eigen::aligned_allocator.++For example, instead of+\code+std::map<int, Eigen::Vector4f>+\endcode+you need to use+\code+std::map<int, Eigen::Vector4f, std::less<int>, +         Eigen::aligned_allocator<std::pair<const int, Eigen::Vector4f> > >+\endcode+Note that the third parameter "std::less<int>" is just the default value, but we have to include it because we want to specify the fourth parameter, which is the allocator type.++\section StlContainers_vector The case of std::vector++The situation with std::vector was even worse (explanation below) so we had to specialize it for the Eigen::aligned_allocator type. In practice you \b must use the Eigen::aligned_allocator (not another aligned allocator), \b and \#include <Eigen/StdVector>.++Here is an example:+\code+#include<Eigen/StdVector>+/* ... */+std::vector<Eigen::Vector4f,Eigen::aligned_allocator<Eigen::Vector4f> >+\endcode++\subsection vector_spec An alternative - specializing std::vector for Eigen types++As an alternative to the recommended approach described above, you have the option to specialize std::vector for Eigen types requiring alignment. +The advantage is that you won't need to declare std::vector all over with Eigen::allocator. One drawback on the other hand side is that+the specialization needs to be defined before all code pieces in which e.g. std::vector<Vector2d> is used. Otherwise, without knowing the specialization+the compiler will compile that particular instance with the default std::allocator and you program is most likely to crash.++Here is an example:+\code+#include<Eigen/StdVector>+/* ... */+EIGEN_DEFINE_STL_VECTOR_SPECIALIZATION(Matrix2d)+std::vector<Eigen::Vector2d>+\endcode++<span class="note">\b Explanation: The resize() method of std::vector takes a value_type argument (defaulting to value_type()). So with std::vector<Eigen::Vector4f>, some Eigen::Vector4f objects will be passed by value, which discards any alignment modifiers, so a Eigen::Vector4f can be created at an unaligned location. In order to avoid that, the only solution we saw was to specialize std::vector to make it work on a slight modification of, here, Eigen::Vector4f, that is able to deal properly with this situation.+</span>++*/++}
+ eigen3/doc/StorageOrders.dox view
@@ -0,0 +1,86 @@+namespace Eigen {++/** \eigenManualPage TopicStorageOrders Storage orders++There are two different storage orders for matrices and two-dimensional arrays: column-major and row-major.+This page explains these storage orders and how to specify which one should be used.++\eigenAutoToc+++\section TopicStorageOrdersIntro Column-major and row-major storage++The entries of a matrix form a two-dimensional grid. However, when the matrix is stored in memory, the entries+have to somehow be laid out linearly. There are two main ways to do this, by row and by column.++We say that a matrix is stored in \b row-major order if it is stored row by row. The entire first row is+stored first, followed by the entire second row, and so on. Consider for example the matrix++\f[+A = \begin{bmatrix}+8 & 2 & 2 & 9 \\+9 & 1 & 4 & 4 \\+3 & 5 & 4 & 5+\end{bmatrix}.+\f]++If this matrix is stored in row-major order, then the entries are laid out in memory as follows:++\code 8 2 2 9 9 1 4 4 3 5 4 5 \endcode++On the other hand, a matrix is stored in \b column-major order if it is stored column by column, starting with+the entire first column, followed by the entire second column, and so on. If the above matrix is stored in+column-major order, it is laid out as follows:++\code 8 9 3 2 1 5 2 4 4 9 4 5 \endcode++This example is illustrated by the following Eigen code. It uses the PlainObjectBase::data() function, which+returns a pointer to the memory location of the first entry of the matrix.++<table class="example">+<tr><th>Example</th><th>Output</th></tr>+<tr><td>+\include TopicStorageOrders_example.cpp+</td>+<td>+\verbinclude TopicStorageOrders_example.out+</td></tr></table>+++\section TopicStorageOrdersInEigen Storage orders in Eigen++The storage order of a matrix or a two-dimensional array can be set by specifying the \c Options template+parameter for Matrix or Array. As \ref TutorialMatrixClass explains, the %Matrix class template has six+template parameters, of which three are compulsory (\c Scalar, \c RowsAtCompileTime and \c ColsAtCompileTime)+and three are optional (\c Options, \c MaxRowsAtCompileTime and \c MaxColsAtCompileTime). If the \c Options+parameter is set to \c RowMajor, then the matrix or array is stored in row-major order; if it is set to +\c ColMajor, then it is stored in column-major order. This mechanism is used in the above Eigen program to+specify the storage order.++If the storage order is not specified, then Eigen defaults to storing the entry in column-major. This is also+the case if one of the convenience typedefs (\c Matrix3f, \c ArrayXXd, etc.) is used.++Matrices and arrays using one storage order can be assigned to matrices and arrays using the other storage+order, as happens in the above program when \c Arowmajor is initialized using \c Acolmajor. Eigen will reorder+the entries automatically. More generally, row-major and column-major matrices can be mixed in an expression+as we want.+++\section TopicStorageOrdersWhich Which storage order to choose?++So, which storage order should you use in your program? There is no simple answer to this question; it depends+on your application. Here are some points to keep in mind:++  - Your users may expect you to use a specific storage order. Alternatively, you may use other libraries than+    Eigen, and these other libraries may expect a certain storage order. In these cases it may be easiest and+    fastest to use this storage order in your whole program.+  - Algorithms that traverse a matrix row by row will go faster when the matrix is stored in row-major order+    because of better data locality. Similarly, column-by-column traversal is faster for column-major+    matrices. It may be worthwhile to experiment a bit to find out what is faster for your particular+    application.+  - The default in Eigen is column-major. Naturally, most of the development and testing of the Eigen library+    is thus done with column-major matrices. This means that, even though we aim to support column-major and+    row-major storage orders transparently, the Eigen library may well work best with column-major matrices.++*/+}
+ eigen3/doc/StructHavingEigenMembers.dox view
@@ -0,0 +1,190 @@+namespace Eigen {++/** \eigenManualPage TopicStructHavingEigenMembers Structures Having Eigen Members++\eigenAutoToc++\section StructHavingEigenMembers_summary Executive Summary++If you define a structure having members of \ref TopicFixedSizeVectorizable "fixed-size vectorizable Eigen types", you must overload its "operator new" so that it generates 16-bytes-aligned pointers. Fortunately, %Eigen provides you with a macro EIGEN_MAKE_ALIGNED_OPERATOR_NEW that does that for you.++\section StructHavingEigenMembers_what What kind of code needs to be changed?++The kind of code that needs to be changed is this:++\code+class Foo+{+  ...+  Eigen::Vector2d v;+  ...+};++...++Foo *foo = new Foo;+\endcode++In other words: you have a class that has as a member a \ref TopicFixedSizeVectorizable "fixed-size vectorizable Eigen object", and then you dynamically create an object of that class.++\section StructHavingEigenMembers_how How should such code be modified?++Very easy, you just need to put a EIGEN_MAKE_ALIGNED_OPERATOR_NEW macro in a public part of your class, like this:++\code+class Foo+{+  ...+  Eigen::Vector2d v;+  ...+public:+  EIGEN_MAKE_ALIGNED_OPERATOR_NEW+};++...++Foo *foo = new Foo;+\endcode++This macro makes "new Foo" always return an aligned pointer.++If this approach is too intrusive, see also the \ref StructHavingEigenMembers_othersolutions "other solutions".++\section StructHavingEigenMembers_why Why is this needed?++OK let's say that your code looks like this:++\code+class Foo+{+  ...+  Eigen::Vector2d v;+  ...+};++...++Foo *foo = new Foo;+\endcode++A Eigen::Vector2d consists of 2 doubles, which is 128 bits. Which is exactly the size of a SSE packet, which makes it possible to use SSE for all sorts of operations on this vector. But SSE instructions (at least the ones that %Eigen uses, which are the fast ones) require 128-bit alignment. Otherwise you get a segmentation fault.++For this reason, Eigen takes care by itself to require 128-bit alignment for Eigen::Vector2d, by doing two things:+\li Eigen requires 128-bit alignment for the Eigen::Vector2d's array (of 2 doubles). With GCC, this is done with a __attribute__ ((aligned(16))).+\li Eigen overloads the "operator new" of Eigen::Vector2d so it will always return 128-bit aligned pointers.++Thus, normally, you don't have to worry about anything, Eigen handles alignment for you...++... except in one case. When you have a class Foo like above, and you dynamically allocate a new Foo as above, then, since Foo doesn't have aligned "operator new", the returned pointer foo is not necessarily 128-bit aligned.++The alignment attribute of the member v is then relative to the start of the class, foo. If the foo pointer wasn't aligned, then foo->v won't be aligned either!++The solution is to let class Foo have an aligned "operator new", as we showed in the previous section.++\section StructHavingEigenMembers_movetotop Should I then put all the members of Eigen types at the beginning of my class?++That's not required. Since Eigen takes care of declaring 128-bit alignment, all members that need it are automatically 128-bit aligned relatively to the class. So code like this works fine:++\code+class Foo+{+  double x;+  Eigen::Vector2d v;+public:+  EIGEN_MAKE_ALIGNED_OPERATOR_NEW+};+\endcode++\section StructHavingEigenMembers_dynamicsize What about dynamic-size matrices and vectors?++Dynamic-size matrices and vectors, such as Eigen::VectorXd, allocate dynamically their own array of coefficients, so they take care of requiring absolute alignment automatically. So they don't cause this issue. The issue discussed here is only with \ref TopicFixedSizeVectorizable  "fixed-size vectorizable matrices and vectors".++\section StructHavingEigenMembers_bugineigen So is this a bug in Eigen?++No, it's not our bug. It's more like an inherent problem of the C++98 language specification, and seems to be taken care of in the upcoming language revision: <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2341.pdf">see this document</a>.++\section StructHavingEigenMembers_conditional What if I want to do this conditionnally (depending on template parameters) ?++For this situation, we offer the macro EIGEN_MAKE_ALIGNED_OPERATOR_NEW_IF(NeedsToAlign). It will generate aligned operators like EIGEN_MAKE_ALIGNED_OPERATOR_NEW if NeedsToAlign is true. It will generate operators with the default alignment if NeedsToAlign is false.++Example:++\code+template<int n> class Foo+{+  typedef Eigen::Matrix<float,n,1> Vector;+  enum { NeedsToAlign = (sizeof(Vector)%16)==0 };+  ...+  Vector v;+  ...+public:+  EIGEN_MAKE_ALIGNED_OPERATOR_NEW_IF(NeedsToAlign)+};++...++Foo<4> *foo4 = new Foo<4>; // foo4 is guaranteed to be 128bit-aligned+Foo<3> *foo3 = new Foo<3>; // foo3 has only the system default alignment guarantee+\endcode+++\section StructHavingEigenMembers_othersolutions Other solutions++In case putting the EIGEN_MAKE_ALIGNED_OPERATOR_NEW macro everywhere is too intrusive, there exists at least two other solutions.++\subsection othersolutions1 Disabling alignment++The first is to disable alignment requirement for the fixed size members:+\code+class Foo+{+  ...+  Eigen::Matrix<double,2,1,Eigen::DontAlign> v;+  ...+};+\endcode+This has for effect to disable vectorization when using \c v.+If a function of Foo uses it several times, then it still possible to re-enable vectorization by copying it into an aligned temporary vector:+\code+void Foo::bar()+{+  Eigen::Vector2d av(v);+  // use av instead of v+  ...+  // if av changed, then do:+  v = av;+}+\endcode++\subsection othersolutions2 Private structure++The second consist in storing the fixed-size objects into a private struct which will be dynamically allocated at the construction time of the main object:++\code+struct Foo_d+{+  EIGEN_MAKE_ALIGNED_OPERATOR_NEW+  Vector2d v;+  ...+};+++struct Foo {+  Foo() { init_d(); }+  ~Foo() { delete d; }+  void bar()+  {+    // use d->v instead of v+    ...+  }+private:+  void init_d() { d = new Foo_d; }+  Foo_d* d;+};+\endcode++The clear advantage here is that the class Foo remains unchanged regarding alignment issues. The drawback is that a heap allocation will be required whatsoever.++*/++}
+ eigen3/doc/TemplateKeyword.dox view
@@ -0,0 +1,133 @@+namespace Eigen {++/** \page TopicTemplateKeyword The template and typename keywords in C++++There are two uses for the \c template and \c typename keywords in C++. One of them is fairly well known+amongst programmers: to define templates. The other use is more obscure: to specify that an expression refers+to a template function or a type. This regularly trips up programmers that use the %Eigen library, often+leading to error messages from the compiler that are difficult to understand, such as "expected expression" or+"no match for operator<".++\eigenAutoToc+++\section TopicTemplateKeywordToDefineTemplates Using the template and typename keywords to define templates++The \c template and \c typename keywords are routinely used to define templates. This is not the topic of this+page as we assume that the reader is aware of this (otherwise consult a C++ book). The following example+should illustrate this use of the \c template keyword.++\code+template <typename T>+bool isPositive(T x)+{+    return x > 0;+}+\endcode++We could just as well have written <tt>template &lt;class T&gt;</tt>; the keywords \c typename and \c class have the+same meaning in this context.+++\section TopicTemplateKeywordExample An example showing the second use of the template keyword++Let us illustrate the second use of the \c template keyword with an example. Suppose we want to write a+function which copies all entries in the upper triangular part of a matrix into another matrix, while keeping+the lower triangular part unchanged. A straightforward implementation would be as follows:++<table class="example">+<tr><th>Example:</th><th>Output:</th></tr>+<tr><td>+\include TemplateKeyword_simple.cpp+</td>+<td>+\verbinclude TemplateKeyword_simple.out+</td></tr></table>++That works fine, but it is not very flexible. First, it only works with dynamic-size matrices of+single-precision floats; the function \c copyUpperTriangularPart() does not accept static-size matrices or+matrices with double-precision numbers. Second, if you use an expression such as+<tt>mat.topLeftCorner(3,3)</tt> as the parameter \c src, then this is copied into a temporary variable of type+MatrixXf; this copy can be avoided.++As explained in \ref TopicFunctionTakingEigenTypes, both issues can be resolved by making +\c copyUpperTriangularPart() accept any object of type MatrixBase. This leads to the following code:++<table class="example">+<tr><th>Example:</th><th>Output:</th></tr>+<tr><td>+\include TemplateKeyword_flexible.cpp+</td>+<td>+\verbinclude TemplateKeyword_flexible.out+</td></tr></table>++The one line in the body of the function \c copyUpperTriangularPart() shows the second, more obscure use of+the \c template keyword in C++.  Even though it may look strange, the \c template keywords are necessary+according to the standard. Without it, the compiler may reject the code with an error message like "no match+for operator<".+++\section TopicTemplateKeywordExplanation Explanation++The reason that the \c template keyword is necessary in the last example has to do with the rules for how+templates are supposed to be compiled in C++. The compiler has to check the code for correct syntax at the+point where the template is defined, without knowing the actual value of the template arguments (\c Derived1+and \c Derived2 in the example). That means that the compiler cannot know that <tt>dst.triangularView</tt> is+a member template and that the following &lt; symbol is part of the delimiter for the template+parameter. Another possibility would be that <tt>dst.triangularView</tt> is a member variable with the &lt;+symbol refering to the <tt>operator&lt;()</tt> function. In fact, the compiler should choose the second+possibility, according to the standard. If <tt>dst.triangularView</tt> is a member template (as in our case),+the programmer should specify this explicitly with the \c template keyword and write <tt>dst.template+triangularView</tt>.++The precise rules are rather complicated, but ignoring some subtleties we can summarize them as follows:+- A <em>dependent name</em> is name that depends (directly or indirectly) on a template parameter. In the+  example, \c dst is a dependent name because it is of type <tt>MatrixBase&lt;Derived1&gt;</tt> which depends+  on the template parameter \c Derived1.+- If the code contains either one of the constructs <tt>xxx.yyy</tt> or <tt>xxx-&gt;yyy</tt> and \c xxx is a+  dependent name and \c yyy refers to a member template, then the \c template keyword must be used before +  \c yyy, leading to <tt>xxx.template yyy</tt> or <tt>xxx-&gt;template yyy</tt>.+- If the code contains the construct <tt>xxx::yyy</tt> and \c xxx is a dependent name and \c yyy refers to a+  member typedef, then the \c typename keyword must be used before the whole construct, leading to+  <tt>typename xxx::yyy</tt>.++As an example where the \c typename keyword is required, consider the following code in \ref TutorialSparse+for iterating over the non-zero entries of a sparse matrix type:++\code+SparseMatrixType mat(rows,cols);+for (int k=0; k<mat.outerSize(); ++k)+  for (SparseMatrixType::InnerIterator it(mat,k); it; ++it)+  {+    /* ... */+  }+\endcode++If \c SparseMatrixType depends on a template parameter, then the \c typename keyword is required:++\code+template <typename T>+void iterateOverSparseMatrix(const SparseMatrix<T>& mat;+{+  for (int k=0; k<m1.outerSize(); ++k)+    for (typename SparseMatrix<T>::InnerIterator it(mat,k); it; ++it)+    {+      /* ... */+    }+}+\endcode+++\section TopicTemplateKeywordResources Resources for further reading++For more information and a fuller explanation of this topic, the reader may consult the following sources:+- The book "C++ Template Metaprogramming" by David Abrahams and Aleksey Gurtovoy contains a very good+  explanation in Appendix B ("The typename and template Keywords") which formed the basis for this page.+- http://pages.cs.wisc.edu/~driscoll/typename.html+- http://www.parashift.com/c++-faq-lite/templates.html#faq-35.18+- http://www.comeaucomputing.com/techtalk/templates/#templateprefix+- http://www.comeaucomputing.com/techtalk/templates/#typename++*/+}
+ eigen3/doc/TopicAliasing.dox view
@@ -0,0 +1,237 @@+namespace Eigen {++/** \eigenManualPage TopicAliasing Aliasing++In %Eigen, aliasing refers to assignment statement in which the same matrix (or array or vector) appears on the+left and on the right of the assignment operators. Statements like <tt>mat = 2 * mat;</tt> or <tt>mat =+mat.transpose();</tt> exhibit aliasing. The aliasing in the first example is harmless, but the aliasing in the+second example leads to unexpected results. This page explains what aliasing is, when it is harmful, and what+to do about it.++\eigenAutoToc+++\section TopicAliasingExamples Examples++Here is a simple example exhibiting aliasing:++<table class="example">+<tr><th>Example</th><th>Output</th></tr>+<tr><td>+\include TopicAliasing_block.cpp+</td>+<td>+\verbinclude TopicAliasing_block.out+</td></tr></table>++The output is not what one would expect. The problem is the assignment+\code+mat.bottomRightCorner(2,2) = mat.topLeftCorner(2,2);+\endcode+This assignment exhibits aliasing: the coefficient \c mat(1,1) appears both in the block+<tt>mat.bottomRightCorner(2,2)</tt> on the left-hand side of the assignment and the block+<tt>mat.topLeftCorner(2,2)</tt> on the right-hand side. After the assignment, the (2,2) entry in the bottom+right corner should have the value of \c mat(1,1) before the assignment, which is 5. However, the output shows+that \c mat(2,2) is actually 1. The problem is that %Eigen uses lazy evaluation (see +\ref TopicEigenExpressionTemplates) for <tt>mat.topLeftCorner(2,2)</tt>. The result is similar to+\code+mat(1,1) = mat(0,0);+mat(1,2) = mat(0,1);+mat(2,1) = mat(1,0);+mat(2,2) = mat(1,1);+\endcode+Thus, \c mat(2,2) is assigned the \e new value of \c mat(1,1) instead of the old value. The next section+explains how to solve this problem by calling \link DenseBase::eval() eval()\endlink.++Aliasing occurs more naturally when trying to shrink a matrix. For example, the expressions <tt>vec =+vec.head(n)</tt> and <tt>mat = mat.block(i,j,r,c)</tt> exhibit aliasing.++In general, aliasing cannot be detected at compile time: if \c mat in the first example were a bit bigger,+then the blocks would not overlap, and there would be no aliasing problem. However, %Eigen does detect some+instances of aliasing, albeit at run time.  The following example exhibiting aliasing was mentioned in \ref+TutorialMatrixArithmetic :++<table class="example">+<tr><th>Example</th><th>Output</th></tr>+<tr><td>+\include tut_arithmetic_transpose_aliasing.cpp+</td>+<td>+\verbinclude tut_arithmetic_transpose_aliasing.out+</td></tr></table>++Again, the output shows the aliasing issue. However, by default %Eigen uses a run-time assertion to detect this+and exits with a message like++\verbatim+void Eigen::DenseBase<Derived>::checkTransposeAliasing(const OtherDerived&) const +[with OtherDerived = Eigen::Transpose<Eigen::Matrix<int, 2, 2, 0, 2, 2> >, Derived = Eigen::Matrix<int, 2, 2, 0, 2, 2>]: +Assertion `(!internal::check_transpose_aliasing_selector<Scalar,internal::blas_traits<Derived>::IsTransposed,OtherDerived>::run(internal::extract_data(derived()), other)) +&& "aliasing detected during transposition, use transposeInPlace() or evaluate the rhs into a temporary using .eval()"' failed.+\endverbatim++The user can turn %Eigen's run-time assertions like the one to detect this aliasing problem off by defining the+EIGEN_NO_DEBUG macro, and the above program was compiled with this macro turned off in order to illustrate the+aliasing problem. See \ref TopicAssertions for more information about %Eigen's run-time assertions.+++\section TopicAliasingSolution Resolving aliasing issues++If you understand the cause of the aliasing issue, then it is obvious what must happen to solve it: %Eigen has+to evaluate the right-hand side fully into a temporary matrix/array and then assign it to the left-hand+side. The function \link DenseBase::eval() eval() \endlink does precisely that.++For example, here is the corrected version of the first example above:++<table class="example">+<tr><th>Example</th><th>Output</th></tr>+<tr><td>+\include TopicAliasing_block_correct.cpp+</td>+<td>+\verbinclude TopicAliasing_block_correct.out+</td></tr></table>++Now, \c mat(2,2) equals 5 after the assignment, as it should be.++The same solution also works for the second example, with the transpose: simply replace the line +<tt>a = a.transpose();</tt> with <tt>a = a.transpose().eval();</tt>. However, in this common case there is a+better solution. %Eigen provides the special-purpose function +\link DenseBase::transposeInPlace() transposeInPlace() \endlink which replaces a matrix by its transpose. +This is shown below:++<table class="example">+<tr><th>Example</th><th>Output</th></tr>+<tr><td>+\include tut_arithmetic_transpose_inplace.cpp+</td>+<td>+\verbinclude tut_arithmetic_transpose_inplace.out+</td></tr></table>++If an xxxInPlace() function is available, then it is best to use it, because it indicates more clearly what you+are doing. This may also allow %Eigen to optimize more aggressively. These are some of the xxxInPlace()+functions provided: ++<table class="manual">+<tr><th>Original function</th><th>In-place function</th></tr>+<tr> <td> MatrixBase::adjoint() </td> <td> MatrixBase::adjointInPlace() </td> </tr>+<tr class="alt"> <td> DenseBase::reverse() </td> <td> DenseBase::reverseInPlace() </td> </tr>+<tr> <td> LDLT::solve() </td> <td> LDLT::solveInPlace() </td> </tr>+<tr class="alt"> <td> LLT::solve() </td> <td> LLT::solveInPlace() </td> </tr>+<tr> <td> TriangularView::solve() </td> <td> TriangularView::solveInPlace() </td> </tr>+<tr class="alt"> <td> DenseBase::transpose() </td> <td> DenseBase::transposeInPlace() </td> </tr>+</table>++In the special case where a matrix or vector is shrunk using an expression like <tt>vec = vec.head(n)</tt>,+you can use \link PlainObjectBase::conservativeResize() conservativeResize() \endlink.+++\section TopicAliasingCwise Aliasing and component-wise operations++As explained above, it may be dangerous if the same matrix or array occurs on both the left-hand side and the+right-hand side of an assignment operator, and it is then often necessary to evaluate the right-hand side+explicitly. However, applying component-wise operations (such as matrix addition, scalar multiplication and+array multiplication) is safe. ++The following example has only component-wise operations. Thus, there is no need for \link DenseBase::eval()+eval() \endlink even though the same matrix appears on both sides of the assignments.++<table class="example">+<tr><th>Example</th><th>Output</th></tr>+<tr><td>+\include TopicAliasing_cwise.cpp+</td>+<td>+\verbinclude TopicAliasing_cwise.out+</td></tr></table>++In general, an assignment is safe if the (i,j) entry of the expression on the right-hand side depends only on+the (i,j) entry of the matrix or array on the left-hand side and not on any other entries. In that case it is+not necessary to evaluate the right-hand side explicitly.+++\section TopicAliasingMatrixMult Aliasing and matrix multiplication++Matrix multiplication is the only operation in %Eigen that assumes aliasing by default, <strong>under the+condition that the destination matrix is not resized</strong>.+Thus, if \c matA is a \b squared matrix, then the statement <tt>matA = matA * matA;</tt> is safe.+All other operations in %Eigen assume that there are no aliasing problems,+either because the result is assigned to a different matrix or because it is a component-wise operation.++<table class="example">+<tr><th>Example</th><th>Output</th></tr>+<tr><td>+\include TopicAliasing_mult1.cpp+</td>+<td>+\verbinclude TopicAliasing_mult1.out+</td></tr></table>++However, this comes at a price. When executing the expression <tt>matA = matA * matA</tt>, %Eigen evaluates the+product in a temporary matrix which is assigned to \c matA after the computation. This is fine. But %Eigen does+the same when the product is assigned to a different matrix (e.g., <tt>matB = matA * matA</tt>). In that case,+it is more efficient to evaluate the product directly into \c matB instead of evaluating it first into a+temporary matrix and copying that matrix to \c matB.++The user can indicate with the \link MatrixBase::noalias() noalias()\endlink function that there is no+aliasing, as follows: <tt>matB.noalias() = matA * matA</tt>. This allows %Eigen to evaluate the matrix product+<tt>matA * matA</tt> directly into \c matB.++<table class="example">+<tr><th>Example</th><th>Output</th></tr>+<tr><td>+\include TopicAliasing_mult2.cpp+</td>+<td>+\verbinclude TopicAliasing_mult2.out+</td></tr></table>++Of course, you should not use \c noalias() when there is in fact aliasing taking place. If you do, then you+may get wrong results:++<table class="example">+<tr><th>Example</th><th>Output</th></tr>+<tr><td>+\include TopicAliasing_mult3.cpp+</td>+<td>+\verbinclude TopicAliasing_mult3.out+</td></tr></table>++Moreover, starting in Eigen 3.3, aliasing is \b not assumed if the destination matrix is resized and the product is not directly assigned to the destination.+Therefore, the following example is also wrong:++<table class="example">+<tr><th>Example</th><th>Output</th></tr>+<tr><td>+\include TopicAliasing_mult4.cpp+</td>+<td>+\verbinclude TopicAliasing_mult4.out+</td></tr></table>++As for any aliasing issue, you can resolve it by explicitly evaluating the expression prior to assignment:+<table class="example">+<tr><th>Example</th><th>Output</th></tr>+<tr><td>+\include TopicAliasing_mult5.cpp+</td>+<td>+\verbinclude TopicAliasing_mult5.out+</td></tr></table>++\section TopicAliasingSummary Summary++Aliasing occurs when the same matrix or array coefficients appear both on the left- and the right-hand side of+an assignment operator.+ - Aliasing is harmless with coefficient-wise computations; this includes scalar multiplication and matrix or+   array addition.+ - When you multiply two matrices, %Eigen assumes that aliasing occurs. If you know that there is no aliasing,+   then you can use \link MatrixBase::noalias() noalias()\endlink.+ - In all other situations, %Eigen assumes that there is no aliasing issue and thus gives the wrong result if+   aliasing does in fact occur. To prevent this, you have to use \link DenseBase::eval() eval() \endlink or+   one of the xxxInPlace() functions.++*/+}
+ eigen3/doc/TopicAssertions.dox view
@@ -0,0 +1,108 @@+namespace Eigen {++/** \page TopicAssertions Assertions++\eigenAutoToc++\section PlainAssert Assertions++The macro eigen_assert is defined to be \c eigen_plain_assert by default. We use eigen_plain_assert instead of \c assert to work around a known bug for GCC <= 4.3. Basically, eigen_plain_assert \a is \c assert.++\subsection RedefineAssert Redefining assertions++Both eigen_assert and eigen_plain_assert are defined in Macros.h. Defining eigen_assert indirectly gives you a chance to change its behavior. You can redefine this macro if you want to do something else such as throwing an exception, and fall back to its default behavior with eigen_plain_assert. The code below tells Eigen to throw an std::runtime_error:++\code+#include <stdexcept>+#undef eigen_assert+#define eigen_assert(x) \+  if (!(x)) { throw (std::runtime_error("Put your message here")); }+\endcode++\subsection DisableAssert Disabling assertions++Assertions cost run time and can be turned off. You can suppress eigen_assert by defining \c EIGEN_NO_DEBUG \b before including Eigen headers. \c EIGEN_NO_DEBUG is undefined by default unless \c NDEBUG is defined.++\section StaticAssert Static assertions++Static assertions are not standardized until C++11. However, in the Eigen library, there are many conditions can and should be detectedat compile time. For instance, we use static assertions to prevent the code below from compiling.++\code+Matrix3d()  + Matrix4d();   // adding matrices of different sizes+Matrix4cd() * Vector3cd();  // invalid product known at compile time+\endcode++Static assertions are defined in StaticAssert.h. If there is native static_assert, we use it. Otherwise, we have implemented an assertion macro that can show a limited range of messages.++One can easily come up with static assertions without messages, such as:++\code+#define STATIC_ASSERT(x) \+  switch(0) { case 0: case x:; }+\endcode++However, the example above obviously cannot tell why the assertion failed. Therefore, we define a \c struct in namespace Eigen::internal to handle available messages.++\code+template<bool condition>+struct static_assertion {};++template<>+struct static_assertion<true>+{+  enum {+    YOU_TRIED_CALLING_A_VECTOR_METHOD_ON_A_MATRIX,+    YOU_MIXED_VECTORS_OF_DIFFERENT_SIZES,+    // see StaticAssert.h for all enums.+  };+};+\endcode++And then, we define EIGEN_STATIC_ASSERT(CONDITION,MSG) to access Eigen::internal::static_assertion<bool(CONDITION)>::MSG. If the condition evaluates into \c false, your compiler displays a lot of messages explaining there is no MSG in static_assert<false>. Nevertheless, this is \a not in what we are interested. As you can see, all members of static_assert<true> are ALL_CAPS_AND_THEY_ARE_SHOUTING.++\warning+When using this macro, MSG should be a member of static_assertion<true>, or the static assertion \b always fails.+Currently, it can only be used in function scope.++\subsection DerivedStaticAssert Derived static assertions++There are other macros derived from EIGEN_STATIC_ASSERT to enhance readability. Their names are self-explanatory.++- \b EIGEN_STATIC_ASSERT_FIXED_SIZE(TYPE) - passes if \a TYPE is fixed size.+- \b EIGEN_STATIC_ASSERT_DYNAMIC_SIZE(TYPE) - passes if \a TYPE is dynamic size.+- \b EIGEN_STATIC_ASSERT_LVALUE(Derived) - failes if \a Derived is read-only.+- \b EIGEN_STATIC_ASSERT_ARRAYXPR(Derived) - passes if \a Derived is an array expression.+- <b>EIGEN_STATIC_ASSERT_SAME_XPR_KIND(Derived1, Derived2)</b> - failes if the two expressions are an array one and a matrix one.++Because Eigen handles both fixed-size and dynamic-size expressions, some conditions cannot be clearly determined at compile time. We classify them into strict assertions and permissive assertions.++\subsubsection StrictAssertions Strict assertions++These assertions fail if the condition <b>may not</b> be met. For example, MatrixXd may not be a vector, so it fails EIGEN_STATIC_ASSERT_VECTOR_ONLY.++- \b EIGEN_STATIC_ASSERT_VECTOR_ONLY(TYPE) - passes if \a TYPE must be a vector type.+- <b>EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(TYPE, SIZE)</b> - passes if \a TYPE must be a vector of the given size.+- <b>EIGEN_STATIC_ASSERT_MATRIX_SPECIFIC_SIZE(TYPE, ROWS, COLS)</b> - passes if \a TYPE must be a matrix with given rows and columns.++\subsubsection PermissiveAssertions Permissive assertions++These assertions fail if the condition \b cannot be met. For example, MatrixXd and Matrix4d may have the same size, so they pass EIGEN_STATIC_ASSERT_SAME_MATRIX_SIZE.++- \b EIGEN_STATIC_ASSERT_SAME_VECTOR_SIZE(TYPE0,TYPE1) - fails if the two vector expression types must have different sizes.+- \b EIGEN_STATIC_ASSERT_SAME_MATRIX_SIZE(TYPE0,TYPE1) - fails if the two matrix expression types must have different sizes.+- \b EIGEN_STATIC_ASSERT_SIZE_1x1(TYPE) - fails if \a TYPE cannot be an 1x1 expression.++See StaticAssert.h for details such as what messages they throw.++\subsection DisableStaticAssert Disabling static assertions++If \c EIGEN_NO_STATIC_ASSERT is defined, static assertions turn into <tt>eigen_assert</tt>'s, working like:++\code+#define EIGEN_STATIC_ASSERT(CONDITION,MSG) eigen_assert((CONDITION) && #MSG);+\endcode++This saves compile time but consumes more run time. \c EIGEN_NO_STATIC_ASSERT is undefined by default.++*/+}
+ eigen3/doc/TopicCMakeGuide.dox view
@@ -0,0 +1,52 @@+namespace Eigen {++/**++\page TopicCMakeGuide Using %Eigen in CMake Projects++%Eigen provides native CMake support which allows the library to be easily+used in CMake projects.++\note %CMake 3.0 (or later) is required to enable this functionality.++%Eigen exports a CMake target called `Eigen3::Eigen` which can be imported+using the `find_package` CMake command and used by calling+`target_link_libraries` as in the following example:+\code{.cmake}+cmake_minimum_required (VERSION 3.0)+project (myproject)++find_package (Eigen3 3.3 REQUIRED NO_MODULE)++add_executable (example example.cpp)+target_link_libraries (example Eigen3::Eigen)+\endcode++The above code snippet must be placed in a file called `CMakeLists.txt` alongside+`example.cpp`. After running+\code{.sh}+$ cmake path-to-example-directory+\endcode+CMake will produce project files that generate an executable called `example`+which requires at least version 3.3 of %Eigen. Here, `path-to-example-directory`+is the path to the directory that contains both `CMakeLists.txt` and+`example.cpp`.++If you have multiple installed version of %Eigen, you can pick your favorite one by setting the \c Eigen3_DIR cmake's variable to the respective path containing the \c Eigen3*.cmake files. For instance:+\code+cmake path-to-example-directory -DEigen3_DIR=$HOME/mypackages/share/eigen3/cmake/+\endcode++If the `REQUIRED` option is omitted when locating %Eigen using+`find_package`, one can check whether the package was found as follows:+\code{.cmake}+find_package (Eigen3 3.3 NO_MODULE)++if (TARGET Eigen3::Eigen)+  # Use the imported target+endif (TARGET Eigen3::Eigen)+\endcode++*/++}
+ eigen3/doc/TopicEigenExpressionTemplates.dox view
@@ -0,0 +1,12 @@+namespace Eigen {++/** \page TopicEigenExpressionTemplates Expression templates in Eigen+++TODO: write this dox page!++Is linked from the tutorial on arithmetic ops.++*/++}
+ eigen3/doc/TopicLazyEvaluation.dox view
@@ -0,0 +1,65 @@+namespace Eigen {++/** \page TopicLazyEvaluation Lazy Evaluation and Aliasing++Executive summary: Eigen has intelligent compile-time mechanisms to enable lazy evaluation and removing temporaries where appropriate.+It will handle aliasing automatically in most cases, for example with matrix products. The automatic behavior can be overridden+manually by using the MatrixBase::eval() and MatrixBase::noalias() methods.++When you write a line of code involving a complex expression such as++\code mat1 = mat2 + mat3 * (mat4 + mat5); \endcode++Eigen determines automatically, for each sub-expression, whether to evaluate it into a temporary variable. Indeed, in certain cases it is better to evaluate immediately a sub-expression into a temporary variable, while in other cases it is better to avoid that.++A traditional math library without expression templates always evaluates all sub-expressions into temporaries. So with this code,++\code vec1 = vec2 + vec3; \endcode++a traditional library would evaluate \c vec2 + vec3 into a temporary \c vec4 and then copy \c vec4  into \c vec1. This is of course inefficient: the arrays are traversed twice, so there are a lot of useless load/store operations.++Expression-templates-based libraries can avoid evaluating sub-expressions into temporaries, which in many cases results in large speed improvements. This is called <i>lazy evaluation</i> as an expression is getting evaluated as late as possible, instead of immediately. However, most other expression-templates-based libraries <i>always</i> choose lazy evaluation. There are two problems with that: first, lazy evaluation is not always a good choice for performance; second, lazy evaluation can be very dangerous, for example with matrix products: doing <tt>matrix = matrix*matrix</tt> gives a wrong result if the matrix product is lazy-evaluated, because of the way matrix product works.++For these reasons, Eigen has intelligent compile-time mechanisms to determine automatically when to use lazy evaluation, and when on the contrary it should evaluate immediately into a temporary variable.++So in the basic example,++\code matrix1 = matrix2 + matrix3; \endcode++Eigen chooses lazy evaluation. Thus the arrays are traversed only once, producing optimized code. If you really want to force immediate evaluation, use \link MatrixBase::eval() eval()\endlink:++\code matrix1 = (matrix2 + matrix3).eval(); \endcode++Here is now a more involved example:++\code matrix1 = -matrix2 + matrix3 + 5 * matrix4; \endcode++Eigen chooses lazy evaluation at every stage in that example, which is clearly the correct choice. In fact, lazy evaluation is the "default choice" and Eigen will choose it except in a few circumstances.++<b>The first circumstance</b> in which Eigen chooses immediate evaluation, is when it sees an assignment <tt>a = b;</tt> and the expression \c b has the evaluate-before-assigning \link flags flag\endlink. The most important example of such an expression is the \link Product matrix product expression\endlink. For example, when you do++\code matrix = matrix * matrix; \endcode++Eigen first evaluates <tt>matrix * matrix</tt> into a temporary matrix, and then copies it into the original \c matrix. This guarantees a correct result as we saw above that lazy evaluation gives wrong results with matrix products. It also doesn't cost much, as the cost of the matrix product itself is much higher.++What if you know that the result does no alias the operand of the product and want to force lazy evaluation? Then use \link MatrixBase::noalias() .noalias()\endlink instead. Here is an example:++\code matrix1.noalias() = matrix2 * matrix2; \endcode++Here, since we know that matrix2 is not the same matrix as matrix1, we know that lazy evaluation is not dangerous, so we may force lazy evaluation. Concretely, the effect of noalias() here is to bypass the evaluate-before-assigning \link flags flag\endlink.++<b>The second circumstance</b> in which Eigen chooses immediate evaluation, is when it sees a nested expression such as <tt>a + b</tt> where \c b is already an expression having the evaluate-before-nesting \link flags flag\endlink. Again, the most important example of such an expression is the \link Product matrix product expression\endlink. For example, when you do++\code matrix1 = matrix2 + matrix3 * matrix4; \endcode++the product <tt>matrix3 * matrix4</tt> gets evaluated immediately into a temporary matrix. Indeed, experiments showed that it is often beneficial for performance to evaluate immediately matrix products when they are nested into bigger expressions.++<b>The third circumstance</b> in which Eigen chooses immediate evaluation, is when its cost model shows that the total cost of an operation is reduced if a sub-expression gets evaluated into a temporary. Indeed, in certain cases, an intermediate result is sufficiently costly to compute and is reused sufficiently many times, that is worth "caching". Here is an example:++\code matrix1 = matrix2 * (matrix3 + matrix4); \endcode++Here, provided the matrices have at least 2 rows and 2 columns, each coefficienct of the expression <tt>matrix3 + matrix4</tt> is going to be used several times in the matrix product. Instead of computing the sum everytime, it is much better to compute it once and store it in a temporary variable. Eigen understands this and evaluates <tt>matrix3 + matrix4</tt> into a temporary variable before evaluating the product.++*/++}
+ eigen3/doc/TopicLinearAlgebraDecompositions.dox view
@@ -0,0 +1,275 @@+namespace Eigen {++/** \eigenManualPage TopicLinearAlgebraDecompositions Catalogue of dense decompositions++This page presents a catalogue of the dense matrix decompositions offered by Eigen.+For an introduction on linear solvers and decompositions, check this \link TutorialLinearAlgebra page \endlink.+To get an overview of the true relative speed of the different decompositions, check this \link DenseDecompositionBenchmark benchmark \endlink.++\section TopicLinAlgBigTable Catalogue of decompositions offered by Eigen++<table class="manual-vl">+    <tr>+        <th class="meta"></th>+        <th class="meta" colspan="5">Generic information, not Eigen-specific</th>+        <th class="meta" colspan="3">Eigen-specific</th>+    </tr>++    <tr>+        <th>Decomposition</th>+        <th>Requirements on the matrix</th>+        <th>Speed</th>+        <th>Algorithm reliability and accuracy</th>+        <th>Rank-revealing</th>+        <th>Allows to compute (besides linear solving)</th>+        <th>Linear solver provided by Eigen</th>+        <th>Maturity of Eigen's implementation</th>+        <th>Optimizations</th>+    </tr>++    <tr>+        <td>PartialPivLU</td>+        <td>Invertible</td>+        <td>Fast</td>+        <td>Depends on condition number</td>+        <td>-</td>+        <td>-</td>+        <td>Yes</td>+        <td>Excellent</td>+        <td>Blocking, Implicit MT</td>+    </tr>++    <tr class="alt">+        <td>FullPivLU</td>+        <td>-</td>+        <td>Slow</td>+        <td>Proven</td>+        <td>Yes</td>+        <td>-</td>+        <td>Yes</td>+        <td>Excellent</td>+        <td>-</td>+    </tr>++    <tr>+        <td>HouseholderQR</td>+        <td>-</td>+        <td>Fast</td>+        <td>Depends on condition number</td>+        <td>-</td>+        <td>Orthogonalization</td>+        <td>Yes</td>+        <td>Excellent</td>+        <td>Blocking</td>+    </tr>++    <tr class="alt">+        <td>ColPivHouseholderQR</td>+        <td>-</td>+        <td>Fast</td>+        <td>Good</td>+        <td>Yes</td>+        <td>Orthogonalization</td>+        <td>Yes</td>+        <td>Excellent</td>+        <td><em>Soon: blocking</em></td>+    </tr>++    <tr>+        <td>FullPivHouseholderQR</td>+        <td>-</td>+        <td>Slow</td>+        <td>Proven</td>+        <td>Yes</td>+        <td>Orthogonalization</td>+        <td>Yes</td>+        <td>Average</td>+        <td>-</td>+    </tr>++    <tr class="alt">+        <td>LLT</td>+        <td>Positive definite</td>+        <td>Very fast</td>+        <td>Depends on condition number</td>+        <td>-</td>+        <td>-</td>+        <td>Yes</td>+        <td>Excellent</td>+        <td>Blocking</td>+    </tr>++    <tr>+        <td>LDLT</td>+        <td>Positive or negative semidefinite<sup><a href="#note1">1</a></sup></td>+        <td>Very fast</td>+        <td>Good</td>+        <td>-</td>+        <td>-</td>+        <td>Yes</td>+        <td>Excellent</td>+        <td><em>Soon: blocking</em></td>+    </tr>++    <tr><th class="inter" colspan="9">\n Singular values and eigenvalues decompositions</th></tr>++    <tr>+        <td>BDCSVD (divide \& conquer)</td>+        <td>-</td>+        <td>One of the fastest SVD algorithms</td>+        <td>Excellent</td>+        <td>Yes</td>+        <td>Singular values/vectors, least squares</td>+        <td>Yes (and does least squares)</td>+        <td>Excellent</td>+        <td>Blocked bidiagonalization</td>+    </tr>++    <tr>+        <td>JacobiSVD (two-sided)</td>+        <td>-</td>+        <td>Slow (but fast for small matrices)</td>+        <td>Proven<sup><a href="#note3">3</a></sup></td>+        <td>Yes</td>+        <td>Singular values/vectors, least squares</td>+        <td>Yes (and does least squares)</td>+        <td>Excellent</td>+        <td>R-SVD</td>+    </tr>++    <tr class="alt">+        <td>SelfAdjointEigenSolver</td>+        <td>Self-adjoint</td>+        <td>Fast-average<sup><a href="#note2">2</a></sup></td>+        <td>Good</td>+        <td>Yes</td>+        <td>Eigenvalues/vectors</td>+        <td>-</td>+        <td>Excellent</td>+        <td><em>Closed forms for 2x2 and 3x3</em></td>+    </tr>++    <tr>+        <td>ComplexEigenSolver</td>+        <td>Square</td>+        <td>Slow-very slow<sup><a href="#note2">2</a></sup></td>+        <td>Depends on condition number</td>+        <td>Yes</td>+        <td>Eigenvalues/vectors</td>+        <td>-</td>+        <td>Average</td>+        <td>-</td>+    </tr>++    <tr class="alt">+        <td>EigenSolver</td>+        <td>Square and real</td>+        <td>Average-slow<sup><a href="#note2">2</a></sup></td>+        <td>Depends on condition number</td>+        <td>Yes</td>+        <td>Eigenvalues/vectors</td>+        <td>-</td>+        <td>Average</td>+        <td>-</td>+    </tr>++    <tr>+        <td>GeneralizedSelfAdjointEigenSolver</td>+        <td>Square</td>+        <td>Fast-average<sup><a href="#note2">2</a></sup></td>+        <td>Depends on condition number</td>+        <td>-</td>+        <td>Generalized eigenvalues/vectors</td>+        <td>-</td>+        <td>Good</td>+        <td>-</td>+    </tr>++    <tr><th class="inter" colspan="9">\n Helper decompositions</th></tr>++    <tr>+        <td>RealSchur</td>+        <td>Square and real</td>+        <td>Average-slow<sup><a href="#note2">2</a></sup></td>+        <td>Depends on condition number</td>+        <td>Yes</td>+        <td>-</td>+        <td>-</td>+        <td>Average</td>+        <td>-</td>+    </tr>++    <tr class="alt">+        <td>ComplexSchur</td>+        <td>Square</td>+        <td>Slow-very slow<sup><a href="#note2">2</a></sup></td>+        <td>Depends on condition number</td>+        <td>Yes</td>+        <td>-</td>+        <td>-</td>+        <td>Average</td>+        <td>-</td>+    </tr>++    <tr class="alt">+        <td>Tridiagonalization</td>+        <td>Self-adjoint</td>+        <td>Fast</td>+        <td>Good</td>+        <td>-</td>+        <td>-</td>+        <td>-</td>+        <td>Good</td>+        <td><em>Soon: blocking</em></td>+    </tr>++    <tr>+        <td>HessenbergDecomposition</td>+        <td>Square</td>+        <td>Average</td>+        <td>Good</td>+        <td>-</td>+        <td>-</td>+        <td>-</td>+        <td>Good</td>+        <td><em>Soon: blocking</em></td>+    </tr>++</table>++\b Notes:+<ul>+<li><a name="note1">\b 1: </a>There exist two variants of the LDLT algorithm. Eigen's one produces a pure diagonal D matrix, and therefore it cannot handle indefinite matrices, unlike Lapack's one which produces a block diagonal D matrix.</li>+<li><a name="note2">\b 2: </a>Eigenvalues, SVD and Schur decompositions rely on iterative algorithms. Their convergence speed depends on how well the eigenvalues are separated.</li>+<li><a name="note3">\b 3: </a>Our JacobiSVD is two-sided, making for proven and optimal precision for square matrices. For non-square matrices, we have to use a QR preconditioner first. The default choice, ColPivHouseholderQR, is already very reliable, but if you want it to be proven, use FullPivHouseholderQR instead.+</ul>++\section TopicLinAlgTerminology Terminology++<dl>+  <dt><b>Selfadjoint</b></dt>+    <dd>For a real matrix, selfadjoint is a synonym for symmetric. For a complex matrix, selfadjoint is a synonym for \em hermitian.+        More generally, a matrix \f$ A \f$ is selfadjoint if and only if it is equal to its adjoint \f$ A^* \f$. The adjoint is also called the \em conjugate \em transpose. </dd>+  <dt><b>Positive/negative definite</b></dt>+    <dd>A selfadjoint matrix \f$ A \f$ is positive definite if \f$ v^* A v > 0 \f$ for any non zero vector \f$ v \f$.+        In the same vein, it is negative definite if \f$ v^* A v < 0 \f$ for any non zero vector \f$ v \f$ </dd>+  <dt><b>Positive/negative semidefinite</b></dt>+    <dd>A selfadjoint matrix \f$ A \f$ is positive semi-definite if \f$ v^* A v \ge 0 \f$ for any non zero vector \f$ v \f$.+        In the same vein, it is negative semi-definite if \f$ v^* A v \le 0 \f$ for any non zero vector \f$ v \f$ </dd>++  <dt><b>Blocking</b></dt>+    <dd>Means the algorithm can work per block, whence guaranteeing a good scaling of the performance for large matrices.</dd>+  <dt><b>Implicit Multi Threading (MT)</b></dt>+    <dd>Means the algorithm can take advantage of multicore processors via OpenMP. "Implicit" means the algortihm itself is not parallelized, but that it relies on parallelized matrix-matrix product rountines.</dd>+  <dt><b>Explicit Multi Threading (MT)</b></dt>+    <dd>Means the algorithm is explicitly parallelized to take advantage of multicore processors via OpenMP.</dd>+  <dt><b>Meta-unroller</b></dt>+    <dd>Means the algorithm is automatically and explicitly unrolled for very small fixed size matrices.</dd>+  <dt><b></b></dt>+    <dd></dd>+</dl>+++*/++}
+ eigen3/doc/TopicMultithreading.dox view
@@ -0,0 +1,54 @@+namespace Eigen {++/** \page TopicMultiThreading Eigen and multi-threading++\section TopicMultiThreading_MakingEigenMT Make Eigen run in parallel++Some Eigen's algorithms can exploit the multiple cores present in your hardware. To this end, it is enough to enable OpenMP on your compiler, for instance:+ * GCC: \c -fopenmp+ * ICC: \c -openmp+ * MSVC: check the respective option in the build properties.+You can control the number of thread that will be used using either the OpenMP API or Eigen's API using the following priority:+\code+ OMP_NUM_THREADS=n ./my_program+ omp_set_num_threads(n);+ Eigen::setNbThreads(n);+\endcode+Unless setNbThreads has been called, Eigen uses the number of threads specified by OpenMP. You can restore this behavior by calling \code setNbThreads(0); \endcode+You can query the number of threads that will be used with:+\code+n = Eigen::nbThreads( );+\endcode+You can disable Eigen's multi threading at compile time by defining the EIGEN_DONT_PARALLELIZE preprocessor token.++Currently, the following algorithms can make use of multi-threading:+ - general dense matrix - matrix products+ - PartialPivLU+ - row-major-sparse * dense vector/matrix products+ - ConjugateGradient with \c Lower|Upper as the \c UpLo template parameter.+ - BiCGSTAB with a row-major sparse matrix format.+ - LeastSquaresConjugateGradient++\section TopicMultiThreading_UsingEigenWithMT Using Eigen in a multi-threaded application++In the case your own application is multithreaded, and multiple threads make calls to Eigen, then you have to initialize Eigen by calling the following routine \b before creating the threads:+\code+#include <Eigen/Core>++int main(int argc, char** argv)+{+  Eigen::initParallel();+  +  ...+}+\endcode++\note With Eigen 3.3, and a fully C++11 compliant compiler (i.e., <a href="http://en.cppreference.com/w/cpp/language/storage_duration#Static_local_variables">thread-safe static local variable initialization</a>), then calling \c initParallel() is optional.++\warning note that all functions generating random matrices are \b not re-entrant nor thread-safe. Those include DenseBase::Random(), and DenseBase::setRandom() despite a call to Eigen::initParallel(). This is because these functions are based on std::rand which is not re-entrant. For thread-safe random generator, we recommend the use of boost::random or c++11 random feature.++In the case your application is parallelized with OpenMP, you might want to disable Eigen's own parallization as detailed in the previous section.++*/++}
+ eigen3/doc/TopicResizing.dox view
@@ -0,0 +1,11 @@+namespace Eigen {++/** \page TopicResizing Resizing+++TODO: write this dox page!++Is linked from the tutorial on the Matrix class.++*/+}
+ eigen3/doc/TopicScalarTypes.dox view
@@ -0,0 +1,12 @@+namespace Eigen {++/** \page TopicScalarTypes Scalar types+++TODO: write this dox page!++Is linked from the tutorial on the Matrix class.++*/++}
+ eigen3/doc/TopicVectorization.dox view
@@ -0,0 +1,9 @@+namespace Eigen {++/** \page TopicVectorization Vectorization+++TODO: write this dox page!++*/+}
+ eigen3/doc/TutorialAdvancedInitialization.dox view
@@ -0,0 +1,162 @@+namespace Eigen {++/** \eigenManualPage TutorialAdvancedInitialization Advanced initialization++This page discusses several advanced methods for initializing matrices. It gives more details on the+comma-initializer, which was introduced before. It also explains how to get special matrices such as the+identity matrix and the zero matrix.++\eigenAutoToc++\section TutorialAdvancedInitializationCommaInitializer The comma initializer++Eigen offers a comma initializer syntax which allows the user to easily set all the coefficients of a matrix,+vector or array. Simply list the coefficients, starting at the top-left corner and moving from left to right+and from the top to the bottom. The size of the object needs to be specified beforehand. If you list too few+or too many coefficients, Eigen will complain.++<table class="example">+<tr><th>Example:</th><th>Output:</th></tr>+<tr><td>+\include Tutorial_commainit_01.cpp+</td>+<td>+\verbinclude Tutorial_commainit_01.out+</td></tr></table>++Moreover, the elements of the initialization list may themselves be vectors or matrices. A common use is+to join vectors or matrices together. For example, here is how to join two row vectors together. Remember+that you have to set the size before you can use the comma initializer.++<table class="example">+<tr><th>Example:</th><th>Output:</th></tr>+<tr><td>+\include Tutorial_AdvancedInitialization_Join.cpp+</td>+<td>+\verbinclude Tutorial_AdvancedInitialization_Join.out+</td></tr></table>++We can use the same technique to initialize matrices with a block structure.++<table class="example">+<tr><th>Example:</th><th>Output:</th></tr>+<tr><td>+\include Tutorial_AdvancedInitialization_Block.cpp+</td>+<td>+\verbinclude Tutorial_AdvancedInitialization_Block.out+</td></tr></table>++The comma initializer can also be used to fill block expressions such as <tt>m.row(i)</tt>. Here is a more+complicated way to get the same result as in the first example above:++<table class="example">+<tr><th>Example:</th><th>Output:</th></tr>+<tr><td>+\include Tutorial_commainit_01b.cpp+</td>+<td>+\verbinclude Tutorial_commainit_01b.out+</td></tr></table>+++\section TutorialAdvancedInitializationSpecialMatrices Special matrices and arrays++The Matrix and Array classes have static methods like \link DenseBase::Zero() Zero()\endlink, which can be+used to initialize all coefficients to zero. There are three variants. The first variant takes no arguments+and can only be used for fixed-size objects. If you want to initialize a dynamic-size object to zero, you need+to specify the size. Thus, the second variant requires one argument and can be used for one-dimensional+dynamic-size objects, while the third variant requires two arguments and can be used for two-dimensional+objects. All three variants are illustrated in the following example:++<table class="example">+<tr><th>Example:</th><th>Output:</th></tr>+<tr><td>+\include Tutorial_AdvancedInitialization_Zero.cpp+</td>+<td>+\verbinclude Tutorial_AdvancedInitialization_Zero.out+</td></tr></table>++Similarly, the static method \link DenseBase::Constant() Constant\endlink(value) sets all coefficients to \c value.+If the size of the object needs to be specified, the additional arguments go before the \c value+argument, as in <tt>MatrixXd::Constant(rows, cols, value)</tt>. The method \link DenseBase::Random() Random()+\endlink fills the matrix or array with random coefficients. The identity matrix can be obtained by calling+\link MatrixBase::Identity() Identity()\endlink; this method is only available for Matrix, not for Array,+because "identity matrix" is a linear algebra concept.  The method+\link DenseBase::LinSpaced LinSpaced\endlink(size, low, high) is only available for vectors and+one-dimensional arrays; it yields a vector of the specified size whose coefficients are equally spaced between+\c low and \c high. The method \c LinSpaced() is illustrated in the following example, which prints a table+with angles in degrees, the corresponding angle in radians, and their sine and cosine.++<table class="example">+<tr><th>Example:</th><th>Output:</th></tr>+<tr><td>+\include Tutorial_AdvancedInitialization_LinSpaced.cpp+</td>+<td>+\verbinclude Tutorial_AdvancedInitialization_LinSpaced.out+</td></tr></table>++This example shows that objects like the ones returned by LinSpaced() can be assigned to variables (and+expressions). Eigen defines utility functions like \link DenseBase::setZero() setZero()\endlink, +\link MatrixBase::setIdentity() \endlink and \link DenseBase::setLinSpaced() \endlink to do this+conveniently. The following example contrasts three ways to construct the matrix+\f$ J = \bigl[ \begin{smallmatrix} O & I \\ I & O \end{smallmatrix} \bigr] \f$: using static methods and+assignment, using static methods and the comma-initializer, or using the setXxx() methods.++<table class="example">+<tr><th>Example:</th><th>Output:</th></tr>+<tr><td>+\include Tutorial_AdvancedInitialization_ThreeWays.cpp+</td>+<td>+\verbinclude Tutorial_AdvancedInitialization_ThreeWays.out+</td></tr></table>++A summary of all pre-defined matrix, vector and array objects can be found in the \ref QuickRefPage.+++\section TutorialAdvancedInitializationTemporaryObjects Usage as temporary objects++As shown above, static methods as Zero() and Constant() can be used to initialize variables at the time of+declaration or at the right-hand side of an assignment operator. You can think of these methods as returning a+matrix or array; in fact, they return so-called \ref TopicEigenExpressionTemplates "expression objects" which+evaluate to a matrix or array when needed, so that this syntax does not incur any overhead.++These expressions can also be used as a temporary object. The second example in+the \ref GettingStarted guide, which we reproduce here, already illustrates this.++<table class="example">+<tr><th>Example:</th><th>Output:</th></tr>+<tr><td>+\include QuickStart_example2_dynamic.cpp+</td>+<td>+\verbinclude QuickStart_example2_dynamic.out+</td></tr></table>++The expression <tt>m + MatrixXf::Constant(3,3,1.2)</tt> constructs the 3-by-3 matrix expression with all its coefficients+equal to 1.2 plus the corresponding coefficient of \a m.++The comma-initializer, too, can also be used to construct temporary objects. The following example constructs a random+matrix of size 2-by-3, and then multiplies this matrix on the left with +\f$ \bigl[ \begin{smallmatrix} 0 & 1 \\ 1 & 0 \end{smallmatrix} \bigr] \f$.++<table class="example">+<tr><th>Example:</th><th>Output:</th></tr>+<tr><td>+\include Tutorial_AdvancedInitialization_CommaTemporary.cpp+</td>+<td>+\verbinclude Tutorial_AdvancedInitialization_CommaTemporary.out+</td></tr></table>++The \link CommaInitializer::finished() finished() \endlink method is necessary here to get the actual matrix+object once the comma initialization of our temporary submatrix is done.+++*/++}
+ eigen3/doc/TutorialArrayClass.dox view
@@ -0,0 +1,192 @@+namespace Eigen {++/** \eigenManualPage TutorialArrayClass The Array class and coefficient-wise operations++This page aims to provide an overview and explanations on how to use+Eigen's Array class.++\eigenAutoToc+  +\section TutorialArrayClassIntro What is the Array class?++The Array class provides general-purpose arrays, as opposed to the Matrix class which+is intended for linear algebra. Furthermore, the Array class provides an easy way to+perform coefficient-wise operations, which might not have a linear algebraic meaning,+such as adding a constant to every coefficient in the array or multiplying two arrays coefficient-wise.+++\section TutorialArrayClassTypes Array types+Array is a class template taking the same template parameters as Matrix.+As with Matrix, the first three template parameters are mandatory:+\code+Array<typename Scalar, int RowsAtCompileTime, int ColsAtCompileTime>+\endcode+The last three template parameters are optional. Since this is exactly the same as for Matrix,+we won't explain it again here and just refer to \ref TutorialMatrixClass.++Eigen also provides typedefs for some common cases, in a way that is similar to the Matrix typedefs+but with some slight differences, as the word "array" is used for both 1-dimensional and 2-dimensional arrays.+We adopt the convention that typedefs of the form ArrayNt stand for 1-dimensional arrays, where N and t are+the size and the scalar type, as in the Matrix typedefs explained on \ref TutorialMatrixClass "this page". For 2-dimensional arrays, we+use typedefs of the form ArrayNNt. Some examples are shown in the following table:++<table class="manual">+  <tr>+    <th>Type </th>+    <th>Typedef </th>+  </tr>+  <tr>+    <td> \code Array<float,Dynamic,1> \endcode </td>+    <td> \code ArrayXf \endcode </td>+  </tr>+  <tr>+    <td> \code Array<float,3,1> \endcode </td>+    <td> \code Array3f \endcode </td>+  </tr>+  <tr>+    <td> \code Array<double,Dynamic,Dynamic> \endcode </td>+    <td> \code ArrayXXd \endcode </td>+  </tr>+  <tr>+    <td> \code Array<double,3,3> \endcode </td>+    <td> \code Array33d \endcode </td>+  </tr>+</table>+++\section TutorialArrayClassAccess Accessing values inside an Array++The parenthesis operator is overloaded to provide write and read access to the coefficients of an array, just as with matrices.+Furthermore, the \c << operator can be used to initialize arrays (via the comma initializer) or to print them.++<table class="example">+<tr><th>Example:</th><th>Output:</th></tr>+<tr><td>+\include Tutorial_ArrayClass_accessors.cpp+</td>+<td>+\verbinclude Tutorial_ArrayClass_accessors.out+</td></tr></table>++For more information about the comma initializer, see \ref TutorialAdvancedInitialization.+++\section TutorialArrayClassAddSub Addition and subtraction++Adding and subtracting two arrays is the same as for matrices.+The operation is valid if both arrays have the same size, and the addition or subtraction is done coefficient-wise.++Arrays also support expressions of the form <tt>array + scalar</tt> which add a scalar to each coefficient in the array.+This provides a functionality that is not directly available for Matrix objects.++<table class="example">+<tr><th>Example:</th><th>Output:</th></tr>+<tr><td>+\include Tutorial_ArrayClass_addition.cpp+</td>+<td>+\verbinclude Tutorial_ArrayClass_addition.out+</td></tr></table>+++\section TutorialArrayClassMult Array multiplication++First of all, of course you can multiply an array by a scalar, this works in the same way as matrices. Where arrays+are fundamentally different from matrices, is when you multiply two together. Matrices interpret+multiplication as matrix product and arrays interpret multiplication as coefficient-wise product. Thus, two +arrays can be multiplied if and only if they have the same dimensions.++<table class="example">+<tr><th>Example:</th><th>Output:</th></tr>+<tr><td>+\include Tutorial_ArrayClass_mult.cpp+</td>+<td>+\verbinclude Tutorial_ArrayClass_mult.out+</td></tr></table>+++\section TutorialArrayClassCwiseOther Other coefficient-wise operations++The Array class defines other coefficient-wise operations besides the addition, subtraction and multiplication+operators described above. For example, the \link ArrayBase::abs() .abs() \endlink method takes the absolute+value of each coefficient, while \link ArrayBase::sqrt() .sqrt() \endlink computes the square root of the+coefficients. If you have two arrays of the same size, you can call \link ArrayBase::min(const Eigen::ArrayBase<OtherDerived>&) const .min(.) \endlink to+construct the array whose coefficients are the minimum of the corresponding coefficients of the two given+arrays. These operations are illustrated in the following example.++<table class="example">+<tr><th>Example:</th><th>Output:</th></tr>+<tr><td>+\include Tutorial_ArrayClass_cwise_other.cpp+</td>+<td>+\verbinclude Tutorial_ArrayClass_cwise_other.out+</td></tr></table>++More coefficient-wise operations can be found in the \ref QuickRefPage.+++\section TutorialArrayClassConvert Converting between array and matrix expressions++When should you use objects of the Matrix class and when should you use objects of the Array class? You cannot+apply Matrix operations on arrays, or Array operations on matrices. Thus, if you need to do linear algebraic+operations such as matrix multiplication, then you should use matrices; if you need to do coefficient-wise+operations, then you should use arrays. However, sometimes it is not that simple, but you need to use both+Matrix and Array operations. In that case, you need to convert a matrix to an array or reversely. This gives+access to all operations regardless of the choice of declaring objects as arrays or as matrices.++\link MatrixBase Matrix expressions \endlink have an \link MatrixBase::array() .array() \endlink method that+'converts' them into \link ArrayBase array expressions\endlink, so that coefficient-wise operations+can be applied easily. Conversely, \link ArrayBase array expressions \endlink+have a \link ArrayBase::matrix() .matrix() \endlink method. As with all Eigen expression abstractions,+this doesn't have any runtime cost (provided that you let your compiler optimize).+Both \link MatrixBase::array() .array() \endlink and \link ArrayBase::matrix() .matrix() \endlink +can be used as rvalues and as lvalues.++Mixing matrices and arrays in an expression is forbidden with Eigen. For instance, you cannot add a matrix and+array directly; the operands of a \c + operator should either both be matrices or both be arrays. However,+it is easy to convert from one to the other with \link MatrixBase::array() .array() \endlink and +\link ArrayBase::matrix() .matrix()\endlink. The exception to this rule is the assignment operator: it is+allowed to assign a matrix expression to an array variable, or to assign an array expression to a matrix+variable.++The following example shows how to use array operations on a Matrix object by employing the +\link MatrixBase::array() .array() \endlink method. For example, the statement +<tt>result = m.array() * n.array()</tt> takes two matrices \c m and \c n, converts them both to an array, uses+* to multiply them coefficient-wise and assigns the result to the matrix variable \c result (this is legal+because Eigen allows assigning array expressions to matrix variables). ++As a matter of fact, this usage case is so common that Eigen provides a \link MatrixBase::cwiseProduct const+.cwiseProduct(.) \endlink method for matrices to compute the coefficient-wise product. This is also shown in+the example program.++<table class="example">+<tr><th>Example:</th><th>Output:</th></tr>+<tr><td>+\include Tutorial_ArrayClass_interop_matrix.cpp+</td>+<td>+\verbinclude Tutorial_ArrayClass_interop_matrix.out+</td></tr></table>++Similarly, if \c array1 and \c array2 are arrays, then the expression <tt>array1.matrix() * array2.matrix()</tt>+computes their matrix product.++Here is a more advanced example. The expression <tt>(m.array() + 4).matrix() * m</tt> adds 4 to every+coefficient in the matrix \c m and then computes the matrix product of the result with \c m. Similarly, the+expression <tt>(m.array() * n.array()).matrix() * m</tt> computes the coefficient-wise product of the matrices+\c m and \c n and then the matrix product of the result with \c m.++<table class="example">+<tr><th>Example:</th><th>Output:</th></tr>+<tr><td>+\include Tutorial_ArrayClass_interop.cpp+</td>+<td>+\verbinclude Tutorial_ArrayClass_interop.out+</td></tr></table>++*/++}
+ eigen3/doc/TutorialBlockOperations.dox view
@@ -0,0 +1,228 @@+namespace Eigen {++/** \eigenManualPage TutorialBlockOperations Block operations++This page explains the essentials of block operations.+A block is a rectangular part of a matrix or array. Blocks expressions can be used both+as rvalues and as lvalues. As usual with Eigen expressions, this abstraction has zero runtime cost+provided that you let your compiler optimize.++\eigenAutoToc++\section TutorialBlockOperationsUsing Using block operations++The most general block operation in Eigen is called \link DenseBase::block() .block() \endlink.+There are two versions, whose syntax is as follows:++<table class="manual">+<tr><th>\b %Block \b operation</td>+<th>Version constructing a \n dynamic-size block expression</th>+<th>Version constructing a \n fixed-size block expression</th></tr>+<tr><td>%Block of size <tt>(p,q)</tt>, starting at <tt>(i,j)</tt></td>+    <td>\code+matrix.block(i,j,p,q);\endcode </td>+    <td>\code +matrix.block<p,q>(i,j);\endcode </td>+</tr>+</table>++As always in Eigen, indices start at 0.++Both versions can be used on fixed-size and dynamic-size matrices and arrays.+These two expressions are semantically equivalent.+The only difference is that the fixed-size version will typically give you faster code if the block size is small,+but requires this size to be known at compile time.++The following program uses the dynamic-size and fixed-size versions to print the values of several blocks inside a+matrix.++<table class="example">+<tr><th>Example:</th><th>Output:</th></tr>+<tr><td>+\include Tutorial_BlockOperations_print_block.cpp+</td>+<td>+\verbinclude Tutorial_BlockOperations_print_block.out+</td></tr></table>++In the above example the \link DenseBase::block() .block() \endlink function was employed as a \em rvalue, i.e.+it was only read from. However, blocks can also be used as \em lvalues, meaning that you can assign to a block.++This is illustrated in the following example. This example also demonstrates blocks in arrays, which works exactly like the above-demonstrated blocks in matrices.++<table class="example">+<tr><th>Example:</th><th>Output:</th></tr>+<tr><td>+\include Tutorial_BlockOperations_block_assignment.cpp+</td>+<td>+\verbinclude Tutorial_BlockOperations_block_assignment.out+</td></tr></table>++While the \link DenseBase::block() .block() \endlink method can be used for any block operation, there are+other methods for special cases, providing more specialized API and/or better performance. On the topic of performance, all what+matters is that you give Eigen as much information as possible at compile time. For example, if your block is a single whole column in a matrix,+using the specialized \link DenseBase::col() .col() \endlink function described below lets Eigen know that, which can give it optimization opportunities.++The rest of this page describes these specialized methods.++\section TutorialBlockOperationsSyntaxColumnRows Columns and rows++Individual columns and rows are special cases of blocks. Eigen provides methods to easily address them:+\link DenseBase::col() .col() \endlink and \link DenseBase::row() .row()\endlink.++<table class="manual">+<tr><th>%Block operation</th>+<th>Method</th>+<tr><td>i<sup>th</sup> row+                    \link DenseBase::row() * \endlink</td>+    <td>\code+matrix.row(i);\endcode </td>+</tr>+<tr><td>j<sup>th</sup> column+                    \link DenseBase::col() * \endlink</td>+    <td>\code+matrix.col(j);\endcode </td>+</tr>+</table>++The argument for \p col() and \p row() is the index of the column or row to be accessed. As always in Eigen, indices start at 0.++<table class="example">+<tr><th>Example:</th><th>Output:</th></tr>+<tr><td>+\include Tutorial_BlockOperations_colrow.cpp+</td>+<td>+\verbinclude Tutorial_BlockOperations_colrow.out+</td></tr></table>++That example also demonstrates that block expressions (here columns) can be used in arithmetic like any other expression.+++\section TutorialBlockOperationsSyntaxCorners Corner-related operations++Eigen also provides special methods for blocks that are flushed against one of the corners or sides of a+matrix or array. For instance, \link DenseBase::topLeftCorner() .topLeftCorner() \endlink can be used to refer+to a block in the top-left corner of a matrix.++The different possibilities are summarized in the following table:++<table class="manual">+<tr><th>%Block \b operation</td>+<th>Version constructing a \n dynamic-size block expression</th>+<th>Version constructing a \n fixed-size block expression</th></tr>+<tr><td>Top-left p by q block \link DenseBase::topLeftCorner() * \endlink</td>+    <td>\code+matrix.topLeftCorner(p,q);\endcode </td>+    <td>\code +matrix.topLeftCorner<p,q>();\endcode </td>+</tr>+<tr><td>Bottom-left p by q block+              \link DenseBase::bottomLeftCorner() * \endlink</td>+    <td>\code+matrix.bottomLeftCorner(p,q);\endcode </td>+    <td>\code +matrix.bottomLeftCorner<p,q>();\endcode </td>+</tr>+<tr><td>Top-right p by q block+              \link DenseBase::topRightCorner() * \endlink</td>+    <td>\code+matrix.topRightCorner(p,q);\endcode </td>+    <td>\code +matrix.topRightCorner<p,q>();\endcode </td>+</tr>+<tr><td>Bottom-right p by q block+               \link DenseBase::bottomRightCorner() * \endlink</td>+    <td>\code+matrix.bottomRightCorner(p,q);\endcode </td>+    <td>\code +matrix.bottomRightCorner<p,q>();\endcode </td>+</tr>+<tr><td>%Block containing the first q rows+                   \link DenseBase::topRows() * \endlink</td>+    <td>\code+matrix.topRows(q);\endcode </td>+    <td>\code +matrix.topRows<q>();\endcode </td>+</tr>+<tr><td>%Block containing the last q rows+                    \link DenseBase::bottomRows() * \endlink</td>+    <td>\code+matrix.bottomRows(q);\endcode </td>+    <td>\code +matrix.bottomRows<q>();\endcode </td>+</tr>+<tr><td>%Block containing the first p columns+                    \link DenseBase::leftCols() * \endlink</td>+    <td>\code+matrix.leftCols(p);\endcode </td>+    <td>\code +matrix.leftCols<p>();\endcode </td>+</tr>+<tr><td>%Block containing the last q columns+                    \link DenseBase::rightCols() * \endlink</td>+    <td>\code+matrix.rightCols(q);\endcode </td>+    <td>\code +matrix.rightCols<q>();\endcode </td>+</tr>+</table>++Here is a simple example illustrating the use of the operations presented above:++<table class="example">+<tr><th>Example:</th><th>Output:</th></tr>+<tr><td>+\include Tutorial_BlockOperations_corner.cpp+</td>+<td>+\verbinclude Tutorial_BlockOperations_corner.out+</td></tr></table>+++\section TutorialBlockOperationsSyntaxVectors Block operations for vectors++Eigen also provides a set of block operations designed specifically for the special case of vectors and one-dimensional arrays:++<table class="manual">+<tr><th> %Block operation</th>+<th>Version constructing a \n dynamic-size block expression</th>+<th>Version constructing a \n fixed-size block expression</th></tr>+<tr><td>%Block containing the first \p n elements +                    \link DenseBase::head() * \endlink</td>+    <td>\code+vector.head(n);\endcode </td>+    <td>\code +vector.head<n>();\endcode </td>+</tr>+<tr><td>%Block containing the last \p n elements+                    \link DenseBase::tail() * \endlink</td>+    <td>\code+vector.tail(n);\endcode </td>+    <td>\code +vector.tail<n>();\endcode </td>+</tr>+<tr><td>%Block containing \p n elements, starting at position \p i+                    \link DenseBase::segment() * \endlink</td>+    <td>\code+vector.segment(i,n);\endcode </td>+    <td>\code +vector.segment<n>(i);\endcode </td>+</tr>+</table>+++An example is presented below:+<table class="example">+<tr><th>Example:</th><th>Output:</th></tr>+<tr><td>+\include Tutorial_BlockOperations_vector.cpp+</td>+<td>+\verbinclude Tutorial_BlockOperations_vector.out+</td></tr></table>++*/++}
+ eigen3/doc/TutorialGeometry.dox view
@@ -0,0 +1,242 @@+namespace Eigen {++/** \eigenManualPage TutorialGeometry Space transformations++In this page, we will introduce the many possibilities offered by the \ref Geometry_Module "geometry module" to deal with 2D and 3D rotations and projective or affine transformations.++\eigenAutoToc++Eigen's Geometry module provides two different kinds of geometric transformations:+  - Abstract transformations, such as rotations (represented by \ref AngleAxis "angle and axis" or by a \ref Quaternion "quaternion"), \ref Translation "translations", \ref Scaling "scalings". These transformations are NOT represented as matrices, but you can nevertheless mix them with matrices and vectors in expressions, and convert them to matrices if you wish.+  - Projective or affine transformation matrices: see the Transform class. These are really matrices.++\note If you are working with OpenGL 4x4 matrices then Affine3f and Affine3d are what you want. Since Eigen defaults to column-major storage, you can directly use the Transform::data() method to pass your transformation matrix to OpenGL.++You can construct a Transform from an abstract transformation, like this:+\code+  Transform t(AngleAxis(angle,axis));+\endcode+or like this:+\code+  Transform t;+  t = AngleAxis(angle,axis);+\endcode+But note that unfortunately, because of how C++ works, you can \b not do this:+\code+  Transform t = AngleAxis(angle,axis);+\endcode+<span class="note">\b Explanation: In the C++ language, this would require Transform to have a non-explicit conversion constructor from AngleAxis, but we really don't want to allow implicit casting here.+</span>++\section TutorialGeoElementaryTransformations Transformation types++<table class="manual">+<tr><th>Transformation type</th><th>Typical initialization code</th></tr>+<tr><td>+\ref Rotation2D "2D rotation" from an angle</td><td>\code+Rotation2D<float> rot2(angle_in_radian);\endcode</td></tr>+<tr class="alt"><td>+3D rotation as an \ref AngleAxis "angle + axis"</td><td>\code+AngleAxis<float> aa(angle_in_radian, Vector3f(ax,ay,az));\endcode+<span class="note">The axis vector must be normalized.</span></td></tr>+<tr><td>+3D rotation as a \ref Quaternion "quaternion"</td><td>\code+Quaternion<float> q;  q = AngleAxis<float>(angle_in_radian, axis);\endcode</td></tr>+<tr class="alt"><td>+N-D Scaling</td><td>\code+Scaling(sx, sy)+Scaling(sx, sy, sz)+Scaling(s)+Scaling(vecN)\endcode</td></tr>+<tr><td>+N-D Translation</td><td>\code+Translation<float,2>(tx, ty)+Translation<float,3>(tx, ty, tz)+Translation<float,N>(s)+Translation<float,N>(vecN)\endcode</td></tr>+<tr class="alt"><td>+N-D \ref TutorialGeoTransform "Affine transformation"</td><td>\code+Transform<float,N,Affine> t = concatenation_of_any_transformations;+Transform<float,3,Affine> t = Translation3f(p) * AngleAxisf(a,axis) * Scaling(s);\endcode</td></tr>+<tr><td>+N-D Linear transformations \n+<em class=note>(pure rotations, \n scaling, etc.)</em></td><td>\code+Matrix<float,N> t = concatenation_of_rotations_and_scalings;+Matrix<float,2> t = Rotation2Df(a) * Scaling(s);+Matrix<float,3> t = AngleAxisf(a,axis) * Scaling(s);\endcode</td></tr>+</table>++<strong>Notes on rotations</strong>\n To transform more than a single vector the preferred+representations are rotation matrices, while for other usages Quaternion is the+representation of choice as they are compact, fast and stable. Finally Rotation2D and+AngleAxis are mainly convenient types to create other rotation objects.++<strong>Notes on Translation and Scaling</strong>\n Like AngleAxis, these classes were+designed to simplify the creation/initialization of linear (Matrix) and affine (Transform)+transformations. Nevertheless, unlike AngleAxis which is inefficient to use, these classes+might still be interesting to write generic and efficient algorithms taking as input any+kind of transformations.++Any of the above transformation types can be converted to any other types of the same nature,+or to a more generic type. Here are some additional examples:+<table class="manual">+<tr><td>\code+Rotation2Df r;  r  = Matrix2f(..);       // assumes a pure rotation matrix+AngleAxisf aa;  aa = Quaternionf(..);+AngleAxisf aa;  aa = Matrix3f(..);       // assumes a pure rotation matrix+Matrix2f m;     m  = Rotation2Df(..);+Matrix3f m;     m  = Quaternionf(..);       Matrix3f m;   m = Scaling(..);+Affine3f m;     m  = AngleAxis3f(..);       Affine3f m;   m = Scaling(..);+Affine3f m;     m  = Translation3f(..);     Affine3f m;   m = Matrix3f(..);+\endcode</td></tr>+</table>+++<a href="#" class="top">top</a>\section TutorialGeoCommontransformationAPI Common API across transformation types++To some extent, Eigen's \ref Geometry_Module "geometry module" allows you to write+generic algorithms working on any kind of transformation representations:+<table class="manual">+<tr><td>+Concatenation of two transformations</td><td>\code+gen1 * gen2;\endcode</td></tr>+<tr class="alt"><td>Apply the transformation to a vector</td><td>\code+vec2 = gen1 * vec1;\endcode</td></tr>+<tr><td>Get the inverse of the transformation</td><td>\code+gen2 = gen1.inverse();\endcode</td></tr>+<tr class="alt"><td>Spherical interpolation \n (Rotation2D and Quaternion only)</td><td>\code+rot3 = rot1.slerp(alpha,rot2);\endcode</td></tr>+</table>++++<a href="#" class="top">top</a>\section TutorialGeoTransform Affine transformations+Generic affine transformations are represented by the Transform class which internaly+is a (Dim+1)^2 matrix. In Eigen we have chosen to not distinghish between points and+vectors such that all points are actually represented by displacement vectors from the+origin ( \f$ \mathbf{p} \equiv \mathbf{p}-0 \f$ ). With that in mind, real points and+vector distinguish when the transformation is applied.+<table class="manual">+<tr><td>+Apply the transformation to a \b point </td><td>\code+VectorNf p1, p2;+p2 = t * p1;\endcode</td></tr>+<tr class="alt"><td>+Apply the transformation to a \b vector </td><td>\code+VectorNf vec1, vec2;+vec2 = t.linear() * vec1;\endcode</td></tr>+<tr><td>+Apply a \em general transformation \n to a \b normal \b vector \n+</td><td>\code+VectorNf n1, n2;+MatrixNf normalMatrix = t.linear().inverse().transpose();+n2 = (normalMatrix * n1).normalized();\endcode</td></tr>+<tr><td colspan="2">(See subject 5.27 of this <a href="http://www.faqs.org/faqs/graphics/algorithms-faq">faq</a> for the explanations)</td></tr>+<tr class="alt"><td>+Apply a transformation with \em pure \em rotation \n to a \b normal \b vector+(no scaling, no shear)</td><td>\code+n2 = t.linear() * n1;\endcode</td></tr>+<tr><td>+OpenGL compatibility \b 3D </td><td>\code+glLoadMatrixf(t.data());\endcode</td></tr>+<tr class="alt"><td>+OpenGL compatibility \b 2D </td><td>\code+Affine3f aux(Affine3f::Identity());+aux.linear().topLeftCorner<2,2>() = t.linear();+aux.translation().start<2>() = t.translation();+glLoadMatrixf(aux.data());\endcode</td></tr>+</table>++\b Component \b accessors+<table class="manual">+<tr><td>+full read-write access to the internal matrix</td><td>\code+t.matrix() = matN1xN1;    // N1 means N+1+matN1xN1 = t.matrix();+\endcode</td></tr>+<tr class="alt"><td>+coefficient accessors</td><td>\code+t(i,j) = scalar;   <=>   t.matrix()(i,j) = scalar;+scalar = t(i,j);   <=>   scalar = t.matrix()(i,j);+\endcode</td></tr>+<tr><td>+translation part</td><td>\code+t.translation() = vecN;+vecN = t.translation();+\endcode</td></tr>+<tr class="alt"><td>+linear part</td><td>\code+t.linear() = matNxN;+matNxN = t.linear();+\endcode</td></tr>+<tr><td>+extract the rotation matrix</td><td>\code+matNxN = t.rotation();+\endcode</td></tr>+</table>+++\b Transformation \b creation \n+While transformation objects can be created and updated concatenating elementary transformations,+the Transform class also features a procedural API:+<table class="manual">+<tr><th></th><th>procedural API</th><th>equivalent natural API </th></tr>+<tr><td>Translation</td><td>\code+t.translate(Vector_(tx,ty,..));+t.pretranslate(Vector_(tx,ty,..));+\endcode</td><td>\code+t *= Translation_(tx,ty,..);+t = Translation_(tx,ty,..) * t;+\endcode</td></tr>+<tr class="alt"><td>\b Rotation \n <em class="note">In 2D and for the procedural API, any_rotation can also \n be an angle in radian</em></td><td>\code+t.rotate(any_rotation);+t.prerotate(any_rotation);+\endcode</td><td>\code+t *= any_rotation;+t = any_rotation * t;+\endcode</td></tr>+<tr><td>Scaling</td><td>\code+t.scale(Vector_(sx,sy,..));+t.scale(s);+t.prescale(Vector_(sx,sy,..));+t.prescale(s);+\endcode</td><td>\code+t *= Scaling(sx,sy,..);+t *= Scaling(s);+t = Scaling(sx,sy,..) * t;+t = Scaling(s) * t;+\endcode</td></tr>+<tr class="alt"><td>Shear transformation \n ( \b 2D \b only ! )</td><td>\code+t.shear(sx,sy);+t.preshear(sx,sy);+\endcode</td><td></td></tr>+</table>++Note that in both API, any many transformations can be concatenated in a single expression as shown in the two following equivalent examples:+<table class="manual">+<tr><td>\code+t.pretranslate(..).rotate(..).translate(..).scale(..);+\endcode</td></tr>+<tr><td>\code+t = Translation_(..) * t * RotationType(..) * Translation_(..) * Scaling(..);+\endcode</td></tr>+</table>++++<a href="#" class="top">top</a>\section TutorialGeoEulerAngles Euler angles+<table class="manual">+<tr><td style="max-width:30em;">+Euler angles might be convenient to create rotation objects.+On the other hand, since there exist 24 different conventions, they are pretty confusing to use. This example shows how+to create a rotation matrix according to the 2-1-2 convention.</td><td>\code+Matrix3f m;+m = AngleAxisf(angle1, Vector3f::UnitZ())+  * AngleAxisf(angle2, Vector3f::UnitY())+  * AngleAxisf(angle3, Vector3f::UnitZ());+\endcode</td></tr>+</table>++*/++}
+ eigen3/doc/TutorialLinearAlgebra.dox view
@@ -0,0 +1,292 @@+namespace Eigen {++/** \eigenManualPage TutorialLinearAlgebra Linear algebra and decompositions++This page explains how to solve linear systems, compute various decompositions such as LU,+QR, %SVD, eigendecompositions... After reading this page, don't miss our+\link TopicLinearAlgebraDecompositions catalogue \endlink of dense matrix decompositions.++\eigenAutoToc++\section TutorialLinAlgBasicSolve Basic linear solving++\b The \b problem: You have a system of equations, that you have written as a single matrix equation+    \f[ Ax \: = \: b \f]+Where \a A and \a b are matrices (\a b could be a vector, as a special case). You want to find a solution \a x.++\b The \b solution: You can choose between various decompositions, depending on what your matrix \a A looks like,+and depending on whether you favor speed or accuracy. However, let's start with an example that works in all cases,+and is a good compromise:+<table class="example">+<tr><th>Example:</th><th>Output:</th></tr>+<tr>+  <td>\include TutorialLinAlgExSolveColPivHouseholderQR.cpp </td>+  <td>\verbinclude TutorialLinAlgExSolveColPivHouseholderQR.out </td>+</tr>+</table>++In this example, the colPivHouseholderQr() method returns an object of class ColPivHouseholderQR. Since here the+matrix is of type Matrix3f, this line could have been replaced by:+\code+ColPivHouseholderQR<Matrix3f> dec(A);+Vector3f x = dec.solve(b);+\endcode++Here, ColPivHouseholderQR is a QR decomposition with column pivoting. It's a good compromise for this tutorial, as it+works for all matrices while being quite fast. Here is a table of some other decompositions that you can choose from,+depending on your matrix and the trade-off you want to make:++<table class="manual">+    <tr>+        <th>Decomposition</th>+        <th>Method</th>+        <th>Requirements<br/>on the matrix</th>+        <th>Speed<br/> (small-to-medium)</th>+        <th>Speed<br/> (large)</th>+        <th>Accuracy</th>+    </tr>+    <tr>+        <td>PartialPivLU</td>+        <td>partialPivLu()</td>+        <td>Invertible</td>+        <td>++</td>+        <td>++</td>+        <td>+</td>+    </tr>+    <tr class="alt">+        <td>FullPivLU</td>+        <td>fullPivLu()</td>+        <td>None</td>+        <td>-</td>+        <td>- -</td>+        <td>+++</td>+    </tr>+    <tr>+        <td>HouseholderQR</td>+        <td>householderQr()</td>+        <td>None</td>+        <td>++</td>+        <td>++</td>+        <td>+</td>+    </tr>+    <tr class="alt">+        <td>ColPivHouseholderQR</td>+        <td>colPivHouseholderQr()</td>+        <td>None</td>+        <td>+</td>+        <td>-</td>+        <td>+++</td>+    </tr>+    <tr>+        <td>FullPivHouseholderQR</td>+        <td>fullPivHouseholderQr()</td>+        <td>None</td>+        <td>-</td>+        <td>- -</td>+        <td>+++</td>+    </tr>+    <tr class="alt">+        <td>CompleteOrthogonalDecomposition</td>+        <td>completeOrthogonalDecomposition()</td>+        <td>None</td>+        <td>+</td>+        <td>-</td>+        <td>+++</td>+    </tr>+    <tr class="alt">+        <td>LLT</td>+        <td>llt()</td>+        <td>Positive definite</td>+        <td>+++</td>+        <td>+++</td>+        <td>+</td>+    </tr>+    <tr>+        <td>LDLT</td>+        <td>ldlt()</td>+        <td>Positive or negative<br/> semidefinite</td>+        <td>+++</td>+        <td>+</td>+        <td>++</td>+    </tr>+    <tr class="alt">+        <td>BDCSVD</td>+        <td>bdcSvd()</td>+        <td>None</td>+        <td>-</td>+        <td>-</td>+        <td>+++</td>+    </tr>+    <tr class="alt">+        <td>JacobiSVD</td>+        <td>jacobiSvd()</td>+        <td>None</td>+        <td>-</td>+        <td>- - -</td>+        <td>+++</td>+    </tr>+</table>+To get an overview of the true relative speed of the different decompositions, check this \link DenseDecompositionBenchmark benchmark \endlink.++All of these decompositions offer a solve() method that works as in the above example.++For example, if your matrix is positive definite, the above table says that a very good+choice is then the LLT or LDLT decomposition. Here's an example, also demonstrating that using a general+matrix (not a vector) as right hand side is possible.++<table class="example">+<tr><th>Example:</th><th>Output:</th></tr>+<tr>+  <td>\include TutorialLinAlgExSolveLDLT.cpp </td>+  <td>\verbinclude TutorialLinAlgExSolveLDLT.out </td>+</tr>+</table>++For a \ref TopicLinearAlgebraDecompositions "much more complete table" comparing all decompositions supported by Eigen (notice that Eigen+supports many other decompositions), see our special page on+\ref TopicLinearAlgebraDecompositions "this topic".++\section TutorialLinAlgSolutionExists Checking if a solution really exists++Only you know what error margin you want to allow for a solution to be considered valid.+So Eigen lets you do this computation for yourself, if you want to, as in this example:++<table class="example">+<tr><th>Example:</th><th>Output:</th></tr>+<tr>+  <td>\include TutorialLinAlgExComputeSolveError.cpp </td>+  <td>\verbinclude TutorialLinAlgExComputeSolveError.out </td>+</tr>+</table>++\section TutorialLinAlgEigensolving Computing eigenvalues and eigenvectors++You need an eigendecomposition here, see available such decompositions on \ref TopicLinearAlgebraDecompositions "this page".+Make sure to check if your matrix is self-adjoint, as is often the case in these problems. Here's an example using+SelfAdjointEigenSolver, it could easily be adapted to general matrices using EigenSolver or ComplexEigenSolver.++The computation of eigenvalues and eigenvectors does not necessarily converge, but such failure to converge is+very rare. The call to info() is to check for this possibility.++<table class="example">+<tr><th>Example:</th><th>Output:</th></tr>+<tr>+  <td>\include TutorialLinAlgSelfAdjointEigenSolver.cpp </td>+  <td>\verbinclude TutorialLinAlgSelfAdjointEigenSolver.out </td>+</tr>+</table>++\section TutorialLinAlgInverse Computing inverse and determinant++First of all, make sure that you really want this. While inverse and determinant are fundamental mathematical concepts,+in \em numerical linear algebra they are not as popular as in pure mathematics. Inverse computations are often+advantageously replaced by solve() operations, and the determinant is often \em not a good way of checking if a matrix+is invertible.++However, for \em very \em small matrices, the above is not true, and inverse and determinant can be very useful.++While certain decompositions, such as PartialPivLU and FullPivLU, offer inverse() and determinant() methods, you can also+call inverse() and determinant() directly on a matrix. If your matrix is of a very small fixed size (at most 4x4) this+allows Eigen to avoid performing a LU decomposition, and instead use formulas that are more efficient on such small matrices.++Here is an example:+<table class="example">+<tr><th>Example:</th><th>Output:</th></tr>+<tr>+  <td>\include TutorialLinAlgInverseDeterminant.cpp </td>+  <td>\verbinclude TutorialLinAlgInverseDeterminant.out </td>+</tr>+</table>++\section TutorialLinAlgLeastsquares Least squares solving++The most accurate method to do least squares solving is with a SVD decomposition.+Eigen provides two implementations.+The recommended one is the BDCSVD class, which scale well for large problems+and automatically fall-back to the JacobiSVD class for smaller problems.+For both classes, their solve() method is doing least-squares solving.++Here is an example:+<table class="example">+<tr><th>Example:</th><th>Output:</th></tr>+<tr>+  <td>\include TutorialLinAlgSVDSolve.cpp </td>+  <td>\verbinclude TutorialLinAlgSVDSolve.out </td>+</tr>+</table>++Another methods, potentially faster but less reliable, are to use a Cholesky decomposition of the+normal matrix or a QR decomposition. Our page on \link LeastSquares least squares solving \endlink+has more details.+++\section TutorialLinAlgSeparateComputation Separating the computation from the construction++In the above examples, the decomposition was computed at the same time that the decomposition object was constructed.+There are however situations where you might want to separate these two things, for example if you don't know,+at the time of the construction, the matrix that you will want to decompose; or if you want to reuse an existing+decomposition object.++What makes this possible is that:+\li all decompositions have a default constructor,+\li all decompositions have a compute(matrix) method that does the computation, and that may be called again+    on an already-computed decomposition, reinitializing it.++For example:++<table class="example">+<tr><th>Example:</th><th>Output:</th></tr>+<tr>+  <td>\include TutorialLinAlgComputeTwice.cpp </td>+  <td>\verbinclude TutorialLinAlgComputeTwice.out </td>+</tr>+</table>++Finally, you can tell the decomposition constructor to preallocate storage for decomposing matrices of a given size,+so that when you subsequently decompose such matrices, no dynamic memory allocation is performed (of course, if you+are using fixed-size matrices, no dynamic memory allocation happens at all). This is done by just+passing the size to the decomposition constructor, as in this example:+\code+HouseholderQR<MatrixXf> qr(50,50);+MatrixXf A = MatrixXf::Random(50,50);+qr.compute(A); // no dynamic memory allocation+\endcode++\section TutorialLinAlgRankRevealing Rank-revealing decompositions++Certain decompositions are rank-revealing, i.e. are able to compute the rank of a matrix. These are typically+also the decompositions that behave best in the face of a non-full-rank matrix (which in the square case means a+singular matrix). On \ref TopicLinearAlgebraDecompositions "this table" you can see for all our decompositions+whether they are rank-revealing or not.++Rank-revealing decompositions offer at least a rank() method. They can also offer convenience methods such as isInvertible(),+and some are also providing methods to compute the kernel (null-space) and image (column-space) of the matrix, as is the+case with FullPivLU:++<table class="example">+<tr><th>Example:</th><th>Output:</th></tr>+<tr>+  <td>\include TutorialLinAlgRankRevealing.cpp </td>+  <td>\verbinclude TutorialLinAlgRankRevealing.out </td>+</tr>+</table>++Of course, any rank computation depends on the choice of an arbitrary threshold, since practically no+floating-point matrix is \em exactly rank-deficient. Eigen picks a sensible default threshold, which depends+on the decomposition but is typically the diagonal size times machine epsilon. While this is the best default we+could pick, only you know what is the right threshold for your application. You can set this by calling setThreshold()+on your decomposition object before calling rank() or any other method that needs to use such a threshold.+The decomposition itself, i.e. the compute() method, is independent of the threshold. You don't need to recompute the+decomposition after you've changed the threshold.++<table class="example">+<tr><th>Example:</th><th>Output:</th></tr>+<tr>+  <td>\include TutorialLinAlgSetThreshold.cpp </td>+  <td>\verbinclude TutorialLinAlgSetThreshold.out </td>+</tr>+</table>++*/++}
+ eigen3/doc/TutorialMapClass.dox view
@@ -0,0 +1,86 @@+namespace Eigen {++/** \eigenManualPage TutorialMapClass Interfacing with raw buffers: the Map class++This page explains how to work with "raw" C/C++ arrays.+This can be useful in a variety of contexts, particularly when "importing" vectors and matrices from other libraries into %Eigen.++\eigenAutoToc++\section TutorialMapIntroduction Introduction++Occasionally you may have a pre-defined array of numbers that you want to use within %Eigen as a vector or matrix. While one option is to make a copy of the data, most commonly you probably want to re-use this memory as an %Eigen type. Fortunately, this is very easy with the Map class.++\section TutorialMapTypes Map types and declaring Map variables++A Map object has a type defined by its %Eigen equivalent:+\code+Map<Matrix<typename Scalar, int RowsAtCompileTime, int ColsAtCompileTime> >+\endcode+Note that, in this default case, a Map requires just a single template parameter.  ++To construct a Map variable, you need two other pieces of information: a pointer to the region of memory defining the array of coefficients, and the desired shape of the matrix or vector.  For example, to define a matrix of \c float with sizes determined at compile time, you might do the following:+\code+Map<MatrixXf> mf(pf,rows,columns);+\endcode+where \c pf is a \c float \c * pointing to the array of memory.  A fixed-size read-only vector of integers might be declared as+\code+Map<const Vector4i> mi(pi);+\endcode+where \c pi is an \c int \c *. In this case the size does not have to be passed to the constructor, because it is already specified by the Matrix/Array type.++Note that Map does not have a default constructor; you \em must pass a pointer to intialize the object. However, you can work around this requirement (see \ref TutorialMapPlacementNew).++Map is flexible enough to accomodate a variety of different data representations.  There are two other (optional) template parameters:+\code+Map<typename MatrixType,+    int MapOptions,+    typename StrideType>+\endcode+\li \c MapOptions specifies whether the pointer is \c #Aligned, or \c #Unaligned.  The default is \c #Unaligned.+\li \c StrideType allows you to specify a custom layout for the memory array, using the Stride class.  One example would be to specify that the data array is organized in row-major format:+<table class="example">+<tr><th>Example:</th><th>Output:</th></tr>+<tr>+<td>\include Tutorial_Map_rowmajor.cpp </td>+<td>\verbinclude Tutorial_Map_rowmajor.out </td>+</table>+However, Stride is even more flexible than this; for details, see the documentation for the Map and Stride classes.++\section TutorialMapUsing Using Map variables++You can use a Map object just like any other %Eigen type:+<table class="example">+<tr><th>Example:</th><th>Output:</th></tr>+<tr>+<td>\include Tutorial_Map_using.cpp </td>+<td>\verbinclude Tutorial_Map_using.out </td>+</table>++All %Eigen functions are written to accept Map objects just like other %Eigen types. However, when writing your own functions taking %Eigen types, this does \em not happen automatically: a Map type is not identical to its Dense equivalent.  See \ref TopicFunctionTakingEigenTypes for details.++\section TutorialMapPlacementNew Changing the mapped array++It is possible to change the array of a Map object after declaration, using the C++ "placement new" syntax:+<table class="example">+<tr><th>Example:</th><th>Output:</th></tr>+<tr>+<td>\include Map_placement_new.cpp </td>+<td>\verbinclude Map_placement_new.out </td>+</table>+Despite appearances, this does not invoke the memory allocator, because the syntax specifies the location for storing the result.++This syntax makes it possible to declare a Map object without first knowing the mapped array's location in memory:+\code+Map<Matrix3f> A(NULL);  // don't try to use this matrix yet!+VectorXf b(n_matrices);+for (int i = 0; i < n_matrices; i++)+{+  new (&A) Map<Matrix3f>(get_matrix_pointer(i));+  b(i) = A.trace();+}+\endcode++*/++}
+ eigen3/doc/TutorialMatrixArithmetic.dox view
@@ -0,0 +1,214 @@+namespace Eigen {++/** \eigenManualPage TutorialMatrixArithmetic Matrix and vector arithmetic++This page aims to provide an overview and some details on how to perform arithmetic+between matrices, vectors and scalars with Eigen.++\eigenAutoToc++\section TutorialArithmeticIntroduction Introduction++Eigen offers matrix/vector arithmetic operations either through overloads of common C++ arithmetic operators such as +, -, *,+or through special methods such as dot(), cross(), etc.+For the Matrix class (matrices and vectors), operators are only overloaded to support+linear-algebraic operations. For example, \c matrix1 \c * \c matrix2 means matrix-matrix product,+and \c vector \c + \c scalar is just not allowed. If you want to perform all kinds of array operations,+not linear algebra, see the \ref TutorialArrayClass "next page".++\section TutorialArithmeticAddSub Addition and subtraction++The left hand side and right hand side must, of course, have the same numbers of rows and of columns. They must+also have the same \c Scalar type, as Eigen doesn't do automatic type promotion. The operators at hand here are:+\li binary operator + as in \c a+b+\li binary operator - as in \c a-b+\li unary operator - as in \c -a+\li compound operator += as in \c a+=b+\li compound operator -= as in \c a-=b++<table class="example">+<tr><th>Example:</th><th>Output:</th></tr>+<tr><td>+\include tut_arithmetic_add_sub.cpp+</td>+<td>+\verbinclude tut_arithmetic_add_sub.out+</td></tr></table>++\section TutorialArithmeticScalarMulDiv Scalar multiplication and division++Multiplication and division by a scalar is very simple too. The operators at hand here are:+\li binary operator * as in \c matrix*scalar+\li binary operator * as in \c scalar*matrix+\li binary operator / as in \c matrix/scalar+\li compound operator *= as in \c matrix*=scalar+\li compound operator /= as in \c matrix/=scalar++<table class="example">+<tr><th>Example:</th><th>Output:</th></tr>+<tr><td>+\include tut_arithmetic_scalar_mul_div.cpp+</td>+<td>+\verbinclude tut_arithmetic_scalar_mul_div.out+</td></tr></table>+++\section TutorialArithmeticMentionXprTemplates A note about expression templates++This is an advanced topic that we explain on \ref TopicEigenExpressionTemplates "this page",+but it is useful to just mention it now. In Eigen, arithmetic operators such as \c operator+ don't+perform any computation by themselves, they just return an "expression object" describing the computation to be+performed. The actual computation happens later, when the whole expression is evaluated, typically in \c operator=.+While this might sound heavy, any modern optimizing compiler is able to optimize away that abstraction and+the result is perfectly optimized code. For example, when you do:+\code+VectorXf a(50), b(50), c(50), d(50);+...+a = 3*b + 4*c + 5*d;+\endcode+Eigen compiles it to just one for loop, so that the arrays are traversed only once. Simplifying (e.g. ignoring+SIMD optimizations), this loop looks like this:+\code+for(int i = 0; i < 50; ++i)+  a[i] = 3*b[i] + 4*c[i] + 5*d[i];+\endcode+Thus, you should not be afraid of using relatively large arithmetic expressions with Eigen: it only gives Eigen+more opportunities for optimization.++\section TutorialArithmeticTranspose Transposition and conjugation++The transpose \f$ a^T \f$, conjugate \f$ \bar{a} \f$, and adjoint (i.e., conjugate transpose) \f$ a^* \f$ of a matrix or vector \f$ a \f$ are obtained by the member functions \link DenseBase::transpose() transpose()\endlink, \link MatrixBase::conjugate() conjugate()\endlink, and \link MatrixBase::adjoint() adjoint()\endlink, respectively.++<table class="example">+<tr><th>Example:</th><th>Output:</th></tr>+<tr><td>+\include tut_arithmetic_transpose_conjugate.cpp+</td>+<td>+\verbinclude tut_arithmetic_transpose_conjugate.out+</td></tr></table>++For real matrices, \c conjugate() is a no-operation, and so \c adjoint() is equivalent to \c transpose().++As for basic arithmetic operators, \c transpose() and \c adjoint() simply return a proxy object without doing the actual transposition. If you do <tt>b = a.transpose()</tt>, then the transpose is evaluated at the same time as the result is written into \c b. However, there is a complication here. If you do <tt>a = a.transpose()</tt>, then Eigen starts writing the result into \c a before the evaluation of the transpose is finished. Therefore, the instruction <tt>a = a.transpose()</tt> does not replace \c a with its transpose, as one would expect:+<table class="example">+<tr><th>Example:</th><th>Output:</th></tr>+<tr><td>+\include tut_arithmetic_transpose_aliasing.cpp+</td>+<td>+\verbinclude tut_arithmetic_transpose_aliasing.out+</td></tr></table>+This is the so-called \ref TopicAliasing "aliasing issue". In "debug mode", i.e., when \ref TopicAssertions "assertions" have not been disabled, such common pitfalls are automatically detected. ++For \em in-place transposition, as for instance in <tt>a = a.transpose()</tt>, simply use the \link DenseBase::transposeInPlace() transposeInPlace()\endlink  function:+<table class="example">+<tr><th>Example:</th><th>Output:</th></tr>+<tr><td>+\include tut_arithmetic_transpose_inplace.cpp+</td>+<td>+\verbinclude tut_arithmetic_transpose_inplace.out+</td></tr></table>+There is also the \link MatrixBase::adjointInPlace() adjointInPlace()\endlink function for complex matrices.++\section TutorialArithmeticMatrixMul Matrix-matrix and matrix-vector multiplication++Matrix-matrix multiplication is again done with \c operator*. Since vectors are a special+case of matrices, they are implicitly handled there too, so matrix-vector product is really just a special+case of matrix-matrix product, and so is vector-vector outer product. Thus, all these cases are handled by just+two operators:+\li binary operator * as in \c a*b+\li compound operator *= as in \c a*=b (this multiplies on the right: \c a*=b is equivalent to <tt>a = a*b</tt>)++<table class="example">+<tr><th>Example:</th><th>Output:</th></tr>+<tr><td>+\include tut_arithmetic_matrix_mul.cpp+</td>+<td>+\verbinclude tut_arithmetic_matrix_mul.out+</td></tr></table>++Note: if you read the above paragraph on expression templates and are worried that doing \c m=m*m might cause+aliasing issues, be reassured for now: Eigen treats matrix multiplication as a special case and takes care of+introducing a temporary here, so it will compile \c m=m*m as:+\code+tmp = m*m;+m = tmp;+\endcode+If you know your matrix product can be safely evaluated into the destination matrix without aliasing issue, then you can use the \link MatrixBase::noalias() noalias()\endlink function to avoid the temporary, e.g.:+\code+c.noalias() += a * b;+\endcode+For more details on this topic, see the page on \ref TopicAliasing "aliasing".++\b Note: for BLAS users worried about performance, expressions such as <tt>c.noalias() -= 2 * a.adjoint() * b;</tt> are fully optimized and trigger a single gemm-like function call.++\section TutorialArithmeticDotAndCross Dot product and cross product++For dot product and cross product, you need the \link MatrixBase::dot() dot()\endlink and \link MatrixBase::cross() cross()\endlink methods. Of course, the dot product can also be obtained as a 1x1 matrix as u.adjoint()*v.+<table class="example">+<tr><th>Example:</th><th>Output:</th></tr>+<tr><td>+\include tut_arithmetic_dot_cross.cpp+</td>+<td>+\verbinclude tut_arithmetic_dot_cross.out+</td></tr></table>++Remember that cross product is only for vectors of size 3. Dot product is for vectors of any sizes.+When using complex numbers, Eigen's dot product is conjugate-linear in the first variable and linear in the+second variable.++\section TutorialArithmeticRedux Basic arithmetic reduction operations+Eigen also provides some reduction operations to reduce a given matrix or vector to a single value such as the sum (computed by \link DenseBase::sum() sum()\endlink), product (\link DenseBase::prod() prod()\endlink), or the maximum (\link DenseBase::maxCoeff() maxCoeff()\endlink) and minimum (\link DenseBase::minCoeff() minCoeff()\endlink) of all its coefficients.++<table class="example">+<tr><th>Example:</th><th>Output:</th></tr>+<tr><td>+\include tut_arithmetic_redux_basic.cpp+</td>+<td>+\verbinclude tut_arithmetic_redux_basic.out+</td></tr></table>++The \em trace of a matrix, as returned by the function \link MatrixBase::trace() trace()\endlink, is the sum of the diagonal coefficients and can also be computed as efficiently using <tt>a.diagonal().sum()</tt>, as we will see later on.++There also exist variants of the \c minCoeff and \c maxCoeff functions returning the coordinates of the respective coefficient via the arguments:++<table class="example">+<tr><th>Example:</th><th>Output:</th></tr>+<tr><td>+\include tut_arithmetic_redux_minmax.cpp+</td>+<td>+\verbinclude tut_arithmetic_redux_minmax.out+</td></tr></table>+++\section TutorialArithmeticValidity Validity of operations+Eigen checks the validity of the operations that you perform. When possible,+it checks them at compile time, producing compilation errors. These error messages can be long and ugly,+but Eigen writes the important message in UPPERCASE_LETTERS_SO_IT_STANDS_OUT. For example:+\code+  Matrix3f m;+  Vector4f v;+  v = m*v;      // Compile-time error: YOU_MIXED_MATRICES_OF_DIFFERENT_SIZES+\endcode++Of course, in many cases, for example when checking dynamic sizes, the check cannot be performed at compile time.+Eigen then uses runtime assertions. This means that the program will abort with an error message when executing an illegal operation if it is run in "debug mode", and it will probably crash if assertions are turned off.++\code+  MatrixXf m(3,3);+  VectorXf v(4);+  v = m * v; // Run-time assertion failure here: "invalid matrix product"+\endcode++For more details on this topic, see \ref TopicAssertions "this page".++*/++}
+ eigen3/doc/TutorialMatrixClass.dox view
@@ -0,0 +1,265 @@+namespace Eigen {++/** \eigenManualPage TutorialMatrixClass The Matrix class++\eigenAutoToc++In Eigen, all matrices and vectors are objects of the Matrix template class.+Vectors are just a special case of matrices, with either 1 row or 1 column.++\section TutorialMatrixFirst3Params The first three template parameters of Matrix++The Matrix class takes six template parameters, but for now it's enough to+learn about the first three first parameters. The three remaining parameters have default+values, which for now we will leave untouched, and which we+\ref TutorialMatrixOptTemplParams "discuss below".++The three mandatory template parameters of Matrix are:+\code+Matrix<typename Scalar, int RowsAtCompileTime, int ColsAtCompileTime>+\endcode+\li \c Scalar is the scalar type, i.e. the type of the coefficients.+    That is, if you want a matrix of floats, choose \c float here.+    See \ref TopicScalarTypes "Scalar types" for a list of all supported+    scalar types and for how to extend support to new types.+\li \c RowsAtCompileTime and \c ColsAtCompileTime are the number of rows+    and columns of the matrix as known at compile time (see +    \ref TutorialMatrixDynamic "below" for what to do if the number is not+    known at compile time).++We offer a lot of convenience typedefs to cover the usual cases. For example, \c Matrix4f is+a 4x4 matrix of floats. Here is how it is defined by Eigen:+\code+typedef Matrix<float, 4, 4> Matrix4f;+\endcode+We discuss \ref TutorialMatrixTypedefs "below" these convenience typedefs.++\section TutorialMatrixVectors Vectors++As mentioned above, in Eigen, vectors are just a special case of+matrices, with either 1 row or 1 column. The case where they have 1 column is the most common;+such vectors are called column-vectors, often abbreviated as just vectors. In the other case+where they have 1 row, they are called row-vectors.++For example, the convenience typedef \c Vector3f is a (column) vector of 3 floats. It is defined as follows by Eigen:+\code+typedef Matrix<float, 3, 1> Vector3f;+\endcode+We also offer convenience typedefs for row-vectors, for example:+\code+typedef Matrix<int, 1, 2> RowVector2i;+\endcode++\section TutorialMatrixDynamic The special value Dynamic++Of course, Eigen is not limited to matrices whose dimensions are known at compile time.+The \c RowsAtCompileTime and \c ColsAtCompileTime template parameters can take the special+value \c Dynamic which indicates that the size is unknown at compile time, so must+be handled as a run-time variable. In Eigen terminology, such a size is referred to as a+\em dynamic \em size; while a size that is known at compile time is called a+\em fixed \em size. For example, the convenience typedef \c MatrixXd, meaning+a matrix of doubles with dynamic size, is defined as follows:+\code+typedef Matrix<double, Dynamic, Dynamic> MatrixXd;+\endcode+And similarly, we define a self-explanatory typedef \c VectorXi as follows:+\code+typedef Matrix<int, Dynamic, 1> VectorXi;+\endcode+You can perfectly have e.g. a fixed number of rows with a dynamic number of columns, as in:+\code+Matrix<float, 3, Dynamic>+\endcode++\section TutorialMatrixConstructors Constructors++A default constructor is always available, never performs any dynamic memory allocation, and never initializes the matrix coefficients. You can do:+\code+Matrix3f a;+MatrixXf b;+\endcode+Here,+\li \c a is a 3-by-3 matrix, with a plain float[9] array of uninitialized coefficients,+\li \c b is a dynamic-size matrix whose size is currently 0-by-0, and whose array of+coefficients hasn't yet been allocated at all.++Constructors taking sizes are also available. For matrices, the number of rows is always passed first.+For vectors, just pass the vector size. They allocate the array of coefficients+with the given size, but don't initialize the coefficients themselves:+\code+MatrixXf a(10,15);+VectorXf b(30);+\endcode+Here,+\li \c a is a 10x15 dynamic-size matrix, with allocated but currently uninitialized coefficients.+\li \c b is a dynamic-size vector of size 30, with allocated but currently uninitialized coefficients.++In order to offer a uniform API across fixed-size and dynamic-size matrices, it is legal to use these+constructors on fixed-size matrices, even if passing the sizes is useless in this case. So this is legal:+\code+Matrix3f a(3,3);+\endcode+and is a no-operation.++Finally, we also offer some constructors to initialize the coefficients of small fixed-size vectors up to size 4:+\code+Vector2d a(5.0, 6.0);+Vector3d b(5.0, 6.0, 7.0);+Vector4d c(5.0, 6.0, 7.0, 8.0);+\endcode++\section TutorialMatrixCoeffAccessors Coefficient accessors++The primary coefficient accessors and mutators in Eigen are the overloaded parenthesis operators.+For matrices, the row index is always passed first. For vectors, just pass one index.+The numbering starts at 0. This example is self-explanatory:++<table class="example">+<tr><th>Example:</th><th>Output:</th></tr>+<tr><td>+\include tut_matrix_coefficient_accessors.cpp+</td>+<td>+\verbinclude tut_matrix_coefficient_accessors.out+</td></tr></table>++Note that the syntax <tt> m(index) </tt>+is not restricted to vectors, it is also available for general matrices, meaning index-based access+in the array of coefficients. This however depends on the matrix's storage order. All Eigen matrices default to+column-major storage order, but this can be changed to row-major, see \ref TopicStorageOrders "Storage orders".++The operator[] is also overloaded for index-based access in vectors, but keep in mind that C++ doesn't allow operator[] to+take more than one argument. We restrict operator[] to vectors, because an awkwardness in the C++ language+would make matrix[i,j] compile to the same thing as matrix[j] !++\section TutorialMatrixCommaInitializer Comma-initialization++%Matrix and vector coefficients can be conveniently set using the so-called \em comma-initializer syntax.+For now, it is enough to know this example:++<table class="example">+<tr><th>Example:</th><th>Output:</th></tr>+<tr>+<td>\include Tutorial_commainit_01.cpp </td>+<td>\verbinclude Tutorial_commainit_01.out </td>+</tr></table>+++The right-hand side can also contain matrix expressions as discussed in \ref TutorialAdvancedInitialization "this page".++\section TutorialMatrixSizesResizing Resizing++The current size of a matrix can be retrieved by \link EigenBase::rows() rows()\endlink, \link EigenBase::cols() cols() \endlink and \link EigenBase::size() size()\endlink. These methods return the number of rows, the number of columns and the number of coefficients, respectively. Resizing a dynamic-size matrix is done by the \link PlainObjectBase::resize(Index,Index) resize() \endlink method.++<table class="example">+<tr><th>Example:</th><th>Output:</th></tr>+<tr>+<td>\include tut_matrix_resize.cpp </td>+<td>\verbinclude tut_matrix_resize.out </td>+</tr></table>++The resize() method is a no-operation if the actual matrix size doesn't change; otherwise it is destructive: the values of the coefficients may change.+If you want a conservative variant of resize() which does not change the coefficients, use \link PlainObjectBase::conservativeResize() conservativeResize()\endlink, see \ref TopicResizing "this page" for more details.++All these methods are still available on fixed-size matrices, for the sake of API uniformity. Of course, you can't actually+resize a fixed-size matrix. Trying to change a fixed size to an actually different value will trigger an assertion failure;+but the following code is legal:++<table class="example">+<tr><th>Example:</th><th>Output:</th></tr>+<tr>+<td>\include tut_matrix_resize_fixed_size.cpp </td>+<td>\verbinclude tut_matrix_resize_fixed_size.out </td>+</tr></table>+++\section TutorialMatrixAssignment Assignment and resizing++Assignment is the action of copying a matrix into another, using \c operator=. Eigen resizes the matrix on the left-hand side automatically so that it matches the size of the matrix on the right-hand size. For example:++<table class="example">+<tr><th>Example:</th><th>Output:</th></tr>+<tr>+<td>\include tut_matrix_assignment_resizing.cpp </td>+<td>\verbinclude tut_matrix_assignment_resizing.out </td>+</tr></table>++Of course, if the left-hand side is of fixed size, resizing it is not allowed.++If you do not want this automatic resizing to happen (for example for debugging purposes), you can disable it, see+\ref TopicResizing "this page".+++\section TutorialMatrixFixedVsDynamic Fixed vs. Dynamic size++When should one use fixed sizes (e.g. \c Matrix4f), and when should one prefer dynamic sizes (e.g. \c MatrixXf)?+The simple answer is: use fixed+sizes for very small sizes where you can, and use dynamic sizes for larger sizes or where you have to. For small sizes,+especially for sizes smaller than (roughly) 16, using fixed sizes is hugely beneficial+to performance, as it allows Eigen to avoid dynamic memory allocation and to unroll+loops. Internally, a fixed-size Eigen matrix is just a plain array, i.e. doing+\code Matrix4f mymatrix; \endcode+really amounts to just doing+\code float mymatrix[16]; \endcode+so this really has zero runtime cost. By contrast, the array of a dynamic-size matrix+is always allocated on the heap, so doing+\code MatrixXf mymatrix(rows,columns); \endcode+amounts to doing+\code float *mymatrix = new float[rows*columns]; \endcode+and in addition to that, the MatrixXf object stores its number of rows and columns as+member variables.++The limitation of using fixed sizes, of course, is that this is only possible+when you know the sizes at compile time. Also, for large enough sizes, say for sizes+greater than (roughly) 32, the performance benefit of using fixed sizes becomes negligible.+Worse, trying to create a very large matrix using fixed sizes inside a function could result in a+stack overflow, since Eigen will try to allocate the array automatically as a local variable, and+this is normally done on the stack.+Finally, depending on circumstances, Eigen can also be more aggressive trying to vectorize+(use SIMD instructions) when dynamic sizes are used, see \ref TopicVectorization "Vectorization".++\section TutorialMatrixOptTemplParams Optional template parameters++We mentioned at the beginning of this page that the Matrix class takes six template parameters,+but so far we only discussed the first three. The remaining three parameters are optional. Here is+the complete list of template parameters:+\code+Matrix<typename Scalar,+       int RowsAtCompileTime,+       int ColsAtCompileTime,+       int Options = 0,+       int MaxRowsAtCompileTime = RowsAtCompileTime,+       int MaxColsAtCompileTime = ColsAtCompileTime>+\endcode+\li \c Options is a bit field. Here, we discuss only one bit: \c RowMajor. It specifies that the matrices+      of this type use row-major storage order; by default, the storage order is column-major. See the page on+      \ref TopicStorageOrders "storage orders". For example, this type means row-major 3x3 matrices:+      \code+      Matrix<float, 3, 3, RowMajor>+      \endcode+\li \c MaxRowsAtCompileTime and \c MaxColsAtCompileTime are useful when you want to specify that, even though+      the exact sizes of your matrices are not known at compile time, a fixed upper bound is known at+      compile time. The biggest reason why you might want to do that is to avoid dynamic memory allocation.+      For example the following matrix type uses a plain array of 12 floats, without dynamic memory allocation:+      \code+      Matrix<float, Dynamic, Dynamic, 0, 3, 4>+      \endcode++\section TutorialMatrixTypedefs Convenience typedefs++Eigen defines the following Matrix typedefs:+\li MatrixNt for Matrix<type, N, N>. For example, MatrixXi for Matrix<int, Dynamic, Dynamic>.+\li VectorNt for Matrix<type, N, 1>. For example, Vector2f for Matrix<float, 2, 1>.+\li RowVectorNt for Matrix<type, 1, N>. For example, RowVector3d for Matrix<double, 1, 3>.++Where:+\li N can be any one of \c 2, \c 3, \c 4, or \c X (meaning \c Dynamic).+\li t can be any one of \c i (meaning int), \c f (meaning float), \c d (meaning double),+      \c cf (meaning complex<float>), or \c cd (meaning complex<double>). The fact that typedefs are only+    defined for these five types doesn't mean that they are the only supported scalar types. For example,+    all standard integer types are supported, see \ref TopicScalarTypes "Scalar types".+++*/++}
+ eigen3/doc/TutorialReductionsVisitorsBroadcasting.dox view
@@ -0,0 +1,266 @@+namespace Eigen {++/** \eigenManualPage TutorialReductionsVisitorsBroadcasting Reductions, visitors and broadcasting++This page explains Eigen's reductions, visitors and broadcasting and how they are used with+\link MatrixBase matrices \endlink and \link ArrayBase arrays \endlink.++\eigenAutoToc++\section TutorialReductionsVisitorsBroadcastingReductions Reductions+In Eigen, a reduction is a function taking a matrix or array, and returning a single+scalar value. One of the most used reductions is \link DenseBase::sum() .sum() \endlink,+returning the sum of all the coefficients inside a given matrix or array.++<table class="example">+<tr><th>Example:</th><th>Output:</th></tr>+<tr><td>+\include tut_arithmetic_redux_basic.cpp+</td>+<td>+\verbinclude tut_arithmetic_redux_basic.out+</td></tr></table>++The \em trace of a matrix, as returned by the function \c trace(), is the sum of the diagonal coefficients and can equivalently be computed <tt>a.diagonal().sum()</tt>.+++\subsection TutorialReductionsVisitorsBroadcastingReductionsNorm Norm computations++The (Euclidean a.k.a. \f$\ell^2\f$) squared norm of a vector can be obtained \link MatrixBase::squaredNorm() squaredNorm() \endlink. It is equal to the dot product of the vector by itself, and equivalently to the sum of squared absolute values of its coefficients.++Eigen also provides the \link MatrixBase::norm() norm() \endlink method, which returns the square root of \link MatrixBase::squaredNorm() squaredNorm() \endlink.++These operations can also operate on matrices; in that case, a n-by-p matrix is seen as a vector of size (n*p), so for example the \link MatrixBase::norm() norm() \endlink method returns the "Frobenius" or "Hilbert-Schmidt" norm. We refrain from speaking of the \f$\ell^2\f$ norm of a matrix because that can mean different things.++If you want other coefficient-wise \f$\ell^p\f$ norms, use the \link MatrixBase::lpNorm lpNorm<p>() \endlink method. The template parameter \a p can take the special value \a Infinity if you want the \f$\ell^\infty\f$ norm, which is the maximum of the absolute values of the coefficients.++The following example demonstrates these methods.++<table class="example">+<tr><th>Example:</th><th>Output:</th></tr>+<tr><td>+\include Tutorial_ReductionsVisitorsBroadcasting_reductions_norm.cpp+</td>+<td>+\verbinclude Tutorial_ReductionsVisitorsBroadcasting_reductions_norm.out+</td></tr></table>++\b Operator \b norm: The 1-norm and \f$\infty\f$-norm <a href="https://en.wikipedia.org/wiki/Operator_norm">matrix operator norms</a> can easily be computed as follows:+<table class="example">+<tr><th>Example:</th><th>Output:</th></tr>+<tr><td>+\include Tutorial_ReductionsVisitorsBroadcasting_reductions_operatornorm.cpp+</td>+<td>+\verbinclude Tutorial_ReductionsVisitorsBroadcasting_reductions_operatornorm.out+</td></tr></table>+See below for more explanations on the syntax of these expressions.++\subsection TutorialReductionsVisitorsBroadcastingReductionsBool Boolean reductions++The following reductions operate on boolean values:+  - \link DenseBase::all() all() \endlink returns \b true if all of the coefficients in a given Matrix or Array evaluate to \b true .+  - \link DenseBase::any() any() \endlink returns \b true if at least one of the coefficients in a given Matrix or Array evaluates to \b true .+  - \link DenseBase::count() count() \endlink returns the number of coefficients in a given Matrix or Array that evaluate to  \b true.++These are typically used in conjunction with the coefficient-wise comparison and equality operators provided by Array. For instance, <tt>array > 0</tt> is an %Array of the same size as \c array , with \b true at those positions where the corresponding coefficient of \c array is positive. Thus, <tt>(array > 0).all()</tt> tests whether all coefficients of \c array are positive. This can be seen in the following example:++<table class="example">+<tr><th>Example:</th><th>Output:</th></tr>+<tr><td>+\include Tutorial_ReductionsVisitorsBroadcasting_reductions_bool.cpp+</td>+<td>+\verbinclude Tutorial_ReductionsVisitorsBroadcasting_reductions_bool.out+</td></tr></table>++\subsection TutorialReductionsVisitorsBroadcastingReductionsUserdefined User defined reductions++TODO++In the meantime you can have a look at the DenseBase::redux() function.++\section TutorialReductionsVisitorsBroadcastingVisitors Visitors+Visitors are useful when one wants to obtain the location of a coefficient inside +a Matrix or Array. The simplest examples are +\link MatrixBase::maxCoeff() maxCoeff(&x,&y) \endlink and +\link MatrixBase::minCoeff() minCoeff(&x,&y)\endlink, which can be used to find+the location of the greatest or smallest coefficient in a Matrix or +Array.++The arguments passed to a visitor are pointers to the variables where the+row and column position are to be stored. These variables should be of type+\link Eigen::Index Index \endlink, as shown below:++<table class="example">+<tr><th>Example:</th><th>Output:</th></tr>+<tr><td>+\include Tutorial_ReductionsVisitorsBroadcasting_visitors.cpp+</td>+<td>+\verbinclude Tutorial_ReductionsVisitorsBroadcasting_visitors.out+</td></tr></table>++Both functions also return the value of the minimum or maximum coefficient.++\section TutorialReductionsVisitorsBroadcastingPartialReductions Partial reductions+Partial reductions are reductions that can operate column- or row-wise on a Matrix or +Array, applying the reduction operation on each column or row and +returning a column or row vector with the corresponding values. Partial reductions are applied +with \link DenseBase::colwise() colwise() \endlink or \link DenseBase::rowwise() rowwise() \endlink.++A simple example is obtaining the maximum of the elements +in each column in a given matrix, storing the result in a row vector:++<table class="example">+<tr><th>Example:</th><th>Output:</th></tr>+<tr><td>+\include Tutorial_ReductionsVisitorsBroadcasting_colwise.cpp+</td>+<td>+\verbinclude Tutorial_ReductionsVisitorsBroadcasting_colwise.out+</td></tr></table>++The same operation can be performed row-wise:++<table class="example">+<tr><th>Example:</th><th>Output:</th></tr>+<tr><td>+\include Tutorial_ReductionsVisitorsBroadcasting_rowwise.cpp+</td>+<td>+\verbinclude Tutorial_ReductionsVisitorsBroadcasting_rowwise.out+</td></tr></table>++<b>Note that column-wise operations return a row vector, while row-wise operations return a column vector.</b>++\subsection TutorialReductionsVisitorsBroadcastingPartialReductionsCombined Combining partial reductions with other operations+It is also possible to use the result of a partial reduction to do further processing.+Here is another example that finds the column whose sum of elements is the maximum+ within a matrix. With column-wise partial reductions this can be coded as:++<table class="example">+<tr><th>Example:</th><th>Output:</th></tr>+<tr><td>+\include Tutorial_ReductionsVisitorsBroadcasting_maxnorm.cpp+</td>+<td>+\verbinclude Tutorial_ReductionsVisitorsBroadcasting_maxnorm.out+</td></tr></table>++The previous example applies the \link DenseBase::sum() sum() \endlink reduction on each column+though the \link DenseBase::colwise() colwise() \endlink visitor, obtaining a new matrix whose+size is 1x4.++Therefore, if+\f[+\mbox{m} = \begin{bmatrix} 1 & 2 & 6 & 9 \\+                    3 & 1 & 7 & 2 \end{bmatrix}+\f]++then++\f[+\mbox{m.colwise().sum()} = \begin{bmatrix} 4 & 3 & 13 & 11 \end{bmatrix}+\f]++The \link DenseBase::maxCoeff() maxCoeff() \endlink reduction is finally applied +to obtain the column index where the maximum sum is found, +which is the column index 2 (third column) in this case.+++\section TutorialReductionsVisitorsBroadcastingBroadcasting Broadcasting+The concept behind broadcasting is similar to partial reductions, with the difference that broadcasting +constructs an expression where a vector (column or row) is interpreted as a matrix by replicating it in +one direction.++A simple example is to add a certain column vector to each column in a matrix. +This can be accomplished with:++<table class="example">+<tr><th>Example:</th><th>Output:</th></tr>+<tr><td>+\include Tutorial_ReductionsVisitorsBroadcasting_broadcast_simple.cpp+</td>+<td>+\verbinclude Tutorial_ReductionsVisitorsBroadcasting_broadcast_simple.out+</td></tr></table>++We can interpret the instruction <tt>mat.colwise() += v</tt> in two equivalent ways. It adds the vector \c v+to every column of the matrix. Alternatively, it can be interpreted as repeating the vector \c v four times to+form a four-by-two matrix which is then added to \c mat:+\f[+\begin{bmatrix} 1 & 2 & 6 & 9 \\ 3 & 1 & 7 & 2 \end{bmatrix}++ \begin{bmatrix} 0 & 0 & 0 & 0 \\ 1 & 1 & 1 & 1 \end{bmatrix}+= \begin{bmatrix} 1 & 2 & 6 & 9 \\ 4 & 2 & 8 & 3 \end{bmatrix}.+\f]+The operators <tt>-=</tt>, <tt>+</tt> and <tt>-</tt> can also be used column-wise and row-wise. On arrays, we +can also use the operators <tt>*=</tt>, <tt>/=</tt>, <tt>*</tt> and <tt>/</tt> to perform coefficient-wise +multiplication and division column-wise or row-wise. These operators are not available on matrices because it+is not clear what they would do. If you want multiply column 0 of a matrix \c mat with \c v(0), column 1 with +\c v(1), and so on, then use <tt>mat = mat * v.asDiagonal()</tt>.++It is important to point out that the vector to be added column-wise or row-wise must be of type Vector,+and cannot be a Matrix. If this is not met then you will get compile-time error. This also means that+broadcasting operations can only be applied with an object of type Vector, when operating with Matrix.+The same applies for the Array class, where the equivalent for VectorXf is ArrayXf. As always, you should+not mix arrays and matrices in the same expression.++To perform the same operation row-wise we can do:++<table class="example">+<tr><th>Example:</th><th>Output:</th></tr>+<tr><td>+\include Tutorial_ReductionsVisitorsBroadcasting_broadcast_simple_rowwise.cpp+</td>+<td>+\verbinclude Tutorial_ReductionsVisitorsBroadcasting_broadcast_simple_rowwise.out+</td></tr></table>++\subsection TutorialReductionsVisitorsBroadcastingBroadcastingCombined Combining broadcasting with other operations+Broadcasting can also be combined with other operations, such as Matrix or Array operations, +reductions and partial reductions.++Now that broadcasting, reductions and partial reductions have been introduced, we can dive into a more advanced example that finds+the nearest neighbour of a vector <tt>v</tt> within the columns of matrix <tt>m</tt>. The Euclidean distance will be used in this example,+computing the squared Euclidean distance with the partial reduction named \link MatrixBase::squaredNorm() squaredNorm() \endlink:++<table class="example">+<tr><th>Example:</th><th>Output:</th></tr>+<tr><td>+\include Tutorial_ReductionsVisitorsBroadcasting_broadcast_1nn.cpp+</td>+<td>+\verbinclude Tutorial_ReductionsVisitorsBroadcasting_broadcast_1nn.out+</td></tr></table>++The line that does the job is +\code+  (m.colwise() - v).colwise().squaredNorm().minCoeff(&index);+\endcode++We will go step by step to understand what is happening:++  - <tt>m.colwise() - v</tt> is a broadcasting operation, subtracting <tt>v</tt> from each column in <tt>m</tt>. The result of this operation+is a new matrix whose size is the same as matrix <tt>m</tt>: \f[+  \mbox{m.colwise() - v} = +  \begin{bmatrix}+    -1 & 21 & 4 & 7 \\+     0 & 8  & 4 & -1+  \end{bmatrix}+\f]++  - <tt>(m.colwise() - v).colwise().squaredNorm()</tt> is a partial reduction, computing the squared norm column-wise. The result of+this operation is a row vector where each coefficient is the squared Euclidean distance between each column in <tt>m</tt> and <tt>v</tt>: \f[+  \mbox{(m.colwise() - v).colwise().squaredNorm()} =+  \begin{bmatrix}+     1 & 505 & 32 & 50+  \end{bmatrix}+\f]++  - Finally, <tt>minCoeff(&index)</tt> is used to obtain the index of the column in <tt>m</tt> that is closest to <tt>v</tt> in terms of Euclidean+distance.++*/++}
+ eigen3/doc/TutorialReshapeSlicing.dox view
@@ -0,0 +1,65 @@+namespace Eigen {++/** \eigenManualPage TutorialReshapeSlicing Reshape and Slicing++%Eigen does not expose convenient methods to take slices or to reshape a matrix yet.+Nonetheless, such features can easily be emulated using the Map class.++\eigenAutoToc++\section TutorialReshape Reshape++A reshape operation consists in modifying the sizes of a matrix while keeping the same coefficients.+Instead of modifying the input matrix itself, which is not possible for compile-time sizes, the approach consist in creating a different \em view on the storage using class Map.+Here is a typical example creating a 1D linear view of a matrix:++<table class="example">+<tr><th>Example:</th><th>Output:</th></tr>+<tr><td>+\include Tutorial_ReshapeMat2Vec.cpp+</td>+<td>+\verbinclude Tutorial_ReshapeMat2Vec.out+</td></tr></table>++Remark how the storage order of the input matrix modifies the order of the coefficients in the linear view.+Here is another example reshaping a 2x6 matrix to a 6x2 one:+<table class="example">+<tr><th>Example:</th><th>Output:</th></tr>+<tr><td>+\include Tutorial_ReshapeMat2Mat.cpp+</td>+<td>+\verbinclude Tutorial_ReshapeMat2Mat.out+</td></tr></table>++++\section TutorialSlicing Slicing++Slicing consists in taking a set of rows, columns, or elements, uniformly spaced within a matrix.+Again, the class Map allows to easily mimic this feature.++For instance, one can skip every P elements in a vector:+<table class="example">+<tr><th>Example:</th><th>Output:</th></tr>+<tr><td>+\include Tutorial_SlicingVec.cpp+</td>+<td>+\verbinclude Tutorial_SlicingVec.out+</td></tr></table>++One can olso take one column over three using an adequate outer-stride or inner-stride depending on the actual storage order:+<table class="example">+<tr><th>Example:</th><th>Output:</th></tr>+<tr><td>+\include Tutorial_SlicingCol.cpp+</td>+<td>+\verbinclude Tutorial_SlicingCol.out+</td></tr></table>++*/++}
+ eigen3/doc/TutorialSparse.dox view
@@ -0,0 +1,365 @@+namespace Eigen {++/** \eigenManualPage TutorialSparse Sparse matrix manipulations++\eigenAutoToc++Manipulating and solving sparse problems involves various modules which are summarized below:++<table class="manual">+<tr><th>Module</th><th>Header file</th><th>Contents</th></tr>+<tr><td>\link SparseCore_Module SparseCore \endlink</td><td>\code#include <Eigen/SparseCore>\endcode</td><td>SparseMatrix and SparseVector classes, matrix assembly, basic sparse linear algebra (including sparse triangular solvers)</td></tr>+<tr><td>\link SparseCholesky_Module SparseCholesky \endlink</td><td>\code#include <Eigen/SparseCholesky>\endcode</td><td>Direct sparse LLT and LDLT Cholesky factorization to solve sparse self-adjoint positive definite problems</td></tr>+<tr><td>\link SparseLU_Module SparseLU \endlink</td><td>\code #include<Eigen/SparseLU> \endcode</td>+<td>%Sparse LU factorization to solve general square sparse systems</td></tr>+<tr><td>\link SparseQR_Module SparseQR \endlink</td><td>\code #include<Eigen/SparseQR>\endcode </td><td>%Sparse QR factorization for solving sparse linear least-squares problems</td></tr>+<tr><td>\link IterativeLinearSolvers_Module IterativeLinearSolvers \endlink</td><td>\code#include <Eigen/IterativeLinearSolvers>\endcode</td><td>Iterative solvers to solve large general linear square problems (including self-adjoint positive definite problems)</td></tr>+<tr><td>\link Sparse_Module Sparse \endlink</td><td>\code#include <Eigen/Sparse>\endcode</td><td>Includes all the above modules</td></tr>+</table>++\section TutorialSparseIntro Sparse matrix format++In many applications (e.g., finite element methods) it is common to deal with very large matrices where only a few coefficients are different from zero.  In such cases, memory consumption can be reduced and performance increased by using a specialized representation storing only the nonzero coefficients. Such a matrix is called a sparse matrix.++\b The \b %SparseMatrix \b class++The class SparseMatrix is the main sparse matrix representation of Eigen's sparse module; it offers high performance and low memory usage.+It implements a more versatile variant of the widely-used Compressed Column (or Row) Storage scheme.+It consists of four compact arrays:+ - \c Values: stores the coefficient values of the non-zeros.+ - \c InnerIndices: stores the row (resp. column) indices of the non-zeros.+ - \c OuterStarts: stores for each column (resp. row) the index of the first non-zero in the previous two arrays.+ - \c InnerNNZs: stores the number of non-zeros of each column (resp. row).+The word \c inner refers to an \em inner \em vector that is a column for a column-major matrix, or a row for a row-major matrix.+The word \c outer refers to the other direction.++This storage scheme is better explained on an example. The following matrix+<table class="manual">+<tr><td> 0</td><td>3</td><td> 0</td><td>0</td><td> 0</td></tr>+<tr><td>22</td><td>0</td><td> 0</td><td>0</td><td>17</td></tr>+<tr><td> 7</td><td>5</td><td> 0</td><td>1</td><td> 0</td></tr>+<tr><td> 0</td><td>0</td><td> 0</td><td>0</td><td> 0</td></tr>+<tr><td> 0</td><td>0</td><td>14</td><td>0</td><td> 8</td></tr>+</table>++and one of its possible sparse, \b column \b major representation:+<table class="manual">+<tr><td>Values:</td>        <td>22</td><td>7</td><td>_</td><td>3</td><td>5</td><td>14</td><td>_</td><td>_</td><td>1</td><td>_</td><td>17</td><td>8</td></tr>+<tr><td>InnerIndices:</td>  <td> 1</td><td>2</td><td>_</td><td>0</td><td>2</td><td> 4</td><td>_</td><td>_</td><td>2</td><td>_</td><td> 1</td><td>4</td></tr>+</table>+<table class="manual">+<tr><td>OuterStarts:</td><td>0</td><td>3</td><td>5</td><td>8</td><td>10</td><td>\em 12 </td></tr>+<tr><td>InnerNNZs:</td>    <td>2</td><td>2</td><td>1</td><td>1</td><td> 2</td><td></td></tr>+</table>++Currently the elements of a given inner vector are guaranteed to be always sorted by increasing inner indices.+The \c "_" indicates available free space to quickly insert new elements.+Assuming no reallocation is needed, the insertion of a random element is therefore in O(nnz_j) where nnz_j is the number of nonzeros of the respective inner vector.+On the other hand, inserting elements with increasing inner indices in a given inner vector is much more efficient since this only requires to increase the respective \c InnerNNZs entry that is a O(1) operation.++The case where no empty space is available is a special case, and is refered as the \em compressed mode.+It corresponds to the widely used Compressed Column (or Row) Storage schemes (CCS or CRS).+Any SparseMatrix can be turned to this form by calling the SparseMatrix::makeCompressed() function.+In this case, one can remark that the \c InnerNNZs array is redundant with \c OuterStarts because we the equality: \c InnerNNZs[j] = \c OuterStarts[j+1]-\c OuterStarts[j].+Therefore, in practice a call to SparseMatrix::makeCompressed() frees this buffer.++It is worth noting that most of our wrappers to external libraries requires compressed matrices as inputs.++The results of %Eigen's operations always produces \b compressed sparse matrices.+On the other hand, the insertion of a new element into a SparseMatrix converts this later to the \b uncompressed mode.++Here is the previous matrix represented in compressed mode:+<table class="manual">+<tr><td>Values:</td>        <td>22</td><td>7</td><td>3</td><td>5</td><td>14</td><td>1</td><td>17</td><td>8</td></tr>+<tr><td>InnerIndices:</td>  <td> 1</td><td>2</td><td>0</td><td>2</td><td> 4</td><td>2</td><td> 1</td><td>4</td></tr>+</table>+<table class="manual">+<tr><td>OuterStarts:</td><td>0</td><td>2</td><td>4</td><td>5</td><td>6</td><td>\em 8 </td></tr>+</table>++A SparseVector is a special case of a SparseMatrix where only the \c Values and \c InnerIndices arrays are stored.+There is no notion of compressed/uncompressed mode for a SparseVector.+++\section TutorialSparseExample First example++Before describing each individual class, let's start with the following typical example: solving the Laplace equation \f$ \Delta u = 0 \f$ on a regular 2D grid using a finite difference scheme and Dirichlet boundary conditions.+Such problem can be mathematically expressed as a linear problem of the form \f$ Ax=b \f$ where \f$ x \f$ is the vector of \c m unknowns (in our case, the values of the pixels), \f$ b \f$ is the right hand side vector resulting from the boundary conditions, and \f$ A \f$ is an \f$ m \times m \f$ matrix containing only a few non-zero elements resulting from the discretization of the Laplacian operator.++<table class="manual">+<tr><td>+\include Tutorial_sparse_example.cpp+</td>+<td>+\image html Tutorial_sparse_example.jpeg+</td></tr></table>++In this example, we start by defining a column-major sparse matrix type of double \c SparseMatrix<double>, and a triplet list of the same scalar type \c  Triplet<double>. A triplet is a simple object representing a non-zero entry as the triplet: \c row index, \c column index, \c value.++In the main function, we declare a list \c coefficients of triplets (as a std vector) and the right hand side vector \f$ b \f$ which are filled by the \a buildProblem function.+The raw and flat list of non-zero entries is then converted to a true SparseMatrix object \c A.+Note that the elements of the list do not have to be sorted, and possible duplicate entries will be summed up.++The last step consists of effectively solving the assembled problem.+Since the resulting matrix \c A is symmetric by construction, we can perform a direct Cholesky factorization via the SimplicialLDLT class which behaves like its LDLT counterpart for dense objects.++The resulting vector \c x contains the pixel values as a 1D array which is saved to a jpeg file shown on the right of the code above.++Describing the \a buildProblem and \a save functions is out of the scope of this tutorial. They are given \ref TutorialSparse_example_details "here" for the curious and reproducibility purpose.+++++\section TutorialSparseSparseMatrix The SparseMatrix class++\b %Matrix \b and \b vector \b properties \n++The SparseMatrix and SparseVector classes take three template arguments:+ * the scalar type (e.g., double)+ * the storage order (ColMajor or RowMajor, the default is ColMajor)+ * the inner index type (default is \c int).++As for dense Matrix objects, constructors takes the size of the object.+Here are some examples:++\code+SparseMatrix<std::complex<float> > mat(1000,2000);         // declares a 1000x2000 column-major compressed sparse matrix of complex<float>+SparseMatrix<double,RowMajor> mat(1000,2000);              // declares a 1000x2000 row-major compressed sparse matrix of double+SparseVector<std::complex<float> > vec(1000);              // declares a column sparse vector of complex<float> of size 1000+SparseVector<double,RowMajor> vec(1000);                   // declares a row sparse vector of double of size 1000+\endcode++In the rest of the tutorial, \c mat and \c vec represent any sparse-matrix and sparse-vector objects, respectively.++The dimensions of a matrix can be queried using the following functions:+<table class="manual">+<tr><td>Standard \n dimensions</td><td>\code+mat.rows()+mat.cols()\endcode</td>+<td>\code+vec.size() \endcode</td>+</tr>+<tr><td>Sizes along the \n inner/outer dimensions</td><td>\code+mat.innerSize()+mat.outerSize()\endcode</td>+<td></td>+</tr>+<tr><td>Number of non \n zero coefficients</td><td>\code+mat.nonZeros() \endcode</td>+<td>\code+vec.nonZeros() \endcode</td></tr>+</table>+++\b Iterating \b over \b the \b nonzero \b coefficients \n++Random access to the elements of a sparse object can be done through the \c coeffRef(i,j) function.+However, this function involves a quite expensive binary search.+In most cases, one only wants to iterate over the non-zeros elements. This is achieved by a standard loop over the outer dimension, and then by iterating over the non-zeros of the current inner vector via an InnerIterator. Thus, the non-zero entries have to be visited in the same order than the storage order.+Here is an example:+<table class="manual">+<tr><td>+\code+SparseMatrix<double> mat(rows,cols);+for (int k=0; k<mat.outerSize(); ++k)+  for (SparseMatrix<double>::InnerIterator it(mat,k); it; ++it)+  {+    it.value();+    it.row();   // row index+    it.col();   // col index (here it is equal to k)+    it.index(); // inner index, here it is equal to it.row()+  }+\endcode+</td><td>+\code+SparseVector<double> vec(size);+for (SparseVector<double>::InnerIterator it(vec); it; ++it)+{+  it.value(); // == vec[ it.index() ]+  it.index();+}+\endcode+</td></tr>+</table>+For a writable expression, the referenced value can be modified using the valueRef() function.+If the type of the sparse matrix or vector depends on a template parameter, then the \c typename keyword is+required to indicate that \c InnerIterator denotes a type; see \ref TopicTemplateKeyword for details.+++\section TutorialSparseFilling Filling a sparse matrix++Because of the special storage scheme of a SparseMatrix, special care has to be taken when adding new nonzero entries.+For instance, the cost of a single purely random insertion into a SparseMatrix is \c O(nnz), where \c nnz is the current number of non-zero coefficients.++The simplest way to create a sparse matrix while guaranteeing good performance is thus to first build a list of so-called \em triplets, and then convert it to a SparseMatrix.++Here is a typical usage example:+\code+typedef Eigen::Triplet<double> T;+std::vector<T> tripletList;+tripletList.reserve(estimation_of_entries);+for(...)+{+  // ...+  tripletList.push_back(T(i,j,v_ij));+}+SparseMatrixType mat(rows,cols);+mat.setFromTriplets(tripletList.begin(), tripletList.end());+// mat is ready to go!+\endcode+The \c std::vector of triplets might contain the elements in arbitrary order, and might even contain duplicated elements that will be summed up by setFromTriplets().+See the SparseMatrix::setFromTriplets() function and class Triplet for more details.+++In some cases, however, slightly higher performance, and lower memory consumption can be reached by directly inserting the non-zeros into the destination matrix.+A typical scenario of this approach is illustrated bellow:+\code+1: SparseMatrix<double> mat(rows,cols);         // default is column major+2: mat.reserve(VectorXi::Constant(cols,6));+3: for each i,j such that v_ij != 0+4:   mat.insert(i,j) = v_ij;                    // alternative: mat.coeffRef(i,j) += v_ij;+5: mat.makeCompressed();                        // optional+\endcode++- The key ingredient here is the line 2 where we reserve room for 6 non-zeros per column. In many cases, the number of non-zeros per column or row can easily be known in advance. If it varies significantly for each inner vector, then it is possible to specify a reserve size for each inner vector by providing a vector object with an operator[](int j) returning the reserve size of the \c j-th inner vector (e.g., via a VectorXi or std::vector<int>). If only a rought estimate of the number of nonzeros per inner-vector can be obtained, it is highly recommended to overestimate it rather than the opposite. If this line is omitted, then the first insertion of a new element will reserve room for 2 elements per inner vector.+- The line 4 performs a sorted insertion. In this example, the ideal case is when the \c j-th column is not full and contains non-zeros whose inner-indices are smaller than \c i. In this case, this operation boils down to trivial O(1) operation.+- When calling insert(i,j) the element \c i \c ,j must not already exists, otherwise use the coeffRef(i,j) method that will allow to, e.g., accumulate values. This method first performs a binary search and finally calls insert(i,j) if the element does not already exist. It is more flexible than insert() but also more costly.+- The line 5 suppresses the remaining empty space and transforms the matrix into a compressed column storage.++++\section TutorialSparseFeatureSet Supported operators and functions++Because of their special storage format, sparse matrices cannot offer the same level of flexibility than dense matrices.+In Eigen's sparse module we chose to expose only the subset of the dense matrix API which can be efficiently implemented.+In the following \em sm denotes a sparse matrix, \em sv a sparse vector, \em dm a dense matrix, and \em dv a dense vector.++\subsection TutorialSparse_BasicOps Basic operations++%Sparse expressions support most of the unary and binary coefficient wise operations:+\code+sm1.real()   sm1.imag()   -sm1                    0.5*sm1+sm1+sm2      sm1-sm2      sm1.cwiseProduct(sm2)+\endcode+However, <strong>a strong restriction is that the storage orders must match</strong>. For instance, in the following example:+\code+sm4 = sm1 + sm2 + sm3;+\endcode+sm1, sm2, and sm3 must all be row-major or all column-major.+On the other hand, there is no restriction on the target matrix sm4.+For instance, this means that for computing \f$ A^T + A \f$, the matrix \f$ A^T \f$ must be evaluated into a temporary matrix of compatible storage order:+\code+SparseMatrix<double> A, B;+B = SparseMatrix<double>(A.transpose()) + A;+\endcode++Binary coefficient wise operators can also mix sparse and dense expressions:+\code+sm2 = sm1.cwiseProduct(dm1);+dm2 = sm1 + dm1;+dm2 = dm1 - sm1;+\endcode+Performance-wise, the adding/subtracting sparse and dense matrices is better performed in two steps. For instance, instead of doing <tt>dm2 = sm1 + dm1</tt>, better write:+\code+dm2 = dm1;+dm2 += sm1;+\endcode+This version has the advantage to fully exploit the higher performance of dense storage (no indirection, SIMD, etc.), and to pay the cost of slow sparse evaluation on the few non-zeros of the sparse matrix only.+++%Sparse expressions also support transposition:+\code+sm1 = sm2.transpose();+sm1 = sm2.adjoint();+\endcode+However, there is no transposeInPlace() method.+++\subsection TutorialSparse_Products Matrix products++%Eigen supports various kind of sparse matrix products which are summarize below:+  - \b sparse-dense:+    \code+dv2 = sm1 * dv1;+dm2 = dm1 * sm1.adjoint();+dm2 = 2. * sm1 * dm1;+    \endcode+  - \b symmetric \b sparse-dense. The product of a sparse symmetric matrix with a dense matrix (or vector) can also be optimized by specifying the symmetry with selfadjointView():+    \code+dm2 = sm1.selfadjointView<>() * dm1;        // if all coefficients of A are stored+dm2 = A.selfadjointView<Upper>() * dm1;     // if only the upper part of A is stored+dm2 = A.selfadjointView<Lower>() * dm1;     // if only the lower part of A is stored+    \endcode+  - \b sparse-sparse. For sparse-sparse products, two different algorithms are available. The default one is conservative and preserve the explicit zeros that might appear:+    \code+sm3 = sm1 * sm2;+sm3 = 4 * sm1.adjoint() * sm2;+    \endcode+    The second algorithm prunes on the fly the explicit zeros, or the values smaller than a given threshold. It is enabled and controlled through the prune() functions:+    \code+sm3 = (sm1 * sm2).pruned();                  // removes numerical zeros+sm3 = (sm1 * sm2).pruned(ref);               // removes elements much smaller than ref+sm3 = (sm1 * sm2).pruned(ref,epsilon);       // removes elements smaller than ref*epsilon+    \endcode++  - \b permutations. Finally, permutations can be applied to sparse matrices too:+    \code+PermutationMatrix<Dynamic,Dynamic> P = ...;+sm2 = P * sm1;+sm2 = sm1 * P.inverse();+sm2 = sm1.transpose() * P;+    \endcode+++\subsection TutorialSparse_SubMatrices Block operations++Regarding read-access, sparse matrices expose the same API than for dense matrices to access to sub-matrices such as blocks, columns, and rows. See \ref TutorialBlockOperations for a detailed introduction.+However, for performance reasons, writing to a sub-sparse-matrix is much more limited, and currently only contiguous sets of columns (resp. rows) of a column-major (resp. row-major) SparseMatrix are writable. Moreover, this information has to be known at compile-time, leaving out methods such as <tt>block(...)</tt> and <tt>corner*(...)</tt>. The available API for write-access to a SparseMatrix are summarized below:+\code+SparseMatrix<double,ColMajor> sm1;+sm1.col(j) = ...;+sm1.leftCols(ncols) = ...;+sm1.middleCols(j,ncols) = ...;+sm1.rightCols(ncols) = ...;++SparseMatrix<double,RowMajor> sm2;+sm2.row(i) = ...;+sm2.topRows(nrows) = ...;+sm2.middleRows(i,nrows) = ...;+sm2.bottomRows(nrows) = ...;+\endcode++In addition, sparse matrices expose the SparseMatrixBase::innerVector() and SparseMatrixBase::innerVectors() methods, which are aliases to the col/middleCols methods for a column-major storage, and to the row/middleRows methods for a row-major storage.++\subsection TutorialSparse_TriangularSelfadjoint Triangular and selfadjoint views++Just as with dense matrices, the triangularView() function can be used to address a triangular part of the matrix, and perform triangular solves with a dense right hand side:+\code+dm2 = sm1.triangularView<Lower>(dm1);+dv2 = sm1.transpose().triangularView<Upper>(dv1);+\endcode++The selfadjointView() function permits various operations:+ - optimized sparse-dense matrix products:+    \code+dm2 = sm1.selfadjointView<>() * dm1;        // if all coefficients of A are stored+dm2 = A.selfadjointView<Upper>() * dm1;     // if only the upper part of A is stored+dm2 = A.selfadjointView<Lower>() * dm1;     // if only the lower part of A is stored+    \endcode+ - copy of triangular parts:+    \code+sm2 = sm1.selfadjointView<Upper>();                               // makes a full selfadjoint matrix from the upper triangular part+sm2.selfadjointView<Lower>() = sm1.selfadjointView<Upper>();      // copies the upper triangular part to the lower triangular part+    \endcode+ - application of symmetric permutations:+ \code+PermutationMatrix<Dynamic,Dynamic> P = ...;+sm2 = A.selfadjointView<Upper>().twistedBy(P);                                // compute P S P' from the upper triangular part of A, and make it a full matrix+sm2.selfadjointView<Lower>() = A.selfadjointView<Lower>().twistedBy(P);       // compute P S P' from the lower triangular part of A, and then only compute the lower part+ \endcode++Please, refer to the \link SparseQuickRefPage Quick Reference \endlink  guide for the list of supported operations. The list of linear solvers available is \link TopicSparseSystems here. \endlink++*/++}
+ eigen3/doc/TutorialSparse_example_details.dox view
@@ -0,0 +1,4 @@+/**+\page TutorialSparse_example_details+\include Tutorial_sparse_example_details.cpp+*/
+ eigen3/doc/UnalignedArrayAssert.dox view
@@ -0,0 +1,120 @@+namespace Eigen {++/** \eigenManualPage TopicUnalignedArrayAssert Explanation of the assertion on unaligned arrays++Hello! You are seeing this webpage because your program terminated on an assertion failure like this one:+<pre>+my_program: path/to/eigen/Eigen/src/Core/DenseStorage.h:44:+Eigen::internal::matrix_array<T, Size, MatrixOptions, Align>::internal::matrix_array()+[with T = double, int Size = 2, int MatrixOptions = 2, bool Align = true]:+Assertion `(reinterpret_cast<size_t>(array) & (sizemask)) == 0 && "this assertion+is explained here: http://eigen.tuxfamily.org/dox-devel/group__TopicUnalignedArrayAssert.html+**** READ THIS WEB PAGE !!! ****"' failed.+</pre>++There are 4 known causes for this issue. Please read on to understand them and learn how to fix them.++\eigenAutoToc++\section where Where in my own code is the cause of the problem?++First of all, you need to find out where in your own code this assertion was triggered from. At first glance, the error message doesn't look helpful, as it refers to a file inside Eigen! However, since your program crashed, if you can reproduce the crash, you can get a backtrace using any debugger. For example, if you're using GCC, you can use the GDB debugger as follows:+\code+$ gdb ./my_program          # Start GDB on your program+> run                       # Start running your program+...                         # Now reproduce the crash!+> bt                        # Obtain the backtrace+\endcode+Now that you know precisely where in your own code the problem is happening, read on to understand what you need to change.++\section c1 Cause 1: Structures having Eigen objects as members++If you have code like this,++\code+class Foo+{+  //...+  Eigen::Vector2d v;+  //...+};+//...+Foo *foo = new Foo;+\endcode++then you need to read this separate page: \ref TopicStructHavingEigenMembers "Structures Having Eigen Members".++Note that here, Eigen::Vector2d is only used as an example, more generally the issue arises for all \ref TopicFixedSizeVectorizable "fixed-size vectorizable Eigen types".++\section c2 Cause 2: STL Containers or manual memory allocation++If you use STL Containers such as std::vector, std::map, ..., with %Eigen objects, or with classes containing %Eigen objects, like this,++\code+std::vector<Eigen::Matrix2f> my_vector;+struct my_class { ... Eigen::Matrix2f m; ... };+std::map<int, my_class> my_map;+\endcode++then you need to read this separate page: \ref TopicStlContainers "Using STL Containers with Eigen".++Note that here, Eigen::Matrix2f is only used as an example, more generally the issue arises for all \ref TopicFixedSizeVectorizable "fixed-size vectorizable Eigen types" and \ref TopicStructHavingEigenMembers "structures having such Eigen objects as member".++The same issue will be exhibited by any classes/functions by-passing operator new to allocate memory, that is, by performing custom memory allocation followed by calls to the placement new operator. This is for instance typically the case of \c std::make_shared or \c std::allocate_shared for which is the solution is to use an \ref aligned_allocator "aligned allocator" as detailed in the \ref TopicStlContainers "solution for STL containers".++\section c3 Cause 3: Passing Eigen objects by value++If some function in your code is getting an Eigen object passed by value, like this,++\code+void func(Eigen::Vector4d v);+\endcode++then you need to read this separate page: \ref TopicPassingByValue "Passing Eigen objects by value to functions".++Note that here, Eigen::Vector4d is only used as an example, more generally the issue arises for all \ref TopicFixedSizeVectorizable "fixed-size vectorizable Eigen types".++\section c4 Cause 4: Compiler making a wrong assumption on stack alignment (for instance GCC on Windows)++This is a must-read for people using GCC on Windows (like MinGW or TDM-GCC). If you have this assertion failure in an innocent function declaring a local variable like this:++\code+void foo()+{+  Eigen::Quaternionf q;+  //...+}+\endcode++then you need to read this separate page: \ref TopicWrongStackAlignment "Compiler making a wrong assumption on stack alignment".++Note that here, Eigen::Quaternionf is only used as an example, more generally the issue arises for all \ref TopicFixedSizeVectorizable "fixed-size vectorizable Eigen types".++\section explanation General explanation of this assertion++\ref TopicFixedSizeVectorizable "fixed-size vectorizable Eigen objects" must absolutely be created at 16-byte-aligned locations, otherwise SIMD instructions addressing them will crash.++Eigen normally takes care of these alignment issues for you, by setting an alignment attribute on them and by overloading their "operator new".++However there are a few corner cases where these alignment settings get overridden: they are the possible causes for this assertion.++\section getrid I don't care about optimal vectorization, how do I get rid of that stuff?++Three possibilities:+<ul>+  <li>Use the \c DontAlign option to Matrix, Array, Quaternion, etc. objects that gives you trouble. This way Eigen won't try to align them, and thus won"t assume any special alignment. On the down side, you will pay the cost of unaligned loads/stores for them, but on modern CPUs, the overhead is either null or marginal. See \link StructHavingEigenMembers_othersolutions here \endlink for an example.</li>+  <li>Define \link TopicPreprocessorDirectivesPerformance EIGEN_DONT_ALIGN_STATICALLY \endlink. That disables all 16-byte (and above) static alignment code, while keeping 16-byte (or above) heap alignment. This has the effect of+      vectorizing fixed-size objects (like Matrix4d) through unaligned stores (as controlled by \link TopicPreprocessorDirectivesPerformance EIGEN_UNALIGNED_VECTORIZE \endlink), while keeping unchanged the vectorization of dynamic-size objects+      (like MatrixXd). But do note that this breaks ABI compatibility with the default behavior of static alignment.</li>+  <li>Or define both \link TopicPreprocessorDirectivesPerformance  EIGEN_DONT_VECTORIZE \endlink and EIGEN_DISABLE_UNALIGNED_ARRAY_ASSERT. This keeps the+      16-byte alignment code and thus preserves ABI compatibility, but completely disables vectorization.</li>+</ul>++If you want to know why defining EIGEN_DONT_VECTORIZE does not by itself disable 16-byte alignment and the assertion, here's the explanation:++It doesn't disable the assertion, because otherwise code that runs fine without vectorization would suddenly crash when enabling vectorization.+It doesn't disable 16-byte alignment, because that would mean that vectorized and non-vectorized code are not mutually ABI-compatible. This ABI compatibility is very important, even for people who develop only an in-house application, as for instance one may want to have in the same application a vectorized path and a non-vectorized path.++*/++}
+ eigen3/doc/UsingBlasLapackBackends.dox view
@@ -0,0 +1,133 @@+/*+ Copyright (c) 2011, Intel Corporation. All rights reserved.+ Copyright (C) 2011-2016 Gael Guennebaud <gael.guennebaud@inria.fr>++ 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 : Documentation on the use of BLAS/LAPACK libraries through Eigen+ ********************************************************************************+*/++namespace Eigen {++/** \page TopicUsingBlasLapack Using BLAS/LAPACK from %Eigen+++Since %Eigen version 3.3 and later, any F77 compatible BLAS or LAPACK libraries can be used as backends for dense matrix products and dense matrix decompositions.+For instance, one can use <a href="http://eigen.tuxfamily.org/Counter/redirect_to_mkl.php">Intel® MKL</a>, Apple's Accelerate framework on OSX, <a href="http://www.openblas.net/">OpenBLAS</a>, <a href="http://www.netlib.org/lapack">Netlib LAPACK</a>, etc.++Do not miss this \link TopicUsingIntelMKL page \endlink for further discussions on the specific use of Intel® MKL (also includes VML, PARDISO, etc.)++In order to use an external BLAS and/or LAPACK library, you must link you own application to the respective libraries and their dependencies.+For LAPACK, you must also link to the standard <a href="http://www.netlib.org/lapack/lapacke.html">Lapacke</a> library, which is used as a convenient think layer between %Eigen's C++ code and LAPACK F77 interface. Then you must activate their usage by defining one or multiple of the following macros (\b before including any %Eigen's header):++\note For Mac users, in order to use the lapack version shipped with the Accelerate framework, you also need the lapacke library.+Using <a href="https://www.macports.org/">MacPorts</a>, this is as easy as:+\code+sudo port install lapack+\endcode+and then use the following link flags: \c -framework \c Accelerate \c /opt/local/lib/lapack/liblapacke.dylib++<table class="manual">+<tr><td>\c EIGEN_USE_BLAS </td><td>Enables the use of external BLAS level 2 and 3 routines (compatible with any F77 BLAS interface)</td></tr>+<tr class="alt"><td>\c EIGEN_USE_LAPACKE </td><td>Enables the use of external Lapack routines via the <a href="http://www.netlib.org/lapack/lapacke.html">Lapacke</a> C interface to Lapack (compatible with any F77 LAPACK interface)</td></tr>+<tr><td>\c EIGEN_USE_LAPACKE_STRICT </td><td>Same as \c EIGEN_USE_LAPACKE but algorithms of lower numerical robustness are disabled. \n This currently concerns only JacobiSVD which otherwise would be replaced by \c gesvd that is less robust than Jacobi rotations.</td></tr>+</table>++When doing so, a number of %Eigen's algorithms are silently substituted with calls to BLAS or LAPACK routines.+These substitutions apply only for \b Dynamic \b or \b large enough objects with one of the following four standard scalar types: \c float, \c double, \c complex<float>, and \c complex<double>.+Operations on other scalar types or mixing reals and complexes will continue to use the built-in algorithms.++The breadth of %Eigen functionality that can be substituted is listed in the table below.+<table class="manual">+<tr><th>Functional domain</th><th>Code example</th><th>BLAS/LAPACK routines</th></tr>+<tr><td>Matrix-matrix operations \n \c EIGEN_USE_BLAS </td><td>\code+m1*m2.transpose();+m1.selfadjointView<Lower>()*m2;+m1*m2.triangularView<Upper>();+m1.selfadjointView<Lower>().rankUpdate(m2,1.0);+\endcode</td><td>\code+?gemm+?symm/?hemm+?trmm+dsyrk/ssyrk+\endcode</td></tr>+<tr class="alt"><td>Matrix-vector operations \n \c EIGEN_USE_BLAS </td><td>\code+m1.adjoint()*b;+m1.selfadjointView<Lower>()*b;+m1.triangularView<Upper>()*b;+\endcode</td><td>\code+?gemv+?symv/?hemv+?trmv+\endcode</td></tr>+<tr><td>LU decomposition \n \c EIGEN_USE_LAPACKE \n \c EIGEN_USE_LAPACKE_STRICT </td><td>\code+v1 = m1.lu().solve(v2);+\endcode</td><td>\code+?getrf+\endcode</td></tr>+<tr class="alt"><td>Cholesky decomposition \n \c EIGEN_USE_LAPACKE \n \c EIGEN_USE_LAPACKE_STRICT </td><td>\code+v1 = m2.selfadjointView<Upper>().llt().solve(v2);+\endcode</td><td>\code+?potrf+\endcode</td></tr>+<tr><td>QR decomposition \n \c EIGEN_USE_LAPACKE \n \c EIGEN_USE_LAPACKE_STRICT </td><td>\code+m1.householderQr();+m1.colPivHouseholderQr();+\endcode</td><td>\code+?geqrf+?geqp3+\endcode</td></tr>+<tr class="alt"><td>Singular value decomposition \n \c EIGEN_USE_LAPACKE </td><td>\code+JacobiSVD<MatrixXd> svd;+svd.compute(m1, ComputeThinV);+\endcode</td><td>\code+?gesvd+\endcode</td></tr>+<tr><td>Eigen-value decompositions \n \c EIGEN_USE_LAPACKE \n \c EIGEN_USE_LAPACKE_STRICT </td><td>\code+EigenSolver<MatrixXd> es(m1);+ComplexEigenSolver<MatrixXcd> ces(m1);+SelfAdjointEigenSolver<MatrixXd> saes(m1+m1.transpose());+GeneralizedSelfAdjointEigenSolver<MatrixXd>+    gsaes(m1+m1.transpose(),m2+m2.transpose());+\endcode</td><td>\code+?gees+?gees+?syev/?heev+?syev/?heev,+?potrf+\endcode</td></tr>+<tr class="alt"><td>Schur decomposition \n \c EIGEN_USE_LAPACKE \n \c EIGEN_USE_LAPACKE_STRICT </td><td>\code+RealSchur<MatrixXd> schurR(m1);+ComplexSchur<MatrixXcd> schurC(m1);+\endcode</td><td>\code+?gees+\endcode</td></tr>+</table>+In the examples, m1 and m2 are dense matrices and v1 and v2 are dense vectors.++*/++}
+ eigen3/doc/UsingIntelMKL.dox view
@@ -0,0 +1,109 @@+/*+ Copyright (c) 2011, Intel Corporation. All rights reserved.+ Copyright (C) 2011 Gael Guennebaud <gael.guennebaud@inria.fr>++ 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 : Documentation on the use of Intel MKL through Eigen+ ********************************************************************************+*/++namespace Eigen {++/** \page TopicUsingIntelMKL Using Intel® MKL from %Eigen++<!-- \section TopicUsingIntelMKL_Intro Eigen and Intel® Math Kernel Library (Intel® MKL) -->++Since %Eigen version 3.1 and later, users can benefit from built-in Intel® Math Kernel Library (MKL) optimizations with an installed copy of Intel MKL 10.3 (or later).++<a href="http://eigen.tuxfamily.org/Counter/redirect_to_mkl.php"> Intel MKL </a> provides highly optimized multi-threaded mathematical routines for x86-compatible architectures.+Intel MKL is available on Linux, Mac and Windows for both Intel64 and IA32 architectures.++\note+Intel® MKL is a proprietary software and it is the responsibility of users to buy or register for community (free) Intel MKL licenses for their products. Moreover, the license of the user product has to allow linking to proprietary software that excludes any unmodified versions of the GPL.++Using Intel MKL through %Eigen is easy:+-# define the \c EIGEN_USE_MKL_ALL macro before including any %Eigen's header+-# link your program to MKL libraries (see the <a href="http://software.intel.com/en-us/articles/intel-mkl-link-line-advisor/">MKL linking advisor</a>)+-# on a 64bits system, you must use the LP64 interface (not the ILP64 one)++When doing so, a number of %Eigen's algorithms are silently substituted with calls to Intel MKL routines.+These substitutions apply only for \b Dynamic \b or \b large enough objects with one of the following four standard scalar types: \c float, \c double, \c complex<float>, and \c complex<double>.+Operations on other scalar types or mixing reals and complexes will continue to use the built-in algorithms.++In addition you can choose which parts will be substituted by defining one or multiple of the following macros:++<table class="manual">+<tr><td>\c EIGEN_USE_BLAS </td><td>Enables the use of external BLAS level 2 and 3 routines</td></tr>+<tr class="alt"><td>\c EIGEN_USE_LAPACKE </td><td>Enables the use of external Lapack routines via the <a href="http://www.netlib.org/lapack/lapacke.html">Lapacke</a> C interface to Lapack</td></tr>+<tr><td>\c EIGEN_USE_LAPACKE_STRICT </td><td>Same as \c EIGEN_USE_LAPACKE but algorithm of lower robustness are disabled. \n This currently concerns only JacobiSVD which otherwise would be replaced by \c gesvd that is less robust than Jacobi rotations.</td></tr>+<tr class="alt"><td>\c EIGEN_USE_MKL_VML </td><td>Enables the use of Intel VML (vector operations)</td></tr>+<tr><td>\c EIGEN_USE_MKL_ALL </td><td>Defines \c EIGEN_USE_BLAS, \c EIGEN_USE_LAPACKE, and \c EIGEN_USE_MKL_VML </td></tr>+</table>++The options can be combined with \b MKL_DIRECT_CALL to enable MKL direct call feature. This may help to increase performance of some MKL BLAS (?GEMM, ?GEMV, ?TRSM, ?AXPY and ?DOT) and LAPACK (LU, Cholesky and QR) routines for very small matrices. To make it work properly, the macro \c EIGEN_USE_MKL must also be defined in the case none of the other \c EIGEN_USE_MKL_* macros has been defined.++Note that the BLAS and LAPACKE backends can be enabled for any F77 compatible BLAS and LAPACK libraries. See this \link TopicUsingBlasLapack page \endlink for the details.++Finally, the PARDISO sparse solver shipped with Intel MKL can be used through the \ref PardisoLU, \ref PardisoLLT and \ref PardisoLDLT classes of the \ref PardisoSupport_Module.++The following table summarizes the list of functions covered by \c EIGEN_USE_MKL_VML:+<table class="manual">+<tr><th>Code example</th><th>MKL routines</th></tr>+<tr><td>\code+v2=v1.array().sin();+v2=v1.array().asin();+v2=v1.array().cos();+v2=v1.array().acos();+v2=v1.array().tan();+v2=v1.array().exp();+v2=v1.array().log();+v2=v1.array().sqrt();+v2=v1.array().square();+v2=v1.array().pow(1.5);+\endcode</td><td>\code+v?Sin+v?Asin+v?Cos+v?Acos+v?Tan+v?Exp+v?Ln+v?Sqrt+v?Sqr+v?Powx+\endcode</td></tr>+</table>+In the examples, v1 and v2 are dense vectors.+++\section TopicUsingIntelMKL_Links Links+- Intel MKL can be purchased and downloaded <a href="http://eigen.tuxfamily.org/Counter/redirect_to_mkl.php">here</a>.+- Intel MKL is also bundled with <a href="http://software.intel.com/en-us/articles/intel-composer-xe/">Intel Composer XE</a>.+++*/++}
+ eigen3/doc/UsingNVCC.dox view
@@ -0,0 +1,32 @@++namespace Eigen {++/** \page TopicCUDA Using Eigen in CUDA kernels++\b Disclaimer: this page is about an \b experimental feature in %Eigen.++Staring from CUDA 5.0, the CUDA compiler, \c nvcc, is able to properly parse %Eigen's code (almost).+A few adaptations of the %Eigen's code already allows to use some parts of %Eigen in your own CUDA kernels.+To this end you need the devel branch of %Eigen, CUDA 5.0 or greater with GCC.++Known issues:++ - \c nvcc with MS Visual Studio does not work (patch welcome)+ + - \c nvcc with \c clang does not work (patch welcome)+ + - \c nvcc 5.5 with gcc-4.7 (or greater) has issues with the standard \c \<limits\> header file. To workaround this, you can add the following before including any other files:+   \code+    // 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+   \endcode+   + - On 64bits system Eigen uses \c long \c int as the default type for indexes and sizes. On CUDA device, it would make sense to default to 32 bits \c int.+   However, to keep host and CUDA code compatible, this cannot be done automatically by %Eigen, and the user is thus required to define \c EIGEN_DEFAULT_DENSE_INDEX_TYPE to \c int throughout his code (or only for CUDA code if there is no interaction between host and CUDA code through %Eigen's object).++*/++}
+ eigen3/doc/WrongStackAlignment.dox view
@@ -0,0 +1,56 @@+namespace Eigen {++/** \eigenManualPage TopicWrongStackAlignment Compiler making a wrong assumption on stack alignment++<h4>It appears that this was a GCC bug that has been fixed in GCC 4.5.+If you hit this issue, please upgrade to GCC 4.5 and report to us, so we can update this page.</h4>++This is an issue that, so far, we met only with GCC on Windows: for instance, MinGW and TDM-GCC.++By default, in a function like this,++\code+void foo()+{+  Eigen::Quaternionf q;+  //...+}+\endcode++GCC assumes that the stack is already 16-byte-aligned so that the object \a q will be created at a 16-byte-aligned location. For this reason, it doesn't take any special care to explicitly align the object \a q, as Eigen requires.++The problem is that, in some particular cases, this assumption can be wrong on Windows, where the stack is only guaranteed to have 4-byte alignment. Indeed, even though GCC takes care of aligning the stack in the main function and does its best to keep it aligned, when a function is called from another thread or from a binary compiled with another compiler, the stack alignment can be corrupted. This results in the object 'q' being created at an unaligned location, making your program crash with the \ref TopicUnalignedArrayAssert "assertion on unaligned arrays". So far we found the three following solutions.+++\section sec_sol1 Local solution++A local solution is to mark such a function with this attribute:+\code+__attribute__((force_align_arg_pointer)) void foo()+{+  Eigen::Quaternionf q;+  //...+}+\endcode+Read <a href="http://gcc.gnu.org/onlinedocs/gcc-4.4.0/gcc/Function-Attributes.html#Function-Attributes">this GCC documentation</a> to understand what this does. Of course this should only be done on GCC on Windows, so for portability you'll have to encapsulate this in a macro which you leave empty on other platforms. The advantage of this solution is that you can finely select which function might have a corrupted stack alignment. Of course on the downside this has to be done for every such function, so you may prefer one of the following two global solutions.+++\section sec_sol2 Global solutions++A global solution is to edit your project so that when compiling with GCC on Windows, you pass this option to GCC:+\code+-mincoming-stack-boundary=2+\endcode+Explanation: this tells GCC that the stack is only required to be aligned to 2^2=4 bytes, so that GCC now knows that it really must take extra care to honor the 16 byte alignment of \ref TopicFixedSizeVectorizable "fixed-size vectorizable Eigen types" when needed.++Another global solution is to pass this option to gcc:+\code+-mstackrealign+\endcode+which has the same effect than adding the \c force_align_arg_pointer attribute to all functions.++These global solutions are easy to use, but note that they may slowdown your program because they lead to extra prologue/epilogue instructions for every function.++*/++}
+ eigen3/doc/eigen_navtree_hacks.js view
@@ -0,0 +1,246 @@++// generate a table of contents in the side-nav based on the h1/h2 tags of the current page.+function generate_autotoc() {+  var headers = $("h1, h2");+  if(headers.length > 1) {+    var toc = $("#side-nav").append('<div id="nav-toc" class="toc"><h3>Table of contents</h3></div>');+    toc = $("#nav-toc");+    var footerHeight = footer.height();+    toc = toc.append('<ul></ul>');+    toc = toc.find('ul');+    var indices = new Array();+    indices[0] = 0;+    indices[1] = 0;++    var h1counts = $("h1").length;+    headers.each(function(i) {+      var current = $(this);+      var levelTag = current[0].tagName.charAt(1);+      if(h1counts==0)+        levelTag--;+      var cur_id = current.attr("id");++      indices[levelTag-1]+=1;  +      var prefix = indices[0];+      if (levelTag >1) {+        prefix+="."+indices[1];+      }+        +      // Uncomment to add number prefixes+      // current.html(prefix + "   " + current.html());+      for(var l = levelTag; l < 2; ++l){+          indices[l] = 0;+      }++      if(cur_id == undefined) {+        current.attr('id', 'title' + i);+        current.addClass('anchor');+        toc.append("<li class='level" + levelTag + "'><a id='link" + i + "' href='#title" ++                    i + "' title='" + current.prop("tagName") + "'>" + current.text() + "</a></li>");+      } else {+        toc.append("<li class='level" + levelTag + "'><a id='" + cur_id + "' href='#title" ++                    i + "' title='" + current.prop("tagName") + "'>" + current.text() + "</a></li>");+      }+    });+    resizeHeight();+  }+}+++var global_navtree_object;++// Overloaded to remove links to sections/subsections+function getNode(o, po)+{+  po.childrenVisited = true;+  var l = po.childrenData.length-1;+  for (var i in po.childrenData) {+    var nodeData = po.childrenData[i];+    if((!nodeData[1]) ||  (nodeData[1].indexOf('#')==-1)) // <- we added this line+      po.children[i] = newNode(o, po, nodeData[0], nodeData[1], nodeData[2], i==l);+  }+}++// Overloaded to adjust the size of the navtree wrt the toc+function resizeHeight() +{+  var header  = $("#top");+  var sidenav = $("#side-nav");+  var content = $("#doc-content");+  var navtree = $("#nav-tree");+  var footer  = $("#nav-path");+  var toc     = $("#nav-toc");++  var headerHeight = header.outerHeight();+  var footerHeight = footer.outerHeight();+  var tocHeight    = toc.height();+  var windowHeight = $(window).height() - headerHeight - footerHeight;+  content.css({height:windowHeight + "px"});+  navtree.css({height:(windowHeight-tocHeight) + "px"});+  sidenav.css({height:windowHeight + "px"});+}++// Overloaded to save the root node into global_navtree_object+function initNavTree(toroot,relpath)+{+  var o = new Object();+  global_navtree_object = o; // <- we added this line+  o.toroot = toroot;+  o.node = new Object();+  o.node.li = document.getElementById("nav-tree-contents");+  o.node.childrenData = NAVTREE;+  o.node.children = new Array();+  o.node.childrenUL = document.createElement("ul");+  o.node.getChildrenUL = function() { return o.node.childrenUL; };+  o.node.li.appendChild(o.node.childrenUL);+  o.node.depth = 0;+  o.node.relpath = relpath;+  o.node.expanded = false;+  o.node.isLast = true;+  o.node.plus_img = document.createElement("img");+  o.node.plus_img.src = relpath+"ftv2pnode.png";+  o.node.plus_img.width = 16;+  o.node.plus_img.height = 22;++  if (localStorageSupported()) {+    var navSync = $('#nav-sync');+    if (cachedLink()) {+      showSyncOff(navSync,relpath);+      navSync.removeClass('sync');+    } else {+      showSyncOn(navSync,relpath);+    }+    navSync.click(function(){ toggleSyncButton(relpath); });+  }++  navTo(o,toroot,window.location.hash,relpath);++  $(window).bind('hashchange', function(){+     if (window.location.hash && window.location.hash.length>1){+       var a;+       if ($(location).attr('hash')){+         var clslink=stripPath($(location).attr('pathname'))+':'++                               $(location).attr('hash').substring(1);+         a=$('.item a[class$="'+clslink+'"]');+       }+       if (a==null || !$(a).parent().parent().hasClass('selected')){+         $('.item').removeClass('selected');+         $('.item').removeAttr('id');+       }+       var link=stripPath2($(location).attr('pathname'));+       navTo(o,link,$(location).attr('hash'),relpath);+     } else if (!animationInProgress) {+       $('#doc-content').scrollTop(0);+       $('.item').removeClass('selected');+       $('.item').removeAttr('id');+       navTo(o,toroot,window.location.hash,relpath);+     }+  })++  $(window).load(showRoot);+}++// return false if the the node has no children at all, or has only section/subsection children+function checkChildrenData(node) {+  if (!(typeof(node.childrenData)==='string')) {+    for (var i in node.childrenData) {+      var url = node.childrenData[i][1];+      if(url.indexOf("#")==-1)+        return true;+    }+    return false;+  }+  return (node.childrenData);+}++// Modified to:+// 1 - remove the root node +// 2 - remove the section/subsection children+function createIndent(o,domNode,node,level)+{+  var level=-2; // <- we replaced level=-1 by level=-2+  var n = node;+  while (n.parentNode) { level++; n=n.parentNode; }+  if (checkChildrenData(node)) { // <- we modified this line to use checkChildrenData(node) instead of node.childrenData+    var imgNode = document.createElement("span");+    imgNode.className = 'arrow';+    imgNode.style.paddingLeft=(16*level).toString()+'px';+    imgNode.innerHTML=arrowRight;+    node.plus_img = imgNode;+    node.expandToggle = document.createElement("a");+    node.expandToggle.href = "javascript:void(0)";+    node.expandToggle.onclick = function() {+      if (node.expanded) {+        $(node.getChildrenUL()).slideUp("fast");+        node.plus_img.innerHTML=arrowRight;+        node.expanded = false;+      } else {+        expandNode(o, node, false, false);+      }+    }+    node.expandToggle.appendChild(imgNode);+    domNode.appendChild(node.expandToggle);+  } else {+    var span = document.createElement("span");+    span.className = 'arrow';+    span.style.width   = 16*(level+1)+'px';+    span.innerHTML = '&#160;';+    domNode.appendChild(span);+  }+}++// Overloaded to automatically expand the selected node+function selectAndHighlight(hash,n)+{+  var a;+  if (hash) {+    var link=stripPath($(location).attr('pathname'))+':'+hash.substring(1);+    a=$('.item a[class$="'+link+'"]');+  }+  if (a && a.length) {+    a.parent().parent().addClass('selected');+    a.parent().parent().attr('id','selected');+    highlightAnchor();+  } else if (n) {+    $(n.itemDiv).addClass('selected');+    $(n.itemDiv).attr('id','selected');+  }+  if ($('#nav-tree-contents .item:first').hasClass('selected')) {+    $('#nav-sync').css('top','30px');+  } else {+    $('#nav-sync').css('top','5px');+  }+  expandNode(global_navtree_object, n, true, true); // <- we added this line+  showRoot();+}+++$(document).ready(function() {+  +  generate_autotoc();+  +  (function (){ // wait until the first "selected" element has been created+    try {+      +      // this line will triger an exception if there is no #selected element, i.e., before the tree structure is complete.+      document.getElementById("selected").className = "item selected";+      +      // ok, the default tree has been created, we can keep going...+      +      // expand the "Chapters" node+      if(window.location.href.indexOf('unsupported')==-1)+        expandNode(global_navtree_object, global_navtree_object.node.children[0].children[2], true, true);+      else+        expandNode(global_navtree_object, global_navtree_object.node.children[0].children[1], true, true);+      +      // Hide the root node "Eigen"+      $(document.getElementsByClassName('index.html')[0]).parent().parent().css({display:"none"});+      +    } catch (err) {+      setTimeout(arguments.callee, 10);+    }+  })();++  $(window).load(resizeHeight);+});+
+ eigen3/doc/eigendoxy.css view
@@ -0,0 +1,223 @@++/******** Eigen specific CSS code ************/++/**** Styles removing elements ****/++/* remove the "modules|classes" link for module pages (they are already in the TOC) */+div.summary {+  display:none;+}++/* remove */+div.contents hr {+  display:none;+}++/**** ****/++p, dl.warning, dl.attention, dl.note+{+  max-width:60em;+  text-align:justify;+}++li {+  max-width:55em;+  text-align:justify;  +}++img {+  border: 0;+}++div.fragment {+  display:table; /* this allows the element to be larger than its parent */+  padding: 0pt;+}+pre.fragment {+  border: 1px solid #cccccc;++  margin: 2px 0px 2px 0px;+  padding: 3px 5px 3px 5px;+}++++/* Common style for all Eigen's tables */++table.example, table.manual, table.manual-vl, table.manual-hl {+    max-width:100%;+    border-collapse: collapse;+    border-style: solid;+    border-width: 1px;+    border-color: #cccccc;+    font-size: 1em;+    +    box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15);+    -moz-box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15);+    -webkit-box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15);+}++table.example th, table.manual th, table.manual-vl th, table.manual-hl th {+  padding: 0.5em 0.5em 0.5em 0.5em;+  text-align: left;+  padding-right: 1em;+  color: #555555;+  background-color: #F4F4E5;+  +  background-image: -webkit-gradient(linear,center top,center bottom,from(#FFFFFF), color-stop(0.3,#FFFFFF), color-stop(0.30,#FFFFFF), color-stop(0.98,#F4F4E5), to(#ECECDE));+  background-image: -moz-linear-gradient(center top, #FFFFFF 0%, #FFFFFF 30%, #F4F4E5 98%, #ECECDE);+  filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFFFFF', endColorstr='#F4F4E5');+}++table.example td, table.manual td, table.manual-vl td, table.manual-hl td {+  vertical-align:top;+  border-width: 1px;+  border-color: #cccccc;+}++/* header of headers */+table th.meta {+  text-align:center;+  font-size: 1.2em;+  background-color:#FFFFFF;+}++/* intermediate header */+table th.inter {+  text-align:left;+  background-color:#FFFFFF;+  background-image:none;+  border-style:solid solid solid solid;+  border-width: 1px;+	border-color: #cccccc;+}++/** class for exemple / output tables **/++table.example {+}++table.example th {+}++table.example td {+  padding: 0.5em 0.5em 0.5em 0.5em;+  vertical-align:top;+}++/* standard class for the manual */++table.manual, table.manual-vl, table.manual-hl {+    padding: 0.2em 0em 0.5em 0em;+}++table.manual th, table.manual-vl th, table.manual-hl th {+  margin: 0em 0em 0.3em 0em;+}++table.manual td, table.manual-vl td, table.manual-hl td {+  padding: 0.3em 0.5em 0.3em 0.5em;+  vertical-align:top;+  border-width: 1px;+}++table.manual td.alt, table.manual tr.alt, table.manual-vl td.alt, table.manual-vl tr.alt {+  background-color: #F4F4E5;+}++table.manual-vl th, table.manual-vl td, table.manual-vl td.alt {+  border-color: #cccccc;+  border-width: 1px;+  border-style: none solid none solid;+}++table.manual-vl th.inter {+  border-style: solid solid solid solid;+}++table.manual-hl td {+  border-color: #cccccc;+  border-width: 1px;+  border-style: solid none solid none;+}++table td.code {+  font-family: monospace;+}++h2 {+  margin-top:2em;+  border-style: none none solid none;+  border-width: 1px;+  border-color: #cccccc;+}++/**** Table of content in the side-nav ****/+++div.toc {+  margin:0;+  padding: 0.3em 0 0 0;+  width:100%;+  float:none;+  position:absolute;+  bottom:0;+  border-radius:0px;+  border-style: solid none none none;+  max-height:50%;+  overflow-y: scroll;+}++div.toc h3 {+  margin-left: 0.5em;+  margin-bottom: 0.2em;+}++div.toc ul {+  margin: 0.2em 0 0.4em 0.5em;+}++span.cpp11,span.cpp14,span.cpp17 {+  color: #119911;+  font-weight: bold;+}++/**** old Eigen's styles ****/+++table.tutorial_code td {+  border-color: transparent; /* required for Firefox */+  padding: 3pt 5pt 3pt 5pt;+  vertical-align: top;+}+++/* Whenever doxygen meets a '\n' or a '<BR/>', it will put + * the text containing the character into a <p class="starttd">.+ * This little hack together with table.tutorial_code td.note+ * aims at fixing this issue. */+table.tutorial_code td.note p.starttd {+  margin: 0px;+  border: none;+  padding: 0px;+}++div.eimainmenu {+  text-align:     center;+}++/* center version number on main page */+h3.version { +  text-align:     center;+}+++td.width20em p.endtd {+  width:  20em;+}++/* needed for huge screens */+.ui-resizable-e {+  background-repeat: repeat-y;+}
+ eigen3/doc/eigendoxy_footer.html.in view
@@ -0,0 +1,36 @@+<!-- start footer part -->+<!--BEGIN GENERATE_TREEVIEW-->+<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->+  <ul>+    $navpath+    <li class="footer">$generatedby+    <a href="http://www.doxygen.org/index.html">+    <img class="footer" src="$relpath^doxygen.png" alt="doxygen"/></a> $doxygenversion </li>+  </ul>+</div>+<!--END GENERATE_TREEVIEW-->+<!--BEGIN !GENERATE_TREEVIEW-->+<hr class="footer"/><address class="footer"><small>+$generatedby &#160;<a href="http://www.doxygen.org/index.html">+<img class="footer" src="$relpath^doxygen.png" alt="doxygen"/>+</a> $doxygenversion+</small></address>+<!--END !GENERATE_TREEVIEW-->++<!-- Piwik -->+<script type="text/javascript">+var pkBaseURL = (("https:" == document.location.protocol) ? "https://stats.sylphide-consulting.com/piwik/" : "http://stats.sylphide-consulting.com/piwik/");+document.write(unescape("%3Cscript src='" + pkBaseURL + "piwik.js' type='text/javascript'%3E%3C/script%3E"));+</script><script type="text/javascript">+try {+var piwikTracker = Piwik.getTracker(pkBaseURL + "piwik.php", 20);+piwikTracker.trackPageView();+piwikTracker.enableLinkTracking();+} catch( err ) {}+</script><noscript><p><img src="http://stats.sylphide-consulting.com/piwik/piwik.php?idsite=20" style="border:0" alt="" /></p></noscript>+<!-- End Piwik Tracking Code -->++</body>+</html>++
+ eigen3/doc/eigendoxy_header.html.in view
@@ -0,0 +1,59 @@+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">+<html xmlns="http://www.w3.org/1999/xhtml">+<head>+<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>+<meta http-equiv="X-UA-Compatible" content="IE=9"/>+<meta name="generator" content="Doxygen $doxygenversion"/>+<meta name="viewport" content="width=device-width, initial-scale=1"/>+<!--BEGIN PROJECT_NAME--><title>$projectname: $title</title><!--END PROJECT_NAME-->+<!--BEGIN !PROJECT_NAME--><title>$title</title><!--END !PROJECT_NAME-->+<link href="$relpath^tabs.css" rel="stylesheet" type="text/css"/>+<script type="text/javascript" src="$relpath^jquery.js"></script>+<script type="text/javascript" src="$relpath^dynsections.js"></script>+$treeview+$search+$mathjax+<link href="$relpath^$stylesheet" rel="stylesheet" type="text/css" />+<link href="$relpath$eigendoxy.css" rel="stylesheet" type="text/css">+<!-- $extrastylesheet -->+<script type="text/javascript" src="$relpath$eigen_navtree_hacks.js"></script>++</head>+<body>+<div id="top"><!-- do not remove this div, it is closed by doxygen! -->++<!--BEGIN TITLEAREA-->+<div id="titlearea">+<table cellspacing="0" cellpadding="0">+ <tbody>+ <tr style="height: 56px;">+  <!--BEGIN PROJECT_LOGO-->+  <td id="projectlogo"><img alt="Logo" src="$relpath^$projectlogo"/></td>+  <!--END PROJECT_LOGO-->+  <!--BEGIN PROJECT_NAME-->+  <td id="projectalign" style="padding-left: 0.5em;">+   <div id="projectname"><a href="http://eigen.tuxfamily.org">$projectname</a>+   <!--BEGIN PROJECT_NUMBER-->&#160;<span id="projectnumber">$projectnumber</span><!--END PROJECT_NUMBER-->+   </div>+   <!--BEGIN PROJECT_BRIEF--><div id="projectbrief">$projectbrief</div><!--END PROJECT_BRIEF-->+  </td>+  <!--END PROJECT_NAME-->+  <!--BEGIN !PROJECT_NAME-->+   <!--BEGIN PROJECT_BRIEF-->+    <td id="projectalign" style="padding-left: 0.5em;">+    <div id="projectbrief">$projectbrief</div>+    </td>+   <!--END PROJECT_BRIEF-->+  <!--END !PROJECT_NAME-->+  <!--BEGIN DISABLE_INDEX-->+   <!--BEGIN SEARCHENGINE-->+   <td>$searchbox</td>+   <!--END SEARCHENGINE-->+  <!--END DISABLE_INDEX-->+ </tr>+ </tbody>+</table>+</div>+<!--END TITLEAREA-->+<!-- end header part -->+
+ eigen3/doc/eigendoxy_layout.xml.in view
@@ -0,0 +1,178 @@+<?xml version="1.0"?>+<doxygenlayout version="1.0">+  <!-- Navigation index tabs for HTML output -->+  <navindex>+    <tab type="user" url="index.html" title="Overview" />+    <tab type="user" url="@ref GettingStarted" title="Getting started" />+    <tab type="modules" visible="yes" title="Chapters" intro=""/>+    <tab type="mainpage" visible="yes" title=""/>+    <tab type="classlist" visible="yes" title="" intro=""/>+<!--     <tab type="classmembers" visible="yes" title="" intro=""/> -->+  </navindex>++  <!-- Layout definition for a class page -->+  <class>+    <briefdescription visible="no"/>+    <includes visible="$SHOW_INCLUDE_FILES"/>+    <detaileddescription title=""/>+    <inheritancegraph visible="$CLASS_GRAPH"/>+    <collaborationgraph visible="$COLLABORATION_GRAPH"/>+    <allmemberslink visible="yes"/>+    <memberdecl>+      <nestedclasses visible="yes" title=""/>+      <publictypes title=""/>+      <publicslots title=""/>+      <signals title=""/>+      <publicmethods title=""/>+      <publicstaticmethods title=""/>+      <publicattributes title=""/>+      <publicstaticattributes title=""/>+      <protectedtypes title=""/>+      <protectedslots title=""/>+      <protectedmethods title=""/>+      <protectedstaticmethods title=""/>+      <protectedattributes title=""/>+      <protectedstaticattributes title=""/>+      <packagetypes title=""/>+      <packagemethods title=""/>+      <packagestaticmethods title=""/>+      <packageattributes title=""/>+      <packagestaticattributes title=""/>+      <properties title=""/>+      <events title=""/>+      <privatetypes title=""/>+      <privateslots title=""/>+      <privatemethods title=""/>+      <privatestaticmethods title=""/>+      <privateattributes title=""/>+      <privatestaticattributes title=""/>+      <friends title=""/>+      <related title="" subtitle=""/>+      <membergroups visible="yes"/>+    </memberdecl>+    +    <memberdef>+      <inlineclasses title=""/>+      <typedefs title=""/>+      <enums title=""/>+      <constructors title=""/>+      <functions title=""/>+      <related title=""/>+      <variables title=""/>+      <properties title=""/>+      <events title=""/>+    </memberdef>+    <usedfiles visible="$SHOW_USED_FILES"/>+    <authorsection visible="yes"/>+  </class>++  <!-- Layout definition for a namespace page -->+  <namespace>+    <briefdescription visible="yes"/>+    <memberdecl>+      <nestednamespaces visible="yes" title=""/>+      <classes visible="yes" title=""/>+      <typedefs title=""/>+      <enums title=""/>+      <functions title=""/>+      <variables title=""/>+      <membergroups visible="yes"/>+    </memberdecl>+    <detaileddescription title=""/>+    <memberdef>+      <inlineclasses title=""/>+      <typedefs title=""/>+      <enums title=""/>+      <functions title=""/>+      <variables title=""/>+    </memberdef>+    <authorsection visible="yes"/>+  </namespace>++  <!-- Layout definition for a file page -->+  <file>+    <briefdescription visible="yes"/>+    <includes visible="$SHOW_INCLUDE_FILES"/>+    <includegraph visible="$INCLUDE_GRAPH"/>+    <includedbygraph visible="$INCLUDED_BY_GRAPH"/>+    <sourcelink visible="yes"/>+    <memberdecl>+      <classes visible="yes" title=""/>+      <namespaces visible="yes" title=""/>+      <defines title=""/>+      <typedefs title=""/>+      <enums title=""/>+      <functions title=""/>+      <variables title=""/>+      <membergroups visible="yes"/>+    </memberdecl>+    <detaileddescription title=""/>+    <memberdef>+      <inlineclasses title=""/>+      <defines title=""/>+      <typedefs title=""/>+      <enums title=""/>+      <functions title=""/>+      <variables title=""/>+    </memberdef>+    <authorsection/>+  </file>++  <!-- Layout definition for a group page -->+  <group>+    <briefdescription visible="no"/>+    <detaileddescription title=""/>+    <groupgraph visible="$GROUP_GRAPHS"/>+    <memberdecl>+      <nestedgroups visible="yes" title=""/>+      <dirs visible="yes" title=""/>+      <files visible="yes" title=""/>+      <namespaces visible="yes" title=""/>+      <classes visible="yes" title=""/>+      <defines title=""/>+      <typedefs title=""/>+      <enums title=""/>+      <enumvalues title=""/>+      <functions title=""/>+      <variables title=""/>+      <signals title=""/>+      <publicslots title=""/>+      <protectedslots title=""/>+      <privateslots title=""/>+      <events title=""/>+      <properties title=""/>+      <friends title=""/>+      <membergroups visible="yes"/>+    </memberdecl>+    +    <memberdef>+      <pagedocs/>+      <inlineclasses title=""/>+      <defines title=""/>+      <typedefs title=""/>+      <enums title=""/>+      <enumvalues title=""/>+      <functions title=""/>+      <variables title=""/>+      <signals title=""/>+      <publicslots title=""/>+      <protectedslots title=""/>+      <privateslots title=""/>+      <events title=""/>+      <properties title=""/>+      <friends title=""/>+    </memberdef>+    <authorsection visible="yes"/>+  </group>++  <!-- Layout definition for a directory page -->+  <directory>+    <briefdescription visible="yes"/>+    <directorygraph visible="yes"/>+    <memberdecl>+      <dirs visible="yes"/>+      <files visible="yes"/>+    </memberdecl>+    <detaileddescription title=""/>+  </directory>+</doxygenlayout>
+ eigen3/doc/eigendoxy_tabs.css view
@@ -0,0 +1,59 @@+.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);+}
+ eigen3/doc/examples/.krazy view
@@ -0,0 +1,2 @@+EXCLUDE copyright+EXCLUDE license
+ eigen3/doc/examples/CMakeLists.txt view
@@ -0,0 +1,21 @@+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(example_src)++check_cxx_compiler_flag("-std=c++11" EIGEN_COMPILER_SUPPORT_CPP11)+if(EIGEN_COMPILER_SUPPORT_CPP11)+ei_add_target_property(nullary_indexing COMPILE_FLAGS "-std=c++11")+endif()
+ eigen3/doc/examples/CustomizingEigen_Inheritance.cpp view
@@ -0,0 +1,30 @@+#include <Eigen/Core>+#include <iostream>++class MyVectorType : public Eigen::VectorXd+{+public:+    MyVectorType(void):Eigen::VectorXd() {}++    // This constructor allows you to construct MyVectorType from Eigen expressions+    template<typename OtherDerived>+    MyVectorType(const Eigen::MatrixBase<OtherDerived>& other)+        : Eigen::VectorXd(other)+    { }++    // This method allows you to assign Eigen expressions to MyVectorType+    template<typename OtherDerived>+    MyVectorType& operator=(const Eigen::MatrixBase <OtherDerived>& 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;+}
+ eigen3/doc/examples/Cwise_erf.cpp view
@@ -0,0 +1,9 @@+#include <Eigen/Core>+#include <unsupported/Eigen/SpecialFunctions>+#include <iostream>+using namespace Eigen;+int main()+{+  Array4d v(-0.5,2,0,-7);+  std::cout << v.erf() << std::endl;+}
+ eigen3/doc/examples/Cwise_erfc.cpp view
@@ -0,0 +1,9 @@+#include <Eigen/Core>+#include <unsupported/Eigen/SpecialFunctions>+#include <iostream>+using namespace Eigen;+int main()+{+  Array4d v(-0.5,2,0,-7);+  std::cout << v.erfc() << std::endl;+}
+ eigen3/doc/examples/Cwise_lgamma.cpp view
@@ -0,0 +1,9 @@+#include <Eigen/Core>+#include <unsupported/Eigen/SpecialFunctions>+#include <iostream>+using namespace Eigen;+int main()+{+  Array4d v(0.5,10,0,-1);+  std::cout << v.lgamma() << std::endl;+}
+ eigen3/doc/examples/DenseBase_middleCols_int.cpp view
@@ -0,0 +1,15 @@+#include <Eigen/Core>+#include <iostream>++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;+}
+ eigen3/doc/examples/DenseBase_middleRows_int.cpp view
@@ -0,0 +1,15 @@+#include <Eigen/Core>+#include <iostream>++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;+}
+ eigen3/doc/examples/DenseBase_template_int_middleCols.cpp view
@@ -0,0 +1,15 @@+#include <Eigen/Core>+#include <iostream>++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;+}
+ eigen3/doc/examples/DenseBase_template_int_middleRows.cpp view
@@ -0,0 +1,15 @@+#include <Eigen/Core>+#include <iostream>++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;+}
+ eigen3/doc/examples/QuickStart_example.cpp view
@@ -0,0 +1,14 @@+#include <iostream>+#include <Eigen/Dense>++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;+}
+ eigen3/doc/examples/QuickStart_example2_dynamic.cpp view
@@ -0,0 +1,15 @@+#include <iostream>+#include <Eigen/Dense>++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;+}
+ eigen3/doc/examples/QuickStart_example2_fixed.cpp view
@@ -0,0 +1,15 @@+#include <iostream>+#include <Eigen/Dense>++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;+}
+ eigen3/doc/examples/TemplateKeyword_flexible.cpp view
@@ -0,0 +1,22 @@+#include <Eigen/Dense>+#include <iostream>++using namespace Eigen;++template <typename Derived1, typename Derived2>+void copyUpperTriangularPart(MatrixBase<Derived1>& dst, const MatrixBase<Derived2>& src)+{+  /* Note the 'template' keywords in the following line! */+  dst.template triangularView<Upper>() = src.template triangularView<Upper>();+}++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;+}
+ eigen3/doc/examples/TemplateKeyword_simple.cpp view
@@ -0,0 +1,20 @@+#include <Eigen/Dense>+#include <iostream>++using namespace Eigen;++void copyUpperTriangularPart(MatrixXf& dst, const MatrixXf& src)+{+  dst.triangularView<Upper>() = src.triangularView<Upper>();+}++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;+}
+ eigen3/doc/examples/TutorialInplaceLU.cpp view
@@ -0,0 +1,61 @@+#include <iostream>+struct init {+  init() { std::cout << "[" << "init" << "]" << std::endl; }+};+init init_obj;+// [init]+#include <iostream>+#include <Eigen/Dense>++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<Ref<MatrixXd> > 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;++}
+ eigen3/doc/examples/TutorialLinAlgComputeTwice.cpp view
@@ -0,0 +1,23 @@+#include <iostream>+#include <Eigen/Dense>++using namespace std;+using namespace Eigen;++int main()+{+   Matrix2f A, b;+   LLT<Matrix2f> 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;+}
+ eigen3/doc/examples/TutorialLinAlgExComputeSolveError.cpp view
@@ -0,0 +1,14 @@+#include <iostream>+#include <Eigen/Dense>++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;+}
+ eigen3/doc/examples/TutorialLinAlgExSolveColPivHouseholderQR.cpp view
@@ -0,0 +1,17 @@+#include <iostream>+#include <Eigen/Dense>++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;+}
+ eigen3/doc/examples/TutorialLinAlgExSolveLDLT.cpp view
@@ -0,0 +1,16 @@+#include <iostream>+#include <Eigen/Dense>++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;+}
+ eigen3/doc/examples/TutorialLinAlgInverseDeterminant.cpp view
@@ -0,0 +1,16 @@+#include <iostream>+#include <Eigen/Dense>++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;+}
+ eigen3/doc/examples/TutorialLinAlgRankRevealing.cpp view
@@ -0,0 +1,20 @@+#include <iostream>+#include <Eigen/Dense>++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<Matrix3f> 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+}
+ eigen3/doc/examples/TutorialLinAlgSVDSolve.cpp view
@@ -0,0 +1,15 @@+#include <iostream>+#include <Eigen/Dense>++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;+}
+ eigen3/doc/examples/TutorialLinAlgSelfAdjointEigenSolver.cpp view
@@ -0,0 +1,18 @@+#include <iostream>+#include <Eigen/Dense>++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<Matrix2f> 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;+}
+ eigen3/doc/examples/TutorialLinAlgSetThreshold.cpp view
@@ -0,0 +1,16 @@+#include <iostream>+#include <Eigen/Dense>++using namespace std;+using namespace Eigen;++int main()+{+   Matrix2d A;+   A << 2, 1,+        2, 0.9999999999;+   FullPivLU<Matrix2d> 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;+}
+ eigen3/doc/examples/Tutorial_ArrayClass_accessors.cpp view
@@ -0,0 +1,24 @@+#include <Eigen/Dense>+#include <iostream>++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;+}
+ eigen3/doc/examples/Tutorial_ArrayClass_addition.cpp view
@@ -0,0 +1,23 @@+#include <Eigen/Dense>+#include <iostream>++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;+}
+ eigen3/doc/examples/Tutorial_ArrayClass_cwise_other.cpp view
@@ -0,0 +1,19 @@+#include <Eigen/Dense>+#include <iostream>++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;+}
+ eigen3/doc/examples/Tutorial_ArrayClass_interop.cpp view
@@ -0,0 +1,22 @@+#include <Eigen/Dense>+#include <iostream>++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;+}
+ eigen3/doc/examples/Tutorial_ArrayClass_interop_matrix.cpp view
@@ -0,0 +1,26 @@+#include <Eigen/Dense>+#include <iostream>++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;+}
+ eigen3/doc/examples/Tutorial_ArrayClass_mult.cpp view
@@ -0,0 +1,16 @@+#include <Eigen/Dense>+#include <iostream>++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;+}
+ eigen3/doc/examples/Tutorial_BlockOperations_block_assignment.cpp view
@@ -0,0 +1,18 @@+#include <Eigen/Dense>+#include <iostream>++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 2x2 block:" << endl << a << endl << endl;+}
+ eigen3/doc/examples/Tutorial_BlockOperations_colrow.cpp view
@@ -0,0 +1,17 @@+#include <Eigen/Dense>+#include <iostream>++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;+}
+ eigen3/doc/examples/Tutorial_BlockOperations_corner.cpp view
@@ -0,0 +1,17 @@+#include <Eigen/Dense>+#include <iostream>++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;+}
+ eigen3/doc/examples/Tutorial_BlockOperations_print_block.cpp view
@@ -0,0 +1,20 @@+#include <Eigen/Dense>+#include <iostream>++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;+  }+}
+ eigen3/doc/examples/Tutorial_BlockOperations_vector.cpp view
@@ -0,0 +1,14 @@+#include <Eigen/Dense>+#include <iostream>++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;+}
+ eigen3/doc/examples/Tutorial_PartialLU_solve.cpp view
@@ -0,0 +1,18 @@+#include <Eigen/Core>+#include <Eigen/LU>+#include <iostream>++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;+}
+ eigen3/doc/examples/Tutorial_ReductionsVisitorsBroadcasting_broadcast_1nn.cpp view
@@ -0,0 +1,24 @@+#include <iostream>+#include <Eigen/Dense>++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;+}
+ eigen3/doc/examples/Tutorial_ReductionsVisitorsBroadcasting_broadcast_simple.cpp view
@@ -0,0 +1,21 @@+#include <iostream>+#include <Eigen/Dense>++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;+}
+ eigen3/doc/examples/Tutorial_ReductionsVisitorsBroadcasting_broadcast_simple_rowwise.cpp view
@@ -0,0 +1,20 @@+#include <iostream>+#include <Eigen/Dense>++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;+}
+ eigen3/doc/examples/Tutorial_ReductionsVisitorsBroadcasting_colwise.cpp view
@@ -0,0 +1,13 @@+#include <iostream>+#include <Eigen/Dense>++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;+}
+ eigen3/doc/examples/Tutorial_ReductionsVisitorsBroadcasting_maxnorm.cpp view
@@ -0,0 +1,20 @@+#include <iostream>+#include <Eigen/Dense>++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;+}
+ eigen3/doc/examples/Tutorial_ReductionsVisitorsBroadcasting_reductions_bool.cpp view
@@ -0,0 +1,21 @@+#include <Eigen/Dense>+#include <iostream>++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;+}
+ eigen3/doc/examples/Tutorial_ReductionsVisitorsBroadcasting_reductions_norm.cpp view
@@ -0,0 +1,28 @@+#include <Eigen/Dense>+#include <iostream>++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<Infinity>() = " << v.lpNorm<Infinity>() << 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<Infinity>() = " << m.lpNorm<Infinity>() << endl;+}
+ eigen3/doc/examples/Tutorial_ReductionsVisitorsBroadcasting_reductions_operatornorm.cpp view
@@ -0,0 +1,18 @@+#include <Eigen/Dense>+#include <iostream>++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;+}
+ eigen3/doc/examples/Tutorial_ReductionsVisitorsBroadcasting_rowwise.cpp view
@@ -0,0 +1,13 @@+#include <iostream>+#include <Eigen/Dense>++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;+}
+ eigen3/doc/examples/Tutorial_ReductionsVisitorsBroadcasting_visitors.cpp view
@@ -0,0 +1,26 @@+#include <iostream>+#include <Eigen/Dense>++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;+}
+ eigen3/doc/examples/Tutorial_simple_example_dynamic_size.cpp view
@@ -0,0 +1,22 @@+#include <Eigen/Core>+#include <iostream>++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<m.cols(); ++j)   // loop over columns+      for (int i=0; i<m.rows(); ++i) // loop over rows+        m(i,j) = i+j*size;           // to access matrix coefficients,+                                     // use operator()(int,int)+    std::cout << m << "\n\n";+  }++  VectorXf v(4); // a vector of 4 float's+  // to access vector coefficients, use either operator () or operator []+  v[0] = 1; v[1] = 2; v(2) = 3; v(3) = 4;+  std::cout << "\nv:\n" << v << std::endl;+}
+ eigen3/doc/examples/Tutorial_simple_example_fixed_size.cpp view
@@ -0,0 +1,15 @@+#include <Eigen/Core>+#include <iostream>++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;+}
+ eigen3/doc/examples/class_Block.cpp view
@@ -0,0 +1,27 @@+#include <Eigen/Core>+#include <iostream>+using namespace Eigen;+using namespace std;++template<typename Derived>+Eigen::Block<Derived>+topLeftCorner(MatrixBase<Derived>& m, int rows, int cols)+{+  return Eigen::Block<Derived>(m.derived(), 0, 0, rows, cols);+}++template<typename Derived>+const Eigen::Block<const Derived>+topLeftCorner(const MatrixBase<Derived>& m, int rows, int cols)+{+  return Eigen::Block<const Derived>(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;+}
+ eigen3/doc/examples/class_CwiseBinaryOp.cpp view
@@ -0,0 +1,18 @@+#include <Eigen/Core>+#include <iostream>+using namespace Eigen;+using namespace std;++// define a custom template binary functor+template<typename Scalar> struct MakeComplexOp {+  EIGEN_EMPTY_STRUCT_CTOR(MakeComplexOp)+  typedef complex<Scalar> result_type;+  complex<Scalar> operator()(const Scalar& a, const Scalar& b) const { return complex<Scalar>(a,b); }+};++int main(int, char**)+{+  Matrix4d m1 = Matrix4d::Random(), m2 = Matrix4d::Random();+  cout << m1.binaryExpr(m2, MakeComplexOp<double>()) << endl;+  return 0;+}
+ eigen3/doc/examples/class_CwiseUnaryOp.cpp view
@@ -0,0 +1,19 @@+#include <Eigen/Core>+#include <iostream>+using namespace Eigen;+using namespace std;++// define a custom template unary functor+template<typename Scalar>+struct CwiseClampOp {+  CwiseClampOp(const Scalar& inf, const Scalar& sup) : m_inf(inf), m_sup(sup) {}+  const Scalar operator()(const Scalar& x) const { return x<m_inf ? m_inf : (x>m_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<double>(-0.5,0.5)) << endl;+  return 0;+}
+ eigen3/doc/examples/class_CwiseUnaryOp_ptrfun.cpp view
@@ -0,0 +1,20 @@+#include <Eigen/Core>+#include <iostream>+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;+}
+ eigen3/doc/examples/class_FixedBlock.cpp view
@@ -0,0 +1,27 @@+#include <Eigen/Core>+#include <iostream>+using namespace Eigen;+using namespace std;++template<typename Derived>+Eigen::Block<Derived, 2, 2>+topLeft2x2Corner(MatrixBase<Derived>& m)+{+  return Eigen::Block<Derived, 2, 2>(m.derived(), 0, 0);+}++template<typename Derived>+const Eigen::Block<const Derived, 2, 2>+topLeft2x2Corner(const MatrixBase<Derived>& m)+{+  return Eigen::Block<const Derived, 2, 2>(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;+}
+ eigen3/doc/examples/class_FixedVectorBlock.cpp view
@@ -0,0 +1,27 @@+#include <Eigen/Core>+#include <iostream>+using namespace Eigen;+using namespace std;++template<typename Derived>+Eigen::VectorBlock<Derived, 2>+firstTwo(MatrixBase<Derived>& v)+{+  return Eigen::VectorBlock<Derived, 2>(v.derived(), 0);+}++template<typename Derived>+const Eigen::VectorBlock<const Derived, 2>+firstTwo(const MatrixBase<Derived>& v)+{+  return Eigen::VectorBlock<const Derived, 2>(v.derived(), 0);+}++int main(int, char**)+{+  Matrix<int,1,6> 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;+}
+ eigen3/doc/examples/class_VectorBlock.cpp view
@@ -0,0 +1,27 @@+#include <Eigen/Core>+#include <iostream>+using namespace Eigen;+using namespace std;++template<typename Derived>+Eigen::VectorBlock<Derived>+segmentFromRange(MatrixBase<Derived>& v, int start, int end)+{+  return Eigen::VectorBlock<Derived>(v.derived(), start, end-start);+}++template<typename Derived>+const Eigen::VectorBlock<const Derived>+segmentFromRange(const MatrixBase<Derived>& v, int start, int end)+{+  return Eigen::VectorBlock<const Derived>(v.derived(), start, end-start);+}++int main(int, char**)+{+  Matrix<int,1,6> 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;+}
+ eigen3/doc/examples/function_taking_eigenbase.cpp view
@@ -0,0 +1,18 @@+#include <iostream>+#include <Eigen/Core>+using namespace Eigen;++template <typename Derived>+void print_size(const EigenBase<Derived>& 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());+}
+ eigen3/doc/examples/function_taking_ref.cpp view
@@ -0,0 +1,19 @@+#include <iostream>+#include <Eigen/SVD>+using namespace Eigen;+using namespace std;++float inv_cond(const Ref<const MatrixXf>& 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;+}
+ eigen3/doc/examples/make_circulant.cpp view
@@ -0,0 +1,11 @@+/*+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"
+ eigen3/doc/examples/make_circulant.cpp.entry view
@@ -0,0 +1,5 @@+template <class ArgType>+Circulant<ArgType> makeCirculant(const Eigen::MatrixBase<ArgType>& arg)+{+  return Circulant<ArgType>(arg.derived());+}
+ eigen3/doc/examples/make_circulant.cpp.evaluator view
@@ -0,0 +1,32 @@+namespace Eigen {+  namespace internal {+    template<typename ArgType>+    struct evaluator<Circulant<ArgType> >+      : evaluator_base<Circulant<ArgType> >+    {+      typedef Circulant<ArgType> XprType;+      typedef typename nested_eval<ArgType, XprType::ColsAtCompileTime>::type ArgTypeNested;+      typedef typename remove_all<ArgTypeNested>::type ArgTypeNestedCleaned;+      typedef typename XprType::CoeffReturnType CoeffReturnType;++      enum { +        CoeffReadCost = evaluator<ArgTypeNestedCleaned>::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<ArgTypeNestedCleaned> m_argImpl;+      const Index m_rows;+    };+  }+}
+ eigen3/doc/examples/make_circulant.cpp.expression view
@@ -0,0 +1,20 @@+template <class ArgType>+class Circulant : public Eigen::MatrixBase<Circulant<ArgType> >+{+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<Circulant>::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<ArgType>::type ArgTypeNested;+  ArgTypeNested m_arg;+};
+ eigen3/doc/examples/make_circulant.cpp.main view
@@ -0,0 +1,8 @@+int main()+{+  Eigen::VectorXd vec(4);+  vec << 1, 2, 4, 8;+  Eigen::MatrixXd mat;+  mat = makeCirculant(vec);+  std::cout << mat << std::endl;+}
+ eigen3/doc/examples/make_circulant.cpp.preamble view
@@ -0,0 +1,4 @@+#include <Eigen/Core>+#include <iostream>++template <class ArgType> class Circulant;
+ eigen3/doc/examples/make_circulant.cpp.traits view
@@ -0,0 +1,19 @@+namespace Eigen {+  namespace internal {+    template <class ArgType>+    struct traits<Circulant<ArgType> >+    {+      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+      };+    };+  }+}
+ eigen3/doc/examples/make_circulant2.cpp view
@@ -0,0 +1,52 @@+#include <Eigen/Core>+#include <iostream>++using namespace Eigen;++// [circulant_func]+template<class ArgType>+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<class ArgType>+struct circulant_helper {+  typedef Matrix<typename ArgType::Scalar,+                 ArgType::SizeAtCompileTime,+                 ArgType::SizeAtCompileTime,+                 ColMajor,+                 ArgType::MaxSizeAtCompileTime,+                 ArgType::MaxSizeAtCompileTime> MatrixType;+};+// [square]++// [makeCirculant]+template <class ArgType>+CwiseNullaryOp<circulant_functor<ArgType>, typename circulant_helper<ArgType>::MatrixType>+makeCirculant(const Eigen::MatrixBase<ArgType>& arg)+{+  typedef typename circulant_helper<ArgType>::MatrixType MatrixType;+  return MatrixType::NullaryExpr(arg.size(), arg.size(), circulant_functor<ArgType>(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]
+ eigen3/doc/examples/matrixfree_cg.cpp view
@@ -0,0 +1,129 @@+#include <iostream>+#include <Eigen/Core>+#include <Eigen/Dense>+#include <Eigen/IterativeLinearSolvers>+#include <unsupported/Eigen/IterativeSolvers>++class MatrixReplacement;+using Eigen::SparseMatrix;++namespace Eigen {+namespace internal {+  // MatrixReplacement looks-like a SparseMatrix, so let's inherits its traits:+  template<>+  struct traits<MatrixReplacement> :  public Eigen::internal::traits<Eigen::SparseMatrix<double> >+  {};+}+}++// 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<MatrixReplacement> {+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<typename Rhs>+  Eigen::Product<MatrixReplacement,Rhs,Eigen::AliasFreeProduct> operator*(const Eigen::MatrixBase<Rhs>& x) const {+    return Eigen::Product<MatrixReplacement,Rhs,Eigen::AliasFreeProduct>(*this, x.derived());+  }++  // Custom API:+  MatrixReplacement() : mp_mat(0) {}++  void attachMyMatrix(const SparseMatrix<double> &mat) {+    mp_mat = &mat;+  }+  const SparseMatrix<double> my_matrix() const { return *mp_mat; }++private:+  const SparseMatrix<double> *mp_mat;+};+++// Implementation of MatrixReplacement * Eigen::DenseVector though a specialization of internal::generic_product_impl:+namespace Eigen {+namespace internal {++  template<typename Rhs>+  struct generic_product_impl<MatrixReplacement, Rhs, SparseShape, DenseShape, GemvProduct> // GEMV stands for matrix-vector+  : generic_product_impl_base<MatrixReplacement,Rhs,generic_product_impl<MatrixReplacement,Rhs> >+  {+    typedef typename Product<MatrixReplacement,Rhs>::Scalar Scalar;++    template<typename Dest>+    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<lhs.cols(); ++i)+        dst += rhs(i) * lhs.my_matrix().col(i);+    }+  };++}+}++int main()+{+  int n = 10;+  Eigen::SparseMatrix<double> 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<MatrixReplacement, Eigen::Lower|Eigen::Upper, Eigen::IdentityPreconditioner> cg;+    cg.compute(A);+    x = cg.solve(b);+    std::cout << "CG:       #iterations: " << cg.iterations() << ", estimated error: " << cg.error() << std::endl;+  }++  {+    Eigen::BiCGSTAB<MatrixReplacement, Eigen::IdentityPreconditioner> bicg;+    bicg.compute(A);+    x = bicg.solve(b);+    std::cout << "BiCGSTAB: #iterations: " << bicg.iterations() << ", estimated error: " << bicg.error() << std::endl;+  }++  {+    Eigen::GMRES<MatrixReplacement, Eigen::IdentityPreconditioner> gmres;+    gmres.compute(A);+    x = gmres.solve(b);+    std::cout << "GMRES:    #iterations: " << gmres.iterations() << ", estimated error: " << gmres.error() << std::endl;+  }++  {+    Eigen::DGMRES<MatrixReplacement, Eigen::IdentityPreconditioner> gmres;+    gmres.compute(A);+    x = gmres.solve(b);+    std::cout << "DGMRES:   #iterations: " << gmres.iterations() << ", estimated error: " << gmres.error() << std::endl;+  }++  {+    Eigen::MINRES<MatrixReplacement, Eigen::Lower|Eigen::Upper, Eigen::IdentityPreconditioner> minres;+    minres.compute(A);+    x = minres.solve(b);+    std::cout << "MINRES:   #iterations: " << minres.iterations() << ", estimated error: " << minres.error() << std::endl;+  }+}
+ eigen3/doc/examples/nullary_indexing.cpp view
@@ -0,0 +1,66 @@+#include <Eigen/Core>+#include <iostream>++using namespace Eigen;++// [functor]+template<class ArgType, class RowIndexType, class ColIndexType>+class indexing_functor {+  const ArgType &m_arg;+  const RowIndexType &m_rowIndices;+  const ColIndexType &m_colIndices;+public:+  typedef Matrix<typename ArgType::Scalar,+                 RowIndexType::SizeAtCompileTime,+                 ColIndexType::SizeAtCompileTime,+                 ArgType::Flags&RowMajorBit?RowMajor:ColMajor,+                 RowIndexType::MaxSizeAtCompileTime,+                 ColIndexType::MaxSizeAtCompileTime> 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 <class ArgType, class RowIndexType, class ColIndexType>+CwiseNullaryOp<indexing_functor<ArgType,RowIndexType,ColIndexType>, typename indexing_functor<ArgType,RowIndexType,ColIndexType>::MatrixType>+indexing(const Eigen::MatrixBase<ArgType>& arg, const RowIndexType& row_indices, const ColIndexType& col_indices)+{+  typedef indexing_functor<ArgType,RowIndexType,ColIndexType> 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 = 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 =  indexing(A, ri+1, ci);+  std::cout << "A(ri+1,ci) =" << std::endl;+  std::cout << B << std::endl << std::endl;+#if __cplusplus >= 201103L+  B =  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";+}+
+ eigen3/doc/examples/tut_arithmetic_add_sub.cpp view
@@ -0,0 +1,22 @@+#include <iostream>+#include <Eigen/Dense>++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;+}
+ eigen3/doc/examples/tut_arithmetic_dot_cross.cpp view
@@ -0,0 +1,15 @@+#include <iostream>+#include <Eigen/Dense>++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;+}
+ eigen3/doc/examples/tut_arithmetic_matrix_mul.cpp view
@@ -0,0 +1,19 @@+#include <iostream>+#include <Eigen/Dense>++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;+}
+ eigen3/doc/examples/tut_arithmetic_redux_basic.cpp view
@@ -0,0 +1,16 @@+#include <iostream>+#include <Eigen/Dense>++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;+}
+ eigen3/doc/examples/tut_arithmetic_scalar_mul_div.cpp view
@@ -0,0 +1,17 @@+#include <iostream>+#include <Eigen/Dense>++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;+}
+ eigen3/doc/examples/tut_matrix_coefficient_accessors.cpp view
@@ -0,0 +1,18 @@+#include <iostream>+#include <Eigen/Dense>++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;+}
+ eigen3/doc/examples/tut_matrix_resize.cpp view
@@ -0,0 +1,18 @@+#include <iostream>+#include <Eigen/Dense>++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;+}
+ eigen3/doc/examples/tut_matrix_resize_fixed_size.cpp view
@@ -0,0 +1,12 @@+#include <iostream>+#include <Eigen/Dense>++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;+}
+ eigen3/doc/ftv2node.png view

binary file changed (absent → 86 bytes)

+ eigen3/doc/ftv2pnode.png view

binary file changed (absent → 229 bytes)

+ eigen3/doc/snippets/.krazy view
@@ -0,0 +1,2 @@+EXCLUDE copyright+EXCLUDE license
+ eigen3/doc/snippets/AngleAxis_mimic_euler.cpp view
@@ -0,0 +1,5 @@+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;
+ eigen3/doc/snippets/BiCGSTAB_simple.cpp view
@@ -0,0 +1,11 @@+  int n = 10000;+  VectorXd x(n), b(n);+  SparseMatrix<double> A(n,n);+  /* ... fill A and b ... */ +  BiCGSTAB<SparseMatrix<double> > 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
+ eigen3/doc/snippets/BiCGSTAB_step_by_step.cpp view
@@ -0,0 +1,14 @@+  int n = 10000;+  VectorXd x(n), b(n);+  SparseMatrix<double> A(n,n);+  /* ... fill A and b ... */ +  BiCGSTAB<SparseMatrix<double> > 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);
+ eigen3/doc/snippets/CMakeLists.txt view
@@ -0,0 +1,26 @@+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()+  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(snippet_src)
+ eigen3/doc/snippets/ColPivHouseholderQR_solve.cpp view
@@ -0,0 +1,8 @@+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;
+ eigen3/doc/snippets/ComplexEigenSolver_compute.cpp view
@@ -0,0 +1,16 @@+MatrixXcf A = MatrixXcf::Random(4,4);+cout << "Here is a random 4x4 matrix, A:" << endl << A << endl << endl;++ComplexEigenSolver<MatrixXcf> 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<float> 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;
+ eigen3/doc/snippets/ComplexEigenSolver_eigenvalues.cpp view
@@ -0,0 +1,4 @@+MatrixXcf ones = MatrixXcf::Ones(3,3);+ComplexEigenSolver<MatrixXcf> ces(ones, /* computeEigenvectors = */ false);+cout << "The eigenvalues of the 3x3 matrix of ones are:" +     << endl << ces.eigenvalues() << endl;
+ eigen3/doc/snippets/ComplexEigenSolver_eigenvectors.cpp view
@@ -0,0 +1,4 @@+MatrixXcf ones = MatrixXcf::Ones(3,3);+ComplexEigenSolver<MatrixXcf> ces(ones);+cout << "The first eigenvector of the 3x3 matrix of ones is:" +     << endl << ces.eigenvectors().col(1) << endl;
+ eigen3/doc/snippets/ComplexSchur_compute.cpp view
@@ -0,0 +1,6 @@+MatrixXcf A = MatrixXcf::Random(4,4);+ComplexSchur<MatrixXcf> 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;
+ eigen3/doc/snippets/ComplexSchur_matrixT.cpp view
@@ -0,0 +1,4 @@+MatrixXcf A = MatrixXcf::Random(4,4);+cout << "Here is a random 4x4 matrix, A:" << endl << A << endl << endl;+ComplexSchur<MatrixXcf> schurOfA(A, false); // false means do not compute U+cout << "The triangular matrix T is:" << endl << schurOfA.matrixT() << endl;
+ eigen3/doc/snippets/ComplexSchur_matrixU.cpp view
@@ -0,0 +1,4 @@+MatrixXcf A = MatrixXcf::Random(4,4);+cout << "Here is a random 4x4 matrix, A:" << endl << A << endl << endl;+ComplexSchur<MatrixXcf> schurOfA(A);+cout << "The unitary matrix U is:" << endl << schurOfA.matrixU() << endl;
+ eigen3/doc/snippets/Cwise_abs.cpp view
@@ -0,0 +1,2 @@+Array3d v(1,-2,-3);+cout << v.abs() << endl;
+ eigen3/doc/snippets/Cwise_abs2.cpp view
@@ -0,0 +1,2 @@+Array3d v(1,-2,-3);+cout << v.abs2() << endl;
+ eigen3/doc/snippets/Cwise_acos.cpp view
@@ -0,0 +1,2 @@+Array3d v(0, sqrt(2.)/2, 1);+cout << v.acos() << endl;
+ eigen3/doc/snippets/Cwise_arg.cpp view
@@ -0,0 +1,3 @@+ArrayXcf v = ArrayXcf::Random(3);+cout << v << endl << endl;+cout << arg(v) << endl;
+ eigen3/doc/snippets/Cwise_array_power_array.cpp view
@@ -0,0 +1,4 @@+Array<double,1,3> 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
+ eigen3/doc/snippets/Cwise_asin.cpp view
@@ -0,0 +1,2 @@+Array3d v(0, sqrt(2.)/2, 1);+cout << v.asin() << endl;
+ eigen3/doc/snippets/Cwise_atan.cpp view
@@ -0,0 +1,2 @@+ArrayXd v = ArrayXd::LinSpaced(5,0,1);+cout << v.atan() << endl;
+ eigen3/doc/snippets/Cwise_boolean_and.cpp view
@@ -0,0 +1,2 @@+Array3d v(-1,2,1), w(-3,2,3);+cout << ((v<w) && (v<0)) << endl;
+ eigen3/doc/snippets/Cwise_boolean_not.cpp view
@@ -0,0 +1,5 @@+Array3d v(1,2,3);+v(1) *= 0.0/0.0;+v(2) /= 0.0;+cout << v << endl << endl;+cout << !isfinite(v) << endl;
+ eigen3/doc/snippets/Cwise_boolean_or.cpp view
@@ -0,0 +1,2 @@+Array3d v(-1,2,1), w(-3,2,3);+cout << ((v<w) || (v<0)) << endl;
+ eigen3/doc/snippets/Cwise_boolean_xor.cpp view
@@ -0,0 +1,2 @@+Array3d v(-1,2,1), w(-3,2,3);+cout << ((v<w) ^ (v<0)) << endl;
+ eigen3/doc/snippets/Cwise_ceil.cpp view
@@ -0,0 +1,3 @@+ArrayXd v = ArrayXd::LinSpaced(7,-2,2);+cout << v << endl << endl;+cout << ceil(v) << endl;
+ eigen3/doc/snippets/Cwise_cos.cpp view
@@ -0,0 +1,2 @@+Array3d v(M_PI, M_PI/2, M_PI/3);+cout << v.cos() << endl;
+ eigen3/doc/snippets/Cwise_cosh.cpp view
@@ -0,0 +1,2 @@+ArrayXd v = ArrayXd::LinSpaced(5,0,1);+cout << cosh(v) << endl;
+ eigen3/doc/snippets/Cwise_cube.cpp view
@@ -0,0 +1,2 @@+Array3d v(2,3,4);+cout << v.cube() << endl;
+ eigen3/doc/snippets/Cwise_equal_equal.cpp view
@@ -0,0 +1,2 @@+Array3d v(1,2,3), w(3,2,1);+cout << (v==w) << endl;
+ eigen3/doc/snippets/Cwise_exp.cpp view
@@ -0,0 +1,2 @@+Array3d v(1,2,3);+cout << v.exp() << endl;
+ eigen3/doc/snippets/Cwise_floor.cpp view
@@ -0,0 +1,3 @@+ArrayXd v = ArrayXd::LinSpaced(7,-2,2);+cout << v << endl << endl;+cout << floor(v) << endl;
+ eigen3/doc/snippets/Cwise_greater.cpp view
@@ -0,0 +1,2 @@+Array3d v(1,2,3), w(3,2,1);+cout << (v>w) << endl;
+ eigen3/doc/snippets/Cwise_greater_equal.cpp view
@@ -0,0 +1,2 @@+Array3d v(1,2,3), w(3,2,1);+cout << (v>=w) << endl;
+ eigen3/doc/snippets/Cwise_inverse.cpp view
@@ -0,0 +1,2 @@+Array3d v(2,3,4);+cout << v.inverse() << endl;
+ eigen3/doc/snippets/Cwise_isFinite.cpp view
@@ -0,0 +1,5 @@+Array3d v(1,2,3);+v(1) *= 0.0/0.0;+v(2) /= 0.0;+cout << v << endl << endl;+cout << isfinite(v) << endl;
+ eigen3/doc/snippets/Cwise_isInf.cpp view
@@ -0,0 +1,5 @@+Array3d v(1,2,3);+v(1) *= 0.0/0.0;+v(2) /= 0.0;+cout << v << endl << endl;+cout << isinf(v) << endl;
+ eigen3/doc/snippets/Cwise_isNaN.cpp view
@@ -0,0 +1,5 @@+Array3d v(1,2,3);+v(1) *= 0.0/0.0;+v(2) /= 0.0;+cout << v << endl << endl;+cout << isnan(v) << endl;
+ eigen3/doc/snippets/Cwise_less.cpp view
@@ -0,0 +1,2 @@+Array3d v(1,2,3), w(3,2,1);+cout << (v<w) << endl;
+ eigen3/doc/snippets/Cwise_less_equal.cpp view
@@ -0,0 +1,2 @@+Array3d v(1,2,3), w(3,2,1);+cout << (v<=w) << endl;
+ eigen3/doc/snippets/Cwise_log.cpp view
@@ -0,0 +1,2 @@+Array3d v(1,2,3);+cout << v.log() << endl;
+ eigen3/doc/snippets/Cwise_log10.cpp view
@@ -0,0 +1,2 @@+Array4d v(-1,0,1,2);+cout << log10(v) << endl;
+ eigen3/doc/snippets/Cwise_max.cpp view
@@ -0,0 +1,2 @@+Array3d v(2,3,4), w(4,2,3);+cout << v.max(w) << endl;
+ eigen3/doc/snippets/Cwise_min.cpp view
@@ -0,0 +1,2 @@+Array3d v(2,3,4), w(4,2,3);+cout << v.min(w) << endl;
+ eigen3/doc/snippets/Cwise_minus.cpp view
@@ -0,0 +1,2 @@+Array3d v(1,2,3);+cout << v-5 << endl;
+ eigen3/doc/snippets/Cwise_minus_equal.cpp view
@@ -0,0 +1,3 @@+Array3d v(1,2,3);+v -= 5;+cout << v << endl;
+ eigen3/doc/snippets/Cwise_not_equal.cpp view
@@ -0,0 +1,2 @@+Array3d v(1,2,3), w(3,2,1);+cout << (v!=w) << endl;
+ eigen3/doc/snippets/Cwise_plus.cpp view
@@ -0,0 +1,2 @@+Array3d v(1,2,3);+cout << v+5 << endl;
+ eigen3/doc/snippets/Cwise_plus_equal.cpp view
@@ -0,0 +1,3 @@+Array3d v(1,2,3);+v += 5;+cout << v << endl;
+ eigen3/doc/snippets/Cwise_pow.cpp view
@@ -0,0 +1,2 @@+Array3d v(8,27,64);+cout << v.pow(0.333333) << endl;
+ eigen3/doc/snippets/Cwise_product.cpp view
@@ -0,0 +1,4 @@+Array33i a = Array33i::Random(), b = Array33i::Random();+Array33i c = a * b;+cout << "a:\n" << a << "\nb:\n" << b << "\nc:\n" << c << endl;+
+ eigen3/doc/snippets/Cwise_quotient.cpp view
@@ -0,0 +1,2 @@+Array3d v(2,3,4), w(4,2,3);+cout << v/w << endl;
+ eigen3/doc/snippets/Cwise_round.cpp view
@@ -0,0 +1,3 @@+ArrayXd v = ArrayXd::LinSpaced(7,-2,2);+cout << v << endl << endl;+cout << round(v) << endl;
+ eigen3/doc/snippets/Cwise_scalar_power_array.cpp view
@@ -0,0 +1,2 @@+Array<double,1,3> e(2,-3,1./3.);+cout << "10^[" << e << "] = " << pow(10,e) << endl;
+ eigen3/doc/snippets/Cwise_sign.cpp view
@@ -0,0 +1,2 @@+Array3d v(-3,5,0);+cout << v.sign() << endl;
+ eigen3/doc/snippets/Cwise_sin.cpp view
@@ -0,0 +1,2 @@+Array3d v(M_PI, M_PI/2, M_PI/3);+cout << v.sin() << endl;
+ eigen3/doc/snippets/Cwise_sinh.cpp view
@@ -0,0 +1,2 @@+ArrayXd v = ArrayXd::LinSpaced(5,0,1);+cout << sinh(v) << endl;
+ eigen3/doc/snippets/Cwise_slash_equal.cpp view
@@ -0,0 +1,3 @@+Array3d v(3,2,4), w(5,4,2);+v /= w;+cout << v << endl;
+ eigen3/doc/snippets/Cwise_sqrt.cpp view
@@ -0,0 +1,2 @@+Array3d v(1,2,4);+cout << v.sqrt() << endl;
+ eigen3/doc/snippets/Cwise_square.cpp view
@@ -0,0 +1,2 @@+Array3d v(2,3,4);+cout << v.square() << endl;
+ eigen3/doc/snippets/Cwise_tan.cpp view
@@ -0,0 +1,2 @@+Array3d v(M_PI, M_PI/2, M_PI/3);+cout << v.tan() << endl;
+ eigen3/doc/snippets/Cwise_tanh.cpp view
@@ -0,0 +1,2 @@+ArrayXd v = ArrayXd::LinSpaced(5,0,1);+cout << tanh(v) << endl;
+ eigen3/doc/snippets/Cwise_times_equal.cpp view
@@ -0,0 +1,3 @@+Array3d v(1,2,3), w(2,3,0);+v *= w;+cout << v << endl;
+ eigen3/doc/snippets/DenseBase_LinSpaced.cpp view
@@ -0,0 +1,2 @@+cout << VectorXi::LinSpaced(4,7,10).transpose() << endl;+cout << VectorXd::LinSpaced(5,0.0,1.0).transpose() << endl;
+ eigen3/doc/snippets/DenseBase_LinSpacedInt.cpp view
@@ -0,0 +1,8 @@+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;
+ eigen3/doc/snippets/DenseBase_LinSpaced_seq.cpp view
@@ -0,0 +1,2 @@+cout << VectorXi::LinSpaced(Sequential,4,7,10).transpose() << endl;+cout << VectorXd::LinSpaced(Sequential,5,0.0,1.0).transpose() << endl;
+ eigen3/doc/snippets/DenseBase_setLinSpaced.cpp view
@@ -0,0 +1,3 @@+VectorXf v;+v.setLinSpaced(5,0.5f,1.5f);+cout << v << endl;
+ eigen3/doc/snippets/DirectionWise_hnormalized.cpp view
@@ -0,0 +1,7 @@+typedef Matrix<double,4,Dynamic> Matrix4Xd;+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;
+ eigen3/doc/snippets/DirectionWise_replicate.cpp view
@@ -0,0 +1,4 @@+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;
+ eigen3/doc/snippets/DirectionWise_replicate_int.cpp view
@@ -0,0 +1,4 @@+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;
+ eigen3/doc/snippets/EigenSolver_EigenSolver_MatrixType.cpp view
@@ -0,0 +1,16 @@+MatrixXd A = MatrixXd::Random(6,6);+cout << "Here is a random 6x6 matrix, A:" << endl << A << endl << endl;++EigenSolver<MatrixXd> 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<double> 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<complex<double> >() * v << endl << endl;++MatrixXcd D = es.eigenvalues().asDiagonal();+MatrixXcd V = es.eigenvectors();+cout << "Finally, V * D * V^(-1) = " << endl << V * D * V.inverse() << endl;
+ eigen3/doc/snippets/EigenSolver_compute.cpp view
@@ -0,0 +1,6 @@+EigenSolver<MatrixXf> 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;
+ eigen3/doc/snippets/EigenSolver_eigenvalues.cpp view
@@ -0,0 +1,4 @@+MatrixXd ones = MatrixXd::Ones(3,3);+EigenSolver<MatrixXd> es(ones, false);+cout << "The eigenvalues of the 3x3 matrix of ones are:" +     << endl << es.eigenvalues() << endl;
+ eigen3/doc/snippets/EigenSolver_eigenvectors.cpp view
@@ -0,0 +1,4 @@+MatrixXd ones = MatrixXd::Ones(3,3);+EigenSolver<MatrixXd> es(ones);+cout << "The first eigenvector of the 3x3 matrix of ones is:"+     << endl << es.eigenvectors().col(0) << endl;
+ eigen3/doc/snippets/EigenSolver_pseudoEigenvectors.cpp view
@@ -0,0 +1,9 @@+MatrixXd A = MatrixXd::Random(6,6);+cout << "Here is a random 6x6 matrix, A:" << endl << A << endl << endl;++EigenSolver<MatrixXd> 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;
+ eigen3/doc/snippets/FullPivHouseholderQR_solve.cpp view
@@ -0,0 +1,8 @@+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;
+ eigen3/doc/snippets/FullPivLU_image.cpp view
@@ -0,0 +1,9 @@+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;
+ eigen3/doc/snippets/FullPivLU_kernel.cpp view
@@ -0,0 +1,7 @@+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;
+ eigen3/doc/snippets/FullPivLU_solve.cpp view
@@ -0,0 +1,11 @@+Matrix<float,2,3> m = Matrix<float,2,3>::Random();+Matrix2f y = Matrix2f::Random();+cout << "Here is the matrix m:" << endl << m << endl;+cout << "Here is the matrix y:" << endl << y << endl;+Matrix<float,3,2> 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;
+ eigen3/doc/snippets/GeneralizedEigenSolver.cpp view
@@ -0,0 +1,7 @@+GeneralizedEigenSolver<MatrixXf> 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;
+ eigen3/doc/snippets/HessenbergDecomposition_compute.cpp view
@@ -0,0 +1,6 @@+MatrixXcf A = MatrixXcf::Random(4,4);+HessenbergDecomposition<MatrixXcf> 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;
+ eigen3/doc/snippets/HessenbergDecomposition_matrixH.cpp view
@@ -0,0 +1,8 @@+Matrix4f A = MatrixXf::Random(4,4);+cout << "Here is a random 4x4 matrix:" << endl << A << endl;+HessenbergDecomposition<MatrixXf> 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;
+ eigen3/doc/snippets/HessenbergDecomposition_packedMatrix.cpp view
@@ -0,0 +1,9 @@+Matrix4d A = Matrix4d::Random(4,4);+cout << "Here is a random 4x4 matrix:" << endl << A << endl;+HessenbergDecomposition<Matrix4d> 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;
+ eigen3/doc/snippets/HouseholderQR_householderQ.cpp view
@@ -0,0 +1,7 @@+MatrixXf A(MatrixXf::Random(5,3)), thinQ(MatrixXf::Identity(5,3)), Q;+A.setRandom();+HouseholderQR<MatrixXf> 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";
+ eigen3/doc/snippets/HouseholderQR_solve.cpp view
@@ -0,0 +1,9 @@+typedef Matrix<float,3,3> 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;
+ eigen3/doc/snippets/HouseholderSequence_HouseholderSequence.cpp view
@@ -0,0 +1,31 @@+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<Matrix3d, Vector3d> 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;
+ eigen3/doc/snippets/IOFormat.cpp view
@@ -0,0 +1,14 @@+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;
+ eigen3/doc/snippets/JacobiSVD_basic.cpp view
@@ -0,0 +1,9 @@+MatrixXf m = MatrixXf::Random(3,2);+cout << "Here is the matrix m:" << endl << m << endl;+JacobiSVD<MatrixXf> 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;
+ eigen3/doc/snippets/Jacobi_makeGivens.cpp view
@@ -0,0 +1,6 @@+Vector2f v = Vector2f::Random();+JacobiRotation<float> 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;
+ eigen3/doc/snippets/Jacobi_makeJacobi.cpp view
@@ -0,0 +1,8 @@+Matrix2f m = Matrix2f::Random();+m = (m + m.adjoint()).eval();+JacobiRotation<float> 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;
+ eigen3/doc/snippets/LLT_example.cpp view
@@ -0,0 +1,12 @@+MatrixXd A(3,3);+A << 4,-1,2, -1,6,0, 2,0,5;+cout << "The matrix A is" << endl << A << endl;++LLT<MatrixXd> 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;
+ eigen3/doc/snippets/LLT_solve.cpp view
@@ -0,0 +1,8 @@+typedef Matrix<float,Dynamic,2> 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<float,2,1> xy+ = (samples.adjoint() * samples).llt().solve((samples.adjoint()*elevations));+cout << xy << endl;
+ eigen3/doc/snippets/LeastSquaresNormalEquations.cpp view
@@ -0,0 +1,4 @@+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;
+ eigen3/doc/snippets/LeastSquaresQR.cpp view
@@ -0,0 +1,4 @@+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;
+ eigen3/doc/snippets/Map_general_stride.cpp view
@@ -0,0 +1,5 @@+int array[24];+for(int i = 0; i < 24; ++i) array[i] = i;+cout << Map<MatrixXi, 0, Stride<Dynamic,2> >+         (array, 3, 3, Stride<Dynamic,2>(8, 2))+     << endl;
+ eigen3/doc/snippets/Map_inner_stride.cpp view
@@ -0,0 +1,5 @@+int array[12];+for(int i = 0; i < 12; ++i) array[i] = i;+cout << Map<VectorXi, 0, InnerStride<2> >+         (array, 6) // the inner stride has already been passed as template parameter+     << endl;
+ eigen3/doc/snippets/Map_outer_stride.cpp view
@@ -0,0 +1,3 @@+int array[12];+for(int i = 0; i < 12; ++i) array[i] = i;+cout << Map<MatrixXi, 0, OuterStride<> >(array, 3, 3, OuterStride<>(4)) << endl;
+ eigen3/doc/snippets/Map_placement_new.cpp view
@@ -0,0 +1,5 @@+int data[] = {1,2,3,4,5,6,7,8,9};+Map<RowVectorXi> v(data,4);+cout << "The mapped vector v is: " << v << "\n";+new (&v) Map<RowVectorXi>(data+4,5);+cout << "Now v is: " << v << "\n";
+ eigen3/doc/snippets/Map_simple.cpp view
@@ -0,0 +1,3 @@+int array[9];+for(int i = 0; i < 9; ++i) array[i] = i;+cout << Map<Matrix3i>(array) << endl;
+ eigen3/doc/snippets/MatrixBase_adjoint.cpp view
@@ -0,0 +1,3 @@+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;
+ eigen3/doc/snippets/MatrixBase_all.cpp view
@@ -0,0 +1,7 @@+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() && (boxMax.array()>p0.array()).all()) << endl;+cout << "Is (" << p1.transpose() << ") inside the box: "+     << ((boxMin.array()<p1.array()).all() && (boxMax.array()>p1.array()).all()) << endl;
+ eigen3/doc/snippets/MatrixBase_applyOnTheLeft.cpp view
@@ -0,0 +1,7 @@+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;
+ eigen3/doc/snippets/MatrixBase_applyOnTheRight.cpp view
@@ -0,0 +1,9 @@+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;
+ eigen3/doc/snippets/MatrixBase_array.cpp view
@@ -0,0 +1,4 @@+Vector3d v(1,2,3);+v.array() += 3;+v.array() -= 2;+cout << v << endl;
+ eigen3/doc/snippets/MatrixBase_array_const.cpp view
@@ -0,0 +1,4 @@+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;
+ eigen3/doc/snippets/MatrixBase_asDiagonal.cpp view
@@ -0,0 +1,1 @@+cout << Matrix3i(Vector3i(2,5,6).asDiagonal()) << endl;
+ eigen3/doc/snippets/MatrixBase_block_int_int.cpp view
@@ -0,0 +1,5 @@+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;
+ eigen3/doc/snippets/MatrixBase_block_int_int_int_int.cpp view
@@ -0,0 +1,5 @@+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;
+ eigen3/doc/snippets/MatrixBase_bottomLeftCorner_int_int.cpp view
@@ -0,0 +1,6 @@+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;
+ eigen3/doc/snippets/MatrixBase_bottomRightCorner_int_int.cpp view
@@ -0,0 +1,6 @@+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;
+ eigen3/doc/snippets/MatrixBase_bottomRows_int.cpp view
@@ -0,0 +1,6 @@+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;
+ eigen3/doc/snippets/MatrixBase_cast.cpp view
@@ -0,0 +1,3 @@+Matrix2d md = Matrix2d::Identity() * 0.45;+Matrix2f mf = Matrix2f::Identity();+cout << md + mf.cast<double>() << endl;
+ eigen3/doc/snippets/MatrixBase_col.cpp view
@@ -0,0 +1,3 @@+Matrix3d m = Matrix3d::Identity();+m.col(1) = Vector3d(4,5,6);+cout << m << endl;
+ eigen3/doc/snippets/MatrixBase_colwise.cpp view
@@ -0,0 +1,5 @@+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;
+ eigen3/doc/snippets/MatrixBase_computeInverseAndDetWithCheck.cpp view
@@ -0,0 +1,13 @@+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;+}
+ eigen3/doc/snippets/MatrixBase_computeInverseWithCheck.cpp view
@@ -0,0 +1,11 @@+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;+}
+ eigen3/doc/snippets/MatrixBase_cwiseAbs.cpp view
@@ -0,0 +1,4 @@+MatrixXd m(2,3);+m << 2, -4, 6,   +     -5, 1, 0;+cout << m.cwiseAbs() << endl;
+ eigen3/doc/snippets/MatrixBase_cwiseAbs2.cpp view
@@ -0,0 +1,4 @@+MatrixXd m(2,3);+m << 2, -4, 6,   +     -5, 1, 0;+cout << m.cwiseAbs2() << endl;
+ eigen3/doc/snippets/MatrixBase_cwiseEqual.cpp view
@@ -0,0 +1,7 @@+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;
+ eigen3/doc/snippets/MatrixBase_cwiseInverse.cpp view
@@ -0,0 +1,4 @@+MatrixXd m(2,3);+m << 2, 0.5, 1,   +     3, 0.25, 1;+cout << m.cwiseInverse() << endl;
+ eigen3/doc/snippets/MatrixBase_cwiseMax.cpp view
@@ -0,0 +1,2 @@+Vector3d v(2,3,4), w(4,2,3);+cout << v.cwiseMax(w) << endl;
+ eigen3/doc/snippets/MatrixBase_cwiseMin.cpp view
@@ -0,0 +1,2 @@+Vector3d v(2,3,4), w(4,2,3);+cout << v.cwiseMin(w) << endl;
+ eigen3/doc/snippets/MatrixBase_cwiseNotEqual.cpp view
@@ -0,0 +1,7 @@+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;
+ eigen3/doc/snippets/MatrixBase_cwiseProduct.cpp view
@@ -0,0 +1,4 @@+Matrix3i a = Matrix3i::Random(), b = Matrix3i::Random();+Matrix3i c = a.cwiseProduct(b);+cout << "a:\n" << a << "\nb:\n" << b << "\nc:\n" << c << endl;+
+ eigen3/doc/snippets/MatrixBase_cwiseQuotient.cpp view
@@ -0,0 +1,2 @@+Vector3d v(2,3,4), w(4,2,3);+cout << v.cwiseQuotient(w) << endl;
+ eigen3/doc/snippets/MatrixBase_cwiseSign.cpp view
@@ -0,0 +1,4 @@+MatrixXd m(2,3);+m <<  2, -4, 6,+     -5,  1, 0;+cout << m.cwiseSign() << endl;
+ eigen3/doc/snippets/MatrixBase_cwiseSqrt.cpp view
@@ -0,0 +1,2 @@+Vector3d v(1,2,4);+cout << v.cwiseSqrt() << endl;
+ eigen3/doc/snippets/MatrixBase_diagonal.cpp view
@@ -0,0 +1,4 @@+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;
+ eigen3/doc/snippets/MatrixBase_diagonal_int.cpp view
@@ -0,0 +1,5 @@+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;
+ eigen3/doc/snippets/MatrixBase_diagonal_template_int.cpp view
@@ -0,0 +1,5 @@+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;
+ eigen3/doc/snippets/MatrixBase_eigenvalues.cpp view
@@ -0,0 +1,3 @@+MatrixXd ones = MatrixXd::Ones(3,3);+VectorXcd eivals = ones.eigenvalues();+cout << "The eigenvalues of the 3x3 matrix of ones are:" << endl << eivals << endl;
+ eigen3/doc/snippets/MatrixBase_end_int.cpp view
@@ -0,0 +1,5 @@+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;
+ eigen3/doc/snippets/MatrixBase_eval.cpp view
@@ -0,0 +1,12 @@+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;
+ eigen3/doc/snippets/MatrixBase_fixedBlock_int_int.cpp view
@@ -0,0 +1,5 @@+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;
+ eigen3/doc/snippets/MatrixBase_hnormalized.cpp view
@@ -0,0 +1,6 @@+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;
+ eigen3/doc/snippets/MatrixBase_homogeneous.cpp view
@@ -0,0 +1,6 @@+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;
+ eigen3/doc/snippets/MatrixBase_identity.cpp view
@@ -0,0 +1,1 @@+cout << Matrix<double, 3, 4>::Identity() << endl;
+ eigen3/doc/snippets/MatrixBase_identity_int_int.cpp view
@@ -0,0 +1,1 @@+cout << MatrixXd::Identity(4, 3) << endl;
+ eigen3/doc/snippets/MatrixBase_inverse.cpp view
@@ -0,0 +1,3 @@+Matrix3d m = Matrix3d::Random();+cout << "Here is the matrix m:" << endl << m << endl;+cout << "Its inverse is:" << endl << m.inverse() << endl;
+ eigen3/doc/snippets/MatrixBase_isDiagonal.cpp view
@@ -0,0 +1,6 @@+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;+
+ eigen3/doc/snippets/MatrixBase_isIdentity.cpp view
@@ -0,0 +1,5 @@+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;
+ eigen3/doc/snippets/MatrixBase_isOnes.cpp view
@@ -0,0 +1,5 @@+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;
+ eigen3/doc/snippets/MatrixBase_isOrthogonal.cpp view
@@ -0,0 +1,6 @@+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;
+ eigen3/doc/snippets/MatrixBase_isUnitary.cpp view
@@ -0,0 +1,5 @@+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;
+ eigen3/doc/snippets/MatrixBase_isZero.cpp view
@@ -0,0 +1,5 @@+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;
+ eigen3/doc/snippets/MatrixBase_leftCols_int.cpp view
@@ -0,0 +1,6 @@+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;
+ eigen3/doc/snippets/MatrixBase_noalias.cpp view
@@ -0,0 +1,3 @@+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;
+ eigen3/doc/snippets/MatrixBase_ones.cpp view
@@ -0,0 +1,2 @@+cout << Matrix2d::Ones() << endl;+cout << 6 * RowVector4i::Ones() << endl;
+ eigen3/doc/snippets/MatrixBase_ones_int.cpp view
@@ -0,0 +1,2 @@+cout << 6 * RowVectorXi::Ones(4) << endl;+cout << VectorXf::Ones(2) << endl;
+ eigen3/doc/snippets/MatrixBase_ones_int_int.cpp view
@@ -0,0 +1,1 @@+cout << MatrixXi::Ones(2,3) << endl;
+ eigen3/doc/snippets/MatrixBase_operatorNorm.cpp view
@@ -0,0 +1,3 @@+MatrixXd ones = MatrixXd::Ones(3,3);+cout << "The operator norm of the 3x3 matrix of ones is "+     << ones.operatorNorm() << endl;
+ eigen3/doc/snippets/MatrixBase_prod.cpp view
@@ -0,0 +1,3 @@+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;
+ eigen3/doc/snippets/MatrixBase_random.cpp view
@@ -0,0 +1,1 @@+cout << 100 * Matrix2i::Random() << endl;
+ eigen3/doc/snippets/MatrixBase_random_int.cpp view
@@ -0,0 +1,1 @@+cout << VectorXi::Random(2) << endl;
+ eigen3/doc/snippets/MatrixBase_random_int_int.cpp view
@@ -0,0 +1,1 @@+cout << MatrixXi::Random(2,3) << endl;
+ eigen3/doc/snippets/MatrixBase_replicate.cpp view
@@ -0,0 +1,4 @@+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;
+ eigen3/doc/snippets/MatrixBase_replicate_int_int.cpp view
@@ -0,0 +1,4 @@+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;
+ eigen3/doc/snippets/MatrixBase_reverse.cpp view
@@ -0,0 +1,8 @@+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;
+ eigen3/doc/snippets/MatrixBase_rightCols_int.cpp view
@@ -0,0 +1,6 @@+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;
+ eigen3/doc/snippets/MatrixBase_row.cpp view
@@ -0,0 +1,3 @@+Matrix3d m = Matrix3d::Identity();+m.row(1) = Vector3d(4,5,6);+cout << m << endl;
+ eigen3/doc/snippets/MatrixBase_rowwise.cpp view
@@ -0,0 +1,5 @@+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;
+ eigen3/doc/snippets/MatrixBase_segment_int_int.cpp view
@@ -0,0 +1,5 @@+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;
+ eigen3/doc/snippets/MatrixBase_select.cpp view
@@ -0,0 +1,6 @@+MatrixXi m(3, 3);+m << 1, 2, 3,+     4, 5, 6,+     7, 8, 9;+m = (m.array() >= 5).select(-m, m);+cout << m << endl;
+ eigen3/doc/snippets/MatrixBase_selfadjointView.cpp view
@@ -0,0 +1,6 @@+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<Upper>()) << endl;+cout << "Here is the symmetric matrix extracted from the lower part of m:" << endl+     << Matrix3i(m.selfadjointView<Lower>()) << endl;
+ eigen3/doc/snippets/MatrixBase_set.cpp view
@@ -0,0 +1,13 @@+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;
+ eigen3/doc/snippets/MatrixBase_setIdentity.cpp view
@@ -0,0 +1,3 @@+Matrix4i m = Matrix4i::Zero();+m.block<3,3>(1,0).setIdentity();+cout << m << endl;
+ eigen3/doc/snippets/MatrixBase_setOnes.cpp view
@@ -0,0 +1,3 @@+Matrix4i m = Matrix4i::Random();+m.row(1).setOnes();+cout << m << endl;
+ eigen3/doc/snippets/MatrixBase_setRandom.cpp view
@@ -0,0 +1,3 @@+Matrix4i m = Matrix4i::Zero();+m.col(1).setRandom();+cout << m << endl;
+ eigen3/doc/snippets/MatrixBase_setZero.cpp view
@@ -0,0 +1,3 @@+Matrix4i m = Matrix4i::Random();+m.row(1).setZero();+cout << m << endl;
+ eigen3/doc/snippets/MatrixBase_start_int.cpp view
@@ -0,0 +1,5 @@+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;
+ eigen3/doc/snippets/MatrixBase_template_int_bottomRows.cpp view
@@ -0,0 +1,6 @@+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;
+ eigen3/doc/snippets/MatrixBase_template_int_end.cpp view
@@ -0,0 +1,5 @@+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;
+ eigen3/doc/snippets/MatrixBase_template_int_int_block_int_int_int_int.cpp view
@@ -0,0 +1,5 @@+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;
+ eigen3/doc/snippets/MatrixBase_template_int_int_bottomLeftCorner.cpp view
@@ -0,0 +1,6 @@+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;
+ eigen3/doc/snippets/MatrixBase_template_int_int_bottomLeftCorner_int_int.cpp view
@@ -0,0 +1,6 @@+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;
+ eigen3/doc/snippets/MatrixBase_template_int_int_bottomRightCorner.cpp view
@@ -0,0 +1,6 @@+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;
+ eigen3/doc/snippets/MatrixBase_template_int_int_bottomRightCorner_int_int.cpp view
@@ -0,0 +1,6 @@+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;
+ eigen3/doc/snippets/MatrixBase_template_int_int_topLeftCorner.cpp view
@@ -0,0 +1,6 @@+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;
+ eigen3/doc/snippets/MatrixBase_template_int_int_topLeftCorner_int_int.cpp view
@@ -0,0 +1,6 @@+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;
+ eigen3/doc/snippets/MatrixBase_template_int_int_topRightCorner.cpp view
@@ -0,0 +1,6 @@+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;
+ eigen3/doc/snippets/MatrixBase_template_int_int_topRightCorner_int_int.cpp view
@@ -0,0 +1,6 @@+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;
+ eigen3/doc/snippets/MatrixBase_template_int_leftCols.cpp view
@@ -0,0 +1,6 @@+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;
+ eigen3/doc/snippets/MatrixBase_template_int_rightCols.cpp view
@@ -0,0 +1,6 @@+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;
+ eigen3/doc/snippets/MatrixBase_template_int_segment.cpp view
@@ -0,0 +1,5 @@+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;
+ eigen3/doc/snippets/MatrixBase_template_int_start.cpp view
@@ -0,0 +1,5 @@+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;
+ eigen3/doc/snippets/MatrixBase_template_int_topRows.cpp view
@@ -0,0 +1,6 @@+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;
+ eigen3/doc/snippets/MatrixBase_topLeftCorner_int_int.cpp view
@@ -0,0 +1,6 @@+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;
+ eigen3/doc/snippets/MatrixBase_topRightCorner_int_int.cpp view
@@ -0,0 +1,6 @@+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;
+ eigen3/doc/snippets/MatrixBase_topRows_int.cpp view
@@ -0,0 +1,6 @@+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;
+ eigen3/doc/snippets/MatrixBase_transpose.cpp view
@@ -0,0 +1,8 @@+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;
+ eigen3/doc/snippets/MatrixBase_triangularView.cpp view
@@ -0,0 +1,9 @@+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<Eigen::Upper>()) << endl;+cout << "Here is the strictly-upper-triangular matrix extracted from m:" << endl+     << Matrix3i(m.triangularView<Eigen::StrictlyUpper>()) << endl;+cout << "Here is the unit-lower-triangular matrix extracted from m:" << endl+     << Matrix3i(m.triangularView<Eigen::UnitLower>()) << endl;+// FIXME need to implement output for triangularViews (Bug 885)
+ eigen3/doc/snippets/MatrixBase_zero.cpp view
@@ -0,0 +1,2 @@+cout << Matrix2d::Zero() << endl;+cout << RowVector4i::Zero() << endl;
+ eigen3/doc/snippets/MatrixBase_zero_int.cpp view
@@ -0,0 +1,2 @@+cout << RowVectorXi::Zero(4) << endl;+cout << VectorXf::Zero(2) << endl;
+ eigen3/doc/snippets/MatrixBase_zero_int_int.cpp view
@@ -0,0 +1,1 @@+cout << MatrixXi::Zero(2,3) << endl;
+ eigen3/doc/snippets/Matrix_Map_stride.cpp view
@@ -0,0 +1,7 @@+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;
+ eigen3/doc/snippets/Matrix_resize_NoChange_int.cpp view
@@ -0,0 +1,3 @@+MatrixXd m(3,4);+m.resize(NoChange, 5);+cout << "m: " << m.rows() << " rows, " << m.cols() << " cols" << endl;
+ eigen3/doc/snippets/Matrix_resize_int.cpp view
@@ -0,0 +1,6 @@+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;
+ eigen3/doc/snippets/Matrix_resize_int_NoChange.cpp view
@@ -0,0 +1,3 @@+MatrixXd m(3,4);+m.resize(5, NoChange);+cout << "m: " << m.rows() << " rows, " << m.cols() << " cols" << endl;
+ eigen3/doc/snippets/Matrix_resize_int_int.cpp view
@@ -0,0 +1,9 @@+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;
+ eigen3/doc/snippets/Matrix_setConstant_int.cpp view
@@ -0,0 +1,3 @@+VectorXf v;+v.setConstant(3, 5);+cout << v << endl;
+ eigen3/doc/snippets/Matrix_setConstant_int_int.cpp view
@@ -0,0 +1,3 @@+MatrixXf m;+m.setConstant(3, 3, 5);+cout << m << endl;
+ eigen3/doc/snippets/Matrix_setIdentity_int_int.cpp view
@@ -0,0 +1,3 @@+MatrixXf m;+m.setIdentity(3, 3);+cout << m << endl;
+ eigen3/doc/snippets/Matrix_setOnes_int.cpp view
@@ -0,0 +1,3 @@+VectorXf v;+v.setOnes(3);+cout << v << endl;
+ eigen3/doc/snippets/Matrix_setOnes_int_int.cpp view
@@ -0,0 +1,3 @@+MatrixXf m;+m.setOnes(3, 3);+cout << m << endl;
+ eigen3/doc/snippets/Matrix_setRandom_int.cpp view
@@ -0,0 +1,3 @@+VectorXf v;+v.setRandom(3);+cout << v << endl;
+ eigen3/doc/snippets/Matrix_setRandom_int_int.cpp view
@@ -0,0 +1,3 @@+MatrixXf m;+m.setRandom(3, 3);+cout << m << endl;
+ eigen3/doc/snippets/Matrix_setZero_int.cpp view
@@ -0,0 +1,3 @@+VectorXf v;+v.setZero(3);+cout << v << endl;
+ eigen3/doc/snippets/Matrix_setZero_int_int.cpp view
@@ -0,0 +1,3 @@+MatrixXf m;+m.setZero(3, 3);+cout << m << endl;
+ eigen3/doc/snippets/PartialPivLU_solve.cpp view
@@ -0,0 +1,7 @@+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;
+ eigen3/doc/snippets/PartialRedux_count.cpp view
@@ -0,0 +1,5 @@+Matrix3d m = Matrix3d::Random();+cout << "Here is the matrix m:" << endl << m << endl;+Matrix<ptrdiff_t, 3, 1> 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;
+ eigen3/doc/snippets/PartialRedux_maxCoeff.cpp view
@@ -0,0 +1,3 @@+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;
+ eigen3/doc/snippets/PartialRedux_minCoeff.cpp view
@@ -0,0 +1,3 @@+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;
+ eigen3/doc/snippets/PartialRedux_norm.cpp view
@@ -0,0 +1,3 @@+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;
+ eigen3/doc/snippets/PartialRedux_prod.cpp view
@@ -0,0 +1,3 @@+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;
+ eigen3/doc/snippets/PartialRedux_squaredNorm.cpp view
@@ -0,0 +1,3 @@+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;
+ eigen3/doc/snippets/PartialRedux_sum.cpp view
@@ -0,0 +1,3 @@+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;
+ eigen3/doc/snippets/RealQZ_compute.cpp view
@@ -0,0 +1,17 @@+MatrixXf A = MatrixXf::Random(4,4);+MatrixXf B = MatrixXf::Random(4,4);+RealQZ<MatrixXf> 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";
+ eigen3/doc/snippets/RealSchur_RealSchur_MatrixType.cpp view
@@ -0,0 +1,10 @@+MatrixXd A = MatrixXd::Random(6,6);+cout << "Here is a random 6x6 matrix, A:" << endl << A << endl << endl;++RealSchur<MatrixXd> 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;
+ eigen3/doc/snippets/RealSchur_compute.cpp view
@@ -0,0 +1,6 @@+MatrixXf A = MatrixXf::Random(4,4);+RealSchur<MatrixXf> 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;
+ eigen3/doc/snippets/SelfAdjointEigenSolver_SelfAdjointEigenSolver.cpp view
@@ -0,0 +1,7 @@+SelfAdjointEigenSolver<Matrix4f> 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;
+ eigen3/doc/snippets/SelfAdjointEigenSolver_SelfAdjointEigenSolver_MatrixType.cpp view
@@ -0,0 +1,17 @@+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<MatrixXd> 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;
+ eigen3/doc/snippets/SelfAdjointEigenSolver_SelfAdjointEigenSolver_MatrixType2.cpp view
@@ -0,0 +1,16 @@+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<MatrixXd> 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;
+ eigen3/doc/snippets/SelfAdjointEigenSolver_compute_MatrixType.cpp view
@@ -0,0 +1,7 @@+SelfAdjointEigenSolver<MatrixXf> 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;
+ eigen3/doc/snippets/SelfAdjointEigenSolver_compute_MatrixType2.cpp view
@@ -0,0 +1,9 @@+MatrixXd X = MatrixXd::Random(5,5);+MatrixXd A = X * X.transpose();+X = MatrixXd::Random(5,5);+MatrixXd B = X * X.transpose();++GeneralizedSelfAdjointEigenSolver<MatrixXd> 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;
+ eigen3/doc/snippets/SelfAdjointEigenSolver_eigenvalues.cpp view
@@ -0,0 +1,4 @@+MatrixXd ones = MatrixXd::Ones(3,3);+SelfAdjointEigenSolver<MatrixXd> es(ones);+cout << "The eigenvalues of the 3x3 matrix of ones are:" +     << endl << es.eigenvalues() << endl;
+ eigen3/doc/snippets/SelfAdjointEigenSolver_eigenvectors.cpp view
@@ -0,0 +1,4 @@+MatrixXd ones = MatrixXd::Ones(3,3);+SelfAdjointEigenSolver<MatrixXd> es(ones);+cout << "The first eigenvector of the 3x3 matrix of ones is:" +     << endl << es.eigenvectors().col(1) << endl;
+ eigen3/doc/snippets/SelfAdjointEigenSolver_operatorInverseSqrt.cpp view
@@ -0,0 +1,9 @@+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<MatrixXd> 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;
+ eigen3/doc/snippets/SelfAdjointEigenSolver_operatorSqrt.cpp view
@@ -0,0 +1,8 @@+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<MatrixXd> 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;
+ eigen3/doc/snippets/SelfAdjointView_eigenvalues.cpp view
@@ -0,0 +1,3 @@+MatrixXd ones = MatrixXd::Ones(3,3);+VectorXd eivals = ones.selfadjointView<Lower>().eigenvalues();+cout << "The eigenvalues of the 3x3 matrix of ones are:" << endl << eivals << endl;
+ eigen3/doc/snippets/SelfAdjointView_operatorNorm.cpp view
@@ -0,0 +1,3 @@+MatrixXd ones = MatrixXd::Ones(3,3);+cout << "The operator norm of the 3x3 matrix of ones is "+     << ones.selfadjointView<Lower>().operatorNorm() << endl;
+ eigen3/doc/snippets/SparseMatrix_coeffs.cpp view
@@ -0,0 +1,9 @@+SparseMatrix<double> 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;
+ eigen3/doc/snippets/TopicAliasing_block.cpp view
@@ -0,0 +1,7 @@+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;
+ eigen3/doc/snippets/TopicAliasing_block_correct.cpp view
@@ -0,0 +1,7 @@+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;
+ eigen3/doc/snippets/TopicAliasing_cwise.cpp view
@@ -0,0 +1,20 @@+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;
+ eigen3/doc/snippets/TopicAliasing_mult1.cpp view
@@ -0,0 +1,4 @@+MatrixXf matA(2,2); +matA << 2, 0,  0, 2;+matA = matA * matA;+cout << matA;
+ eigen3/doc/snippets/TopicAliasing_mult2.cpp view
@@ -0,0 +1,10 @@+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;
+ eigen3/doc/snippets/TopicAliasing_mult3.cpp view
@@ -0,0 +1,4 @@+MatrixXf matA(2,2); +matA << 2, 0,  0, 2;+matA.noalias() = matA * matA;+cout << matA;
+ eigen3/doc/snippets/TopicAliasing_mult4.cpp view
@@ -0,0 +1,5 @@+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;
+ eigen3/doc/snippets/TopicAliasing_mult5.cpp view
@@ -0,0 +1,5 @@+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;
+ eigen3/doc/snippets/TopicStorageOrders_example.cpp view
@@ -0,0 +1,18 @@+Matrix<int, 3, 4, ColMajor> 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<int, 3, 4, RowMajor> Arowmajor = Acolmajor;+cout << "In memory (row-major):" << endl;+for (int i = 0; i < Arowmajor.size(); i++)+  cout << *(Arowmajor.data() + i) << "  ";+cout << endl;+
+ eigen3/doc/snippets/Triangular_solve.cpp view
@@ -0,0 +1,11 @@+Matrix3d m = Matrix3d::Zero();+m.triangularView<Eigen::Upper>().setOnes();+cout << "Here is the matrix m:\n" << m << endl;+Matrix3d n = Matrix3d::Ones();+n.triangularView<Eigen::Lower>() *= 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<Eigen::Upper>().solve(n) << endl;+cout << "And this is n*m.inverse():\n"+     << m.triangularView<Eigen::Upper>().solve<Eigen::OnTheRight>(n);
+ eigen3/doc/snippets/Tridiagonalization_Tridiagonalization_MatrixType.cpp view
@@ -0,0 +1,9 @@+MatrixXd X = MatrixXd::Random(5,5);+MatrixXd A = X + X.transpose();+cout << "Here is a random symmetric 5x5 matrix:" << endl << A << endl << endl;+Tridiagonalization<MatrixXd> 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;
+ eigen3/doc/snippets/Tridiagonalization_compute.cpp view
@@ -0,0 +1,9 @@+Tridiagonalization<MatrixXf> 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;
+ eigen3/doc/snippets/Tridiagonalization_decomposeInPlace.cpp view
@@ -0,0 +1,10 @@+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);+internal::tridiagonalization_inplace(A, diag, subdiag, 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;
+ eigen3/doc/snippets/Tridiagonalization_diagonal.cpp view
@@ -0,0 +1,13 @@+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<MatrixXcd> 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;
+ eigen3/doc/snippets/Tridiagonalization_householderCoefficients.cpp view
@@ -0,0 +1,6 @@+Matrix4d X = Matrix4d::Random(4,4);+Matrix4d A = X + X.transpose();+cout << "Here is a random symmetric 4x4 matrix:" << endl << A << endl;+Tridiagonalization<Matrix4d> triOfA(A);+Vector3d hc = triOfA.householderCoefficients();+cout << "The vector of Householder coefficients is:" << endl << hc << endl;
+ eigen3/doc/snippets/Tridiagonalization_packedMatrix.cpp view
@@ -0,0 +1,8 @@+Matrix4d X = Matrix4d::Random(4,4);+Matrix4d A = X + X.transpose();+cout << "Here is a random symmetric 4x4 matrix:" << endl << A << endl;+Tridiagonalization<Matrix4d> 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;
+ eigen3/doc/snippets/Tutorial_AdvancedInitialization_Block.cpp view
@@ -0,0 +1,5 @@+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;
+ eigen3/doc/snippets/Tutorial_AdvancedInitialization_CommaTemporary.cpp view
@@ -0,0 +1,4 @@+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;
+ eigen3/doc/snippets/Tutorial_AdvancedInitialization_Join.cpp view
@@ -0,0 +1,11 @@+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;
+ eigen3/doc/snippets/Tutorial_AdvancedInitialization_LinSpaced.cpp view
@@ -0,0 +1,7 @@+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;
+ eigen3/doc/snippets/Tutorial_AdvancedInitialization_ThreeWays.cpp view
@@ -0,0 +1,20 @@+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;+
+ eigen3/doc/snippets/Tutorial_AdvancedInitialization_Zero.cpp view
@@ -0,0 +1,13 @@+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";
+ eigen3/doc/snippets/Tutorial_Map_rowmajor.cpp view
@@ -0,0 +1,7 @@+int array[8];+for(int i = 0; i < 8; ++i) array[i] = i;+cout << "Column-major:\n" << Map<Matrix<int,2,4> >(array) << endl;+cout << "Row-major:\n" << Map<Matrix<int,2,4,RowMajor> >(array) << endl;+cout << "Row-major using stride:\n" <<+  Map<Matrix<int,2,4>, Unaligned, Stride<1,4> >(array) << endl;+
+ eigen3/doc/snippets/Tutorial_Map_using.cpp view
@@ -0,0 +1,21 @@+typedef Matrix<float,1,Dynamic> MatrixType;+typedef Map<MatrixType> MapType;+typedef Map<const MatrixType> 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
+ eigen3/doc/snippets/Tutorial_ReshapeMat2Mat.cpp view
@@ -0,0 +1,6 @@+MatrixXf M1(2,6);    // Column-major storage+M1 << 1, 2, 3,  4,  5,  6,+      7, 8, 9, 10, 11, 12;++Map<MatrixXf> M2(M1.data(), 6,2);+cout << "M2:" << endl << M2 << endl;
+ eigen3/doc/snippets/Tutorial_ReshapeMat2Vec.cpp view
@@ -0,0 +1,11 @@+MatrixXf M1(3,3);    // Column-major storage+M1 << 1, 2, 3,+      4, 5, 6,+      7, 8, 9;++Map<RowVectorXf> v1(M1.data(), M1.size());+cout << "v1:" << endl << v1 << endl;++Matrix<float,Dynamic,Dynamic,RowMajor> M2(M1);+Map<RowVectorXf> v2(M2.data(), M2.size());+cout << "v2:" << endl << v2 << endl;
+ eigen3/doc/snippets/Tutorial_SlicingCol.cpp view
@@ -0,0 +1,11 @@+MatrixXf M1 = MatrixXf::Random(3,8);+cout << "Column major input:" << endl << M1 << "\n";+Map<MatrixXf,0,OuterStride<> > M2(M1.data(), M1.rows(), (M1.cols()+2)/3, OuterStride<>(M1.outerStride()*3));+cout << "1 column over 3:" << endl << M2 << "\n";++typedef Matrix<float,Dynamic,Dynamic,RowMajor> RowMajorMatrixXf;+RowMajorMatrixXf M3(M1);+cout << "Row major input:" << endl << M3 << "\n";+Map<RowMajorMatrixXf,0,Stride<Dynamic,3> > M4(M3.data(), M3.rows(), (M3.cols()+2)/3,+                                              Stride<Dynamic,3>(M3.outerStride(),3));+cout << "1 column over 3:" << endl << M4 << "\n";
+ eigen3/doc/snippets/Tutorial_SlicingVec.cpp view
@@ -0,0 +1,4 @@+RowVectorXf v = RowVectorXf::LinSpaced(20,0,19);+cout << "Input:" << endl << v << endl;+Map<RowVectorXf,0,InnerStride<2> > v2(v.data(), v.size()/2);+cout << "Even:" << v2 << endl;
+ eigen3/doc/snippets/Tutorial_commainit_01.cpp view
@@ -0,0 +1,5 @@+Matrix3f m;+m << 1, 2, 3,+     4, 5, 6,+     7, 8, 9;+std::cout << m;
+ eigen3/doc/snippets/Tutorial_commainit_01b.cpp view
@@ -0,0 +1,5 @@+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;
+ eigen3/doc/snippets/Tutorial_commainit_02.cpp view
@@ -0,0 +1,7 @@+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;
+ eigen3/doc/snippets/Tutorial_solve_matrix_inverse.cpp view
@@ -0,0 +1,6 @@+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;
+ eigen3/doc/snippets/Tutorial_solve_multiple_rhs.cpp view
@@ -0,0 +1,10 @@+Matrix3f A(3,3);+A << 1,2,3,  4,5,6,  7,8,10;+Matrix<float,3,2> B;+B << 3,1, 3,1, 4,1;+Matrix<float,3,2> 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;
+ eigen3/doc/snippets/Tutorial_solve_reuse_decomposition.cpp view
@@ -0,0 +1,13 @@+Matrix3f A(3,3);+A << 1,2,3,  4,5,6,  7,8,10;+PartialPivLU<Matrix3f> 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;
+ eigen3/doc/snippets/Tutorial_solve_singular.cpp view
@@ -0,0 +1,9 @@+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;
+ eigen3/doc/snippets/Tutorial_solve_triangular.cpp view
@@ -0,0 +1,8 @@+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<Upper>().solve(b);+cout << "The solution is:" << endl << x << endl;
+ eigen3/doc/snippets/Tutorial_solve_triangular_inplace.cpp view
@@ -0,0 +1,6 @@+Matrix3f A;+Vector3f b;+A << 1,2,3,  0,5,6,  0,0,10;+b << 3, 3, 4;+A.triangularView<Upper>().solveInPlace(b);+cout << "The solution is:" << endl << b << endl;
+ eigen3/doc/snippets/VectorwiseOp_homogeneous.cpp view
@@ -0,0 +1,7 @@+typedef Matrix<double,3,Dynamic> Matrix3Xd;+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;
+ eigen3/doc/snippets/Vectorwise_reverse.cpp view
@@ -0,0 +1,10 @@+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;
+ eigen3/doc/snippets/class_FullPivLU.cpp view
@@ -0,0 +1,16 @@+typedef Matrix<double, 5, 3> Matrix5x3;+typedef Matrix<double, 5, 5> Matrix5x5;+Matrix5x3 m = Matrix5x3::Random();+cout << "Here is the matrix m:" << endl << m << endl;+Eigen::FullPivLU<Matrix5x3> 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<StrictlyLower>() = lu.matrixLU();+cout << l << endl;+cout << "Here is the U part:" << endl;+Matrix5x3 u = lu.matrixLU().triangularView<Upper>();+cout << u << endl;+cout << "Let us now reconstruct the original matrix m:" << endl;+cout << lu.permutationP().inverse() * l * u * lu.permutationQ().inverse() << endl;
+ eigen3/doc/snippets/compile_snippet.cpp.in view
@@ -0,0 +1,20 @@+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 <iostream>+#include <Eigen/Eigen>++#ifndef M_PI+#define M_PI 3.1415926535897932384626433832795+#endif+++using namespace Eigen;+using namespace std;++int main(int, char**)+{+  cout.precision(3);+  ${snippet_source_code}+  return 0;+}
+ eigen3/doc/snippets/tut_arithmetic_redux_minmax.cpp view
@@ -0,0 +1,12 @@+  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;
+ eigen3/doc/snippets/tut_arithmetic_transpose_aliasing.cpp view
@@ -0,0 +1,5 @@+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;
+ eigen3/doc/snippets/tut_arithmetic_transpose_conjugate.cpp view
@@ -0,0 +1,12 @@+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;++
+ eigen3/doc/snippets/tut_arithmetic_transpose_inplace.cpp view
@@ -0,0 +1,6 @@+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;
+ eigen3/doc/snippets/tut_matrix_assignment_resizing.cpp view
@@ -0,0 +1,5 @@+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;
+ eigen3/doc/special_examples/CMakeLists.txt view
@@ -0,0 +1,34 @@+if(NOT EIGEN_TEST_NOQT)+  find_package(Qt4)+  if(QT4_FOUND)+    include(${QT_USE_FILE})+  endif()+endif(NOT EIGEN_TEST_NOQT)++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(QT4_FOUND)++if(EIGEN_COMPILER_SUPPORT_CPP11)+  add_executable(random_cpp11 random_cpp11.cpp)+  target_link_libraries(random_cpp11 ${EIGEN_STANDARD_LIBRARIES_TO_LINK_TO})+  add_dependencies(all_examples random_cpp11)+  ei_add_target_property(random_cpp11 COMPILE_FLAGS "-std=c++11")++  add_custom_command(+    TARGET random_cpp11+    POST_BUILD+    COMMAND random_cpp11+    ARGS >${CMAKE_CURRENT_BINARY_DIR}/random_cpp11.out+  )+endif()
+ eigen3/doc/special_examples/Tutorial_sparse_example.cpp view
@@ -0,0 +1,38 @@+#include <Eigen/Sparse>+#include <vector>+#include <iostream>++typedef Eigen::SparseMatrix<double> SpMat; // declares a column-major sparse matrix type of double+typedef Eigen::Triplet<double> T;++void buildProblem(std::vector<T>& 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 unknows (=number of pixels)++  // Assembly:+  std::vector<T> 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<SpMat> 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;+}+
+ eigen3/doc/special_examples/Tutorial_sparse_example_details.cpp view
@@ -0,0 +1,44 @@+#include <Eigen/Sparse>+#include <vector>+#include <QImage>++typedef Eigen::SparseMatrix<double> SpMat; // declares a column-major sparse matrix type of double+typedef Eigen::Triplet<double> T;++void insertCoefficient(int id, int i, int j, double w, std::vector<T>& 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<T>& 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<n; ++j)+  {+    for(int i=0; i<n; ++i)+    {+      int id = i+j*n;+      insertCoefficient(id, i-1,j, -1, coefficients, b, boundary);+      insertCoefficient(id, i+1,j, -1, coefficients, b, boundary);+      insertCoefficient(id, i,j-1, -1, coefficients, b, boundary);+      insertCoefficient(id, i,j+1, -1, coefficients, b, boundary);+      insertCoefficient(id, i,j,    4, coefficients, b, boundary);+    }+  }+}++void saveAsBitmap(const Eigen::VectorXd& x, int n, const char* filename)+{+  Eigen::Array<unsigned char,Eigen::Dynamic,Eigen::Dynamic> bits = (x*255).cast<unsigned char>();+  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);+}
+ eigen3/doc/special_examples/random_cpp11.cpp view
@@ -0,0 +1,14 @@+#include <Eigen/Core>+#include <iostream>+#include <random>++using namespace Eigen;++int main() {+  std::default_random_engine generator;+  std::poisson_distribution<int> distribution(4.1);+  auto poisson = [&] () {return distribution(generator);};++  RowVectorXi v = RowVectorXi::NullaryExpr(10, poisson );+  std::cout << v << "\n";+}
+ eigen3/doc/tutorial.cpp view
@@ -0,0 +1,62 @@+#include <Eigen/Array>++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;+}
+ eigen3/eigen3.pc.in view
@@ -0,0 +1,9 @@+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@
+ eigen3/failtest/CMakeLists.txt view
@@ -0,0 +1,75 @@+message(STATUS "Running the failtests")++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")++if (EIGEN_FAILTEST_FAILURE_COUNT)+  message(FATAL_ERROR+          "${EIGEN_FAILTEST_FAILURE_COUNT} out of ${EIGEN_FAILTEST_COUNT} failtests FAILED. "+          "To debug these failures, manually compile these programs in ${CMAKE_CURRENT_SOURCE_DIR}, "+          "with and without #define EIGEN_SHOULD_FAIL_TO_BUILD.")+else()+  message(STATUS "Failtest SUCCESS: all ${EIGEN_FAILTEST_COUNT} failtests passed.")+  message(STATUS "")+endif()
+ eigen3/failtest/bdcsvd_int.cpp view
@@ -0,0 +1,14 @@+#include "../Eigen/SVD"++#ifdef EIGEN_SHOULD_FAIL_TO_BUILD+#define SCALAR int+#else+#define SCALAR float+#endif++using namespace Eigen;++int main()+{+  BDCSVD<Matrix<SCALAR,Dynamic,Dynamic> > qr(Matrix<SCALAR,Dynamic,Dynamic>::Random(10,10));+}
+ eigen3/failtest/block_nonconst_ctor_on_const_xpr_0.cpp view
@@ -0,0 +1,15 @@+#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<Matrix3d,3,3> b(m,0,0);+}++int main() {}
+ eigen3/failtest/block_nonconst_ctor_on_const_xpr_1.cpp view
@@ -0,0 +1,15 @@+#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<Matrix3d> b(m,0,0,3,3);+}++int main() {}
+ eigen3/failtest/block_nonconst_ctor_on_const_xpr_2.cpp view
@@ -0,0 +1,16 @@+#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<Matrix3d,3,1> b(m,0);+}++int main() {}
+ eigen3/failtest/block_on_const_type_actually_const_0.cpp view
@@ -0,0 +1,16 @@+#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<CV_QUALIFIER Matrix3f>(m, 0, 0, 3, 3).coeffRef(0, 0) = 1.0f;+}++int main() {}
+ eigen3/failtest/block_on_const_type_actually_const_1.cpp view
@@ -0,0 +1,16 @@+#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<CV_QUALIFIER MatrixXf, 3, 3>(m, 0, 0).coeffRef(0, 0) = 1.0f;+}++int main() {}
+ eigen3/failtest/colpivqr_int.cpp view
@@ -0,0 +1,14 @@+#include "../Eigen/QR"++#ifdef EIGEN_SHOULD_FAIL_TO_BUILD+#define SCALAR int+#else+#define SCALAR float+#endif++using namespace Eigen;++int main()+{+  ColPivHouseholderQR<Matrix<SCALAR,Dynamic,Dynamic> > qr(Matrix<SCALAR,Dynamic,Dynamic>::Random(10,10));+}
+ eigen3/failtest/const_qualified_block_method_retval_0.cpp view
@@ -0,0 +1,15 @@+#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<Matrix3d,3,3> b(m.block<3,3>(0,0));+}++int main() {}
+ eigen3/failtest/const_qualified_block_method_retval_1.cpp view
@@ -0,0 +1,15 @@+#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<Matrix3d> b(m.block(0,0,3,3));+}++int main() {}
+ eigen3/failtest/const_qualified_diagonal_method_retval.cpp view
@@ -0,0 +1,15 @@+#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<Matrix3d> b(m.diagonal());+}++int main() {}
+ eigen3/failtest/const_qualified_transpose_method_retval.cpp view
@@ -0,0 +1,15 @@+#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<Matrix3d> b(m.transpose());+}++int main() {}
+ eigen3/failtest/cwiseunaryview_nonconst_ctor_on_const_xpr.cpp view
@@ -0,0 +1,15 @@+#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<internal::scalar_real_ref_op<double>,Matrix3d> t(m);+}++int main() {}
+ eigen3/failtest/cwiseunaryview_on_const_type_actually_const.cpp view
@@ -0,0 +1,16 @@+#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<internal::scalar_real_ref_op<double>,CV_QUALIFIER MatrixXf>(m).coeffRef(0, 0) = 1.0f;+}++int main() {}
+ eigen3/failtest/diagonal_nonconst_ctor_on_const_xpr.cpp view
@@ -0,0 +1,15 @@+#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<Matrix3d> d(m);+}++int main() {}
+ eigen3/failtest/diagonal_on_const_type_actually_const.cpp view
@@ -0,0 +1,16 @@+#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<CV_QUALIFIER MatrixXf>(m).coeffRef(0) = 1.0f;+}++int main() {}
+ eigen3/failtest/eigensolver_cplx.cpp view
@@ -0,0 +1,14 @@+#include "../Eigen/Eigenvalues"++#ifdef EIGEN_SHOULD_FAIL_TO_BUILD+#define SCALAR std::complex<double>+#else+#define SCALAR float+#endif++using namespace Eigen;++int main()+{+  EigenSolver<Matrix<SCALAR,Dynamic,Dynamic> > eig(Matrix<SCALAR,Dynamic,Dynamic>::Random(10,10));+}
+ eigen3/failtest/eigensolver_int.cpp view
@@ -0,0 +1,14 @@+#include "../Eigen/Eigenvalues"++#ifdef EIGEN_SHOULD_FAIL_TO_BUILD+#define SCALAR int+#else+#define SCALAR float+#endif++using namespace Eigen;++int main()+{+  EigenSolver<Matrix<SCALAR,Dynamic,Dynamic> > eig(Matrix<SCALAR,Dynamic,Dynamic>::Random(10,10));+}
+ eigen3/failtest/failtest_sanity_check.cpp view
@@ -0,0 +1,5 @@+#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
+ eigen3/failtest/fullpivlu_int.cpp view
@@ -0,0 +1,14 @@+#include "../Eigen/LU"++#ifdef EIGEN_SHOULD_FAIL_TO_BUILD+#define SCALAR int+#else+#define SCALAR float+#endif++using namespace Eigen;++int main()+{+  FullPivLU<Matrix<SCALAR,Dynamic,Dynamic> > lu(Matrix<SCALAR,Dynamic,Dynamic>::Random(10,10));+}
+ eigen3/failtest/fullpivqr_int.cpp view
@@ -0,0 +1,14 @@+#include "../Eigen/QR"++#ifdef EIGEN_SHOULD_FAIL_TO_BUILD+#define SCALAR int+#else+#define SCALAR float+#endif++using namespace Eigen;++int main()+{+  FullPivHouseholderQR<Matrix<SCALAR,Dynamic,Dynamic> > qr(Matrix<SCALAR,Dynamic,Dynamic>::Random(10,10));+}
+ eigen3/failtest/jacobisvd_int.cpp view
@@ -0,0 +1,14 @@+#include "../Eigen/SVD"++#ifdef EIGEN_SHOULD_FAIL_TO_BUILD+#define SCALAR int+#else+#define SCALAR float+#endif++using namespace Eigen;++int main()+{+  JacobiSVD<Matrix<SCALAR,Dynamic,Dynamic> > qr(Matrix<SCALAR,Dynamic,Dynamic>::Random(10,10));+}
+ eigen3/failtest/ldlt_int.cpp view
@@ -0,0 +1,14 @@+#include "../Eigen/Cholesky"++#ifdef EIGEN_SHOULD_FAIL_TO_BUILD+#define SCALAR int+#else+#define SCALAR float+#endif++using namespace Eigen;++int main()+{+  LDLT<Matrix<SCALAR,Dynamic,Dynamic> > ldlt(Matrix<SCALAR,Dynamic,Dynamic>::Random(10,10));+}
+ eigen3/failtest/llt_int.cpp view
@@ -0,0 +1,14 @@+#include "../Eigen/Cholesky"++#ifdef EIGEN_SHOULD_FAIL_TO_BUILD+#define SCALAR int+#else+#define SCALAR float+#endif++using namespace Eigen;++int main()+{+  LLT<Matrix<SCALAR,Dynamic,Dynamic> > llt(Matrix<SCALAR,Dynamic,Dynamic>::Random(10,10));+}
+ eigen3/failtest/map_nonconst_ctor_on_const_ptr_0.cpp view
@@ -0,0 +1,15 @@+#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<Matrix3f> m(ptr);+}++int main() {}
+ eigen3/failtest/map_nonconst_ctor_on_const_ptr_1.cpp view
@@ -0,0 +1,15 @@+#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<ArrayXf> m(ptr, size);+}++int main() {}
+ eigen3/failtest/map_nonconst_ctor_on_const_ptr_2.cpp view
@@ -0,0 +1,15 @@+#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<MatrixXf> m(ptr, rows, cols);+}++int main() {}
+ eigen3/failtest/map_nonconst_ctor_on_const_ptr_3.cpp view
@@ -0,0 +1,15 @@+#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<MatrixXf, Aligned, InnerStride<2> > m(ptr, rows, cols, InnerStride<2>());+}++int main() {}
+ eigen3/failtest/map_nonconst_ctor_on_const_ptr_4.cpp view
@@ -0,0 +1,15 @@+#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<CV_QUALIFIER MatrixXf, Unaligned, OuterStride<> > m(ptr, rows, cols, OuterStride<>(2));+}++int main() {}
+ eigen3/failtest/map_on_const_type_actually_const_0.cpp view
@@ -0,0 +1,15 @@+#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<CV_QUALIFIER MatrixXf>(ptr, 1, 1).coeffRef(0,0) = 1.0f;+}++int main() {}
+ eigen3/failtest/map_on_const_type_actually_const_1.cpp view
@@ -0,0 +1,15 @@+#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<CV_QUALIFIER Vector3f>(ptr).coeffRef(0) = 1.0f;+}++int main() {}
+ eigen3/failtest/partialpivlu_int.cpp view
@@ -0,0 +1,14 @@+#include "../Eigen/LU"++#ifdef EIGEN_SHOULD_FAIL_TO_BUILD+#define SCALAR int+#else+#define SCALAR float+#endif++using namespace Eigen;++int main()+{+  PartialPivLU<Matrix<SCALAR,Dynamic,Dynamic> > lu(Matrix<SCALAR,Dynamic,Dynamic>::Random(10,10));+}
+ eigen3/failtest/qr_int.cpp view
@@ -0,0 +1,14 @@+#include "../Eigen/QR"++#ifdef EIGEN_SHOULD_FAIL_TO_BUILD+#define SCALAR int+#else+#define SCALAR float+#endif++using namespace Eigen;++int main()+{+  HouseholderQR<Matrix<SCALAR,Dynamic,Dynamic> > qr(Matrix<SCALAR,Dynamic,Dynamic>::Random(10,10));+}
+ eigen3/failtest/ref_1.cpp view
@@ -0,0 +1,18 @@+#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<VectorXf> a) { }++int main()+{+  VectorXf a(10);+  CV_QUALIFIER VectorXf& ac(a);+  call_ref(ac);+}
+ eigen3/failtest/ref_2.cpp view
@@ -0,0 +1,15 @@+#include "../Eigen/Core"++using namespace Eigen;++void call_ref(Ref<VectorXf> 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+}
+ eigen3/failtest/ref_3.cpp view
@@ -0,0 +1,15 @@+#include "../Eigen/Core"++using namespace Eigen;++#ifdef EIGEN_SHOULD_FAIL_TO_BUILD+void call_ref(Ref<VectorXf> a) { }+#else+void call_ref(const Ref<const VectorXf> &a) { }+#endif++int main()+{+  VectorXf a(10);+  call_ref(a+a);+}
+ eigen3/failtest/ref_4.cpp view
@@ -0,0 +1,15 @@+#include "../Eigen/Core"++using namespace Eigen;++void call_ref(Ref<MatrixXf,0,OuterStride<> > a) {}++int main()+{+  MatrixXf A(10,10);+#ifdef EIGEN_SHOULD_FAIL_TO_BUILD+  call_ref(A.transpose());+#else+  call_ref(A);+#endif+}
+ eigen3/failtest/ref_5.cpp view
@@ -0,0 +1,16 @@+#include "../Eigen/Core"++using namespace Eigen;++void call_ref(Ref<VectorXf> a) { }++int main()+{+  VectorXf a(10);+  DenseBase<VectorXf> &ac(a);+#ifdef EIGEN_SHOULD_FAIL_TO_BUILD+  call_ref(ac);+#else+  call_ref(ac.derived());+#endif+}
+ eigen3/failtest/selfadjointview_nonconst_ctor_on_const_xpr.cpp view
@@ -0,0 +1,15 @@+#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<Matrix3d,Upper> t(m);+}++int main() {}
+ eigen3/failtest/selfadjointview_on_const_type_actually_const.cpp view
@@ -0,0 +1,16 @@+#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<CV_QUALIFIER MatrixXf,Upper>(m).coeffRef(0, 0) = 1.0f;+}++int main() {}
+ eigen3/failtest/sparse_ref_1.cpp view
@@ -0,0 +1,18 @@+#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<SparseMatrix<float> > a) { }++int main()+{+  SparseMatrix<float> a(10,10);+  CV_QUALIFIER SparseMatrix<float>& ac(a);+  call_ref(ac);+}
+ eigen3/failtest/sparse_ref_2.cpp view
@@ -0,0 +1,15 @@+#include "../Eigen/Sparse"++using namespace Eigen;++void call_ref(Ref<SparseMatrix<float> > a) { }++int main()+{+  SparseMatrix<float> A(10,10);+#ifdef EIGEN_SHOULD_FAIL_TO_BUILD+  call_ref(A.row(3));+#else+  call_ref(A.col(3));+#endif+}
+ eigen3/failtest/sparse_ref_3.cpp view
@@ -0,0 +1,15 @@+#include "../Eigen/Sparse"++using namespace Eigen;++#ifdef EIGEN_SHOULD_FAIL_TO_BUILD+void call_ref(Ref<SparseMatrix<float> > a) { }+#else+void call_ref(const Ref<const SparseMatrix<float> > &a) { }+#endif++int main()+{+  SparseMatrix<float> a(10,10);+  call_ref(a+a);+}
+ eigen3/failtest/sparse_ref_4.cpp view
@@ -0,0 +1,15 @@+#include "../Eigen/Sparse"++using namespace Eigen;++void call_ref(Ref<SparseMatrix<float> > a) {}++int main()+{+  SparseMatrix<float> A(10,10);+#ifdef EIGEN_SHOULD_FAIL_TO_BUILD+  call_ref(A.transpose());+#else+  call_ref(A);+#endif+}
+ eigen3/failtest/sparse_ref_5.cpp view
@@ -0,0 +1,16 @@+#include "../Eigen/Sparse"++using namespace Eigen;++void call_ref(Ref<SparseMatrix<float> > a) { }++int main()+{+  SparseMatrix<float> a(10,10);+  SparseMatrixBase<SparseMatrix<float> > &ac(a);+#ifdef EIGEN_SHOULD_FAIL_TO_BUILD+  call_ref(ac);+#else+  call_ref(ac.derived());+#endif+}
+ eigen3/failtest/sparse_storage_mismatch.cpp view
@@ -0,0 +1,16 @@+#include "../Eigen/Sparse"+using namespace Eigen;++typedef SparseMatrix<double,ColMajor> Mat1;+#ifdef EIGEN_SHOULD_FAIL_TO_BUILD+typedef SparseMatrix<double,RowMajor> Mat2;+#else+typedef SparseMatrix<double,ColMajor> Mat2;+#endif++int main()+{+  Mat1 a(10,10);+  Mat2 b(10,10);+  a += b;+}
+ eigen3/failtest/swap_1.cpp view
@@ -0,0 +1,14 @@+#include "../Eigen/Core"++using namespace Eigen;++int main()+{+  VectorXf a(10), b(10);+#ifdef EIGEN_SHOULD_FAIL_TO_BUILD+  const DenseBase<VectorXf> &ac(a);+#else+  DenseBase<VectorXf> &ac(a);+#endif+  b.swap(ac);+}
+ eigen3/failtest/swap_2.cpp view
@@ -0,0 +1,14 @@+#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+}
+ eigen3/failtest/ternary_1.cpp view
@@ -0,0 +1,13 @@+#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+}
+ eigen3/failtest/ternary_2.cpp view
@@ -0,0 +1,13 @@+#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+}
+ eigen3/failtest/transpose_nonconst_ctor_on_const_xpr.cpp view
@@ -0,0 +1,15 @@+#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<Matrix3d> t(m);+}++int main() {}
+ eigen3/failtest/transpose_on_const_type_actually_const.cpp view
@@ -0,0 +1,16 @@+#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<CV_QUALIFIER MatrixXf>(m).coeffRef(0, 0) = 1.0f;+}++int main() {}
+ eigen3/failtest/triangularview_nonconst_ctor_on_const_xpr.cpp view
@@ -0,0 +1,15 @@+#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<Matrix3d,Upper> t(m);+}++int main() {}
+ eigen3/failtest/triangularview_on_const_type_actually_const.cpp view
@@ -0,0 +1,16 @@+#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<CV_QUALIFIER MatrixXf,Upper>(m).coeffRef(0, 0) = 1.0f;+}++int main() {}
+ eigen3/lapack/CMakeLists.txt view
@@ -0,0 +1,449 @@++project(EigenLapack CXX)++include("../cmake/language_support.cmake")++workaround_9220(Fortran EIGEN_Fortran_COMPILER_WORKS)++if(EIGEN_Fortran_COMPILER_WORKS)+  enable_language(Fortran OPTIONAL)+  if(NOT CMAKE_Fortran_COMPILER)+    set(EIGEN_Fortran_COMPILER_WORKS OFF)+  endif()+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 "Enbale 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 wont 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(EIGEN_ENABLE_LAPACK_TESTS)++endif(EIGEN_Fortran_COMPILER_WORKS)++add_library(eigen_lapack_static ${EigenLapack_SRCS} ${ReferenceLapack_SRCS})+add_library(eigen_lapack SHARED ${EigenLapack_SRCS})++target_link_libraries(eigen_lapack  eigen_blas)++if(EIGEN_STANDARD_LIBRARIES_TO_LINK_TO)+  target_link_libraries(eigen_lapack_static ${EIGEN_STANDARD_LIBRARIES_TO_LINK_TO})+  target_link_libraries(eigen_lapack        ${EIGEN_STANDARD_LIBRARIES_TO_LINK_TO})+endif()++add_dependencies(lapack eigen_lapack eigen_lapack_static)++install(TARGETS eigen_lapack eigen_lapack_static+        RUNTIME DESTINATION bin+        LIBRARY DESTINATION lib+        ARCHIVE DESTINATION lib)++        +        +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()+  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}")+    get_target_property(TEST_LOC ${target} LOCATION)+    string(REPLACE "." "_" input_name ${input})+    set(testName "${target}_${input_name}")+    if(EXISTS "${TEST_INPUT}")+      add_test(LAPACK-${testName} "${CMAKE_COMMAND}"+        -DTEST=${TEST_LOC}+        -DINPUT=${TEST_INPUT} +        -DOUTPUT=${TEST_OUTPUT} +        -DINTDIR=${CMAKE_CFG_INTDIR}+        -P "${LAPACK_SOURCE_DIR}/testing/runtest.cmake")+    endif()+  endmacro(add_lapack_test)++  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()+
+ eigen3/lapack/cholesky.cpp view
@@ -0,0 +1,72 @@+// This file is part of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2010-2011 Gael Guennebaud <gael.guennebaud@inria.fr>+//+// 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 <Eigen/Cholesky>++// 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<std::max(1,*n))  *info = -4;+  if(*info!=0)+  {+    int e = -*info;+    return xerbla_(SCALAR_SUFFIX_UP"POTRF", &e, 6);+  }++  Scalar* a = reinterpret_cast<Scalar*>(pa);+  MatrixType A(a,*n,*n,*lda);+  int ret;+  if(UPLO(*uplo)==UP) ret = int(internal::llt_inplace<Scalar, Upper>::blocked(A));+  else                ret = int(internal::llt_inplace<Scalar, Lower>::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<std::max(1,*n))  *info = -5;+  else  if(*ldb<std::max(1,*n))  *info = -7;+  if(*info!=0)+  {+    int e = -*info;+    return xerbla_(SCALAR_SUFFIX_UP"POTRS", &e, 6);+  }++  Scalar* a = reinterpret_cast<Scalar*>(pa);+  Scalar* b = reinterpret_cast<Scalar*>(pb);+  MatrixType A(a,*n,*n,*lda);+  MatrixType B(b,*n,*nrhs,*ldb);++  if(UPLO(*uplo)==UP)+  {+    A.triangularView<Upper>().adjoint().solveInPlace(B);+    A.triangularView<Upper>().solveInPlace(B);+  }+  else+  {+    A.triangularView<Lower>().solveInPlace(B);+    A.triangularView<Lower>().adjoint().solveInPlace(B);+  }++  return 0;+}
+ eigen3/lapack/clacgv.f view
@@ -0,0 +1,116 @@+*> \brief \b CLACGV+*+*  =========== DOCUMENTATION ===========+*+* Online html documentation available at +*            http://www.netlib.org/lapack/explore-html/ +*+*> \htmlonly+*> Download CLACGV + dependencies +*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/clacgv.f"> +*> [TGZ]</a> +*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/clacgv.f"> +*> [ZIP]</a> +*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/clacgv.f"> +*> [TXT]</a>+*> \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
+ eigen3/lapack/cladiv.f view
@@ -0,0 +1,97 @@+*> \brief \b CLADIV+*+*  =========== DOCUMENTATION ===========+*+* Online html documentation available at +*            http://www.netlib.org/lapack/explore-html/ +*+*> \htmlonly+*> Download CLADIV + dependencies +*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/cladiv.f"> +*> [TGZ]</a> +*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/cladiv.f"> +*> [ZIP]</a> +*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/cladiv.f"> +*> [TXT]</a>+*> \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
+ eigen3/lapack/clarf.f view
@@ -0,0 +1,232 @@+*> \brief \b CLARF+*+*  =========== DOCUMENTATION ===========+*+* Online html documentation available at +*            http://www.netlib.org/lapack/explore-html/ +*+*> \htmlonly+*> Download CLARF + dependencies +*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/clarf.f"> +*> [TGZ]</a> +*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/clarf.f"> +*> [ZIP]</a> +*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/clarf.f"> +*> [TXT]</a>+*> \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
+ eigen3/lapack/clarfb.f view
@@ -0,0 +1,771 @@+*> \brief \b CLARFB+*+*  =========== DOCUMENTATION ===========+*+* Online html documentation available at +*            http://www.netlib.org/lapack/explore-html/ +*+*> \htmlonly+*> Download CLARFB + dependencies +*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/clarfb.f"> +*> [TGZ]</a> +*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/clarfb.f"> +*> [ZIP]</a> +*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/clarfb.f"> +*> [TXT]</a>+*> \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
+ eigen3/lapack/clarfg.f view
@@ -0,0 +1,203 @@+*> \brief \b CLARFG+*+*  =========== DOCUMENTATION ===========+*+* Online html documentation available at +*            http://www.netlib.org/lapack/explore-html/ +*+*> \htmlonly+*> Download CLARFG + dependencies +*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/clarfg.f"> +*> [TGZ]</a> +*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/clarfg.f"> +*> [ZIP]</a> +*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/clarfg.f"> +*> [TXT]</a>+*> \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
+ eigen3/lapack/clarft.f view
@@ -0,0 +1,328 @@+*> \brief \b CLARFT+*+*  =========== DOCUMENTATION ===========+*+* Online html documentation available at +*            http://www.netlib.org/lapack/explore-html/ +*+*> \htmlonly+*> Download CLARFT + dependencies +*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/clarft.f"> +*> [TGZ]</a> +*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/clarft.f"> +*> [ZIP]</a> +*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/clarft.f"> +*> [TXT]</a>+*> \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
+ eigen3/lapack/complex_double.cpp view
@@ -0,0 +1,18 @@+// This file is part of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2009-2014 Gael Guennebaud <gael.guennebaud@inria.fr>+//+// 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<double>+#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"
+ eigen3/lapack/complex_single.cpp view
@@ -0,0 +1,18 @@+// This file is part of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2009-2014 Gael Guennebaud <gael.guennebaud@inria.fr>+//+// 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<float>+#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"
+ eigen3/lapack/dladiv.f view
@@ -0,0 +1,128 @@+*> \brief \b DLADIV+*+*  =========== DOCUMENTATION ===========+*+* Online html documentation available at +*            http://www.netlib.org/lapack/explore-html/ +*+*> \htmlonly+*> Download DLADIV + dependencies +*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/dladiv.f"> +*> [TGZ]</a> +*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/dladiv.f"> +*> [ZIP]</a> +*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/dladiv.f"> +*> [TXT]</a>+*> \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
+ eigen3/lapack/dlamch.f view
@@ -0,0 +1,189 @@+*> \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+*+************************************************************************
+ eigen3/lapack/dlapy2.f view
@@ -0,0 +1,104 @@+*> \brief \b DLAPY2+*+*  =========== DOCUMENTATION ===========+*+* Online html documentation available at +*            http://www.netlib.org/lapack/explore-html/ +*+*> \htmlonly+*> Download DLAPY2 + dependencies +*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/dlapy2.f"> +*> [TGZ]</a> +*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/dlapy2.f"> +*> [ZIP]</a> +*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/dlapy2.f"> +*> [TXT]</a>+*> \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
+ eigen3/lapack/dlapy3.f view
@@ -0,0 +1,111 @@+*> \brief \b DLAPY3+*+*  =========== DOCUMENTATION ===========+*+* Online html documentation available at +*            http://www.netlib.org/lapack/explore-html/ +*+*> \htmlonly+*> Download DLAPY3 + dependencies +*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/dlapy3.f"> +*> [TGZ]</a> +*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/dlapy3.f"> +*> [ZIP]</a> +*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/dlapy3.f"> +*> [TXT]</a>+*> \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
+ eigen3/lapack/dlarf.f view
@@ -0,0 +1,227 @@+*> \brief \b DLARF+*+*  =========== DOCUMENTATION ===========+*+* Online html documentation available at +*            http://www.netlib.org/lapack/explore-html/ +*+*> \htmlonly+*> Download DLARF + dependencies +*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/dlarf.f"> +*> [TGZ]</a> +*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/dlarf.f"> +*> [ZIP]</a> +*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/dlarf.f"> +*> [TXT]</a>+*> \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
+ eigen3/lapack/dlarfb.f view
@@ -0,0 +1,762 @@+*> \brief \b DLARFB+*+*  =========== DOCUMENTATION ===========+*+* Online html documentation available at +*            http://www.netlib.org/lapack/explore-html/ +*+*> \htmlonly+*> Download DLARFB + dependencies +*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/dlarfb.f"> +*> [TGZ]</a> +*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/dlarfb.f"> +*> [ZIP]</a> +*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/dlarfb.f"> +*> [TXT]</a>+*> \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
+ eigen3/lapack/dlarfg.f view
@@ -0,0 +1,196 @@+*> \brief \b DLARFG+*+*  =========== DOCUMENTATION ===========+*+* Online html documentation available at +*            http://www.netlib.org/lapack/explore-html/ +*+*> \htmlonly+*> Download DLARFG + dependencies +*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/dlarfg.f"> +*> [TGZ]</a> +*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/dlarfg.f"> +*> [ZIP]</a> +*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/dlarfg.f"> +*> [TXT]</a>+*> \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
+ eigen3/lapack/dlarft.f view
@@ -0,0 +1,326 @@+*> \brief \b DLARFT+*+*  =========== DOCUMENTATION ===========+*+* Online html documentation available at +*            http://www.netlib.org/lapack/explore-html/ +*+*> \htmlonly+*> Download DLARFT + dependencies +*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/dlarft.f"> +*> [TGZ]</a> +*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/dlarft.f"> +*> [ZIP]</a> +*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/dlarft.f"> +*> [TXT]</a>+*> \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
+ eigen3/lapack/double.cpp view
@@ -0,0 +1,18 @@+// This file is part of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2009-2014 Gael Guennebaud <gael.guennebaud@inria.fr>+//+// 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"
+ eigen3/lapack/dsecnd_NONE.f view
@@ -0,0 +1,52 @@+*> \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
+ eigen3/lapack/eigenvalues.cpp view
@@ -0,0 +1,62 @@+// This file is part of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2011 Gael Guennebaud <gael.guennebaud@inria.fr>+//+// 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 <Eigen/Eigenvalues>++// 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<std::max(1,*n))                         *info = -5;+  else  if((!query_size) && *lwork<std::max(1,3**n-1))  *info = -8;+    +  if(*info!=0)+  {+    int e = -*info;+    return xerbla_(SCALAR_SUFFIX_UP"SYEV ", &e, 6);+  }+  +  if(query_size)+  {+    *lwork = 0;+    return 0;+  }+  +  if(*n==0)+    return 0;+  +  PlainMatrixType mat(*n,*n);+  if(UPLO(*uplo)==UP) mat = matrix(a,*n,*n,*lda).adjoint();+  else                mat = matrix(a,*n,*n,*lda);+  +  bool computeVectors = *jobz=='V' || *jobz=='v';+  SelfAdjointEigenSolver<PlainMatrixType> eig(mat,computeVectors?ComputeEigenvectors:EigenvaluesOnly);+  +  if(eig.info()==NoConvergence)+  {+    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;+}
+ eigen3/lapack/ilaclc.f view
@@ -0,0 +1,118 @@+*> \brief \b ILACLC+*+*  =========== DOCUMENTATION ===========+*+* Online html documentation available at +*            http://www.netlib.org/lapack/explore-html/ +*+*> \htmlonly+*> Download ILACLC + dependencies +*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/ilaclc.f"> +*> [TGZ]</a> +*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/ilaclc.f"> +*> [ZIP]</a> +*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/ilaclc.f"> +*> [TXT]</a>+*> \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
+ eigen3/lapack/ilaclr.f view
@@ -0,0 +1,121 @@+*> \brief \b ILACLR+*+*  =========== DOCUMENTATION ===========+*+* Online html documentation available at +*            http://www.netlib.org/lapack/explore-html/ +*+*> \htmlonly+*> Download ILACLR + dependencies +*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/ilaclr.f"> +*> [TGZ]</a> +*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/ilaclr.f"> +*> [ZIP]</a> +*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/ilaclr.f"> +*> [TXT]</a>+*> \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
+ eigen3/lapack/iladlc.f view
@@ -0,0 +1,118 @@+*> \brief \b ILADLC+*+*  =========== DOCUMENTATION ===========+*+* Online html documentation available at +*            http://www.netlib.org/lapack/explore-html/ +*+*> \htmlonly+*> Download ILADLC + dependencies +*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/iladlc.f"> +*> [TGZ]</a> +*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/iladlc.f"> +*> [ZIP]</a> +*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/iladlc.f"> +*> [TXT]</a>+*> \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
+ eigen3/lapack/iladlr.f view
@@ -0,0 +1,121 @@+*> \brief \b ILADLR+*+*  =========== DOCUMENTATION ===========+*+* Online html documentation available at +*            http://www.netlib.org/lapack/explore-html/ +*+*> \htmlonly+*> Download ILADLR + dependencies +*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/iladlr.f"> +*> [TGZ]</a> +*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/iladlr.f"> +*> [ZIP]</a> +*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/iladlr.f"> +*> [TXT]</a>+*> \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
+ eigen3/lapack/ilaslc.f view
@@ -0,0 +1,118 @@+*> \brief \b ILASLC+*+*  =========== DOCUMENTATION ===========+*+* Online html documentation available at +*            http://www.netlib.org/lapack/explore-html/ +*+*> \htmlonly+*> Download ILASLC + dependencies +*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/ilaslc.f"> +*> [TGZ]</a> +*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/ilaslc.f"> +*> [ZIP]</a> +*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/ilaslc.f"> +*> [TXT]</a>+*> \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
+ eigen3/lapack/ilaslr.f view
@@ -0,0 +1,121 @@+*> \brief \b ILASLR+*+*  =========== DOCUMENTATION ===========+*+* Online html documentation available at +*            http://www.netlib.org/lapack/explore-html/ +*+*> \htmlonly+*> Download ILASLR + dependencies +*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/ilaslr.f"> +*> [TGZ]</a> +*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/ilaslr.f"> +*> [ZIP]</a> +*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/ilaslr.f"> +*> [TXT]</a>+*> \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
+ eigen3/lapack/ilazlc.f view
@@ -0,0 +1,118 @@+*> \brief \b ILAZLC+*+*  =========== DOCUMENTATION ===========+*+* Online html documentation available at +*            http://www.netlib.org/lapack/explore-html/ +*+*> \htmlonly+*> Download ILAZLC + dependencies +*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/ilazlc.f"> +*> [TGZ]</a> +*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/ilazlc.f"> +*> [ZIP]</a> +*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/ilazlc.f"> +*> [TXT]</a>+*> \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
+ eigen3/lapack/ilazlr.f view
@@ -0,0 +1,121 @@+*> \brief \b ILAZLR+*+*  =========== DOCUMENTATION ===========+*+* Online html documentation available at +*            http://www.netlib.org/lapack/explore-html/ +*+*> \htmlonly+*> Download ILAZLR + dependencies +*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/ilazlr.f"> +*> [TGZ]</a> +*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/ilazlr.f"> +*> [ZIP]</a> +*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/ilazlr.f"> +*> [TXT]</a>+*> \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
+ eigen3/lapack/lapack_common.h view
@@ -0,0 +1,29 @@+// This file is part of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2010-2014 Gael Guennebaud <gael.guennebaud@inria.fr>+//+// 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<Eigen::Transpositions<Eigen::Dynamic,Eigen::Dynamic,int> > 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
+ eigen3/lapack/lu.cpp view
@@ -0,0 +1,89 @@+// This file is part of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2010-2011 Gael Guennebaud <gael.guennebaud@inria.fr>+//+// 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 <Eigen/LU>++// 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<std::max(1,*m))   *info = -4;+  if(*info!=0)+  {+    int e = -*info;+    return xerbla_(SCALAR_SUFFIX_UP"GETRF", &e, 6);+  }++  if(*m==0 || *n==0)+    return 0;++  Scalar* a = reinterpret_cast<Scalar*>(pa);+  int nb_transpositions;+  int ret = int(Eigen::internal::partial_lu_impl<Scalar,ColMajor,int>+                     ::blocked_lu(*m, *n, a, *lda, ipiv, nb_transpositions));++  for(int i=0; i<std::min(*m,*n); ++i)+    ipiv[i]++;++  if(ret>=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<std::max(1,*n))  *info = -5;+  else  if(*ldb<std::max(1,*n))  *info = -8;+  if(*info!=0)+  {+    int e = -*info;+    return xerbla_(SCALAR_SUFFIX_UP"GETRS", &e, 6);+  }++  Scalar* a = reinterpret_cast<Scalar*>(pa);+  Scalar* b = reinterpret_cast<Scalar*>(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<UnitLower>().solveInPlace(B);+    lu.triangularView<Upper>().solveInPlace(B);+  }+  else if(OP(*trans)==TR)+  {+    lu.triangularView<Upper>().transpose().solveInPlace(B);+    lu.triangularView<UnitLower>().transpose().solveInPlace(B);+    B = PivotsType(ipiv,*n).transpose() * B;+  }+  else if(OP(*trans)==ADJ)+  {+    lu.triangularView<Upper>().adjoint().solveInPlace(B);+    lu.triangularView<UnitLower>().adjoint().solveInPlace(B);+    B = PivotsType(ipiv,*n).transpose() * B;+  }+  for(int i=0; i<*n; ++i)+    ipiv[i]++;++  return 0;+}
+ eigen3/lapack/second_NONE.f view
@@ -0,0 +1,52 @@+*> \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
+ eigen3/lapack/single.cpp view
@@ -0,0 +1,18 @@+// This file is part of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2009-2014 Gael Guennebaud <gael.guennebaud@inria.fr>+//+// 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"
+ eigen3/lapack/sladiv.f view
@@ -0,0 +1,128 @@+*> \brief \b SLADIV+*+*  =========== DOCUMENTATION ===========+*+* Online html documentation available at +*            http://www.netlib.org/lapack/explore-html/ +*+*> \htmlonly+*> Download SLADIV + dependencies +*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/sladiv.f"> +*> [TGZ]</a> +*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/sladiv.f"> +*> [ZIP]</a> +*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/sladiv.f"> +*> [TXT]</a>+*> \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
+ eigen3/lapack/slamch.f view
@@ -0,0 +1,192 @@+*> \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+*+************************************************************************
+ eigen3/lapack/slapy2.f view
@@ -0,0 +1,104 @@+*> \brief \b SLAPY2+*+*  =========== DOCUMENTATION ===========+*+* Online html documentation available at +*            http://www.netlib.org/lapack/explore-html/ +*+*> \htmlonly+*> Download SLAPY2 + dependencies +*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/slapy2.f"> +*> [TGZ]</a> +*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/slapy2.f"> +*> [ZIP]</a> +*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/slapy2.f"> +*> [TXT]</a>+*> \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
+ eigen3/lapack/slapy3.f view
@@ -0,0 +1,111 @@+*> \brief \b SLAPY3+*+*  =========== DOCUMENTATION ===========+*+* Online html documentation available at +*            http://www.netlib.org/lapack/explore-html/ +*+*> \htmlonly+*> Download SLAPY3 + dependencies +*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/slapy3.f"> +*> [TGZ]</a> +*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/slapy3.f"> +*> [ZIP]</a> +*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/slapy3.f"> +*> [TXT]</a>+*> \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
+ eigen3/lapack/slarf.f view
@@ -0,0 +1,227 @@+*> \brief \b SLARF+*+*  =========== DOCUMENTATION ===========+*+* Online html documentation available at +*            http://www.netlib.org/lapack/explore-html/ +*+*> \htmlonly+*> Download SLARF + dependencies +*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/slarf.f"> +*> [TGZ]</a> +*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/slarf.f"> +*> [ZIP]</a> +*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/slarf.f"> +*> [TXT]</a>+*> \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
+ eigen3/lapack/slarfb.f view
@@ -0,0 +1,763 @@+*> \brief \b SLARFB+*+*  =========== DOCUMENTATION ===========+*+* Online html documentation available at +*            http://www.netlib.org/lapack/explore-html/ +*+*> \htmlonly+*> Download SLARFB + dependencies +*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/slarfb.f"> +*> [TGZ]</a> +*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/slarfb.f"> +*> [ZIP]</a> +*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/slarfb.f"> +*> [TXT]</a>+*> \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
+ eigen3/lapack/slarfg.f view
@@ -0,0 +1,196 @@+*> \brief \b SLARFG+*+*  =========== DOCUMENTATION ===========+*+* Online html documentation available at +*            http://www.netlib.org/lapack/explore-html/ +*+*> \htmlonly+*> Download SLARFG + dependencies +*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/slarfg.f"> +*> [TGZ]</a> +*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/slarfg.f"> +*> [ZIP]</a> +*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/slarfg.f"> +*> [TXT]</a>+*> \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
+ eigen3/lapack/slarft.f view
@@ -0,0 +1,326 @@+*> \brief \b SLARFT+*+*  =========== DOCUMENTATION ===========+*+* Online html documentation available at +*            http://www.netlib.org/lapack/explore-html/ +*+*> \htmlonly+*> Download SLARFT + dependencies +*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/slarft.f"> +*> [TGZ]</a> +*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/slarft.f"> +*> [ZIP]</a> +*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/slarft.f"> +*> [TXT]</a>+*> \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
+ eigen3/lapack/svd.cpp view
@@ -0,0 +1,138 @@+// This file is part of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2014 Gael Guennebaud <gael.guennebaud@inria.fr>+//+// 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 <Eigen/SVD>++// 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<std::max(1,*m))                                   *info = -5;+  else  if(*lda<std::max(1,*m))                                   *info = -8;+  else  if(*ldu <1 || (*jobz=='A' && *ldu <*m)+                   || (*jobz=='O' && *m<*n && *ldu<*m))           *info = -8;+  else  if(*ldvt<1 || (*jobz=='A' && *ldvt<*n)+                   || (*jobz=='S' && *ldvt<diag_size)+                   || (*jobz=='O' && *m>=*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<PlainMatrixType> 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<std::max(1,*m))                                   *info = -6;+  else  if(*ldu <1 || ((*jobu=='A' || *jobu=='S') && *ldu<*m))    *info = -9;+  else  if(*ldvt<1 || (*jobv=='A' && *ldvt<*n)+                   || (*jobv=='S' && *ldvt<diag_size))            *info = -11;+  +  if(*info!=0)+  {+    int e = -*info;+    return xerbla_(SCALAR_SUFFIX_UP"GESVD ", &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 = (*jobu=='A' ? ComputeFullU : *jobu=='S' || *jobu=='O' ? ComputeThinU : 0)+             | (*jobv=='A' ? ComputeFullV : *jobv=='S' || *jobv=='O' ? ComputeThinV : 0);+  +  JacobiSVD<PlainMatrixType> 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;+}
+ eigen3/lapack/zlacgv.f view
@@ -0,0 +1,116 @@+*> \brief \b ZLACGV+*+*  =========== DOCUMENTATION ===========+*+* Online html documentation available at +*            http://www.netlib.org/lapack/explore-html/ +*+*> \htmlonly+*> Download ZLACGV + dependencies +*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/zlacgv.f"> +*> [TGZ]</a> +*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/zlacgv.f"> +*> [ZIP]</a> +*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/zlacgv.f"> +*> [TXT]</a>+*> \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
+ eigen3/lapack/zladiv.f view
@@ -0,0 +1,97 @@+*> \brief \b ZLADIV+*+*  =========== DOCUMENTATION ===========+*+* Online html documentation available at +*            http://www.netlib.org/lapack/explore-html/ +*+*> \htmlonly+*> Download ZLADIV + dependencies +*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/zladiv.f"> +*> [TGZ]</a> +*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/zladiv.f"> +*> [ZIP]</a> +*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/zladiv.f"> +*> [TXT]</a>+*> \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
+ eigen3/lapack/zlarf.f view
@@ -0,0 +1,232 @@+*> \brief \b ZLARF+*+*  =========== DOCUMENTATION ===========+*+* Online html documentation available at +*            http://www.netlib.org/lapack/explore-html/ +*+*> \htmlonly+*> Download ZLARF + dependencies +*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/zlarf.f"> +*> [TGZ]</a> +*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/zlarf.f"> +*> [ZIP]</a> +*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/zlarf.f"> +*> [TXT]</a>+*> \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
+ eigen3/lapack/zlarfb.f view
@@ -0,0 +1,774 @@+*> \brief \b ZLARFB+*+*  =========== DOCUMENTATION ===========+*+* Online html documentation available at +*            http://www.netlib.org/lapack/explore-html/ +*+*> \htmlonly+*> Download ZLARFB + dependencies +*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/zlarfb.f"> +*> [TGZ]</a> +*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/zlarfb.f"> +*> [ZIP]</a> +*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/zlarfb.f"> +*> [TXT]</a>+*> \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
+ eigen3/lapack/zlarfg.f view
@@ -0,0 +1,203 @@+*> \brief \b ZLARFG+*+*  =========== DOCUMENTATION ===========+*+* Online html documentation available at +*            http://www.netlib.org/lapack/explore-html/ +*+*> \htmlonly+*> Download ZLARFG + dependencies +*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/zlarfg.f"> +*> [TGZ]</a> +*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/zlarfg.f"> +*> [ZIP]</a> +*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/zlarfg.f"> +*> [TXT]</a>+*> \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
+ eigen3/lapack/zlarft.f view
@@ -0,0 +1,327 @@+*> \brief \b ZLARFT+*+*  =========== DOCUMENTATION ===========+*+* Online html documentation available at +*            http://www.netlib.org/lapack/explore-html/ +*+*> \htmlonly+*> Download ZLARFT + dependencies +*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/zlarft.f"> +*> [TGZ]</a> +*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/zlarft.f"> +*> [ZIP]</a> +*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/zlarft.f"> +*> [TXT]</a>+*> \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
+ eigen3/scripts/CMakeLists.txt view
@@ -0,0 +1,6 @@+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)
+ eigen3/scripts/buildtests.in view
@@ -0,0 +1,22 @@+#!/bin/bash++if [[ $# != 1 || $1 == *help ]]+then+  echo "usage: $0 regexp"+  echo "  Builds 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'"+  exit 0+fi++TESTSLIST="@EIGEN_TESTS_LIST@"+targets_to_make=`echo "$TESTSLIST" | egrep "$1" | xargs echo`++if [ -n "${EIGEN_MAKE_ARGS:+x}" ]+then+  @CMAKE_MAKE_PROGRAM@ $targets_to_make ${EIGEN_MAKE_ARGS}+else+  @CMAKE_MAKE_PROGRAM@ $targets_to_make @EIGEN_TEST_BUILD_FLAGS@+fi+exit $?+
+ eigen3/scripts/cdashtesting.cmake.in view
@@ -0,0 +1,49 @@++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_HG_COMMAND NAMES hg)+set(CTEST_UPDATE_COMMAND "${CTEST_HG_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()
+ eigen3/scripts/check.in view
@@ -0,0 +1,21 @@+#!/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 $?
+ eigen3/scripts/debug.in view
@@ -0,0 +1,3 @@+#!/bin/sh++cmake -DCMAKE_BUILD_TYPE=Debug .
+ eigen3/scripts/eigen_gen_credits.cpp view
@@ -0,0 +1,232 @@+#include <string>+#include <sstream>+#include <iostream>+#include <fstream>+#include <iomanip>+#include <map>+#include <list>++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 <bblurp@email.com>+  +  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<string,int> contributors_map_from_churn_output(const char *filename)+{+  map<string,int> 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<string,int>::iterator it = contributors_map.find(name);+    // if new contributor, insert+    if(it == contributors_map.end())+      contributors_map.insert(pair<string,int>(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<contributor>& 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<contributor>::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<string,int> contributors_map_for_changedlines = contributors_map_from_churn_output("churn-changedlines.out");+  //map<string,int> contributors_map_for_changesets = contributors_map_from_churn_output("churn-changesets.out");+  +  // merge into the contributors list+  list<contributor> contributors_list;+  map<string,int>::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<contributor>::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;+}
+ eigen3/scripts/eigen_gen_docs view
@@ -0,0 +1,24 @@+#!/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"+
+ eigen3/scripts/release.in view
@@ -0,0 +1,3 @@+#!/bin/sh++cmake -DCMAKE_BUILD_TYPE=Release .
+ eigen3/scripts/relicense.py view
@@ -0,0 +1,69 @@+# This file is part of Eigen, a lightweight C++ template library+# for linear algebra.+#+# Copyright (C) 2012 Keir Mierle <mierle@gmail.com>+#+# 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 <http://www.gnu.org/licenses/>.+'''++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
+ eigen3/signature_of_eigen3_matrix_library view
@@ -0,0 +1,1 @@+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...
+ eigen3/test/CMakeLists.txt view
@@ -0,0 +1,390 @@+# generate split test header file only if it does not yet exist+# in order to prevent a rebuild everytime cmake is configured+if(NOT EXISTS ${CMAKE_CURRENT_BINARY_DIR}/split_test_helper.h)  +  file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/split_test_helper.h "")+  foreach(i RANGE 1 999)+    file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/split_test_helper.h+      "#ifdef EIGEN_TEST_PART_${i}\n"+      "#define CALL_SUBTEST_${i}(FUNC) CALL_SUBTEST(FUNC)\n"+      "#else\n"+      "#define CALL_SUBTEST_${i}(FUNC)\n"+      "#endif\n\n"+    )+  endforeach()+endif()++# check if we have a Fortran compiler+include("../cmake/language_support.cmake")++workaround_9220(Fortran EIGEN_Fortran_COMPILER_WORKS)++if(EIGEN_Fortran_COMPILER_WORKS)+  enable_language(Fortran OPTIONAL)+  if(NOT CMAKE_Fortran_COMPILER)+    set(EIGEN_Fortran_COMPILER_WORKS OFF)+  endif()+endif()++if(NOT EIGEN_Fortran_COMPILER_WORKS)+  # search for a default Lapack library to complete Eigen's one+  find_package(LAPACK QUIET)+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(NOT WIN32)+    message(STATUS "REAL CASES CAN NOT BE CURRENTLY TESTED ON WIN32")+  endif(NOT WIN32)+endif(EIGEN_TEST_MATRIX_DIR)++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(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 SCOTCH)+# 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(SCOTCH_FOUND)+    ei_add_property(EIGEN_MISSING_BACKENDS  "PaStiX, ")+  endif(SCOTCH_FOUND)+  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(NOT EIGEN_TEST_NOQT)++if(TEST_LIB)+  add_definitions("-DEIGEN_EXTERN_INSTANTIATIONS=1")+endif(TEST_LIB)++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(nullary)+ei_add_test(mixingtypes)+ei_add_test(packetmath "-DEIGEN_FAST_MATH=1")+ei_add_test(unalignedassert)+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)+  ei_add_test(exceptions)+endif()+ei_add_test(redux)+ei_add_test(visitor)+ei_add_test(block)+ei_add_test(corners)+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)+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(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(array_of_string)++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(QT4_FOUND)++if(UMFPACK_FOUND)+  ei_add_test(umfpack_support "" "${UMFPACK_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")+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)+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)+  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)+   set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 --cuda-gpu-arch=sm_30")+  endif()+  cuda_include_directories(${CMAKE_CURRENT_BINARY_DIR})+  set(EIGEN_ADD_TEST_FILENAME_EXTENSION  "cu")+  +  ei_add_test(cuda_basic)+  +  unset(EIGEN_ADD_TEST_FILENAME_EXTENSION)++endif(CUDA_FOUND)++endif(EIGEN_TEST_CUDA)+++file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/failtests)    +add_test(NAME failtests WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/failtests COMMAND ${CMAKE_COMMAND} ${Eigen_SOURCE_DIR} -G "${CMAKE_GENERATOR}" -DEIGEN_FAILTEST=ON)++option(EIGEN_TEST_BUILD_DOCUMENTATION "Test building the doxygen documentation" OFF)+IF(EIGEN_TEST_BUILD_DOCUMENTATION)+  add_dependencies(buildtests doc)+ENDIF()
+ eigen3/test/adjoint.cpp view
@@ -0,0 +1,199 @@+// This file is part of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2006-2008 Benoit Jacob <jacob.benoit.1@gmail.com>+//+// 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<bool IsInteger> struct adjoint_specific;++template<> struct adjoint_specific<true> {+  template<typename Vec, typename Mat, typename Scalar>+  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<false> {+  template<typename Vec, typename Mat, typename Scalar>+  static void run(const Vec& v1, const Vec& v2, Vec& v3, const Mat& square, Scalar s1, Scalar s2) {+    typedef typename NumTraits<Scalar>::Real RealScalar;+    using std::abs;+    +    RealScalar ref = NumTraits<Scalar>::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<RealScalar>::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<Scalar>::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<Scalar>()));+    +    // 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<typename MatrixType> 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<Scalar>::Real RealScalar;+  typedef Matrix<Scalar, MatrixType::RowsAtCompileTime, 1> VectorType;+  typedef Matrix<Scalar, MatrixType::RowsAtCompileTime, MatrixType::RowsAtCompileTime> SquareMatrixType;+  const Index PacketSize = internal::packet_traits<Scalar>::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<Scalar>(),+         s2 = internal::random<Scalar>();++  // 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<NumTraits<Scalar>::IsInteger>::run(v1, v2, v3, square, s1, s2);+  +  VERIFY_IS_MUCH_SMALLER_THAN(abs(vzero.dot(v1)),  static_cast<RealScalar>(1));+  +  // like in testBasicStuff, test operator() to check const-qualification+  Index r = internal::random<Index>(0, rows-1),+      c = internal::random<Index>(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<m3.rows() && PacketSize<m3.cols())+  {+    m3 = m1;+    Index i = internal::random<Index>(0,m3.rows()-PacketSize);+    Index j = internal::random<Index>(0,m3.cols()-PacketSize);+    m3.template block<PacketSize,PacketSize>(i,j).transposeInPlace();+    VERIFY_IS_APPROX( (m3.template block<PacketSize,PacketSize>(i,j)), (m1.template block<PacketSize,PacketSize>(i,j).transpose()) );+    m3.template block<PacketSize,PacketSize>(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<RealScalar, MatrixType::RowsAtCompileTime, 1> RealVectorType;+  RealVectorType rv1 = RealVectorType::Random(rows);+  VERIFY_IS_APPROX(v1.dot(rv1.template cast<Scalar>()), v1.dot(rv1));+  VERIFY_IS_APPROX(rv1.template cast<Scalar>().dot(v1), rv1.dot(v1));+}++void test_adjoint()+{+  for(int i = 0; i < g_repeat; i++) {+    CALL_SUBTEST_1( adjoint(Matrix<float, 1, 1>()) );+    CALL_SUBTEST_2( adjoint(Matrix3d()) );+    CALL_SUBTEST_3( adjoint(Matrix4f()) );+    +    CALL_SUBTEST_4( adjoint(MatrixXcf(internal::random<int>(1,EIGEN_TEST_MAX_SIZE/2), internal::random<int>(1,EIGEN_TEST_MAX_SIZE/2))) );+    CALL_SUBTEST_5( adjoint(MatrixXi(internal::random<int>(1,EIGEN_TEST_MAX_SIZE), internal::random<int>(1,EIGEN_TEST_MAX_SIZE))) );+    CALL_SUBTEST_6( adjoint(MatrixXf(internal::random<int>(1,EIGEN_TEST_MAX_SIZE), internal::random<int>(1,EIGEN_TEST_MAX_SIZE))) );+    +    // Complement for 128 bits vectorization:+    CALL_SUBTEST_8( adjoint(Matrix2d()) );+    CALL_SUBTEST_9( adjoint(Matrix<int,4,4>()) );+    +    // 256 bits vectorization:+    CALL_SUBTEST_10( adjoint(Matrix<float,8,8>()) );+    CALL_SUBTEST_11( adjoint(Matrix<double,4,4>()) );+    CALL_SUBTEST_12( adjoint(Matrix<int,8,8>()) );+  }+  // test a large static matrix only once+  CALL_SUBTEST_7( adjoint(Matrix<float, 100, 100>()) );++#ifdef EIGEN_TEST_PART_13+  {+    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);+  }+#endif+}+
+ eigen3/test/array.cpp view
@@ -0,0 +1,490 @@+// This file is part of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2008-2009 Gael Guennebaud <gael.guennebaud@inria.fr>+//+// 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<typename ArrayType> void array(const ArrayType& m)+{+  typedef typename ArrayType::Scalar Scalar;+  typedef typename ArrayType::RealScalar RealScalar;+  typedef Array<Scalar, ArrayType::RowsAtCompileTime, 1> ColVectorType;+  typedef Array<Scalar, 1, ArrayType::ColsAtCompileTime> 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<Scalar>(),+          s2 = internal::random<Scalar>();++  // 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<Scalar>()))+      VERIFY_IS_NOT_APPROX(((m1+m2).rowwise().sum()).sum(), m1.sum());+  VERIFY_IS_APPROX(m1.colwise().sum(), m1.colwise().redux(internal::scalar_sum_op<Scalar,Scalar>()));++  // 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<Scalar,+                ArrayType::RowsAtCompileTime==Dynamic?2:ArrayType::RowsAtCompileTime,+                ArrayType::ColsAtCompileTime==Dynamic?2:ArrayType::ColsAtCompileTime,+                ArrayType::Options> 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);+  +  // 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<Scalar, Dynamic, 1> OneDArrayType;+  OneDArrayType o1(rows);+  VERIFY(o1.size()==rows);+  OneDArrayType o4((int)rows);+  VERIFY(o4.size()==rows);+}++template<typename ArrayType> void comparisons(const ArrayType& m)+{+  using std::abs;+  typedef typename ArrayType::Scalar Scalar;+  typedef typename NumTraits<Scalar>::Real RealScalar;++  Index rows = m.rows();+  Index cols = m.cols();++  Index r = internal::random<Index>(0, rows-1),+        c = internal::random<Index>(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( (m1<m2).select(m1,m2), m1.cwiseMin(m2) );+  VERIFY_IS_APPROX( (m1>m2).select(m1,m2), m1.cwiseMax(m2) );+  Scalar mid = (m1.cwiseAbs().minCoeff() + m1.cwiseAbs().maxCoeff())/Scalar(2);+  for (int j=0; j<cols; ++j)+  for (int i=0; i<rows; ++i)+    m3(i,j) = abs(m1(i,j))<mid ? 0 : m1(i,j);+  VERIFY_IS_APPROX( (m1.abs()<ArrayType::Constant(rows,cols,mid))+                        .select(ArrayType::Zero(rows,cols),m1), m3);+  // shorter versions:+  VERIFY_IS_APPROX( (m1.abs()<ArrayType::Constant(rows,cols,mid))+                        .select(0,m1), m3);+  VERIFY_IS_APPROX( (m1.abs()>=ArrayType::Constant(rows,cols,mid))+                        .select(m1,0), m3);+  // even shorter version:+  VERIFY_IS_APPROX( (m1.abs()<mid).select(0,m1), m3);++  // count+  VERIFY(((m1.abs()+1)>RealScalar(0.1)).count() == rows*cols);++  // and/or+  VERIFY( (m1<RealScalar(0) && m1>RealScalar(0)).count() == 0);+  VERIFY( (m1<RealScalar(0) || m1>=RealScalar(0)).count() == rows*cols);+  RealScalar a = m1.abs().mean();+  VERIFY( (m1<-a || m1>a).count() == (m1.abs()>a).count());++  typedef Array<typename ArrayType::Index, Dynamic, 1> 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<typename ArrayType> void array_real(const ArrayType& m)+{+  using std::abs;+  using std::sqrt;+  typedef typename ArrayType::Scalar Scalar;+  typedef typename NumTraits<Scalar>::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(1,m4);++  Scalar  s1 = internal::random<Scalar>();++  // 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));++  VERIFY_IS_APPROX(m1.arg(), arg(m1));+  VERIFY_IS_APPROX(m1.round(), round(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(m1.inverse(), inverse(m1));+  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));+++  // avoid NaNs with abs() so verification doesn't fail+  m3 = m1.abs();+  VERIFY_IS_APPROX(m3.sqrt(), sqrt(abs(m1)));+  VERIFY_IS_APPROX(m3.rsqrt(), Scalar(1)/sqrt(abs(m1)));+  VERIFY_IS_APPROX(rsqrt(m3), Scalar(1)/sqrt(abs(m1)));+  VERIFY_IS_APPROX(m3.log(), log(m3));+  VERIFY_IS_APPROX(m3.log1p(), log1p(m3));+  VERIFY_IS_APPROX(m3.log10(), log10(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), 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(arg(m1), ((m1<0).template cast<Scalar>())*std::acos(-1.0));+  VERIFY((round(m1) <= ceil(m1) && round(m1) >= floor(m1)).all());+  VERIFY((Eigen::isnan)((m1*0.0)/0.0).all());+  VERIFY((Eigen::isinf)(m4/0.0).all());+  VERIFY(((Eigen::isfinite)(m1) && (!(Eigen::isfinite)(m1*0.0/0.0)) && (!(Eigen::isfinite)(m4/0.0))).all());+  VERIFY_IS_APPROX(inverse(inverse(m1)),m1);+  VERIFY((abs(m1) == m1 || abs(m1) == -m1).all());+  VERIFY_IS_APPROX(m3, sqrt(abs2(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(real(m1)) + numext::abs2(imag(m1)), numext::abs2(m1));+  if(!NumTraits<Scalar>::IsComplex)+    VERIFY_IS_APPROX(numext::real(m1), m1);++  // shift argument of logarithm so that it is not zero+  Scalar smallNumber = NumTraits<Scalar>::dummy_precision();+  VERIFY_IS_APPROX((m3 + smallNumber).log() , log(abs(m1) + smallNumber));+  VERIFY_IS_APPROX((m3 + smallNumber + 1).log() , log1p(abs(m1) + 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(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());++  VERIFY_IS_APPROX(log10(m3), log(m3)/log(10));++  // scalar by array division+  const RealScalar tiny = sqrt(std::numeric_limits<RealScalar>::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<typename ArrayType> void array_complex(const ArrayType& m)+{+  typedef typename ArrayType::Scalar Scalar;+  typedef typename NumTraits<Scalar>::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<RealScalar, -1, -1> 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.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(m1.inverse(), inverse(m1));+  VERIFY_IS_APPROX(m1.log(), log(m1));+  VERIFY_IS_APPROX(m1.log10(), log10(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(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))));++  for (Index i = 0; i < m.rows(); ++i)+    for (Index j = 0; j < m.cols(); ++j)+      m3(i,j) = std::atan2(imag(m1(i,j)), real(m1(i,j)));+  VERIFY_IS_APPROX(arg(m1), m3);++  std::complex<RealScalar> 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(m1)),m1);+  VERIFY_IS_APPROX(conj(m1.conjugate()), m1);+  VERIFY_IS_APPROX(abs(m1), sqrt(square(real(m1))+square(imag(m1))));+  VERIFY_IS_APPROX(abs(m1), sqrt(abs2(m1)));+  VERIFY_IS_APPROX(log10(m1), log(m1)/log(10));++  VERIFY_IS_APPROX( m1.sign(), -(-m1).sign() );+  VERIFY_IS_APPROX( m1.sign() * m1.abs(), m1);++  // scalar by array division+  Scalar  s1 = internal::random<Scalar>();+  const RealScalar tiny = std::sqrt(std::numeric_limits<RealScalar>::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);++}++template<typename ArrayType> 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));++}++void test_array()+{+  for(int i = 0; i < g_repeat; i++) {+    CALL_SUBTEST_1( array(Array<float, 1, 1>()) );+    CALL_SUBTEST_2( array(Array22f()) );+    CALL_SUBTEST_3( array(Array44d()) );+    CALL_SUBTEST_4( array(ArrayXXcf(internal::random<int>(1,EIGEN_TEST_MAX_SIZE), internal::random<int>(1,EIGEN_TEST_MAX_SIZE))) );+    CALL_SUBTEST_5( array(ArrayXXf(internal::random<int>(1,EIGEN_TEST_MAX_SIZE), internal::random<int>(1,EIGEN_TEST_MAX_SIZE))) );+    CALL_SUBTEST_6( array(ArrayXXi(internal::random<int>(1,EIGEN_TEST_MAX_SIZE), internal::random<int>(1,EIGEN_TEST_MAX_SIZE))) );+  }+  for(int i = 0; i < g_repeat; i++) {+    CALL_SUBTEST_1( comparisons(Array<float, 1, 1>()) );+    CALL_SUBTEST_2( comparisons(Array22f()) );+    CALL_SUBTEST_3( comparisons(Array44d()) );+    CALL_SUBTEST_5( comparisons(ArrayXXf(internal::random<int>(1,EIGEN_TEST_MAX_SIZE), internal::random<int>(1,EIGEN_TEST_MAX_SIZE))) );+    CALL_SUBTEST_6( comparisons(ArrayXXi(internal::random<int>(1,EIGEN_TEST_MAX_SIZE), internal::random<int>(1,EIGEN_TEST_MAX_SIZE))) );+  }+  for(int i = 0; i < g_repeat; i++) {+    CALL_SUBTEST_1( min_max(Array<float, 1, 1>()) );+    CALL_SUBTEST_2( min_max(Array22f()) );+    CALL_SUBTEST_3( min_max(Array44d()) );+    CALL_SUBTEST_5( min_max(ArrayXXf(internal::random<int>(1,EIGEN_TEST_MAX_SIZE), internal::random<int>(1,EIGEN_TEST_MAX_SIZE))) );+    CALL_SUBTEST_6( min_max(ArrayXXi(internal::random<int>(1,EIGEN_TEST_MAX_SIZE), internal::random<int>(1,EIGEN_TEST_MAX_SIZE))) );+  }+  for(int i = 0; i < g_repeat; i++) {+    CALL_SUBTEST_1( array_real(Array<float, 1, 1>()) );+    CALL_SUBTEST_2( array_real(Array22f()) );+    CALL_SUBTEST_3( array_real(Array44d()) );+    CALL_SUBTEST_5( array_real(ArrayXXf(internal::random<int>(1,EIGEN_TEST_MAX_SIZE), internal::random<int>(1,EIGEN_TEST_MAX_SIZE))) );+  }+  for(int i = 0; i < g_repeat; i++) {+    CALL_SUBTEST_4( array_complex(ArrayXXcf(internal::random<int>(1,EIGEN_TEST_MAX_SIZE), internal::random<int>(1,EIGEN_TEST_MAX_SIZE))) );+  }++  VERIFY((internal::is_same< internal::global_math_functions_filtering_base<int>::type, int >::value));+  VERIFY((internal::is_same< internal::global_math_functions_filtering_base<float>::type, float >::value));+  VERIFY((internal::is_same< internal::global_math_functions_filtering_base<Array2i>::type, ArrayBase<Array2i> >::value));+  typedef CwiseUnaryOp<internal::scalar_abs_op<double>, ArrayXd > Xpr;+  VERIFY((internal::is_same< internal::global_math_functions_filtering_base<Xpr>::type,+                           ArrayBase<Xpr>+                         >::value));+}
+ eigen3/test/array_for_matrix.cpp view
@@ -0,0 +1,300 @@+// This file is part of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2008-2009 Gael Guennebaud <gael.guennebaud@inria.fr>+//+// 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<typename MatrixType> void array_for_matrix(const MatrixType& m)+{+  typedef typename MatrixType::Scalar Scalar;+  typedef Matrix<Scalar, MatrixType::RowsAtCompileTime, 1> ColVectorType;+  typedef Matrix<Scalar, 1, MatrixType::ColsAtCompileTime> 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<Scalar>(),+          s2 = internal::random<Scalar>();+          +  // 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<Scalar,Scalar>()));++  // 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.block(0,0,0,cols).colwise().sum(),  RowVectorType::Zero(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<typename MatrixType> void comparisons(const MatrixType& m)+{+  using std::abs;+  typedef typename MatrixType::Scalar Scalar;+  typedef typename NumTraits<Scalar>::Real RealScalar;++  Index rows = m.rows();+  Index cols = m.cols();++  Index r = internal::random<Index>(0, rows-1),+        c = internal::random<Index>(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.cwiseMin(m2) );+  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<cols; ++j)+  for (int i=0; i<rows; ++i)+    m3(i,j) = abs(m1(i,j))<mid ? 0 : m1(i,j);+  VERIFY_IS_APPROX( (m1.array().abs()<MatrixType::Constant(rows,cols,mid).array())+                        .select(MatrixType::Zero(rows,cols),m1), m3);+  // shorter versions:+  VERIFY_IS_APPROX( (m1.array().abs()<MatrixType::Constant(rows,cols,mid).array())+                        .select(0,m1), m3);+  VERIFY_IS_APPROX( (m1.array().abs()>=MatrixType::Constant(rows,cols,mid).array())+                        .select(m1,0), m3);+  // even shorter version:+  VERIFY_IS_APPROX( (m1.array().abs()<mid).select(0,m1), m3);++  // count+  VERIFY(((m1.array().abs()+1)>RealScalar(0.1)).count() == rows*cols);++  // and/or+  VERIFY( ((m1.array()<RealScalar(0)).matrix() && (m1.array()>RealScalar(0)).matrix()).count() == 0);+  VERIFY( ((m1.array()<RealScalar(0)).matrix() || (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<typename MatrixType::Index, Dynamic, 1> 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<typename VectorType> 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<Infinity>(), 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<Infinity>(), 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<typename MatrixType> 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<typename MatrixTraits> void resize(const MatrixTraits& t)+{+  typedef typename MatrixTraits::Scalar Scalar;+  typedef Matrix<Scalar,Dynamic,Dynamic> MatrixType;+  typedef Array<Scalar,Dynamic,Dynamic> Array2DType;+  typedef Matrix<Scalar,Dynamic,1> VectorType;+  typedef Array<Scalar,Dynamic,1> 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<int>+void regression_bug_654()+{+  ArrayXf a = RowVectorXf(3);+  VectorXf v = Array<float,1,Dynamic>(3);+}++// Check propagation of LvalueBit through Array/Matrix-Wrapper+template<int>+void regrrssion_bug_1410()+{+  const Matrix4i M;+  const Array4i A;+  ArrayWrapper<const Matrix4i> MA = M.array();+  MA.row(0);+  MatrixWrapper<const Array4i> AM = A.matrix();+  AM.row(0);++  VERIFY((internal::traits<ArrayWrapper<const Matrix4i> >::Flags&LvalueBit)==0);+  VERIFY((internal::traits<MatrixWrapper<const Array4i> >::Flags&LvalueBit)==0);++  VERIFY((internal::traits<ArrayWrapper<Matrix4i> >::Flags&LvalueBit)==LvalueBit);+  VERIFY((internal::traits<MatrixWrapper<Array4i> >::Flags&LvalueBit)==LvalueBit);+}++void test_array_for_matrix()+{+  for(int i = 0; i < g_repeat; i++) {+    CALL_SUBTEST_1( array_for_matrix(Matrix<float, 1, 1>()) );+    CALL_SUBTEST_2( array_for_matrix(Matrix2f()) );+    CALL_SUBTEST_3( array_for_matrix(Matrix4d()) );+    CALL_SUBTEST_4( array_for_matrix(MatrixXcf(internal::random<int>(1,EIGEN_TEST_MAX_SIZE), internal::random<int>(1,EIGEN_TEST_MAX_SIZE))) );+    CALL_SUBTEST_5( array_for_matrix(MatrixXf(internal::random<int>(1,EIGEN_TEST_MAX_SIZE), internal::random<int>(1,EIGEN_TEST_MAX_SIZE))) );+    CALL_SUBTEST_6( array_for_matrix(MatrixXi(internal::random<int>(1,EIGEN_TEST_MAX_SIZE), internal::random<int>(1,EIGEN_TEST_MAX_SIZE))) );+  }+  for(int i = 0; i < g_repeat; i++) {+    CALL_SUBTEST_1( comparisons(Matrix<float, 1, 1>()) );+    CALL_SUBTEST_2( comparisons(Matrix2f()) );+    CALL_SUBTEST_3( comparisons(Matrix4d()) );+    CALL_SUBTEST_5( comparisons(MatrixXf(internal::random<int>(1,EIGEN_TEST_MAX_SIZE), internal::random<int>(1,EIGEN_TEST_MAX_SIZE))) );+    CALL_SUBTEST_6( comparisons(MatrixXi(internal::random<int>(1,EIGEN_TEST_MAX_SIZE), internal::random<int>(1,EIGEN_TEST_MAX_SIZE))) );+  }+  for(int i = 0; i < g_repeat; i++) {+    CALL_SUBTEST_1( cwise_min_max(Matrix<float, 1, 1>()) );+    CALL_SUBTEST_2( cwise_min_max(Matrix2f()) );+    CALL_SUBTEST_3( cwise_min_max(Matrix4d()) );+    CALL_SUBTEST_5( cwise_min_max(MatrixXf(internal::random<int>(1,EIGEN_TEST_MAX_SIZE), internal::random<int>(1,EIGEN_TEST_MAX_SIZE))) );+    CALL_SUBTEST_6( cwise_min_max(MatrixXi(internal::random<int>(1,EIGEN_TEST_MAX_SIZE), internal::random<int>(1,EIGEN_TEST_MAX_SIZE))) );+  }+  for(int i = 0; i < g_repeat; i++) {+    CALL_SUBTEST_1( lpNorm(Matrix<float, 1, 1>()) );+    CALL_SUBTEST_2( lpNorm(Vector2f()) );+    CALL_SUBTEST_7( lpNorm(Vector3d()) );+    CALL_SUBTEST_8( lpNorm(Vector4f()) );+    CALL_SUBTEST_5( lpNorm(VectorXf(internal::random<int>(1,EIGEN_TEST_MAX_SIZE))) );+    CALL_SUBTEST_4( lpNorm(VectorXcf(internal::random<int>(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<int>(1,EIGEN_TEST_MAX_SIZE), internal::random<int>(1,EIGEN_TEST_MAX_SIZE))) );+    CALL_SUBTEST_5( resize(MatrixXf(internal::random<int>(1,EIGEN_TEST_MAX_SIZE), internal::random<int>(1,EIGEN_TEST_MAX_SIZE))) );+    CALL_SUBTEST_6( resize(MatrixXi(internal::random<int>(1,EIGEN_TEST_MAX_SIZE), internal::random<int>(1,EIGEN_TEST_MAX_SIZE))) );+  }+  CALL_SUBTEST_6( regression_bug_654<0>() );+  CALL_SUBTEST_6( regrrssion_bug_1410<0>() );+}
+ eigen3/test/array_of_string.cpp view
@@ -0,0 +1,32 @@+// This file is part of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2016 Gael Guennebaud <gael.guennebaud@inria.fr>+//+// 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 test_array_of_string()+{+  typedef Array<std::string,1,Dynamic> 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());+}
+ eigen3/test/array_replicate.cpp view
@@ -0,0 +1,81 @@+// This file is part of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2009 Gael Guennebaud <gael.guennebaud@inria.fr>+//+// 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<typename MatrixType> void replicate(const MatrixType& m)+{+  /* this test covers the following files:+     Replicate.cpp+  */+  typedef typename MatrixType::Scalar Scalar;+  typedef Matrix<Scalar, MatrixType::RowsAtCompileTime, 1> VectorType;+  typedef Matrix<Scalar, Dynamic, Dynamic> MatrixX;+  typedef Matrix<Scalar, Dynamic, 1> 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<int>(1,10),+       f2 = internal::random<int>(1,10);++  x1.resize(rows*f1,cols*f2);+  for(int j=0; j<f2; j++)+  for(int i=0; i<f1; i++)+    x1.block(i*rows,j*cols,rows,cols) = m1;+  VERIFY_IS_APPROX(x1, m1.replicate(f1,f2));++  x2.resize(2*rows,3*cols);+  x2 << m2, m2, m2,+        m2, m2, m2;+  VERIFY_IS_APPROX(x2, (m2.template replicate<2,3>()));+  +  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<f1; ++j)+    x2.col(j) = v1;+  VERIFY_IS_APPROX(x2, v1.rowwise().replicate(f1));++  vx1.resize(rows*f2);+  for (int j=0; j<f2; ++j)+    vx1.segment(j*rows,rows) = v1;+  VERIFY_IS_APPROX(vx1, v1.colwise().replicate(f2));+}++void test_array_replicate()+{+  for(int i = 0; i < g_repeat; i++) {+    CALL_SUBTEST_1( replicate(Matrix<float, 1, 1>()) );+    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)) );+  }+}
+ eigen3/test/array_reverse.cpp view
@@ -0,0 +1,145 @@+// This file is part of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2006-2008 Benoit Jacob <jacob.benoit.1@gmail.com>+// Copyright (C) 2009 Ricard Marxer <email@ricardmarxer.com>+//+// 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 <iostream>++using namespace std;++template<typename MatrixType> void reverse(const MatrixType& m)+{+  typedef typename MatrixType::Scalar Scalar;+  typedef Matrix<Scalar, MatrixType::RowsAtCompileTime, 1> 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<MatrixType> 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<MatrixType, BothDirections> 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<MatrixType, Vertical> 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<MatrixType, Horizontal> 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<Scalar>();++  Index r = internal::random<Index>(0, rows-1),+        c = internal::random<Index>(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));+}++void test_array_reverse()+{+  for(int i = 0; i < g_repeat; i++) {+    CALL_SUBTEST_1( reverse(Matrix<float, 1, 1>()) );+    CALL_SUBTEST_2( reverse(Matrix2f()) );+    CALL_SUBTEST_3( reverse(Matrix4f()) );+    CALL_SUBTEST_4( reverse(Matrix4d()) );+    CALL_SUBTEST_5( reverse(MatrixXcf(internal::random<int>(1,EIGEN_TEST_MAX_SIZE), internal::random<int>(1,EIGEN_TEST_MAX_SIZE))) );+    CALL_SUBTEST_6( reverse(MatrixXi(internal::random<int>(1,EIGEN_TEST_MAX_SIZE), internal::random<int>(1,EIGEN_TEST_MAX_SIZE))) );+    CALL_SUBTEST_7( reverse(MatrixXcd(internal::random<int>(1,EIGEN_TEST_MAX_SIZE), internal::random<int>(1,EIGEN_TEST_MAX_SIZE))) );+    CALL_SUBTEST_8( reverse(Matrix<float, 100, 100>()) );+    CALL_SUBTEST_9( reverse(Matrix<float,Dynamic,Dynamic,RowMajor>(internal::random<int>(1,EIGEN_TEST_MAX_SIZE), internal::random<int>(1,EIGEN_TEST_MAX_SIZE))) );+  }+#ifdef EIGEN_TEST_PART_3+  Vector4f x; x << 1, 2, 3, 4;+  Vector4f y; y << 4, 3, 2, 1;+  VERIFY(x.reverse()[1] == 3);+  VERIFY(x.reverse() == y);+#endif+}
+ eigen3/test/bandmatrix.cpp view
@@ -0,0 +1,71 @@+// This file is triangularView of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2008-2009 Gael Guennebaud <gael.guennebaud@inria.fr>+//+// 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<typename MatrixType> void bandmatrix(const MatrixType& _m)+{+  typedef typename MatrixType::Scalar Scalar;+  typedef typename NumTraits<Scalar>::Real RealScalar;+  typedef Matrix<Scalar,Dynamic,Dynamic> 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<RealScalar>(i));+    dm1.diagonal(i).setConstant(static_cast<RealScalar>(i));+  }+  for (int i=1; i<=m.subs();++i)+  {+    m.diagonal(-i).setConstant(-static_cast<RealScalar>(i));+    dm1.diagonal(-i).setConstant(-static_cast<RealScalar>(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<cols; ++i)+  {+    m.col(i).setConstant(static_cast<RealScalar>(i+1));+    dm1.col(i).setConstant(static_cast<RealScalar>(i+1));+  }+  Index d = (std::min)(rows,cols);+  Index a = std::max<Index>(0,cols-d-supers);+  Index b = std::max<Index>(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<Upper>().setZero();+  dm1.block(subs+1,0,rows-subs-1-b,rows-subs-1-b).template triangularView<Lower>().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;++void test_bandmatrix()+{+  for(int i = 0; i < 10*g_repeat ; i++) {+    Index rows = internal::random<Index>(1,10);+    Index cols = internal::random<Index>(1,10);+    Index sups = internal::random<Index>(0,cols-1);+    Index subs = internal::random<Index>(0,rows-1);+    CALL_SUBTEST(bandmatrix(BandMatrix<float>(rows,cols,sups,subs)) );+  }+}
+ eigen3/test/basicstuff.cpp view
@@ -0,0 +1,278 @@+// This file is part of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2006-2008 Benoit Jacob <jacob.benoit.1@gmail.com>+//+// 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<typename MatrixType> void basicStuff(const MatrixType& m)+{+  typedef typename MatrixType::Scalar Scalar;+  typedef Matrix<Scalar, MatrixType::RowsAtCompileTime, 1> VectorType;+  typedef Matrix<Scalar, MatrixType::RowsAtCompileTime, MatrixType::RowsAtCompileTime> SquareMatrixType;++  Index rows = m.rows();+  Index cols = m.cols();++  // 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<Scalar, MatrixType::RowsAtCompileTime, MatrixType::RowsAtCompileTime>::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<Scalar>();++  Index r = internal::random<Index>(0, rows-1),+        c = internal::random<Index>(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]);++  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<Scalar>(1));++  // now test copying a row-vector into a (column-)vector and conversely.+  square.col(r) = square.row(r).eval();+  Matrix<Scalar, 1, MatrixType::RowsAtCompileTime> rv(rows);+  Matrix<Scalar, MatrixType::RowsAtCompileTime, 1> 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<const MatrixType&>(m3).real(), static_cast<const MatrixType&>(m1).real());+  VERIFY_IS_APPROX(static_cast<const MatrixType&>(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(typename MatrixType::Index i=0;i<rows;++i)+    sm2.col(i) = sm1.row(i);+  VERIFY_IS_APPROX(sm2,sm1.transpose());+  +  sm2.setZero();+  for(typename MatrixType::Index i=0;i<rows;++i)+    sm2.col(i).noalias() = sm1.row(i);+  VERIFY_IS_APPROX(sm2,sm1.transpose());+  +  sm2.setZero();+  for(typename MatrixType::Index i=0;i<rows;++i)+    sm2.col(i).noalias() += sm1.row(i);+  VERIFY_IS_APPROX(sm2,sm1.transpose());+  +  sm2.setZero();+  for(typename MatrixType::Index i=0;i<rows;++i)+    sm2.col(i).noalias() -= sm1.row(i);+  VERIFY_IS_APPROX(sm2,-sm1.transpose());+  +  // check ternary usage+  {+    bool b = internal::random<int>(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<typename MatrixType> void basicStuffComplex(const MatrixType& m)+{+  typedef typename MatrixType::Scalar Scalar;+  typedef typename NumTraits<Scalar>::Real RealScalar;+  typedef Matrix<RealScalar, MatrixType::RowsAtCompileTime, MatrixType::ColsAtCompileTime> RealMatrixType;++  Index rows = m.rows();+  Index cols = m.cols();++  Scalar s1 = internal::random<Scalar>(),+         s2 = internal::random<Scalar>();++  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<RealScalar>::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<const MatrixType&>(cm).real(), rm1);+  VERIFY_IS_APPROX(static_cast<const MatrixType&>(cm).imag(), rm2);+  rm1.setZero();+  rm2.setZero();+  rm1 = cm.real();+  rm2 = cm.imag();+  VERIFY_IS_APPROX(static_cast<const MatrixType&>(cm).real(), rm1);+  VERIFY_IS_APPROX(static_cast<const MatrixType&>(cm).imag(), rm2);+  cm.real().setZero();+  VERIFY(static_cast<const MatrixType&>(cm).real().isZero());+  VERIFY(!static_cast<const MatrixType&>(cm).imag().isZero());+}++#ifdef EIGEN_TEST_PART_2+void casting()+{+  Matrix4f m = Matrix4f::Random(), m2;+  Matrix4d n = m.cast<double>();+  VERIFY(m.isApprox(n.cast<float>()));+  m2 = m.cast<float>(); // check the specialization when NewType == Type+  VERIFY(m.isApprox(m2));+}+#endif++template <typename Scalar>+void fixedSizeMatrixConstruction()+{+  Scalar raw[4];+  for(int k=0; k<4; ++k)+    raw[k] = internal::random<Scalar>();+  +  {+    Matrix<Scalar,4,1> m(raw);+    Array<Scalar,4,1> 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<Scalar,4,1>(raw[0],raw[1],raw[2],raw[3])));+    VERIFY((a==(Array<Scalar,4,1>(raw[0],raw[1],raw[2],raw[3]))).all());+  }+  {+    Matrix<Scalar,3,1> m(raw);+    Array<Scalar,3,1> 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<Scalar,3,1>(raw[0],raw[1],raw[2])));+    VERIFY((a==Array<Scalar,3,1>(raw[0],raw[1],raw[2])).all());+  }+  {+    Matrix<Scalar,2,1> m(raw), m2( (DenseIndex(raw[0])), (DenseIndex(raw[1])) );+    Array<Scalar,2,1> 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<Scalar,2,1>(raw[0],raw[1])));+    VERIFY((a==Array<Scalar,2,1>(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<Scalar,1,2> m(raw),+                       m2( (DenseIndex(raw[0])), (DenseIndex(raw[1])) ),+                       m3( (int(raw[0])), (int(raw[1])) ),+                       m4( (float(raw[0])), (float(raw[1])) );+    Array<Scalar,1,2> 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<Scalar,1,2>(raw[0],raw[1])));+    VERIFY((a==Array<Scalar,1,2>(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<Scalar,1,1> m(raw), m1(raw[0]), m2( (DenseIndex(raw[0])) ), m3( (int(raw[0])) );+    Array<Scalar,1,1> 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<Scalar,1,1>(raw[0])));+    VERIFY((a==Array<Scalar,1,1>(raw[0])).all());+  }+}++void test_basicstuff()+{+  for(int i = 0; i < g_repeat; i++) {+    CALL_SUBTEST_1( basicStuff(Matrix<float, 1, 1>()) );+    CALL_SUBTEST_2( basicStuff(Matrix4d()) );+    CALL_SUBTEST_3( basicStuff(MatrixXcf(internal::random<int>(1,EIGEN_TEST_MAX_SIZE), internal::random<int>(1,EIGEN_TEST_MAX_SIZE))) );+    CALL_SUBTEST_4( basicStuff(MatrixXi(internal::random<int>(1,EIGEN_TEST_MAX_SIZE), internal::random<int>(1,EIGEN_TEST_MAX_SIZE))) );+    CALL_SUBTEST_5( basicStuff(MatrixXcd(internal::random<int>(1,EIGEN_TEST_MAX_SIZE), internal::random<int>(1,EIGEN_TEST_MAX_SIZE))) );+    CALL_SUBTEST_6( basicStuff(Matrix<float, 100, 100>()) );+    CALL_SUBTEST_7( basicStuff(Matrix<long double,Dynamic,Dynamic>(internal::random<int>(1,EIGEN_TEST_MAX_SIZE),internal::random<int>(1,EIGEN_TEST_MAX_SIZE))) );++    CALL_SUBTEST_3( basicStuffComplex(MatrixXcf(internal::random<int>(1,EIGEN_TEST_MAX_SIZE), internal::random<int>(1,EIGEN_TEST_MAX_SIZE))) );+    CALL_SUBTEST_5( basicStuffComplex(MatrixXcd(internal::random<int>(1,EIGEN_TEST_MAX_SIZE), internal::random<int>(1,EIGEN_TEST_MAX_SIZE))) );+  }++  CALL_SUBTEST_1(fixedSizeMatrixConstruction<unsigned char>());+  CALL_SUBTEST_1(fixedSizeMatrixConstruction<float>());+  CALL_SUBTEST_1(fixedSizeMatrixConstruction<double>());+  CALL_SUBTEST_1(fixedSizeMatrixConstruction<int>());+  CALL_SUBTEST_1(fixedSizeMatrixConstruction<long int>());+  CALL_SUBTEST_1(fixedSizeMatrixConstruction<std::ptrdiff_t>());++  CALL_SUBTEST_2(casting());+}
+ eigen3/test/bdcsvd.cpp view
@@ -0,0 +1,112 @@+// This file is part of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2013 Gauthier Brun <brun.gauthier@gmail.com>+// Copyright (C) 2013 Nicolas Carre <nicolas.carre@ensimag.fr>+// Copyright (C) 2013 Jean Ceccato <jean.ceccato@ensimag.fr>+// Copyright (C) 2013 Pierre Zoppitelli <pierre.zoppitelli@ensimag.fr>+//+// 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 <Eigen/SVD>+#include <iostream>+#include <Eigen/LU>+++#define SVD_DEFAULT(M) BDCSVD<M>+#define SVD_FOR_MIN_NORM(M) BDCSVD<M>+#include "svd_common.h"++// Check all variants of JacobiSVD+template<typename MatrixType>+void bdcsvd(const MatrixType& a = MatrixType(), bool pickrandom = true)+{+  MatrixType m = a;+  if(pickrandom)+    svd_fill_random(m);++  CALL_SUBTEST(( svd_test_all_computation_options<BDCSVD<MatrixType> >(m, false)  ));+}++template<typename MatrixType>+void bdcsvd_method()+{+  enum { Size = MatrixType::RowsAtCompileTime };+  typedef typename MatrixType::RealScalar RealScalar;+  typedef Matrix<RealScalar, Size, 1> 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);+}++// compare the Singular values returned with Jacobi and Bdc+template<typename MatrixType> +void compare_bdc_jacobi(const MatrixType& a = MatrixType(), unsigned int computationOptions = 0)+{+  MatrixType m = MatrixType::Random(a.rows(), a.cols());+  BDCSVD<MatrixType> bdc_svd(m);+  JacobiSVD<MatrixType> 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());+}++void test_bdcsvd()+{+  CALL_SUBTEST_3(( svd_verify_assert<BDCSVD<Matrix3f>  >(Matrix3f()) ));+  CALL_SUBTEST_4(( svd_verify_assert<BDCSVD<Matrix4d>  >(Matrix4d()) ));+  CALL_SUBTEST_7(( svd_verify_assert<BDCSVD<MatrixXf>  >(MatrixXf(10,12)) ));+  CALL_SUBTEST_8(( svd_verify_assert<BDCSVD<MatrixXcd> >(MatrixXcd(7,5)) ));+  +  CALL_SUBTEST_101(( svd_all_trivial_2x2(bdcsvd<Matrix2cd>) ));+  CALL_SUBTEST_102(( svd_all_trivial_2x2(bdcsvd<Matrix2d>) ));++  for(int i = 0; i < g_repeat; i++) {+    CALL_SUBTEST_3(( bdcsvd<Matrix3f>() ));+    CALL_SUBTEST_4(( bdcsvd<Matrix4d>() ));+    CALL_SUBTEST_5(( bdcsvd<Matrix<float,3,5> >() ));++    int r = internal::random<int>(1, EIGEN_TEST_MAX_SIZE/2),+        c = internal::random<int>(1, EIGEN_TEST_MAX_SIZE/2);+    +    TEST_SET_BUT_UNUSED_VARIABLE(r)+    TEST_SET_BUT_UNUSED_VARIABLE(c)+    +    CALL_SUBTEST_6((  bdcsvd(Matrix<double,Dynamic,2>(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<BDCSVD<MatrixXf>, MatrixXf>()) );+    CALL_SUBTEST_10( (svd_inf_nan<BDCSVD<MatrixXd>, MatrixXd>()) );+  }++  // test matrixbase method+  CALL_SUBTEST_1(( bdcsvd_method<Matrix2cd>() ));+  CALL_SUBTEST_3(( bdcsvd_method<Matrix3f>() ));++  // Test problem size constructors+  CALL_SUBTEST_7( BDCSVD<MatrixXf>(10,10) );++  // Check that preallocation avoids subsequent mallocs+  // Disbaled because not supported by BDCSVD+  // CALL_SUBTEST_9( svd_preallocate<void>() );++  CALL_SUBTEST_2( svd_underoverflow<void>() );+}+
+ eigen3/test/bicgstab.cpp view
@@ -0,0 +1,34 @@+// This file is part of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2011 Gael Guennebaud <g.gael@free.fr>+//+// 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 <Eigen/IterativeLinearSolvers>++template<typename T, typename I> void test_bicgstab_T()+{+  BiCGSTAB<SparseMatrix<T,0,I>, DiagonalPreconditioner<T> >     bicgstab_colmajor_diag;+  BiCGSTAB<SparseMatrix<T,0,I>, IdentityPreconditioner    >     bicgstab_colmajor_I;+  BiCGSTAB<SparseMatrix<T,0,I>, IncompleteLUT<T,I> >              bicgstab_colmajor_ilut;+  //BiCGSTAB<SparseMatrix<T>, SSORPreconditioner<T> >     bicgstab_colmajor_ssor;++  bicgstab_colmajor_diag.setTolerance(NumTraits<T>::epsilon()*4);+  bicgstab_colmajor_ilut.setTolerance(NumTraits<T>::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)     );+}++void test_bicgstab()+{+  CALL_SUBTEST_1((test_bicgstab_T<double,int>()) );+  CALL_SUBTEST_2((test_bicgstab_T<std::complex<double>, int>()));+  CALL_SUBTEST_3((test_bicgstab_T<double,long int>()));+}
+ eigen3/test/block.cpp view
@@ -0,0 +1,276 @@+// This file is part of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2006-2010 Benoit Jacob <jacob.benoit.1@gmail.com>+//+// 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 MatrixType, typename Index, typename Scalar>+typename Eigen::internal::enable_if<!NumTraits<typename MatrixType::Scalar>::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 MatrixType, typename Index, typename Scalar>+typename Eigen::internal::enable_if<NumTraits<typename MatrixType::Scalar>::IsComplex,typename MatrixType::Scalar>::type+block_real_only(const MatrixType &, Index, Index, Index, Index, const Scalar&) {+  return Scalar(0);+}+++template<typename MatrixType> void block(const MatrixType& m)+{+  typedef typename MatrixType::Scalar Scalar;+  typedef typename MatrixType::RealScalar RealScalar;+  typedef Matrix<Scalar, MatrixType::RowsAtCompileTime, 1> VectorType;+  typedef Matrix<Scalar, 1, MatrixType::ColsAtCompileTime> RowVectorType;+  typedef Matrix<Scalar, Dynamic, Dynamic, MatrixType::IsRowMajor?RowMajor:ColMajor> DynamicMatrixType;+  typedef Matrix<Scalar, Dynamic, 1> 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<Scalar>();++  Index r1 = internal::random<Index>(0,rows-1);+  Index r2 = internal::random<Index>(r1,rows-1);+  Index c1 = internal::random<Index>(0,cols-1);+  Index c2 = internal::random<Index>(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<Scalar,Dynamic,Dynamic> 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);++  enum {+    BlockRows = 2,+    BlockCols = 5+  };+  if (rows>=5 && cols>=8)+  {+    // test fixed block() as lvalue+    m1.template block<BlockRows,BlockCols>(1,1) *= s1;+    // test operator() on fixed block() both as constant and non-constant+    m1.template block<BlockRows,BlockCols>(1,1)(0, 3) = m1.template block<2,5>(1,1)(1,2);+    // check that fixed block() and block() agree+    Matrix<Scalar,Dynamic,Dynamic> b = m1.template block<BlockRows,BlockCols>(3,3);+    VERIFY_IS_EQUAL(b, m1.block(3,3,BlockRows,BlockCols));++    // same tests with mixed fixed/dynamic size+    m1.template block<BlockRows,Dynamic>(1,1,BlockRows,BlockCols) *= s1;+    m1.template block<BlockRows,Dynamic>(1,1,BlockRows,BlockCols)(0,3) = m1.template block<2,5>(1,1)(1,2);+    Matrix<Scalar,Dynamic,Dynamic> b2 = m1.template block<Dynamic,BlockCols>(3,3,2,5);+    VERIFY_IS_EQUAL(b2, m1.block(3,3,BlockRows,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<Index>(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).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*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<Dynamic,1>(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<Dynamic,1>(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() );+  }+}+++template<typename MatrixType>+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<cols;++j)+    for(int i=0;i<rows;++i)+      VERIFY(m.coeff(i,j) == data[i*rowStride + j*colStride]);++  if(!MatrixType::IsVectorAtCompileTime)+  {+    for(int j=0;j<cols;++j)+      for(int i=0;i<rows;++i)+        VERIFY(m.coeff(i,j) == data[(MatrixType::Flags&RowMajorBit)+                                     ? i*outerStride + j*innerStride+                                     : j*outerStride + i*innerStride]);+  }++  if(MatrixType::IsVectorAtCompileTime)+  {+    VERIFY(innerStride == int((&m.coeff(1))-(&m.coeff(0))));+    for (int i=0;i<size;++i)+      VERIFY(m.coeff(i) == data[i*innerStride]);+  }+}++template<typename MatrixType>+void data_and_stride(const MatrixType& m)+{+  Index rows = m.rows();+  Index cols = m.cols();++  Index r1 = internal::random<Index>(0,rows-1);+  Index r2 = internal::random<Index>(r1,rows-1);+  Index c1 = internal::random<Index>(0,cols-1);+  Index c2 = internal::random<Index>(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());+}++void test_block()+{+  for(int i = 0; i < g_repeat; i++) {+    CALL_SUBTEST_1( block(Matrix<float, 1, 1>()) );+    CALL_SUBTEST_2( block(Matrix4d()) );+    CALL_SUBTEST_3( block(MatrixXcf(3, 3)) );+    CALL_SUBTEST_4( block(MatrixXi(8, 12)) );+    CALL_SUBTEST_5( block(MatrixXcd(20, 20)) );+    CALL_SUBTEST_6( block(MatrixXf(20, 20)) );++    CALL_SUBTEST_8( block(Matrix<float,Dynamic,4>(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<int,Dynamic,Dynamic,RowMajor>(internal::random(5,50), internal::random(5,50))) );+#endif+  }+}
+ eigen3/test/boostmultiprec.cpp view
@@ -0,0 +1,201 @@+// This file is part of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2016 Gael Guennebaud <gael.guennebaud@inria.fr>+//+// 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 <sstream>++#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++#include <Eigen/Dense>++#undef min+#undef max+#undef isnan+#undef isinf+#undef isfinite++#include <boost/multiprecision/cpp_dec_float.hpp>+#include <boost/multiprecision/number.hpp>+#include <boost/math/special_functions.hpp>+#include <boost/math/complex.hpp>++namespace mp = boost::multiprecision;+typedef mp::number<mp::cpp_dec_float<100>, mp::et_on> Real;++namespace Eigen {+  template<> struct NumTraits<Real> : GenericNumTraits<Real> {+    static inline Real dummy_precision() { return 1e-50; }+  };++  template<typename T1,typename T2,typename T3,typename T4,typename T5>+  struct NumTraits<boost::multiprecision::detail::expression<T1,T2,T3,T4,T5> > : NumTraits<Real> {};++  template<>+  Real test_precision<Real>() { return 1e-50; }++  // needed in C++93 mode where number does not support explicit cast.+  namespace internal {+    template<typename NewType>+    struct cast_impl<Real,NewType> {+      static inline NewType run(const Real& x) {+        return x.template convert_to<NewType>();+      }+    };++    template<>+    struct cast_impl<Real,std::complex<Real> > {+      static inline std::complex<Real>  run(const Real& x) {+        return std::complex<Real>(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>:+  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<Real>());+  }++  inline bool test_isApprox(const Real& a, const Real& b) {+    return internal::isApprox(a, b, test_precision<Real>());+  }++  inline bool test_isApproxOrLessThan(const Real& a, const Real& b) {+    return internal::isApproxOrLessThan(a, b, test_precision<Real>());+  }++  Real get_test_precision(const Real&) {+    return test_precision<Real>();+  }++  Real test_relative_error(const Real &a, const Real &b) {+    using Eigen::numext::abs2;+    return sqrt(abs2<Real>(a-b)/Eigen::numext::mini<Real>(abs2(a),abs2(b)));+  }+}+}++namespace Eigen {++}++void test_boostmultiprec()+{+  typedef Matrix<Real,Dynamic,Dynamic> Mat;+  typedef Matrix<std::complex<Real>,Dynamic,Dynamic> MatC;++  std::cout << "NumTraits<Real>::epsilon()         = " << NumTraits<Real>::epsilon() << std::endl;+  std::cout << "NumTraits<Real>::dummy_precision() = " << NumTraits<Real>::dummy_precision() << std::endl;+  std::cout << "NumTraits<Real>::lowest()          = " << NumTraits<Real>::lowest() << std::endl;+  std::cout << "NumTraits<Real>::highest()         = " << NumTraits<Real>::highest() << std::endl;+  std::cout << "NumTraits<Real>::digits10()        = " << NumTraits<Real>::digits10() << std::endl;++  // chekc 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<int>(1,EIGEN_TEST_MAX_SIZE);++    CALL_SUBTEST_1( cholesky(Mat(s,s)) );++    CALL_SUBTEST_2( lu_non_invertible<Mat>() );+    CALL_SUBTEST_2( lu_invertible<Mat>() );+    CALL_SUBTEST_2( lu_non_invertible<MatC>() );+    CALL_SUBTEST_2( lu_invertible<MatC>() );++    CALL_SUBTEST_3( qr(Mat(internal::random<int>(1,EIGEN_TEST_MAX_SIZE),internal::random<int>(1,EIGEN_TEST_MAX_SIZE))) );+    CALL_SUBTEST_3( qr_invertible<Mat>() );++    CALL_SUBTEST_4( qr<Mat>() );+    CALL_SUBTEST_4( cod<Mat>() );+    CALL_SUBTEST_4( qr_invertible<Mat>() );++    CALL_SUBTEST_5( qr<Mat>() );+    CALL_SUBTEST_5( qr_invertible<Mat>() );++    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<int>(EIGEN_TEST_MAX_SIZE/4, EIGEN_TEST_MAX_SIZE), internal::random<int>(EIGEN_TEST_MAX_SIZE/4, EIGEN_TEST_MAX_SIZE/2))) ));+  CALL_SUBTEST_10(( bdcsvd(Mat(internal::random<int>(EIGEN_TEST_MAX_SIZE/4, EIGEN_TEST_MAX_SIZE), internal::random<int>(EIGEN_TEST_MAX_SIZE/4, EIGEN_TEST_MAX_SIZE/2))) ));+}+
+ eigen3/test/bug1213.cpp view
@@ -0,0 +1,13 @@++// 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);+}+
+ eigen3/test/bug1213.h view
@@ -0,0 +1,8 @@++#include <Eigen/Core>++template<typename T, int dim>+bool bug1213_2(const Eigen::Matrix<T,dim,1>& x);++bool bug1213_1(const Eigen::Vector3f& x);+
+ eigen3/test/bug1213_main.cpp view
@@ -0,0 +1,18 @@++// This is a regression unit regarding a weird linking issue with gcc.++#include "bug1213.h"++int main()+{+  return 0;+}+++template<typename T, int dim>+bool bug1213_2(const Eigen::Matrix<T,dim,1>& )+{+  return true;+}++template bool bug1213_2<float,3>(const Eigen::Vector3f&);
+ eigen3/test/cholesky.cpp view
@@ -0,0 +1,529 @@+// This file is part of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2008 Gael Guennebaud <gael.guennebaud@inria.fr>+//+// 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_ASSERTION_CHECKING+#define EIGEN_NO_ASSERTION_CHECKING+#endif++#define TEST_ENABLE_TEMPORARY_TRACKING++#include "main.h"+#include <Eigen/Cholesky>+#include <Eigen/QR>++template<typename MatrixType, int UpLo>+typename MatrixType::RealScalar matrix_l1_norm(const MatrixType& m) {+  if(m.cols()==0) return typename MatrixType::RealScalar(0);+  MatrixType symm = m.template selfadjointView<UpLo>();+  return symm.cwiseAbs().colwise().sum().maxCoeff();+}++template<typename MatrixType,template <typename,int> class CholType> void test_chol_update(const MatrixType& symm)+{+  typedef typename MatrixType::Scalar Scalar;+  typedef typename MatrixType::RealScalar RealScalar;+  typedef Matrix<Scalar, MatrixType::RowsAtCompileTime, 1> VectorType;++  MatrixType symmLo = symm.template triangularView<Lower>();+  MatrixType symmUp = symm.template triangularView<Upper>();+  MatrixType symmCpy = symm;++  CholType<MatrixType,Lower> chollo(symmLo);+  CholType<MatrixType,Upper> cholup(symmUp);++  for (int k=0; k<10; ++k)+  {+    VectorType vec = VectorType::Random(symm.rows());+    RealScalar sigma = internal::random<RealScalar>();+    symmCpy += sigma * vec * vec.adjoint();++    // we are doing some downdates, so it might be the case that the matrix is not SPD anymore+    CholType<MatrixType,Lower> 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<typename MatrixType> 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<Scalar>::Real RealScalar;+  typedef Matrix<Scalar, MatrixType::RowsAtCompileTime, MatrixType::RowsAtCompileTime> SquareMatrixType;+  typedef Matrix<Scalar, MatrixType::RowsAtCompileTime, 1> 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();+  }++  {+    SquareMatrixType symmUp = symm.template triangularView<Upper>();+    SquareMatrixType symmLo = symm.template triangularView<Lower>();++    LLT<SquareMatrixType,Lower> chollo(symmLo);+    VERIFY_IS_APPROX(symm, chollo.reconstructedMatrix());+    vecX = chollo.solve(vecB);+    VERIFY_IS_APPROX(symm * vecX, vecB);+    matX = chollo.solve(matB);+    VERIFY_IS_APPROX(symm * matX, matB);++    const MatrixType symmLo_inverse = chollo.solve(MatrixType::Identity(rows,cols));+    RealScalar rcond = (RealScalar(1) / matrix_l1_norm<MatrixType, Lower>(symmLo)) /+                             matrix_l1_norm<MatrixType, Lower>(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<SquareMatrixType,Upper> 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<MatrixType, Upper>(symmUp)) /+                             matrix_l1_norm<MatrixType, Upper>(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<Lower>().llt().solve(matB);+    VERIFY_IS_APPROX(m2, m1 + symmLo.template selfadjointView<Lower>().llt().solve(matB));+    m2 = m1;+    m2 -= symmLo.template selfadjointView<Lower>().llt().solve(matB);+    VERIFY_IS_APPROX(m2, m1 - symmLo.template selfadjointView<Lower>().llt().solve(matB));+    m2 = m1;+    m2.noalias() += symmLo.template selfadjointView<Lower>().llt().solve(matB);+    VERIFY_IS_APPROX(m2, m1 + symmLo.template selfadjointView<Lower>().llt().solve(matB));+    m2 = m1;+    m2.noalias() -= symmLo.template selfadjointView<Lower>().llt().solve(matB);+    VERIFY_IS_APPROX(m2, m1 - symmLo.template selfadjointView<Lower>().llt().solve(matB));+  }++  // LDLT+  {+    int sign = internal::random<int>()%2 ? 1 : -1;++    if(sign == -1)+    {+      symm = -symm; // test a negative matrix+    }++    SquareMatrixType symmUp = symm.template triangularView<Upper>();+    SquareMatrixType symmLo = symm.template triangularView<Lower>();++    LDLT<SquareMatrixType,Lower> ldltlo(symmLo);+    VERIFY(ldltlo.info()==Success);+    VERIFY_IS_APPROX(symm, ldltlo.reconstructedMatrix());+    vecX = ldltlo.solve(vecB);+    VERIFY_IS_APPROX(symm * vecX, vecB);+    matX = ldltlo.solve(matB);+    VERIFY_IS_APPROX(symm * matX, matB);++    const MatrixType symmLo_inverse = ldltlo.solve(MatrixType::Identity(rows,cols));+    RealScalar rcond = (RealScalar(1) / matrix_l1_norm<MatrixType, Lower>(symmLo)) /+                             matrix_l1_norm<MatrixType, Lower>(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<SquareMatrixType,Upper> 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<MatrixType, Upper>(symmUp)) /+                             matrix_l1_norm<MatrixType, Upper>(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<Index>(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<Index>(1,rows-1);+      Matrix<Scalar,Dynamic,Dynamic> a = Matrix<Scalar,Dynamic,Dynamic>::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<RealScalar>::max_exponent10/8);+      Matrix<Scalar,Dynamic,Dynamic> a = Matrix<Scalar,Dynamic,Dynamic>::Random(rows,rows);+      Matrix<RealScalar,Dynamic,1> d =  Matrix<RealScalar,Dynamic,1>::Random(rows);+      for(Index k=0; k<rows; ++k)+        d(k) = d(k)*pow(RealScalar(10),internal::random<RealScalar>(-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<RealScalar>());+        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<SquareMatrixType,LLT>(symm)  ));+  CALL_SUBTEST(( test_chol_update<SquareMatrixType,LDLT>(symm) ));+}++template<typename MatrixType> 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<Scalar>::Real RealScalar;+  typedef Matrix<RealScalar, MatrixType::RowsAtCompileTime, MatrixType::RowsAtCompileTime> RealMatrixType;+  typedef Matrix<Scalar, MatrixType::RowsAtCompileTime, 1> 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<Lower>();++    LLT<RealMatrixType,Lower> chollo(symmLo);+    VERIFY_IS_APPROX(symm, chollo.reconstructedMatrix());+    vecX = chollo.solve(vecB);+    VERIFY_IS_APPROX(symm * vecX, vecB);+//     matX = chollo.solve(matB);+//     VERIFY_IS_APPROX(symm * matX, matB);+  }++  // LDLT+  {+    int sign = internal::random<int>()%2 ? 1 : -1;++    if(sign == -1)+    {+      symm = -symm; // test a negative matrix+    }++    RealMatrixType symmLo = symm.template triangularView<Lower>();++    LDLT<RealMatrixType,Lower> ldltlo(symmLo);+    VERIFY(ldltlo.info()==Success);+    VERIFY_IS_APPROX(symm, ldltlo.reconstructedMatrix());+    vecX = ldltlo.solve(vecB);+    VERIFY_IS_APPROX(symm * vecX, vecB);+//     matX = ldltlo.solve(matB);+//     VERIFY_IS_APPROX(symm * matX, matB);+  }+}++// regression test for bug 241+template<typename MatrixType> void cholesky_bug241(const MatrixType& m)+{+  eigen_assert(m.rows() == 2 && m.cols() == 2);++  typedef typename MatrixType::Scalar Scalar;+  typedef Matrix<Scalar, MatrixType::RowsAtCompileTime, 1> 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<typename MatrixType> void cholesky_definiteness(const MatrixType& m)+{+  eigen_assert(m.rows() == 2 && m.cols() == 2);+  MatrixType mat;+  LDLT<MatrixType> 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<typename>+void cholesky_faillure_cases()+{+  MatrixXd mat;+  LDLT<MatrixXd> 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<typename MatrixType> void cholesky_verify_assert()+{+  MatrixType tmp;++  LLT<MatrixType> llt;+  VERIFY_RAISES_ASSERT(llt.matrixL())+  VERIFY_RAISES_ASSERT(llt.matrixU())+  VERIFY_RAISES_ASSERT(llt.solve(tmp))+  VERIFY_RAISES_ASSERT(llt.solveInPlace(&tmp))++  LDLT<MatrixType> ldlt;+  VERIFY_RAISES_ASSERT(ldlt.matrixL())+  VERIFY_RAISES_ASSERT(ldlt.permutationP())+  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.solveInPlace(&tmp))+}++void test_cholesky()+{+  int s = 0;+  for(int i = 0; i < g_repeat; i++) {+    CALL_SUBTEST_1( cholesky(Matrix<double,1,1>()) );+    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<int>(1,EIGEN_TEST_MAX_SIZE);+    CALL_SUBTEST_2( cholesky(MatrixXd(s,s)) );+    TEST_SET_BUT_UNUSED_VARIABLE(s)++    s = internal::random<int>(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<double,0,0>()) );++  CALL_SUBTEST_4( cholesky_verify_assert<Matrix3f>() );+  CALL_SUBTEST_7( cholesky_verify_assert<Matrix3d>() );+  CALL_SUBTEST_8( cholesky_verify_assert<MatrixXf>() );+  CALL_SUBTEST_2( cholesky_verify_assert<MatrixXd>() );++  // Test problem size constructors+  CALL_SUBTEST_9( LLT<MatrixXf>(10) );+  CALL_SUBTEST_9( LDLT<MatrixXf>(10) );++  CALL_SUBTEST_2( cholesky_faillure_cases<void>() );++  TEST_SET_BUT_UNUSED_VARIABLE(nb_temporaries)+}
+ eigen3/test/cholmod_support.cpp view
@@ -0,0 +1,57 @@+// This file is part of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2011 Gael Guennebaud <g.gael@free.fr>+//+// 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 <Eigen/CholmodSupport>++template<typename T> void test_cholmod_T()+{+  CholmodDecomposition<SparseMatrix<T>, Lower> g_chol_colmajor_lower; g_chol_colmajor_lower.setMode(CholmodSupernodalLLt);+  CholmodDecomposition<SparseMatrix<T>, Upper> g_chol_colmajor_upper; g_chol_colmajor_upper.setMode(CholmodSupernodalLLt);+  CholmodDecomposition<SparseMatrix<T>, Lower> g_llt_colmajor_lower;  g_llt_colmajor_lower.setMode(CholmodSimplicialLLt);+  CholmodDecomposition<SparseMatrix<T>, Upper> g_llt_colmajor_upper;  g_llt_colmajor_upper.setMode(CholmodSimplicialLLt);+  CholmodDecomposition<SparseMatrix<T>, Lower> g_ldlt_colmajor_lower; g_ldlt_colmajor_lower.setMode(CholmodLDLt);+  CholmodDecomposition<SparseMatrix<T>, Upper> g_ldlt_colmajor_upper; g_ldlt_colmajor_upper.setMode(CholmodLDLt);+  +  CholmodSupernodalLLT<SparseMatrix<T>, Lower> chol_colmajor_lower;+  CholmodSupernodalLLT<SparseMatrix<T>, Upper> chol_colmajor_upper;+  CholmodSimplicialLLT<SparseMatrix<T>, Lower> llt_colmajor_lower;+  CholmodSimplicialLLT<SparseMatrix<T>, Upper> llt_colmajor_upper;+  CholmodSimplicialLDLT<SparseMatrix<T>, Lower> ldlt_colmajor_lower;+  CholmodSimplicialLDLT<SparseMatrix<T>, Upper> 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);+}++void test_cholmod_support()+{+  CALL_SUBTEST_1(test_cholmod_T<double>());+  CALL_SUBTEST_2(test_cholmod_T<std::complex<double> >());+}
+ eigen3/test/commainitializer.cpp view
@@ -0,0 +1,106 @@+// This file is part of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2008 Gael Guennebaud <gael.guennebaud@inria.fr>+//+// 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<int M1, int M2, int N1, int N2>+void test_blocks()+{+  Matrix<int, M1+M2, N1+N2> m_fixed;+  MatrixXi m_dynamic(M1+M2, N1+N2);++  Matrix<int, M1, N1> mat11; mat11.setRandom();+  Matrix<int, M1, N2> mat12; mat12.setRandom();+  Matrix<int, M2, N1> mat21; mat21.setRandom();+  Matrix<int, M2, N2> 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<M1,N1>()), mat11);+    VERIFY_IS_EQUAL((m_fixed.template topRightCorner<M1,N2>()), mat12);+    VERIFY_IS_EQUAL((m_fixed.template bottomLeftCorner<M2,N1>()), mat21);+    VERIFY_IS_EQUAL((m_fixed.template bottomRightCorner<M2,N2>()), mat22);+    VERIFY_IS_EQUAL((m_fixed << mat12, mat11, matx21, mat22).finished(), (m_dynamic << mat12, matx11, matx21, mat22).finished());+  }++  if(N1 > 0)+  {+    VERIFY_RAISES_ASSERT((m_fixed << mat11, mat12, mat11, mat21, mat22));+    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<int N>+struct test_block_recursion+{+  static void run()+  {+    test_blocks<(N>>6)&3, (N>>4)&3, (N>>2)&3, N & 3>();+    test_block_recursion<N-1>::run();+  }+};++template<>+struct test_block_recursion<-1>+{+  static void run() { }+};++void test_commainitializer()+{+  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<Matrix<double,3,3,RowMajor> >(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);+++  // recursively test all block-sizes from 0 to 3:+  test_block_recursion<(1<<8) - 1>();+}
+ eigen3/test/conjugate_gradient.cpp view
@@ -0,0 +1,34 @@+// This file is part of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2011 Gael Guennebaud <g.gael@free.fr>+//+// 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 <Eigen/IterativeLinearSolvers>++template<typename T, typename I> void test_conjugate_gradient_T()+{+  typedef SparseMatrix<T,0,I> SparseMatrixType;+  ConjugateGradient<SparseMatrixType, Lower      > cg_colmajor_lower_diag;+  ConjugateGradient<SparseMatrixType, Upper      > cg_colmajor_upper_diag;+  ConjugateGradient<SparseMatrixType, Lower|Upper> cg_colmajor_loup_diag;+  ConjugateGradient<SparseMatrixType, Lower, IdentityPreconditioner> cg_colmajor_lower_I;+  ConjugateGradient<SparseMatrixType, Upper, IdentityPreconditioner> 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)     );+}++void test_conjugate_gradient()+{+  CALL_SUBTEST_1(( test_conjugate_gradient_T<double,int>() ));+  CALL_SUBTEST_2(( test_conjugate_gradient_T<std::complex<double>, int>() ));+  CALL_SUBTEST_3(( test_conjugate_gradient_T<double,long int>() ));+}
+ eigen3/test/conservative_resize.cpp view
@@ -0,0 +1,133 @@+// This file is part of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2009 Hauke Heibel <hauke.heibel@gmail.com>+//+// 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 <Eigen/Core>++using namespace Eigen;++template <typename Scalar, int Storage>+void run_matrix_tests()+{+  typedef Matrix<Scalar, Eigen::Dynamic, Eigen::Dynamic, Storage> 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<Index>(1,50);+    const Index cols = internal::random<Index>(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<Index>(50,75);+    const Index cols = internal::random<Index>(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 <typename Scalar>+void run_vector_tests()+{+  typedef Matrix<Scalar, 1, Eigen::Dynamic> 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<int>(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<int>(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<Scalar,Dynamic,Dynamic>::Zero(1,size));+    VERIFY_IS_APPROX(m.segment(0,50), n);+    VERIFY( size<=50 || m.segment(50,size-50).sum() == Scalar(0) );+  }+}++void test_conservative_resize()+{+  for(int i=0; i<g_repeat; ++i)+  {+    CALL_SUBTEST_1((run_matrix_tests<int, Eigen::RowMajor>()));+    CALL_SUBTEST_1((run_matrix_tests<int, Eigen::ColMajor>()));+    CALL_SUBTEST_2((run_matrix_tests<float, Eigen::RowMajor>()));+    CALL_SUBTEST_2((run_matrix_tests<float, Eigen::ColMajor>()));+    CALL_SUBTEST_3((run_matrix_tests<double, Eigen::RowMajor>()));+    CALL_SUBTEST_3((run_matrix_tests<double, Eigen::ColMajor>()));+    CALL_SUBTEST_4((run_matrix_tests<std::complex<float>, Eigen::RowMajor>()));+    CALL_SUBTEST_4((run_matrix_tests<std::complex<float>, Eigen::ColMajor>()));+    CALL_SUBTEST_5((run_matrix_tests<std::complex<double>, Eigen::RowMajor>()));+    CALL_SUBTEST_6((run_matrix_tests<std::complex<double>, Eigen::ColMajor>()));++    CALL_SUBTEST_1((run_vector_tests<int>()));+    CALL_SUBTEST_2((run_vector_tests<float>()));+    CALL_SUBTEST_3((run_vector_tests<double>()));+    CALL_SUBTEST_4((run_vector_tests<std::complex<float> >()));+    CALL_SUBTEST_5((run_vector_tests<std::complex<double> >()));+  }+}
+ eigen3/test/constructor.cpp view
@@ -0,0 +1,84 @@+// This file is part of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2017 Gael Guennebaud <gael.guennebaud@inria.fr>+//+// 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<typename MatrixType> 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; }+};++template<typename MatrixType> 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<MatrixType> wrapper(m0);+  VERIFY_EVALUATION_COUNT( MatrixType m3(wrapper) , 1);+}+++void test_constructor()+{+  for(int i = 0; i < g_repeat; i++) {+    CALL_SUBTEST_1( ctor_init1(Matrix<float, 1, 1>()) );+    CALL_SUBTEST_1( ctor_init1(Matrix4d()) );+    CALL_SUBTEST_1( ctor_init1(MatrixXcf(internal::random<int>(1,EIGEN_TEST_MAX_SIZE), internal::random<int>(1,EIGEN_TEST_MAX_SIZE))) );+    CALL_SUBTEST_1( ctor_init1(MatrixXi(internal::random<int>(1,EIGEN_TEST_MAX_SIZE), internal::random<int>(1,EIGEN_TEST_MAX_SIZE))) );+  }+  {+    Matrix<Index,1,1> a(123);+    VERIFY_IS_EQUAL(a[0], 123);+  }+  {+    Matrix<Index,1,1> a(123.0);+    VERIFY_IS_EQUAL(a[0], 123);+  }+  {+    Matrix<float,1,1> a(123);+    VERIFY_IS_EQUAL(a[0], 123.f);+  }+  {+    Array<Index,1,1> a(123);+    VERIFY_IS_EQUAL(a[0], 123);+  }+  {+    Array<Index,1,1> a(123.0);+    VERIFY_IS_EQUAL(a[0], 123);+  }+  {+    Array<float,1,1> a(123);+    VERIFY_IS_EQUAL(a[0], 123.f);+  }+  {+    Array<Index,3,3> a(123);+    VERIFY_IS_EQUAL(a(4), 123);+  }+  {+    Array<Index,3,3> a(123.0);+    VERIFY_IS_EQUAL(a(4), 123);+  }+  {+    Array<float,3,3> a(123);+    VERIFY_IS_EQUAL(a(4), 123.f);+  }+}
+ eigen3/test/corners.cpp view
@@ -0,0 +1,117 @@+// This file is part of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2006-2010 Benoit Jacob <jacob.benoit.1@gmail.com>+//+// 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<typename MatrixType> void corners(const MatrixType& m)+{+  Index rows = m.rows();+  Index cols = m.cols();++  Index r = internal::random<Index>(1,rows);+  Index c = internal::random<Index>(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<Index>(1,rows) - 1;+  Index nr = internal::random<Index>(1,rows-sr);+  Index sc = internal::random<Index>(1,cols) - 1;+  Index nc = internal::random<Index>(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<typename MatrixType, int CRows, int CCols, int SRows, int SCols> 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<r,c>()), (matrix.template block<r,c>(0,0)));+  VERIFY_IS_EQUAL((matrix.template topRightCorner<r,c>()), (matrix.template block<r,c>(0,cols-c)));+  VERIFY_IS_EQUAL((matrix.template bottomLeftCorner<r,c>()), (matrix.template block<r,c>(rows-r,0)));+  VERIFY_IS_EQUAL((matrix.template bottomRightCorner<r,c>()), (matrix.template block<r,c>(rows-r,cols-c)));++  VERIFY_IS_EQUAL((matrix.template topLeftCorner<r,c>()), (matrix.template topLeftCorner<r,Dynamic>(r,c)));+  VERIFY_IS_EQUAL((matrix.template topRightCorner<r,c>()), (matrix.template topRightCorner<r,Dynamic>(r,c)));+  VERIFY_IS_EQUAL((matrix.template bottomLeftCorner<r,c>()), (matrix.template bottomLeftCorner<r,Dynamic>(r,c)));+  VERIFY_IS_EQUAL((matrix.template bottomRightCorner<r,c>()), (matrix.template bottomRightCorner<r,Dynamic>(r,c)));++  VERIFY_IS_EQUAL((matrix.template topLeftCorner<r,c>()), (matrix.template topLeftCorner<Dynamic,c>(r,c)));+  VERIFY_IS_EQUAL((matrix.template topRightCorner<r,c>()), (matrix.template topRightCorner<Dynamic,c>(r,c)));+  VERIFY_IS_EQUAL((matrix.template bottomLeftCorner<r,c>()), (matrix.template bottomLeftCorner<Dynamic,c>(r,c)));+  VERIFY_IS_EQUAL((matrix.template bottomRightCorner<r,c>()), (matrix.template bottomRightCorner<Dynamic,c>(r,c)));++  VERIFY_IS_EQUAL((matrix.template topRows<r>()), (matrix.template block<r,cols>(0,0)));+  VERIFY_IS_EQUAL((matrix.template middleRows<r>(sr)), (matrix.template block<r,cols>(sr,0)));+  VERIFY_IS_EQUAL((matrix.template bottomRows<r>()), (matrix.template block<r,cols>(rows-r,0)));+  VERIFY_IS_EQUAL((matrix.template leftCols<c>()), (matrix.template block<rows,c>(0,0)));+  VERIFY_IS_EQUAL((matrix.template middleCols<c>(sc)), (matrix.template block<rows,c>(0,sc)));+  VERIFY_IS_EQUAL((matrix.template rightCols<c>()), (matrix.template block<rows,c>(0,cols-c)));++  VERIFY_IS_EQUAL((const_matrix.template topLeftCorner<r,c>()), (const_matrix.template block<r,c>(0,0)));+  VERIFY_IS_EQUAL((const_matrix.template topRightCorner<r,c>()), (const_matrix.template block<r,c>(0,cols-c)));+  VERIFY_IS_EQUAL((const_matrix.template bottomLeftCorner<r,c>()), (const_matrix.template block<r,c>(rows-r,0)));+  VERIFY_IS_EQUAL((const_matrix.template bottomRightCorner<r,c>()), (const_matrix.template block<r,c>(rows-r,cols-c)));++  VERIFY_IS_EQUAL((const_matrix.template topLeftCorner<r,c>()), (const_matrix.template topLeftCorner<r,Dynamic>(r,c)));+  VERIFY_IS_EQUAL((const_matrix.template topRightCorner<r,c>()), (const_matrix.template topRightCorner<r,Dynamic>(r,c)));+  VERIFY_IS_EQUAL((const_matrix.template bottomLeftCorner<r,c>()), (const_matrix.template bottomLeftCorner<r,Dynamic>(r,c)));+  VERIFY_IS_EQUAL((const_matrix.template bottomRightCorner<r,c>()), (const_matrix.template bottomRightCorner<r,Dynamic>(r,c)));++  VERIFY_IS_EQUAL((const_matrix.template topLeftCorner<r,c>()), (const_matrix.template topLeftCorner<Dynamic,c>(r,c)));+  VERIFY_IS_EQUAL((const_matrix.template topRightCorner<r,c>()), (const_matrix.template topRightCorner<Dynamic,c>(r,c)));+  VERIFY_IS_EQUAL((const_matrix.template bottomLeftCorner<r,c>()), (const_matrix.template bottomLeftCorner<Dynamic,c>(r,c)));+  VERIFY_IS_EQUAL((const_matrix.template bottomRightCorner<r,c>()), (const_matrix.template bottomRightCorner<Dynamic,c>(r,c)));++  VERIFY_IS_EQUAL((const_matrix.template topRows<r>()), (const_matrix.template block<r,cols>(0,0)));+  VERIFY_IS_EQUAL((const_matrix.template middleRows<r>(sr)), (const_matrix.template block<r,cols>(sr,0)));+  VERIFY_IS_EQUAL((const_matrix.template bottomRows<r>()), (const_matrix.template block<r,cols>(rows-r,0)));+  VERIFY_IS_EQUAL((const_matrix.template leftCols<c>()), (const_matrix.template block<rows,c>(0,0)));+  VERIFY_IS_EQUAL((const_matrix.template middleCols<c>(sc)), (const_matrix.template block<rows,c>(0,sc)));+  VERIFY_IS_EQUAL((const_matrix.template rightCols<c>()), (const_matrix.template block<rows,c>(0,cols-c)));+}++void test_corners()+{+  for(int i = 0; i < g_repeat; i++) {+    CALL_SUBTEST_1( corners(Matrix<float, 1, 1>()) );+    CALL_SUBTEST_2( corners(Matrix4d()) );+    CALL_SUBTEST_3( corners(Matrix<int,10,12>()) );+    CALL_SUBTEST_4( corners(MatrixXcf(5, 7)) );+    CALL_SUBTEST_5( corners(MatrixXf(21, 20)) );++    CALL_SUBTEST_1(( corners_fixedsize<Matrix<float, 1, 1>, 1, 1, 0, 0>() ));+    CALL_SUBTEST_2(( corners_fixedsize<Matrix4d,2,2,1,1>() ));+    CALL_SUBTEST_3(( corners_fixedsize<Matrix<int,10,12>,4,7,5,2>() ));+  }+}
+ eigen3/test/ctorleak.cpp view
@@ -0,0 +1,69 @@+#include "main.h"++#include <exception>  // std::exception++struct Foo+{+  static Index object_count;+  static Index object_limit;+  int dummy;++  Foo()+  {+#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++void test_ctorleak()+{+  typedef Matrix<Foo, Dynamic, Dynamic> MatrixX;+  typedef Matrix<Foo, Dynamic, 1> VectorX;+  Foo::object_count = 0;+  for(int i = 0; i < g_repeat; i++) {+    Index rows = internal::random<Index>(2,EIGEN_TEST_MAX_SIZE), cols = internal::random<Index>(2,EIGEN_TEST_MAX_SIZE);+    Foo::object_limit = internal::random<Index>(0, rows*cols - 2);+    std::cout << "object_limit =" << Foo::object_limit << std::endl;+#ifdef EIGEN_EXCEPTIONS+    try+    {+#endif+    	std::cout <<       "\nMatrixX m(" << rows << ", " << cols << ");\n";+      MatrixX m(rows, cols);+#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);+  }+}
+ eigen3/test/cuda_basic.cu view
@@ -0,0 +1,170 @@+// This file is part of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2015-2016 Gael Guennebaud <gael.guennebaud@inria.fr>+//+// 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_TEST_NO_COMPLEX+#define EIGEN_TEST_FUNC cuda_basic+#define EIGEN_DEFAULT_DENSE_INDEX_TYPE int++#include <math_constants.h>+#include <cuda.h>+#include "main.h"+#include "cuda_common.h"++// Check that dense modules can be properly parsed by nvcc+#include <Eigen/Dense>++// 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<Vector3f>(data+9) = M.inverse() * x;+//     Matrix3f M(mats+i/16);+//     Vector3f x(vecs+i*3);+//   //   using std::min;+//   //   using std::sqrt;+//     Map<Vector3f>(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<typename T>+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<T> res(out+i*T::MaxSizeAtCompileTime);+    +    res.array() += (in[0] * x1 + x2).array() * x3.array();+  }+};++template<typename T>+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<Array<typename T::Scalar,Dynamic,Dynamic> > 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<typename T>+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<typename T1, typename T2>+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<typename T1::Scalar, T1::RowsAtCompileTime, T2::ColsAtCompileTime> T3;+    T1 x1(in+i);+    T2 x2(in+i+1);+    Map<T3> res(out+i*T3::MaxSizeAtCompileTime);+    res += in[i] * x1 * x2;+  }+};++template<typename T1, typename T2>+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<T2> res(out+i*T2::MaxSizeAtCompileTime);+    res += x1.diagonal();+  }+};++template<typename T>+struct eigenvalues {+  EIGEN_DEVICE_FUNC+  void operator()(int i, const typename T::Scalar* in, typename T::Scalar* out) const+  {+    using namespace Eigen;+    typedef Matrix<typename T::Scalar, T::RowsAtCompileTime, 1> Vec;+    T M(in+i);+    Map<Vec> res(out+i*Vec::MaxSizeAtCompileTime);+    T A = M*M.adjoint();+    SelfAdjointEigenSolver<T> eig;+    eig.computeDirect(M);+    res = eig.eigenvalues();+  }+};++void test_cuda_basic()+{+  ei_test_init_cuda();+  +  int nthreads = 100;+  Eigen::VectorXf in, out;+  +  #ifndef __CUDA_ARCH__+  int data_size = nthreads * 512;+  in.setRandom(data_size);+  out.setRandom(data_size);+  #endif+  +  CALL_SUBTEST( run_and_compare_to_cuda(coeff_wise<Vector3f>(), nthreads, in, out) );+  CALL_SUBTEST( run_and_compare_to_cuda(coeff_wise<Array44f>(), nthreads, in, out) );+  +  CALL_SUBTEST( run_and_compare_to_cuda(replicate<Array4f>(), nthreads, in, out) );+  CALL_SUBTEST( run_and_compare_to_cuda(replicate<Array33f>(), nthreads, in, out) );+  +  CALL_SUBTEST( run_and_compare_to_cuda(redux<Array4f>(), nthreads, in, out) );+  CALL_SUBTEST( run_and_compare_to_cuda(redux<Matrix3f>(), nthreads, in, out) );+  +  CALL_SUBTEST( run_and_compare_to_cuda(prod_test<Matrix3f,Matrix3f>(), nthreads, in, out) );+  CALL_SUBTEST( run_and_compare_to_cuda(prod_test<Matrix4f,Vector4f>(), nthreads, in, out) );+  +  CALL_SUBTEST( run_and_compare_to_cuda(diagonal<Matrix3f,Vector3f>(), nthreads, in, out) );+  CALL_SUBTEST( run_and_compare_to_cuda(diagonal<Matrix4f,Vector4f>(), nthreads, in, out) );+  +  CALL_SUBTEST( run_and_compare_to_cuda(eigenvalues<Matrix3f>(), nthreads, in, out) );+  CALL_SUBTEST( run_and_compare_to_cuda(eigenvalues<Matrix2f>(), nthreads, in, out) );++}
+ eigen3/test/cuda_common.h view
@@ -0,0 +1,101 @@++#ifndef EIGEN_TEST_CUDA_COMMON_H+#define EIGEN_TEST_CUDA_COMMON_H++#include <cuda.h>+#include <cuda_runtime.h>+#include <cuda_runtime_api.h>+#include <iostream>++#ifndef __CUDACC__+dim3 threadIdx, blockDim, blockIdx;+#endif++template<typename Kernel, typename Input, typename Output>+void run_on_cpu(const Kernel& ker, int n, const Input& in, Output& out)+{+  for(int i=0; i<n; i++)+    ker(i, in.data(), out.data());+}+++template<typename Kernel, typename Input, typename Output>+__global__+void run_on_cuda_meta_kernel(const Kernel ker, int n, const Input* in, Output* out)+{+  int i = threadIdx.x + blockIdx.x*blockDim.x;+  if(i<n) {+    ker(i, in, out);+  }+}+++template<typename Kernel, typename Input, typename Output>+void run_on_cuda(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);+  +  cudaMalloc((void**)(&d_in),  in_bytes);+  cudaMalloc((void**)(&d_out), out_bytes);+  +  cudaMemcpy(d_in,  in.data(),  in_bytes,  cudaMemcpyHostToDevice);+  cudaMemcpy(d_out, out.data(), out_bytes, cudaMemcpyHostToDevice);+  +  // 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) );++  cudaThreadSynchronize();+  run_on_cuda_meta_kernel<<<Grids,Blocks>>>(ker, n, d_in, d_out);+  cudaThreadSynchronize();+  +  // check inputs have not been modified+  cudaMemcpy(const_cast<typename Input::Scalar*>(in.data()),  d_in,  in_bytes,  cudaMemcpyDeviceToHost);+  cudaMemcpy(out.data(), d_out, out_bytes, cudaMemcpyDeviceToHost);+  +  cudaFree(d_in);+  cudaFree(d_out);+}+++template<typename Kernel, typename Input, typename Output>+void run_and_compare_to_cuda(const Kernel& ker, int n, const Input& in, Output& out)+{+  Input  in_ref,  in_cuda;+  Output out_ref, out_cuda;+  #ifndef __CUDA_ARCH__+  in_ref = in_cuda = in;+  out_ref = out_cuda = out;+  #endif+  run_on_cpu (ker, n, in_ref,  out_ref);+  run_on_cuda(ker, n, in_cuda, out_cuda);+  #ifndef __CUDA_ARCH__+  VERIFY_IS_APPROX(in_ref, in_cuda);+  VERIFY_IS_APPROX(out_ref, out_cuda);+  #endif+}+++void ei_test_init_cuda()+{+  int device = 0;+  cudaDeviceProp deviceProp;+  cudaGetDeviceProperties(&deviceProp, device);+  std::cout << "CUDA 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_CUDA_COMMON_H
+ eigen3/test/denseLM.cpp view
@@ -0,0 +1,190 @@+// This file is part of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2012 Desire Nuentsa <desire.nuentsa_wakam@inria.fr>+// Copyright (C) 2012 Gael Guennebaud <gael.guennebaud@inria.fr>+//+// 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 <iostream>+#include <fstream>+#include <iomanip>++#include "main.h"+#include <Eigen/LevenbergMarquardt>+using namespace std;+using namespace Eigen;++template<typename Scalar>+struct DenseLM : DenseFunctor<Scalar>+{+  typedef DenseFunctor<Scalar> Base;+  typedef typename Base::JacobianType JacobianType;+  typedef Matrix<Scalar,Dynamic,1> VectorType;+  +  DenseLM(int n, int m) : DenseFunctor<Scalar>(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<const VectorType> u(uv, 0, half);+    VectorBlock<const VectorType> 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<const VectorType> u(uv, 0, half);+    VectorBlock<const VectorType> 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<const VectorType> u(uv, 0, half);+    VectorBlock<const VectorType> 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<typename FunctorType, typename VectorType>+int test_minimizeLM(FunctorType& functor, VectorType& uv)+{+  LevenbergMarquardt<FunctorType> lm(functor);+  LevenbergMarquardtSpace::Status info; +  +  info = lm.minimize(uv);+  +  VERIFY_IS_EQUAL(info, 1);+  //FIXME Check other parameters+  return info;+}++template<typename FunctorType, typename VectorType>+int test_lmder(FunctorType& functor, VectorType& uv)+{+  typedef typename VectorType::Scalar Scalar;+  LevenbergMarquardtSpace::Status info; +  LevenbergMarquardt<FunctorType> lm(functor);+  info = lm.lmder1(uv);+  +  VERIFY_IS_EQUAL(info, 1);+  //FIXME Check other parameters+  return info;+}++template<typename FunctorType, typename VectorType>+int test_minimizeSteps(FunctorType& functor, VectorType& uv)+{+  LevenbergMarquardtSpace::Status info;   +  LevenbergMarquardt<FunctorType> 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<typename T>+void test_denseLM_T()+{+  typedef Matrix<T,Dynamic,1> VectorType;+  +  int inputs = 10; +  int values = 1000; +  DenseLM<T> 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<VectorType> u(uv, 0, inputs/2); +  VectorBlock<VectorType> 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);+  +}++void test_denseLM()+{+  CALL_SUBTEST_2(test_denseLM_T<double>());+  +  // CALL_SUBTEST_2(test_sparseLM_T<std::complex<double>());+}
+ eigen3/test/dense_storage.cpp view
@@ -0,0 +1,76 @@+// This file is part of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2013 Hauke Heibel <hauke.heibel@gmail.com>+//+// 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 <Eigen/Core>++template <typename T, int Rows, int Cols>+void dense_storage_copy()+{+  static const int Size = ((Rows==Dynamic || Cols==Dynamic) ? Dynamic : Rows*Cols);+  typedef DenseStorage<T,Size, Rows,Cols, 0> DenseStorageType;+  +  const int rows = (Rows==Dynamic) ? 4 : Rows;+  const int cols = (Cols==Dynamic) ? 3 : Cols;+  const int size = rows*cols;+  DenseStorageType reference(size, rows, cols);+  T* raw_reference = reference.data();+  for (int i=0; i<size; ++i)+    raw_reference[i] = static_cast<T>(i);+    +  DenseStorageType copied_reference(reference);+  const T* raw_copied_reference = copied_reference.data();+  for (int i=0; i<size; ++i)+    VERIFY_IS_EQUAL(raw_reference[i], raw_copied_reference[i]);+}++template <typename T, int Rows, int Cols>+void dense_storage_assignment()+{+  static const int Size = ((Rows==Dynamic || Cols==Dynamic) ? Dynamic : Rows*Cols);+  typedef DenseStorage<T,Size, Rows,Cols, 0> DenseStorageType;+  +  const int rows = (Rows==Dynamic) ? 4 : Rows;+  const int cols = (Cols==Dynamic) ? 3 : Cols;+  const int size = rows*cols;+  DenseStorageType reference(size, rows, cols);+  T* raw_reference = reference.data();+  for (int i=0; i<size; ++i)+    raw_reference[i] = static_cast<T>(i);+    +  DenseStorageType copied_reference;+  copied_reference = reference;+  const T* raw_copied_reference = copied_reference.data();+  for (int i=0; i<size; ++i)+    VERIFY_IS_EQUAL(raw_reference[i], raw_copied_reference[i]);+}++void test_dense_storage()+{+  dense_storage_copy<int,Dynamic,Dynamic>();  +  dense_storage_copy<int,Dynamic,3>();+  dense_storage_copy<int,4,Dynamic>();+  dense_storage_copy<int,4,3>();++  dense_storage_copy<float,Dynamic,Dynamic>();+  dense_storage_copy<float,Dynamic,3>();+  dense_storage_copy<float,4,Dynamic>();  +  dense_storage_copy<float,4,3>();+  +  dense_storage_assignment<int,Dynamic,Dynamic>();  +  dense_storage_assignment<int,Dynamic,3>();+  dense_storage_assignment<int,4,Dynamic>();+  dense_storage_assignment<int,4,3>();++  dense_storage_assignment<float,Dynamic,Dynamic>();+  dense_storage_assignment<float,Dynamic,3>();+  dense_storage_assignment<float,4,Dynamic>();  +  dense_storage_assignment<float,4,3>();  +}
+ eigen3/test/determinant.cpp view
@@ -0,0 +1,66 @@+// This file is part of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2008 Benoit Jacob <jacob.benoit.1@gmail.com>+// Copyright (C) 2008 Gael Guennebaud <gael.guennebaud@inria.fr>+//+// 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 <Eigen/LU>++template<typename MatrixType> 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<Scalar>();+  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<Index>(0, size-1);+  Index j;+  do {+    j = internal::random<Index>(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));+}++void test_determinant()+{+  for(int i = 0; i < g_repeat; i++) {+    int s = 0;+    CALL_SUBTEST_1( determinant(Matrix<float, 1, 1>()) );+    CALL_SUBTEST_2( determinant(Matrix<double, 2, 2>()) );+    CALL_SUBTEST_3( determinant(Matrix<double, 3, 3>()) );+    CALL_SUBTEST_4( determinant(Matrix<double, 4, 4>()) );+    CALL_SUBTEST_5( determinant(Matrix<std::complex<double>, 10, 10>()) );+    s = internal::random<int>(1,EIGEN_TEST_MAX_SIZE/4);+    CALL_SUBTEST_6( determinant(MatrixXd(s, s)) );+    TEST_SET_BUT_UNUSED_VARIABLE(s)+  }+}
+ eigen3/test/diagonal.cpp view
@@ -0,0 +1,105 @@+// This file is part of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2006-2010 Benoit Jacob <jacob.benoit.1@gmail.com>+//+// 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<typename MatrixType> 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<Scalar>();++  //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<N1>().RowsAtCompileTime == m1.diagonal(N1).size());+      VERIFY(m1.template diagonal<N2>().RowsAtCompileTime == m1.diagonal(N2).size());+    }++    m2.template diagonal<N1>() = 2 * m1.template diagonal<N1>();+    VERIFY_IS_APPROX(m2.template diagonal<N1>(), static_cast<Scalar>(2) * m1.diagonal(N1));+    m2.template diagonal<N1>()[0] *= 3;+    VERIFY_IS_APPROX(m2.template diagonal<N1>()[0], static_cast<Scalar>(6) * m1.template diagonal<N1>()[0]);+++    m2.template diagonal<N2>() = 2 * m1.template diagonal<N2>();+    m2.template diagonal<N2>()[0] *= 3;+    VERIFY_IS_APPROX(m2.template diagonal<N2>()[0], static_cast<Scalar>(6) * m1.template diagonal<N2>()[0]);++    m2.diagonal(N1) = 2 * m1.diagonal(N1);+    VERIFY_IS_APPROX(m2.template diagonal<N1>(), static_cast<Scalar>(2) * m1.diagonal(N1));+    m2.diagonal(N1)[0] *= 3;+    VERIFY_IS_APPROX(m2.diagonal(N1)[0], static_cast<Scalar>(6) * m1.diagonal(N1)[0]);++    m2.diagonal(N2) = 2 * m1.diagonal(N2);+    VERIFY_IS_APPROX(m2.template diagonal<N2>(), static_cast<Scalar>(2) * m1.diagonal(N2));+    m2.diagonal(N2)[0] *= 3;+    VERIFY_IS_APPROX(m2.diagonal(N2)[0], static_cast<Scalar>(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<typename MatrixType> 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)) );+}++void test_diagonal()+{+  for(int i = 0; i < g_repeat; i++) {+    CALL_SUBTEST_1( diagonal(Matrix<float, 1, 1>()) );+    CALL_SUBTEST_1( diagonal(Matrix<float, 4, 9>()) );+    CALL_SUBTEST_1( diagonal(Matrix<float, 7, 3>()) );+    CALL_SUBTEST_2( diagonal(Matrix4d()) );+    CALL_SUBTEST_2( diagonal(MatrixXcf(internal::random<int>(1,EIGEN_TEST_MAX_SIZE), internal::random<int>(1,EIGEN_TEST_MAX_SIZE))) );+    CALL_SUBTEST_2( diagonal(MatrixXi(internal::random<int>(1,EIGEN_TEST_MAX_SIZE), internal::random<int>(1,EIGEN_TEST_MAX_SIZE))) );+    CALL_SUBTEST_2( diagonal(MatrixXcd(internal::random<int>(1,EIGEN_TEST_MAX_SIZE), internal::random<int>(1,EIGEN_TEST_MAX_SIZE))) );+    CALL_SUBTEST_1( diagonal(MatrixXf(internal::random<int>(1,EIGEN_TEST_MAX_SIZE), internal::random<int>(1,EIGEN_TEST_MAX_SIZE))) );+    CALL_SUBTEST_1( diagonal(Matrix<float,Dynamic,4>(3, 4)) );+    CALL_SUBTEST_1( diagonal_assert(MatrixXf(internal::random<int>(1,EIGEN_TEST_MAX_SIZE), internal::random<int>(1,EIGEN_TEST_MAX_SIZE))) );+  }+}
+ eigen3/test/diagonalmatrices.cpp view
@@ -0,0 +1,166 @@+// This file is part of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2009 Benoit Jacob <jacob.benoit.1@gmail.com>+//+// 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<typename MatrixType> void diagonalmatrices(const MatrixType& m)+{+  typedef typename MatrixType::Scalar Scalar;+  enum { Rows = MatrixType::RowsAtCompileTime, Cols = MatrixType::ColsAtCompileTime };+  typedef Matrix<Scalar, Rows, 1> VectorType;+  typedef Matrix<Scalar, 1, Cols> RowVectorType;+  typedef Matrix<Scalar, Rows, Rows> SquareMatrixType;+  typedef Matrix<Scalar, Dynamic, Dynamic> DynMatrixType;+  typedef DiagonalMatrix<Scalar, Rows> LeftDiagonalMatrix;+  typedef DiagonalMatrix<Scalar, Cols> RightDiagonalMatrix;+  typedef Matrix<Scalar, Rows==Dynamic?Dynamic:2*Rows, Cols==Dynamic?Dynamic:2*Cols> 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<Scalar>();++  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<Index>(0, rows-1);+  Index j = internal::random<Index>(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) );+}++template<typename MatrixType> void as_scalar_product(const MatrixType& m)+{+  typedef typename MatrixType::Scalar Scalar;+  typedef Matrix<Scalar, MatrixType::RowsAtCompileTime, 1> VectorType;+  typedef Matrix<Scalar, Dynamic, Dynamic> DynMatrixType;+  typedef Matrix<Scalar, Dynamic, 1> DynVectorType;+  typedef Matrix<Scalar, 1, Dynamic> DynRowVectorType;++  Index rows = m.rows();+  Index depth = internal::random<Index>(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<int>+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() );+}++void test_diagonalmatrices()+{+  for(int i = 0; i < g_repeat; i++) {+    CALL_SUBTEST_1( diagonalmatrices(Matrix<float, 1, 1>()) );+    CALL_SUBTEST_1( as_scalar_product(Matrix<float, 1, 1>()) );++    CALL_SUBTEST_2( diagonalmatrices(Matrix3f()) );+    CALL_SUBTEST_3( diagonalmatrices(Matrix<double,3,3,RowMajor>()) );+    CALL_SUBTEST_4( diagonalmatrices(Matrix4d()) );+    CALL_SUBTEST_5( diagonalmatrices(Matrix<float,4,4,RowMajor>()) );+    CALL_SUBTEST_6( diagonalmatrices(MatrixXcf(internal::random<int>(1,EIGEN_TEST_MAX_SIZE), internal::random<int>(1,EIGEN_TEST_MAX_SIZE))) );+    CALL_SUBTEST_6( as_scalar_product(MatrixXcf(1,1)) );+    CALL_SUBTEST_7( diagonalmatrices(MatrixXi(internal::random<int>(1,EIGEN_TEST_MAX_SIZE), internal::random<int>(1,EIGEN_TEST_MAX_SIZE))) );+    CALL_SUBTEST_8( diagonalmatrices(Matrix<double,Dynamic,Dynamic,RowMajor>(internal::random<int>(1,EIGEN_TEST_MAX_SIZE), internal::random<int>(1,EIGEN_TEST_MAX_SIZE))) );+    CALL_SUBTEST_9( diagonalmatrices(MatrixXf(internal::random<int>(1,EIGEN_TEST_MAX_SIZE), internal::random<int>(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>() );+}
+ eigen3/test/dontalign.cpp view
@@ -0,0 +1,62 @@+// This file is part of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2011 Benoit Jacob <jacob.benoit.1@gmail.com>+//+// 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 <Eigen/Dense>++template<typename MatrixType>+void dontalign(const MatrixType& m)+{+  typedef typename MatrixType::Scalar Scalar;+  typedef Matrix<Scalar, MatrixType::RowsAtCompileTime, 1> VectorType;+  typedef Matrix<Scalar, MatrixType::RowsAtCompileTime, MatrixType::RowsAtCompileTime> SquareMatrixType;++  Index rows = m.rows();+  Index cols = m.cols();++  MatrixType a = MatrixType::Random(rows,cols);+  SquareMatrixType square = SquareMatrixType::Random(rows,rows);+  VectorType v = VectorType::Random(rows);++  VERIFY_IS_APPROX(v, square * square.colPivHouseholderQr().solve(v));+  square = square.inverse().eval();+  a = square * a;+  square = square*square;+  v = square * v;+  v = a.adjoint() * v;+  VERIFY(square.determinant() != Scalar(0));++  // bug 219: MapAligned() was giving an assert with EIGEN_DONT_ALIGN, because Map Flags were miscomputed+  Scalar* array = internal::aligned_new<Scalar>(rows);+  v = VectorType::MapAligned(array, rows);+  internal::aligned_delete(array, rows);+}++void test_dontalign()+{+#if defined EIGEN_TEST_PART_1 || defined EIGEN_TEST_PART_5+  dontalign(Matrix3d());+  dontalign(Matrix4f());+#elif defined EIGEN_TEST_PART_2 || defined EIGEN_TEST_PART_6+  dontalign(Matrix3cd());+  dontalign(Matrix4cf());+#elif defined EIGEN_TEST_PART_3 || defined EIGEN_TEST_PART_7+  dontalign(Matrix<float, 32, 32>());+  dontalign(Matrix<std::complex<float>, 32, 32>());+#elif defined EIGEN_TEST_PART_4 || defined EIGEN_TEST_PART_8+  dontalign(MatrixXd(32, 32));+  dontalign(MatrixXcf(32, 32));+#endif+}
+ eigen3/test/dynalloc.cpp view
@@ -0,0 +1,175 @@+// This file is part of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2008 Gael Guennebaud <gael.guennebaud@inria.fr>+//+// 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<float,8,1> 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<float>(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;+  Vector8f avec;+};++class MyClassA+{+  public:+    EIGEN_MAKE_ALIGNED_OPERATOR_NEW+    char dummychar;+    Vector8f avec;+};++template<typename T> 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<typename T> void check_custom_new_delete()+{+  {+    T* t = new T;+    delete t;+  }+  +  {+    std::size_t N = internal::random<std::size_t>(1,10);+    T* t = new T[N];+    delete[] t;+  }+  +#if EIGEN_MAX_ALIGN_BYTES>0+  {+    T* t = static_cast<T *>((T::operator new)(sizeof(T)));+    (T::operator delete)(t, sizeof(T));+  }+  +  {+    T* t = static_cast<T *>((T::operator new)(sizeof(T)));+    (T::operator delete)(t);+  }+#endif+}++void 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<g_repeat*100; ++i)+  {+    CALL_SUBTEST( check_custom_new_delete<Vector4f>() );+    CALL_SUBTEST( check_custom_new_delete<Vector2f>() );+    CALL_SUBTEST( check_custom_new_delete<Matrix4f>() );+    CALL_SUBTEST( check_custom_new_delete<MatrixXi>() );+  }+  +  // check static allocation, who knows ?+  #if EIGEN_MAX_STATIC_ALIGN_BYTES+  for (int i=0; i<g_repeat*100; ++i)+  {+    CALL_SUBTEST(check_dynaligned<Vector4f>() );+    CALL_SUBTEST(check_dynaligned<Vector2d>() );+    CALL_SUBTEST(check_dynaligned<Matrix4f>() );+    CALL_SUBTEST(check_dynaligned<Vector4d>() );+    CALL_SUBTEST(check_dynaligned<Vector4i>() );+    CALL_SUBTEST(check_dynaligned<Vector8f>() );+  }++  {+    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; i<g_repeat*100; ++i)+  {+    MyStruct *foo0 = new MyStruct();  VERIFY(internal::UIntPtr(foo0->avec.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; i<g_repeat*100; ++i)+  {+    MyStruct *foo0 = new MyStruct[N];  VERIFY(internal::UIntPtr(foo0->avec.data())%ALIGNMENT==0);+    MyClassA *fooA = new MyClassA[N];  VERIFY(internal::UIntPtr(fooA->avec.data())%ALIGNMENT==0);+    delete[] foo0;+    delete[] fooA;+  }+  #endif+  +}
+ eigen3/test/eigen2support.cpp view
@@ -0,0 +1,65 @@+// This file is part of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2009 Gael Guennebaud <gael.guennebaud@inria.fr>+//+// 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<typename MatrixType> 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<Scalar>(),+          s2 = internal::random<Scalar>();++  // 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);+}++void test_eigen2support()+{+  for(int i = 0; i < g_repeat; i++) {+    CALL_SUBTEST_1( eigen2support(Matrix<double,1,1>()) );+    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)) );+  }+}
+ eigen3/test/eigensolver_complex.cpp view
@@ -0,0 +1,176 @@+// This file is part of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2008-2009 Gael Guennebaud <gael.guennebaud@inria.fr>+// Copyright (C) 2010 Jitse Niesen <jitse@maths.leeds.ac.uk>+//+// 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 <limits>+#include <Eigen/Eigenvalues>+#include <Eigen/LU>++template<typename MatrixType> 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<std::pair<Index,Index> > transpositions;+    for(Index i=col; i<n; ++i)+    {+      Index best_index(0);+      if(diffs.col(col).segment(col,n-i).minCoeff(&best_index) > 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<Index,Index>(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 upto 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<typename VectorType>+void verify_is_approx_upto_permutation(const VectorType& vec1, const VectorType& vec2)+{+  typedef typename VectorType::Scalar Scalar;+  typedef typename NumTraits<Scalar>::Real RealScalar;++  VERIFY(vec1.cols() == 1);+  VERIFY(vec2.cols() == 1);+  VERIFY(vec1.rows() == vec2.rows());+  +  Index n = vec1.rows();+  RealScalar tol = test_precision<RealScalar>()*test_precision<RealScalar>()*numext::maxi(vec1.squaredNorm(),vec2.squaredNorm());+  Matrix<RealScalar,Dynamic,Dynamic> diffs = (vec1.rowwise().replicate(n) - vec2.rowwise().replicate(n).transpose()).cwiseAbs2();+  +  VERIFY( find_pivot(tol, diffs) );+}+++template<typename MatrixType> 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<Scalar>::Real RealScalar;++  MatrixType a = MatrixType::Random(rows,cols);+  MatrixType symmA =  a.adjoint() * a;++  ComplexEigenSolver<MatrixType> ei0(symmA);+  VERIFY_IS_EQUAL(ei0.info(), Success);+  VERIFY_IS_APPROX(symmA * ei0.eigenvectors(), ei0.eigenvectors() * ei0.eigenvalues().asDiagonal());++  ComplexEigenSolver<MatrixType> 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<MatrixType> ei2;+  ei2.setMaxIterations(ComplexSchur<MatrixType>::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<MatrixType> 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<MatrixType> 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<typename MatrixType::RealScalar>::quiet_NaN();+    ComplexEigenSolver<MatrixType> eiNaN(a);+    VERIFY_IS_EQUAL(eiNaN.info(), NoConvergence);+  }++  // regression test for bug 1098+  {+    ComplexEigenSolver<MatrixType> eig(a.adjoint() * a);+    eig.compute(a.adjoint() * a);+  }++  // regression test for bug 478+  {+    a.setZero();+    ComplexEigenSolver<MatrixType> 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<typename MatrixType> void eigensolver_verify_assert(const MatrixType& m)+{+  ComplexEigenSolver<MatrixType> 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());+}++void test_eigensolver_complex()+{+  int s = 0;+  for(int i = 0; i < g_repeat; i++) {+    CALL_SUBTEST_1( eigensolver(Matrix4cf()) );+    s = internal::random<int>(1,EIGEN_TEST_MAX_SIZE/4);+    CALL_SUBTEST_2( eigensolver(MatrixXcd(s,s)) );+    CALL_SUBTEST_3( eigensolver(Matrix<std::complex<float>, 1, 1>()) );+    CALL_SUBTEST_4( eigensolver(Matrix3f()) );+    TEST_SET_BUT_UNUSED_VARIABLE(s)+  }+  CALL_SUBTEST_1( eigensolver_verify_assert(Matrix4cf()) );+  s = internal::random<int>(1,EIGEN_TEST_MAX_SIZE/4);+  CALL_SUBTEST_2( eigensolver_verify_assert(MatrixXcd(s,s)) );+  CALL_SUBTEST_3( eigensolver_verify_assert(Matrix<std::complex<float>, 1, 1>()) );+  CALL_SUBTEST_4( eigensolver_verify_assert(Matrix3f()) );++  // Test problem size constructors+  CALL_SUBTEST_5(ComplexEigenSolver<MatrixXf> tmp(s));+  +  TEST_SET_BUT_UNUSED_VARIABLE(s)+}
+ eigen3/test/eigensolver_generalized_real.cpp view
@@ -0,0 +1,103 @@+// This file is part of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2012-2016 Gael Guennebaud <gael.guennebaud@inria.fr>+//+// 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 <limits>+#include <Eigen/Eigenvalues>+#include <Eigen/LU>++template<typename MatrixType> 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<Scalar> ComplexScalar;+  typedef Matrix<Scalar, MatrixType::RowsAtCompileTime, 1> 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<MatrixType> symmEig(spdA, spdB);+    GeneralizedEigenSolver<MatrixType> 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<MatrixType>::EigenvectorsType D = eig.eigenvalues().asDiagonal();+    typename GeneralizedEigenSolver<MatrixType>::EigenvectorsType V = eig.eigenvectors();+    VERIFY_IS_APPROX(spdA*V, spdB*V*D);+  }++  // non symmetric case:+  {+    GeneralizedEigenSolver<MatrixType> 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<cols; ++k)+    {+      Matrix<ComplexScalar,Dynamic,Dynamic> tmp = (eig.betas()(k)*a).template cast<ComplexScalar>() - eig.alphas()(k)*b;+      if(tmp.size()>1 && tmp.norm()>(std::numeric_limits<Scalar>::min)())+        tmp /= tmp.norm();+      VERIFY_IS_MUCH_SMALLER_THAN( std::abs(tmp.determinant()), Scalar(1) );+    }+    // check eigenvectors+    typename GeneralizedEigenSolver<MatrixType>::EigenvectorsType D = eig.eigenvalues().asDiagonal();+    typename GeneralizedEigenSolver<MatrixType>::EigenvectorsType V = eig.eigenvectors();+    VERIFY_IS_APPROX(a*V, b*V*D);+  }++  // regression test for bug 1098+  {+    GeneralizedSelfAdjointEigenSolver<MatrixType> eig1(a.adjoint() * a,b.adjoint() * b);+    eig1.compute(a.adjoint() * a,b.adjoint() * b);+    GeneralizedEigenSolver<MatrixType> eig2(a.adjoint() * a,b.adjoint() * b);+    eig2.compute(a.adjoint() * a,b.adjoint() * b);+  }++  // check without eigenvectors+  {+    GeneralizedEigenSolver<MatrixType> eig1(spdA, spdB, true);+    GeneralizedEigenSolver<MatrixType> eig2(spdA, spdB, false);+    VERIFY_IS_APPROX(eig1.eigenvalues(), eig2.eigenvalues());+  }+}++void 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<int>(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<double,1,1>()) );+    CALL_SUBTEST_4( generalized_eigensolver_real(Matrix2d()) );+    TEST_SET_BUT_UNUSED_VARIABLE(s)+  }+}
+ eigen3/test/eigensolver_generic.cpp view
@@ -0,0 +1,165 @@+// This file is part of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2008 Gael Guennebaud <gael.guennebaud@inria.fr>+// Copyright (C) 2010,2012 Jitse Niesen <jitse@maths.leeds.ac.uk>+//+// 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 <limits>+#include <Eigen/Eigenvalues>++template<typename MatrixType> 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<Scalar>::Real RealScalar;+  typedef Matrix<RealScalar, MatrixType::RowsAtCompileTime, 1> RealVectorType;+  typedef typename std::complex<typename NumTraits<typename MatrixType::Scalar>::Real> Complex;++  MatrixType a = MatrixType::Random(rows,cols);+  MatrixType a1 = MatrixType::Random(rows,cols);+  MatrixType symmA =  a.adjoint() * a + a1.adjoint() * a1;++  EigenSolver<MatrixType> ei0(symmA);+  VERIFY_IS_EQUAL(ei0.info(), Success);+  VERIFY_IS_APPROX(symmA * ei0.pseudoEigenvectors(), ei0.pseudoEigenvectors() * ei0.pseudoEigenvalueMatrix());+  VERIFY_IS_APPROX((symmA.template cast<Complex>()) * (ei0.pseudoEigenvectors().template cast<Complex>()),+    (ei0.pseudoEigenvectors().template cast<Complex>()) * (ei0.eigenvalues().asDiagonal()));++  EigenSolver<MatrixType> ei1(a);+  VERIFY_IS_EQUAL(ei1.info(), Success);+  VERIFY_IS_APPROX(a * ei1.pseudoEigenvectors(), ei1.pseudoEigenvectors() * ei1.pseudoEigenvalueMatrix());+  VERIFY_IS_APPROX(a.template cast<Complex>() * ei1.eigenvectors(),+                   ei1.eigenvectors() * ei1.eigenvalues().asDiagonal());+  VERIFY_IS_APPROX(ei1.eigenvectors().colwise().norm(), RealVectorType::Ones(rows).transpose());+  VERIFY_IS_APPROX(a.eigenvalues(), ei1.eigenvalues());++  EigenSolver<MatrixType> ei2;+  ei2.setMaxIterations(RealSchur<MatrixType>::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<MatrixType> 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<typename MatrixType::RealScalar>::quiet_NaN();+    EigenSolver<MatrixType> eiNaN(a);+    VERIFY_IS_EQUAL(eiNaN.info(), NoConvergence);+  }++  // regression test for bug 1098+  {+    EigenSolver<MatrixType> eig(a.adjoint() * a);+    eig.compute(a.adjoint() * a);+  }++  // regression test for bug 478+  {+    a.setZero();+    EigenSolver<MatrixType> 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<typename MatrixType> void eigensolver_verify_assert(const MatrixType& m)+{+  EigenSolver<MatrixType> 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());+}++void test_eigensolver_generic()+{+  int s = 0;+  for(int i = 0; i < g_repeat; i++) {+    CALL_SUBTEST_1( eigensolver(Matrix4f()) );+    s = internal::random<int>(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<double,1,1>()) );+    CALL_SUBTEST_4( eigensolver(Matrix2d()) );+  }++  CALL_SUBTEST_1( eigensolver_verify_assert(Matrix4f()) );+  s = internal::random<int>(1,EIGEN_TEST_MAX_SIZE/4);+  CALL_SUBTEST_2( eigensolver_verify_assert(MatrixXd(s,s)) );+  CALL_SUBTEST_3( eigensolver_verify_assert(Matrix<double,1,1>()) );+  CALL_SUBTEST_4( eigensolver_verify_assert(Matrix2d()) );++  // Test problem size constructors+  CALL_SUBTEST_5(EigenSolver<MatrixXf> 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<MatrixXd> solver(A);+     VERIFY_IS_EQUAL(solver.info(), NumericalIssue);+  }+  );+  +#ifdef EIGEN_TEST_PART_2+  {+    // regression test for bug 793+    MatrixXd a(3,3);+    a << 0,  0,  1,+        1,  1, 1,+        1, 1e+200,  1;+    Eigen::EigenSolver<MatrixXd> 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<MatrixXd> 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.);+  }+#endif+  +  TEST_SET_BUT_UNUSED_VARIABLE(s)+}
+ eigen3/test/eigensolver_selfadjoint.cpp view
@@ -0,0 +1,273 @@+// This file is part of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2008 Gael Guennebaud <gael.guennebaud@inria.fr>+// Copyright (C) 2010 Jitse Niesen <jitse@maths.leeds.ac.uk>+//+// 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 <limits>+#include <Eigen/Eigenvalues>+#include <Eigen/SparseCore>+++template<typename MatrixType> void selfadjointeigensolver_essential_check(const MatrixType& m)+{+  typedef typename MatrixType::Scalar Scalar;+  typedef typename NumTraits<Scalar>::Real RealScalar;+  RealScalar eival_eps = numext::mini<RealScalar>(test_precision<RealScalar>(),  NumTraits<Scalar>::dummy_precision()*20000);+  +  SelfAdjointEigenSolver<MatrixType> eiSymm(m);+  VERIFY_IS_EQUAL(eiSymm.info(), Success);++  RealScalar scaling = m.cwiseAbs().maxCoeff();++  if(scaling<(std::numeric_limits<RealScalar>::min)())+  {+    VERIFY(eiSymm.eigenvalues().cwiseAbs().maxCoeff() <= (std::numeric_limits<RealScalar>::min)());+  }+  else+  {+    VERIFY_IS_APPROX((m.template selfadjointView<Lower>() * eiSymm.eigenvectors())/scaling,+                     (eiSymm.eigenvectors() * eiSymm.eigenvalues().asDiagonal())/scaling);+  }+  VERIFY_IS_APPROX(m.template selfadjointView<Lower>().eigenvalues(), eiSymm.eigenvalues());+  VERIFY_IS_UNITARY(eiSymm.eigenvectors());++  if(m.cols()<=4)+  {+    SelfAdjointEigenSolver<MatrixType> 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<RealScalar>::min)())+    {+      VERIFY(eiDirect.eigenvalues().cwiseAbs().maxCoeff() <= (std::numeric_limits<RealScalar>::min)());+    }+    else+    {+      VERIFY_IS_APPROX(eiSymm.eigenvalues()/scaling, eiDirect.eigenvalues()/scaling);+      VERIFY_IS_APPROX((m.template selfadjointView<Lower>() * eiDirect.eigenvectors())/scaling,+                       (eiDirect.eigenvectors() * eiDirect.eigenvalues().asDiagonal())/scaling);+      VERIFY_IS_APPROX(m.template selfadjointView<Lower>().eigenvalues()/scaling, eiDirect.eigenvalues()/scaling);+    }++    VERIFY_IS_UNITARY(eiDirect.eigenvectors());+  }+}++template<typename MatrixType> 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<Scalar>::Real RealScalar;++  RealScalar largerEps = 10*test_precision<RealScalar>();++  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<StrictlyUpper>().setZero();+  symmC.template triangularView<StrictlyUpper>().setZero();++  MatrixType b = MatrixType::Random(rows,cols);+  MatrixType b1 = MatrixType::Random(rows,cols);+  MatrixType symmB = b.adjoint() * b + b1.adjoint() * b1;+  symmB.template triangularView<StrictlyUpper>().setZero();+  +  CALL_SUBTEST( selfadjointeigensolver_essential_check(symmA) );++  SelfAdjointEigenSolver<MatrixType> eiSymm(symmA);+  // generalized eigen pb+  GeneralizedSelfAdjointEigenSolver<MatrixType> eiSymmGen(symmC, symmB);++  SelfAdjointEigenSolver<MatrixType> 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<Lower>() * eiSymmGen.eigenvectors()).isApprox(+          symmB.template selfadjointView<Lower>() * (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<Lower>() * (symmC.template selfadjointView<Lower>() * 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<Lower>() * (symmB.template selfadjointView<Lower>() * eiSymmGen.eigenvectors())).isApprox(+         (eiSymmGen.eigenvectors() * eiSymmGen.eigenvalues().asDiagonal()), largerEps));+++  eiSymm.compute(symmC);+  MatrixType sqrtSymmA = eiSymm.operatorSqrt();+  VERIFY_IS_APPROX(MatrixType(symmC.template selfadjointView<Lower>()), sqrtSymmA*sqrtSymmA);+  VERIFY_IS_APPROX(sqrtSymmA, symmC.template selfadjointView<Lower>()*eiSymm.operatorInverseSqrt());++  MatrixType id = MatrixType::Identity(rows, cols);+  VERIFY_IS_APPROX(id.template selfadjointView<Lower>().operatorNorm(), RealScalar(1));++  SelfAdjointEigenSolver<MatrixType> 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<MatrixType> tridiag(symmC);+  VERIFY_IS_APPROX(tridiag.diagonal(), tridiag.matrixT().diagonal());+  VERIFY_IS_APPROX(tridiag.subDiagonal(), tridiag.matrixT().template diagonal<-1>());+  Matrix<RealScalar,Dynamic,Dynamic> 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<Upper>().isZero());+  }+  VERIFY_IS_APPROX(tridiag.diagonal(), T.diagonal());+  VERIFY_IS_APPROX(tridiag.subDiagonal(), T.template diagonal<1>());+  VERIFY_IS_APPROX(MatrixType(symmC.template selfadjointView<Lower>()), tridiag.matrixQ() * tridiag.matrixT().eval() * MatrixType(tridiag.matrixQ()).adjoint());+  VERIFY_IS_APPROX(MatrixType(symmC.template selfadjointView<Lower>()), tridiag.matrixQ() * tridiag.matrixT() * tridiag.matrixQ().adjoint());+  +  // Test computation of eigenvalues from tridiagonal matrix+  if(rows > 1)+  {+    SelfAdjointEigenSolver<MatrixType> 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<typename MatrixType::RealScalar>::quiet_NaN();+    SelfAdjointEigenSolver<MatrixType> eiSymmNaN(symmC);+    VERIFY_IS_EQUAL(eiSymmNaN.info(), NoConvergence);+  }++  // regression test for bug 1098+  {+    SelfAdjointEigenSolver<MatrixType> eig(a.adjoint() * a);+    eig.compute(a.adjoint() * a);+  }++  // regression test for bug 478+  {+    a.setZero();+    SelfAdjointEigenSolver<MatrixType> 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<int>+void bug_854()+{+  Matrix3d m;+  m << 850.961, 51.966, 0,+       51.966, 254.841, 0,+            0,       0, 0;+  selfadjointeigensolver_essential_check(m);+}++template<int>+void bug_1014()+{+  Matrix3d m;+  m <<        0.11111111111111114658, 0, 0,+       0,     0.11111111111111109107, 0,+       0, 0,  0.11111111111111107719;+  selfadjointeigensolver_essential_check(m);+}++template<int>+void bug_1225()+{+  Matrix3d m1, m2;+  m1.setRandom();+  m1 = m1*m1.transpose();+  m2 = m1.triangularView<Upper>();+  SelfAdjointEigenSolver<Matrix3d> eig1(m1);+  SelfAdjointEigenSolver<Matrix3d> eig2(m2.selfadjointView<Upper>());+  VERIFY_IS_APPROX(eig1.eigenvalues(), eig2.eigenvalues());+}++template<int>+void bug_1204()+{+  SparseMatrix<double> A(2,2);+  A.setIdentity();+  SelfAdjointEigenSolver<Eigen::SparseMatrix<double> > eig(A);+}++void test_eigensolver_selfadjoint()+{+  int s = 0;+  for(int i = 0; i < g_repeat; i++) {+    // trivial test for 1x1 matrices:+    CALL_SUBTEST_1( selfadjointeigensolver(Matrix<float, 1, 1>()));+    CALL_SUBTEST_1( selfadjointeigensolver(Matrix<double, 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_13( selfadjointeigensolver(Matrix3f()) );+    CALL_SUBTEST_13( selfadjointeigensolver(Matrix3d()) );+    CALL_SUBTEST_2( selfadjointeigensolver(Matrix4d()) );+    +    s = internal::random<int>(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<std::complex<double>,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_6( selfadjointeigensolver(Matrix<double,1,1>()) );+    CALL_SUBTEST_7( selfadjointeigensolver(Matrix<double,2,2>()) );+  }+  +  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<int>(1,EIGEN_TEST_MAX_SIZE/4);+  CALL_SUBTEST_8(SelfAdjointEigenSolver<MatrixXf> tmp1(s));+  CALL_SUBTEST_8(Tridiagonalization<MatrixXf> tmp2(s));+  +  TEST_SET_BUT_UNUSED_VARIABLE(s)+}+
+ eigen3/test/evaluator_common.h view
+ eigen3/test/evaluators.cpp view
@@ -0,0 +1,499 @@++#include "main.h"++namespace Eigen {++  template<typename Lhs,typename Rhs>+  const Product<Lhs,Rhs>+  prod(const Lhs& lhs, const Rhs& rhs)+  {+    return Product<Lhs,Rhs>(lhs,rhs);+  }++  template<typename Lhs,typename Rhs>+  const Product<Lhs,Rhs,LazyProduct>+  lazyprod(const Lhs& lhs, const Rhs& rhs)+  {+    return Product<Lhs,Rhs,LazyProduct>(lhs,rhs);+  }+  +  template<typename DstXprType, typename SrcXprType>+  EIGEN_STRONG_INLINE+  DstXprType& copy_using_evaluator(const EigenBase<DstXprType> &dst, const SrcXprType &src)+  {+    call_assignment(dst.const_cast_derived(), src.derived(), internal::assign_op<typename DstXprType::Scalar,typename SrcXprType::Scalar>());+    return dst.const_cast_derived();+  }+  +  template<typename DstXprType, template <typename> class StorageBase, typename SrcXprType>+  EIGEN_STRONG_INLINE+  const DstXprType& copy_using_evaluator(const NoAlias<DstXprType, StorageBase>& dst, const SrcXprType &src)+  {+    call_assignment(dst, src.derived(), internal::assign_op<typename DstXprType::Scalar,typename SrcXprType::Scalar>());+    return dst.expression();+  }+  +  template<typename DstXprType, typename SrcXprType>+  EIGEN_STRONG_INLINE+  DstXprType& copy_using_evaluator(const PlainObjectBase<DstXprType> &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<typename DstXprType::Scalar,typename SrcXprType::Scalar>());+    return dst.const_cast_derived();+  }++  template<typename DstXprType, typename SrcXprType>+  void add_assign_using_evaluator(const DstXprType& dst, const SrcXprType& src)+  {+    typedef typename DstXprType::Scalar Scalar;+    call_assignment(const_cast<DstXprType&>(dst), src.derived(), internal::add_assign_op<Scalar,typename SrcXprType::Scalar>());+  }++  template<typename DstXprType, typename SrcXprType>+  void subtract_assign_using_evaluator(const DstXprType& dst, const SrcXprType& src)+  {+    typedef typename DstXprType::Scalar Scalar;+    call_assignment(const_cast<DstXprType&>(dst), src.derived(), internal::sub_assign_op<Scalar,typename SrcXprType::Scalar>());+  }++  template<typename DstXprType, typename SrcXprType>+  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<Scalar,typename SrcXprType::Scalar>());+  }++  template<typename DstXprType, typename SrcXprType>+  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<Scalar,typename SrcXprType::Scalar>());+  }+  +  template<typename DstXprType, typename SrcXprType>+  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<Scalar>());+  }++  namespace internal {+    template<typename Dst, template <typename> class StorageBase, typename Src, typename Func>+    EIGEN_DEVICE_FUNC void call_assignment(const NoAlias<Dst,StorageBase>& dst, const Src& src, const Func& func)+    {+      call_assignment_no_alias(dst.expression(), src, func);+    }+  }+  +}++template<typename XprType> long get_cost(const XprType& ) { return Eigen::internal::evaluator<XprType>::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());++void 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<int>(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<int>(1,100);+    Matrix<float,      1,      1> m11, res11;  m11.setRandom(1,1);+    Matrix<float,      1,      4> m14, res14;  m14.setRandom(1,4);+    Matrix<float,      1,Dynamic> m1X, res1X;  m1X.setRandom(1,s);+    Matrix<float,      4,      1> m41, res41;  m41.setRandom(4,1);+    Matrix<float,      4,      4> m44, res44;  m44.setRandom(4,4);+    Matrix<float,      4,Dynamic> m4X, res4X;  m4X.setRandom(4,s);+    Matrix<float,Dynamic,      1> mX1, resX1;  mX1.setRandom(s,1);+    Matrix<float,Dynamic,      4> mX4, resX4;  mX4.setRandom(s,4);+    Matrix<float,Dynamic,Dynamic> 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<const Vector3f>(raw));+    VERIFY_IS_APPROX_EVALUATOR(a3f, Map<const Array3f>(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<Upper>(), MatrixXd(A.triangularView<Upper>()));+    +    A.setRandom();B.setRandom();+    VERIFY_IS_APPROX_EVALUATOR2(B, A.triangularView<UnitLower>(), MatrixXd(A.triangularView<UnitLower>()));+    +    A.setRandom();B.setRandom();+    VERIFY_IS_APPROX_EVALUATOR2(B, A.triangularView<UnitUpper>(), MatrixXd(A.triangularView<UnitUpper>()));+    +    A.setRandom();B.setRandom();+    C = B; C.triangularView<Upper>() = A;+    copy_using_evaluator(B.triangularView<Upper>(), A);+    VERIFY(B.isApprox(C) && "copy_using_evaluator(B.triangularView<Upper>(), A)");+    +    A.setRandom();B.setRandom();+    C = B; C.triangularView<Lower>() = A.triangularView<Lower>();+    copy_using_evaluator(B.triangularView<Lower>(), A.triangularView<Lower>());+    VERIFY(B.isApprox(C) && "copy_using_evaluator(B.triangularView<Lower>(), A.triangularView<Lower>())");+    +    +    A.setRandom();B.setRandom();+    C = B; C.triangularView<Lower>() = A.triangularView<Upper>().transpose();+    copy_using_evaluator(B.triangularView<Lower>(), A.triangularView<Upper>().transpose());+    VERIFY(B.isApprox(C) && "copy_using_evaluator(B.triangularView<Lower>(), A.triangularView<Lower>().transpose())");+    +    +    A.setRandom();B.setRandom(); C = B; D = A;+    C.triangularView<Upper>().swap(D.triangularView<Upper>());+    swap_using_evaluator(B.triangularView<Upper>(), A.triangularView<Upper>());+    VERIFY(B.isApprox(C) && "swap_using_evaluator(B.triangularView<Upper>(), A.triangularView<Upper>())");+    +    +    VERIFY_IS_APPROX_EVALUATOR2(B, prod(A.triangularView<Upper>(),A), MatrixXd(A.triangularView<Upper>()*A));+    +    VERIFY_IS_APPROX_EVALUATOR2(B, prod(A.selfadjointView<Upper>(),A), MatrixXd(A.selfadjointView<Upper>()*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);+  }+}
+ eigen3/test/exceptions.cpp view
@@ -0,0 +1,113 @@+// This file is part of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2011 Gael Guennebaud <gael.guennebaud@inria.fr>+//+// 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:+//  - 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"++struct my_exception+{+  my_exception() {}+  ~my_exception() {}+};+    +class ScalarWithExceptions+{+  public:+    ScalarWithExceptions() { init(); }+    ScalarWithExceptions(const float& _v) { init(); *v = _v; }+    ScalarWithExceptions(const ScalarWithExceptions& other) { init(); *v = *(other.v); }+    ~ScalarWithExceptions() {+      delete v;+      instances--;+    }++    void init() {+      v = new float;+      instances++;+    }++    ScalarWithExceptions operator+(const ScalarWithExceptions& other) const+    {+      countdown--;+      if(countdown<=0)+        throw my_exception();+      return ScalarWithExceptions(*v+*other.v);+    }+    +    ScalarWithExceptions operator-(const ScalarWithExceptions& other) const+    { return ScalarWithExceptions(*v-*other.v); }+    +    ScalarWithExceptions operator*(const ScalarWithExceptions& other) const+    { return ScalarWithExceptions((*v)*(*other.v)); }+    +    ScalarWithExceptions& operator+=(const ScalarWithExceptions& other)+    { *v+=*other.v; return *this; }+    ScalarWithExceptions& operator-=(const ScalarWithExceptions& other)+    { *v-=*other.v; return *this; }+    ScalarWithExceptions& operator=(const ScalarWithExceptions& other)+    { *v = *(other.v); return *this; }+  +    bool operator==(const ScalarWithExceptions& other) const+    { return *v==*other.v; }+    bool operator!=(const ScalarWithExceptions& other) const+    { return *v!=*other.v; }+    +    float* v;+    static int instances;+    static int countdown;+};++ScalarWithExceptions real(const ScalarWithExceptions &x) { return x; }+ScalarWithExceptions imag(const ScalarWithExceptions & ) { return 0; }+ScalarWithExceptions conj(const ScalarWithExceptions &x) { return x; }++int ScalarWithExceptions::instances = 0;+int ScalarWithExceptions::countdown = 0;+++#define CHECK_MEMLEAK(OP) {                                 \+    ScalarWithExceptions::countdown = 100;                  \+    int before = ScalarWithExceptions::instances;           \+    bool exception_thrown = false;                         \+    try { OP; }                              \+    catch (my_exception) {                                  \+      exception_thrown = true;                              \+      VERIFY(ScalarWithExceptions::instances==before && "memory leak detected in " && EIGEN_MAKESTRING(OP)); \+    } \+    VERIFY(exception_thrown && " no exception thrown in " && EIGEN_MAKESTRING(OP)); \+  }++void memoryleak()+{+  typedef Eigen::Matrix<ScalarWithExceptions,Dynamic,1> VectorType;+  typedef Eigen::Matrix<ScalarWithExceptions,Dynamic,Dynamic> MatrixType;+  +  {+    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(ScalarWithExceptions::instances==0 && "global memory leak detected in " && EIGEN_MAKESTRING(OP)); \+}++void test_exceptions()+{+  CALL_SUBTEST( memoryleak() );+}
+ eigen3/test/fastmath.cpp view
@@ -0,0 +1,99 @@+// This file is part of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2015 Gael Guennebaud <gael.guennebaud@inria.fr>+//+// 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<typename T> bool (isfinite)(T x) { return _finite(x); }+  template<typename T> bool (isnan)(T x) { return _isnan(x); }+  template<typename T> bool (isinf)(T x) { return _fpclass(x)==_FPCLASS_NINF || _fpclass(x)==_FPCLASS_PINF; }+}+#endif++template<typename T>+void check_inf_nan(bool dryrun) {+  Matrix<T,Dynamic,1> m(10);+  m.setRandom();+  m(3) = std::numeric_limits<T>::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+  {+    VERIFY( !(numext::isfinite)(m(3)) );+    VERIFY( !(numext::isinf)(m(3)) );+    VERIFY(  (numext::isnan)(m(3)) );+    VERIFY( !m.allFinite() );+    VERIFY(  m.hasNaN() );+  }+  T hidden_zero = (std::numeric_limits<T>::min)()*(std::numeric_limits<T>::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+  {+    VERIFY( !(numext::isfinite)(m(4)) );+    VERIFY(  (numext::isinf)(m(4)) );+    VERIFY( !(numext::isnan)(m(4)) );+    VERIFY( !m.allFinite() );+    VERIFY(  m.hasNaN() );+  }+  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+  {+    VERIFY(  (numext::isfinite)(m(3)) );+    VERIFY( !(numext::isinf)(m(3)) );+    VERIFY( !(numext::isnan)(m(3)) );+    VERIFY( !m.allFinite() );+    VERIFY( !m.hasNaN() );+  }+}++void test_fastmath() {+  std::cout << "*** float *** \n\n"; check_inf_nan<float>(true);+  std::cout << "*** double ***\n\n"; check_inf_nan<double>(true);+  std::cout << "*** long double *** \n\n"; check_inf_nan<long double>(true);++  check_inf_nan<float>(false);+  check_inf_nan<double>(false);+  check_inf_nan<long double>(false);+}
+ eigen3/test/first_aligned.cpp view
@@ -0,0 +1,51 @@+// This file is part of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2009 Benoit Jacob <jacob.benoit.1@gmail.com>+//+// 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<typename Scalar>+void test_first_aligned_helper(Scalar *array, int size)+{+  const int packet_size = sizeof(Scalar) * internal::packet_traits<Scalar>::size;+  VERIFY(((size_t(array) + sizeof(Scalar) * internal::first_default_aligned(array, size)) % packet_size) == 0);+}++template<typename Scalar>+void test_none_aligned_helper(Scalar *array, int size)+{+  EIGEN_UNUSED_VARIABLE(array);+  EIGEN_UNUSED_VARIABLE(size);+  VERIFY(internal::packet_traits<Scalar>::size == 1 || internal::first_default_aligned(array, size) == size);+}++struct some_non_vectorizable_type { float x; };++void 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);+}
+ eigen3/test/geo_alignedbox.cpp view
@@ -0,0 +1,187 @@+// This file is part of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2008-2009 Gael Guennebaud <gael.guennebaud@inria.fr>+//+// 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 <Eigen/Geometry>+#include <Eigen/LU>+#include <Eigen/QR>++#include<iostream>+using namespace std;++template<typename T> EIGEN_DONT_INLINE+void kill_extra_precision(T& x) { eigen_assert((void*)(&x) != (void*)0); }+++template<typename BoxType> void alignedbox(const BoxType& _box)+{+  /* this test covers the following files:+     AlignedBox.h+  */+  typedef typename BoxType::Scalar Scalar;+  typedef typename NumTraits<Scalar>::Real RealScalar;+  typedef Matrix<Scalar, BoxType::AmbientDimAtCompileTime, 1> 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<RealScalar>(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<typename BoxType>+void alignedboxCastTests(const BoxType& _box)+{+  // casting  +  typedef typename BoxType::Scalar Scalar;+  typedef Matrix<Scalar, BoxType::AmbientDimAtCompileTime, 1> 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<Scalar>::type OtherScalar;+  AlignedBox<OtherScalar,Dim> hp1f = b0.template cast<OtherScalar>();+  VERIFY_IS_APPROX(hp1f.template cast<Scalar>(),b0);+  AlignedBox<Scalar,Dim> hp1d = b0.template cast<Scalar>();+  VERIFY_IS_APPROX(hp1d.template cast<Scalar>(),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 ) );+}+++void test_geo_alignedbox()+{+  for(int i = 0; i < g_repeat; i++)+  {+    CALL_SUBTEST_1( alignedbox(AlignedBox2f()) );+    CALL_SUBTEST_2( alignedboxCastTests(AlignedBox2f()) );++    CALL_SUBTEST_3( alignedbox(AlignedBox3f()) );+    CALL_SUBTEST_4( alignedboxCastTests(AlignedBox3f()) );++    CALL_SUBTEST_5( alignedbox(AlignedBox4d()) );+    CALL_SUBTEST_6( alignedboxCastTests(AlignedBox4d()) );++    CALL_SUBTEST_7( alignedbox(AlignedBox1d()) );+    CALL_SUBTEST_8( alignedboxCastTests(AlignedBox1d()) );++    CALL_SUBTEST_9( alignedbox(AlignedBox1i()) );+    CALL_SUBTEST_10( alignedbox(AlignedBox2i()) );+    CALL_SUBTEST_11( alignedbox(AlignedBox3i()) );++    CALL_SUBTEST_14( alignedbox(AlignedBox<double,Dynamic>(4)) );+  }+  CALL_SUBTEST_12( specificTest1() );+  CALL_SUBTEST_13( specificTest2() );+}
+ eigen3/test/geo_eulerangles.cpp view
@@ -0,0 +1,112 @@+// This file is part of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2008-2012 Gael Guennebaud <gael.guennebaud@inria.fr>+//+// 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 <Eigen/Geometry>+#include <Eigen/LU>+#include <Eigen/SVD>+++template<typename Scalar>+void verify_euler(const Matrix<Scalar,3,1>& ea, int i, int j, int k)+{+  typedef Matrix<Scalar,3,3> Matrix3;+  typedef Matrix<Scalar,3,1> Vector3;+  typedef AngleAxis<Scalar> 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<Scalar>())) ) +    VERIFY((ea-eabis).norm() <= test_precision<Scalar>());+  +  // 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<typename Scalar> void check_all_var(const Matrix<Scalar,3,1>& 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<typename Scalar> void eulerangles()+{+  typedef Matrix<Scalar,3,3> Matrix3;+  typedef Matrix<Scalar,3,1> Vector3;+  typedef Array<Scalar,3,1> Array3;+  typedef Quaternion<Scalar> Quaternionx;+  typedef AngleAxis<Scalar> AngleAxisx;++  Scalar a = internal::random<Scalar>(-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<Scalar>(0,Scalar(EIGEN_PI));+  check_all_var(ea);+  +  ea[0] = ea[1] = internal::random<Scalar>(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);+}++void test_geo_eulerangles()+{+  for(int i = 0; i < g_repeat; i++) {+    CALL_SUBTEST_1( eulerangles<float>() );+    CALL_SUBTEST_2( eulerangles<double>() );+  }+}
+ eigen3/test/geo_homogeneous.cpp view
@@ -0,0 +1,125 @@+// This file is part of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2009 Gael Guennebaud <gael.guennebaud@inria.fr>+//+// 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 <Eigen/Geometry>++template<typename Scalar,int Size> void homogeneous(void)+{+  /* this test covers the following files:+     Homogeneous.h+  */++  typedef Matrix<Scalar,Size,Size> MatrixType;+  typedef Matrix<Scalar,Size,1, ColMajor> VectorType;++  typedef Matrix<Scalar,Size+1,Size> HMatrixType;+  typedef Matrix<Scalar,Size+1,1> HVectorType;++  typedef Matrix<Scalar,Size,Size+1>   T1MatrixType;+  typedef Matrix<Scalar,Size+1,Size+1> T2MatrixType;+  typedef Matrix<Scalar,Size+1,Size> 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<Size; ++j)+    m0.col(j) = hm0.col(j).head(Size) / hm0(Size,j);+  VERIFY_IS_APPROX(m0, hm0.colwise().hnormalized());++  T1MatrixType t1 = T1MatrixType::Random();+  VERIFY_IS_APPROX(t1 * (v0.homogeneous().eval()), t1 * v0.homogeneous());+  VERIFY_IS_APPROX(t1 * (m0.colwise().homogeneous().eval()), t1 * m0.colwise().homogeneous());++  T2MatrixType t2 = T2MatrixType::Random();+  VERIFY_IS_APPROX(t2 * (v0.homogeneous().eval()), t2 * v0.homogeneous());+  VERIFY_IS_APPROX(t2 * (m0.colwise().homogeneous().eval()), t2 * m0.colwise().homogeneous());+  VERIFY_IS_APPROX(t2 * (v0.homogeneous().asDiagonal()), t2 * hv0.asDiagonal());+  VERIFY_IS_APPROX((v0.homogeneous().asDiagonal()) * t2, hv0.asDiagonal() * t2);++  VERIFY_IS_APPROX((v0.transpose().rowwise().homogeneous().eval()) * t2,+                    v0.transpose().rowwise().homogeneous() * t2);+  VERIFY_IS_APPROX((m0.transpose().rowwise().homogeneous().eval()) * t2,+                    m0.transpose().rowwise().homogeneous() * t2);++  T3MatrixType t3 = T3MatrixType::Random();+  VERIFY_IS_APPROX((v0.transpose().rowwise().homogeneous().eval()) * t3,+                    v0.transpose().rowwise().homogeneous() * t3);+  VERIFY_IS_APPROX((m0.transpose().rowwise().homogeneous().eval()) * t3,+                    m0.transpose().rowwise().homogeneous() * t3);++  // test product with a Transform object+  Transform<Scalar, Size, Affine> aff;+  Transform<Scalar, Size, AffineCompact> caff;+  Transform<Scalar, Size, Projective> proj;+  Matrix<Scalar, Size, Dynamic>   pts;+  Matrix<Scalar, Size+1, Dynamic> pts1, pts2;++  aff.affine().setRandom();+  proj = caff = aff;+  pts.setRandom(Size,internal::random<int>(1,20));+  +  pts1 = pts.colwise().homogeneous();+  VERIFY_IS_APPROX(aff  * pts.colwise().homogeneous(), (aff  * pts1).colwise().hnormalized());+  VERIFY_IS_APPROX(caff * pts.colwise().homogeneous(), (caff * pts1).colwise().hnormalized());+  VERIFY_IS_APPROX(proj * pts.colwise().homogeneous(), (proj * pts1));++  VERIFY_IS_APPROX((aff  * pts1).colwise().hnormalized(),  aff  * pts);+  VERIFY_IS_APPROX((caff * pts1).colwise().hnormalized(), caff * pts);+  +  pts2 = pts1;+  pts2.row(Size).setRandom();+  VERIFY_IS_APPROX((aff  * pts2).colwise().hnormalized(), aff  * pts2.colwise().hnormalized());+  VERIFY_IS_APPROX((caff * pts2).colwise().hnormalized(), caff * pts2.colwise().hnormalized());+  VERIFY_IS_APPROX((proj * pts2).colwise().hnormalized(), (proj * pts2.colwise().hnormalized().colwise().homogeneous()).colwise().hnormalized());+  +  // Test combination of homogeneous+  +  VERIFY_IS_APPROX( (t2 * v0.homogeneous()).hnormalized(),+                       (t2.template topLeftCorner<Size,Size>() * v0 + t2.template topRightCorner<Size,1>())+                     / ((t2.template bottomLeftCorner<1,Size>()*v0).value() + t2(Size,Size)) );+  +  VERIFY_IS_APPROX( (t2 * pts.colwise().homogeneous()).colwise().hnormalized(),+                    (Matrix<Scalar, Size+1, Dynamic>(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<Lower>() * v0.homogeneous()).eval(), (t2.template triangularView<Lower>()*hv0) );+}++void test_geo_homogeneous()+{+  for(int i = 0; i < g_repeat; i++) {+    CALL_SUBTEST_1(( homogeneous<float,1>() ));+    CALL_SUBTEST_2(( homogeneous<double,3>() ));+    CALL_SUBTEST_3(( homogeneous<double,8>() ));+  }+}
+ eigen3/test/geo_hyperplane.cpp view
@@ -0,0 +1,197 @@+// This file is part of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2008 Gael Guennebaud <gael.guennebaud@inria.fr>+// Copyright (C) 2008 Benoit Jacob <jacob.benoit.1@gmail.com>+//+// 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 <Eigen/Geometry>+#include <Eigen/LU>+#include <Eigen/QR>++template<typename HyperplaneType> 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<Scalar, HyperplaneType::AmbientDimAtCompileTime, 1> VectorType;+  typedef Matrix<Scalar, HyperplaneType::AmbientDimAtCompileTime,+                         HyperplaneType::AmbientDimAtCompileTime> 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>();+  Scalar s1 = internal::random<Scalar>();++  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<Scalar>::IsComplex)+  {+    MatrixType rot = MatrixType::Random(dim,dim).householderQr().householderQ();+    DiagonalMatrix<Scalar,HyperplaneType::AmbientDimAtCompileTime> scaling(VectorType::Random());+    Translation<Scalar,HyperplaneType::AmbientDimAtCompileTime> translation(VectorType::Random());+    +    while(scaling.diagonal().cwiseAbs().minCoeff()<RealScalar(1e-4)) scaling.diagonal() = VectorType::Random();++    pl2 = pl1;+    VERIFY_IS_MUCH_SMALLER_THAN( pl2.transform(rot).absDistance(rot * p1), Scalar(1) );+    pl2 = pl1;+    VERIFY_IS_MUCH_SMALLER_THAN( pl2.transform(rot,Isometry).absDistance(rot * p1), Scalar(1) );+    pl2 = pl1;+    VERIFY_IS_MUCH_SMALLER_THAN( pl2.transform(rot*scaling).absDistance((rot*scaling) * p1), Scalar(1) );+    VERIFY_IS_APPROX( pl2.normal().norm(), RealScalar(1) );+    pl2 = pl1;+    VERIFY_IS_MUCH_SMALLER_THAN( pl2.transform(rot*scaling*translation)+                                  .absDistance((rot*scaling*translation) * p1), Scalar(1) );+    VERIFY_IS_APPROX( pl2.normal().norm(), RealScalar(1) );+    pl2 = pl1;+    VERIFY_IS_MUCH_SMALLER_THAN( pl2.transform(rot*translation,Isometry)+                                 .absDistance((rot*translation) * p1), Scalar(1) );+    VERIFY_IS_APPROX( pl2.normal().norm(), RealScalar(1) );+  }++  // casting+  const int Dim = HyperplaneType::AmbientDimAtCompileTime;+  typedef typename GetDifferentType<Scalar>::type OtherScalar;+  Hyperplane<OtherScalar,Dim,Options> hp1f = pl1.template cast<OtherScalar>();+  VERIFY_IS_APPROX(hp1f.template cast<Scalar>(),pl1);+  Hyperplane<Scalar,Dim,Options> hp1d = pl1.template cast<Scalar>();+  VERIFY_IS_APPROX(hp1d.template cast<Scalar>(),pl1);+}++template<typename Scalar> void lines()+{+  using std::abs;+  typedef Hyperplane<Scalar, 2> HLine;+  typedef ParametrizedLine<Scalar, 2> PLine;+  typedef Matrix<Scalar,2,1> Vector;+  typedef Matrix<Scalar,3,1> CoeffsType;++  for(int i = 0; i < 10; i++)+  {+    Vector center = Vector::Random();+    Vector u = Vector::Random();+    Vector v = Vector::Random();+    Scalar a = internal::random<Scalar>();+    while (abs(a-1) < Scalar(1e-4)) a = internal::random<Scalar>();+    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()))<Scalar(0.9))+      VERIFY_IS_APPROX(result, center);++    // check conversions between two types of lines+    PLine pl(line_u); // gcc 3.3 will commit suicide if we don't name this variable+    HLine line_u2(pl);+    CoeffsType converted_coeffs = line_u2.coeffs();+    if(line_u2.normal().dot(line_u.normal())<Scalar(0))+      converted_coeffs = -line_u2.coeffs();+    VERIFY(line_u.coeffs().isApprox(converted_coeffs));+  }+}++template<typename Scalar> void planes()+{+  using std::abs;+  typedef Hyperplane<Scalar, 3> Plane;+  typedef Matrix<Scalar,3,1> Vector;++  for(int i = 0; i < 10; i++)+  {+    Vector v0 = Vector::Random();+    Vector v1(v0), v2(v0);+    if(internal::random<double>(0,1)>0.25)+      v1 += Vector::Random();+    if(internal::random<double>(0,1)>0.25)+      v2 += v1 * std::pow(internal::random<Scalar>(0,1),internal::random<int>(1,16));+    if(internal::random<double>(0,1)>0.25)+      v2 += Vector::Random() * std::pow(internal::random<Scalar>(0,1),internal::random<int>(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<typename Scalar> void hyperplane_alignment()+{+  typedef Hyperplane<Scalar,3,AutoAlign> Plane3a;+  typedef Hyperplane<Scalar,3,DontAlign> 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<void*>(array1)) Plane3a;+  Plane3u *p2 = ::new(reinterpret_cast<void*>(array2)) Plane3u;+  Plane3u *p3 = ::new(reinterpret_cast<void*>(array3u)) Plane3u;+  +  p1->coeffs().setRandom();+  *p2 = *p1;+  *p3 = *p1;++  VERIFY_IS_APPROX(p1->coeffs(), p2->coeffs());+  VERIFY_IS_APPROX(p1->coeffs(), p3->coeffs());+  +  #if defined(EIGEN_VECTORIZE) && EIGEN_MAX_STATIC_ALIGN_BYTES > 0+  if(internal::packet_traits<Scalar>::Vectorizable && internal::packet_traits<Scalar>::size<=4)+    VERIFY_RAISES_ASSERT((::new(reinterpret_cast<void*>(array3u)) Plane3a));+  #endif+}+++void test_geo_hyperplane()+{+  for(int i = 0; i < g_repeat; i++) {+    CALL_SUBTEST_1( hyperplane(Hyperplane<float,2>()) );+    CALL_SUBTEST_2( hyperplane(Hyperplane<float,3>()) );+    CALL_SUBTEST_2( hyperplane(Hyperplane<float,3,DontAlign>()) );+    CALL_SUBTEST_2( hyperplane_alignment<float>() );+    CALL_SUBTEST_3( hyperplane(Hyperplane<double,4>()) );+    CALL_SUBTEST_4( hyperplane(Hyperplane<std::complex<double>,5>()) );+    CALL_SUBTEST_1( lines<float>() );+    CALL_SUBTEST_3( lines<double>() );+    CALL_SUBTEST_2( planes<float>() );+    CALL_SUBTEST_5( planes<double>() );+  }+}
+ eigen3/test/geo_orthomethods.cpp view
@@ -0,0 +1,133 @@+// This file is part of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2008-2009 Gael Guennebaud <gael.guennebaud@inria.fr>+//+// 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 <Eigen/Geometry>+#include <Eigen/LU>+#include <Eigen/SVD>++/* this test covers the following files:+   Geometry/OrthoMethods.h+*/++template<typename Scalar> void orthomethods_3()+{+  typedef typename NumTraits<Scalar>::Real RealScalar;+  typedef Matrix<Scalar,3,3> Matrix3;+  typedef Matrix<Scalar,3,1> Vector3;++  typedef Matrix<Scalar,4,1> 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<int>(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<RealScalar, 3, 1> RealVector3;+  RealVector3 rv1 = RealVector3::Random();+  VERIFY_IS_APPROX(v1.cross(rv1.template cast<Scalar>()), v1.cross(rv1));+  VERIFY_IS_APPROX(rv1.template cast<Scalar>().cross(v1), rv1.cross(v1));+}++template<typename Scalar, int Size> void orthomethods(int size=Size)+{+  typedef typename NumTraits<Scalar>::Real RealScalar;+  typedef Matrix<Scalar,Size,1> VectorType;+  typedef Matrix<Scalar,3,Size> Matrix3N;+  typedef Matrix<Scalar,Size,3> MatrixN3;+  typedef Matrix<Scalar,3,1> 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<int>(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));+}++void test_geo_orthomethods()+{+  for(int i = 0; i < g_repeat; i++) {+    CALL_SUBTEST_1( orthomethods_3<float>() );+    CALL_SUBTEST_2( orthomethods_3<double>() );+    CALL_SUBTEST_4( orthomethods_3<std::complex<double> >() );+    CALL_SUBTEST_1( (orthomethods<float,2>()) );+    CALL_SUBTEST_2( (orthomethods<double,2>()) );+    CALL_SUBTEST_1( (orthomethods<float,3>()) );+    CALL_SUBTEST_2( (orthomethods<double,3>()) );+    CALL_SUBTEST_3( (orthomethods<float,7>()) );+    CALL_SUBTEST_4( (orthomethods<std::complex<double>,8>()) );+    CALL_SUBTEST_5( (orthomethods<float,Dynamic>(36)) );+    CALL_SUBTEST_6( (orthomethods<double,Dynamic>(35)) );+  }+}
+ eigen3/test/geo_parametrizedline.cpp view
@@ -0,0 +1,103 @@+// This file is part of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2008 Gael Guennebaud <gael.guennebaud@inria.fr>+// Copyright (C) 2008 Benoit Jacob <jacob.benoit.1@gmail.com>+//+// 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 <Eigen/Geometry>+#include <Eigen/LU>+#include <Eigen/QR>++template<typename LineType> 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<Scalar>::Real RealScalar;+  typedef Matrix<Scalar, LineType::AmbientDimAtCompileTime, 1> VectorType;+  typedef Hyperplane<Scalar,LineType::AmbientDimAtCompileTime> HyperplaneType;++  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>();+  Scalar s1 = abs(internal::random<Scalar>());++  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<Scalar>::type OtherScalar;+  ParametrizedLine<OtherScalar,Dim> hp1f = l0.template cast<OtherScalar>();+  VERIFY_IS_APPROX(hp1f.template cast<Scalar>(),l0);+  ParametrizedLine<Scalar,Dim> hp1d = l0.template cast<Scalar>();+  VERIFY_IS_APPROX(hp1d.template cast<Scalar>(),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);+}++template<typename Scalar> void parametrizedline_alignment()+{+  typedef ParametrizedLine<Scalar,4,AutoAlign> Line4a;+  typedef ParametrizedLine<Scalar,4,DontAlign> 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<void*>(array1)) Line4a;+  Line4u *p2 = ::new(reinterpret_cast<void*>(array2)) Line4u;+  Line4u *p3 = ::new(reinterpret_cast<void*>(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());+  +  #if defined(EIGEN_VECTORIZE) && EIGEN_MAX_STATIC_ALIGN_BYTES>0+  if(internal::packet_traits<Scalar>::Vectorizable && internal::packet_traits<Scalar>::size<=4)+    VERIFY_RAISES_ASSERT((::new(reinterpret_cast<void*>(array3u)) Line4a));+  #endif+}++void test_geo_parametrizedline()+{+  for(int i = 0; i < g_repeat; i++) {+    CALL_SUBTEST_1( parametrizedline(ParametrizedLine<float,2>()) );+    CALL_SUBTEST_2( parametrizedline(ParametrizedLine<float,3>()) );+    CALL_SUBTEST_2( parametrizedline_alignment<float>() );+    CALL_SUBTEST_3( parametrizedline(ParametrizedLine<double,4>()) );+    CALL_SUBTEST_3( parametrizedline_alignment<double>() );+    CALL_SUBTEST_4( parametrizedline(ParametrizedLine<std::complex<double>,5>()) );+  }+}
+ eigen3/test/geo_quaternion.cpp view
@@ -0,0 +1,302 @@+// This file is part of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2008-2009 Gael Guennebaud <gael.guennebaud@inria.fr>+// Copyright (C) 2009 Mathieu Gautier <mathieu.gautier@cea.fr>+//+// 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 <Eigen/Geometry>+#include <Eigen/LU>+#include <Eigen/SVD>++template<typename T> T bounded_acos(T v)+{+  using std::acos;+  using std::min;+  using std::max;+  return acos((max)(T(-1),(min)(v,T(1))));+}++template<typename QuatType> void check_slerp(const QuatType& q0, const QuatType& q1)+{+  using std::abs;+  typedef typename QuatType::Scalar Scalar;+  typedef AngleAxis<Scalar> AA;++  Scalar largeEps = test_precision<Scalar>();++  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<typename Scalar, int Options> void quaternion(void)+{+  /* this test covers the following files:+     Quaternion.h+  */+  using std::abs;+  typedef Matrix<Scalar,3,1> Vector3;+  typedef Matrix<Scalar,3,3> Matrix3;+  typedef Quaternion<Scalar,Options> Quaternionx;+  typedef AngleAxis<Scalar> AngleAxisx;++  Scalar largeEps = test_precision<Scalar>();+  if (internal::is_same<Scalar,float>::value)+    largeEps = Scalar(1e-3);++  Scalar eps = internal::random<Scalar>() * Scalar(1e-2);++  Vector3 v0 = Vector3::Random(),+          v1 = Vector3::Random(),+          v2 = Vector3::Random(),+          v3 = Vector3::Random();++  Scalar  a = internal::random<Scalar>(-Scalar(EIGEN_PI), Scalar(EIGEN_PI)),+          b = internal::random<Scalar>(-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());++  // 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() > 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()) > 5*test_precision<Scalar>()+      && (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<Scalar,double>::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<Scalar,double>::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<float> q1f = q1.template cast<float>();+  VERIFY_IS_APPROX(q1f.template cast<Scalar>(),q1);+  Quaternion<double> q1d = q1.template cast<double>();+  VERIFY_IS_APPROX(q1d.template cast<Scalar>(),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<typename Scalar> void mapQuaternion(void){+  typedef Map<Quaternion<Scalar>, Aligned> MQuaternionA;+  typedef Map<const Quaternion<Scalar>, Aligned> MCQuaternionA;+  typedef Map<Quaternion<Scalar> > MQuaternionUA;+  typedef Map<const Quaternion<Scalar> > MCQuaternionUA;+  typedef Quaternion<Scalar> Quaternionx;+  typedef Matrix<Scalar,3,1> Vector3;+  typedef AngleAxis<Scalar> AngleAxisx;+  +  Vector3 v0 = Vector3::Random(),+          v1 = Vector3::Random();+  Scalar  a = internal::random<Scalar>(-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());+  #ifdef EIGEN_VECTORIZE+  if(internal::packet_traits<Scalar>::Vectorizable)+    VERIFY_RAISES_ASSERT((MQuaternionA(array3unaligned)));+  #endif+    +  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<const Quat>::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 wether we can return a coeff by reference or not, which is not enough for Map<const ...>.+  //const MCQuaternionUA& cmcq3(mcq3);+  //VERIFY( &cmcq3.x() == &mcq3.x() );+}++template<typename Scalar> void quaternionAlignment(void){+  typedef Quaternion<Scalar,AutoAlign> QuaternionA;+  typedef Quaternion<Scalar,DontAlign> 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<void*>(array1)) QuaternionA;+  QuaternionUA *q2 = ::new(reinterpret_cast<void*>(array2)) QuaternionUA;+  QuaternionUA *q3 = ::new(reinterpret_cast<void*>(arrayunaligned)) QuaternionUA;++  q1->coeffs().setRandom();+  *q2 = *q1;+  *q3 = *q1;++  VERIFY_IS_APPROX(q1->coeffs(), q2->coeffs());+  VERIFY_IS_APPROX(q1->coeffs(), q3->coeffs());+  #if defined(EIGEN_VECTORIZE) && EIGEN_MAX_STATIC_ALIGN_BYTES>0+  if(internal::packet_traits<Scalar>::Vectorizable && internal::packet_traits<Scalar>::size<=4)+    VERIFY_RAISES_ASSERT((::new(reinterpret_cast<void*>(arrayunaligned)) QuaternionA));+  #endif+}++template<typename PlainObjectType> 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<PlainObjectType>::type ConstPlainObjectType;+  VERIFY( !(internal::traits<Map<ConstPlainObjectType> >::Flags & LvalueBit) );+  VERIFY( !(internal::traits<Map<ConstPlainObjectType, Aligned> >::Flags & LvalueBit) );+  VERIFY( !(Map<ConstPlainObjectType>::Flags & LvalueBit) );+  VERIFY( !(Map<ConstPlainObjectType, Aligned>::Flags & LvalueBit) );+}++void test_geo_quaternion()+{+  for(int i = 0; i < g_repeat; i++) {+    CALL_SUBTEST_1(( quaternion<float,AutoAlign>() ));+    CALL_SUBTEST_1( check_const_correctness(Quaternionf()) );+    CALL_SUBTEST_2(( quaternion<double,AutoAlign>() ));+    CALL_SUBTEST_2( check_const_correctness(Quaterniond()) );+    CALL_SUBTEST_3(( quaternion<float,DontAlign>() ));+    CALL_SUBTEST_4(( quaternion<double,DontAlign>() ));+    CALL_SUBTEST_5(( quaternionAlignment<float>() ));+    CALL_SUBTEST_6(( quaternionAlignment<double>() ));+    CALL_SUBTEST_1( mapQuaternion<float>() );+    CALL_SUBTEST_2( mapQuaternion<double>() );+  }+}
+ eigen3/test/geo_transformations.cpp view
@@ -0,0 +1,645 @@+// This file is part of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2008-2009 Gael Guennebaud <gael.guennebaud@inria.fr>+//+// 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 <Eigen/Geometry>+#include <Eigen/LU>+#include <Eigen/SVD>++template<typename T>+Matrix<T,2,1> angleToVec(T a)+{+  return Matrix<T,2,1>(std::cos(a), std::sin(a));+}++// This permits to workaround a bug in clang/llvm code generation.+template<typename T>+EIGEN_DONT_INLINE+void dont_over_optimize(T& x) { volatile typename T::Scalar tmp = x(0); x(0) = tmp; }++template<typename Scalar, int Mode, int Options> void non_projective_only()+{+    /* this test covers the following files:+     Cross.h Quaternion.h, Transform.cpp+  */+  typedef Matrix<Scalar,3,1> Vector3;+  typedef Quaternion<Scalar> Quaternionx;+  typedef AngleAxis<Scalar> AngleAxisx;+  typedef Transform<Scalar,3,Mode,Options> Transform3;+  typedef DiagonalMatrix<Scalar,3> AlignedScaling3;+  typedef Translation<Scalar,3> Translation3;++  Vector3 v0 = Vector3::Random(),+          v1 = Vector3::Random();++  Transform3 t0, t1, t2;++  Scalar a = internal::random<Scalar>(-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<Scalar>()));++  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<typename Scalar, int Mode, int Options> void transformations()+{+  /* this test covers the following files:+     Cross.h Quaternion.h, Transform.cpp+  */+  using std::cos;+  using std::abs;+  typedef Matrix<Scalar,3,3> Matrix3;+  typedef Matrix<Scalar,4,4> Matrix4;+  typedef Matrix<Scalar,2,1> Vector2;+  typedef Matrix<Scalar,3,1> Vector3;+  typedef Matrix<Scalar,4,1> Vector4;+  typedef Quaternion<Scalar> Quaternionx;+  typedef AngleAxis<Scalar> AngleAxisx;+  typedef Transform<Scalar,2,Mode,Options> Transform2;+  typedef Transform<Scalar,3,Mode,Options> Transform3;+  typedef typename Transform3::MatrixType MatrixType;+  typedef DiagonalMatrix<Scalar,3> AlignedScaling3;+  typedef Translation<Scalar,2> Translation2;+  typedef Translation<Scalar,3> Translation3;++  Vector3 v0 = Vector3::Random(),+          v1 = Vector3::Random();+  Matrix3 matrot1, m;++  Scalar a = internal::random<Scalar>(-Scalar(EIGEN_PI), Scalar(EIGEN_PI));+  Scalar s0 = internal::random<Scalar>(), s1 = internal::random<Scalar>();+  +  while(v0.norm() < test_precision<Scalar>()) v0 = Vector3::Random();+  while(v1.norm() < test_precision<Scalar>()) 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<Scalar>())+  {+    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<Scalar>()) && (abs(aa.axis().dot(v1.normalized()))<(Scalar(1)-Scalar(4)*test_precision<Scalar>())) )+  {+    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<Scalar>()) && (abs(aa.axis().dot(v1.normalized()))<(Scalar(1)-Scalar(4)*test_precision<Scalar>())) )+  {+    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.1))+    a = internal::random<Scalar>(-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<Scalar>()));++  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>(-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()<NumTraits<Scalar>::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])<Scalar(1e-3)) v21[k] = Scalar(1e-3);+  t21.setIdentity();+  t21.linear() = Rotation2D<Scalar>(a).toRotationMatrix();+  VERIFY_IS_APPROX(t20.fromPositionOrientationScale(v20,a,v21).matrix(),+    t21.pretranslate(v20).scale(v21).matrix());++  t21.setIdentity();+  t21.linear() = Rotation2D<Scalar>(-a).toRotationMatrix();+  VERIFY( (t20.fromPositionOrientationScale(v20,a,v21)+        * (t21.prescale(v21.cwiseInverse()).translate(-v20))).matrix().isIdentity(test_precision<Scalar>()) );++  // 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)<test_precision<Scalar>());+  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<float,3,Mode> t1f = t1.template cast<float>();+  VERIFY_IS_APPROX(t1f.template cast<Scalar>(),t1);+  Transform<double,3,Mode> t1d = t1.template cast<double>();+  VERIFY_IS_APPROX(t1d.template cast<Scalar>(),t1);++  Translation3 tr1(v0);+  Translation<float,3> tr1f = tr1.template cast<float>();+  VERIFY_IS_APPROX(tr1f.template cast<Scalar>(),tr1);+  Translation<double,3> tr1d = tr1.template cast<double>();+  VERIFY_IS_APPROX(tr1d.template cast<Scalar>(),tr1);++  AngleAxis<float> aa1f = aa1.template cast<float>();+  VERIFY_IS_APPROX(aa1f.template cast<Scalar>(),aa1);+  AngleAxis<double> aa1d = aa1.template cast<double>();+  VERIFY_IS_APPROX(aa1d.template cast<Scalar>(),aa1);++  Rotation2D<Scalar> r2d1(internal::random<Scalar>());+  Rotation2D<float> r2d1f = r2d1.template cast<float>();+  VERIFY_IS_APPROX(r2d1f.template cast<Scalar>(),r2d1);+  Rotation2D<double> r2d1d = r2d1.template cast<double>();+  VERIFY_IS_APPROX(r2d1d.template cast<Scalar>(),r2d1);+  +  for(int k=0; k<100; ++k)+  {+    Scalar angle = internal::random<Scalar>(-100,100);+    Rotation2D<Scalar> 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<Scalar,2,2> rot2_as_mat(rot2);+    Rotation2D<Scalar> rot3(rot2_as_mat);+    VERIFY_IS_APPROX( angleToVec(rot2.smallestAngle()),  angleToVec(rot3.angle()) );+  }++  s0 = internal::random<Scalar>(-100,100);+  s1 = internal::random<Scalar>(-100,100);+  Rotation2D<Scalar> 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<path_steps; ++k)+  {+    Scalar a1 = R0.slerp(Scalar(k)/Scalar(path_steps), R1).angle();+    Scalar a2 = R0.slerp(Scalar(k+1)/Scalar(path_steps), R1).angle();+    l += std::abs(a2-a1);+  }+  VERIFY(l<=Scalar(EIGEN_PI)*(Scalar(1)+NumTraits<Scalar>::epsilon()*Scalar(path_steps/2)));+  +  // check basic features+  {+    Rotation2D<Scalar> r1;           // default ctor+    r1 = Rotation2D<Scalar>(s0);     // copy assignment+    VERIFY_IS_APPROX(r1.angle(),s0);+    Rotation2D<Scalar> 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<typename A1, typename A2, typename P, typename Q, typename V, typename H>+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<typename A1, typename A2, typename P, typename Q, typename V, typename H>+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<typename Scalar, int Dim, int Options,typename RotationType>+void transform_associativity(const RotationType& R)+{+  typedef Matrix<Scalar,Dim,1> VectorType;+  typedef Matrix<Scalar,Dim+1,1> HVectorType;+  typedef Matrix<Scalar,Dim,Dim> LinearType;+  typedef Matrix<Scalar,Dim+1,Dim+1> MatrixType;+  typedef Transform<Scalar,Dim,AffineCompact,Options> AffineCompactType;+  typedef Transform<Scalar,Dim,Affine,Options> AffineType;+  typedef Transform<Scalar,Dim,Projective,Options> ProjectiveType;+  typedef DiagonalMatrix<Scalar,Dim> ScalingType;+  typedef Translation<Scalar,Dim> 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<Scalar>();+  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<typename Scalar> void transform_alignment()+{+  typedef Transform<Scalar,3,Projective,AutoAlign> Projective3a;+  typedef Transform<Scalar,3,Projective,DontAlign> 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<void*>(array1)) Projective3a;+  Projective3u *p2 = ::new(reinterpret_cast<void*>(array2)) Projective3u;+  Projective3u *p3 = ::new(reinterpret_cast<void*>(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));+  +  #if defined(EIGEN_VECTORIZE) && EIGEN_MAX_STATIC_ALIGN_BYTES>0+  if(internal::packet_traits<Scalar>::Vectorizable)+    VERIFY_RAISES_ASSERT((::new(reinterpret_cast<void*>(array3u)) Projective3a));+  #endif+}++template<typename Scalar, int Dim, int Options> void transform_products()+{+  typedef Matrix<Scalar,Dim+1,Dim+1> Mat;+  typedef Transform<Scalar,Dim,Projective,Options> Proj;+  typedef Transform<Scalar,Dim,Affine,Options> Aff;+  typedef Transform<Scalar,Dim,AffineCompact,Options> 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);+}++void test_geo_transformations()+{+  for(int i = 0; i < g_repeat; i++) {+    CALL_SUBTEST_1(( transformations<double,Affine,AutoAlign>() ));+    CALL_SUBTEST_1(( non_projective_only<double,Affine,AutoAlign>() ));+    +    CALL_SUBTEST_2(( transformations<float,AffineCompact,AutoAlign>() ));+    CALL_SUBTEST_2(( non_projective_only<float,AffineCompact,AutoAlign>() ));+    CALL_SUBTEST_2(( transform_alignment<float>() ));+    +    CALL_SUBTEST_3(( transformations<double,Projective,AutoAlign>() ));+    CALL_SUBTEST_3(( transformations<double,Projective,DontAlign>() ));+    CALL_SUBTEST_3(( transform_alignment<double>() ));+    +    CALL_SUBTEST_4(( transformations<float,Affine,RowMajor|AutoAlign>() ));+    CALL_SUBTEST_4(( non_projective_only<float,Affine,RowMajor>() ));+    +    CALL_SUBTEST_5(( transformations<double,AffineCompact,RowMajor|AutoAlign>() ));+    CALL_SUBTEST_5(( non_projective_only<double,AffineCompact,RowMajor>() ));++    CALL_SUBTEST_6(( transformations<double,Projective,RowMajor|AutoAlign>() ));+    CALL_SUBTEST_6(( transformations<double,Projective,RowMajor|DontAlign>() ));+++    CALL_SUBTEST_7(( transform_products<double,3,RowMajor|AutoAlign>() ));+    CALL_SUBTEST_7(( transform_products<float,2,AutoAlign>() ));++    CALL_SUBTEST_8(( transform_associativity<double,2,ColMajor>(Rotation2D<double>(internal::random<double>()*double(EIGEN_PI))) ));+    CALL_SUBTEST_8(( transform_associativity<double,3,ColMajor>(Quaterniond::UnitRandom()) ));+  }+}
+ eigen3/test/half_float.cpp view
@@ -0,0 +1,268 @@+// 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 <sstream>++#include "main.h"++#include <Eigen/src/Core/arch/CUDA/Half.h>++#ifdef EIGEN_HAS_CUDA_FP16+#error "EIGEN_HAS_CUDA_FP16 should not be defined in this CPU unit test"+#endif++// Make sure it's possible to forward declare Eigen::half+namespace Eigen {+struct half;+}++using Eigen::half;++void test_conversion()+{+  using Eigen::half_impl::__half_raw;++  // Conversion from float.+  VERIFY_IS_EQUAL(half(1.0f).x, 0x3c00);+  VERIFY_IS_EQUAL(half(0.5f).x, 0x3800);+  VERIFY_IS_EQUAL(half(0.33333f).x, 0x3555);+  VERIFY_IS_EQUAL(half(0.0f).x, 0x0000);+  VERIFY_IS_EQUAL(half(-0.0f).x, 0x8000);+  VERIFY_IS_EQUAL(half(65504.0f).x, 0x7bff);+  VERIFY_IS_EQUAL(half(65536.0f).x, 0x7c00);  // Becomes infinity.++  // Denormals.+  VERIFY_IS_EQUAL(half(-5.96046e-08f).x, 0x8001);+  VERIFY_IS_EQUAL(half(5.96046e-08f).x, 0x0001);+  VERIFY_IS_EQUAL(half(1.19209e-07f).x, 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_IS_EQUAL(half(0.5f * (val1 + val2)).x, 0x3c00);+  VERIFY_IS_EQUAL(half(0.5f * (val2 + val3)).x, 0x3c02);++  // Conversion from int.+  VERIFY_IS_EQUAL(half(-1).x, 0xbc00);+  VERIFY_IS_EQUAL(half(0).x, 0x0000);+  VERIFY_IS_EQUAL(half(1).x, 0x3c00);+  VERIFY_IS_EQUAL(half(2).x, 0x4000);+  VERIFY_IS_EQUAL(half(3).x, 0x4200);++  // Conversion from bool.+  VERIFY_IS_EQUAL(half(false).x, 0x0000);+  VERIFY_IS_EQUAL(half(true).x, 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+}++void test_numtraits()+{+  std::cout << "epsilon       = " << NumTraits<half>::epsilon() << "  (0x" << std::hex << NumTraits<half>::epsilon().x << ")" << std::endl;+  std::cout << "highest       = " << NumTraits<half>::highest() << "  (0x" << std::hex << NumTraits<half>::highest().x << ")" << std::endl;+  std::cout << "lowest        = " << NumTraits<half>::lowest() << "  (0x" << std::hex << NumTraits<half>::lowest().x << ")" << std::endl;+  std::cout << "min           = " << (std::numeric_limits<half>::min)() << "  (0x" << std::hex << half((std::numeric_limits<half>::min)()).x << ")" << std::endl;+  std::cout << "denorm min    = " << (std::numeric_limits<half>::denorm_min)() << "  (0x" << std::hex << half((std::numeric_limits<half>::denorm_min)()).x << ")" << std::endl;+  std::cout << "infinity      = " << NumTraits<half>::infinity() << "  (0x" << std::hex << NumTraits<half>::infinity().x << ")" << std::endl;+  std::cout << "quiet nan     = " << NumTraits<half>::quiet_NaN() << "  (0x" << std::hex << NumTraits<half>::quiet_NaN().x << ")" << std::endl;+  std::cout << "signaling nan = " << std::numeric_limits<half>::signaling_NaN() << "  (0x" << std::hex << std::numeric_limits<half>::signaling_NaN().x << ")" << std::endl;++  VERIFY(NumTraits<half>::IsSigned);++  VERIFY_IS_EQUAL( std::numeric_limits<half>::infinity().x, half(std::numeric_limits<float>::infinity()).x );+  VERIFY_IS_EQUAL( std::numeric_limits<half>::quiet_NaN().x, half(std::numeric_limits<float>::quiet_NaN()).x );+  VERIFY_IS_EQUAL( std::numeric_limits<half>::signaling_NaN().x, half(std::numeric_limits<float>::signaling_NaN()).x );+  VERIFY( (std::numeric_limits<half>::min)() > half(0.f) );+  VERIFY( (std::numeric_limits<half>::denorm_min)() > half(0.f) );+  VERIFY( (std::numeric_limits<half>::min)()/half(2) > half(0.f) );+  VERIFY_IS_EQUAL( (std::numeric_limits<half>::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);+}++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::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);+}++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<half,1,Dynamic> ArrayXh;+  Index size = internal::random<Index>(1,10);+  Index i = internal::random<Index>(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_half_float()+{+  CALL_SUBTEST(test_conversion());+  CALL_SUBTEST(test_numtraits());+  CALL_SUBTEST(test_arithmetic());+  CALL_SUBTEST(test_comparison());+  CALL_SUBTEST(test_basic_functions());+  CALL_SUBTEST(test_trigonometric_functions());+  CALL_SUBTEST(test_array());+}
+ eigen3/test/hessenberg.cpp view
@@ -0,0 +1,62 @@+// This file is part of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2009 Gael Guennebaud <gael.guennebaud@inria.fr>+// Copyright (C) 2010 Jitse Niesen <jitse@maths.leeds.ac.uk>+//+// 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 <Eigen/Eigenvalues>++template<typename Scalar,int Size> void hessenberg(int size = Size)+{+  typedef Matrix<Scalar,Size,Size> 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<MatrixType> 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<MatrixType> cs1;+  cs1.compute(A);+  HessenbergDecomposition<MatrixType> 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<MatrixType> 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()+}++void test_hessenberg()+{+  CALL_SUBTEST_1(( hessenberg<std::complex<double>,1>() ));+  CALL_SUBTEST_2(( hessenberg<std::complex<double>,2>() ));+  CALL_SUBTEST_3(( hessenberg<std::complex<float>,4>() ));+  CALL_SUBTEST_4(( hessenberg<float,Dynamic>(internal::random<int>(1,EIGEN_TEST_MAX_SIZE)) ));+  CALL_SUBTEST_5(( hessenberg<std::complex<double>,Dynamic>(internal::random<int>(1,EIGEN_TEST_MAX_SIZE)) ));++  // Test problem size constructors+  CALL_SUBTEST_6(HessenbergDecomposition<MatrixXf>(10));+}
+ eigen3/test/householder.cpp view
@@ -0,0 +1,137 @@+// This file is part of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2009-2010 Benoit Jacob <jacob.benoit.1@gmail.com>+//+// 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 <Eigen/QR>++template<typename MatrixType> 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<Scalar>::Real RealScalar;+  typedef Matrix<Scalar, MatrixType::RowsAtCompileTime, 1> VectorType;+  typedef Matrix<Scalar, internal::decrement_size<MatrixType::RowsAtCompileTime>::ret, 1> EssentialVectorType;+  typedef Matrix<Scalar, MatrixType::RowsAtCompileTime, MatrixType::RowsAtCompileTime> SquareMatrixType;+  typedef Matrix<Scalar, Dynamic, MatrixType::ColsAtCompileTime> HBlockMatrixType;+  typedef Matrix<Scalar, Dynamic, 1> HCoeffsVectorType;++  typedef Matrix<Scalar, MatrixType::ColsAtCompileTime, MatrixType::RowsAtCompileTime> TMatrixType;+  +  Matrix<Scalar, EIGEN_SIZE_MAX(MatrixType::RowsAtCompileTime,MatrixType::ColsAtCompileTime), 1> _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());++  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,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<Index>(0, std::max<Index>(rows-2,0));+  Index brows = rows - shift;+  m1.setRandom(rows, cols);+  HBlockMatrixType hbm = m1.block(shift,0,brows,cols);+  HouseholderQR<HBlockMatrixType> qr(hbm);+  m2 = m1;+  m2.block(shift,0,brows,cols) = qr.matrixQR();+  HCoeffsVectorType hc = qr.hCoeffs().conjugate();+  HouseholderSequence<MatrixType, HCoeffsVectorType> 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<StrictlyLower>().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_mat * m6,             hseq_mat * m6);+  VERIFY_IS_APPROX(hseq_mat.adjoint() * m6,   hseq_mat_adj * m6);+  VERIFY_IS_APPROX(hseq_mat.conjugate() * m6, hseq_mat_conj * m6);+  VERIFY_IS_APPROX(hseq_mat.transpose() * m6, hseq_mat_trans * m6);+  VERIFY_IS_APPROX(m6 * hseq_mat,             m6 * hseq_mat);+  VERIFY_IS_APPROX(m6 * hseq_mat.adjoint(),   m6 * hseq_mat_adj);+  VERIFY_IS_APPROX(m6 * hseq_mat.conjugate(), m6 * hseq_mat_conj);+  VERIFY_IS_APPROX(m6 * hseq_mat.transpose(), m6 * hseq_mat_trans);++  // test householder sequence on the right with a shift++  TMatrixType tm2 = m2.transpose();+  HouseholderSequence<TMatrixType, HCoeffsVectorType, OnTheRight> 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+}++void test_householder()+{+  for(int i = 0; i < g_repeat; i++) {+    CALL_SUBTEST_1( householder(Matrix<double,2,2>()) );+    CALL_SUBTEST_2( householder(Matrix<float,2,3>()) );+    CALL_SUBTEST_3( householder(Matrix<double,3,5>()) );+    CALL_SUBTEST_4( householder(Matrix<float,4,4>()) );+    CALL_SUBTEST_5( householder(MatrixXd(internal::random<int>(1,EIGEN_TEST_MAX_SIZE),internal::random<int>(1,EIGEN_TEST_MAX_SIZE))) );+    CALL_SUBTEST_6( householder(MatrixXcf(internal::random<int>(1,EIGEN_TEST_MAX_SIZE),internal::random<int>(1,EIGEN_TEST_MAX_SIZE))) );+    CALL_SUBTEST_7( householder(MatrixXf(internal::random<int>(1,EIGEN_TEST_MAX_SIZE),internal::random<int>(1,EIGEN_TEST_MAX_SIZE))) );+    CALL_SUBTEST_8( householder(Matrix<double,1,1>()) );+  }+}
+ eigen3/test/incomplete_cholesky.cpp view
@@ -0,0 +1,65 @@+// This file is part of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2015-2016 Gael Guennebaud <gael.guennebaud@inria.fr>+//+// 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 <Eigen/IterativeLinearSolvers>+#include <unsupported/Eigen/IterativeSolvers>++template<typename T, typename I> void test_incomplete_cholesky_T()+{+  typedef SparseMatrix<T,0,I> SparseMatrixType;+  ConjugateGradient<SparseMatrixType, Lower, IncompleteCholesky<T, Lower, AMDOrdering<I> > >        cg_illt_lower_amd;+  ConjugateGradient<SparseMatrixType, Lower, IncompleteCholesky<T, Lower, NaturalOrdering<I> > >    cg_illt_lower_nat;+  ConjugateGradient<SparseMatrixType, Upper, IncompleteCholesky<T, Upper, AMDOrdering<I> > >        cg_illt_upper_amd;+  ConjugateGradient<SparseMatrixType, Upper, IncompleteCholesky<T, Upper, NaturalOrdering<I> > >    cg_illt_upper_nat;+  ConjugateGradient<SparseMatrixType, Upper|Lower, IncompleteCholesky<T, Lower, AMDOrdering<I> > >  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) );+}++void test_incomplete_cholesky()+{+  CALL_SUBTEST_1(( test_incomplete_cholesky_T<double,int>() ));+  CALL_SUBTEST_2(( test_incomplete_cholesky_T<std::complex<double>, int>() ));+  CALL_SUBTEST_3(( test_incomplete_cholesky_T<double,long int>() ));++#ifdef EIGEN_TEST_PART_1+    // regression for bug 1150+  for(int N = 1; N<20; ++N)+  {+    Eigen::MatrixXd b( N, N );+    b.setOnes();++    Eigen::SparseMatrix<double> 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<double> A;+    A = m * m.transpose();++    Eigen::ConjugateGradient<Eigen::SparseMatrix<double>,+        Eigen::Lower | Eigen::Upper,+        Eigen::IncompleteCholesky<double> > solver( A );+    VERIFY(solver.preconditioner().info() == Eigen::Success);+    VERIFY(solver.info() == Eigen::Success);+  }+#endif+}
+ eigen3/test/inplace_decomposition.cpp view
@@ -0,0 +1,110 @@+// This file is part of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2016 Gael Guennebaud <gael.guennebaud@inria.fr>+//+// 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 <Eigen/LU>+#include <Eigen/Cholesky>+#include <Eigen/QR>++// This file test inplace decomposition through Ref<>, as supported by Cholesky, LU, and QR decompositions.++template<typename DecType,typename MatrixType> void inplace(bool square = false, bool SPD = false)+{+  typedef typename MatrixType::Scalar Scalar;+  typedef Matrix<Scalar, MatrixType::RowsAtCompileTime, 1> RhsType;+  typedef Matrix<Scalar, MatrixType::ColsAtCompileTime, 1> ResType;++  Index rows = MatrixType::RowsAtCompileTime==Dynamic ? internal::random<Index>(2,EIGEN_TEST_MAX_SIZE/2) : Index(MatrixType::RowsAtCompileTime);+  Index cols = MatrixType::ColsAtCompileTime==Dynamic ? (square?rows:internal::random<Index>(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 );+  }+}+++void test_inplace_decomposition()+{+  EIGEN_UNUSED typedef Matrix<double,4,3> Matrix43d;+  for(int i = 0; i < g_repeat; i++) {+    CALL_SUBTEST_1(( inplace<LLT<Ref<MatrixXd> >, MatrixXd>(true,true) ));+    CALL_SUBTEST_1(( inplace<LLT<Ref<Matrix4d> >, Matrix4d>(true,true) ));++    CALL_SUBTEST_2(( inplace<LDLT<Ref<MatrixXd> >, MatrixXd>(true,true) ));+    CALL_SUBTEST_2(( inplace<LDLT<Ref<Matrix4d> >, Matrix4d>(true,true) ));++    CALL_SUBTEST_3(( inplace<PartialPivLU<Ref<MatrixXd> >, MatrixXd>(true,false) ));+    CALL_SUBTEST_3(( inplace<PartialPivLU<Ref<Matrix4d> >, Matrix4d>(true,false) ));++    CALL_SUBTEST_4(( inplace<FullPivLU<Ref<MatrixXd> >, MatrixXd>(true,false) ));+    CALL_SUBTEST_4(( inplace<FullPivLU<Ref<Matrix4d> >, Matrix4d>(true,false) ));++    CALL_SUBTEST_5(( inplace<HouseholderQR<Ref<MatrixXd> >, MatrixXd>(false,false) ));+    CALL_SUBTEST_5(( inplace<HouseholderQR<Ref<Matrix43d> >, Matrix43d>(false,false) ));++    CALL_SUBTEST_6(( inplace<ColPivHouseholderQR<Ref<MatrixXd> >, MatrixXd>(false,false) ));+    CALL_SUBTEST_6(( inplace<ColPivHouseholderQR<Ref<Matrix43d> >, Matrix43d>(false,false) ));++    CALL_SUBTEST_7(( inplace<FullPivHouseholderQR<Ref<MatrixXd> >, MatrixXd>(false,false) ));+    CALL_SUBTEST_7(( inplace<FullPivHouseholderQR<Ref<Matrix43d> >, Matrix43d>(false,false) ));++    CALL_SUBTEST_8(( inplace<CompleteOrthogonalDecomposition<Ref<MatrixXd> >, MatrixXd>(false,false) ));+    CALL_SUBTEST_8(( inplace<CompleteOrthogonalDecomposition<Ref<Matrix43d> >, Matrix43d>(false,false) ));+  }+}
+ eigen3/test/integer_types.cpp view
@@ -0,0 +1,167 @@+// This file is part of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2010 Benoit Jacob <jacob.benoit.1@gmail.com>+//+// 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<typename MatrixType> 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<Scalar>();+  } 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<typename MatrixType> void integer_type_tests(const MatrixType& m)+{+  typedef typename MatrixType::Scalar Scalar;++  VERIFY(NumTraits<Scalar>::IsInteger);+  enum { is_signed = (Scalar(-1) > Scalar(0)) ? 0 : 1 };+  VERIFY(int(NumTraits<Scalar>::IsSigned) == is_signed);++  typedef Matrix<Scalar, MatrixType::RowsAtCompileTime, 1> 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<Scalar, MatrixType::RowsAtCompileTime, MatrixType::RowsAtCompileTime> 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<const MatrixType&>(m3).real(), static_cast<const MatrixType&>(m1).real());+  VERIFY_IS_APPROX(static_cast<const MatrixType&>(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<Scalar>();+  } 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));+}++void test_integer_types()+{+  for(int i = 0; i < g_repeat; i++) {+    CALL_SUBTEST_1( integer_type_tests(Matrix<unsigned int, 1, 1>()) );+    CALL_SUBTEST_1( integer_type_tests(Matrix<unsigned long, 3, 4>()) );++    CALL_SUBTEST_2( integer_type_tests(Matrix<long, 2, 2>()) );+    CALL_SUBTEST_2( signed_integer_type_tests(Matrix<long, 2, 2>()) );++    CALL_SUBTEST_3( integer_type_tests(Matrix<char, 2, Dynamic>(2, 10)) );+    CALL_SUBTEST_3( signed_integer_type_tests(Matrix<signed char, 2, Dynamic>(2, 10)) );++    CALL_SUBTEST_4( integer_type_tests(Matrix<unsigned char, 3, 3>()) );+    CALL_SUBTEST_4( integer_type_tests(Matrix<unsigned char, Dynamic, Dynamic>(20, 20)) );++    CALL_SUBTEST_5( integer_type_tests(Matrix<short, Dynamic, 4>(7, 4)) );+    CALL_SUBTEST_5( signed_integer_type_tests(Matrix<short, Dynamic, 4>(7, 4)) );++    CALL_SUBTEST_6( integer_type_tests(Matrix<unsigned short, 4, 4>()) );++    CALL_SUBTEST_7( integer_type_tests(Matrix<long long, 11, 13>()) );+    CALL_SUBTEST_7( signed_integer_type_tests(Matrix<long long, 11, 13>()) );++    CALL_SUBTEST_8( integer_type_tests(Matrix<unsigned long long, Dynamic, 5>(1, 5)) );+  }+#ifdef EIGEN_TEST_PART_9+  VERIFY_IS_EQUAL(internal::scalar_div_cost<int>::value, 8);+  VERIFY_IS_EQUAL(internal::scalar_div_cost<unsigned int>::value, 8);+  if(sizeof(long)>sizeof(int)) {+    VERIFY(int(internal::scalar_div_cost<long>::value) > int(internal::scalar_div_cost<int>::value));+    VERIFY(int(internal::scalar_div_cost<unsigned long>::value) > int(internal::scalar_div_cost<int>::value));+  }+#endif+}
+ eigen3/test/inverse.cpp view
@@ -0,0 +1,118 @@+// This file is part of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2008 Gael Guennebaud <gael.guennebaud@inria.fr>+// Copyright (C) 2008 Benoit Jacob <jacob.benoit.1@gmail.com>+//+// 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 <Eigen/LU>++template<typename MatrixType> void inverse(const MatrixType& m)+{+  using std::abs;+  /* 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()));++#if !defined(EIGEN_TEST_PART_5) && !defined(EIGEN_TEST_PART_6)+  typedef typename NumTraits<Scalar>::Real RealScalar;+  typedef Matrix<Scalar, MatrixType::ColsAtCompileTime, 1> 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(rows);+  MatrixType m3 = v3*v3.transpose(), m4(rows,cols);+  m3.computeInverseAndDetWithCheck(m4, det, invertible);+  VERIFY( rows==1 ? invertible : !invertible );+  VERIFY_IS_MUCH_SMALLER_THAN(abs(det-m3.determinant()), RealScalar(1));+  m3.computeInverseWithCheck(m4, invertible);+  VERIFY( rows==1 ? invertible : !invertible );+  +  // check with submatrices+  {+    Matrix<Scalar, MatrixType::RowsAtCompileTime+1, MatrixType::RowsAtCompileTime+1, MatrixType::Options> m5;+    m5.setRandom();+    m5.topLeftCorner(rows,rows) = m1;+    m2 = m5.template topLeftCorner<MatrixType::RowsAtCompileTime,MatrixType::ColsAtCompileTime>().inverse();+    VERIFY_IS_APPROX( (m5.template topLeftCorner<MatrixType::RowsAtCompileTime,MatrixType::ColsAtCompileTime>()), m2.inverse() );+  }+#endif++  // 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);+  }+}++void test_inverse()+{+  int s = 0;+  for(int i = 0; i < g_repeat; i++) {+    CALL_SUBTEST_1( inverse(Matrix<double,1,1>()) );+    CALL_SUBTEST_2( inverse(Matrix2d()) );+    CALL_SUBTEST_3( inverse(Matrix3f()) );+    CALL_SUBTEST_4( inverse(Matrix4f()) );+    CALL_SUBTEST_4( inverse(Matrix<float,4,4,DontAlign>()) );+    +    s = internal::random<int>(50,320); +    CALL_SUBTEST_5( inverse(MatrixXf(s,s)) );+    TEST_SET_BUT_UNUSED_VARIABLE(s)+    +    s = internal::random<int>(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<double,4,4,DontAlign>()) );++    CALL_SUBTEST_8( inverse(Matrix4cd()) );+  }+}
+ eigen3/test/is_same_dense.cpp view
@@ -0,0 +1,33 @@+// This file is part of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2015 Gael Guennebaud <gael.guennebaud@inria.fr>+//+// 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;++void test_is_same_dense()+{+  typedef Matrix<double,Dynamic,Dynamic,ColMajor> ColMatrixXd;+  ColMatrixXd m1(10,10);+  Ref<ColMatrixXd> ref_m1(m1);+  Ref<const ColMatrixXd> 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 ColMatrixXd> const_ref_m1_row(m1.row(1));+  VERIFY(!is_same_dense(m1.row(1),const_ref_m1_row));+  +  Ref<const ColMatrixXd> const_ref_m1_col(m1.col(1));+  VERIFY(is_same_dense(m1.col(1),const_ref_m1_col));+}
+ eigen3/test/jacobi.cpp view
@@ -0,0 +1,80 @@+// This file is part of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2008 Gael Guennebaud <gael.guennebaud@inria.fr>+// Copyright (C) 2009 Benoit Jacob <jacob.benoit.1@gmail.com>+//+// 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 <Eigen/SVD>++template<typename MatrixType, typename JacobiScalar>+void jacobi(const MatrixType& m = MatrixType())+{+  Index rows = m.rows();+  Index cols = m.cols();++  enum {+    RowsAtCompileTime = MatrixType::RowsAtCompileTime,+    ColsAtCompileTime = MatrixType::ColsAtCompileTime+  };++  typedef Matrix<JacobiScalar, 2, 1> JacobiVector;++  const MatrixType a(MatrixType::Random(rows, cols));++  JacobiVector v = JacobiVector::Random().normalized();+  JacobiScalar c = v.x(), s = v.y();+  JacobiRotation<JacobiScalar> rot(c, s);++  {+    Index p = internal::random<Index>(0, rows-1);+    Index q;+    do {+      q = internal::random<Index>(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<Index>(0, cols-1);+    Index q;+    do {+      q = internal::random<Index>(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));+  }+}++void test_jacobi()+{+  for(int i = 0; i < g_repeat; i++) {+    CALL_SUBTEST_1(( jacobi<Matrix3f, float>() ));+    CALL_SUBTEST_2(( jacobi<Matrix4d, double>() ));+    CALL_SUBTEST_3(( jacobi<Matrix4cf, float>() ));+    CALL_SUBTEST_3(( jacobi<Matrix4cf, std::complex<float> >() ));++    int r = internal::random<int>(2, internal::random<int>(1,EIGEN_TEST_MAX_SIZE)/2),+        c = internal::random<int>(2, internal::random<int>(1,EIGEN_TEST_MAX_SIZE)/2);+    CALL_SUBTEST_4(( jacobi<MatrixXf, float>(MatrixXf(r,c)) ));+    CALL_SUBTEST_5(( jacobi<MatrixXcd, double>(MatrixXcd(r,c)) ));+    CALL_SUBTEST_5(( jacobi<MatrixXcd, std::complex<double> >(MatrixXcd(r,c)) ));+    // complex<float> is really important to test as it is the only way to cover conjugation issues in certain unaligned paths+    CALL_SUBTEST_6(( jacobi<MatrixXcf, float>(MatrixXcf(r,c)) ));+    CALL_SUBTEST_6(( jacobi<MatrixXcf, std::complex<float> >(MatrixXcf(r,c)) ));+    +    TEST_SET_BUT_UNUSED_VARIABLE(r);+    TEST_SET_BUT_UNUSED_VARIABLE(c);+  }+}
+ eigen3/test/jacobisvd.cpp view
@@ -0,0 +1,142 @@+// This file is part of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2008-2014 Gael Guennebaud <gael.guennebaud@inria.fr>+// Copyright (C) 2009 Benoit Jacob <jacob.benoit.1@gmail.com>+//+// 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 <Eigen/SVD>++#define SVD_DEFAULT(M) JacobiSVD<M>+#define SVD_FOR_MIN_NORM(M) JacobiSVD<M,ColPivHouseholderQRPreconditioner>+#include "svd_common.h"++// Check all variants of JacobiSVD+template<typename MatrixType>+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<JacobiSVD<MatrixType, FullPivHouseholderQRPreconditioner> >(m, true)  )); // check full only+  CALL_SUBTEST(( svd_test_all_computation_options<JacobiSVD<MatrixType, ColPivHouseholderQRPreconditioner>  >(m, false) ));+  CALL_SUBTEST(( svd_test_all_computation_options<JacobiSVD<MatrixType, HouseholderQRPreconditioner>        >(m, false) ));+  if(m.rows()==m.cols())+    CALL_SUBTEST(( svd_test_all_computation_options<JacobiSVD<MatrixType, NoQRPreconditioner>               >(m, false) ));+}++template<typename MatrixType> void jacobisvd_verify_assert(const MatrixType& m)+{+  svd_verify_assert<JacobiSVD<MatrixType> >(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<MatrixType, FullPivHouseholderQRPreconditioner> 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<typename MatrixType>+void jacobisvd_method()+{+  enum { Size = MatrixType::RowsAtCompileTime };+  typedef typename MatrixType::RealScalar RealScalar;+  typedef Matrix<RealScalar, Size, 1> 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);+}++namespace Foo {+// older compiler require a default constructor for Bar+// cf: https://stackoverflow.com/questions/7411515/+class Bar {public: Bar() {}};+bool operator<(const Bar&, const Bar&) { return true; }+}+// regression test for a very strange MSVC issue for which simply+// including SVDBase.h messes up with std::max and custom scalar type+void msvc_workaround()+{+  const Foo::Bar a;+  const Foo::Bar b;+  std::max EIGEN_NOT_A_MACRO (a,b);+}++void test_jacobisvd()+{+  CALL_SUBTEST_3(( jacobisvd_verify_assert(Matrix3f()) ));+  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<Matrix2cd>));+  CALL_SUBTEST_12(svd_all_trivial_2x2(jacobisvd<Matrix2d>));++  for(int i = 0; i < g_repeat; i++) {+    CALL_SUBTEST_3(( jacobisvd<Matrix3f>() ));+    CALL_SUBTEST_4(( jacobisvd<Matrix4d>() ));+    CALL_SUBTEST_5(( jacobisvd<Matrix<float,3,5> >() ));+    CALL_SUBTEST_6(( jacobisvd<Matrix<double,Dynamic,2> >(Matrix<double,Dynamic,2>(10,2)) ));++    int r = internal::random<int>(1, 30),+        c = internal::random<int>(1, 30);+    +    TEST_SET_BUT_UNUSED_VARIABLE(r)+    TEST_SET_BUT_UNUSED_VARIABLE(c)+    +    CALL_SUBTEST_10(( jacobisvd<MatrixXd>(MatrixXd(r,c)) ));+    CALL_SUBTEST_7(( jacobisvd<MatrixXf>(MatrixXf(r,c)) ));+    CALL_SUBTEST_8(( jacobisvd<MatrixXcd>(MatrixXcd(r,c)) ));+    (void) r;+    (void) c;++    // Test on inf/nan matrix+    CALL_SUBTEST_7(  (svd_inf_nan<JacobiSVD<MatrixXf>, MatrixXf>()) );+    CALL_SUBTEST_10( (svd_inf_nan<JacobiSVD<MatrixXd>, MatrixXd>()) );++    // bug1395 test compile-time vectors as input+    CALL_SUBTEST_13(( jacobisvd_verify_assert(Matrix<double,6,1>()) ));+    CALL_SUBTEST_13(( jacobisvd_verify_assert(Matrix<double,1,6>()) ));+    CALL_SUBTEST_13(( jacobisvd_verify_assert(Matrix<double,Dynamic,1>(r)) ));+    CALL_SUBTEST_13(( jacobisvd_verify_assert(Matrix<double,1,Dynamic>(c)) ));+  }++  CALL_SUBTEST_7(( jacobisvd<MatrixXf>(MatrixXf(internal::random<int>(EIGEN_TEST_MAX_SIZE/4, EIGEN_TEST_MAX_SIZE/2), internal::random<int>(EIGEN_TEST_MAX_SIZE/4, EIGEN_TEST_MAX_SIZE/2))) ));+  CALL_SUBTEST_8(( jacobisvd<MatrixXcd>(MatrixXcd(internal::random<int>(EIGEN_TEST_MAX_SIZE/4, EIGEN_TEST_MAX_SIZE/3), internal::random<int>(EIGEN_TEST_MAX_SIZE/4, EIGEN_TEST_MAX_SIZE/3))) ));++  // test matrixbase method+  CALL_SUBTEST_1(( jacobisvd_method<Matrix2cd>() ));+  CALL_SUBTEST_3(( jacobisvd_method<Matrix3f>() ));++  // Test problem size constructors+  CALL_SUBTEST_7( JacobiSVD<MatrixXf>(10,10) );++  // Check that preallocation avoids subsequent mallocs+  CALL_SUBTEST_9( svd_preallocate<void>() );++  CALL_SUBTEST_2( svd_underoverflow<void>() );++  msvc_workaround();+}
+ eigen3/test/linearstructure.cpp view
@@ -0,0 +1,148 @@+// This file is part of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2006-2008 Benoit Jacob <jacob.benoit.1@gmail.com>+// Copyright (C) 2014 Gael Guennebaud <gael.guennebaud@inria.fr>+//+// 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<LhsScalar,RhsScalar>::value); }++#include "main.h"++template<typename MatrixType> 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<Scalar>();+  while (abs(s1)<RealScalar(1e-3)) s1 = internal::random<Scalar>();++  Index r = internal::random<Index>(0, rows-1),+        c = internal::random<Index>(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<Scalar>::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<Scalar>::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<typename MatrixType> 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<RealScalar>();+  MatrixType m1 = MatrixType::Random(rows, cols);+  +  g_called = false;+  VERIFY_IS_APPROX(s*m1, Scalar(s)*m1);+  VERIFY(g_called && "real * matrix<complex> not properly optimized");+  +  g_called = false;+  VERIFY_IS_APPROX(m1*s, m1*Scalar(s));+  VERIFY(g_called && "matrix<complex> * real not properly optimized");+  +  g_called = false;+  VERIFY_IS_APPROX(m1/s, m1/Scalar(s));+  VERIFY(g_called && "matrix<complex> / real not properly optimized");++  g_called = false;+  VERIFY_IS_APPROX(s+m1.array(), Scalar(s)+m1.array());+  VERIFY(g_called && "real + matrix<complex> not properly optimized");++  g_called = false;+  VERIFY_IS_APPROX(m1.array()+s, m1.array()+Scalar(s));+  VERIFY(g_called && "matrix<complex> + real not properly optimized");++  g_called = false;+  VERIFY_IS_APPROX(s-m1.array(), Scalar(s)-m1.array());+  VERIFY(g_called && "real - matrix<complex> not properly optimized");++  g_called = false;+  VERIFY_IS_APPROX(m1.array()-s, m1.array()-Scalar(s));+  VERIFY(g_called && "matrix<complex> - real not properly optimized");+}++void 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<float, 1, 1>()) );+    CALL_SUBTEST_2( linearStructure(Matrix2f()) );+    CALL_SUBTEST_3( linearStructure(Vector3d()) );+    CALL_SUBTEST_4( linearStructure(Matrix4d()) );+    CALL_SUBTEST_5( linearStructure(MatrixXcf(internal::random<int>(1,EIGEN_TEST_MAX_SIZE/2), internal::random<int>(1,EIGEN_TEST_MAX_SIZE/2))) );+    CALL_SUBTEST_6( linearStructure(MatrixXf (internal::random<int>(1,EIGEN_TEST_MAX_SIZE), internal::random<int>(1,EIGEN_TEST_MAX_SIZE))) );+    CALL_SUBTEST_7( linearStructure(MatrixXi (internal::random<int>(1,EIGEN_TEST_MAX_SIZE), internal::random<int>(1,EIGEN_TEST_MAX_SIZE))) );+    CALL_SUBTEST_8( linearStructure(MatrixXcd(internal::random<int>(1,EIGEN_TEST_MAX_SIZE/2), internal::random<int>(1,EIGEN_TEST_MAX_SIZE/2))) );+    CALL_SUBTEST_9( linearStructure(ArrayXXf (internal::random<int>(1,EIGEN_TEST_MAX_SIZE), internal::random<int>(1,EIGEN_TEST_MAX_SIZE))) );+    CALL_SUBTEST_10( linearStructure(ArrayXXcf (internal::random<int>(1,EIGEN_TEST_MAX_SIZE), internal::random<int>(1,EIGEN_TEST_MAX_SIZE))) );+    +    CALL_SUBTEST_11( real_complex<Matrix4cd>() );+    CALL_SUBTEST_11( real_complex<MatrixXcf>(10,10) );+    CALL_SUBTEST_11( real_complex<ArrayXXcf>(10,10) );+  }+  +#ifdef EIGEN_TEST_PART_4+  {+    // 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());+    +    +  }+#endif+}
+ eigen3/test/lscg.cpp view
@@ -0,0 +1,37 @@+// This file is part of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2011 Gael Guennebaud <g.gael@free.fr>+//+// 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 <Eigen/IterativeLinearSolvers>++template<typename T> void test_lscg_T()+{+  LeastSquaresConjugateGradient<SparseMatrix<T> > lscg_colmajor_diag;+  LeastSquaresConjugateGradient<SparseMatrix<T>, IdentityPreconditioner> lscg_colmajor_I;+  LeastSquaresConjugateGradient<SparseMatrix<T,RowMajor> > lscg_rowmajor_diag;+  LeastSquaresConjugateGradient<SparseMatrix<T,RowMajor>, 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)     );+}++void test_lscg()+{+  CALL_SUBTEST_1(test_lscg_T<double>());+  CALL_SUBTEST_2(test_lscg_T<std::complex<double> >());+}
+ eigen3/test/lu.cpp view
@@ -0,0 +1,283 @@+// This file is part of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2008-2009 Benoit Jacob <jacob.benoit.1@gmail.com>+//+// 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 <Eigen/LU>+using namespace std;++template<typename MatrixType>+typename MatrixType::RealScalar matrix_l1_norm(const MatrixType& m) {+  return m.cwiseAbs().colwise().sum().maxCoeff();+}++template<typename MatrixType> void lu_non_invertible()+{+  typedef typename MatrixType::RealScalar RealScalar;+  /* this test covers the following files:+     LU.h+  */+  Index rows, cols, cols2;+  if(MatrixType::RowsAtCompileTime==Dynamic)+  {+    rows = internal::random<Index>(2,EIGEN_TEST_MAX_SIZE);+  }+  else+  {+    rows = MatrixType::RowsAtCompileTime;+  }+  if(MatrixType::ColsAtCompileTime==Dynamic)+  {+    cols = internal::random<Index>(2,EIGEN_TEST_MAX_SIZE);+    cols2 = internal::random<int>(2,EIGEN_TEST_MAX_SIZE);+  }+  else+  {+    cols2 = cols = MatrixType::ColsAtCompileTime;+  }++  enum {+    RowsAtCompileTime = MatrixType::RowsAtCompileTime,+    ColsAtCompileTime = MatrixType::ColsAtCompileTime+  };+  typedef typename internal::kernel_retval_base<FullPivLU<MatrixType> >::ReturnType KernelMatrixType;+  typedef typename internal::image_retval_base<FullPivLU<MatrixType> >::ReturnType ImageMatrixType;+  typedef Matrix<typename MatrixType::Scalar, ColsAtCompileTime, ColsAtCompileTime>+          CMatrixType;+  typedef Matrix<typename MatrixType::Scalar, RowsAtCompileTime, RowsAtCompileTime>+          RMatrixType;++  Index rank = internal::random<Index>(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<MatrixType> 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<Upper>();+  RMatrixType l = RMatrixType::Identity(rows,rows);+  l.block(0,0,rows,(std::min)(rows,cols)).template triangularView<StrictlyLower>()+    = 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);++  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);++  // test solve with transposed+  m3 = MatrixType::Random(rows,cols2);+  m2 = m1.transpose()*m3;+  m3 = MatrixType::Random(rows,cols2);+  lu.template _solve_impl_transposed<false>(m2, m3);+  VERIFY_IS_APPROX(m2, m1.transpose()*m3);+  m3 = MatrixType::Random(rows,cols2);+  m3 = lu.transpose().solve(m2);+  VERIFY_IS_APPROX(m2, m1.transpose()*m3);++  // test solve with conjugate transposed+  m3 = MatrixType::Random(rows,cols2);+  m2 = m1.adjoint()*m3;+  m3 = MatrixType::Random(rows,cols2);+  lu.template _solve_impl_transposed<true>(m2, m3);+  VERIFY_IS_APPROX(m2, m1.adjoint()*m3);+  m3 = MatrixType::Random(rows,cols2);+  m3 = lu.adjoint().solve(m2);+  VERIFY_IS_APPROX(m2, m1.adjoint()*m3);+}++template<typename MatrixType> void lu_invertible()+{+  /* this test covers the following files:+     LU.h+  */+  typedef typename NumTraits<typename MatrixType::Scalar>::Real RealScalar;+  Index size = MatrixType::RowsAtCompileTime;+  if( size==Dynamic)+    size = internal::random<Index>(1,EIGEN_TEST_MAX_SIZE);++  MatrixType m1(size, size), m2(size, size), m3(size, size);+  FullPivLU<MatrixType> 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());+  m3 = MatrixType::Random(size,size);+  m2 = lu.solve(m3);+  VERIFY_IS_APPROX(m3, m1*m2);+  MatrixType m1_inverse = lu.inverse();+  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);++  // test solve with transposed+  lu.template _solve_impl_transposed<false>(m3, m2);+  VERIFY_IS_APPROX(m3, m1.transpose()*m2);+  m3 = MatrixType::Random(size,size);+  m3 = lu.transpose().solve(m2);+  VERIFY_IS_APPROX(m2, m1.transpose()*m3);++  // test solve with conjugate transposed+  lu.template _solve_impl_transposed<true>(m3, m2);+  VERIFY_IS_APPROX(m3, m1.adjoint()*m2);+  m3 = MatrixType::Random(size,size);+  m3 = lu.adjoint().solve(m2);+  VERIFY_IS_APPROX(m2, m1.adjoint()*m3);++  // Regression test for Bug 302+  MatrixType m4 = MatrixType::Random(size,size);+  VERIFY_IS_APPROX(lu.solve(m3*m4), lu.solve(m3)*m4);+}++template<typename MatrixType> void lu_partial_piv()+{+  /* this test covers the following files:+     PartialPivLU.h+  */+  typedef typename NumTraits<typename MatrixType::Scalar>::Real RealScalar;+  Index size = internal::random<Index>(1,4);++  MatrixType m1(size, size), m2(size, size), m3(size, size);+  m1.setRandom();+  PartialPivLU<MatrixType> plu(m1);++  VERIFY_IS_APPROX(m1, plu.reconstructedMatrix());++  m3 = MatrixType::Random(size,size);+  m2 = plu.solve(m3);+  VERIFY_IS_APPROX(m3, m1*m2);+  MatrixType m1_inverse = plu.inverse();+  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);++  // test solve with transposed+  plu.template _solve_impl_transposed<false>(m3, m2);+  VERIFY_IS_APPROX(m3, m1.transpose()*m2);+  m3 = MatrixType::Random(size,size);+  m3 = plu.transpose().solve(m2);+  VERIFY_IS_APPROX(m2, m1.transpose()*m3);++  // test solve with conjugate transposed+  plu.template _solve_impl_transposed<true>(m3, m2);+  VERIFY_IS_APPROX(m3, m1.adjoint()*m2);+  m3 = MatrixType::Random(size,size);+  m3 = plu.adjoint().solve(m2);+  VERIFY_IS_APPROX(m2, m1.adjoint()*m3);+}++template<typename MatrixType> void lu_verify_assert()+{+  MatrixType tmp;++  FullPivLU<MatrixType> 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.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<MatrixType> plu;+  VERIFY_RAISES_ASSERT(plu.matrixLU())+  VERIFY_RAISES_ASSERT(plu.permutationP())+  VERIFY_RAISES_ASSERT(plu.solve(tmp))+  VERIFY_RAISES_ASSERT(plu.determinant())+  VERIFY_RAISES_ASSERT(plu.inverse())+}++void test_lu()+{+  for(int i = 0; i < g_repeat; i++) {+    CALL_SUBTEST_1( lu_non_invertible<Matrix3f>() );+    CALL_SUBTEST_1( lu_invertible<Matrix3f>() );+    CALL_SUBTEST_1( lu_verify_assert<Matrix3f>() );++    CALL_SUBTEST_2( (lu_non_invertible<Matrix<double, 4, 6> >()) );+    CALL_SUBTEST_2( (lu_verify_assert<Matrix<double, 4, 6> >()) );++    CALL_SUBTEST_3( lu_non_invertible<MatrixXf>() );+    CALL_SUBTEST_3( lu_invertible<MatrixXf>() );+    CALL_SUBTEST_3( lu_verify_assert<MatrixXf>() );++    CALL_SUBTEST_4( lu_non_invertible<MatrixXd>() );+    CALL_SUBTEST_4( lu_invertible<MatrixXd>() );+    CALL_SUBTEST_4( lu_partial_piv<MatrixXd>() );+    CALL_SUBTEST_4( lu_verify_assert<MatrixXd>() );++    CALL_SUBTEST_5( lu_non_invertible<MatrixXcf>() );+    CALL_SUBTEST_5( lu_invertible<MatrixXcf>() );+    CALL_SUBTEST_5( lu_verify_assert<MatrixXcf>() );++    CALL_SUBTEST_6( lu_non_invertible<MatrixXcd>() );+    CALL_SUBTEST_6( lu_invertible<MatrixXcd>() );+    CALL_SUBTEST_6( lu_partial_piv<MatrixXcd>() );+    CALL_SUBTEST_6( lu_verify_assert<MatrixXcd>() );++    CALL_SUBTEST_7(( lu_non_invertible<Matrix<float,Dynamic,16> >() ));++    // Test problem size constructors+    CALL_SUBTEST_9( PartialPivLU<MatrixXf>(10) );+    CALL_SUBTEST_9( FullPivLU<MatrixXf>(10, 20); );+  }+}
+ eigen3/test/main.h view
@@ -0,0 +1,803 @@+// This file is part of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2006-2008 Benoit Jacob <jacob.benoit.1@gmail.com>+// Copyright (C) 2008 Gael Guennebaud <gael.guennebaud@inria.fr>+//+// 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 <cstdlib>+#include <cerrno>+#include <ctime>+#include <iostream>+#include <fstream>+#include <string>+#include <sstream>+#include <vector>+#include <typeinfo>++// 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 <limits>+#include <algorithm>+#include <complex>+#include <deque>+#include <queue>+#include <cassert>+#include <list>+#if __cplusplus >= 201103L+#include <random>+#ifdef EIGEN_USE_THREADS+#include <future>+#endif+#endif++// Same for cuda_fp16.h+#if defined(__CUDACC_VER_MAJOR__) && (__CUDACC_VER_MAJOR__ >= 9)+#define EIGEN_TEST_CUDACC_VER  ((__CUDACC_VER_MAJOR__ * 10000) + (__CUDACC_VER_MINOR__ * 100))+#elif defined(__CUDACC_VER__)+#define EIGEN_TEST_CUDACC_VER __CUDACC_VER__+#else+#define EIGEN_TEST_CUDACC_VER 0+#endif++#if EIGEN_TEST_CUDACC_VER >= 70500+#include <cuda_fp16.h>+#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.+#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+#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++// 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<nb_temporaries_on_assert);+}++#define EIGEN_DENSE_STORAGE_CTOR_PLUGIN { on_temporary_creation(size); }++#define VERIFY_EVALUATION_COUNT(XPR,N) {\+    nb_temporaries = 0; \+    XPR; \+    if(nb_temporaries!=N) { std::cerr << "nb_temporaries == " << nb_temporaries << "\n"; }\+    VERIFY( (#XPR) && nb_temporaries==N ); \+  }+  +#endif++// the following file is automatically generated by cmake+#include "split_test_helper.h"++#ifdef NDEBUG+#undef NDEBUG+#endif++// On windows CE, NDEBUG is automatically defined <assert.h> 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++#ifndef EIGEN_TEST_FUNC+#error EIGEN_TEST_FUNC must be defined+#endif++#define DEFAULT_REPEAT 10++namespace Eigen+{+  static std::vector<std::string> 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;+  static unsigned int g_seed;+  static bool g_has_set_repeat, g_has_set_seed;+}++#define TRACK std::cerr << __FILE__ << " " << __LINE__ << std::endl+// #define TRACK while()++#define EI_PP_MAKE_STRING2(S) #S+#define EI_PP_MAKE_STRING(S) EI_PP_MAKE_STRING2(S)++#define EIGEN_DEFAULT_IO_FORMAT IOFormat(4, 0, "  ", "\n", "", "", "", "")++#if (defined(_CPPUNWIND) || defined(__EXCEPTIONS)) && !defined(__CUDA_ARCH__)+  #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 excecuted 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<std::string> 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(EI_PP_MAKE_STRING(__FILE__) " (" EI_PP_MAKE_STRING(__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<eigen_assert_list.size() ; ++ai)                        \+            std::cerr << "  " << eigen_assert_list[ai] << "\n";                       \+          VERIFY(Eigen::should_raise_an_assert && # a);                               \+        } catch (Eigen::eigen_assert_exception) {                                     \+          Eigen::internal::push_assert = false; VERIFY(true);                         \+        }                                                                             \+        Eigen::report_on_cerr_on_assert_failure = true;                               \+        Eigen::internal::push_assert = false;                                         \+      }+    #endif //EIGEN_EXCEPTIONS++  #elif !defined(__CUDACC__) // EIGEN_DEBUG_ASSERTS+    // see bug 89. The copy_bool here is working around a bug in gcc <= 4.3+    #define eigen_assert(a) \+      if( (!Eigen::internal::copy_bool(a)) && (!no_more_assert) )\+      {                                       \+        Eigen::no_more_assert = true;         \+        if(report_on_cerr_on_assert_failure)  \+          eigen_plain_assert(a);              \+        else                                  \+          EIGEN_THROW_X(Eigen::eigen_assert_exception()); \+      }++    #ifdef EIGEN_EXCEPTIONS+      #define VERIFY_RAISES_ASSERT(a) {                           \+        Eigen::no_more_assert = false;                            \+        Eigen::report_on_cerr_on_assert_failure = false;          \+        try {                                                     \+          a;                                                      \+          VERIFY(Eigen::should_raise_an_assert && # a);           \+        }                                                         \+        catch (Eigen::eigen_assert_exception&) { VERIFY(true); }  \+        Eigen::report_on_cerr_on_assert_failure = true;           \+      }+    #endif // EIGEN_EXCEPTIONS+  #endif // EIGEN_DEBUG_ASSERTS++  #if defined(TEST_CHECK_STATIC_ASSERTIONS) && defined(EIGEN_EXCEPTIONS)+    #define EIGEN_STATIC_ASSERT(a,MSG) \+      if( (!Eigen::internal::copy_bool(a)) && (!no_more_assert) )\+      {                                       \+        Eigen::no_more_assert = true;         \+        if(report_on_cerr_on_assert_failure)  \+          eigen_plain_assert((a) && #MSG);      \+        else                                  \+          EIGEN_THROW_X(Eigen::eigen_static_assert_exception()); \+      }+    #define VERIFY_RAISES_STATIC_ASSERT(a) {                    \+      Eigen::no_more_assert = false;                            \+      Eigen::report_on_cerr_on_assert_failure = false;          \+      try {                                                     \+        a;                                                      \+        VERIFY(Eigen::should_raise_an_assert && # a);           \+      }                                                         \+      catch (Eigen::eigen_static_assert_exception&) { VERIFY(true); }  \+      Eigen::report_on_cerr_on_assert_failure = true;           \+    }+  #endif // TEST_CHECK_STATIC_ASSERTIONS++#ifndef VERIFY_RAISES_ASSERT+  #define VERIFY_RAISES_ASSERT(a) \+    std::cout << "Can't VERIFY_RAISES_ASSERT( " #a " ) with exceptions disabled\n";+#endif+#ifndef VERIFY_RAISES_STATIC_ASSERT+  #define VERIFY_RAISES_STATIC_ASSERT(a) \+    std::cout << "Can't VERIFY_RAISES_STATIC_ASSERT( " #a " ) with exceptions disabled\n";+#endif+    +  #if !defined(__CUDACC__)+  #define EIGEN_USE_CUSTOM_ASSERT+  #endif++#else // EIGEN_NO_ASSERTION_CHECKING++  #define VERIFY_RAISES_ASSERT(a) {}+  #define VERIFY_RAISES_STATIC_ASSERT(a) {}++#endif // EIGEN_NO_ASSERTION_CHECKING++#define EIGEN_INTERNAL_DEBUGGING+#include <Eigen/QR> // required for createRandomPIMatrixOfRank++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<int>(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__, EI_PP_MAKE_STRING(a))++#define VERIFY_GE(a, b) ::verify_impl(a >= b, g_test_stack.back().c_str(), __FILE__, __LINE__, EI_PP_MAKE_STRING(a >= b))+#define VERIFY_LE(a, b) ::verify_impl(a <= b, g_test_stack.back().c_str(), __FILE__, __LINE__, EI_PP_MAKE_STRING(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 CALL_SUBTEST(FUNC) do { \+    g_test_stack.push_back(EI_PP_MAKE_STRING(FUNC)); \+    FUNC; \+    g_test_stack.pop_back(); \+  } while (0)+++namespace Eigen {++template<typename T> inline typename NumTraits<T>::Real test_precision() { return NumTraits<T>::dummy_precision(); }+template<> inline float test_precision<float>() { return 1e-3f; }+template<> inline double test_precision<double>() { return 1e-6; }+template<> inline long double test_precision<long double>() { return 1e-6l; }+template<> inline float test_precision<std::complex<float> >() { return test_precision<float>(); }+template<> inline double test_precision<std::complex<double> >() { return test_precision<double>(); }+template<> inline long double test_precision<std::complex<long double> >() { return test_precision<long double>(); }++inline bool test_isApprox(const short& a, const short& b)+{ return internal::isApprox(a, b, test_precision<short>()); }+inline bool test_isApprox(const unsigned short& a, const unsigned short& b)+{ return internal::isApprox(a, b, test_precision<unsigned short>()); }+inline bool test_isApprox(const unsigned int& a, const unsigned int& b)+{ return internal::isApprox(a, b, test_precision<unsigned int>()); }+inline bool test_isApprox(const long& a, const long& b)+{ return internal::isApprox(a, b, test_precision<long>()); }+inline bool test_isApprox(const unsigned long& a, const unsigned long& b)+{ return internal::isApprox(a, b, test_precision<unsigned long>()); }++inline bool test_isApprox(const int& a, const int& b)+{ return internal::isApprox(a, b, test_precision<int>()); }+inline bool test_isMuchSmallerThan(const int& a, const int& b)+{ return internal::isMuchSmallerThan(a, b, test_precision<int>()); }+inline bool test_isApproxOrLessThan(const int& a, const int& b)+{ return internal::isApproxOrLessThan(a, b, test_precision<int>()); }++inline bool test_isApprox(const float& a, const float& b)+{ return internal::isApprox(a, b, test_precision<float>()); }+inline bool test_isMuchSmallerThan(const float& a, const float& b)+{ return internal::isMuchSmallerThan(a, b, test_precision<float>()); }+inline bool test_isApproxOrLessThan(const float& a, const float& b)+{ return internal::isApproxOrLessThan(a, b, test_precision<float>()); }++inline bool test_isApprox(const double& a, const double& b)+{ return internal::isApprox(a, b, test_precision<double>()); }+inline bool test_isMuchSmallerThan(const double& a, const double& b)+{ return internal::isMuchSmallerThan(a, b, test_precision<double>()); }+inline bool test_isApproxOrLessThan(const double& a, const double& b)+{ return internal::isApproxOrLessThan(a, b, test_precision<double>()); }++#ifndef EIGEN_TEST_NO_COMPLEX+inline bool test_isApprox(const std::complex<float>& a, const std::complex<float>& b)+{ return internal::isApprox(a, b, test_precision<std::complex<float> >()); }+inline bool test_isMuchSmallerThan(const std::complex<float>& a, const std::complex<float>& b)+{ return internal::isMuchSmallerThan(a, b, test_precision<std::complex<float> >()); }++inline bool test_isApprox(const std::complex<double>& a, const std::complex<double>& b)+{ return internal::isApprox(a, b, test_precision<std::complex<double> >()); }+inline bool test_isMuchSmallerThan(const std::complex<double>& a, const std::complex<double>& b)+{ return internal::isMuchSmallerThan(a, b, test_precision<std::complex<double> >()); }++#ifndef EIGEN_TEST_NO_LONGDOUBLE+inline bool test_isApprox(const std::complex<long double>& a, const std::complex<long double>& b)+{ return internal::isApprox(a, b, test_precision<std::complex<long double> >()); }+inline bool test_isMuchSmallerThan(const std::complex<long double>& a, const std::complex<long double>& b)+{ return internal::isMuchSmallerThan(a, b, test_precision<std::complex<long double> >()); }+#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<long double>());+    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<long double>()); }+inline bool test_isApproxOrLessThan(const long double& a, const long double& b)+{ return internal::isApproxOrLessThan(a, b, test_precision<long double>()); }+#endif // EIGEN_TEST_NO_LONGDOUBLE++inline bool test_isApprox(const half& a, const half& b)+{ return internal::isApprox(a, b, test_precision<half>()); }+inline bool test_isMuchSmallerThan(const half& a, const half& b)+{ return internal::isMuchSmallerThan(a, b, test_precision<half>()); }+inline bool test_isApproxOrLessThan(const half& a, const half& b)+{ return internal::isApproxOrLessThan(a, b, test_precision<half>()); }++// test_relative_error returns the relative difference between a and b as a real scalar as used in isApprox.+template<typename T1,typename T2>+typename NumTraits<typename T1::RealScalar>::NonInteger test_relative_error(const EigenBase<T1> &a, const EigenBase<T2> &b)+{+  using std::sqrt;+  typedef typename NumTraits<typename T1::RealScalar>::NonInteger RealScalar;+  typename internal::nested_eval<T1,2>::type ea(a.derived());+  typename internal::nested_eval<T2,2>::type eb(b.derived());+  return sqrt(RealScalar((ea-eb).cwiseAbs2().sum()) / RealScalar((std::min)(eb.cwiseAbs2().sum(),ea.cwiseAbs2().sum())));+}++template<typename T1,typename T2>+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,typename T2>+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<typename S, int D>+S test_relative_error(const Translation<S,D> &a, const Translation<S,D> &b)+{+  return test_relative_error(a.vector(), b.vector());+}++template <typename S, int D, int O>+S test_relative_error(const ParametrizedLine<S,D,O> &a, const ParametrizedLine<S,D,O> &b)+{+  return (std::max)(test_relative_error(a.origin(), b.origin()), test_relative_error(a.origin(), b.origin()));+}++template <typename S, int D>+S test_relative_error(const AlignedBox<S,D> &a, const AlignedBox<S,D> &b)+{+  return (std::max)(test_relative_error((a.min)(), (b.min)()), test_relative_error((a.max)(), (b.max)()));+}++template<typename Derived> class SparseMatrixBase;+template<typename T1,typename T2>+typename T1::RealScalar test_relative_error(const MatrixBase<T1> &a, const SparseMatrixBase<T2> &b)+{+  return test_relative_error(a,b.toDense());+}++template<typename Derived> class SparseMatrixBase;+template<typename T1,typename T2>+typename T1::RealScalar test_relative_error(const SparseMatrixBase<T1> &a, const MatrixBase<T2> &b)+{+  return test_relative_error(a.toDense(),b);+}++template<typename Derived> class SparseMatrixBase;+template<typename T1,typename T2>+typename T1::RealScalar test_relative_error(const SparseMatrixBase<T1> &a, const SparseMatrixBase<T2> &b)+{+  return test_relative_error(a.toDense(),b.toDense());+}++template<typename T1,typename T2>+typename NumTraits<typename NumTraits<T1>::Real>::NonInteger test_relative_error(const T1 &a, const T2 &b, typename internal::enable_if<internal::is_arithmetic<typename NumTraits<T1>::Real>::value, T1>::type* = 0)+{+  typedef typename NumTraits<typename NumTraits<T1>::Real>::NonInteger RealScalar;+  return numext::sqrt(RealScalar(numext::abs2(a-b))/RealScalar((numext::mini)(numext::abs2(a),numext::abs2(b))));+}++template<typename T>+T test_relative_error(const Rotation2D<T> &a, const Rotation2D<T> &b)+{+  return test_relative_error(a.angle(), b.angle());+}++template<typename T>+T test_relative_error(const AngleAxis<T> &a, const AngleAxis<T> &b)+{+  return (std::max)(test_relative_error(a.angle(), b.angle()), test_relative_error(a.axis(), b.axis()));+}++template<typename Type1, typename Type2>+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<typename Type1::Scalar>());+}++// get_test_precision is a small wrapper to test_precision allowing to return the scalar precision for either scalars or expressions+template<typename T>+typename NumTraits<typename T::Scalar>::Real get_test_precision(const T&, const typename T::Scalar* = 0)+{+  return test_precision<typename NumTraits<typename T::Scalar>::Real>();+}++template<typename T>+typename NumTraits<T>::Real get_test_precision(const T&,typename internal::enable_if<internal::is_arithmetic<typename NumTraits<T>::Real>::value, T>::type* = 0)+{+  return test_precision<typename NumTraits<T>::Real>();+}++// verifyIsApprox is a wrapper to test_isApprox that outputs the relative difference magnitude if the test fails.+template<typename Type1, typename Type2>+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<typename Scalar,typename ScalarRef>+inline bool test_isApproxWithRef(const Scalar& a, const Scalar& b, const ScalarRef& ref)+{+  return test_isApprox(a+ref, b+ref);+}++template<typename Derived1, typename Derived2>+inline bool test_isMuchSmallerThan(const MatrixBase<Derived1>& m1,+                                   const MatrixBase<Derived2>& m2)+{+  return m1.isMuchSmallerThan(m2, test_precision<typename internal::traits<Derived1>::Scalar>());+}++template<typename Derived>+inline bool test_isMuchSmallerThan(const MatrixBase<Derived>& m,+                                   const typename NumTraits<typename internal::traits<Derived>::Scalar>::Real& s)+{+  return m.isMuchSmallerThan(s, test_precision<typename internal::traits<Derived>::Scalar>());+}++template<typename Derived>+inline bool test_isUnitary(const MatrixBase<Derived>& m)+{+  return m.isUnitary(test_precision<typename internal::traits<Derived>::Scalar>());+}++// Forward declaration to avoid ICC warning+template<typename T, typename U>+bool test_is_equal(const T& actual, const U& expected, bool expect_equal=true);++template<typename T, typename U>+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;+}++/** 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.+  */+// Forward declaration to avoid ICC warning+template<typename MatrixType>+void createRandomPIMatrixOfRank(Index desired_rank, Index rows, Index cols, MatrixType& m);+template<typename MatrixType>+void createRandomPIMatrixOfRank(Index desired_rank, Index rows, Index cols, MatrixType& m)+{+  typedef typename internal::traits<MatrixType>::Scalar Scalar;+  enum { Rows = MatrixType::RowsAtCompileTime, Cols = MatrixType::ColsAtCompileTime };++  typedef Matrix<Scalar, Dynamic, 1> VectorType;+  typedef Matrix<Scalar, Rows, Rows> MatrixAType;+  typedef Matrix<Scalar, Cols, Cols> 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 reamain+  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<MatrixAType> qra(a);+  HouseholderQR<MatrixBType> qrb(b);+  m = qra.householderQ() * d * qrb.householderQ();+}++// Forward declaration to avoid ICC warning+template<typename PermutationVectorType>+void randomPermutationVector(PermutationVectorType& v, Index size);+template<typename PermutationVectorType>+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<Index>(0, size-1);+    Index j;+    do j = internal::random<Index>(0, size-1); while(j==i);+    std::swap(v(i), v(j));+  }+}++template<typename T> bool isNotNaN(const T& x)+{+  return x==x;+}++template<typename T> bool isPlusInf(const T& x)+{+  return x > NumTraits<T>::highest();+}++template<typename T> bool isMinusInf(const T& x)+{+  return x < NumTraits<T>::lowest();+}++} // end namespace Eigen++template<typename T> struct GetDifferentType;++template<> struct GetDifferentType<float> { typedef double type; };+template<> struct GetDifferentType<double> { typedef float type; };+template<typename T> struct GetDifferentType<std::complex<T> >+{ typedef std::complex<typename GetDifferentType<T>::type> type; };++// Forward declaration to avoid ICC warning+template<typename T> std::string type_name();+template<typename T> std::string type_name()                    { return "other"; }+template<> std::string type_name<float>()                       { return "float"; }+template<> std::string type_name<double>()                      { return "double"; }+template<> std::string type_name<long double>()                 { return "long double"; }+template<> std::string type_name<int>()                         { return "int"; }+template<> std::string type_name<std::complex<float> >()        { return "complex<float>"; }+template<> std::string type_name<std::complex<double> >()       { return "complex<double>"; }+template<> std::string type_name<std::complex<long double> >()  { return "complex<long double>"; }+template<> std::string type_name<std::complex<int> >()          { return "complex<int>"; }++// forward declaration of the main test function+void EIGEN_CAT(test_,EIGEN_TEST_FUNC)();++using namespace Eigen;++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;+}++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;++    Eigen::g_test_stack.push_back(std::string(EI_PP_MAKE_STRING(EIGEN_TEST_FUNC)));++    EIGEN_CAT(test_,EIGEN_TEST_FUNC)();+    return 0;+}++// These warning are disabled here such that they are still ON when parsing Eigen's header files.+#if defined __INTEL_COMPILER+  // remark #383: value copied to temporary, reference to temporary used+  //  -> this warning is raised even for legal usage as: g_test_stack.push_back("foo"); where g_test_stack is a std::vector<std::string>+  // 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
+ eigen3/test/mapped_matrix.cpp view
@@ -0,0 +1,208 @@+// This file is part of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2006-2010 Benoit Jacob <jacob.benoit.1@gmail.com>+//+// 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<typename VectorType> void map_class_vector(const VectorType& m)+{+  typedef typename VectorType::Scalar Scalar;++  Index size = m.size();++  Scalar* array1 = internal::aligned_new<Scalar>(size);+  Scalar* array2 = internal::aligned_new<Scalar>(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<VectorType, AlignedMax>(array1, size) = VectorType::Random(size);+  Map<VectorType, AlignedMax>(array2, size) = Map<VectorType,AlignedMax>(array1, size);+  Map<VectorType>(array3unaligned, size) = Map<VectorType>(array1, size);+  Map<VectorType>(array4, size)          = Map<VectorType,AlignedMax>(array1, size);+  VectorType ma1 = Map<VectorType, AlignedMax>(array1, size);+  VectorType ma2 = Map<VectorType, AlignedMax>(array2, size);+  VectorType ma3 = Map<VectorType>(array3unaligned, size);+  VectorType ma4 = Map<VectorType>(array4, size);+  VERIFY_IS_EQUAL(ma1, ma2);+  VERIFY_IS_EQUAL(ma1, ma3);+  VERIFY_IS_EQUAL(ma1, ma4);+  #ifdef EIGEN_VECTORIZE+  if(internal::packet_traits<Scalar>::Vectorizable && size>=AlignedMax)+    VERIFY_RAISES_ASSERT((Map<VectorType,AlignedMax>(array3unaligned, size)))+  #endif++  internal::aligned_delete(array1, size);+  internal::aligned_delete(array2, size);+  delete[] array3;+}++template<typename MatrixType> 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<Scalar>();++  // array1 and array2 -> aligned heap allocation+  Scalar* array1 = internal::aligned_new<Scalar>(size);+  for(int i = 0; i < size; i++) array1[i] = Scalar(1);+  Scalar* array2 = internal::aligned_new<Scalar>(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<MatrixType> map1(array1, rows, cols);+  Map<MatrixType, AlignedMax> map2(array2, rows, cols);+  Map<MatrixType> map3(array3unaligned, rows, cols);+  Map<MatrixType> 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<typename VectorType> void map_static_methods(const VectorType& m)+{+  typedef typename VectorType::Scalar Scalar;++  Index size = m.size();++  Scalar* array1 = internal::aligned_new<Scalar>(size);+  Scalar* array2 = internal::aligned_new<Scalar>(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<typename PlainObjectType> 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<PlainObjectType>::type ConstPlainObjectType;+  VERIFY( !(internal::traits<Map<ConstPlainObjectType> >::Flags & LvalueBit) );+  VERIFY( !(internal::traits<Map<ConstPlainObjectType, AlignedMax> >::Flags & LvalueBit) );+  VERIFY( !(Map<ConstPlainObjectType>::Flags & LvalueBit) );+  VERIFY( !(Map<ConstPlainObjectType, AlignedMax>::Flags & LvalueBit) );+}++template<typename Scalar>+void map_not_aligned_on_scalar()+{+  typedef Matrix<Scalar,Dynamic,Dynamic> MatrixType;+  Index size = 11;+  Scalar* array1 = internal::aligned_new<Scalar>((size+1)*(size+1)+1);+  Scalar* array2 = reinterpret_cast<Scalar*>(sizeof(Scalar)/2+std::size_t(array1));+  Map<MatrixType,0,OuterStride<> > map2(array2, size, size, OuterStride<>(size+1));+  MatrixType m2 = MatrixType::Random(size,size);+  map2 = m2;+  VERIFY_IS_EQUAL(m2, map2);+  +  typedef Matrix<Scalar,Dynamic,1> VectorType;+  Map<VectorType> map3(array2, size);+  MatrixType v3 = VectorType::Random(size);+  map3 = v3;+  VERIFY_IS_EQUAL(v3, map3);+  +  internal::aligned_delete(array1, (size+1)*(size+1)+1);+}++void test_mapped_matrix()+{+  for(int i = 0; i < g_repeat; i++) {+    CALL_SUBTEST_1( map_class_vector(Matrix<float, 1, 1>()) );+    CALL_SUBTEST_1( check_const_correctness(Matrix<float, 1, 1>()) );+    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<float, 1, 1>()) );+    CALL_SUBTEST_2( map_class_matrix(Matrix4d()) );+    CALL_SUBTEST_11( map_class_matrix(Matrix<float,3,5>()) );+    CALL_SUBTEST_4( map_class_matrix(MatrixXcf(internal::random<int>(1,10),internal::random<int>(1,10))) );+    CALL_SUBTEST_5( map_class_matrix(MatrixXi(internal::random<int>(1,10),internal::random<int>(1,10))) );++    CALL_SUBTEST_6( map_static_methods(Matrix<double, 1, 1>()) );+    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<double>() );+  }+}
+ eigen3/test/mapstaticmethods.cpp view
@@ -0,0 +1,173 @@+// This file is part of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2011 Benoit Jacob <jacob.benoit.1@gmail.com>+//+// 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"++float *ptr;+const float *const_ptr;++template<typename PlainObjectType,+         bool IsDynamicSize = PlainObjectType::SizeAtCompileTime == Dynamic,+         bool IsVector = PlainObjectType::IsVectorAtCompileTime+>+struct mapstaticmethods_impl {};++template<typename PlainObjectType, bool IsVector>+struct mapstaticmethods_impl<PlainObjectType, false, IsVector>+{+  static void run(const PlainObjectType& m)+  {+    mapstaticmethods_impl<PlainObjectType, true, IsVector>::run(m);++    int i = internal::random<int>(2,5), j = internal::random<int>(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<Dynamic, Dynamic>(i,j)).setZero();+    PlainObjectType::MapAligned(ptr, Stride<2,Dynamic>(2,i)).setZero();+    PlainObjectType::Map(const_ptr, Stride<Dynamic,3>(i,3)).sum();+    PlainObjectType::MapAligned(const_ptr, Stride<Dynamic, Dynamic>(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<typename PlainObjectType>+struct mapstaticmethods_impl<PlainObjectType, true, false>+{+  static void run(const PlainObjectType& m)+  {+    Index rows = m.rows(), cols = m.cols();++    int i = internal::random<int>(2,5), j = internal::random<int>(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<Dynamic, Dynamic>(i,j)).setZero();+    PlainObjectType::MapAligned(ptr, rows, cols, Stride<2,Dynamic>(2,i)).setZero();+    PlainObjectType::Map(const_ptr, rows, cols, Stride<Dynamic,3>(i,3)).sum();+    PlainObjectType::MapAligned(const_ptr, rows, cols, Stride<Dynamic, Dynamic>(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<typename PlainObjectType>+struct mapstaticmethods_impl<PlainObjectType, true, true>+{+  static void run(const PlainObjectType& v)+  {+    Index size = v.size();++    int i = internal::random<int>(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<typename PlainObjectType>+void mapstaticmethods(const PlainObjectType& m)+{+  mapstaticmethods_impl<PlainObjectType>::run(m);+  VERIFY(true); // just to avoid 'unused function' warning+}++void test_mapstaticmethods()+{+  ptr = internal::aligned_new<float>(1000);+  for(int i = 0; i < 1000; i++) ptr[i] = float(i);++  const_ptr = ptr;++  CALL_SUBTEST_1(( mapstaticmethods(Matrix<float, 1, 1>()) ));+  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);+}+
+ eigen3/test/mapstride.cpp view
@@ -0,0 +1,234 @@+// This file is part of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2010 Benoit Jacob <jacob.benoit.1@gmail.com>+//+// 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<int Alignment,typename VectorType> 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<Scalar>(arraysize+1);+  Scalar* array = a_array;+  if(Alignment!=Aligned)+    array = (Scalar*)(internal::IntPtr(a_array) + (internal::packet_traits<Scalar>::AlignedOnScalar?sizeof(Scalar):sizeof(typename NumTraits<Scalar>::Real)));++  {+    Map<VectorType, Alignment, InnerStride<3> > map(array, size);+    map = v;+    for(int i = 0; i < size; ++i)+    {+      VERIFY(array[3*i] == v[i]);+      VERIFY(map[i] == v[i]);+    }+  }++  {+    Map<VectorType, Unaligned, InnerStride<Dynamic> > map(array, size, InnerStride<Dynamic>(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<int Alignment,typename MatrixType> 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<Scalar>();++  Index arraysize = 4*(rows+4)*(cols+4);++  Scalar* a_array1 = internal::aligned_new<Scalar>(arraysize+1);+  Scalar* array1 = a_array1;+  if(Alignment!=Aligned)+    array1 = (Scalar*)(internal::IntPtr(a_array1) + (internal::packet_traits<Scalar>::AlignedOnScalar?sizeof(Scalar):sizeof(typename NumTraits<Scalar>::Real)));++  Scalar a_array2[256];+  Scalar* array2 = a_array2;+  if(Alignment!=Aligned)+    array2 = (Scalar*)(internal::IntPtr(a_array2) + (internal::packet_traits<Scalar>::AlignedOnScalar?sizeof(Scalar):sizeof(typename NumTraits<Scalar>::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<MatrixType, Alignment, OuterStride<Dynamic> > map(array, rows, cols, OuterStride<Dynamic>(m.innerSize()+1));+    map = m;+    VERIFY(map.outerStride() == map.innerSize()+1);+    for(int i = 0; i < m.outerSize(); ++i)+      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<MatrixType, Alignment, OuterStride<OuterStrideAtCompileTime> >+      map(array, rows, cols, OuterStride<OuterStrideAtCompileTime>(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<MatrixType, Alignment, Stride<Dynamic,Dynamic> > map(array, rows, cols, Stride<Dynamic,Dynamic>(2*m.innerSize()+1, 2));+    map = m;+    VERIFY(map.outerStride() == 2*map.innerSize()+1);+    VERIFY(map.innerStride() == 2);+    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<MatrixType, Alignment, InnerStride<Dynamic> > map(array, rows, cols, InnerStride<Dynamic>(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);+  }++  internal::aligned_delete(a_array1, arraysize+1);+}++// Additional tests for inner-stride but no outer-stride+template<int>+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<int,Dynamic,Dynamic,RowMajor> RowMatrixXi;+  typedef Matrix<int,2,3,ColMajor> ColMatrix23i;+  typedef Matrix<int,3,2,ColMajor> ColMatrix32i;+  typedef Matrix<int,2,3,RowMajor> RowMatrix23i;+  typedef Matrix<int,3,2,RowMajor> 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>()));+}++void test_mapstride()+{+  for(int i = 0; i < g_repeat; i++) {+    int maxn = 30;+    CALL_SUBTEST_1( map_class_vector<Aligned>(Matrix<float, 1, 1>()) );+    CALL_SUBTEST_1( map_class_vector<Unaligned>(Matrix<float, 1, 1>()) );+    CALL_SUBTEST_2( map_class_vector<Aligned>(Vector4d()) );+    CALL_SUBTEST_2( map_class_vector<Unaligned>(Vector4d()) );+    CALL_SUBTEST_3( map_class_vector<Aligned>(RowVector4f()) );+    CALL_SUBTEST_3( map_class_vector<Unaligned>(RowVector4f()) );+    CALL_SUBTEST_4( map_class_vector<Aligned>(VectorXcf(internal::random<int>(1,maxn))) );+    CALL_SUBTEST_4( map_class_vector<Unaligned>(VectorXcf(internal::random<int>(1,maxn))) );+    CALL_SUBTEST_5( map_class_vector<Aligned>(VectorXi(internal::random<int>(1,maxn))) );+    CALL_SUBTEST_5( map_class_vector<Unaligned>(VectorXi(internal::random<int>(1,maxn))) );++    CALL_SUBTEST_1( map_class_matrix<Aligned>(Matrix<float, 1, 1>()) );+    CALL_SUBTEST_1( map_class_matrix<Unaligned>(Matrix<float, 1, 1>()) );+    CALL_SUBTEST_2( map_class_matrix<Aligned>(Matrix4d()) );+    CALL_SUBTEST_2( map_class_matrix<Unaligned>(Matrix4d()) );+    CALL_SUBTEST_3( map_class_matrix<Aligned>(Matrix<float,3,5>()) );+    CALL_SUBTEST_3( map_class_matrix<Unaligned>(Matrix<float,3,5>()) );+    CALL_SUBTEST_3( map_class_matrix<Aligned>(Matrix<float,4,8>()) );+    CALL_SUBTEST_3( map_class_matrix<Unaligned>(Matrix<float,4,8>()) );+    CALL_SUBTEST_4( map_class_matrix<Aligned>(MatrixXcf(internal::random<int>(1,maxn),internal::random<int>(1,maxn))) );+    CALL_SUBTEST_4( map_class_matrix<Unaligned>(MatrixXcf(internal::random<int>(1,maxn),internal::random<int>(1,maxn))) );+    CALL_SUBTEST_5( map_class_matrix<Aligned>(MatrixXi(internal::random<int>(1,maxn),internal::random<int>(1,maxn))) );+    CALL_SUBTEST_5( map_class_matrix<Unaligned>(MatrixXi(internal::random<int>(1,maxn),internal::random<int>(1,maxn))) );+    CALL_SUBTEST_6( map_class_matrix<Aligned>(MatrixXcd(internal::random<int>(1,maxn),internal::random<int>(1,maxn))) );+    CALL_SUBTEST_6( map_class_matrix<Unaligned>(MatrixXcd(internal::random<int>(1,maxn),internal::random<int>(1,maxn))) );++    CALL_SUBTEST_5( bug1453<0>() );+    +    TEST_SET_BUT_UNUSED_VARIABLE(maxn);+  }+}
+ eigen3/test/meta.cpp view
@@ -0,0 +1,97 @@+// This file is part of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2008 Gael Guennebaud <gael.guennebaud@inria.fr>+//+// 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<typename From, typename To>+bool check_is_convertible(const From&, const To&)+{+  return internal::is_convertible<From,To>::value;+}++void test_meta()+{+  VERIFY((internal::conditional<(3<4),internal::true_type, internal::false_type>::type::value));+  VERIFY(( internal::is_same<float,float>::value));+  VERIFY((!internal::is_same<float,double>::value));+  VERIFY((!internal::is_same<float,float&>::value));+  VERIFY((!internal::is_same<float,const float&>::value));+  +  VERIFY(( internal::is_same<float,internal::remove_all<const float&>::type >::value));+  VERIFY(( internal::is_same<float,internal::remove_all<const float*>::type >::value));+  VERIFY(( internal::is_same<float,internal::remove_all<const float*&>::type >::value));+  VERIFY(( internal::is_same<float,internal::remove_all<float**>::type >::value));+  VERIFY(( internal::is_same<float,internal::remove_all<float**&>::type >::value));+  VERIFY(( internal::is_same<float,internal::remove_all<float* const *&>::type >::value));+  VERIFY(( internal::is_same<float,internal::remove_all<float* const>::type >::value));++  // test add_const+  VERIFY(( internal::is_same< internal::add_const<float>::type, const float >::value));+  VERIFY(( internal::is_same< internal::add_const<float*>::type, float* const>::value));+  VERIFY(( internal::is_same< internal::add_const<float const*>::type, float const* const>::value));+  VERIFY(( internal::is_same< internal::add_const<float&>::type, float& >::value));++  // test remove_const+  VERIFY(( internal::is_same< internal::remove_const<float const* const>::type, float const* >::value));+  VERIFY(( internal::is_same< internal::remove_const<float const*>::type, float const* >::value));+  VERIFY(( internal::is_same< internal::remove_const<float* const>::type, float* >::value));++  // test add_const_on_value_type+  VERIFY(( internal::is_same< internal::add_const_on_value_type<float&>::type, float const& >::value));+  VERIFY(( internal::is_same< internal::add_const_on_value_type<float*>::type, float const* >::value));++  VERIFY(( internal::is_same< internal::add_const_on_value_type<float>::type, const float >::value));+  VERIFY(( internal::is_same< internal::add_const_on_value_type<const float>::type, const float >::value));++  VERIFY(( internal::is_same< internal::add_const_on_value_type<const float* const>::type, const float* const>::value));+  VERIFY(( internal::is_same< internal::add_const_on_value_type<float* const>::type, const float* const>::value));+  +  VERIFY(( internal::is_same<float,internal::remove_reference<float&>::type >::value));+  VERIFY(( internal::is_same<const float,internal::remove_reference<const float&>::type >::value));+  VERIFY(( internal::is_same<float,internal::remove_pointer<float*>::type >::value));+  VERIFY(( internal::is_same<const float,internal::remove_pointer<const float*>::type >::value));+  VERIFY(( internal::is_same<float,internal::remove_pointer<float* const >::type >::value));+  +  VERIFY(( internal::is_convertible<float,double>::value ));+  VERIFY(( internal::is_convertible<int,double>::value ));+  VERIFY(( internal::is_convertible<double,int>::value ));+  VERIFY((!internal::is_convertible<std::complex<double>,double>::value ));+  VERIFY(( internal::is_convertible<Array33f,Matrix3f>::value ));+//   VERIFY((!internal::is_convertible<Matrix3f,Matrix3d>::value )); //does not work because the conversion is prevented by a static assertion+  VERIFY((!internal::is_convertible<Array33f,int>::value ));+  VERIFY((!internal::is_convertible<MatrixXf,float>::value ));+  {+    float f;+    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) ));+  }+  +  VERIFY(internal::meta_sqrt<1>::ret == 1);+  #define VERIFY_META_SQRT(X) VERIFY(internal::meta_sqrt<X>::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);+}
+ eigen3/test/metis_support.cpp view
@@ -0,0 +1,25 @@+// This file is part of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2012 Désiré Nuentsa-Wakam <desire.nuentsa_wakam@inria.fr>+//+// 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 <Eigen/SparseLU>+#include <Eigen/MetisSupport>+#include <unsupported/Eigen/SparseExtra>++template<typename T> void test_metis_T()+{+  SparseLU<SparseMatrix<T, ColMajor>, MetisOrdering<int> > sparselu_metis;+  +  check_sparse_square_solving(sparselu_metis); +}++void test_metis_support()+{+  CALL_SUBTEST_1(test_metis_T<double>());+}
+ eigen3/test/miscmatrices.cpp view
@@ -0,0 +1,46 @@+// This file is part of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2006-2008 Benoit Jacob <jacob.benoit.1@gmail.com>+//+// 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<typename MatrixType> void miscMatrices(const MatrixType& m)+{+  /* this test covers the following files:+     DiagonalMatrix.h Ones.h+  */+  typedef typename MatrixType::Scalar Scalar;+  typedef Matrix<Scalar, MatrixType::RowsAtCompileTime, 1> VectorType;+  Index rows = m.rows();+  Index cols = m.cols();++  Index r = internal::random<Index>(0, rows-1), r2 = internal::random<Index>(0, rows-1), c = internal::random<Index>(0, cols-1);+  VERIFY_IS_APPROX(MatrixType::Ones(rows,cols)(r,c), static_cast<Scalar>(1));+  MatrixType m1 = MatrixType::Ones(rows,cols);+  VERIFY_IS_APPROX(m1(r,c), static_cast<Scalar>(1));+  VectorType v1 = VectorType::Random(rows);+  v1[0];+  Matrix<Scalar, MatrixType::RowsAtCompileTime, MatrixType::RowsAtCompileTime>+  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<Scalar>(1));+  square = MatrixType::Zero(rows, rows);+  square.diagonal() = VectorType::Ones(rows);+  VERIFY_IS_APPROX(square, MatrixType::Identity(rows, rows));+}++void test_miscmatrices()+{+  for(int i = 0; i < g_repeat; i++) {+    CALL_SUBTEST_1( miscMatrices(Matrix<float, 1, 1>()) );+    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)) );+  }+}
+ eigen3/test/mixingtypes.cpp view
@@ -0,0 +1,328 @@+// This file is part of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2008-2015 Gael Guennebaud <gael.guennebaud@inria.fr>+// Copyright (C) 2008 Benoit Jacob <jacob.benoit.1@gmail.com>+//+// 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<LhsScalar,RhsScalar>::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<int SizeAtCompileType>+void raise_assertion(Index size = SizeAtCompileType)+{+  // VERIFY_RAISES_ASSERT(mf+md); // does not even compile+  Matrix<float, SizeAtCompileType, 1> vf; vf.setRandom(size);+  Matrix<double, SizeAtCompileType, 1> vd; vd.setRandom(size);+  VERIFY_RAISES_ASSERT(vf=vd);+  VERIFY_RAISES_ASSERT(vf+=vd);+  VERIFY_RAISES_ASSERT(vf-=vd);+  VERIFY_RAISES_ASSERT(vd=vf);+  VERIFY_RAISES_ASSERT(vd+=vf);+  VERIFY_RAISES_ASSERT(vd-=vf);++  //   vd.asDiagonal() * mf;    // does not even compile+  //   vcd.asDiagonal() * mf;   // does not even compile++#if 0 // we get other compilation errors here than just static asserts+  VERIFY_RAISES_ASSERT(vd.dot(vf));+#endif+}+++template<int SizeAtCompileType> void mixingtypes(int size = SizeAtCompileType)+{+  typedef std::complex<float>   CF;+  typedef std::complex<double>  CD;+  typedef Matrix<float, SizeAtCompileType, SizeAtCompileType> Mat_f;+  typedef Matrix<double, SizeAtCompileType, SizeAtCompileType> Mat_d;+  typedef Matrix<std::complex<float>, SizeAtCompileType, SizeAtCompileType> Mat_cf;+  typedef Matrix<std::complex<double>, SizeAtCompileType, SizeAtCompileType> Mat_cd;+  typedef Matrix<float, SizeAtCompileType, 1> Vec_f;+  typedef Matrix<double, SizeAtCompileType, 1> Vec_d;+  typedef Matrix<std::complex<float>, SizeAtCompileType, 1> Vec_cf;+  typedef Matrix<std::complex<double>, SizeAtCompileType, 1> Vec_cd;++  Mat_f mf    = Mat_f::Random(size,size);+  Mat_d md    = mf.template cast<double>();+  //Mat_d rd    = md;+  Mat_cf mcf  = Mat_cf::Random(size,size);+  Mat_cd mcd  = mcf.template cast<complex<double> >();+  Mat_cd rcd = mcd;+  Vec_f vf    = Vec_f::Random(size,1);+  Vec_d vd    = vf.template cast<double>();+  Vec_cf vcf  = Vec_cf::Random(size,1);+  Vec_cd vcd  = vcf.template cast<complex<double> >();+  float           sf  = internal::random<float>();+  double          sd  = internal::random<double>();+  complex<float>  scf = internal::random<complex<float> >();+  complex<double> scd = internal::random<complex<double> >();++  mf+mf;++  float  epsf = std::sqrt(std::numeric_limits<float> ::min EIGEN_EMPTY ());+  double epsd = std::sqrt(std::numeric_limits<double>::min EIGEN_EMPTY ());++  while(std::abs(sf )<epsf) sf  = internal::random<float>();+  while(std::abs(sd )<epsd) sd  = internal::random<double>();+  while(std::abs(scf)<epsf) scf = internal::random<CF>();+  while(std::abs(scd)<epsd) scd = internal::random<CD>();++  // check scalar products+  VERIFY_MIX_SCALAR(vcf * sf , vcf * complex<float>(sf));+  VERIFY_MIX_SCALAR(sd * vcd , complex<double>(sd) * vcd);+  VERIFY_MIX_SCALAR(vf * scf , vf.template cast<complex<float> >() * scf);+  VERIFY_MIX_SCALAR(scd * vd , scd * vd.template cast<complex<double> >());++  VERIFY_MIX_SCALAR(vcf * 2 , vcf * complex<float>(2));+  VERIFY_MIX_SCALAR(vcf * 2.1 , vcf * complex<float>(2.1));+  VERIFY_MIX_SCALAR(2 * vcf, vcf * complex<float>(2));+  VERIFY_MIX_SCALAR(2.1 * vcf , vcf * complex<float>(2.1));++  // check scalar quotients+  VERIFY_MIX_SCALAR(vcf / sf , vcf / complex<float>(sf));+  VERIFY_MIX_SCALAR(vf / scf , vf.template cast<complex<float> >() / scf);+  VERIFY_MIX_SCALAR(vf.array()  / scf, vf.template cast<complex<float> >().array() / scf);+  VERIFY_MIX_SCALAR(scd / vd.array() , scd / vd.template cast<complex<double> >().array());++  // check scalar increment+  VERIFY_MIX_SCALAR(vcf.array() + sf , vcf.array() + complex<float>(sf));+  VERIFY_MIX_SCALAR(sd  + vcd.array(), complex<double>(sd) + vcd.array());+  VERIFY_MIX_SCALAR(vf.array()  + scf, vf.template cast<complex<float> >().array() + scf);+  VERIFY_MIX_SCALAR(scd + vd.array() , scd + vd.template cast<complex<double> >().array());++  // check scalar subtractions+  VERIFY_MIX_SCALAR(vcf.array() - sf , vcf.array() - complex<float>(sf));+  VERIFY_MIX_SCALAR(sd  - vcd.array(), complex<double>(sd) - vcd.array());+  VERIFY_MIX_SCALAR(vf.array()  - scf, vf.template cast<complex<float> >().array() - scf);+  VERIFY_MIX_SCALAR(scd - vd.array() , scd - vd.template cast<complex<double> >().array());++  // check scalar powers+  VERIFY_MIX_SCALAR( pow(vcf.array(), sf),        Eigen::pow(vcf.array(), complex<float>(sf)) );+  VERIFY_MIX_SCALAR( vcf.array().pow(sf) ,        Eigen::pow(vcf.array(), complex<float>(sf)) );+  VERIFY_MIX_SCALAR( pow(sd, vcd.array()),        Eigen::pow(complex<double>(sd), vcd.array()) );+  VERIFY_MIX_SCALAR( Eigen::pow(vf.array(), scf), Eigen::pow(vf.template cast<complex<float> >().array(), scf) );+  VERIFY_MIX_SCALAR( vf.array().pow(scf) ,        Eigen::pow(vf.template cast<complex<float> >().array(), scf) );+  VERIFY_MIX_SCALAR( Eigen::pow(scd, vd.array()), Eigen::pow(scd, vd.template cast<complex<double> >().array()) );++  // check dot product+  vf.dot(vf);+  VERIFY_IS_APPROX(vcf.dot(vf), vcf.dot(vf.template cast<complex<float> >()));++  // check diagonal product+  VERIFY_IS_APPROX(vf.asDiagonal() * mcf, vf.template cast<complex<float> >().asDiagonal() * mcf);+  VERIFY_IS_APPROX(vcd.asDiagonal() * md, vcd.asDiagonal() * md.template cast<complex<double> >());+  VERIFY_IS_APPROX(mcf * vf.asDiagonal(), mcf * vf.template cast<complex<float> >().asDiagonal());+  VERIFY_IS_APPROX(md * vcd.asDiagonal(), md.template cast<complex<double> >() * vcd.asDiagonal());++  // check inner product+  VERIFY_IS_APPROX((vf.transpose() * vcf).value(), (vf.template cast<complex<float> >().transpose() * vcf).value());++  // check outer product+  VERIFY_IS_APPROX((vf * vcf.transpose()).eval(), (vf.template cast<complex<float> >() * vcf.transpose()).eval());++  // coeff wise product++  VERIFY_IS_APPROX((vf * vcf.transpose()).eval(), (vf.template cast<complex<float> >() * vcf.transpose()).eval());++  Mat_cd mcd2 = mcd;+  VERIFY_IS_APPROX(mcd.array() *= md.array(), mcd2.array() *= md.array().template cast<std::complex<double> >());+  +  // check matrix-matrix products+  VERIFY_IS_APPROX(sd*md*mcd, (sd*md).template cast<CD>().eval()*mcd);+  VERIFY_IS_APPROX(sd*mcd*md, sd*mcd*md.template cast<CD>());+  VERIFY_IS_APPROX(scd*md*mcd, scd*md.template cast<CD>().eval()*mcd);+  VERIFY_IS_APPROX(scd*mcd*md, scd*mcd*md.template cast<CD>());++  VERIFY_IS_APPROX(sf*mf*mcf, sf*mf.template cast<CF>()*mcf);+  VERIFY_IS_APPROX(sf*mcf*mf, sf*mcf*mf.template cast<CF>());+  VERIFY_IS_APPROX(scf*mf*mcf, scf*mf.template cast<CF>()*mcf);+  VERIFY_IS_APPROX(scf*mcf*mf, scf*mcf*mf.template cast<CF>());++  VERIFY_IS_APPROX(sd*md.adjoint()*mcd, (sd*md).template cast<CD>().eval().adjoint()*mcd);+  VERIFY_IS_APPROX(sd*mcd.adjoint()*md, sd*mcd.adjoint()*md.template cast<CD>());+  VERIFY_IS_APPROX(sd*md.adjoint()*mcd.adjoint(), (sd*md).template cast<CD>().eval().adjoint()*mcd.adjoint());+  VERIFY_IS_APPROX(sd*mcd.adjoint()*md.adjoint(), sd*mcd.adjoint()*md.template cast<CD>().adjoint());+  VERIFY_IS_APPROX(sd*md*mcd.adjoint(), (sd*md).template cast<CD>().eval()*mcd.adjoint());+  VERIFY_IS_APPROX(sd*mcd*md.adjoint(), sd*mcd*md.template cast<CD>().adjoint());++  VERIFY_IS_APPROX(sf*mf.adjoint()*mcf, (sf*mf).template cast<CF>().eval().adjoint()*mcf);+  VERIFY_IS_APPROX(sf*mcf.adjoint()*mf, sf*mcf.adjoint()*mf.template cast<CF>());+  VERIFY_IS_APPROX(sf*mf.adjoint()*mcf.adjoint(), (sf*mf).template cast<CF>().eval().adjoint()*mcf.adjoint());+  VERIFY_IS_APPROX(sf*mcf.adjoint()*mf.adjoint(), sf*mcf.adjoint()*mf.template cast<CF>().adjoint());+  VERIFY_IS_APPROX(sf*mf*mcf.adjoint(), (sf*mf).template cast<CF>().eval()*mcf.adjoint());+  VERIFY_IS_APPROX(sf*mcf*mf.adjoint(), sf*mcf*mf.template cast<CF>().adjoint());++  VERIFY_IS_APPROX(sf*mf*vcf, (sf*mf).template cast<CF>().eval()*vcf);+  VERIFY_IS_APPROX(scf*mf*vcf,(scf*mf.template cast<CF>()).eval()*vcf);+  VERIFY_IS_APPROX(sf*mcf*vf, sf*mcf*vf.template cast<CF>());+  VERIFY_IS_APPROX(scf*mcf*vf,scf*mcf*vf.template cast<CF>());++  VERIFY_IS_APPROX(sf*vcf.adjoint()*mf,  sf*vcf.adjoint()*mf.template cast<CF>().eval());+  VERIFY_IS_APPROX(scf*vcf.adjoint()*mf, scf*vcf.adjoint()*mf.template cast<CF>().eval());+  VERIFY_IS_APPROX(sf*vf.adjoint()*mcf,  sf*vf.adjoint().template cast<CF>().eval()*mcf);+  VERIFY_IS_APPROX(scf*vf.adjoint()*mcf, scf*vf.adjoint().template cast<CF>().eval()*mcf);++  VERIFY_IS_APPROX(sd*md*vcd, (sd*md).template cast<CD>().eval()*vcd);+  VERIFY_IS_APPROX(scd*md*vcd,(scd*md.template cast<CD>()).eval()*vcd);+  VERIFY_IS_APPROX(sd*mcd*vd, sd*mcd*vd.template cast<CD>().eval());+  VERIFY_IS_APPROX(scd*mcd*vd,scd*mcd*vd.template cast<CD>().eval());++  VERIFY_IS_APPROX(sd*vcd.adjoint()*md,  sd*vcd.adjoint()*md.template cast<CD>().eval());+  VERIFY_IS_APPROX(scd*vcd.adjoint()*md, scd*vcd.adjoint()*md.template cast<CD>().eval());+  VERIFY_IS_APPROX(sd*vd.adjoint()*mcd,  sd*vd.adjoint().template cast<CD>().eval()*mcd);+  VERIFY_IS_APPROX(scd*vd.adjoint()*mcd, scd*vd.adjoint().template cast<CD>().eval()*mcd);++  VERIFY_IS_APPROX( sd*vcd.adjoint()*md.template triangularView<Upper>(),  sd*vcd.adjoint()*md.template cast<CD>().eval().template triangularView<Upper>());+  VERIFY_IS_APPROX(scd*vcd.adjoint()*md.template triangularView<Lower>(), scd*vcd.adjoint()*md.template cast<CD>().eval().template triangularView<Lower>());+  VERIFY_IS_APPROX( sd*vcd.adjoint()*md.transpose().template triangularView<Upper>(),  sd*vcd.adjoint()*md.transpose().template cast<CD>().eval().template triangularView<Upper>());+  VERIFY_IS_APPROX(scd*vcd.adjoint()*md.transpose().template triangularView<Lower>(), scd*vcd.adjoint()*md.transpose().template cast<CD>().eval().template triangularView<Lower>());+  VERIFY_IS_APPROX( sd*vd.adjoint()*mcd.template triangularView<Lower>(),  sd*vd.adjoint().template cast<CD>().eval()*mcd.template triangularView<Lower>());+  VERIFY_IS_APPROX(scd*vd.adjoint()*mcd.template triangularView<Upper>(), scd*vd.adjoint().template cast<CD>().eval()*mcd.template triangularView<Upper>());+  VERIFY_IS_APPROX( sd*vd.adjoint()*mcd.transpose().template triangularView<Lower>(),  sd*vd.adjoint().template cast<CD>().eval()*mcd.transpose().template triangularView<Lower>());+  VERIFY_IS_APPROX(scd*vd.adjoint()*mcd.transpose().template triangularView<Upper>(), scd*vd.adjoint().template cast<CD>().eval()*mcd.transpose().template triangularView<Upper>());++  // Not supported yet: trmm+//   VERIFY_IS_APPROX(sd*mcd*md.template triangularView<Lower>(),  sd*mcd*md.template cast<CD>().eval().template triangularView<Lower>());+//   VERIFY_IS_APPROX(scd*mcd*md.template triangularView<Upper>(), scd*mcd*md.template cast<CD>().eval().template triangularView<Upper>());+//   VERIFY_IS_APPROX(sd*md*mcd.template triangularView<Lower>(),  sd*md.template cast<CD>().eval()*mcd.template triangularView<Lower>());+//   VERIFY_IS_APPROX(scd*md*mcd.template triangularView<Upper>(), scd*md.template cast<CD>().eval()*mcd.template triangularView<Upper>());++  // Not supported yet: symv+//   VERIFY_IS_APPROX(sd*vcd.adjoint()*md.template selfadjointView<Upper>(),  sd*vcd.adjoint()*md.template cast<CD>().eval().template selfadjointView<Upper>());+//   VERIFY_IS_APPROX(scd*vcd.adjoint()*md.template selfadjointView<Lower>(), scd*vcd.adjoint()*md.template cast<CD>().eval().template selfadjointView<Lower>());+//   VERIFY_IS_APPROX(sd*vd.adjoint()*mcd.template selfadjointView<Lower>(),  sd*vd.adjoint().template cast<CD>().eval()*mcd.template selfadjointView<Lower>());+//   VERIFY_IS_APPROX(scd*vd.adjoint()*mcd.template selfadjointView<Upper>(), scd*vd.adjoint().template cast<CD>().eval()*mcd.template selfadjointView<Upper>());++  // Not supported yet: symm+//   VERIFY_IS_APPROX(sd*vcd.adjoint()*md.template selfadjointView<Upper>(),  sd*vcd.adjoint()*md.template cast<CD>().eval().template selfadjointView<Upper>());+//   VERIFY_IS_APPROX(scd*vcd.adjoint()*md.template selfadjointView<Upper>(), scd*vcd.adjoint()*md.template cast<CD>().eval().template selfadjointView<Upper>());+//   VERIFY_IS_APPROX(sd*vd.adjoint()*mcd.template selfadjointView<Upper>(),  sd*vd.adjoint().template cast<CD>().eval()*mcd.template selfadjointView<Upper>());+//   VERIFY_IS_APPROX(scd*vd.adjoint()*mcd.template selfadjointView<Upper>(), scd*vd.adjoint().template cast<CD>().eval()*mcd.template selfadjointView<Upper>());++  rcd.setZero();+  VERIFY_IS_APPROX(Mat_cd(rcd.template triangularView<Upper>() = sd * mcd * md),+                   Mat_cd((sd * mcd * md.template cast<CD>().eval()).template triangularView<Upper>()));+  VERIFY_IS_APPROX(Mat_cd(rcd.template triangularView<Upper>() = sd * md * mcd),+                   Mat_cd((sd * md.template cast<CD>().eval() * mcd).template triangularView<Upper>()));+  VERIFY_IS_APPROX(Mat_cd(rcd.template triangularView<Upper>() = scd * mcd * md),+                   Mat_cd((scd * mcd * md.template cast<CD>().eval()).template triangularView<Upper>()));+  VERIFY_IS_APPROX(Mat_cd(rcd.template triangularView<Upper>() = scd * md * mcd),+                   Mat_cd((scd * md.template cast<CD>().eval() * mcd).template triangularView<Upper>()));+++  VERIFY_IS_APPROX( md.array()  * mcd.array(), md.template cast<CD>().eval().array() * mcd.array() );+  VERIFY_IS_APPROX( mcd.array() * md.array(),  mcd.array() * md.template cast<CD>().eval().array() );++  VERIFY_IS_APPROX( md.array()  + mcd.array(), md.template cast<CD>().eval().array() + mcd.array() );+  VERIFY_IS_APPROX( mcd.array() + md.array(),  mcd.array() + md.template cast<CD>().eval().array() );++  VERIFY_IS_APPROX( md.array()  - mcd.array(), md.template cast<CD>().eval().array() - mcd.array() );+  VERIFY_IS_APPROX( mcd.array() - md.array(),  mcd.array() - md.template cast<CD>().eval().array() );++  if(mcd.array().abs().minCoeff()>epsd)+  {+    VERIFY_IS_APPROX( md.array() / mcd.array(), md.template cast<CD>().eval().array() / mcd.array() );+  }+  if(md.array().abs().minCoeff()>epsd)+  {+    VERIFY_IS_APPROX( mcd.array() / md.array(), mcd.array() / md.template cast<CD>().eval().array() );+  }++  if(md.array().abs().minCoeff()>epsd || mcd.array().abs().minCoeff()>epsd)+  {+    VERIFY_IS_APPROX( md.array().pow(mcd.array()), md.template cast<CD>().eval().array().pow(mcd.array()) );+    VERIFY_IS_APPROX( mcd.array().pow(md.array()),  mcd.array().pow(md.template cast<CD>().eval().array()) );++    VERIFY_IS_APPROX( pow(md.array(),mcd.array()), md.template cast<CD>().eval().array().pow(mcd.array()) );+    VERIFY_IS_APPROX( pow(mcd.array(),md.array()),  mcd.array().pow(md.template cast<CD>().eval().array()) );+  }++  rcd = mcd;+  VERIFY_IS_APPROX( rcd = md, md.template cast<CD>().eval() );+  rcd = mcd;+  VERIFY_IS_APPROX( rcd += md, mcd + md.template cast<CD>().eval() );+  rcd = mcd;+  VERIFY_IS_APPROX( rcd -= md, mcd - md.template cast<CD>().eval() );+  rcd = mcd;+  VERIFY_IS_APPROX( rcd.array() *= md.array(), mcd.array() * md.template cast<CD>().eval().array() );+  rcd = mcd;+  if(md.array().abs().minCoeff()>epsd)+  {+    VERIFY_IS_APPROX( rcd.array() /= md.array(), mcd.array() / md.template cast<CD>().eval().array() );+  }++  rcd = mcd;+  VERIFY_IS_APPROX( rcd.noalias() += md + mcd*md, mcd + (md.template cast<CD>().eval()) + mcd*(md.template cast<CD>().eval()));++  VERIFY_IS_APPROX( rcd.noalias()  = md*md,       ((md*md).eval().template cast<CD>()) );+  rcd = mcd;+  VERIFY_IS_APPROX( rcd.noalias() += md*md, mcd + ((md*md).eval().template cast<CD>()) );+  rcd = mcd;+  VERIFY_IS_APPROX( rcd.noalias() -= md*md, mcd - ((md*md).eval().template cast<CD>()) );++  VERIFY_IS_APPROX( rcd.noalias()  = mcd + md*md,       mcd + ((md*md).eval().template cast<CD>()) );+  rcd = mcd;+  VERIFY_IS_APPROX( rcd.noalias() += mcd + md*md, mcd + mcd + ((md*md).eval().template cast<CD>()) );+  rcd = mcd;+  VERIFY_IS_APPROX( rcd.noalias() -= mcd + md*md,           - ((md*md).eval().template cast<CD>()) );+}++void test_mixingtypes()+{+  for(int i = 0; i < g_repeat; i++) {+    CALL_SUBTEST_1(mixingtypes<3>());+    CALL_SUBTEST_2(mixingtypes<4>());+    CALL_SUBTEST_3(mixingtypes<Dynamic>(internal::random<int>(1,EIGEN_TEST_MAX_SIZE)));++    CALL_SUBTEST_4(mixingtypes<3>());+    CALL_SUBTEST_5(mixingtypes<4>());+    CALL_SUBTEST_6(mixingtypes<Dynamic>(internal::random<int>(1,EIGEN_TEST_MAX_SIZE)));+    CALL_SUBTEST_7(raise_assertion<Dynamic>(internal::random<int>(1,EIGEN_TEST_MAX_SIZE)));+  }+  CALL_SUBTEST_7(raise_assertion<0>());+  CALL_SUBTEST_7(raise_assertion<3>());+  CALL_SUBTEST_7(raise_assertion<4>());+  CALL_SUBTEST_7(raise_assertion<Dynamic>(0));+}
+ eigen3/test/mpl2only.cpp view
@@ -0,0 +1,22 @@+// This file is part of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2015 Gael Guennebaud <gael.guennebaud@inria.fr>+//+// 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_MPL2_ONLY+#include <Eigen/Dense>+#include <Eigen/SparseCore>+#include <Eigen/SparseLU>+#include <Eigen/SparseQR>+#include <Eigen/Sparse>+#include <Eigen/IterativeLinearSolvers>+#include <Eigen/Eigen>++int main()+{+  return 0;+}
+ eigen3/test/nesting_ops.cpp view
@@ -0,0 +1,107 @@+// This file is part of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2010 Hauke Heibel <hauke.heibel@gmail.com>+// Copyright (C) 2015 Gael Guennebaud <gael.guennebaud@inria.fr>+//+// 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 <int N, typename XprType>+void use_n_times(const XprType &xpr)+{+  typename internal::nested_eval<XprType,N>::type mat(xpr);+  typename XprType::PlainObject res(mat.rows(), mat.cols());+  nb_temporaries--; // remove res+  res.setZero();+  for(int i=0; i<N; ++i)+    res += mat;+}++template <int N, typename ReferenceType, typename XprType>+bool verify_eval_type(const XprType &, const ReferenceType&)+{+  typedef typename internal::nested_eval<XprType,N>::type EvalType;+  return internal::is_same<typename internal::remove_all<EvalType>::type, typename internal::remove_all<ReferenceType>::type>::value;+}++template <typename MatrixType> void run_nesting_ops_1(const MatrixType& _m)+{+  typename internal::nested_eval<MatrixType,2>::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 <typename MatrixType> 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<Scalar,MatrixType::RowsAtCompileTime,MatrixType::ColsAtCompileTime,ColMajor> 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<Lower>().solve(m1.col(0))), 1 );+    VERIFY_EVALUATION_COUNT( use_n_times<10>(m1.template triangularView<Lower>().solve(m1.col(0))), 1 );++    VERIFY_EVALUATION_COUNT( use_n_times<1>(Scalar(2)*m1.template triangularView<Lower>().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<Lower>().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<Lower>().solve(m1.col(0))), 2 );+  }++  {+    VERIFY( verify_eval_type<10>(m1, m1) );+    if(!NumTraits<Scalar>::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<Lower>().solve(m1), m1) );+    VERIFY( verify_eval_type<1>(m1+m1.template triangularView<Lower>().solve(m1), m1) );+  }+}+++void 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<int>(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)+}
+ eigen3/test/nomalloc.cpp view
@@ -0,0 +1,228 @@+// This file is part of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2008 Gael Guennebaud <gael.guennebaud@inria.fr>+// Copyright (C) 2006-2008 Benoit Jacob <jacob.benoit.1@gmail.com>+//+// 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 <Eigen/Cholesky>+#include <Eigen/Eigenvalues>+#include <Eigen/LU>+#include <Eigen/QR>+#include <Eigen/SVD>++template<typename MatrixType> 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<Scalar>();++  Index r = internal::random<Index>(0, rows-1),+        c = internal::random<Index>(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<Upper>() * m1.col(0);+  m2.col(0).noalias() -= m1.adjoint().template triangularView<Upper>() * m1.col(0);+  m2.col(0).noalias() -= m1.template triangularView<Upper>() * m1.row(0).adjoint();+  m2.col(0).noalias() -= m1.adjoint().template triangularView<Upper>() * m1.row(0).adjoint();++  m2.row(0).noalias() = m1.row(0) * m1.template triangularView<Upper>();+  m2.row(0).noalias() -= m1.row(0) * m1.adjoint().template triangularView<Upper>();+  m2.row(0).noalias() -= m1.col(0).adjoint() * m1.template triangularView<Upper>();+  m2.row(0).noalias() -= m1.col(0).adjoint() * m1.adjoint().template triangularView<Upper>();+  VERIFY_IS_APPROX(m2,m2);+  +  m2.col(0).noalias() = m1.template selfadjointView<Upper>() * m1.col(0);+  m2.col(0).noalias() -= m1.adjoint().template selfadjointView<Upper>() * m1.col(0);+  m2.col(0).noalias() -= m1.template selfadjointView<Upper>() * m1.row(0).adjoint();+  m2.col(0).noalias() -= m1.adjoint().template selfadjointView<Upper>() * m1.row(0).adjoint();++  m2.row(0).noalias() = m1.row(0) * m1.template selfadjointView<Upper>();+  m2.row(0).noalias() -= m1.row(0) * m1.adjoint().template selfadjointView<Upper>();+  m2.row(0).noalias() -= m1.col(0).adjoint() * m1.template selfadjointView<Upper>();+  m2.row(0).noalias() -= m1.col(0).adjoint() * m1.adjoint().template selfadjointView<Upper>();+  VERIFY_IS_APPROX(m2,m2);+  +  m2.template selfadjointView<Lower>().rankUpdate(m1.col(0),-1);+  m2.template selfadjointView<Upper>().rankUpdate(m1.row(0),-1);+  m2.template selfadjointView<Lower>().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<Lower>().rankUpdate(m1);+  m2 += m2.template triangularView<Upper>() * m1;+  m2.template triangularView<Upper>() = m2 * m2;+  m1 += m1.template selfadjointView<Lower>() * m2;+  VERIFY_IS_APPROX(m2,m2);+}++template<typename Scalar>+void ctms_decompositions()+{+  const int maxSize = 16;+  const int size    = 12;++  typedef Eigen::Matrix<Scalar,+                        Eigen::Dynamic, Eigen::Dynamic,+                        0,+                        maxSize, maxSize> Matrix;++  typedef Eigen::Matrix<Scalar,+                        Eigen::Dynamic, 1,+                        0,+                        maxSize, 1> Vector;++  typedef Eigen::Matrix<std::complex<Scalar>,+                        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<Matrix>  LLT;  LLT.compute(A);+  X = LLT.solve(B);+  x = LLT.solve(b);+  Eigen::LDLT<Matrix> LDLT; LDLT.compute(A);+  X = LDLT.solve(B);+  x = LDLT.solve(b);++  // Eigenvalues module+  Eigen::HessenbergDecomposition<ComplexMatrix> hessDecomp;        hessDecomp.compute(complexA);+  Eigen::ComplexSchur<ComplexMatrix>            cSchur(size);      cSchur.compute(complexA);+  Eigen::ComplexEigenSolver<ComplexMatrix>      cEigSolver;        cEigSolver.compute(complexA);+  Eigen::EigenSolver<Matrix>                    eigSolver;         eigSolver.compute(A);+  Eigen::SelfAdjointEigenSolver<Matrix>         saEigSolver(size); saEigSolver.compute(saA);+  Eigen::Tridiagonalization<Matrix>             tridiag;           tridiag.compute(saA);++  // LU module+  Eigen::PartialPivLU<Matrix> ppLU; ppLU.compute(A);+  X = ppLU.solve(B);+  x = ppLU.solve(b);+  Eigen::FullPivLU<Matrix>    fpLU; fpLU.compute(A);+  X = fpLU.solve(B);+  x = fpLU.solve(b);++  // QR module+  Eigen::HouseholderQR<Matrix>        hQR;  hQR.compute(A);+  X = hQR.solve(B);+  x = hQR.solve(b);+  Eigen::ColPivHouseholderQR<Matrix>  cpQR; cpQR.compute(A);+  X = cpQR.solve(B);+  x = cpQR.solve(b);+  Eigen::FullPivHouseholderQR<Matrix> fpQR; fpQR.compute(A);+  // FIXME X = fpQR.solve(B);+  x = fpQR.solve(b);++  // SVD module+  Eigen::JacobiSVD<Matrix> 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<typename MatrixType> 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};+  typename MatrixType::Index rows = m.rows(), cols=m.cols();+  typedef Eigen::Matrix<Scalar, Eigen::Dynamic, Eigen::Dynamic, Flag         > MatrixX;+  typedef Eigen::Matrix<Scalar, Eigen::Dynamic, Eigen::Dynamic, TransposeFlag> MatrixXT;+  // Dynamic reference:+  typedef Eigen::Ref<const MatrixX  > Ref;+  typedef Eigen::Ref<const MatrixXT > 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<const MatrixX, Unaligned, Stride<Dynamic, Dynamic> > r10=r8, r11=m;++  // Initializing from an incompatible Ref will malloc:+  typedef Eigen::Ref<const MatrixX, Aligned> RefAligned;+  VERIFY_RAISES_ASSERT(RefAligned r12=r10);+  VERIFY_RAISES_ASSERT(Ref r13=r10); // r10 has more dynamic strides++}++void test_nomalloc()+{+  // create some dynamic objects+  Eigen::MatrixXd M1 = MatrixXd::Random(3,3);+  Ref<const MatrixXd> 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<float, 1, 1>()) );+  CALL_SUBTEST_2(nomalloc(Matrix4d()) );+  CALL_SUBTEST_3(nomalloc(Matrix<float,32,32>()) );+  +  // Check decomposition modules with dynamic matrices that have a known compile-time max size (ctms)+  CALL_SUBTEST_4(ctms_decompositions<float>());++  CALL_SUBTEST_5(test_zerosized());++  CALL_SUBTEST_6(test_reference(Matrix<float,32,32>()));+  CALL_SUBTEST_7(test_reference(R1));+  CALL_SUBTEST_8(Ref<MatrixXd> R2 = M1.topRows<2>(); test_reference(R2));+}
+ eigen3/test/nullary.cpp view
@@ -0,0 +1,304 @@+// This file is part of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2010-2011 Jitse Niesen <jitse@maths.leeds.ac.uk>+// Copyright (C) 2016 Gael Guennebaud <gael.guennebaud@inria.fr>+//+// 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<typename MatrixType>+bool equalsIdentity(const MatrixType& A)+{+  typedef typename MatrixType::Scalar Scalar;+  Scalar zero = static_cast<Scalar>(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<typename VectorType>+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<RealScalar,float>::value ? NumTraits<RealScalar>::dummy_precision()*10 : NumTraits<RealScalar>::dummy_precision()/10;+  Index size = v.size();++  if(size<20)+    return;++  for (int i=0; i<size; ++i)+  {+    if(i<5 || i>size-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<typename VectorType>+void testVectorType(const VectorType& base)+{+  typedef typename VectorType::Scalar Scalar;+  typedef typename VectorType::RealScalar RealScalar;++  const Index size = base.size();+  +  Scalar high = internal::random<Scalar>(-500,500);+  Scalar low = (size == 1 ? high : internal::random<Scalar>(-500,500));+  if (low>high) std::swap(low,high);++  // check low==high+  if(internal::random<float>(0.f,1.f)<0.05f)+    low = high;+  // check abs(low) >> abs(high)+  else if(size>2 && std::numeric_limits<RealScalar>::max_exponent10>0 && internal::random<float>(0.f,1.f)<0.1f)+    low = -internal::random<Scalar>(1,2) * RealScalar(std::pow(RealScalar(10),std::numeric_limits<RealScalar>::max_exponent10/2));++  const Scalar step = ((size == 1) ? 1 : (high-low)/(size-1));++  // check whether the result yields what we expect it to do+  VectorType m(base);+  m.setLinSpaced(size,low,high);++  if(!NumTraits<Scalar>::IsInteger)+  {+    VectorType n(size);+    for (int i=0; i<size; ++i)+      n(i) = low+i*step;+    VERIFY_IS_APPROX(m,n);++    CALL_SUBTEST( check_extremity_accuracy(m, low, high) );+  }++  if((!NumTraits<Scalar>::IsInteger) || ((high-low)>=size && (Index(high-low)%(size-1))==0) || (Index(high-low+1)<size && (size%Index(high-low+1))==0))+  {+    VectorType n(size);+    if((!NumTraits<Scalar>::IsInteger) || (high-low>=size))+      for (int i=0; i<size; ++i)+        n(i) = size==1 ? low : (low + ((high-low)*Scalar(i))/(size-1));+    else+      for (int i=0; i<size; ++i)+        n(i) = size==1 ? low : low + Scalar((double(high-low+1)*double(i))/double(size));+    VERIFY_IS_APPROX(m,n);++    // random access version+    m = VectorType::LinSpaced(size,low,high);+    VERIFY_IS_APPROX(m,n);+    VERIFY( internal::isApprox(m(m.size()-1),high) );+    VERIFY( size==1 || internal::isApprox(m(0),low) );+    VERIFY_IS_EQUAL(m(m.size()-1) , high);+    if(!NumTraits<Scalar>::IsInteger)+      CALL_SUBTEST( check_extremity_accuracy(m, low, high) );+  }++  VERIFY( m(m.size()-1) <= high );+  VERIFY( (m.array() <= high).all() );+  VERIFY( (m.array() >= low).all() );+++  VERIFY( m(m.size()-1) >= 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<Scalar,Dynamic,1> row_vector(size);+  Matrix<Scalar,1,Dynamic> 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(), Scalar(2)*NumTraits<Scalar>::epsilon()));++  Matrix<Scalar,Dynamic,1> size_changer(size+50);+  size_changer.setLinSpaced(size,low,high);+  VERIFY( size_changer.size() == size );++  typedef Matrix<Scalar,1,1> 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<Scalar>::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<Scalar>();+    m = VectorType::LinSpaced(n0,low,low-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-1).sum(),Scalar(0));+    }++    m.setLinSpaced(n0,0,Scalar(n0-1));+    VERIFY(m.size()==n0);+    m.setLinSpaced(n0,low,low-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<Scalar>::IsInteger)+    {+      VERIFY_IS_APPROX( VectorType::LinSpaced(size,low,Scalar(low+size-1)), VectorType::LinSpaced(size,Scalar(low+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,Scalar(low+(size-1)*k)), VectorType::LinSpaced(size,Scalar(low+(size-1)*k),low).reverse() );+        // Check negative divisor path:+        for(Index k=1; k<5; ++k)+          VERIFY_IS_APPROX( VectorType::LinSpaced(size*k,low,Scalar(low+size-1)), VectorType::LinSpaced(size*k,Scalar(low+size-1),low).reverse() );+      }+    }+  }+}++template<typename MatrixType>+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<Scalar>();+  } while(abs(s1)<RealScalar(1e-5) && (!NumTraits<Scalar>::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<Index>(0,rows-1);+  Index j = internal::random<Index>(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 );+}++void test_nullary()+{+  CALL_SUBTEST_1( testMatrixType(Matrix2d()) );+  CALL_SUBTEST_2( testMatrixType(MatrixXcf(internal::random<int>(1,300),internal::random<int>(1,300))) );+  CALL_SUBTEST_3( testMatrixType(MatrixXf(internal::random<int>(1,300),internal::random<int>(1,300))) );+  +  for(int i = 0; i < g_repeat*10; i++) {+    CALL_SUBTEST_4( testVectorType(VectorXd(internal::random<int>(1,30000))) );+    CALL_SUBTEST_5( testVectorType(Vector4d()) );  // regression test for bug 232+    CALL_SUBTEST_6( testVectorType(Vector3d()) );+    CALL_SUBTEST_7( testVectorType(VectorXf(internal::random<int>(1,30000))) );+    CALL_SUBTEST_8( testVectorType(Vector3f()) );+    CALL_SUBTEST_8( testVectorType(Vector4f()) );+    CALL_SUBTEST_8( testVectorType(Matrix<float,8,1>()) );+    CALL_SUBTEST_8( testVectorType(Matrix<float,1,1>()) );++    CALL_SUBTEST_9( testVectorType(VectorXi(internal::random<int>(1,10))) );+    CALL_SUBTEST_9( testVectorType(VectorXi(internal::random<int>(9,300))) );+    CALL_SUBTEST_9( testVectorType(Matrix<int,1,1>()) );+  }++#ifdef EIGEN_TEST_PART_6+  // 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<double>::epsilon() );+#endif++#ifdef EIGEN_TEST_PART_9+  // Check possible overflow issue+  {+    int n = 60000;+    ArrayXi a1(n), a2(n);+    a1.setLinSpaced(n, 0, n-1);+    for(int i=0; i<n; ++i)+      a2(i) = i;+    VERIFY_IS_APPROX(a1,a2);+  }+#endif++#ifdef EIGEN_TEST_PART_10+  // check some internal logic+  VERIFY((  internal::has_nullary_operator<internal::scalar_constant_op<double> >::value ));+  VERIFY(( !internal::has_unary_operator<internal::scalar_constant_op<double> >::value ));+  VERIFY(( !internal::has_binary_operator<internal::scalar_constant_op<double> >::value ));+  VERIFY((  internal::functor_has_linear_access<internal::scalar_constant_op<double> >::ret ));++  VERIFY(( !internal::has_nullary_operator<internal::scalar_identity_op<double> >::value ));+  VERIFY(( !internal::has_unary_operator<internal::scalar_identity_op<double> >::value ));+  VERIFY((  internal::has_binary_operator<internal::scalar_identity_op<double> >::value ));+  VERIFY(( !internal::functor_has_linear_access<internal::scalar_identity_op<double> >::ret ));++  VERIFY(( !internal::has_nullary_operator<internal::linspaced_op<float,float> >::value ));+  VERIFY((  internal::has_unary_operator<internal::linspaced_op<float,float> >::value ));+  VERIFY(( !internal::has_binary_operator<internal::linspaced_op<float,float> >::value ));+  VERIFY((  internal::functor_has_linear_access<internal::linspaced_op<float,float> >::ret ));++  // Regression unit test for a weird MSVC bug.+  // Search "nullary_wrapper_workaround_msvc" in CoreEvaluators.h for the details.+  // See also traits<Ref>::match.+  {+    MatrixXf A = MatrixXf::Random(3,3);+    Ref<const MatrixXf> R = 2.0*A;+    VERIFY_IS_APPROX(R, A+A);++    Ref<const MatrixXf> R1 = MatrixXf::Random(3,3)+A;++    VectorXi V = VectorXi::Random(3);+    Ref<const VectorXi> R2 = VectorXi::LinSpaced(3,1,3)+V;+    VERIFY_IS_APPROX(R2, V+Vector3i(1,2,3));++    VERIFY((  internal::has_nullary_operator<internal::scalar_constant_op<float> >::value ));+    VERIFY(( !internal::has_unary_operator<internal::scalar_constant_op<float> >::value ));+    VERIFY(( !internal::has_binary_operator<internal::scalar_constant_op<float> >::value ));+    VERIFY((  internal::functor_has_linear_access<internal::scalar_constant_op<float> >::ret ));++    VERIFY(( !internal::has_nullary_operator<internal::linspaced_op<int,int> >::value ));+    VERIFY((  internal::has_unary_operator<internal::linspaced_op<int,int> >::value ));+    VERIFY(( !internal::has_binary_operator<internal::linspaced_op<int,int> >::value ));+    VERIFY((  internal::functor_has_linear_access<internal::linspaced_op<int,int> >::ret ));+  }+#endif+}
+ eigen3/test/numext.cpp view
@@ -0,0 +1,53 @@+// This file is part of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2017 Gael Guennebaud <gael.guennebaud@inria.fr>+//+// 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<typename T>+void check_abs() {+  typedef typename NumTraits<T>::Real Real;++  if(NumTraits<T>::IsSigned)+    VERIFY_IS_EQUAL(numext::abs(-T(1)), T(1));+  VERIFY_IS_EQUAL(numext::abs(T(0)), T(0));+  VERIFY_IS_EQUAL(numext::abs(T(1)), T(1));++  for(int k=0; k<g_repeat*100; ++k)+  {+    T x = internal::random<T>();+    if(!internal::is_same<T,bool>::value)+      x = x/Real(2);+    if(NumTraits<T>::IsSigned)+    {+      VERIFY_IS_EQUAL(numext::abs(x), numext::abs(-x));+      VERIFY( numext::abs(-x) >= Real(0));+    }+    VERIFY( numext::abs(x) >= Real(0));+    VERIFY_IS_APPROX( numext::abs2(x), numext::abs2(numext::abs(x)) );+  }+}++void test_numext() {+  CALL_SUBTEST( check_abs<bool>() );+  CALL_SUBTEST( check_abs<signed char>() );+  CALL_SUBTEST( check_abs<unsigned char>() );+  CALL_SUBTEST( check_abs<short>() );+  CALL_SUBTEST( check_abs<unsigned short>() );+  CALL_SUBTEST( check_abs<int>() );+  CALL_SUBTEST( check_abs<unsigned int>() );+  CALL_SUBTEST( check_abs<long>() );+  CALL_SUBTEST( check_abs<unsigned long>() );+  CALL_SUBTEST( check_abs<half>() );+  CALL_SUBTEST( check_abs<float>() );+  CALL_SUBTEST( check_abs<double>() );+  CALL_SUBTEST( check_abs<long double>() );++  CALL_SUBTEST( check_abs<std::complex<float> >() );+  CALL_SUBTEST( check_abs<std::complex<double> >() );+}
+ eigen3/test/packetmath.cpp view
@@ -0,0 +1,641 @@+// This file is part of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2008-2009 Gael Guennebaud <gael.guennebaud@inria.fr>+// Copyright (C) 2006-2008 Benoit Jacob <jacob.benoit.1@gmail.com>+//+// 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 "unsupported/Eigen/SpecialFunctions"++#if defined __GNUC__ && __GNUC__>=6+  #pragma GCC diagnostic ignored "-Wignored-attributes"+#endif+// using namespace Eigen;++#ifdef EIGEN_VECTORIZE_SSE+const bool g_vectorize_sse = true;+#else+const bool g_vectorize_sse = false;+#endif++namespace Eigen {+namespace internal {+template<typename T> T negate(const T& x) { return -x; }+}+}++// NOTE: we disbale inlining for this function to workaround a GCC issue when using -O3 and the i387 FPU.+template<typename Scalar> EIGEN_DONT_INLINE+bool isApproxAbs(const Scalar& a, const Scalar& b, const typename NumTraits<Scalar>::Real& refvalue)+{+  return internal::isMuchSmallerThan(a-b, refvalue);+}++template<typename Scalar> bool areApproxAbs(const Scalar* a, const Scalar* b, int size, const typename NumTraits<Scalar>::Real& refvalue)+{+  for (int i=0; i<size; ++i)+  {+    if (!isApproxAbs(a[i],b[i],refvalue))+    {+      std::cout << "ref: [" << Map<const Matrix<Scalar,1,Dynamic> >(a,size) << "]" << " != vec: [" << Map<const Matrix<Scalar,1,Dynamic> >(b,size) << "]\n";+      return false;+    }+  }+  return true;+}++template<typename Scalar> bool areApprox(const Scalar* a, const Scalar* b, int size)+{+  for (int i=0; i<size; ++i)+  {+    if (a[i]!=b[i] && !internal::isApprox(a[i],b[i]))+    {+      std::cout << "ref: [" << Map<const Matrix<Scalar,1,Dynamic> >(a,size) << "]" << " != vec: [" << Map<const Matrix<Scalar,1,Dynamic> >(b,size) << "]\n";+      return false;+    }+  }+  return true;+}++#define CHECK_CWISE1(REFOP, POP) { \+  for (int i=0; i<PacketSize; ++i) \+    ref[i] = REFOP(data1[i]); \+  internal::pstore(data2, POP(internal::pload<Packet>(data1))); \+  VERIFY(areApprox(ref, data2, PacketSize) && #POP); \+}++template<bool Cond,typename Packet>+struct packet_helper+{+  template<typename T>+  inline Packet load(const T* from) const { return internal::pload<Packet>(from); }++  template<typename T>+  inline void store(T* to, const Packet& x) const { internal::pstore(to,x); }+};++template<typename Packet>+struct packet_helper<false,Packet>+{+  template<typename T>+  inline T load(const T* from) const { return *from; }++  template<typename T>+  inline void store(T* to, const T& x) const { *to = x; }+};++#define CHECK_CWISE1_IF(COND, REFOP, POP) if(COND) { \+  packet_helper<COND,Packet> h; \+  for (int i=0; i<PacketSize; ++i) \+    ref[i] = REFOP(data1[i]); \+  h.store(data2, POP(h.load(data1))); \+  VERIFY(areApprox(ref, data2, PacketSize) && #POP); \+}++#define CHECK_CWISE2_IF(COND, REFOP, POP) if(COND) { \+  packet_helper<COND,Packet> h; \+  for (int i=0; i<PacketSize; ++i) \+    ref[i] = REFOP(data1[i], data1[i+PacketSize]); \+  h.store(data2, POP(h.load(data1),h.load(data1+PacketSize))); \+  VERIFY(areApprox(ref, data2, PacketSize) && #POP); \+}++#define REF_ADD(a,b) ((a)+(b))+#define REF_SUB(a,b) ((a)-(b))+#define REF_MUL(a,b) ((a)*(b))+#define REF_DIV(a,b) ((a)/(b))++template<typename Scalar> void packetmath()+{+  using std::abs;+  typedef internal::packet_traits<Scalar> PacketTraits;+  typedef typename PacketTraits::type Packet;+  const int PacketSize = PacketTraits::size;+  typedef typename NumTraits<Scalar>::Real RealScalar;++  const int max_size = PacketSize > 4 ? PacketSize : 4;+  const int size = PacketSize*max_size;+  EIGEN_ALIGN_MAX Scalar data1[size];+  EIGEN_ALIGN_MAX Scalar data2[size];+  EIGEN_ALIGN_MAX Packet packets[PacketSize*2];+  EIGEN_ALIGN_MAX Scalar ref[size];+  RealScalar refvalue = 0;+  for (int i=0; i<size; ++i)+  {+    data1[i] = internal::random<Scalar>()/RealScalar(PacketSize);+    data2[i] = internal::random<Scalar>()/RealScalar(PacketSize);+    refvalue = (std::max)(refvalue,abs(data1[i]));+  }++  internal::pstore(data2, internal::pload<Packet>(data1));+  VERIFY(areApprox(data1, data2, PacketSize) && "aligned load/store");++  for (int offset=0; offset<PacketSize; ++offset)+  {+    internal::pstore(data2, internal::ploadu<Packet>(data1+offset));+    VERIFY(areApprox(data1+offset, data2, PacketSize) && "internal::ploadu");+  }++  for (int offset=0; offset<PacketSize; ++offset)+  {+    internal::pstoreu(data2+offset, internal::pload<Packet>(data1));+    VERIFY(areApprox(data1, data2+offset, PacketSize) && "internal::pstoreu");+  }++  for (int offset=0; offset<PacketSize; ++offset)+  {+    packets[0] = internal::pload<Packet>(data1);+    packets[1] = internal::pload<Packet>(data1+PacketSize);+         if (offset==0) internal::palign<0>(packets[0], packets[1]);+    else if (offset==1) internal::palign<1>(packets[0], packets[1]);+    else if (offset==2) internal::palign<2>(packets[0], packets[1]);+    else if (offset==3) internal::palign<3>(packets[0], packets[1]);+    else if (offset==4) internal::palign<4>(packets[0], packets[1]);+    else if (offset==5) internal::palign<5>(packets[0], packets[1]);+    else if (offset==6) internal::palign<6>(packets[0], packets[1]);+    else if (offset==7) internal::palign<7>(packets[0], packets[1]);+    else if (offset==8) internal::palign<8>(packets[0], packets[1]);+    else if (offset==9) internal::palign<9>(packets[0], packets[1]);+    else if (offset==10) internal::palign<10>(packets[0], packets[1]);+    else if (offset==11) internal::palign<11>(packets[0], packets[1]);+    else if (offset==12) internal::palign<12>(packets[0], packets[1]);+    else if (offset==13) internal::palign<13>(packets[0], packets[1]);+    else if (offset==14) internal::palign<14>(packets[0], packets[1]);+    else if (offset==15) internal::palign<15>(packets[0], packets[1]);+    internal::pstore(data2, packets[0]);++    for (int i=0; i<PacketSize; ++i)+      ref[i] = data1[i+offset];++    VERIFY(areApprox(ref, data2, PacketSize) && "internal::palign");+  }++  VERIFY((!PacketTraits::Vectorizable) || PacketTraits::HasAdd);+  VERIFY((!PacketTraits::Vectorizable) || PacketTraits::HasSub);+  VERIFY((!PacketTraits::Vectorizable) || PacketTraits::HasMul);+  VERIFY((!PacketTraits::Vectorizable) || PacketTraits::HasNegate);+  VERIFY((internal::is_same<Scalar,int>::value) || (!PacketTraits::Vectorizable) || PacketTraits::HasDiv);++  CHECK_CWISE2_IF(PacketTraits::HasAdd, REF_ADD,  internal::padd);+  CHECK_CWISE2_IF(PacketTraits::HasSub, REF_SUB,  internal::psub);+  CHECK_CWISE2_IF(PacketTraits::HasMul, REF_MUL,  internal::pmul);+  CHECK_CWISE2_IF(PacketTraits::HasDiv, REF_DIV, internal::pdiv);++  CHECK_CWISE1(internal::negate, internal::pnegate);+  CHECK_CWISE1(numext::conj, internal::pconj);++  for(int offset=0;offset<3;++offset)+  {+    for (int i=0; i<PacketSize; ++i)+      ref[i] = data1[offset];+    internal::pstore(data2, internal::pset1<Packet>(data1[offset]));+    VERIFY(areApprox(ref, data2, PacketSize) && "internal::pset1");+  }++  {+    for (int i=0; i<PacketSize*4; ++i)+      ref[i] = data1[i/PacketSize];+    Packet A0, A1, A2, A3;+    internal::pbroadcast4<Packet>(data1, A0, A1, A2, A3);+    internal::pstore(data2+0*PacketSize, A0);+    internal::pstore(data2+1*PacketSize, A1);+    internal::pstore(data2+2*PacketSize, A2);+    internal::pstore(data2+3*PacketSize, A3);+    VERIFY(areApprox(ref, data2, 4*PacketSize) && "internal::pbroadcast4");+  }++  {+    for (int i=0; i<PacketSize*2; ++i)+      ref[i] = data1[i/PacketSize];+    Packet A0, A1;+    internal::pbroadcast2<Packet>(data1, A0, A1);+    internal::pstore(data2+0*PacketSize, A0);+    internal::pstore(data2+1*PacketSize, A1);+    VERIFY(areApprox(ref, data2, 2*PacketSize) && "internal::pbroadcast2");+  }++  VERIFY(internal::isApprox(data1[0], internal::pfirst(internal::pload<Packet>(data1))) && "internal::pfirst");++  if(PacketSize>1)+  {+    for(int offset=0;offset<4;++offset)+    {+      for(int i=0;i<PacketSize/2;++i)+        ref[2*i+0] = ref[2*i+1] = data1[offset+i];+      internal::pstore(data2,internal::ploaddup<Packet>(data1+offset));+      VERIFY(areApprox(ref, data2, PacketSize) && "ploaddup");+    }+  }++  if(PacketSize>2)+  {+    for(int offset=0;offset<4;++offset)+    {+      for(int i=0;i<PacketSize/4;++i)+        ref[4*i+0] = ref[4*i+1] = ref[4*i+2] = ref[4*i+3] = data1[offset+i];+      internal::pstore(data2,internal::ploadquad<Packet>(data1+offset));+      VERIFY(areApprox(ref, data2, PacketSize) && "ploadquad");+    }+  }++  ref[0] = 0;+  for (int i=0; i<PacketSize; ++i)+    ref[0] += data1[i];+  VERIFY(isApproxAbs(ref[0], internal::predux(internal::pload<Packet>(data1)), refvalue) && "internal::predux");++  {+    for (int i=0; i<4; ++i)+      ref[i] = 0;+    for (int i=0; i<PacketSize; ++i)+      ref[i%4] += data1[i];+    internal::pstore(data2, internal::predux_downto4(internal::pload<Packet>(data1)));+    VERIFY(areApprox(ref, data2, PacketSize>4?PacketSize/2:PacketSize) && "internal::predux_downto4");+  }++  ref[0] = 1;+  for (int i=0; i<PacketSize; ++i)+    ref[0] *= data1[i];+  VERIFY(internal::isApprox(ref[0], internal::predux_mul(internal::pload<Packet>(data1))) && "internal::predux_mul");++  for (int j=0; j<PacketSize; ++j)+  {+    ref[j] = 0;+    for (int i=0; i<PacketSize; ++i)+      ref[j] += data1[i+j*PacketSize];+    packets[j] = internal::pload<Packet>(data1+j*PacketSize);+  }+  internal::pstore(data2, internal::preduxp(packets));+  VERIFY(areApproxAbs(ref, data2, PacketSize, refvalue) && "internal::preduxp");++  for (int i=0; i<PacketSize; ++i)+    ref[i] = data1[PacketSize-i-1];+  internal::pstore(data2, internal::preverse(internal::pload<Packet>(data1)));+  VERIFY(areApprox(ref, data2, PacketSize) && "internal::preverse");++  internal::PacketBlock<Packet> kernel;+  for (int i=0; i<PacketSize; ++i) {+    kernel.packet[i] = internal::pload<Packet>(data1+i*PacketSize);+  }+  ptranspose(kernel);+  for (int i=0; i<PacketSize; ++i) {+    internal::pstore(data2, kernel.packet[i]);+    for (int j = 0; j < PacketSize; ++j) {+      VERIFY(isApproxAbs(data2[j], data1[i+j*PacketSize], refvalue) && "ptranspose");+    }+  }++  if (PacketTraits::HasBlend) {+    Packet thenPacket = internal::pload<Packet>(data1);+    Packet elsePacket = internal::pload<Packet>(data2);+    EIGEN_ALIGN_MAX internal::Selector<PacketSize> selector;+    for (int i = 0; i < PacketSize; ++i) {+      selector.select[i] = i;+    }++    Packet blend = internal::pblend(selector, thenPacket, elsePacket);+    EIGEN_ALIGN_MAX Scalar result[size];+    internal::pstore(result, blend);+    for (int i = 0; i < PacketSize; ++i) {+      VERIFY(isApproxAbs(result[i], (selector.select[i] ? data1[i] : data2[i]), refvalue));+    }+  }++  if (PacketTraits::HasBlend || g_vectorize_sse) {+    // pinsertfirst+    for (int i=0; i<PacketSize; ++i)+      ref[i] = data1[i];+    Scalar s = internal::random<Scalar>();+    ref[0] = s;+    internal::pstore(data2, internal::pinsertfirst(internal::pload<Packet>(data1),s));+    VERIFY(areApprox(ref, data2, PacketSize) && "internal::pinsertfirst");+  }++  if (PacketTraits::HasBlend || g_vectorize_sse) {+    // pinsertlast+    for (int i=0; i<PacketSize; ++i)+      ref[i] = data1[i];+    Scalar s = internal::random<Scalar>();+    ref[PacketSize-1] = s;+    internal::pstore(data2, internal::pinsertlast(internal::pload<Packet>(data1),s));+    VERIFY(areApprox(ref, data2, PacketSize) && "internal::pinsertlast");+  }+}++template<typename Scalar> void packetmath_real()+{+  using std::abs;+  typedef internal::packet_traits<Scalar> PacketTraits;+  typedef typename PacketTraits::type Packet;+  const int PacketSize = PacketTraits::size;++  const int size = PacketSize*4;+  EIGEN_ALIGN_MAX Scalar data1[PacketTraits::size*4];+  EIGEN_ALIGN_MAX Scalar data2[PacketTraits::size*4];+  EIGEN_ALIGN_MAX Scalar ref[PacketTraits::size*4];++  for (int i=0; i<size; ++i)+  {+    data1[i] = internal::random<Scalar>(-1,1) * std::pow(Scalar(10), internal::random<Scalar>(-3,3));+    data2[i] = internal::random<Scalar>(-1,1) * std::pow(Scalar(10), internal::random<Scalar>(-3,3));+  }+  CHECK_CWISE1_IF(PacketTraits::HasSin, std::sin, internal::psin);+  CHECK_CWISE1_IF(PacketTraits::HasCos, std::cos, internal::pcos);+  CHECK_CWISE1_IF(PacketTraits::HasTan, std::tan, internal::ptan);++  CHECK_CWISE1_IF(PacketTraits::HasRound, numext::round, internal::pround);+  CHECK_CWISE1_IF(PacketTraits::HasCeil, numext::ceil, internal::pceil);+  CHECK_CWISE1_IF(PacketTraits::HasFloor, numext::floor, internal::pfloor);++  for (int i=0; i<size; ++i)+  {+    data1[i] = internal::random<Scalar>(-1,1);+    data2[i] = internal::random<Scalar>(-1,1);+  }+  CHECK_CWISE1_IF(PacketTraits::HasASin, std::asin, internal::pasin);+  CHECK_CWISE1_IF(PacketTraits::HasACos, std::acos, internal::pacos);++  for (int i=0; i<size; ++i)+  {+    data1[i] = internal::random<Scalar>(-87,88);+    data2[i] = internal::random<Scalar>(-87,88);+  }+  CHECK_CWISE1_IF(PacketTraits::HasExp, std::exp, internal::pexp);+  for (int i=0; i<size; ++i)+  {+    data1[i] = internal::random<Scalar>(-1,1) * std::pow(Scalar(10), internal::random<Scalar>(-6,6));+    data2[i] = internal::random<Scalar>(-1,1) * std::pow(Scalar(10), internal::random<Scalar>(-6,6));+  }+  CHECK_CWISE1_IF(PacketTraits::HasTanh, std::tanh, internal::ptanh);+  if(PacketTraits::HasExp && PacketTraits::size>=2)+  {+    data1[0] = std::numeric_limits<Scalar>::quiet_NaN();+    data1[1] = std::numeric_limits<Scalar>::epsilon();+    packet_helper<PacketTraits::HasExp,Packet> h;+    h.store(data2, internal::pexp(h.load(data1)));+    VERIFY((numext::isnan)(data2[0]));+    VERIFY_IS_EQUAL(std::exp(std::numeric_limits<Scalar>::epsilon()), data2[1]);++    data1[0] = -std::numeric_limits<Scalar>::epsilon();+    data1[1] = 0;+    h.store(data2, internal::pexp(h.load(data1)));+    VERIFY_IS_EQUAL(std::exp(-std::numeric_limits<Scalar>::epsilon()), data2[0]);+    VERIFY_IS_EQUAL(std::exp(Scalar(0)), data2[1]);++    data1[0] = (std::numeric_limits<Scalar>::min)();+    data1[1] = -(std::numeric_limits<Scalar>::min)();+    h.store(data2, internal::pexp(h.load(data1)));+    VERIFY_IS_EQUAL(std::exp((std::numeric_limits<Scalar>::min)()), data2[0]);+    VERIFY_IS_EQUAL(std::exp(-(std::numeric_limits<Scalar>::min)()), data2[1]);++    data1[0] = std::numeric_limits<Scalar>::denorm_min();+    data1[1] = -std::numeric_limits<Scalar>::denorm_min();+    h.store(data2, internal::pexp(h.load(data1)));+    VERIFY_IS_EQUAL(std::exp(std::numeric_limits<Scalar>::denorm_min()), data2[0]);+    VERIFY_IS_EQUAL(std::exp(-std::numeric_limits<Scalar>::denorm_min()), data2[1]);+  }++  if (PacketTraits::HasTanh) {+    // NOTE this test migh fail with GCC prior to 6.3, see MathFunctionsImpl.h for details.+    data1[0] = std::numeric_limits<Scalar>::quiet_NaN();+    packet_helper<internal::packet_traits<Scalar>::HasTanh,Packet> h;+    h.store(data2, internal::ptanh(h.load(data1)));+    VERIFY((numext::isnan)(data2[0]));+  }++#if EIGEN_HAS_C99_MATH+  {+    data1[0] = std::numeric_limits<Scalar>::quiet_NaN();+    packet_helper<internal::packet_traits<Scalar>::HasLGamma,Packet> h;+    h.store(data2, internal::plgamma(h.load(data1)));+    VERIFY((numext::isnan)(data2[0]));+  }+  {+    data1[0] = std::numeric_limits<Scalar>::quiet_NaN();+    packet_helper<internal::packet_traits<Scalar>::HasErf,Packet> h;+    h.store(data2, internal::perf(h.load(data1)));+    VERIFY((numext::isnan)(data2[0]));+  }+  {+    data1[0] = std::numeric_limits<Scalar>::quiet_NaN();+    packet_helper<internal::packet_traits<Scalar>::HasErfc,Packet> h;+    h.store(data2, internal::perfc(h.load(data1)));+    VERIFY((numext::isnan)(data2[0]));+  }+#endif  // EIGEN_HAS_C99_MATH++  for (int i=0; i<size; ++i)+  {+    data1[i] = internal::random<Scalar>(0,1) * std::pow(Scalar(10), internal::random<Scalar>(-6,6));+    data2[i] = internal::random<Scalar>(0,1) * std::pow(Scalar(10), internal::random<Scalar>(-6,6));+  }++  if(internal::random<float>(0,1)<0.1f)+    data1[internal::random<int>(0, PacketSize)] = 0;+  CHECK_CWISE1_IF(PacketTraits::HasSqrt, std::sqrt, internal::psqrt);+  CHECK_CWISE1_IF(PacketTraits::HasLog, std::log, internal::plog);+#if EIGEN_HAS_C99_MATH && (__cplusplus > 199711L)+  CHECK_CWISE1_IF(PacketTraits::HasLog1p, std::log1p, internal::plog1p);+  CHECK_CWISE1_IF(internal::packet_traits<Scalar>::HasLGamma, std::lgamma, internal::plgamma);+  CHECK_CWISE1_IF(internal::packet_traits<Scalar>::HasErf, std::erf, internal::perf);+  CHECK_CWISE1_IF(internal::packet_traits<Scalar>::HasErfc, std::erfc, internal::perfc);+#endif++  if(PacketTraits::HasLog && PacketTraits::size>=2)+  {+    data1[0] = std::numeric_limits<Scalar>::quiet_NaN();+    data1[1] = std::numeric_limits<Scalar>::epsilon();+    packet_helper<PacketTraits::HasLog,Packet> h;+    h.store(data2, internal::plog(h.load(data1)));+    VERIFY((numext::isnan)(data2[0]));+    VERIFY_IS_EQUAL(std::log(std::numeric_limits<Scalar>::epsilon()), data2[1]);++    data1[0] = -std::numeric_limits<Scalar>::epsilon();+    data1[1] = 0;+    h.store(data2, internal::plog(h.load(data1)));+    VERIFY((numext::isnan)(data2[0]));+    VERIFY_IS_EQUAL(std::log(Scalar(0)), data2[1]);++    data1[0] = (std::numeric_limits<Scalar>::min)();+    data1[1] = -(std::numeric_limits<Scalar>::min)();+    h.store(data2, internal::plog(h.load(data1)));+    VERIFY_IS_EQUAL(std::log((std::numeric_limits<Scalar>::min)()), data2[0]);+    VERIFY((numext::isnan)(data2[1]));++    data1[0] = std::numeric_limits<Scalar>::denorm_min();+    data1[1] = -std::numeric_limits<Scalar>::denorm_min();+    h.store(data2, internal::plog(h.load(data1)));+    // VERIFY_IS_EQUAL(std::log(std::numeric_limits<Scalar>::denorm_min()), data2[0]);+    VERIFY((numext::isnan)(data2[1]));++    data1[0] = Scalar(-1.0f);+    h.store(data2, internal::plog(h.load(data1)));+    VERIFY((numext::isnan)(data2[0]));+    h.store(data2, internal::psqrt(h.load(data1)));+    VERIFY((numext::isnan)(data2[0]));+    VERIFY((numext::isnan)(data2[1]));+  }+}++template<typename Scalar> void packetmath_notcomplex()+{+  using std::abs;+  typedef internal::packet_traits<Scalar> PacketTraits;+  typedef typename PacketTraits::type Packet;+  const int PacketSize = PacketTraits::size;++  EIGEN_ALIGN_MAX Scalar data1[PacketTraits::size*4];+  EIGEN_ALIGN_MAX Scalar data2[PacketTraits::size*4];+  EIGEN_ALIGN_MAX Scalar ref[PacketTraits::size*4];++  Array<Scalar,Dynamic,1>::Map(data1, PacketTraits::size*4).setRandom();++  ref[0] = data1[0];+  for (int i=0; i<PacketSize; ++i)+    ref[0] = (std::min)(ref[0],data1[i]);+  VERIFY(internal::isApprox(ref[0], internal::predux_min(internal::pload<Packet>(data1))) && "internal::predux_min");++  VERIFY((!PacketTraits::Vectorizable) || PacketTraits::HasMin);+  VERIFY((!PacketTraits::Vectorizable) || PacketTraits::HasMax);++  CHECK_CWISE2_IF(PacketTraits::HasMin, (std::min), internal::pmin);+  CHECK_CWISE2_IF(PacketTraits::HasMax, (std::max), internal::pmax);+  CHECK_CWISE1(abs, internal::pabs);++  ref[0] = data1[0];+  for (int i=0; i<PacketSize; ++i)+    ref[0] = (std::max)(ref[0],data1[i]);+  VERIFY(internal::isApprox(ref[0], internal::predux_max(internal::pload<Packet>(data1))) && "internal::predux_max");++  for (int i=0; i<PacketSize; ++i)+    ref[i] = data1[0]+Scalar(i);+  internal::pstore(data2, internal::plset<Packet>(data1[0]));+  VERIFY(areApprox(ref, data2, PacketSize) && "internal::plset");+}++template<typename Scalar,bool ConjLhs,bool ConjRhs> void test_conj_helper(Scalar* data1, Scalar* data2, Scalar* ref, Scalar* pval)+{+  typedef internal::packet_traits<Scalar> PacketTraits;+  typedef typename PacketTraits::type Packet;+  const int PacketSize = PacketTraits::size;++  internal::conj_if<ConjLhs> cj0;+  internal::conj_if<ConjRhs> cj1;+  internal::conj_helper<Scalar,Scalar,ConjLhs,ConjRhs> cj;+  internal::conj_helper<Packet,Packet,ConjLhs,ConjRhs> pcj;++  for(int i=0;i<PacketSize;++i)+  {+    ref[i] = cj0(data1[i]) * cj1(data2[i]);+    VERIFY(internal::isApprox(ref[i], cj.pmul(data1[i],data2[i])) && "conj_helper pmul");+  }+  internal::pstore(pval,pcj.pmul(internal::pload<Packet>(data1),internal::pload<Packet>(data2)));+  VERIFY(areApprox(ref, pval, PacketSize) && "conj_helper pmul");++  for(int i=0;i<PacketSize;++i)+  {+    Scalar tmp = ref[i];+    ref[i] += cj0(data1[i]) * cj1(data2[i]);+    VERIFY(internal::isApprox(ref[i], cj.pmadd(data1[i],data2[i],tmp)) && "conj_helper pmadd");+  }+  internal::pstore(pval,pcj.pmadd(internal::pload<Packet>(data1),internal::pload<Packet>(data2),internal::pload<Packet>(pval)));+  VERIFY(areApprox(ref, pval, PacketSize) && "conj_helper pmadd");+}++template<typename Scalar> void packetmath_complex()+{+  typedef internal::packet_traits<Scalar> PacketTraits;+  typedef typename PacketTraits::type Packet;+  const int PacketSize = PacketTraits::size;++  const int size = PacketSize*4;+  EIGEN_ALIGN_MAX Scalar data1[PacketSize*4];+  EIGEN_ALIGN_MAX Scalar data2[PacketSize*4];+  EIGEN_ALIGN_MAX Scalar ref[PacketSize*4];+  EIGEN_ALIGN_MAX Scalar pval[PacketSize*4];++  for (int i=0; i<size; ++i)+  {+    data1[i] = internal::random<Scalar>() * Scalar(1e2);+    data2[i] = internal::random<Scalar>() * Scalar(1e2);+  }++  test_conj_helper<Scalar,false,false> (data1,data2,ref,pval);+  test_conj_helper<Scalar,false,true>  (data1,data2,ref,pval);+  test_conj_helper<Scalar,true,false>  (data1,data2,ref,pval);+  test_conj_helper<Scalar,true,true>   (data1,data2,ref,pval);++  {+    for(int i=0;i<PacketSize;++i)+      ref[i] = Scalar(std::imag(data1[i]),std::real(data1[i]));+    internal::pstore(pval,internal::pcplxflip(internal::pload<Packet>(data1)));+    VERIFY(areApprox(ref, pval, PacketSize) && "pcplxflip");+  }+}++template<typename Scalar> void packetmath_scatter_gather()+{+  typedef internal::packet_traits<Scalar> PacketTraits;+  typedef typename PacketTraits::type Packet;+  typedef typename NumTraits<Scalar>::Real RealScalar;+  const int PacketSize = PacketTraits::size;+  EIGEN_ALIGN_MAX Scalar data1[PacketSize];+  RealScalar refvalue = 0;+  for (int i=0; i<PacketSize; ++i) {+    data1[i] = internal::random<Scalar>()/RealScalar(PacketSize);+  }++  int stride = internal::random<int>(1,20);++  EIGEN_ALIGN_MAX Scalar buffer[PacketSize*20];+  memset(buffer, 0, 20*PacketSize*sizeof(Scalar));+  Packet packet = internal::pload<Packet>(data1);+  internal::pscatter<Scalar, Packet>(buffer, packet, stride);++  for (int i = 0; i < PacketSize*20; ++i) {+    if ((i%stride) == 0 && i<stride*PacketSize) {+      VERIFY(isApproxAbs(buffer[i], data1[i/stride], refvalue) && "pscatter");+    } else {+      VERIFY(isApproxAbs(buffer[i], Scalar(0), refvalue) && "pscatter");+    }+  }++  for (int i=0; i<PacketSize*7; ++i) {+    buffer[i] = internal::random<Scalar>()/RealScalar(PacketSize);+  }+  packet = internal::pgather<Scalar, Packet>(buffer, 7);+  internal::pstore(data1, packet);+  for (int i = 0; i < PacketSize; ++i) {+    VERIFY(isApproxAbs(data1[i], buffer[i*7], refvalue) && "pgather");+  }+}++void test_packetmath()+{+  for(int i = 0; i < g_repeat; i++) {+    CALL_SUBTEST_1( packetmath<float>() );+    CALL_SUBTEST_2( packetmath<double>() );+    CALL_SUBTEST_3( packetmath<int>() );+    CALL_SUBTEST_4( packetmath<std::complex<float> >() );+    CALL_SUBTEST_5( packetmath<std::complex<double> >() );++    CALL_SUBTEST_1( packetmath_notcomplex<float>() );+    CALL_SUBTEST_2( packetmath_notcomplex<double>() );+    CALL_SUBTEST_3( packetmath_notcomplex<int>() );++    CALL_SUBTEST_1( packetmath_real<float>() );+    CALL_SUBTEST_2( packetmath_real<double>() );++    CALL_SUBTEST_4( packetmath_complex<std::complex<float> >() );+    CALL_SUBTEST_5( packetmath_complex<std::complex<double> >() );++    CALL_SUBTEST_1( packetmath_scatter_gather<float>() );+    CALL_SUBTEST_2( packetmath_scatter_gather<double>() );+    CALL_SUBTEST_3( packetmath_scatter_gather<int>() );+    CALL_SUBTEST_4( packetmath_scatter_gather<std::complex<float> >() );+    CALL_SUBTEST_5( packetmath_scatter_gather<std::complex<double> >() );+  }+}
+ eigen3/test/pardiso_support.cpp view
@@ -0,0 +1,29 @@+/* +   Intel Copyright (C) ....+*/++#include "sparse_solver.h"+#include <Eigen/PardisoSupport>++template<typename T> void test_pardiso_T()+{+  PardisoLLT < SparseMatrix<T, RowMajor>, Lower> pardiso_llt_lower;+  PardisoLLT < SparseMatrix<T, RowMajor>, Upper> pardiso_llt_upper;+  PardisoLDLT < SparseMatrix<T, RowMajor>, Lower> pardiso_ldlt_lower;+  PardisoLDLT < SparseMatrix<T, RowMajor>, Upper> pardiso_ldlt_upper;+  PardisoLU  < SparseMatrix<T, RowMajor> > pardiso_lu;++  check_sparse_spd_solving(pardiso_llt_lower);+  check_sparse_spd_solving(pardiso_llt_upper);+  check_sparse_spd_solving(pardiso_ldlt_lower);+  check_sparse_spd_solving(pardiso_ldlt_upper);+  check_sparse_square_solving(pardiso_lu);+}++void test_pardiso_support()+{+  CALL_SUBTEST_1(test_pardiso_T<float>());+  CALL_SUBTEST_2(test_pardiso_T<double>());+  CALL_SUBTEST_3(test_pardiso_T< std::complex<float> >());+  CALL_SUBTEST_4(test_pardiso_T< std::complex<double> >());+}
+ eigen3/test/pastix_support.cpp view
@@ -0,0 +1,54 @@+// This file is part of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2008-2012 Gael Guennebaud <gael.guennebaud@inria.fr>+// Copyright (C) 2012 Désiré Nuentsa-Wakam <desire.nuentsa_wakam@inria.fr>+//+// 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 <Eigen/PaStiXSupport>+#include <unsupported/Eigen/SparseExtra>+++template<typename T> void test_pastix_T()+{+  PastixLLT< SparseMatrix<T, ColMajor>, Eigen::Lower > pastix_llt_lower;+  PastixLDLT< SparseMatrix<T, ColMajor>, Eigen::Lower > pastix_ldlt_lower;+  PastixLLT< SparseMatrix<T, ColMajor>, Eigen::Upper > pastix_llt_upper;+  PastixLDLT< SparseMatrix<T, ColMajor>, Eigen::Upper > pastix_ldlt_upper;+  PastixLU< SparseMatrix<T, ColMajor> > pastix_lu;++  check_sparse_spd_solving(pastix_llt_lower);+  check_sparse_spd_solving(pastix_ldlt_lower);+  check_sparse_spd_solving(pastix_llt_upper);+  check_sparse_spd_solving(pastix_ldlt_upper);+  check_sparse_square_solving(pastix_lu);++  // Some compilation check:+  pastix_llt_lower.iparm();+  pastix_llt_lower.dparm();+  pastix_ldlt_lower.iparm();+  pastix_ldlt_lower.dparm();+  pastix_lu.iparm();+  pastix_lu.dparm();+}++// There is no support for selfadjoint matrices with PaStiX. +// Complex symmetric matrices should pass though+template<typename T> void test_pastix_T_LU()+{+  PastixLU< SparseMatrix<T, ColMajor> > pastix_lu;+  check_sparse_square_solving(pastix_lu);+}++void test_pastix_support()+{+  CALL_SUBTEST_1(test_pastix_T<float>());+  CALL_SUBTEST_2(test_pastix_T<double>());+  CALL_SUBTEST_3( (test_pastix_T_LU<std::complex<float> >()) );+  CALL_SUBTEST_4(test_pastix_T_LU<std::complex<double> >());+} 
+ eigen3/test/permutationmatrices.cpp view
@@ -0,0 +1,167 @@+// This file is part of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2009 Benoit Jacob <jacob.benoit.1@gmail.com>+//+// 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"++using namespace std;+template<typename MatrixType> void permutationmatrices(const MatrixType& m)+{+  typedef typename MatrixType::Scalar Scalar;+  enum { Rows = MatrixType::RowsAtCompileTime, Cols = MatrixType::ColsAtCompileTime,+         Options = MatrixType::Options };+  typedef PermutationMatrix<Rows> LeftPermutationType;+  typedef Transpositions<Rows> LeftTranspositionsType;+  typedef Matrix<int, Rows, 1> LeftPermutationVectorType;+  typedef Map<LeftPermutationType> MapLeftPerm;+  typedef PermutationMatrix<Cols> RightPermutationType;+  typedef Transpositions<Cols> RightTranspositionsType;+  typedef Matrix<int, Cols, 1> RightPermutationVectorType;+  typedef Map<RightPermutationType> MapRightPerm;++  Index rows = m.rows();+  Index cols = m.cols();++  MatrixType m_original = MatrixType::Random(rows,cols);+  LeftPermutationVectorType lv;+  randomPermutationVector(lv, rows);+  LeftPermutationType lp(lv);+  RightPermutationVectorType rv;+  randomPermutationVector(rv, cols);+  RightPermutationType rp(rv);+  LeftTranspositionsType lt(lv);+  RightTranspositionsType rt(rv);+  MatrixType m_permuted = MatrixType::Random(rows,cols);+  +  VERIFY_EVALUATION_COUNT(m_permuted = lp * m_original * rp, 1); // 1 temp for sub expression "lp * m_original"++  for (int i=0; i<rows; i++)+    for (int j=0; j<cols; j++)+        VERIFY_IS_APPROX(m_permuted(lv(i),j), m_original(i,rv(j)));++  Matrix<Scalar,Rows,Rows> lm(lp);+  Matrix<Scalar,Cols,Cols> rm(rp);++  VERIFY_IS_APPROX(m_permuted, lm*m_original*rm);+  +  m_permuted = m_original;+  VERIFY_EVALUATION_COUNT(m_permuted = lp * m_permuted * rp, 1);+  VERIFY_IS_APPROX(m_permuted, lm*m_original*rm);+  +  VERIFY_IS_APPROX(lp.inverse()*m_permuted*rp.inverse(), m_original);+  VERIFY_IS_APPROX(lv.asPermutation().inverse()*m_permuted*rv.asPermutation().inverse(), m_original);+  VERIFY_IS_APPROX(MapLeftPerm(lv.data(),lv.size()).inverse()*m_permuted*MapRightPerm(rv.data(),rv.size()).inverse(), m_original);+  +  VERIFY((lp*lp.inverse()).toDenseMatrix().isIdentity());+  VERIFY((lv.asPermutation()*lv.asPermutation().inverse()).toDenseMatrix().isIdentity());+  VERIFY((MapLeftPerm(lv.data(),lv.size())*MapLeftPerm(lv.data(),lv.size()).inverse()).toDenseMatrix().isIdentity());++  LeftPermutationVectorType lv2;+  randomPermutationVector(lv2, rows);+  LeftPermutationType lp2(lv2);+  Matrix<Scalar,Rows,Rows> lm2(lp2);+  VERIFY_IS_APPROX((lp*lp2).toDenseMatrix().template cast<Scalar>(), lm*lm2);+  VERIFY_IS_APPROX((lv.asPermutation()*lv2.asPermutation()).toDenseMatrix().template cast<Scalar>(), lm*lm2);+  VERIFY_IS_APPROX((MapLeftPerm(lv.data(),lv.size())*MapLeftPerm(lv2.data(),lv2.size())).toDenseMatrix().template cast<Scalar>(), lm*lm2);++  LeftPermutationType identityp;+  identityp.setIdentity(rows);+  VERIFY_IS_APPROX(m_original, identityp*m_original);+  +  // check inplace permutations+  m_permuted = m_original;+  VERIFY_EVALUATION_COUNT(m_permuted.noalias()= lp.inverse() * m_permuted, 1); // 1 temp to allocate the mask+  VERIFY_IS_APPROX(m_permuted, lp.inverse()*m_original);+  +  m_permuted = m_original;+  VERIFY_EVALUATION_COUNT(m_permuted.noalias() = m_permuted * rp.inverse(), 1); // 1 temp to allocate the mask+  VERIFY_IS_APPROX(m_permuted, m_original*rp.inverse());+  +  m_permuted = m_original;+  VERIFY_EVALUATION_COUNT(m_permuted.noalias() = lp * m_permuted, 1); // 1 temp to allocate the mask+  VERIFY_IS_APPROX(m_permuted, lp*m_original);+  +  m_permuted = m_original;+  VERIFY_EVALUATION_COUNT(m_permuted.noalias() = m_permuted * rp, 1); // 1 temp to allocate the mask+  VERIFY_IS_APPROX(m_permuted, m_original*rp);++  if(rows>1 && cols>1)+  {+    lp2 = lp;+    Index i = internal::random<Index>(0, rows-1);+    Index j;+    do j = internal::random<Index>(0, rows-1); while(j==i);+    lp2.applyTranspositionOnTheLeft(i, j);+    lm = lp;+    lm.row(i).swap(lm.row(j));+    VERIFY_IS_APPROX(lm, lp2.toDenseMatrix().template cast<Scalar>());++    RightPermutationType rp2 = rp;+    i = internal::random<Index>(0, cols-1);+    do j = internal::random<Index>(0, cols-1); while(j==i);+    rp2.applyTranspositionOnTheRight(i, j);+    rm = rp;+    rm.col(i).swap(rm.col(j));+    VERIFY_IS_APPROX(rm, rp2.toDenseMatrix().template cast<Scalar>());+  }++  {+    // simple compilation check+    Matrix<Scalar, Cols, Cols> A = rp;+    Matrix<Scalar, Cols, Cols> B = rp.transpose();+    VERIFY_IS_APPROX(A, B.transpose());+  }++  m_permuted = m_original;+  lp = lt;+  rp = rt;+  VERIFY_EVALUATION_COUNT(m_permuted = lt * m_permuted * rt, 1);+  VERIFY_IS_APPROX(m_permuted, lp*m_original*rp.transpose());+  +  VERIFY_IS_APPROX(lt.inverse()*m_permuted*rt.inverse(), m_original);+}++template<typename T>+void bug890()+{+  typedef Matrix<T, Dynamic, Dynamic> MatrixType;+  typedef Matrix<T, Dynamic, 1> VectorType;+  typedef Stride<Dynamic,Dynamic> S;+  typedef Map<MatrixType, Aligned, S> MapType;+  typedef PermutationMatrix<Dynamic> Perm;+  +  VectorType v1(2), v2(2), op(4), rhs(2);+  v1 << 666,667;+  op << 1,0,0,1;+  rhs << 42,42;+  +  Perm P(2);+  P.indices() << 1, 0;++  MapType(v1.data(),2,1,S(1,1)) = P * MapType(rhs.data(),2,1,S(1,1));+  VERIFY_IS_APPROX(v1, (P * rhs).eval());+  +  MapType(v1.data(),2,1,S(1,1)) = P.inverse() * MapType(rhs.data(),2,1,S(1,1));+  VERIFY_IS_APPROX(v1, (P.inverse() * rhs).eval());+}++void test_permutationmatrices()+{+  for(int i = 0; i < g_repeat; i++) {+    CALL_SUBTEST_1( permutationmatrices(Matrix<float, 1, 1>()) );+    CALL_SUBTEST_2( permutationmatrices(Matrix3f()) );+    CALL_SUBTEST_3( permutationmatrices(Matrix<double,3,3,RowMajor>()) );+    CALL_SUBTEST_4( permutationmatrices(Matrix4d()) );+    CALL_SUBTEST_5( permutationmatrices(Matrix<double,40,60>()) );+    CALL_SUBTEST_6( permutationmatrices(Matrix<double,Dynamic,Dynamic,RowMajor>(20, 30)) );+    CALL_SUBTEST_7( permutationmatrices(MatrixXcf(15, 10)) );+  }+  CALL_SUBTEST_5( bug890<double>() );+}
+ eigen3/test/prec_inverse_4x4.cpp view
@@ -0,0 +1,83 @@+// This file is part of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2009 Benoit Jacob <jacob.benoit.1@gmail.com>+//+// 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 <Eigen/LU>+#include <algorithm>++template<typename MatrixType> void inverse_permutation_4x4()+{+  typedef typename MatrixType::Scalar Scalar;+  Vector4i indices(0,1,2,3);+  for(int i = 0; i < 24; ++i)+  {+    MatrixType m = PermutationMatrix<4>(indices);+    MatrixType inv = m.inverse();+    double error = double( (m*inv-MatrixType::Identity()).norm() / NumTraits<Scalar>::epsilon() );+    EIGEN_DEBUG_VAR(error)+    VERIFY(error == 0.0);+    std::next_permutation(indices.data(),indices.data()+4);+  }+}++template<typename MatrixType> void inverse_general_4x4(int repeat)+{+  using std::abs;+  typedef typename MatrixType::Scalar Scalar;+  typedef typename MatrixType::RealScalar RealScalar;+  double error_sum = 0., error_max = 0.;+  for(int i = 0; i < repeat; ++i)+  {+    MatrixType m;+    RealScalar absdet;+    do {+      m = MatrixType::Random();+      absdet = abs(m.determinant());+    } while(absdet < NumTraits<Scalar>::epsilon());+    MatrixType inv = m.inverse();+    double error = double( (m*inv-MatrixType::Identity()).norm() * absdet / NumTraits<Scalar>::epsilon() );+    error_sum += error;+    error_max = (std::max)(error_max, error);+  }+  std::cerr << "inverse_general_4x4, Scalar = " << type_name<Scalar>() << std::endl;+  double error_avg = error_sum / repeat;+  EIGEN_DEBUG_VAR(error_avg);+  EIGEN_DEBUG_VAR(error_max);+   // FIXME that 1.25 used to be a 1.0 until the NumTraits changes on 28 April 2010, what's going wrong??+   // FIXME that 1.25 used to be 1.2 until we tested gcc 4.1 on 30 June 2010 and got 1.21.+  VERIFY(error_avg < (NumTraits<Scalar>::IsComplex ? 8.0 : 1.25));+  VERIFY(error_max < (NumTraits<Scalar>::IsComplex ? 64.0 : 20.0));++  {+    int s = 5;//internal::random<int>(4,10);+    int i = 0;//internal::random<int>(0,s-4);+    int j = 0;//internal::random<int>(0,s-4);+    Matrix<Scalar,5,5> mat(s,s);+    mat.setRandom();+    MatrixType submat = mat.template block<4,4>(i,j);+    MatrixType mat_inv = mat.template block<4,4>(i,j).inverse();+    VERIFY_IS_APPROX(mat_inv, submat.inverse());+    mat.template block<4,4>(i,j) = submat.inverse();+    VERIFY_IS_APPROX(mat_inv, (mat.template block<4,4>(i,j)));+  }+}++void test_prec_inverse_4x4()+{+  CALL_SUBTEST_1((inverse_permutation_4x4<Matrix4f>()));+  CALL_SUBTEST_1(( inverse_general_4x4<Matrix4f>(200000 * g_repeat) ));+  CALL_SUBTEST_1(( inverse_general_4x4<Matrix<float,4,4,RowMajor> >(200000 * g_repeat) ));++  CALL_SUBTEST_2((inverse_permutation_4x4<Matrix<double,4,4,RowMajor> >()));+  CALL_SUBTEST_2(( inverse_general_4x4<Matrix<double,4,4,ColMajor> >(200000 * g_repeat) ));+  CALL_SUBTEST_2(( inverse_general_4x4<Matrix<double,4,4,RowMajor> >(200000 * g_repeat) ));++  CALL_SUBTEST_3((inverse_permutation_4x4<Matrix4cf>()));+  CALL_SUBTEST_3((inverse_general_4x4<Matrix4cf>(50000 * g_repeat)));+}
+ eigen3/test/product.h view
@@ -0,0 +1,231 @@+// This file is part of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2006-2008 Benoit Jacob <jacob.benoit.1@gmail.com>+//+// 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 <Eigen/QR>++template<typename Derived1, typename Derived2>+bool areNotApprox(const MatrixBase<Derived1>& m1, const MatrixBase<Derived2>& m2, typename Derived1::RealScalar epsilon = NumTraits<typename Derived1::RealScalar>::dummy_precision())+{+  return !((m1-m2).cwiseAbs2().maxCoeff() < epsilon * epsilon+                          * (std::max)(m1.cwiseAbs2().maxCoeff(), m2.cwiseAbs2().maxCoeff()));+}++template<typename MatrixType> void product(const MatrixType& m)+{+  /* this test covers the following files:+     Identity.h Product.h+  */+  typedef typename MatrixType::Scalar Scalar;+  typedef Matrix<Scalar, MatrixType::RowsAtCompileTime, 1> RowVectorType;+  typedef Matrix<Scalar, MatrixType::ColsAtCompileTime, 1> ColVectorType;+  typedef Matrix<Scalar, MatrixType::RowsAtCompileTime, MatrixType::RowsAtCompileTime> RowSquareMatrixType;+  typedef Matrix<Scalar, MatrixType::ColsAtCompileTime, MatrixType::ColsAtCompileTime> ColSquareMatrixType;+  typedef Matrix<Scalar, MatrixType::RowsAtCompileTime, MatrixType::ColsAtCompileTime,+                         MatrixType::Flags&RowMajorBit?ColMajor:RowMajor> OtherMajorMatrixType;++  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);+  RowSquareMatrixType+             identity = RowSquareMatrixType::Identity(rows, rows),+             square = RowSquareMatrixType::Random(rows, rows),+             res = RowSquareMatrixType::Random(rows, rows);+  ColSquareMatrixType+             square2 = ColSquareMatrixType::Random(cols, cols),+             res2 = ColSquareMatrixType::Random(cols, cols);+  RowVectorType v1 = RowVectorType::Random(rows);+  ColVectorType vc2 = ColVectorType::Random(cols), vcres(cols);+  OtherMajorMatrixType tm1 = m1;++  Scalar s1 = internal::random<Scalar>();++  Index r  = internal::random<Index>(0, rows-1),+        c  = internal::random<Index>(0, cols-1),+        c2 = internal::random<Index>(0, cols-1);++  // begin testing Product.h: only associativity for now+  // (we use Transpose.h but this doesn't count as a test for it)+  VERIFY_IS_APPROX((m1*m1.transpose())*m2,  m1*(m1.transpose()*m2));+  m3 = m1;+  m3 *= m1.transpose() * m2;+  VERIFY_IS_APPROX(m3,                      m1 * (m1.transpose()*m2));+  VERIFY_IS_APPROX(m3,                      m1 * (m1.transpose()*m2));++  // continue testing Product.h: distributivity+  VERIFY_IS_APPROX(square*(m1 + m2),        square*m1+square*m2);+  VERIFY_IS_APPROX(square*(m1 - m2),        square*m1-square*m2);++  // continue testing Product.h: compatibility with ScalarMultiple.h+  VERIFY_IS_APPROX(s1*(square*m1),          (s1*square)*m1);+  VERIFY_IS_APPROX(s1*(square*m1),          square*(m1*s1));++  // test Product.h together with Identity.h+  VERIFY_IS_APPROX(v1,                      identity*v1);+  VERIFY_IS_APPROX(v1.transpose(),          v1.transpose() * identity);+  // again, test operator() to check const-qualification+  VERIFY_IS_APPROX(MatrixType::Identity(rows, cols)(r,c), static_cast<Scalar>(r==c));++  if (rows!=cols)+     VERIFY_RAISES_ASSERT(m3 = m1*m1);++  // test the previous tests were not screwed up because operator* returns 0+  // (we use the more accurate default epsilon)+  if (!NumTraits<Scalar>::IsInteger && (std::min)(rows,cols)>1)+  {+    VERIFY(areNotApprox(m1.transpose()*m2,m2.transpose()*m1));+  }++  // test optimized operator+= path+  res = square;+  res.noalias() += m1 * m2.transpose();+  VERIFY_IS_APPROX(res, square + m1 * m2.transpose());+  if (!NumTraits<Scalar>::IsInteger && (std::min)(rows,cols)>1)+  {+    VERIFY(areNotApprox(res,square + m2 * m1.transpose()));+  }+  vcres = vc2;+  vcres.noalias() += m1.transpose() * v1;+  VERIFY_IS_APPROX(vcres, vc2 + m1.transpose() * v1);++  // test optimized operator-= path+  res = square;+  res.noalias() -= m1 * m2.transpose();+  VERIFY_IS_APPROX(res, square - (m1 * m2.transpose()));+  if (!NumTraits<Scalar>::IsInteger && (std::min)(rows,cols)>1)+  {+    VERIFY(areNotApprox(res,square - m2 * m1.transpose()));+  }+  vcres = vc2;+  vcres.noalias() -= m1.transpose() * v1;+  VERIFY_IS_APPROX(vcres, vc2 - m1.transpose() * v1);++  // test d ?= a+b*c rules+  res.noalias() = square + m1 * m2.transpose();+  VERIFY_IS_APPROX(res, square + m1 * m2.transpose());+  res.noalias() += square + m1 * m2.transpose();+  VERIFY_IS_APPROX(res, 2*(square + m1 * m2.transpose()));+  res.noalias() -= square + m1 * m2.transpose();+  VERIFY_IS_APPROX(res, square + m1 * m2.transpose());++  // test d ?= a-b*c rules+  res.noalias() = square - m1 * m2.transpose();+  VERIFY_IS_APPROX(res, square - m1 * m2.transpose());+  res.noalias() += square - m1 * m2.transpose();+  VERIFY_IS_APPROX(res, 2*(square - m1 * m2.transpose()));+  res.noalias() -= square - m1 * m2.transpose();+  VERIFY_IS_APPROX(res, square - m1 * m2.transpose());+++  tm1 = m1;+  VERIFY_IS_APPROX(tm1.transpose() * v1, m1.transpose() * v1);+  VERIFY_IS_APPROX(v1.transpose() * tm1, v1.transpose() * m1);++  // test submatrix and matrix/vector product+  for (int i=0; i<rows; ++i)+    res.row(i) = m1.row(i) * m2.transpose();+  VERIFY_IS_APPROX(res, m1 * m2.transpose());+  // the other way round:+  for (int i=0; i<rows; ++i)+    res.col(i) = m1 * m2.transpose().col(i);+  VERIFY_IS_APPROX(res, m1 * m2.transpose());++  res2 = square2;+  res2.noalias() += m1.transpose() * m2;+  VERIFY_IS_APPROX(res2, square2 + m1.transpose() * m2);+  if (!NumTraits<Scalar>::IsInteger && (std::min)(rows,cols)>1)+  {+    VERIFY(areNotApprox(res2,square2 + m2.transpose() * m1));+  }++  VERIFY_IS_APPROX(res.col(r).noalias() = square.adjoint() * square.col(r), (square.adjoint() * square.col(r)).eval());+  VERIFY_IS_APPROX(res.col(r).noalias() = square * square.col(r), (square * square.col(r)).eval());++  // vector at runtime (see bug 1166)+  {+    RowSquareMatrixType ref(square);+    ColSquareMatrixType ref2(square2);+    ref = res = square;+    VERIFY_IS_APPROX(res.block(0,0,1,rows).noalias() = m1.col(0).transpose() * square.transpose(),            (ref.row(0) = m1.col(0).transpose() * square.transpose()));+    VERIFY_IS_APPROX(res.block(0,0,1,rows).noalias() = m1.block(0,0,rows,1).transpose() * square.transpose(), (ref.row(0) = m1.col(0).transpose() * square.transpose()));+    VERIFY_IS_APPROX(res.block(0,0,1,rows).noalias() = m1.col(0).transpose() * square,                        (ref.row(0) = m1.col(0).transpose() * square));+    VERIFY_IS_APPROX(res.block(0,0,1,rows).noalias() = m1.block(0,0,rows,1).transpose() * square,             (ref.row(0) = m1.col(0).transpose() * square));+    ref2 = res2 = square2;+    VERIFY_IS_APPROX(res2.block(0,0,1,cols).noalias() = m1.row(0) * square2.transpose(),                      (ref2.row(0) = m1.row(0) * square2.transpose()));+    VERIFY_IS_APPROX(res2.block(0,0,1,cols).noalias() = m1.block(0,0,1,cols) * square2.transpose(),           (ref2.row(0) = m1.row(0) * square2.transpose()));+    VERIFY_IS_APPROX(res2.block(0,0,1,cols).noalias() = m1.row(0) * square2,                                  (ref2.row(0) = m1.row(0) * square2));+    VERIFY_IS_APPROX(res2.block(0,0,1,cols).noalias() = m1.block(0,0,1,cols) * square2,                       (ref2.row(0) = m1.row(0) * square2));+  }++  // vector.block() (see bug 1283)+  {+    RowVectorType w1(rows);+    VERIFY_IS_APPROX(square * v1.block(0,0,rows,1), square * v1);+    VERIFY_IS_APPROX(w1.noalias() = square * v1.block(0,0,rows,1), square * v1);+    VERIFY_IS_APPROX(w1.block(0,0,rows,1).noalias() = square * v1.block(0,0,rows,1), square * v1);++    Matrix<Scalar,1,MatrixType::ColsAtCompileTime> w2(cols);+    VERIFY_IS_APPROX(vc2.block(0,0,cols,1).transpose() * square2, vc2.transpose() * square2);+    VERIFY_IS_APPROX(w2.noalias() = vc2.block(0,0,cols,1).transpose() * square2, vc2.transpose() * square2);+    VERIFY_IS_APPROX(w2.block(0,0,1,cols).noalias() = vc2.block(0,0,cols,1).transpose() * square2, vc2.transpose() * square2);++    vc2 = square2.block(0,0,1,cols).transpose();+    VERIFY_IS_APPROX(square2.block(0,0,1,cols) * square2, vc2.transpose() * square2);+    VERIFY_IS_APPROX(w2.noalias() = square2.block(0,0,1,cols) * square2, vc2.transpose() * square2);+    VERIFY_IS_APPROX(w2.block(0,0,1,cols).noalias() = square2.block(0,0,1,cols) * square2, vc2.transpose() * square2);++    vc2 = square2.block(0,0,cols,1);+    VERIFY_IS_APPROX(square2.block(0,0,cols,1).transpose() * square2, vc2.transpose() * square2);+    VERIFY_IS_APPROX(w2.noalias() = square2.block(0,0,cols,1).transpose() * square2, vc2.transpose() * square2);+    VERIFY_IS_APPROX(w2.block(0,0,1,cols).noalias() = square2.block(0,0,cols,1).transpose() * square2, vc2.transpose() * square2);+  }++  // inner product+  {+    Scalar x = square2.row(c) * square2.col(c2);+    VERIFY_IS_APPROX(x, square2.row(c).transpose().cwiseProduct(square2.col(c2)).sum());+  }++  // outer product+  {+    VERIFY_IS_APPROX(m1.col(c) * m1.row(r), m1.block(0,c,rows,1) * m1.block(r,0,1,cols));+    VERIFY_IS_APPROX(m1.row(r).transpose() * m1.col(c).transpose(), m1.block(r,0,1,cols).transpose() * m1.block(0,c,rows,1).transpose());+    VERIFY_IS_APPROX(m1.block(0,c,rows,1) * m1.row(r), m1.block(0,c,rows,1) * m1.block(r,0,1,cols));+    VERIFY_IS_APPROX(m1.col(c) * m1.block(r,0,1,cols), m1.block(0,c,rows,1) * m1.block(r,0,1,cols));+    VERIFY_IS_APPROX(m1.leftCols(1) * m1.row(r), m1.block(0,0,rows,1) * m1.block(r,0,1,cols));+    VERIFY_IS_APPROX(m1.col(c) * m1.topRows(1), m1.block(0,c,rows,1) * m1.block(0,0,1,cols));+  }++  // Aliasing+  {+    ColVectorType x(cols); x.setRandom();+    ColVectorType z(x);+    ColVectorType y(cols); y.setZero();+    ColSquareMatrixType A(cols,cols); A.setRandom();+    // CwiseBinaryOp+    VERIFY_IS_APPROX(x = y + A*x, A*z);+    x = z;+    // CwiseUnaryOp+    VERIFY_IS_APPROX(x = Scalar(1.)*(A*x), A*z);+  }++  // regression for blas_trais+  {+    VERIFY_IS_APPROX(square * (square*square).transpose(), square * square.transpose() * square.transpose());+    VERIFY_IS_APPROX(square * (-(square*square)), -square * square * square);+    VERIFY_IS_APPROX(square * (s1*(square*square)), s1 * square * square * square);+    VERIFY_IS_APPROX(square * (square*square).conjugate(), square * square.conjugate() * square.conjugate());+  }++}
+ eigen3/test/product_extra.cpp view
@@ -0,0 +1,374 @@+// This file is part of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2006-2008 Benoit Jacob <jacob.benoit.1@gmail.com>+//+// 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<typename MatrixType> void product_extra(const MatrixType& m)+{+  typedef typename MatrixType::Scalar Scalar;+  typedef Matrix<Scalar, 1, Dynamic> RowVectorType;+  typedef Matrix<Scalar, Dynamic, 1> ColVectorType;+  typedef Matrix<Scalar, Dynamic, Dynamic,+                         MatrixType::Flags&RowMajorBit> OtherMajorMatrixType;++  Index rows = m.rows();+  Index cols = m.cols();++  MatrixType m1 = MatrixType::Random(rows, cols),+             m2 = MatrixType::Random(rows, cols),+             m3(rows, cols),+             mzero = MatrixType::Zero(rows, cols),+             identity = MatrixType::Identity(rows, rows),+             square = MatrixType::Random(rows, rows),+             res = MatrixType::Random(rows, rows),+             square2 = MatrixType::Random(cols, cols),+             res2 = MatrixType::Random(cols, cols);+  RowVectorType v1 = RowVectorType::Random(rows), vrres(rows);+  ColVectorType vc2 = ColVectorType::Random(cols), vcres(cols);+  OtherMajorMatrixType tm1 = m1;++  Scalar s1 = internal::random<Scalar>(),+         s2 = internal::random<Scalar>(),+         s3 = internal::random<Scalar>();++  VERIFY_IS_APPROX(m3.noalias() = m1 * m2.adjoint(),                 m1 * m2.adjoint().eval());+  VERIFY_IS_APPROX(m3.noalias() = m1.adjoint() * square.adjoint(),   m1.adjoint().eval() * square.adjoint().eval());+  VERIFY_IS_APPROX(m3.noalias() = m1.adjoint() * m2,                 m1.adjoint().eval() * m2);+  VERIFY_IS_APPROX(m3.noalias() = (s1 * m1.adjoint()) * m2,          (s1 * m1.adjoint()).eval() * m2);+  VERIFY_IS_APPROX(m3.noalias() = ((s1 * m1).adjoint()) * m2,        (numext::conj(s1) * m1.adjoint()).eval() * m2);+  VERIFY_IS_APPROX(m3.noalias() = (- m1.adjoint() * s1) * (s3 * m2), (- m1.adjoint()  * s1).eval() * (s3 * m2).eval());+  VERIFY_IS_APPROX(m3.noalias() = (s2 * m1.adjoint() * s1) * m2,     (s2 * m1.adjoint()  * s1).eval() * m2);+  VERIFY_IS_APPROX(m3.noalias() = (-m1*s2) * s1*m2.adjoint(),        (-m1*s2).eval() * (s1*m2.adjoint()).eval());++  // a very tricky case where a scale factor has to be automatically conjugated:+  VERIFY_IS_APPROX( m1.adjoint() * (s1*m2).conjugate(), (m1.adjoint()).eval() * ((s1*m2).conjugate()).eval());+++  // test all possible conjugate combinations for the four matrix-vector product cases:++  VERIFY_IS_APPROX((-m1.conjugate() * s2) * (s1 * vc2),+                   (-m1.conjugate()*s2).eval() * (s1 * vc2).eval());+  VERIFY_IS_APPROX((-m1 * s2) * (s1 * vc2.conjugate()),+                   (-m1*s2).eval() * (s1 * vc2.conjugate()).eval());+  VERIFY_IS_APPROX((-m1.conjugate() * s2) * (s1 * vc2.conjugate()),+                   (-m1.conjugate()*s2).eval() * (s1 * vc2.conjugate()).eval());++  VERIFY_IS_APPROX((s1 * vc2.transpose()) * (-m1.adjoint() * s2),+                   (s1 * vc2.transpose()).eval() * (-m1.adjoint()*s2).eval());+  VERIFY_IS_APPROX((s1 * vc2.adjoint()) * (-m1.transpose() * s2),+                   (s1 * vc2.adjoint()).eval() * (-m1.transpose()*s2).eval());+  VERIFY_IS_APPROX((s1 * vc2.adjoint()) * (-m1.adjoint() * s2),+                   (s1 * vc2.adjoint()).eval() * (-m1.adjoint()*s2).eval());++  VERIFY_IS_APPROX((-m1.adjoint() * s2) * (s1 * v1.transpose()),+                   (-m1.adjoint()*s2).eval() * (s1 * v1.transpose()).eval());+  VERIFY_IS_APPROX((-m1.transpose() * s2) * (s1 * v1.adjoint()),+                   (-m1.transpose()*s2).eval() * (s1 * v1.adjoint()).eval());+  VERIFY_IS_APPROX((-m1.adjoint() * s2) * (s1 * v1.adjoint()),+                   (-m1.adjoint()*s2).eval() * (s1 * v1.adjoint()).eval());++  VERIFY_IS_APPROX((s1 * v1) * (-m1.conjugate() * s2),+                   (s1 * v1).eval() * (-m1.conjugate()*s2).eval());+  VERIFY_IS_APPROX((s1 * v1.conjugate()) * (-m1 * s2),+                   (s1 * v1.conjugate()).eval() * (-m1*s2).eval());+  VERIFY_IS_APPROX((s1 * v1.conjugate()) * (-m1.conjugate() * s2),+                   (s1 * v1.conjugate()).eval() * (-m1.conjugate()*s2).eval());++  VERIFY_IS_APPROX((-m1.adjoint() * s2) * (s1 * v1.adjoint()),+                   (-m1.adjoint()*s2).eval() * (s1 * v1.adjoint()).eval());++  // test the vector-matrix product with non aligned starts+  Index i = internal::random<Index>(0,m1.rows()-2);+  Index j = internal::random<Index>(0,m1.cols()-2);+  Index r = internal::random<Index>(1,m1.rows()-i);+  Index c = internal::random<Index>(1,m1.cols()-j);+  Index i2 = internal::random<Index>(0,m1.rows()-1);+  Index j2 = internal::random<Index>(0,m1.cols()-1);++  VERIFY_IS_APPROX(m1.col(j2).adjoint() * m1.block(0,j,m1.rows(),c), m1.col(j2).adjoint().eval() * m1.block(0,j,m1.rows(),c).eval());+  VERIFY_IS_APPROX(m1.block(i,0,r,m1.cols()) * m1.row(i2).adjoint(), m1.block(i,0,r,m1.cols()).eval() * m1.row(i2).adjoint().eval());+  +  // regression test+  MatrixType tmp = m1 * m1.adjoint() * s1;+  VERIFY_IS_APPROX(tmp, m1 * m1.adjoint() * s1);++  // regression test for bug 1343, assignment to arrays+  Array<Scalar,Dynamic,1> a1 = m1 * vc2;+  VERIFY_IS_APPROX(a1.matrix(),m1*vc2);+  Array<Scalar,Dynamic,1> a2 = s1 * (m1 * vc2);+  VERIFY_IS_APPROX(a2.matrix(),s1*m1*vc2);+  Array<Scalar,1,Dynamic> a3 = v1 * m1;+  VERIFY_IS_APPROX(a3.matrix(),v1*m1);+  Array<Scalar,Dynamic,Dynamic> a4 = m1 * m2.adjoint();+  VERIFY_IS_APPROX(a4.matrix(),m1*m2.adjoint());+}++// Regression test for bug reported at http://forum.kde.org/viewtopic.php?f=74&t=96947+void mat_mat_scalar_scalar_product()+{+  Eigen::Matrix2Xd dNdxy(2, 3);+  dNdxy << -0.5, 0.5, 0,+           -0.3, 0, 0.3;+  double det = 6.0, wt = 0.5;+  VERIFY_IS_APPROX(dNdxy.transpose()*dNdxy*det*wt, det*wt*dNdxy.transpose()*dNdxy);+}++template <typename MatrixType> +void zero_sized_objects(const MatrixType& m)+{+  typedef typename MatrixType::Scalar Scalar;+  const int PacketSize  = internal::packet_traits<Scalar>::size;+  const int PacketSize1 = PacketSize>1 ?  PacketSize-1 : 1;+  Index rows = m.rows();+  Index cols = m.cols();+  +  {+    MatrixType res, a(rows,0), b(0,cols);+    VERIFY_IS_APPROX( (res=a*b), MatrixType::Zero(rows,cols) );+    VERIFY_IS_APPROX( (res=a*a.transpose()), MatrixType::Zero(rows,rows) );+    VERIFY_IS_APPROX( (res=b.transpose()*b), MatrixType::Zero(cols,cols) );+    VERIFY_IS_APPROX( (res=b.transpose()*a.transpose()), MatrixType::Zero(cols,rows) );+  }+  +  {+    MatrixType res, a(rows,cols), b(cols,0);+    res = a*b;+    VERIFY(res.rows()==rows && res.cols()==0);+    b.resize(0,rows);+    res = b*a;+    VERIFY(res.rows()==0 && res.cols()==cols);+  }+  +  {+    Matrix<Scalar,PacketSize,0> a;+    Matrix<Scalar,0,1> b;+    Matrix<Scalar,PacketSize,1> res;+    VERIFY_IS_APPROX( (res=a*b), MatrixType::Zero(PacketSize,1) );+    VERIFY_IS_APPROX( (res=a.lazyProduct(b)), MatrixType::Zero(PacketSize,1) );+  }+  +  {+    Matrix<Scalar,PacketSize1,0> a;+    Matrix<Scalar,0,1> b;+    Matrix<Scalar,PacketSize1,1> res;+    VERIFY_IS_APPROX( (res=a*b), MatrixType::Zero(PacketSize1,1) );+    VERIFY_IS_APPROX( (res=a.lazyProduct(b)), MatrixType::Zero(PacketSize1,1) );+  }+  +  {+    Matrix<Scalar,PacketSize,Dynamic> a(PacketSize,0);+    Matrix<Scalar,Dynamic,1> b(0,1);+    Matrix<Scalar,PacketSize,1> res;+    VERIFY_IS_APPROX( (res=a*b), MatrixType::Zero(PacketSize,1) );+    VERIFY_IS_APPROX( (res=a.lazyProduct(b)), MatrixType::Zero(PacketSize,1) );+  }+  +  {+    Matrix<Scalar,PacketSize1,Dynamic> a(PacketSize1,0);+    Matrix<Scalar,Dynamic,1> b(0,1);+    Matrix<Scalar,PacketSize1,1> res;+    VERIFY_IS_APPROX( (res=a*b), MatrixType::Zero(PacketSize1,1) );+    VERIFY_IS_APPROX( (res=a.lazyProduct(b)), MatrixType::Zero(PacketSize1,1) );+  }+}++template<int>+void bug_127()+{+  // Bug 127+  //+  // a product of the form lhs*rhs with+  //+  // lhs:+  // rows = 1, cols = 4+  // RowsAtCompileTime = 1, ColsAtCompileTime = -1+  // MaxRowsAtCompileTime = 1, MaxColsAtCompileTime = 5+  //+  // rhs:+  // rows = 4, cols = 0+  // RowsAtCompileTime = -1, ColsAtCompileTime = -1+  // MaxRowsAtCompileTime = 5, MaxColsAtCompileTime = 1+  //+  // was failing on a runtime assertion, because it had been mis-compiled as a dot product because Product.h was using the+  // max-sizes to detect size 1 indicating vectors, and that didn't account for 0-sized object with max-size 1.++  Matrix<float,1,Dynamic,RowMajor,1,5> a(1,4);+  Matrix<float,Dynamic,Dynamic,ColMajor,5,1> b(4,0);+  a*b;+}++template<int> void bug_817()+{+  ArrayXXf B = ArrayXXf::Random(10,10), C;+  VectorXf x = VectorXf::Random(10);+  C = (x.transpose()*B.matrix());+  B = (x.transpose()*B.matrix());+  VERIFY_IS_APPROX(B,C);+}++template<int>+void unaligned_objects()+{+  // Regression test for the bug reported here:+  // http://forum.kde.org/viewtopic.php?f=74&t=107541+  // Recall the matrix*vector kernel avoid unaligned loads by loading two packets and then reassemble then.+  // There was a mistake in the computation of the valid range for fully unaligned objects: in some rare cases,+  // memory was read outside the allocated matrix memory. Though the values were not used, this might raise segfault.+  for(int m=450;m<460;++m)+  {+    for(int n=8;n<12;++n)+    {+      MatrixXf M(m, n);+      VectorXf v1(n), r1(500);+      RowVectorXf v2(m), r2(16);++      M.setRandom();+      v1.setRandom();+      v2.setRandom();+      for(int o=0; o<4; ++o)+      {+        r1.segment(o,m).noalias() = M * v1;+        VERIFY_IS_APPROX(r1.segment(o,m), M * MatrixXf(v1));+        r2.segment(o,n).noalias() = v2 * M;+        VERIFY_IS_APPROX(r2.segment(o,n), MatrixXf(v2) * M);+      }+    }+  }+}++template<typename T>+EIGEN_DONT_INLINE+Index test_compute_block_size(Index m, Index n, Index k)+{+  Index mc(m), nc(n), kc(k);+  internal::computeProductBlockingSizes<T,T>(kc, mc, nc);+  return kc+mc+nc;+}++template<typename T>+Index compute_block_size()+{+  Index ret = 0;+  ret += test_compute_block_size<T>(0,1,1);+  ret += test_compute_block_size<T>(1,0,1);+  ret += test_compute_block_size<T>(1,1,0);+  ret += test_compute_block_size<T>(0,0,1);+  ret += test_compute_block_size<T>(0,1,0);+  ret += test_compute_block_size<T>(1,0,0);+  ret += test_compute_block_size<T>(0,0,0);+  return ret;+}++template<typename>+void aliasing_with_resize()+{+  Index m = internal::random<Index>(10,50);+  Index n = internal::random<Index>(10,50);+  MatrixXd A, B, C(m,n), D(m,m);+  VectorXd a, b, c(n);+  C.setRandom();+  D.setRandom();+  c.setRandom();+  double s = internal::random<double>(1,10);++  A = C;+  B = A * A.transpose();+  A = A * A.transpose();+  VERIFY_IS_APPROX(A,B);++  A = C;+  B = (A * A.transpose())/s;+  A = (A * A.transpose())/s;+  VERIFY_IS_APPROX(A,B);++  A = C;+  B = (A * A.transpose()) + D;+  A = (A * A.transpose()) + D;+  VERIFY_IS_APPROX(A,B);++  A = C;+  B = D + (A * A.transpose());+  A = D + (A * A.transpose());+  VERIFY_IS_APPROX(A,B);++  A = C;+  B = s * (A * A.transpose());+  A = s * (A * A.transpose());+  VERIFY_IS_APPROX(A,B);++  A = C;+  a = c;+  b = (A * a)/s;+  a = (A * a)/s;+  VERIFY_IS_APPROX(a,b);+}++template<int>+void bug_1308()+{+  int n = 10;+  MatrixXd r(n,n);+  VectorXd v = VectorXd::Random(n);+  r = v * RowVectorXd::Ones(n);+  VERIFY_IS_APPROX(r, v.rowwise().replicate(n));+  r = VectorXd::Ones(n) * v.transpose();+  VERIFY_IS_APPROX(r, v.rowwise().replicate(n).transpose());++  Matrix4d ones44 = Matrix4d::Ones();+  Matrix4d m44 = Matrix4d::Ones() * Matrix4d::Ones();+  VERIFY_IS_APPROX(m44,Matrix4d::Constant(4));+  VERIFY_IS_APPROX(m44.noalias()=ones44*Matrix4d::Ones(), Matrix4d::Constant(4));+  VERIFY_IS_APPROX(m44.noalias()=ones44.transpose()*Matrix4d::Ones(), Matrix4d::Constant(4));+  VERIFY_IS_APPROX(m44.noalias()=Matrix4d::Ones()*ones44, Matrix4d::Constant(4));+  VERIFY_IS_APPROX(m44.noalias()=Matrix4d::Ones()*ones44.transpose(), Matrix4d::Constant(4));++  typedef Matrix<double,4,4,RowMajor> RMatrix4d;+  RMatrix4d r44 = Matrix4d::Ones() * Matrix4d::Ones();+  VERIFY_IS_APPROX(r44,Matrix4d::Constant(4));+  VERIFY_IS_APPROX(r44.noalias()=ones44*Matrix4d::Ones(), Matrix4d::Constant(4));+  VERIFY_IS_APPROX(r44.noalias()=ones44.transpose()*Matrix4d::Ones(), Matrix4d::Constant(4));+  VERIFY_IS_APPROX(r44.noalias()=Matrix4d::Ones()*ones44, Matrix4d::Constant(4));+  VERIFY_IS_APPROX(r44.noalias()=Matrix4d::Ones()*ones44.transpose(), Matrix4d::Constant(4));+  VERIFY_IS_APPROX(r44.noalias()=ones44*RMatrix4d::Ones(), Matrix4d::Constant(4));+  VERIFY_IS_APPROX(r44.noalias()=ones44.transpose()*RMatrix4d::Ones(), Matrix4d::Constant(4));+  VERIFY_IS_APPROX(r44.noalias()=RMatrix4d::Ones()*ones44, Matrix4d::Constant(4));+  VERIFY_IS_APPROX(r44.noalias()=RMatrix4d::Ones()*ones44.transpose(), Matrix4d::Constant(4));++//   RowVector4d r4;+  m44.setOnes();+  r44.setZero();+  VERIFY_IS_APPROX(r44.noalias() += m44.row(0).transpose() * RowVector4d::Ones(), ones44);+  r44.setZero();+  VERIFY_IS_APPROX(r44.noalias() += m44.col(0) * RowVector4d::Ones(), ones44);+  r44.setZero();+  VERIFY_IS_APPROX(r44.noalias() += Vector4d::Ones() * m44.row(0), ones44);+  r44.setZero();+  VERIFY_IS_APPROX(r44.noalias() += Vector4d::Ones() * m44.col(0).transpose(), ones44);+}++void test_product_extra()+{+  for(int i = 0; i < g_repeat; i++) {+    CALL_SUBTEST_1( product_extra(MatrixXf(internal::random<int>(1,EIGEN_TEST_MAX_SIZE), internal::random<int>(1,EIGEN_TEST_MAX_SIZE))) );+    CALL_SUBTEST_2( product_extra(MatrixXd(internal::random<int>(1,EIGEN_TEST_MAX_SIZE), internal::random<int>(1,EIGEN_TEST_MAX_SIZE))) );+    CALL_SUBTEST_2( mat_mat_scalar_scalar_product() );+    CALL_SUBTEST_3( product_extra(MatrixXcf(internal::random<int>(1,EIGEN_TEST_MAX_SIZE/2), internal::random<int>(1,EIGEN_TEST_MAX_SIZE/2))) );+    CALL_SUBTEST_4( product_extra(MatrixXcd(internal::random<int>(1,EIGEN_TEST_MAX_SIZE/2), internal::random<int>(1,EIGEN_TEST_MAX_SIZE/2))) );+    CALL_SUBTEST_1( zero_sized_objects(MatrixXf(internal::random<int>(1,EIGEN_TEST_MAX_SIZE), internal::random<int>(1,EIGEN_TEST_MAX_SIZE))) );+  }+  CALL_SUBTEST_5( bug_127<0>() );+  CALL_SUBTEST_5( bug_817<0>() );+  CALL_SUBTEST_5( bug_1308<0>() );+  CALL_SUBTEST_6( unaligned_objects<0>() );+  CALL_SUBTEST_7( compute_block_size<float>() );+  CALL_SUBTEST_7( compute_block_size<double>() );+  CALL_SUBTEST_7( compute_block_size<std::complex<double> >() );+  CALL_SUBTEST_8( aliasing_with_resize<void>() );++}
+ eigen3/test/product_large.cpp view
@@ -0,0 +1,107 @@+// This file is part of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2006-2008 Benoit Jacob <jacob.benoit.1@gmail.com>+//+// 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 "product.h"++template<typename T>+void test_aliasing()+{+  int rows = internal::random<int>(1,12);+  int cols = internal::random<int>(1,12);+  typedef Matrix<T,Dynamic,Dynamic> MatrixType;+  typedef Matrix<T,Dynamic,1> VectorType;+  VectorType x(cols); x.setRandom();+  VectorType z(x);+  VectorType y(rows); y.setZero();+  MatrixType A(rows,cols); A.setRandom();+  // CwiseBinaryOp+  VERIFY_IS_APPROX(x = y + A*x, A*z);     // OK because "y + A*x" is marked as "assume-aliasing"+  x = z;+  // CwiseUnaryOp+  VERIFY_IS_APPROX(x = T(1.)*(A*x), A*z); // OK because 1*(A*x) is replaced by (1*A*x) which is a Product<> expression+  x = z;+  // VERIFY_IS_APPROX(x = y-A*x, -A*z);   // Not OK in 3.3 because x is resized before A*x gets evaluated+  x = z;+}++void test_product_large()+{+  for(int i = 0; i < g_repeat; i++) {+    CALL_SUBTEST_1( product(MatrixXf(internal::random<int>(1,EIGEN_TEST_MAX_SIZE), internal::random<int>(1,EIGEN_TEST_MAX_SIZE))) );+    CALL_SUBTEST_2( product(MatrixXd(internal::random<int>(1,EIGEN_TEST_MAX_SIZE), internal::random<int>(1,EIGEN_TEST_MAX_SIZE))) );+    CALL_SUBTEST_3( product(MatrixXi(internal::random<int>(1,EIGEN_TEST_MAX_SIZE), internal::random<int>(1,EIGEN_TEST_MAX_SIZE))) );+    CALL_SUBTEST_4( product(MatrixXcf(internal::random<int>(1,EIGEN_TEST_MAX_SIZE/2), internal::random<int>(1,EIGEN_TEST_MAX_SIZE/2))) );+    CALL_SUBTEST_5( product(Matrix<float,Dynamic,Dynamic,RowMajor>(internal::random<int>(1,EIGEN_TEST_MAX_SIZE), internal::random<int>(1,EIGEN_TEST_MAX_SIZE))) );++    CALL_SUBTEST_1( test_aliasing<float>() );+  }++#if defined EIGEN_TEST_PART_6+  {+    // test a specific issue in DiagonalProduct+    int N = 1000000;+    VectorXf v = VectorXf::Ones(N);+    MatrixXf m = MatrixXf::Ones(N,3);+    m = (v+v).asDiagonal() * m;+    VERIFY_IS_APPROX(m, MatrixXf::Constant(N,3,2));+  }++  {+    // test deferred resizing in Matrix::operator=+    MatrixXf a = MatrixXf::Random(10,4), b = MatrixXf::Random(4,10), c = a;+    VERIFY_IS_APPROX((a = a * b), (c * b).eval());+  }++  {+    // check the functions to setup blocking sizes compile and do not segfault+    // FIXME check they do what they are supposed to do !!+    std::ptrdiff_t l1 = internal::random<int>(10000,20000);+    std::ptrdiff_t l2 = internal::random<int>(100000,200000);+    std::ptrdiff_t l3 = internal::random<int>(1000000,2000000);+    setCpuCacheSizes(l1,l2,l3);+    VERIFY(l1==l1CacheSize());+    VERIFY(l2==l2CacheSize());+    std::ptrdiff_t k1 = internal::random<int>(10,100)*16;+    std::ptrdiff_t m1 = internal::random<int>(10,100)*16;+    std::ptrdiff_t n1 = internal::random<int>(10,100)*16;+    // only makes sure it compiles fine+    internal::computeProductBlockingSizes<float,float,std::ptrdiff_t>(k1,m1,n1,1);+  }++  {+    // test regression in row-vector by matrix (bad Map type)+    MatrixXf mat1(10,32); mat1.setRandom();+    MatrixXf mat2(32,32); mat2.setRandom();+    MatrixXf r1 = mat1.row(2)*mat2.transpose();+    VERIFY_IS_APPROX(r1, (mat1.row(2)*mat2.transpose()).eval());++    MatrixXf r2 = mat1.row(2)*mat2;+    VERIFY_IS_APPROX(r2, (mat1.row(2)*mat2).eval());+  }++  {+    Eigen::MatrixXd A(10,10), B, C;+    A.setRandom();+    C = A;+    for(int k=0; k<79; ++k)+      C = C * A;+    B.noalias() = (((A*A)*(A*A))*((A*A)*(A*A))*((A*A)*(A*A))*((A*A)*(A*A))*((A*A)*(A*A)) * ((A*A)*(A*A))*((A*A)*(A*A))*((A*A)*(A*A))*((A*A)*(A*A))*((A*A)*(A*A)))+                * (((A*A)*(A*A))*((A*A)*(A*A))*((A*A)*(A*A))*((A*A)*(A*A))*((A*A)*(A*A)) * ((A*A)*(A*A))*((A*A)*(A*A))*((A*A)*(A*A))*((A*A)*(A*A))*((A*A)*(A*A)));+    VERIFY_IS_APPROX(B,C);+  }+#endif++  // Regression test for bug 714:+#if defined EIGEN_HAS_OPENMP+  omp_set_dynamic(1);+  for(int i = 0; i < g_repeat; i++) {+    CALL_SUBTEST_6( product(Matrix<float,Dynamic,Dynamic>(internal::random<int>(1,EIGEN_TEST_MAX_SIZE), internal::random<int>(1,EIGEN_TEST_MAX_SIZE))) );+  }+#endif+}
+ eigen3/test/product_mmtr.cpp view
@@ -0,0 +1,96 @@+// This file is part of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2010-2017 Gael Guennebaud <gael.guennebaud@inria.fr>+//+// 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 CHECK_MMTR(DEST, TRI, OP) {                   \+    ref3 = DEST;                                      \+    ref2 = ref1 = DEST;                               \+    DEST.template triangularView<TRI>() OP;           \+    ref1 OP;                                          \+    ref2.template triangularView<TRI>()               \+      = ref1.template triangularView<TRI>();          \+    VERIFY_IS_APPROX(DEST,ref2);                      \+    \+    DEST = ref3;                                      \+    ref3 = ref2;                                      \+    ref3.diagonal() = DEST.diagonal();                \+    DEST.template triangularView<TRI|ZeroDiag>() OP;  \+    VERIFY_IS_APPROX(DEST,ref3);                      \+  }++template<typename Scalar> void mmtr(int size)+{+  typedef Matrix<Scalar,Dynamic,Dynamic,ColMajor> MatrixColMaj;+  typedef Matrix<Scalar,Dynamic,Dynamic,RowMajor> MatrixRowMaj;++  DenseIndex othersize = internal::random<DenseIndex>(1,200);+  +  MatrixColMaj matc = MatrixColMaj::Zero(size, size);+  MatrixRowMaj matr = MatrixRowMaj::Zero(size, size);+  MatrixColMaj ref1(size, size), ref2(size, size), ref3(size,size);+  +  MatrixColMaj soc(size,othersize); soc.setRandom();+  MatrixColMaj osc(othersize,size); osc.setRandom();+  MatrixRowMaj sor(size,othersize); sor.setRandom();+  MatrixRowMaj osr(othersize,size); osr.setRandom();+  MatrixColMaj sqc(size,size); sqc.setRandom();+  MatrixRowMaj sqr(size,size); sqr.setRandom();+  +  Scalar s = internal::random<Scalar>();+  +  CHECK_MMTR(matc, Lower, = s*soc*sor.adjoint());+  CHECK_MMTR(matc, Upper, = s*(soc*soc.adjoint()));+  CHECK_MMTR(matr, Lower, = s*soc*soc.adjoint());+  CHECK_MMTR(matr, Upper, = soc*(s*sor.adjoint()));+  +  CHECK_MMTR(matc, Lower, += s*soc*soc.adjoint());+  CHECK_MMTR(matc, Upper, += s*(soc*sor.transpose()));+  CHECK_MMTR(matr, Lower, += s*sor*soc.adjoint());+  CHECK_MMTR(matr, Upper, += soc*(s*soc.adjoint()));+  +  CHECK_MMTR(matc, Lower, -= s*soc*soc.adjoint());+  CHECK_MMTR(matc, Upper, -= s*(osc.transpose()*osc.conjugate()));+  CHECK_MMTR(matr, Lower, -= s*soc*soc.adjoint());+  CHECK_MMTR(matr, Upper, -= soc*(s*soc.adjoint()));+  +  CHECK_MMTR(matc, Lower, -= s*sqr*sqc.template triangularView<Upper>());+  CHECK_MMTR(matc, Upper, = s*sqc*sqr.template triangularView<Upper>());+  CHECK_MMTR(matc, Lower, += s*sqr*sqc.template triangularView<Lower>());+  CHECK_MMTR(matc, Upper, = s*sqc*sqc.template triangularView<Lower>());+  +  CHECK_MMTR(matc, Lower, = (s*sqr).template triangularView<Upper>()*sqc);+  CHECK_MMTR(matc, Upper, -= (s*sqc).template triangularView<Upper>()*sqc);+  CHECK_MMTR(matc, Lower, = (s*sqr).template triangularView<Lower>()*sqc);+  CHECK_MMTR(matc, Upper, += (s*sqc).template triangularView<Lower>()*sqc);++  // check aliasing+  ref2 = ref1 = matc;+  ref1 = sqc.adjoint() * matc * sqc;+  ref2.template triangularView<Upper>() = ref1.template triangularView<Upper>();+  matc.template triangularView<Upper>() = sqc.adjoint() * matc * sqc;+  VERIFY_IS_APPROX(matc, ref2);++  ref2 = ref1 = matc;+  ref1 = sqc * matc * sqc.adjoint();+  ref2.template triangularView<Lower>() = ref1.template triangularView<Lower>();+  matc.template triangularView<Lower>() = sqc * matc * sqc.adjoint();+  VERIFY_IS_APPROX(matc, ref2);+}++void test_product_mmtr()+{+  for(int i = 0; i < g_repeat ; i++)+  {+    CALL_SUBTEST_1((mmtr<float>(internal::random<int>(1,EIGEN_TEST_MAX_SIZE))));+    CALL_SUBTEST_2((mmtr<double>(internal::random<int>(1,EIGEN_TEST_MAX_SIZE))));+    CALL_SUBTEST_3((mmtr<std::complex<float> >(internal::random<int>(1,EIGEN_TEST_MAX_SIZE/2))));+    CALL_SUBTEST_4((mmtr<std::complex<double> >(internal::random<int>(1,EIGEN_TEST_MAX_SIZE/2))));+  }+}
+ eigen3/test/product_notemporary.cpp view
@@ -0,0 +1,159 @@+// This file is part of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2006-2008 Benoit Jacob <jacob.benoit.1@gmail.com>+//+// 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<typename MatrixType> void product_notemporary(const MatrixType& m)+{+  /* This test checks the number of temporaries created+   * during the evaluation of a complex expression */+  typedef typename MatrixType::Scalar Scalar;+  typedef typename MatrixType::RealScalar RealScalar;+  typedef Matrix<Scalar, 1, Dynamic> RowVectorType;+  typedef Matrix<Scalar, Dynamic, 1> ColVectorType;+  typedef Matrix<Scalar, Dynamic, Dynamic, ColMajor> ColMajorMatrixType;+  typedef Matrix<Scalar, Dynamic, Dynamic, RowMajor> RowMajorMatrixType;++  Index rows = m.rows();+  Index cols = m.cols();++  ColMajorMatrixType m1 = MatrixType::Random(rows, cols),+                     m2 = MatrixType::Random(rows, cols),+                     m3(rows, cols);+  RowVectorType rv1 = RowVectorType::Random(rows), rvres(rows);+  ColVectorType cv1 = ColVectorType::Random(cols), cvres(cols);+  RowMajorMatrixType rm3(rows, cols);++  Scalar s1 = internal::random<Scalar>(),+         s2 = internal::random<Scalar>(),+         s3 = internal::random<Scalar>();++  Index c0 = internal::random<Index>(4,cols-8),+        c1 = internal::random<Index>(8,cols-c0),+        r0 = internal::random<Index>(4,cols-8),+        r1 = internal::random<Index>(8,rows-r0);++  VERIFY_EVALUATION_COUNT( m3 = (m1 * m2.adjoint()), 1);+  VERIFY_EVALUATION_COUNT( m3 = (m1 * m2.adjoint()).transpose(), 1);+  VERIFY_EVALUATION_COUNT( m3.noalias() = m1 * m2.adjoint(), 0);++  VERIFY_EVALUATION_COUNT( m3 = s1 * (m1 * m2.transpose()), 1);+//   VERIFY_EVALUATION_COUNT( m3 = m3 + s1 * (m1 * m2.transpose()), 1);+  VERIFY_EVALUATION_COUNT( m3.noalias() = s1 * (m1 * m2.transpose()), 0);++  VERIFY_EVALUATION_COUNT( m3 = m3 + (m1 * m2.adjoint()), 1);+  VERIFY_EVALUATION_COUNT( m3 = m3 - (m1 * m2.adjoint()), 1);++  VERIFY_EVALUATION_COUNT( m3 = m3 + (m1 * m2.adjoint()).transpose(), 1);+  VERIFY_EVALUATION_COUNT( m3.noalias() = m3 + m1 * m2.transpose(), 0);+  VERIFY_EVALUATION_COUNT( m3.noalias() += m3 + m1 * m2.transpose(), 0);+  VERIFY_EVALUATION_COUNT( m3.noalias() -= m3 + m1 * m2.transpose(), 0);+  VERIFY_EVALUATION_COUNT( m3.noalias() =  m3 - m1 * m2.transpose(), 0);+  VERIFY_EVALUATION_COUNT( m3.noalias() += m3 - m1 * m2.transpose(), 0);+  VERIFY_EVALUATION_COUNT( m3.noalias() -= m3 - m1 * m2.transpose(), 0);++  VERIFY_EVALUATION_COUNT( m3.noalias() = s1 * m1 * s2 * m2.adjoint(), 0);+  VERIFY_EVALUATION_COUNT( m3.noalias() = s1 * m1 * s2 * (m1*s3+m2*s2).adjoint(), 1);+  VERIFY_EVALUATION_COUNT( m3.noalias() = (s1 * m1).adjoint() * s2 * m2, 0);+  VERIFY_EVALUATION_COUNT( m3.noalias() += s1 * (-m1*s3).adjoint() * (s2 * m2 * s3), 0);+  VERIFY_EVALUATION_COUNT( m3.noalias() -= s1 * (m1.transpose() * m2), 0);++  VERIFY_EVALUATION_COUNT(( m3.block(r0,r0,r1,r1).noalias() += -m1.block(r0,c0,r1,c1) * (s2*m2.block(r0,c0,r1,c1)).adjoint() ), 0);+  VERIFY_EVALUATION_COUNT(( m3.block(r0,r0,r1,r1).noalias() -= s1 * m1.block(r0,c0,r1,c1) * m2.block(c0,r0,c1,r1) ), 0);++  // NOTE this is because the Block expression is not handled yet by our expression analyser+  VERIFY_EVALUATION_COUNT(( m3.block(r0,r0,r1,r1).noalias() = s1 * m1.block(r0,c0,r1,c1) * (s1*m2).block(c0,r0,c1,r1) ), 1);++  VERIFY_EVALUATION_COUNT( m3.noalias() -= (s1 * m1).template triangularView<Lower>() * m2, 0);+  VERIFY_EVALUATION_COUNT( rm3.noalias() = (s1 * m1.adjoint()).template triangularView<Upper>() * (m2+m2), 1);+  VERIFY_EVALUATION_COUNT( rm3.noalias() = (s1 * m1.adjoint()).template triangularView<UnitUpper>() * m2.adjoint(), 0);++  VERIFY_EVALUATION_COUNT( m3.template triangularView<Upper>() = (m1 * m2.adjoint()), 0);+  VERIFY_EVALUATION_COUNT( m3.template triangularView<Upper>() -= (m1 * m2.adjoint()), 0);++  // NOTE this is because the blas_traits require innerstride==1 to avoid a temporary, but that doesn't seem to be actually needed for the triangular products+  VERIFY_EVALUATION_COUNT( rm3.col(c0).noalias() = (s1 * m1.adjoint()).template triangularView<UnitUpper>() * (s2*m2.row(c0)).adjoint(), 1);++  VERIFY_EVALUATION_COUNT( m1.template triangularView<Lower>().solveInPlace(m3), 0);+  VERIFY_EVALUATION_COUNT( m1.adjoint().template triangularView<Lower>().solveInPlace(m3.transpose()), 0);++  VERIFY_EVALUATION_COUNT( m3.noalias() -= (s1 * m1).adjoint().template selfadjointView<Lower>() * (-m2*s3).adjoint(), 0);+  VERIFY_EVALUATION_COUNT( m3.noalias() = s2 * m2.adjoint() * (s1 * m1.adjoint()).template selfadjointView<Upper>(), 0);+  VERIFY_EVALUATION_COUNT( rm3.noalias() = (s1 * m1.adjoint()).template selfadjointView<Lower>() * m2.adjoint(), 0);++  // NOTE this is because the blas_traits require innerstride==1 to avoid a temporary, but that doesn't seem to be actually needed for the triangular products+  VERIFY_EVALUATION_COUNT( m3.col(c0).noalias() = (s1 * m1).adjoint().template selfadjointView<Lower>() * (-m2.row(c0)*s3).adjoint(), 1);+  VERIFY_EVALUATION_COUNT( m3.col(c0).noalias() -= (s1 * m1).adjoint().template selfadjointView<Upper>() * (-m2.row(c0)*s3).adjoint(), 1);++  VERIFY_EVALUATION_COUNT( m3.block(r0,c0,r1,c1).noalias() += m1.block(r0,r0,r1,r1).template selfadjointView<Upper>() * (s1*m2.block(r0,c0,r1,c1)), 0);+  VERIFY_EVALUATION_COUNT( m3.block(r0,c0,r1,c1).noalias() = m1.block(r0,r0,r1,r1).template selfadjointView<Upper>() * m2.block(r0,c0,r1,c1), 0);++  VERIFY_EVALUATION_COUNT( m3.template selfadjointView<Lower>().rankUpdate(m2.adjoint()), 0);++  // Here we will get 1 temporary for each resize operation of the lhs operator; resize(r1,c1) would lead to zero temporaries+  m3.resize(1,1);+  VERIFY_EVALUATION_COUNT( m3.noalias() = m1.block(r0,r0,r1,r1).template selfadjointView<Lower>() * m2.block(r0,c0,r1,c1), 1);+  m3.resize(1,1);+  VERIFY_EVALUATION_COUNT( m3.noalias() = m1.block(r0,r0,r1,r1).template triangularView<UnitUpper>()  * m2.block(r0,c0,r1,c1), 1);++  // Zero temporaries for lazy products ...+  VERIFY_EVALUATION_COUNT( Scalar tmp = 0; tmp += Scalar(RealScalar(1)) /  (m3.transpose().lazyProduct(m3)).diagonal().sum(), 0 );++  // ... and even no temporary for even deeply (>=2) nested products+  VERIFY_EVALUATION_COUNT( Scalar tmp = 0; tmp += Scalar(RealScalar(1)) /  (m3.transpose() * m3).diagonal().sum(), 0 );+  VERIFY_EVALUATION_COUNT( Scalar tmp = 0; tmp += Scalar(RealScalar(1)) /  (m3.transpose() * m3).diagonal().array().abs().sum(), 0 );++  // Zero temporaries for ... CoeffBasedProductMode+  VERIFY_EVALUATION_COUNT( m3.col(0).template head<5>() * m3.col(0).transpose() + m3.col(0).template head<5>() * m3.col(0).transpose(), 0 );++  // Check matrix * vectors+  VERIFY_EVALUATION_COUNT( cvres.noalias() = m1 * cv1, 0 );+  VERIFY_EVALUATION_COUNT( cvres.noalias() -= m1 * cv1, 0 );+  VERIFY_EVALUATION_COUNT( cvres.noalias() -= m1 * m2.col(0), 0 );+  VERIFY_EVALUATION_COUNT( cvres.noalias() -= m1 * rv1.adjoint(), 0 );+  VERIFY_EVALUATION_COUNT( cvres.noalias() -= m1 * m2.row(0).transpose(), 0 );++  VERIFY_EVALUATION_COUNT( cvres.noalias() = (m1+m1) * cv1, 0 );+  VERIFY_EVALUATION_COUNT( cvres.noalias() = (rm3+rm3) * cv1, 0 );+  VERIFY_EVALUATION_COUNT( cvres.noalias() = (m1+m1) * (m1*cv1), 1 );+  VERIFY_EVALUATION_COUNT( cvres.noalias() = (rm3+rm3) * (m1*cv1), 1 );++  // Check outer products+  m3 = cv1 * rv1;+  VERIFY_EVALUATION_COUNT( m3.noalias() = cv1 * rv1, 0 );+  VERIFY_EVALUATION_COUNT( m3.noalias() = (cv1+cv1) * (rv1+rv1), 1 );+  VERIFY_EVALUATION_COUNT( m3.noalias() = (m1*cv1) * (rv1), 1 );+  VERIFY_EVALUATION_COUNT( m3.noalias() += (m1*cv1) * (rv1), 1 );+  VERIFY_EVALUATION_COUNT( rm3.noalias() = (cv1) * (rv1 * m1), 1 );+  VERIFY_EVALUATION_COUNT( rm3.noalias() -= (cv1) * (rv1 * m1), 1 );+  VERIFY_EVALUATION_COUNT( rm3.noalias() = (m1*cv1) * (rv1 * m1), 2 );+  VERIFY_EVALUATION_COUNT( rm3.noalias() += (m1*cv1) * (rv1 * m1), 2 );++  // Check nested products+  VERIFY_EVALUATION_COUNT( cvres.noalias() = m1.adjoint() * m1 * cv1, 1 );+  VERIFY_EVALUATION_COUNT( rvres.noalias() = rv1 * (m1 * m2.adjoint()), 1 );+}++void test_product_notemporary()+{+  int s;+  for(int i = 0; i < g_repeat; i++) {+    s = internal::random<int>(16,EIGEN_TEST_MAX_SIZE);+    CALL_SUBTEST_1( product_notemporary(MatrixXf(s, s)) );+    CALL_SUBTEST_2( product_notemporary(MatrixXd(s, s)) );+    TEST_SET_BUT_UNUSED_VARIABLE(s)+    +    s = internal::random<int>(16,EIGEN_TEST_MAX_SIZE/2);+    CALL_SUBTEST_3( product_notemporary(MatrixXcf(s,s)) );+    CALL_SUBTEST_4( product_notemporary(MatrixXcd(s,s)) );+    TEST_SET_BUT_UNUSED_VARIABLE(s)+  }+}
+ eigen3/test/product_selfadjoint.cpp view
@@ -0,0 +1,86 @@+// This file is part of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2008-2009 Gael Guennebaud <gael.guennebaud@inria.fr>+//+// 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<typename MatrixType> void product_selfadjoint(const MatrixType& m)+{+  typedef typename MatrixType::Scalar Scalar;+  typedef Matrix<Scalar, MatrixType::RowsAtCompileTime, 1> VectorType;+  typedef Matrix<Scalar, 1, MatrixType::RowsAtCompileTime> RowVectorType;++  typedef Matrix<Scalar, MatrixType::RowsAtCompileTime, Dynamic, RowMajor> RhsMatrixType;++  Index rows = m.rows();+  Index cols = m.cols();++  MatrixType m1 = MatrixType::Random(rows, cols),+             m2 = MatrixType::Random(rows, cols),+             m3;+  VectorType v1 = VectorType::Random(rows),+             v2 = VectorType::Random(rows),+             v3(rows);+  RowVectorType r1 = RowVectorType::Random(rows),+                r2 = RowVectorType::Random(rows);+  RhsMatrixType m4 = RhsMatrixType::Random(rows,10);++  Scalar s1 = internal::random<Scalar>(),+         s2 = internal::random<Scalar>(),+         s3 = internal::random<Scalar>();++  m1 = (m1.adjoint() + m1).eval();++  // rank2 update+  m2 = m1.template triangularView<Lower>();+  m2.template selfadjointView<Lower>().rankUpdate(v1,v2);+  VERIFY_IS_APPROX(m2, (m1 + v1 * v2.adjoint()+ v2 * v1.adjoint()).template triangularView<Lower>().toDenseMatrix());++  m2 = m1.template triangularView<Upper>();+  m2.template selfadjointView<Upper>().rankUpdate(-v1,s2*v2,s3);+  VERIFY_IS_APPROX(m2, (m1 + (s3*(-v1)*(s2*v2).adjoint()+numext::conj(s3)*(s2*v2)*(-v1).adjoint())).template triangularView<Upper>().toDenseMatrix());++  m2 = m1.template triangularView<Upper>();+  m2.template selfadjointView<Upper>().rankUpdate(-s2*r1.adjoint(),r2.adjoint()*s3,s1);+  VERIFY_IS_APPROX(m2, (m1 + s1*(-s2*r1.adjoint())*(r2.adjoint()*s3).adjoint() + numext::conj(s1)*(r2.adjoint()*s3) * (-s2*r1.adjoint()).adjoint()).template triangularView<Upper>().toDenseMatrix());++  if (rows>1)+  {+    m2 = m1.template triangularView<Lower>();+    m2.block(1,1,rows-1,cols-1).template selfadjointView<Lower>().rankUpdate(v1.tail(rows-1),v2.head(cols-1));+    m3 = m1;+    m3.block(1,1,rows-1,cols-1) += v1.tail(rows-1) * v2.head(cols-1).adjoint()+ v2.head(cols-1) * v1.tail(rows-1).adjoint();+    VERIFY_IS_APPROX(m2, m3.template triangularView<Lower>().toDenseMatrix());+  }+}++void test_product_selfadjoint()+{+  int s = 0;+  for(int i = 0; i < g_repeat ; i++) {+    CALL_SUBTEST_1( product_selfadjoint(Matrix<float, 1, 1>()) );+    CALL_SUBTEST_2( product_selfadjoint(Matrix<float, 2, 2>()) );+    CALL_SUBTEST_3( product_selfadjoint(Matrix3d()) );+    +    s = internal::random<int>(1,EIGEN_TEST_MAX_SIZE/2);+    CALL_SUBTEST_4( product_selfadjoint(MatrixXcf(s, s)) );+    TEST_SET_BUT_UNUSED_VARIABLE(s)+    +    s = internal::random<int>(1,EIGEN_TEST_MAX_SIZE/2);+    CALL_SUBTEST_5( product_selfadjoint(MatrixXcd(s,s)) );+    TEST_SET_BUT_UNUSED_VARIABLE(s)+    +    s = internal::random<int>(1,EIGEN_TEST_MAX_SIZE);+    CALL_SUBTEST_6( product_selfadjoint(MatrixXd(s,s)) );+    TEST_SET_BUT_UNUSED_VARIABLE(s)+    +    s = internal::random<int>(1,EIGEN_TEST_MAX_SIZE);+    CALL_SUBTEST_7( product_selfadjoint(Matrix<float,Dynamic,Dynamic,RowMajor>(s,s)) );+    TEST_SET_BUT_UNUSED_VARIABLE(s)+  }+}
+ eigen3/test/product_small.cpp view
@@ -0,0 +1,293 @@+// This file is part of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2006-2008 Benoit Jacob <jacob.benoit.1@gmail.com>+//+// 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 "product.h"+#include <Eigen/LU>++// regression test for bug 447+template<int>+void product1x1()+{+  Matrix<float,1,3> matAstatic;+  Matrix<float,3,1> matBstatic;+  matAstatic.setRandom();+  matBstatic.setRandom();+  VERIFY_IS_APPROX( (matAstatic * matBstatic).coeff(0,0), +                    matAstatic.cwiseProduct(matBstatic.transpose()).sum() );++  MatrixXf matAdynamic(1,3);+  MatrixXf matBdynamic(3,1);+  matAdynamic.setRandom();+  matBdynamic.setRandom();+  VERIFY_IS_APPROX( (matAdynamic * matBdynamic).coeff(0,0), +                    matAdynamic.cwiseProduct(matBdynamic.transpose()).sum() );+}++template<typename TC, typename TA, typename TB>+const TC& ref_prod(TC &C, const TA &A, const TB &B)+{+  for(Index i=0;i<C.rows();++i)+    for(Index j=0;j<C.cols();++j)+      for(Index k=0;k<A.cols();++k)+        C.coeffRef(i,j) += A.coeff(i,k) * B.coeff(k,j);+  return C;+}++template<typename T, int Rows, int Cols, int Depth, int OC, int OA, int OB>+typename internal::enable_if<! ( (Rows ==1&&Depth!=1&&OA==ColMajor)+                              || (Depth==1&&Rows !=1&&OA==RowMajor)+                              || (Cols ==1&&Depth!=1&&OB==RowMajor)+                              || (Depth==1&&Cols !=1&&OB==ColMajor)+                              || (Rows ==1&&Cols !=1&&OC==ColMajor)+                              || (Cols ==1&&Rows !=1&&OC==RowMajor)),void>::type+test_lazy_single(int rows, int cols, int depth)+{+  Matrix<T,Rows,Depth,OA> A(rows,depth); A.setRandom();+  Matrix<T,Depth,Cols,OB> B(depth,cols); B.setRandom();+  Matrix<T,Rows,Cols,OC>  C(rows,cols);  C.setRandom();+  Matrix<T,Rows,Cols,OC>  D(C);+  VERIFY_IS_APPROX(C+=A.lazyProduct(B), ref_prod(D,A,B));+}++template<typename T, int Rows, int Cols, int Depth, int OC, int OA, int OB>+typename internal::enable_if<  ( (Rows ==1&&Depth!=1&&OA==ColMajor)+                              || (Depth==1&&Rows !=1&&OA==RowMajor)+                              || (Cols ==1&&Depth!=1&&OB==RowMajor)+                              || (Depth==1&&Cols !=1&&OB==ColMajor)+                              || (Rows ==1&&Cols !=1&&OC==ColMajor)+                              || (Cols ==1&&Rows !=1&&OC==RowMajor)),void>::type+test_lazy_single(int, int, int)+{+}++template<typename T, int Rows, int Cols, int Depth>+void test_lazy_all_layout(int rows=Rows, int cols=Cols, int depth=Depth)+{+  CALL_SUBTEST(( test_lazy_single<T,Rows,Cols,Depth,ColMajor,ColMajor,ColMajor>(rows,cols,depth) ));+  CALL_SUBTEST(( test_lazy_single<T,Rows,Cols,Depth,RowMajor,ColMajor,ColMajor>(rows,cols,depth) ));+  CALL_SUBTEST(( test_lazy_single<T,Rows,Cols,Depth,ColMajor,RowMajor,ColMajor>(rows,cols,depth) ));+  CALL_SUBTEST(( test_lazy_single<T,Rows,Cols,Depth,RowMajor,RowMajor,ColMajor>(rows,cols,depth) ));+  CALL_SUBTEST(( test_lazy_single<T,Rows,Cols,Depth,ColMajor,ColMajor,RowMajor>(rows,cols,depth) ));+  CALL_SUBTEST(( test_lazy_single<T,Rows,Cols,Depth,RowMajor,ColMajor,RowMajor>(rows,cols,depth) ));+  CALL_SUBTEST(( test_lazy_single<T,Rows,Cols,Depth,ColMajor,RowMajor,RowMajor>(rows,cols,depth) ));+  CALL_SUBTEST(( test_lazy_single<T,Rows,Cols,Depth,RowMajor,RowMajor,RowMajor>(rows,cols,depth) ));+}++template<typename T>+void test_lazy_l1()+{+  int rows = internal::random<int>(1,12);+  int cols = internal::random<int>(1,12);+  int depth = internal::random<int>(1,12);++  // Inner+  CALL_SUBTEST(( test_lazy_all_layout<T,1,1,1>() ));+  CALL_SUBTEST(( test_lazy_all_layout<T,1,1,2>() ));+  CALL_SUBTEST(( test_lazy_all_layout<T,1,1,3>() ));+  CALL_SUBTEST(( test_lazy_all_layout<T,1,1,8>() ));+  CALL_SUBTEST(( test_lazy_all_layout<T,1,1,9>() ));+  CALL_SUBTEST(( test_lazy_all_layout<T,1,1,-1>(1,1,depth) ));++  // Outer+  CALL_SUBTEST(( test_lazy_all_layout<T,2,1,1>() ));+  CALL_SUBTEST(( test_lazy_all_layout<T,1,2,1>() ));+  CALL_SUBTEST(( test_lazy_all_layout<T,2,2,1>() ));+  CALL_SUBTEST(( test_lazy_all_layout<T,3,3,1>() ));+  CALL_SUBTEST(( test_lazy_all_layout<T,4,4,1>() ));+  CALL_SUBTEST(( test_lazy_all_layout<T,4,8,1>() ));+  CALL_SUBTEST(( test_lazy_all_layout<T,4,-1,1>(4,cols) ));+  CALL_SUBTEST(( test_lazy_all_layout<T,7,-1,1>(7,cols) ));+  CALL_SUBTEST(( test_lazy_all_layout<T,-1,8,1>(rows) ));+  CALL_SUBTEST(( test_lazy_all_layout<T,-1,3,1>(rows) ));+  CALL_SUBTEST(( test_lazy_all_layout<T,-1,-1,1>(rows,cols) ));+}++template<typename T>+void test_lazy_l2()+{+  int rows = internal::random<int>(1,12);+  int cols = internal::random<int>(1,12);+  int depth = internal::random<int>(1,12);++  // mat-vec+  CALL_SUBTEST(( test_lazy_all_layout<T,2,1,2>() ));+  CALL_SUBTEST(( test_lazy_all_layout<T,2,1,4>() ));+  CALL_SUBTEST(( test_lazy_all_layout<T,4,1,2>() ));+  CALL_SUBTEST(( test_lazy_all_layout<T,4,1,4>() ));+  CALL_SUBTEST(( test_lazy_all_layout<T,5,1,4>() ));+  CALL_SUBTEST(( test_lazy_all_layout<T,4,1,5>() ));+  CALL_SUBTEST(( test_lazy_all_layout<T,4,1,6>() ));+  CALL_SUBTEST(( test_lazy_all_layout<T,6,1,4>() ));+  CALL_SUBTEST(( test_lazy_all_layout<T,8,1,8>() ));+  CALL_SUBTEST(( test_lazy_all_layout<T,-1,1,4>(rows) ));+  CALL_SUBTEST(( test_lazy_all_layout<T,4,1,-1>(4,1,depth) ));+  CALL_SUBTEST(( test_lazy_all_layout<T,-1,1,-1>(rows,1,depth) ));++  // vec-mat+  CALL_SUBTEST(( test_lazy_all_layout<T,1,2,2>() ));+  CALL_SUBTEST(( test_lazy_all_layout<T,1,2,4>() ));+  CALL_SUBTEST(( test_lazy_all_layout<T,1,4,2>() ));+  CALL_SUBTEST(( test_lazy_all_layout<T,1,4,4>() ));+  CALL_SUBTEST(( test_lazy_all_layout<T,1,5,4>() ));+  CALL_SUBTEST(( test_lazy_all_layout<T,1,4,5>() ));+  CALL_SUBTEST(( test_lazy_all_layout<T,1,4,6>() ));+  CALL_SUBTEST(( test_lazy_all_layout<T,1,6,4>() ));+  CALL_SUBTEST(( test_lazy_all_layout<T,1,8,8>() ));+  CALL_SUBTEST(( test_lazy_all_layout<T,1,-1, 4>(1,cols) ));+  CALL_SUBTEST(( test_lazy_all_layout<T,1, 4,-1>(1,4,depth) ));+  CALL_SUBTEST(( test_lazy_all_layout<T,1,-1,-1>(1,cols,depth) ));+}++template<typename T>+void test_lazy_l3()+{+  int rows = internal::random<int>(1,12);+  int cols = internal::random<int>(1,12);+  int depth = internal::random<int>(1,12);+  // mat-mat+  CALL_SUBTEST(( test_lazy_all_layout<T,2,4,2>() ));+  CALL_SUBTEST(( test_lazy_all_layout<T,2,6,4>() ));+  CALL_SUBTEST(( test_lazy_all_layout<T,4,3,2>() ));+  CALL_SUBTEST(( test_lazy_all_layout<T,4,8,4>() ));+  CALL_SUBTEST(( test_lazy_all_layout<T,5,6,4>() ));+  CALL_SUBTEST(( test_lazy_all_layout<T,4,2,5>() ));+  CALL_SUBTEST(( test_lazy_all_layout<T,4,7,6>() ));+  CALL_SUBTEST(( test_lazy_all_layout<T,6,8,4>() ));+  CALL_SUBTEST(( test_lazy_all_layout<T,8,3,8>() ));+  CALL_SUBTEST(( test_lazy_all_layout<T,-1,6,4>(rows) ));+  CALL_SUBTEST(( test_lazy_all_layout<T,4,3,-1>(4,3,depth) ));+  CALL_SUBTEST(( test_lazy_all_layout<T,-1,6,-1>(rows,6,depth) ));+  CALL_SUBTEST(( test_lazy_all_layout<T,8,2,2>() ));+  CALL_SUBTEST(( test_lazy_all_layout<T,5,2,4>() ));+  CALL_SUBTEST(( test_lazy_all_layout<T,4,4,2>() ));+  CALL_SUBTEST(( test_lazy_all_layout<T,8,4,4>() ));+  CALL_SUBTEST(( test_lazy_all_layout<T,6,5,4>() ));+  CALL_SUBTEST(( test_lazy_all_layout<T,4,4,5>() ));+  CALL_SUBTEST(( test_lazy_all_layout<T,3,4,6>() ));+  CALL_SUBTEST(( test_lazy_all_layout<T,2,6,4>() ));+  CALL_SUBTEST(( test_lazy_all_layout<T,7,8,8>() ));+  CALL_SUBTEST(( test_lazy_all_layout<T,8,-1, 4>(8,cols) ));+  CALL_SUBTEST(( test_lazy_all_layout<T,3, 4,-1>(3,4,depth) ));+  CALL_SUBTEST(( test_lazy_all_layout<T,4,-1,-1>(4,cols,depth) ));+}++template<typename T,int N,int M,int K>+void test_linear_but_not_vectorizable()+{+  // Check tricky cases for which the result of the product is a vector and thus must exhibit the LinearBit flag,+  // but is not vectorizable along the linear dimension.+  Index n = N==Dynamic ? internal::random<Index>(1,32) : N;+  Index m = M==Dynamic ? internal::random<Index>(1,32) : M;+  Index k = K==Dynamic ? internal::random<Index>(1,32) : K;++  {+    Matrix<T,N,M+1> A; A.setRandom(n,m+1);+    Matrix<T,M*2,K> B; B.setRandom(m*2,k);+    Matrix<T,1,K> C;+    Matrix<T,1,K> R;++    C.noalias() = A.template topLeftCorner<1,M>() * (B.template topRows<M>()+B.template bottomRows<M>());+    R.noalias() = A.template topLeftCorner<1,M>() * (B.template topRows<M>()+B.template bottomRows<M>()).eval();+    VERIFY_IS_APPROX(C,R);+  }++  {+    Matrix<T,M+1,N,RowMajor> A; A.setRandom(m+1,n);+    Matrix<T,K,M*2,RowMajor> B; B.setRandom(k,m*2);+    Matrix<T,K,1> C;+    Matrix<T,K,1> R;++    C.noalias() = (B.template leftCols<M>()+B.template rightCols<M>())        * A.template topLeftCorner<M,1>();+    R.noalias() = (B.template leftCols<M>()+B.template rightCols<M>()).eval() * A.template topLeftCorner<M,1>();+    VERIFY_IS_APPROX(C,R);+  }+}++template<int Rows>+void bug_1311()+{+  Matrix< double, Rows, 2 > A;  A.setRandom();+  Vector2d b = Vector2d::Random() ;+  Matrix<double,Rows,1> res;+  res.noalias() = 1. * (A * b);+  VERIFY_IS_APPROX(res, A*b);+  res.noalias() = 1.*A * b;+  VERIFY_IS_APPROX(res, A*b);+  res.noalias() = (1.*A).lazyProduct(b);+  VERIFY_IS_APPROX(res, A*b);+  res.noalias() = (1.*A).lazyProduct(1.*b);+  VERIFY_IS_APPROX(res, A*b);+  res.noalias() = (A).lazyProduct(1.*b);+  VERIFY_IS_APPROX(res, A*b);+}++void test_product_small()+{+  for(int i = 0; i < g_repeat; i++) {+    CALL_SUBTEST_1( product(Matrix<float, 3, 2>()) );+    CALL_SUBTEST_2( product(Matrix<int, 3, 17>()) );+    CALL_SUBTEST_8( product(Matrix<double, 3, 17>()) );+    CALL_SUBTEST_3( product(Matrix3d()) );+    CALL_SUBTEST_4( product(Matrix4d()) );+    CALL_SUBTEST_5( product(Matrix4f()) );+    CALL_SUBTEST_6( product1x1<0>() );++    CALL_SUBTEST_11( test_lazy_l1<float>() );+    CALL_SUBTEST_12( test_lazy_l2<float>() );+    CALL_SUBTEST_13( test_lazy_l3<float>() );++    CALL_SUBTEST_21( test_lazy_l1<double>() );+    CALL_SUBTEST_22( test_lazy_l2<double>() );+    CALL_SUBTEST_23( test_lazy_l3<double>() );++    CALL_SUBTEST_31( test_lazy_l1<std::complex<float> >() );+    CALL_SUBTEST_32( test_lazy_l2<std::complex<float> >() );+    CALL_SUBTEST_33( test_lazy_l3<std::complex<float> >() );++    CALL_SUBTEST_41( test_lazy_l1<std::complex<double> >() );+    CALL_SUBTEST_42( test_lazy_l2<std::complex<double> >() );+    CALL_SUBTEST_43( test_lazy_l3<std::complex<double> >() );++    CALL_SUBTEST_7(( test_linear_but_not_vectorizable<float,2,1,Dynamic>() ));+    CALL_SUBTEST_7(( test_linear_but_not_vectorizable<float,3,1,Dynamic>() ));+    CALL_SUBTEST_7(( test_linear_but_not_vectorizable<float,2,1,16>() ));++    CALL_SUBTEST_6( bug_1311<3>() );+    CALL_SUBTEST_6( bug_1311<5>() );+  }++#ifdef EIGEN_TEST_PART_6+  {+    // test compilation of (outer_product) * vector+    Vector3f v = Vector3f::Random();+    VERIFY_IS_APPROX( (v * v.transpose()) * v, (v * v.transpose()).eval() * v);+  }+  +  {+    // regression test for pull-request #93+    Eigen::Matrix<double, 1, 1> A;  A.setRandom();+    Eigen::Matrix<double, 18, 1> B; B.setRandom();+    Eigen::Matrix<double, 1, 18> C; C.setRandom();+    VERIFY_IS_APPROX(B * A.inverse(), B * A.inverse()[0]);+    VERIFY_IS_APPROX(A.inverse() * C, A.inverse()[0] * C);+  }++  {+    Eigen::Matrix<double, 10, 10> A, B, C;+    A.setRandom();+    C = A;+    for(int k=0; k<79; ++k)+      C = C * A;+    B.noalias() = (((A*A)*(A*A))*((A*A)*(A*A))*((A*A)*(A*A))*((A*A)*(A*A))*((A*A)*(A*A)) * ((A*A)*(A*A))*((A*A)*(A*A))*((A*A)*(A*A))*((A*A)*(A*A))*((A*A)*(A*A)))+                * (((A*A)*(A*A))*((A*A)*(A*A))*((A*A)*(A*A))*((A*A)*(A*A))*((A*A)*(A*A)) * ((A*A)*(A*A))*((A*A)*(A*A))*((A*A)*(A*A))*((A*A)*(A*A))*((A*A)*(A*A)));+    VERIFY_IS_APPROX(B,C);+  }+#endif+}
+ eigen3/test/product_symm.cpp view
@@ -0,0 +1,111 @@+// This file is part of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2008-2009 Gael Guennebaud <gael.guennebaud@inria.fr>+//+// 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<typename Scalar, int Size, int OtherSize> void symm(int size = Size, int othersize = OtherSize)+{+  typedef Matrix<Scalar, Size, Size> MatrixType;+  typedef Matrix<Scalar, Size, OtherSize> Rhs1;+  typedef Matrix<Scalar, OtherSize, Size> Rhs2;+  enum { order = OtherSize==1 ? 0 : RowMajor };+  typedef Matrix<Scalar, Size, OtherSize,order> Rhs3;++  Index rows = size;+  Index cols = size;++  MatrixType m1 = MatrixType::Random(rows, cols),+             m2 = MatrixType::Random(rows, cols), m3;++  m1 = (m1+m1.adjoint()).eval();++  Rhs1 rhs1 = Rhs1::Random(cols, othersize), rhs12(cols, othersize), rhs13(cols, othersize);+  Rhs2 rhs2 = Rhs2::Random(othersize, rows), rhs22(othersize, rows), rhs23(othersize, rows);+  Rhs3 rhs3 = Rhs3::Random(cols, othersize), rhs32(cols, othersize), rhs33(cols, othersize);++  Scalar s1 = internal::random<Scalar>(),+         s2 = internal::random<Scalar>();++  m2 = m1.template triangularView<Lower>();+  m3 = m2.template selfadjointView<Lower>();+  VERIFY_IS_EQUAL(m1, m3);+  VERIFY_IS_APPROX(rhs12 = (s1*m2).template selfadjointView<Lower>() * (s2*rhs1),+                   rhs13 = (s1*m1) * (s2*rhs1));++  VERIFY_IS_APPROX(rhs12 = (s1*m2).transpose().template selfadjointView<Upper>() * (s2*rhs1),+                   rhs13 = (s1*m1.transpose()) * (s2*rhs1));++  VERIFY_IS_APPROX(rhs12 = (s1*m2).template selfadjointView<Lower>().transpose() * (s2*rhs1),+                   rhs13 = (s1*m1.transpose()) * (s2*rhs1));++  VERIFY_IS_APPROX(rhs12 = (s1*m2).conjugate().template selfadjointView<Lower>() * (s2*rhs1),+                   rhs13 = (s1*m1).conjugate() * (s2*rhs1));++  VERIFY_IS_APPROX(rhs12 = (s1*m2).template selfadjointView<Lower>().conjugate() * (s2*rhs1),+                   rhs13 = (s1*m1).conjugate() * (s2*rhs1));++  VERIFY_IS_APPROX(rhs12 = (s1*m2).adjoint().template selfadjointView<Upper>() * (s2*rhs1),+                   rhs13 = (s1*m1).adjoint() * (s2*rhs1));++  VERIFY_IS_APPROX(rhs12 = (s1*m2).template selfadjointView<Lower>().adjoint() * (s2*rhs1),+                   rhs13 = (s1*m1).adjoint() * (s2*rhs1));++  m2 = m1.template triangularView<Upper>(); rhs12.setRandom(); rhs13 = rhs12;+  m3 = m2.template selfadjointView<Upper>();+  VERIFY_IS_EQUAL(m1, m3);+  VERIFY_IS_APPROX(rhs12 += (s1*m2).template selfadjointView<Upper>() * (s2*rhs1),+                   rhs13 += (s1*m1) * (s2*rhs1));++  m2 = m1.template triangularView<Lower>();+  VERIFY_IS_APPROX(rhs12 = (s1*m2).template selfadjointView<Lower>() * (s2*rhs2.adjoint()),+                   rhs13 = (s1*m1) * (s2*rhs2.adjoint()));++  m2 = m1.template triangularView<Upper>();+  VERIFY_IS_APPROX(rhs12 = (s1*m2).template selfadjointView<Upper>() * (s2*rhs2.adjoint()),+                   rhs13 = (s1*m1) * (s2*rhs2.adjoint()));++  m2 = m1.template triangularView<Upper>();+  VERIFY_IS_APPROX(rhs12 = (s1*m2.adjoint()).template selfadjointView<Lower>() * (s2*rhs2.adjoint()),+                   rhs13 = (s1*m1.adjoint()) * (s2*rhs2.adjoint()));++  // test row major = <...>+  m2 = m1.template triangularView<Lower>(); rhs12.setRandom(); rhs13 = rhs12;+  VERIFY_IS_APPROX(rhs12 -= (s1*m2).template selfadjointView<Lower>() * (s2*rhs3),+                   rhs13 -= (s1*m1) * (s2 * rhs3));++  m2 = m1.template triangularView<Upper>();+  VERIFY_IS_APPROX(rhs12 = (s1*m2.adjoint()).template selfadjointView<Lower>() * (s2*rhs3).conjugate(),+                   rhs13 = (s1*m1.adjoint()) * (s2*rhs3).conjugate());+++  m2 = m1.template triangularView<Upper>(); rhs13 = rhs12;+  VERIFY_IS_APPROX(rhs12.noalias() += s1 * ((m2.adjoint()).template selfadjointView<Lower>() * (s2*rhs3).conjugate()),+                   rhs13 += (s1*m1.adjoint()) * (s2*rhs3).conjugate());++  m2 = m1.template triangularView<Lower>();+  VERIFY_IS_APPROX(rhs22 = (rhs2) * (m2).template selfadjointView<Lower>(), rhs23 = (rhs2) * (m1));+  VERIFY_IS_APPROX(rhs22 = (s2*rhs2) * (s1*m2).template selfadjointView<Lower>(), rhs23 = (s2*rhs2) * (s1*m1));++}++void test_product_symm()+{+  for(int i = 0; i < g_repeat ; i++)+  {+    CALL_SUBTEST_1(( symm<float,Dynamic,Dynamic>(internal::random<int>(1,EIGEN_TEST_MAX_SIZE),internal::random<int>(1,EIGEN_TEST_MAX_SIZE)) ));+    CALL_SUBTEST_2(( symm<double,Dynamic,Dynamic>(internal::random<int>(1,EIGEN_TEST_MAX_SIZE),internal::random<int>(1,EIGEN_TEST_MAX_SIZE)) ));+    CALL_SUBTEST_3(( symm<std::complex<float>,Dynamic,Dynamic>(internal::random<int>(1,EIGEN_TEST_MAX_SIZE/2),internal::random<int>(1,EIGEN_TEST_MAX_SIZE/2)) ));+    CALL_SUBTEST_4(( symm<std::complex<double>,Dynamic,Dynamic>(internal::random<int>(1,EIGEN_TEST_MAX_SIZE/2),internal::random<int>(1,EIGEN_TEST_MAX_SIZE/2)) ));++    CALL_SUBTEST_5(( symm<float,Dynamic,1>(internal::random<int>(1,EIGEN_TEST_MAX_SIZE)) ));+    CALL_SUBTEST_6(( symm<double,Dynamic,1>(internal::random<int>(1,EIGEN_TEST_MAX_SIZE)) ));+    CALL_SUBTEST_7(( symm<std::complex<float>,Dynamic,1>(internal::random<int>(1,EIGEN_TEST_MAX_SIZE)) ));+    CALL_SUBTEST_8(( symm<std::complex<double>,Dynamic,1>(internal::random<int>(1,EIGEN_TEST_MAX_SIZE)) ));+  }+}
+ eigen3/test/product_syrk.cpp view
@@ -0,0 +1,135 @@+// This file is part of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2008-2009 Gael Guennebaud <gael.guennebaud@inria.fr>+//+// 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<typename MatrixType> void syrk(const MatrixType& m)+{+  typedef typename MatrixType::Scalar Scalar;+  typedef Matrix<Scalar, MatrixType::RowsAtCompileTime, MatrixType::ColsAtCompileTime, RowMajor> RMatrixType;+  typedef Matrix<Scalar, MatrixType::ColsAtCompileTime, Dynamic> Rhs1;+  typedef Matrix<Scalar, Dynamic, MatrixType::RowsAtCompileTime> Rhs2;+  typedef Matrix<Scalar, MatrixType::ColsAtCompileTime, Dynamic,RowMajor> Rhs3;++  Index rows = m.rows();+  Index cols = m.cols();++  MatrixType m1 = MatrixType::Random(rows, cols),+             m2 = MatrixType::Random(rows, cols),+             m3 = MatrixType::Random(rows, cols);+  RMatrixType rm2 = MatrixType::Random(rows, cols);++  Rhs1 rhs1 = Rhs1::Random(internal::random<int>(1,320), cols); Rhs1 rhs11 = Rhs1::Random(rhs1.rows(), cols);+  Rhs2 rhs2 = Rhs2::Random(rows, internal::random<int>(1,320)); Rhs2 rhs22 = Rhs2::Random(rows, rhs2.cols());+  Rhs3 rhs3 = Rhs3::Random(internal::random<int>(1,320), rows);++  Scalar s1 = internal::random<Scalar>();+  +  Index c = internal::random<Index>(0,cols-1);++  m2.setZero();+  VERIFY_IS_APPROX((m2.template selfadjointView<Lower>().rankUpdate(rhs2,s1)._expression()),+                   ((s1 * rhs2 * rhs2.adjoint()).eval().template triangularView<Lower>().toDenseMatrix()));+  m2.setZero();+  VERIFY_IS_APPROX(((m2.template triangularView<Lower>() += s1 * rhs2  * rhs22.adjoint()).nestedExpression()),+                   ((s1 * rhs2 * rhs22.adjoint()).eval().template triangularView<Lower>().toDenseMatrix()));++  +  m2.setZero();+  VERIFY_IS_APPROX(m2.template selfadjointView<Upper>().rankUpdate(rhs2,s1)._expression(),+                   (s1 * rhs2 * rhs2.adjoint()).eval().template triangularView<Upper>().toDenseMatrix());+  m2.setZero();+  VERIFY_IS_APPROX((m2.template triangularView<Upper>() += s1 * rhs22 * rhs2.adjoint()).nestedExpression(),+                   (s1 * rhs22 * rhs2.adjoint()).eval().template triangularView<Upper>().toDenseMatrix());++  +  m2.setZero();+  VERIFY_IS_APPROX(m2.template selfadjointView<Lower>().rankUpdate(rhs1.adjoint(),s1)._expression(),+                   (s1 * rhs1.adjoint() * rhs1).eval().template triangularView<Lower>().toDenseMatrix());+  m2.setZero();+  VERIFY_IS_APPROX((m2.template triangularView<Lower>() += s1 * rhs11.adjoint() * rhs1).nestedExpression(),+                   (s1 * rhs11.adjoint() * rhs1).eval().template triangularView<Lower>().toDenseMatrix());+  +  +  m2.setZero();+  VERIFY_IS_APPROX(m2.template selfadjointView<Upper>().rankUpdate(rhs1.adjoint(),s1)._expression(),+                   (s1 * rhs1.adjoint() * rhs1).eval().template triangularView<Upper>().toDenseMatrix());+  VERIFY_IS_APPROX((m2.template triangularView<Upper>() = s1 * rhs1.adjoint() * rhs11).nestedExpression(),+                   (s1 * rhs1.adjoint() * rhs11).eval().template triangularView<Upper>().toDenseMatrix());++  +  m2.setZero();+  VERIFY_IS_APPROX(m2.template selfadjointView<Lower>().rankUpdate(rhs3.adjoint(),s1)._expression(),+                   (s1 * rhs3.adjoint() * rhs3).eval().template triangularView<Lower>().toDenseMatrix());++  m2.setZero();+  VERIFY_IS_APPROX(m2.template selfadjointView<Upper>().rankUpdate(rhs3.adjoint(),s1)._expression(),+                   (s1 * rhs3.adjoint() * rhs3).eval().template triangularView<Upper>().toDenseMatrix());+                   +  m2.setZero();+  VERIFY_IS_APPROX((m2.template selfadjointView<Lower>().rankUpdate(m1.col(c),s1)._expression()),+                   ((s1 * m1.col(c) * m1.col(c).adjoint()).eval().template triangularView<Lower>().toDenseMatrix()));+                   +  m2.setZero();+  VERIFY_IS_APPROX((m2.template selfadjointView<Upper>().rankUpdate(m1.col(c),s1)._expression()),+                   ((s1 * m1.col(c) * m1.col(c).adjoint()).eval().template triangularView<Upper>().toDenseMatrix()));+  rm2.setZero();+  VERIFY_IS_APPROX((rm2.template selfadjointView<Upper>().rankUpdate(m1.col(c),s1)._expression()),+                   ((s1 * m1.col(c) * m1.col(c).adjoint()).eval().template triangularView<Upper>().toDenseMatrix()));+  m2.setZero();+  VERIFY_IS_APPROX((m2.template triangularView<Upper>() += s1 * m3.col(c) * m1.col(c).adjoint()).nestedExpression(),+                   ((s1 * m3.col(c) * m1.col(c).adjoint()).eval().template triangularView<Upper>().toDenseMatrix()));+  rm2.setZero();+  VERIFY_IS_APPROX((rm2.template triangularView<Upper>() += s1 * m1.col(c) * m3.col(c).adjoint()).nestedExpression(),+                   ((s1 * m1.col(c) * m3.col(c).adjoint()).eval().template triangularView<Upper>().toDenseMatrix()));+  +  m2.setZero();+  VERIFY_IS_APPROX((m2.template selfadjointView<Lower>().rankUpdate(m1.col(c).conjugate(),s1)._expression()),+                   ((s1 * m1.col(c).conjugate() * m1.col(c).conjugate().adjoint()).eval().template triangularView<Lower>().toDenseMatrix()));+                   +  m2.setZero();+  VERIFY_IS_APPROX((m2.template selfadjointView<Upper>().rankUpdate(m1.col(c).conjugate(),s1)._expression()),+                   ((s1 * m1.col(c).conjugate() * m1.col(c).conjugate().adjoint()).eval().template triangularView<Upper>().toDenseMatrix()));+  +  +  m2.setZero();+  VERIFY_IS_APPROX((m2.template selfadjointView<Lower>().rankUpdate(m1.row(c),s1)._expression()),+                   ((s1 * m1.row(c).transpose() * m1.row(c).transpose().adjoint()).eval().template triangularView<Lower>().toDenseMatrix()));+  rm2.setZero();+  VERIFY_IS_APPROX((rm2.template selfadjointView<Lower>().rankUpdate(m1.row(c),s1)._expression()),+                   ((s1 * m1.row(c).transpose() * m1.row(c).transpose().adjoint()).eval().template triangularView<Lower>().toDenseMatrix()));+  m2.setZero();+  VERIFY_IS_APPROX((m2.template triangularView<Lower>() += s1 * m3.row(c).transpose() * m1.row(c).transpose().adjoint()).nestedExpression(),+                   ((s1 * m3.row(c).transpose() * m1.row(c).transpose().adjoint()).eval().template triangularView<Lower>().toDenseMatrix()));+  rm2.setZero();+  VERIFY_IS_APPROX((rm2.template triangularView<Lower>() += s1 * m3.row(c).transpose() * m1.row(c).transpose().adjoint()).nestedExpression(),+                   ((s1 * m3.row(c).transpose() * m1.row(c).transpose().adjoint()).eval().template triangularView<Lower>().toDenseMatrix()));+  +  +  m2.setZero();+  VERIFY_IS_APPROX((m2.template selfadjointView<Upper>().rankUpdate(m1.row(c).adjoint(),s1)._expression()),+                   ((s1 * m1.row(c).adjoint() * m1.row(c).adjoint().adjoint()).eval().template triangularView<Upper>().toDenseMatrix()));+}++void test_product_syrk()+{+  for(int i = 0; i < g_repeat ; i++)+  {+    int s;+    s = internal::random<int>(1,EIGEN_TEST_MAX_SIZE);+    CALL_SUBTEST_1( syrk(MatrixXf(s, s)) );+    CALL_SUBTEST_2( syrk(MatrixXd(s, s)) );+    TEST_SET_BUT_UNUSED_VARIABLE(s)+    +    s = internal::random<int>(1,EIGEN_TEST_MAX_SIZE/2);+    CALL_SUBTEST_3( syrk(MatrixXcf(s, s)) );+    CALL_SUBTEST_4( syrk(MatrixXcd(s, s)) );+    TEST_SET_BUT_UNUSED_VARIABLE(s)+  }+}
+ eigen3/test/product_trmm.cpp view
@@ -0,0 +1,127 @@+// This file is part of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2008-2009 Gael Guennebaud <gael.guennebaud@inria.fr>+//+// 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<typename T>+int get_random_size()+{+  const int factor = NumTraits<T>::ReadCost;+  const int max_test_size = EIGEN_TEST_MAX_SIZE>2*factor ? EIGEN_TEST_MAX_SIZE/factor : EIGEN_TEST_MAX_SIZE;+  return internal::random<int>(1,max_test_size);+}++template<typename Scalar, int Mode, int TriOrder, int OtherOrder, int ResOrder, int OtherCols>+void trmm(int rows=get_random_size<Scalar>(),+          int cols=get_random_size<Scalar>(),+          int otherCols = OtherCols==Dynamic?get_random_size<Scalar>():OtherCols)+{+  typedef Matrix<Scalar,Dynamic,Dynamic,TriOrder> TriMatrix;+  typedef Matrix<Scalar,Dynamic,OtherCols,OtherCols==1?ColMajor:OtherOrder> OnTheRight;+  typedef Matrix<Scalar,OtherCols,Dynamic,OtherCols==1?RowMajor:OtherOrder> OnTheLeft;+  +  typedef Matrix<Scalar,Dynamic,OtherCols,OtherCols==1?ColMajor:ResOrder> ResXS;+  typedef Matrix<Scalar,OtherCols,Dynamic,OtherCols==1?RowMajor:ResOrder> ResSX;++  TriMatrix  mat(rows,cols), tri(rows,cols), triTr(cols,rows), s1tri(rows,cols), s1triTr(cols,rows);+  +  OnTheRight  ge_right(cols,otherCols);+  OnTheLeft   ge_left(otherCols,rows);+  ResSX       ge_sx, ge_sx_save;+  ResXS       ge_xs, ge_xs_save;++  Scalar s1 = internal::random<Scalar>(),+         s2 = internal::random<Scalar>();++  mat.setRandom();+  tri = mat.template triangularView<Mode>();+  triTr = mat.transpose().template triangularView<Mode>();+  s1tri = (s1*mat).template triangularView<Mode>();+  s1triTr = (s1*mat).transpose().template triangularView<Mode>();+  ge_right.setRandom();+  ge_left.setRandom();++  VERIFY_IS_APPROX( ge_xs = mat.template triangularView<Mode>() * ge_right, tri * ge_right);+  VERIFY_IS_APPROX( ge_sx = ge_left * mat.template triangularView<Mode>(), ge_left * tri);+  +  VERIFY_IS_APPROX( ge_xs.noalias() = mat.template triangularView<Mode>() * ge_right, tri * ge_right);+  VERIFY_IS_APPROX( ge_sx.noalias() = ge_left * mat.template triangularView<Mode>(), ge_left * tri);++  if((Mode&UnitDiag)==0)+    VERIFY_IS_APPROX( ge_xs.noalias() = (s1*mat.adjoint()).template triangularView<Mode>() * (s2*ge_left.transpose()), s1*triTr.conjugate() * (s2*ge_left.transpose()));+  +  VERIFY_IS_APPROX( ge_xs.noalias() = (s1*mat.transpose()).template triangularView<Mode>() * (s2*ge_left.transpose()), s1triTr * (s2*ge_left.transpose()));+  VERIFY_IS_APPROX( ge_sx.noalias() = (s2*ge_left) * (s1*mat).template triangularView<Mode>(), (s2*ge_left)*s1tri);++  VERIFY_IS_APPROX( ge_sx.noalias() = ge_right.transpose() * mat.adjoint().template triangularView<Mode>(), ge_right.transpose() * triTr.conjugate());+  VERIFY_IS_APPROX( ge_sx.noalias() = ge_right.adjoint() * mat.adjoint().template triangularView<Mode>(), ge_right.adjoint() * triTr.conjugate());+  +  ge_xs_save = ge_xs;+  if((Mode&UnitDiag)==0)+    VERIFY_IS_APPROX( (ge_xs_save + s1*triTr.conjugate() * (s2*ge_left.adjoint())).eval(), ge_xs.noalias() += (s1*mat.adjoint()).template triangularView<Mode>() * (s2*ge_left.adjoint()) );+  ge_xs_save = ge_xs;+  VERIFY_IS_APPROX( (ge_xs_save + s1triTr * (s2*ge_left.adjoint())).eval(), ge_xs.noalias() += (s1*mat.transpose()).template triangularView<Mode>() * (s2*ge_left.adjoint()) );+  ge_sx.setRandom();+  ge_sx_save = ge_sx;+  if((Mode&UnitDiag)==0)+    VERIFY_IS_APPROX( ge_sx_save - (ge_right.adjoint() * (-s1 * triTr).conjugate()).eval(), ge_sx.noalias() -= (ge_right.adjoint() * (-s1 * mat).adjoint().template triangularView<Mode>()).eval());+  +  if((Mode&UnitDiag)==0)+    VERIFY_IS_APPROX( ge_xs = (s1*mat).adjoint().template triangularView<Mode>() * ge_left.adjoint(), numext::conj(s1) * triTr.conjugate() * ge_left.adjoint());+  VERIFY_IS_APPROX( ge_xs = (s1*mat).transpose().template triangularView<Mode>() * ge_left.adjoint(), s1triTr * ge_left.adjoint());++  +  // TODO check with sub-matrix expressions ?+}++template<typename Scalar, int Mode, int TriOrder>+void trmv(int rows=get_random_size<Scalar>(), int cols=get_random_size<Scalar>())+{+  trmm<Scalar,Mode,TriOrder,ColMajor,ColMajor,1>(rows,cols,1);+}++template<typename Scalar, int Mode, int TriOrder, int OtherOrder, int ResOrder>+void trmm(int rows=get_random_size<Scalar>(), int cols=get_random_size<Scalar>(), int otherCols = get_random_size<Scalar>())+{+  trmm<Scalar,Mode,TriOrder,OtherOrder,ResOrder,Dynamic>(rows,cols,otherCols);+}++#define CALL_ALL_ORDERS(NB,SCALAR,MODE)                                             \+  EIGEN_CAT(CALL_SUBTEST_,NB)((trmm<SCALAR, MODE, ColMajor,ColMajor,ColMajor>()));  \+  EIGEN_CAT(CALL_SUBTEST_,NB)((trmm<SCALAR, MODE, ColMajor,ColMajor,RowMajor>()));  \+  EIGEN_CAT(CALL_SUBTEST_,NB)((trmm<SCALAR, MODE, ColMajor,RowMajor,ColMajor>()));  \+  EIGEN_CAT(CALL_SUBTEST_,NB)((trmm<SCALAR, MODE, ColMajor,RowMajor,RowMajor>()));  \+  EIGEN_CAT(CALL_SUBTEST_,NB)((trmm<SCALAR, MODE, RowMajor,ColMajor,ColMajor>()));  \+  EIGEN_CAT(CALL_SUBTEST_,NB)((trmm<SCALAR, MODE, RowMajor,ColMajor,RowMajor>()));  \+  EIGEN_CAT(CALL_SUBTEST_,NB)((trmm<SCALAR, MODE, RowMajor,RowMajor,ColMajor>()));  \+  EIGEN_CAT(CALL_SUBTEST_,NB)((trmm<SCALAR, MODE, RowMajor,RowMajor,RowMajor>()));  \+  \+  EIGEN_CAT(CALL_SUBTEST_1,NB)((trmv<SCALAR, MODE, ColMajor>()));                   \+  EIGEN_CAT(CALL_SUBTEST_1,NB)((trmv<SCALAR, MODE, RowMajor>()));++  +#define CALL_ALL(NB,SCALAR)                 \+  CALL_ALL_ORDERS(EIGEN_CAT(1,NB),SCALAR,Upper)          \+  CALL_ALL_ORDERS(EIGEN_CAT(2,NB),SCALAR,UnitUpper)      \+  CALL_ALL_ORDERS(EIGEN_CAT(3,NB),SCALAR,StrictlyUpper)  \+  CALL_ALL_ORDERS(EIGEN_CAT(1,NB),SCALAR,Lower)          \+  CALL_ALL_ORDERS(EIGEN_CAT(2,NB),SCALAR,UnitLower)      \+  CALL_ALL_ORDERS(EIGEN_CAT(3,NB),SCALAR,StrictlyLower)+  ++void test_product_trmm()+{+  for(int i = 0; i < g_repeat ; i++)+  {+    CALL_ALL(1,float);                //  EIGEN_SUFFIXES;11;111;21;121;31;131+    CALL_ALL(2,double);               //  EIGEN_SUFFIXES;12;112;22;122;32;132+    CALL_ALL(3,std::complex<float>);  //  EIGEN_SUFFIXES;13;113;23;123;33;133+    CALL_ALL(4,std::complex<double>); //  EIGEN_SUFFIXES;14;114;24;124;34;134+  }+}
+ eigen3/test/product_trmv.cpp view
@@ -0,0 +1,90 @@+// This file is triangularView of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2008-2009 Gael Guennebaud <gael.guennebaud@inria.fr>+//+// 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<typename MatrixType> void trmv(const MatrixType& m)+{+  typedef typename MatrixType::Scalar Scalar;+  typedef typename NumTraits<Scalar>::Real RealScalar;+  typedef Matrix<Scalar, MatrixType::RowsAtCompileTime, 1> VectorType;++  RealScalar largerEps = 10*test_precision<RealScalar>();++  Index rows = m.rows();+  Index cols = m.cols();++  MatrixType m1 = MatrixType::Random(rows, cols),+             m3(rows, cols);+  VectorType v1 = VectorType::Random(rows);++  Scalar s1 = internal::random<Scalar>();++  m1 = MatrixType::Random(rows, cols);++  // check with a column-major matrix+  m3 = m1.template triangularView<Eigen::Lower>();+  VERIFY((m3 * v1).isApprox(m1.template triangularView<Eigen::Lower>() * v1, largerEps));+  m3 = m1.template triangularView<Eigen::Upper>();+  VERIFY((m3 * v1).isApprox(m1.template triangularView<Eigen::Upper>() * v1, largerEps));+  m3 = m1.template triangularView<Eigen::UnitLower>();+  VERIFY((m3 * v1).isApprox(m1.template triangularView<Eigen::UnitLower>() * v1, largerEps));+  m3 = m1.template triangularView<Eigen::UnitUpper>();+  VERIFY((m3 * v1).isApprox(m1.template triangularView<Eigen::UnitUpper>() * v1, largerEps));++  // check conjugated and scalar multiple expressions (col-major)+  m3 = m1.template triangularView<Eigen::Lower>();+  VERIFY(((s1*m3).conjugate() * v1).isApprox((s1*m1).conjugate().template triangularView<Eigen::Lower>() * v1, largerEps));+  m3 = m1.template triangularView<Eigen::Upper>();+  VERIFY((m3.conjugate() * v1.conjugate()).isApprox(m1.conjugate().template triangularView<Eigen::Upper>() * v1.conjugate(), largerEps));++  // check with a row-major matrix+  m3 = m1.template triangularView<Eigen::Upper>();+  VERIFY((m3.transpose() * v1).isApprox(m1.transpose().template triangularView<Eigen::Lower>() * v1, largerEps));+  m3 = m1.template triangularView<Eigen::Lower>();+  VERIFY((m3.transpose() * v1).isApprox(m1.transpose().template triangularView<Eigen::Upper>() * v1, largerEps));+  m3 = m1.template triangularView<Eigen::UnitUpper>();+  VERIFY((m3.transpose() * v1).isApprox(m1.transpose().template triangularView<Eigen::UnitLower>() * v1, largerEps));+  m3 = m1.template triangularView<Eigen::UnitLower>();+  VERIFY((m3.transpose() * v1).isApprox(m1.transpose().template triangularView<Eigen::UnitUpper>() * v1, largerEps));++  // check conjugated and scalar multiple expressions (row-major)+  m3 = m1.template triangularView<Eigen::Upper>();+  VERIFY((m3.adjoint() * v1).isApprox(m1.adjoint().template triangularView<Eigen::Lower>() * v1, largerEps));+  m3 = m1.template triangularView<Eigen::Lower>();+  VERIFY((m3.adjoint() * (s1*v1.conjugate())).isApprox(m1.adjoint().template triangularView<Eigen::Upper>() * (s1*v1.conjugate()), largerEps));+  m3 = m1.template triangularView<Eigen::UnitUpper>();++  // check transposed cases:+  m3 = m1.template triangularView<Eigen::Lower>();+  VERIFY((v1.transpose() * m3).isApprox(v1.transpose() * m1.template triangularView<Eigen::Lower>(), largerEps));+  VERIFY((v1.adjoint() * m3).isApprox(v1.adjoint() * m1.template triangularView<Eigen::Lower>(), largerEps));+  VERIFY((v1.adjoint() * m3.adjoint()).isApprox(v1.adjoint() * m1.template triangularView<Eigen::Lower>().adjoint(), largerEps));++  // TODO check with sub-matrices+}++void test_product_trmv()+{+  int s = 0;+  for(int i = 0; i < g_repeat ; i++) {+    CALL_SUBTEST_1( trmv(Matrix<float, 1, 1>()) );+    CALL_SUBTEST_2( trmv(Matrix<float, 2, 2>()) );+    CALL_SUBTEST_3( trmv(Matrix3d()) );+    +    s = internal::random<int>(1,EIGEN_TEST_MAX_SIZE/2);+    CALL_SUBTEST_4( trmv(MatrixXcf(s,s)) );+    CALL_SUBTEST_5( trmv(MatrixXcd(s,s)) );+    TEST_SET_BUT_UNUSED_VARIABLE(s)+    +    s = internal::random<int>(1,EIGEN_TEST_MAX_SIZE);+    CALL_SUBTEST_6( trmv(Matrix<float,Dynamic,Dynamic,RowMajor>(s, s)) );+    TEST_SET_BUT_UNUSED_VARIABLE(s)+  }+}
+ eigen3/test/product_trsolve.cpp view
@@ -0,0 +1,101 @@+// This file is part of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2008-2009 Gael Guennebaud <gael.guennebaud@inria.fr>+//+// 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 VERIFY_TRSM(TRI,XB) { \+    (XB).setRandom(); ref = (XB); \+    (TRI).solveInPlace(XB); \+    VERIFY_IS_APPROX((TRI).toDenseMatrix() * (XB), ref); \+    (XB).setRandom(); ref = (XB); \+    (XB) = (TRI).solve(XB); \+    VERIFY_IS_APPROX((TRI).toDenseMatrix() * (XB), ref); \+  }++#define VERIFY_TRSM_ONTHERIGHT(TRI,XB) { \+    (XB).setRandom(); ref = (XB); \+    (TRI).transpose().template solveInPlace<OnTheRight>(XB.transpose()); \+    VERIFY_IS_APPROX((XB).transpose() * (TRI).transpose().toDenseMatrix(), ref.transpose()); \+    (XB).setRandom(); ref = (XB); \+    (XB).transpose() = (TRI).transpose().template solve<OnTheRight>(XB.transpose()); \+    VERIFY_IS_APPROX((XB).transpose() * (TRI).transpose().toDenseMatrix(), ref.transpose()); \+  }++template<typename Scalar,int Size, int Cols> void trsolve(int size=Size,int cols=Cols)+{+  typedef typename NumTraits<Scalar>::Real RealScalar;++  Matrix<Scalar,Size,Size,ColMajor> cmLhs(size,size);+  Matrix<Scalar,Size,Size,RowMajor> rmLhs(size,size);++  enum {  colmajor = Size==1 ? RowMajor : ColMajor,+          rowmajor = Cols==1 ? ColMajor : RowMajor };+  Matrix<Scalar,Size,Cols,colmajor> cmRhs(size,cols);+  Matrix<Scalar,Size,Cols,rowmajor> rmRhs(size,cols);+  Matrix<Scalar,Dynamic,Dynamic,colmajor> ref(size,cols);++  cmLhs.setRandom(); cmLhs *= static_cast<RealScalar>(0.1); cmLhs.diagonal().array() += static_cast<RealScalar>(1);+  rmLhs.setRandom(); rmLhs *= static_cast<RealScalar>(0.1); rmLhs.diagonal().array() += static_cast<RealScalar>(1);++  VERIFY_TRSM(cmLhs.conjugate().template triangularView<Lower>(), cmRhs);+  VERIFY_TRSM(cmLhs.adjoint()  .template triangularView<Lower>(), cmRhs);+  VERIFY_TRSM(cmLhs            .template triangularView<Upper>(), cmRhs);+  VERIFY_TRSM(cmLhs            .template triangularView<Lower>(), rmRhs);+  VERIFY_TRSM(cmLhs.conjugate().template triangularView<Upper>(), rmRhs);+  VERIFY_TRSM(cmLhs.adjoint()  .template triangularView<Upper>(), rmRhs);++  VERIFY_TRSM(cmLhs.conjugate().template triangularView<UnitLower>(), cmRhs);+  VERIFY_TRSM(cmLhs            .template triangularView<UnitUpper>(), rmRhs);++  VERIFY_TRSM(rmLhs            .template triangularView<Lower>(), cmRhs);+  VERIFY_TRSM(rmLhs.conjugate().template triangularView<UnitUpper>(), rmRhs);+++  VERIFY_TRSM_ONTHERIGHT(cmLhs.conjugate().template triangularView<Lower>(), cmRhs);+  VERIFY_TRSM_ONTHERIGHT(cmLhs            .template triangularView<Upper>(), cmRhs);+  VERIFY_TRSM_ONTHERIGHT(cmLhs            .template triangularView<Lower>(), rmRhs);+  VERIFY_TRSM_ONTHERIGHT(cmLhs.conjugate().template triangularView<Upper>(), rmRhs);++  VERIFY_TRSM_ONTHERIGHT(cmLhs.conjugate().template triangularView<UnitLower>(), cmRhs);+  VERIFY_TRSM_ONTHERIGHT(cmLhs            .template triangularView<UnitUpper>(), rmRhs);++  VERIFY_TRSM_ONTHERIGHT(rmLhs            .template triangularView<Lower>(), cmRhs);+  VERIFY_TRSM_ONTHERIGHT(rmLhs.conjugate().template triangularView<UnitUpper>(), rmRhs);++  int c = internal::random<int>(0,cols-1);+  VERIFY_TRSM(rmLhs.template triangularView<Lower>(), rmRhs.col(c));+  VERIFY_TRSM(cmLhs.template triangularView<Lower>(), rmRhs.col(c));+}++void test_product_trsolve()+{+  for(int i = 0; i < g_repeat ; i++)+  {+    // matrices+    CALL_SUBTEST_1((trsolve<float,Dynamic,Dynamic>(internal::random<int>(1,EIGEN_TEST_MAX_SIZE),internal::random<int>(1,EIGEN_TEST_MAX_SIZE))));+    CALL_SUBTEST_2((trsolve<double,Dynamic,Dynamic>(internal::random<int>(1,EIGEN_TEST_MAX_SIZE),internal::random<int>(1,EIGEN_TEST_MAX_SIZE))));+    CALL_SUBTEST_3((trsolve<std::complex<float>,Dynamic,Dynamic>(internal::random<int>(1,EIGEN_TEST_MAX_SIZE/2),internal::random<int>(1,EIGEN_TEST_MAX_SIZE/2))));+    CALL_SUBTEST_4((trsolve<std::complex<double>,Dynamic,Dynamic>(internal::random<int>(1,EIGEN_TEST_MAX_SIZE/2),internal::random<int>(1,EIGEN_TEST_MAX_SIZE/2))));++    // vectors+    CALL_SUBTEST_5((trsolve<float,Dynamic,1>(internal::random<int>(1,EIGEN_TEST_MAX_SIZE))));+    CALL_SUBTEST_6((trsolve<double,Dynamic,1>(internal::random<int>(1,EIGEN_TEST_MAX_SIZE))));+    CALL_SUBTEST_7((trsolve<std::complex<float>,Dynamic,1>(internal::random<int>(1,EIGEN_TEST_MAX_SIZE))));+    CALL_SUBTEST_8((trsolve<std::complex<double>,Dynamic,1>(internal::random<int>(1,EIGEN_TEST_MAX_SIZE))));+    +    // meta-unrollers+    CALL_SUBTEST_9((trsolve<float,4,1>()));+    CALL_SUBTEST_10((trsolve<double,4,1>()));+    CALL_SUBTEST_11((trsolve<std::complex<float>,4,1>()));+    CALL_SUBTEST_12((trsolve<float,1,1>()));+    CALL_SUBTEST_13((trsolve<float,1,2>()));+    CALL_SUBTEST_14((trsolve<float,3,1>()));+    +  }+}
+ eigen3/test/qr.cpp view
@@ -0,0 +1,130 @@+// This file is part of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2008 Gael Guennebaud <gael.guennebaud@inria.fr>+//+// 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 <Eigen/QR>++template<typename MatrixType> void qr(const MatrixType& m)+{+  Index rows = m.rows();+  Index cols = m.cols();++  typedef typename MatrixType::Scalar Scalar;+  typedef Matrix<Scalar, MatrixType::RowsAtCompileTime, MatrixType::RowsAtCompileTime> MatrixQType;++  MatrixType a = MatrixType::Random(rows,cols);+  HouseholderQR<MatrixType> qrOfA(a);++  MatrixQType q = qrOfA.householderQ();+  VERIFY_IS_UNITARY(q);++  MatrixType r = qrOfA.matrixQR().template triangularView<Upper>();+  VERIFY_IS_APPROX(a, qrOfA.householderQ() * r);+}++template<typename MatrixType, int Cols2> void qr_fixedsize()+{+  enum { Rows = MatrixType::RowsAtCompileTime, Cols = MatrixType::ColsAtCompileTime };+  typedef typename MatrixType::Scalar Scalar;+  Matrix<Scalar,Rows,Cols> m1 = Matrix<Scalar,Rows,Cols>::Random();+  HouseholderQR<Matrix<Scalar,Rows,Cols> > qr(m1);++  Matrix<Scalar,Rows,Cols> r = qr.matrixQR();+  // FIXME need better way to construct trapezoid+  for(int i = 0; i < Rows; i++) for(int j = 0; j < Cols; j++) if(i>j) r(i,j) = Scalar(0);++  VERIFY_IS_APPROX(m1, qr.householderQ() * r);++  Matrix<Scalar,Cols,Cols2> m2 = Matrix<Scalar,Cols,Cols2>::Random(Cols,Cols2);+  Matrix<Scalar,Rows,Cols2> m3 = m1*m2;+  m2 = Matrix<Scalar,Cols,Cols2>::Random(Cols,Cols2);+  m2 = qr.solve(m3);+  VERIFY_IS_APPROX(m3, m1*m2);+}++template<typename MatrixType> void qr_invertible()+{+  using std::log;+  using std::abs;+  using std::pow;+  using std::max;+  typedef typename NumTraits<typename MatrixType::Scalar>::Real RealScalar;+  typedef typename MatrixType::Scalar Scalar;++  int size = internal::random<int>(10,50);++  MatrixType m1(size, size), m2(size, size), m3(size, size);+  m1 = MatrixType::Random(size,size);++  if (internal::is_same<RealScalar,float>::value)+  {+    // let's build a matrix more stable to inverse+    MatrixType a = MatrixType::Random(size,size*4);+    m1 += a * a.adjoint();+  }++  HouseholderQR<MatrixType> qr(m1);+  m3 = MatrixType::Random(size,size);+  m2 = qr.solve(m3);+  VERIFY_IS_APPROX(m3, m1*m2);++  // now construct a matrix with prescribed determinant+  m1.setZero();+  for(int i = 0; i < size; i++) m1(i,i) = internal::random<Scalar>();+  RealScalar absdet = abs(m1.diagonal().prod());+  m3 = qr.householderQ(); // get a unitary+  m1 = m3 * m1 * m3;+  qr.compute(m1);+  VERIFY_IS_APPROX(log(absdet), qr.logAbsDeterminant());+  // This test is tricky if the determinant becomes too small.+  // Since we generate random numbers with magnitude rrange [0,1], the average determinant is 0.5^size+  VERIFY_IS_MUCH_SMALLER_THAN( abs(absdet-qr.absDeterminant()), numext::maxi(RealScalar(pow(0.5,size)),numext::maxi<RealScalar>(abs(absdet),abs(qr.absDeterminant()))) );+  +}++template<typename MatrixType> void qr_verify_assert()+{+  MatrixType tmp;++  HouseholderQR<MatrixType> qr;+  VERIFY_RAISES_ASSERT(qr.matrixQR())+  VERIFY_RAISES_ASSERT(qr.solve(tmp))+  VERIFY_RAISES_ASSERT(qr.householderQ())+  VERIFY_RAISES_ASSERT(qr.absDeterminant())+  VERIFY_RAISES_ASSERT(qr.logAbsDeterminant())+}++void test_qr()+{+  for(int i = 0; i < g_repeat; i++) {+   CALL_SUBTEST_1( qr(MatrixXf(internal::random<int>(1,EIGEN_TEST_MAX_SIZE),internal::random<int>(1,EIGEN_TEST_MAX_SIZE))) );+   CALL_SUBTEST_2( qr(MatrixXcd(internal::random<int>(1,EIGEN_TEST_MAX_SIZE/2),internal::random<int>(1,EIGEN_TEST_MAX_SIZE/2))) );+   CALL_SUBTEST_3(( qr_fixedsize<Matrix<float,3,4>, 2 >() ));+   CALL_SUBTEST_4(( qr_fixedsize<Matrix<double,6,2>, 4 >() ));+   CALL_SUBTEST_5(( qr_fixedsize<Matrix<double,2,5>, 7 >() ));+   CALL_SUBTEST_11( qr(Matrix<float,1,1>()) );+  }++  for(int i = 0; i < g_repeat; i++) {+    CALL_SUBTEST_1( qr_invertible<MatrixXf>() );+    CALL_SUBTEST_6( qr_invertible<MatrixXd>() );+    CALL_SUBTEST_7( qr_invertible<MatrixXcf>() );+    CALL_SUBTEST_8( qr_invertible<MatrixXcd>() );+  }++  CALL_SUBTEST_9(qr_verify_assert<Matrix3f>());+  CALL_SUBTEST_10(qr_verify_assert<Matrix3d>());+  CALL_SUBTEST_1(qr_verify_assert<MatrixXf>());+  CALL_SUBTEST_6(qr_verify_assert<MatrixXd>());+  CALL_SUBTEST_7(qr_verify_assert<MatrixXcf>());+  CALL_SUBTEST_8(qr_verify_assert<MatrixXcd>());++  // Test problem size constructors+  CALL_SUBTEST_12(HouseholderQR<MatrixXf>(10, 20));+}
+ eigen3/test/qr_colpivoting.cpp view
@@ -0,0 +1,338 @@+// This file is part of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2008 Gael Guennebaud <gael.guennebaud@inria.fr>+// Copyright (C) 2009 Benoit Jacob <jacob.benoit.1@gmail.com>+//+// 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 <Eigen/QR>+#include <Eigen/SVD>++template <typename MatrixType>+void cod() {+  Index rows = internal::random<Index>(2, EIGEN_TEST_MAX_SIZE);+  Index cols = internal::random<Index>(2, EIGEN_TEST_MAX_SIZE);+  Index cols2 = internal::random<Index>(2, EIGEN_TEST_MAX_SIZE);+  Index rank = internal::random<Index>(1, (std::min)(rows, cols) - 1);++  typedef typename MatrixType::Scalar Scalar;+  typedef Matrix<Scalar, MatrixType::RowsAtCompileTime,+                 MatrixType::RowsAtCompileTime>+      MatrixQType;+  MatrixType matrix;+  createRandomPIMatrixOfRank(rank, rows, cols, matrix);+  CompleteOrthogonalDecomposition<MatrixType> cod(matrix);+  VERIFY(rank == cod.rank());+  VERIFY(cols - cod.rank() == cod.dimensionOfKernel());+  VERIFY(!cod.isInjective());+  VERIFY(!cod.isInvertible());+  VERIFY(!cod.isSurjective());++  MatrixQType q = cod.householderQ();+  VERIFY_IS_UNITARY(q);++  MatrixType z = cod.matrixZ();+  VERIFY_IS_UNITARY(z);++  MatrixType t;+  t.setZero(rows, cols);+  t.topLeftCorner(rank, rank) =+      cod.matrixT().topLeftCorner(rank, rank).template triangularView<Upper>();++  MatrixType c = q * t * z * cod.colsPermutation().inverse();+  VERIFY_IS_APPROX(matrix, c);++  MatrixType exact_solution = MatrixType::Random(cols, cols2);+  MatrixType rhs = matrix * exact_solution;+  MatrixType cod_solution = cod.solve(rhs);+  VERIFY_IS_APPROX(rhs, matrix * cod_solution);++  // Verify that we get the same minimum-norm solution as the SVD.+  JacobiSVD<MatrixType> svd(matrix, ComputeThinU | ComputeThinV);+  MatrixType svd_solution = svd.solve(rhs);+  VERIFY_IS_APPROX(cod_solution, svd_solution);++  MatrixType pinv = cod.pseudoInverse();+  VERIFY_IS_APPROX(cod_solution, pinv * rhs);+}++template <typename MatrixType, int Cols2>+void cod_fixedsize() {+  enum {+    Rows = MatrixType::RowsAtCompileTime,+    Cols = MatrixType::ColsAtCompileTime+  };+  typedef typename MatrixType::Scalar Scalar;+  int rank = internal::random<int>(1, (std::min)(int(Rows), int(Cols)) - 1);+  Matrix<Scalar, Rows, Cols> matrix;+  createRandomPIMatrixOfRank(rank, Rows, Cols, matrix);+  CompleteOrthogonalDecomposition<Matrix<Scalar, Rows, Cols> > cod(matrix);+  VERIFY(rank == cod.rank());+  VERIFY(Cols - cod.rank() == cod.dimensionOfKernel());+  VERIFY(cod.isInjective() == (rank == Rows));+  VERIFY(cod.isSurjective() == (rank == Cols));+  VERIFY(cod.isInvertible() == (cod.isInjective() && cod.isSurjective()));++  Matrix<Scalar, Cols, Cols2> exact_solution;+  exact_solution.setRandom(Cols, Cols2);+  Matrix<Scalar, Rows, Cols2> rhs = matrix * exact_solution;+  Matrix<Scalar, Cols, Cols2> cod_solution = cod.solve(rhs);+  VERIFY_IS_APPROX(rhs, matrix * cod_solution);++  // Verify that we get the same minimum-norm solution as the SVD.+  JacobiSVD<MatrixType> svd(matrix, ComputeFullU | ComputeFullV);+  Matrix<Scalar, Cols, Cols2> svd_solution = svd.solve(rhs);+  VERIFY_IS_APPROX(cod_solution, svd_solution);+}++template<typename MatrixType> void qr()+{+  using std::sqrt;++  Index rows = internal::random<Index>(2,EIGEN_TEST_MAX_SIZE), cols = internal::random<Index>(2,EIGEN_TEST_MAX_SIZE), cols2 = internal::random<Index>(2,EIGEN_TEST_MAX_SIZE);+  Index rank = internal::random<Index>(1, (std::min)(rows, cols)-1);++  typedef typename MatrixType::Scalar Scalar;+  typedef typename MatrixType::RealScalar RealScalar;+  typedef Matrix<Scalar, MatrixType::RowsAtCompileTime, MatrixType::RowsAtCompileTime> MatrixQType;+  MatrixType m1;+  createRandomPIMatrixOfRank(rank,rows,cols,m1);+  ColPivHouseholderQR<MatrixType> qr(m1);+  VERIFY_IS_EQUAL(rank, qr.rank());+  VERIFY_IS_EQUAL(cols - qr.rank(), qr.dimensionOfKernel());+  VERIFY(!qr.isInjective());+  VERIFY(!qr.isInvertible());+  VERIFY(!qr.isSurjective());++  MatrixQType q = qr.householderQ();+  VERIFY_IS_UNITARY(q);++  MatrixType r = qr.matrixQR().template triangularView<Upper>();+  MatrixType c = q * r * qr.colsPermutation().inverse();+  VERIFY_IS_APPROX(m1, c);++  // Verify that the absolute value of the diagonal elements in R are+  // non-increasing until they reach the singularity threshold.+  RealScalar threshold =+      sqrt(RealScalar(rows)) * numext::abs(r(0, 0)) * NumTraits<Scalar>::epsilon();+  for (Index i = 0; i < (std::min)(rows, cols) - 1; ++i) {+    RealScalar x = numext::abs(r(i, i));+    RealScalar y = numext::abs(r(i + 1, i + 1));+    if (x < threshold && y < threshold) continue;+    if (!test_isApproxOrLessThan(y, x)) {+      for (Index j = 0; j < (std::min)(rows, cols); ++j) {+        std::cout << "i = " << j << ", |r_ii| = " << numext::abs(r(j, j)) << std::endl;+      }+      std::cout << "Failure at i=" << i << ", rank=" << rank+                << ", threshold=" << threshold << std::endl;+    }+    VERIFY_IS_APPROX_OR_LESS_THAN(y, x);+  }++  MatrixType m2 = MatrixType::Random(cols,cols2);+  MatrixType m3 = m1*m2;+  m2 = MatrixType::Random(cols,cols2);+  m2 = qr.solve(m3);+  VERIFY_IS_APPROX(m3, m1*m2);++  {+    Index size = rows;+    do {+      m1 = MatrixType::Random(size,size);+      qr.compute(m1);+    } while(!qr.isInvertible());+    MatrixType m1_inv = qr.inverse();+    m3 = m1 * MatrixType::Random(size,cols2);+    m2 = qr.solve(m3);+    VERIFY_IS_APPROX(m2, m1_inv*m3);+  }+}++template<typename MatrixType, int Cols2> void qr_fixedsize()+{+  using std::sqrt;+  using std::abs;+  enum { Rows = MatrixType::RowsAtCompileTime, Cols = MatrixType::ColsAtCompileTime };+  typedef typename MatrixType::Scalar Scalar;+  typedef typename MatrixType::RealScalar RealScalar;+  int rank = internal::random<int>(1, (std::min)(int(Rows), int(Cols))-1);+  Matrix<Scalar,Rows,Cols> m1;+  createRandomPIMatrixOfRank(rank,Rows,Cols,m1);+  ColPivHouseholderQR<Matrix<Scalar,Rows,Cols> > qr(m1);+  VERIFY_IS_EQUAL(rank, qr.rank());+  VERIFY_IS_EQUAL(Cols - qr.rank(), qr.dimensionOfKernel());+  VERIFY_IS_EQUAL(qr.isInjective(), (rank == Rows));+  VERIFY_IS_EQUAL(qr.isSurjective(), (rank == Cols));+  VERIFY_IS_EQUAL(qr.isInvertible(), (qr.isInjective() && qr.isSurjective()));++  Matrix<Scalar,Rows,Cols> r = qr.matrixQR().template triangularView<Upper>();+  Matrix<Scalar,Rows,Cols> c = qr.householderQ() * r * qr.colsPermutation().inverse();+  VERIFY_IS_APPROX(m1, c);++  Matrix<Scalar,Cols,Cols2> m2 = Matrix<Scalar,Cols,Cols2>::Random(Cols,Cols2);+  Matrix<Scalar,Rows,Cols2> m3 = m1*m2;+  m2 = Matrix<Scalar,Cols,Cols2>::Random(Cols,Cols2);+  m2 = qr.solve(m3);+  VERIFY_IS_APPROX(m3, m1*m2);+  // Verify that the absolute value of the diagonal elements in R are+  // non-increasing until they reache the singularity threshold.+  RealScalar threshold =+      sqrt(RealScalar(Rows)) * (std::abs)(r(0, 0)) * NumTraits<Scalar>::epsilon();+  for (Index i = 0; i < (std::min)(int(Rows), int(Cols)) - 1; ++i) {+    RealScalar x = numext::abs(r(i, i));+    RealScalar y = numext::abs(r(i + 1, i + 1));+    if (x < threshold && y < threshold) continue;+    if (!test_isApproxOrLessThan(y, x)) {+      for (Index j = 0; j < (std::min)(int(Rows), int(Cols)); ++j) {+        std::cout << "i = " << j << ", |r_ii| = " << numext::abs(r(j, j)) << std::endl;+      }+      std::cout << "Failure at i=" << i << ", rank=" << rank+                << ", threshold=" << threshold << std::endl;+    }+    VERIFY_IS_APPROX_OR_LESS_THAN(y, x);+  }+}++// This test is meant to verify that pivots are chosen such that+// even for a graded matrix, the diagonal of R falls of roughly+// monotonically until it reaches the threshold for singularity.+// We use the so-called Kahan matrix, which is a famous counter-example+// for rank-revealing QR. See+// http://www.netlib.org/lapack/lawnspdf/lawn176.pdf+// page 3 for more detail.+template<typename MatrixType> void qr_kahan_matrix()+{+  using std::sqrt;+  using std::abs;+  typedef typename MatrixType::Scalar Scalar;+  typedef typename MatrixType::RealScalar RealScalar;++  Index rows = 300, cols = rows;++  MatrixType m1;+  m1.setZero(rows,cols);+  RealScalar s = std::pow(NumTraits<RealScalar>::epsilon(), 1.0 / rows);+  RealScalar c = std::sqrt(1 - s*s);+  RealScalar pow_s_i(1.0); // pow(s,i)+  for (Index i = 0; i < rows; ++i) {+    m1(i, i) = pow_s_i;+    m1.row(i).tail(rows - i - 1) = -pow_s_i * c * MatrixType::Ones(1, rows - i - 1);+    pow_s_i *= s;+  }+  m1 = (m1 + m1.transpose()).eval();+  ColPivHouseholderQR<MatrixType> qr(m1);+  MatrixType r = qr.matrixQR().template triangularView<Upper>();++  RealScalar threshold =+      std::sqrt(RealScalar(rows)) * numext::abs(r(0, 0)) * NumTraits<Scalar>::epsilon();+  for (Index i = 0; i < (std::min)(rows, cols) - 1; ++i) {+    RealScalar x = numext::abs(r(i, i));+    RealScalar y = numext::abs(r(i + 1, i + 1));+    if (x < threshold && y < threshold) continue;+    if (!test_isApproxOrLessThan(y, x)) {+      for (Index j = 0; j < (std::min)(rows, cols); ++j) {+        std::cout << "i = " << j << ", |r_ii| = " << numext::abs(r(j, j)) << std::endl;+      }+      std::cout << "Failure at i=" << i << ", rank=" << qr.rank()+                << ", threshold=" << threshold << std::endl;+    }+    VERIFY_IS_APPROX_OR_LESS_THAN(y, x);+  }+}++template<typename MatrixType> void qr_invertible()+{+  using std::log;+  using std::abs;+  typedef typename NumTraits<typename MatrixType::Scalar>::Real RealScalar;+  typedef typename MatrixType::Scalar Scalar;++  int size = internal::random<int>(10,50);++  MatrixType m1(size, size), m2(size, size), m3(size, size);+  m1 = MatrixType::Random(size,size);++  if (internal::is_same<RealScalar,float>::value)+  {+    // let's build a matrix more stable to inverse+    MatrixType a = MatrixType::Random(size,size*2);+    m1 += a * a.adjoint();+  }++  ColPivHouseholderQR<MatrixType> qr(m1);+  m3 = MatrixType::Random(size,size);+  m2 = qr.solve(m3);+  //VERIFY_IS_APPROX(m3, m1*m2);++  // now construct a matrix with prescribed determinant+  m1.setZero();+  for(int i = 0; i < size; i++) m1(i,i) = internal::random<Scalar>();+  RealScalar absdet = abs(m1.diagonal().prod());+  m3 = qr.householderQ(); // get a unitary+  m1 = m3 * m1 * m3;+  qr.compute(m1);+  VERIFY_IS_APPROX(absdet, qr.absDeterminant());+  VERIFY_IS_APPROX(log(absdet), qr.logAbsDeterminant());+}++template<typename MatrixType> void qr_verify_assert()+{+  MatrixType tmp;++  ColPivHouseholderQR<MatrixType> qr;+  VERIFY_RAISES_ASSERT(qr.matrixQR())+  VERIFY_RAISES_ASSERT(qr.solve(tmp))+  VERIFY_RAISES_ASSERT(qr.householderQ())+  VERIFY_RAISES_ASSERT(qr.dimensionOfKernel())+  VERIFY_RAISES_ASSERT(qr.isInjective())+  VERIFY_RAISES_ASSERT(qr.isSurjective())+  VERIFY_RAISES_ASSERT(qr.isInvertible())+  VERIFY_RAISES_ASSERT(qr.inverse())+  VERIFY_RAISES_ASSERT(qr.absDeterminant())+  VERIFY_RAISES_ASSERT(qr.logAbsDeterminant())+}++void test_qr_colpivoting()+{+  for(int i = 0; i < g_repeat; i++) {+    CALL_SUBTEST_1( qr<MatrixXf>() );+    CALL_SUBTEST_2( qr<MatrixXd>() );+    CALL_SUBTEST_3( qr<MatrixXcd>() );+    CALL_SUBTEST_4(( qr_fixedsize<Matrix<float,3,5>, 4 >() ));+    CALL_SUBTEST_5(( qr_fixedsize<Matrix<double,6,2>, 3 >() ));+    CALL_SUBTEST_5(( qr_fixedsize<Matrix<double,1,1>, 1 >() ));+  }++  for(int i = 0; i < g_repeat; i++) {+    CALL_SUBTEST_1( cod<MatrixXf>() );+    CALL_SUBTEST_2( cod<MatrixXd>() );+    CALL_SUBTEST_3( cod<MatrixXcd>() );+    CALL_SUBTEST_4(( cod_fixedsize<Matrix<float,3,5>, 4 >() ));+    CALL_SUBTEST_5(( cod_fixedsize<Matrix<double,6,2>, 3 >() ));+    CALL_SUBTEST_5(( cod_fixedsize<Matrix<double,1,1>, 1 >() ));+  }++  for(int i = 0; i < g_repeat; i++) {+    CALL_SUBTEST_1( qr_invertible<MatrixXf>() );+    CALL_SUBTEST_2( qr_invertible<MatrixXd>() );+    CALL_SUBTEST_6( qr_invertible<MatrixXcf>() );+    CALL_SUBTEST_3( qr_invertible<MatrixXcd>() );+  }++  CALL_SUBTEST_7(qr_verify_assert<Matrix3f>());+  CALL_SUBTEST_8(qr_verify_assert<Matrix3d>());+  CALL_SUBTEST_1(qr_verify_assert<MatrixXf>());+  CALL_SUBTEST_2(qr_verify_assert<MatrixXd>());+  CALL_SUBTEST_6(qr_verify_assert<MatrixXcf>());+  CALL_SUBTEST_3(qr_verify_assert<MatrixXcd>());++  // Test problem size constructors+  CALL_SUBTEST_9(ColPivHouseholderQR<MatrixXf>(10, 20));++  CALL_SUBTEST_1( qr_kahan_matrix<MatrixXf>() );+  CALL_SUBTEST_2( qr_kahan_matrix<MatrixXd>() );+}
+ eigen3/test/qr_fullpivoting.cpp view
@@ -0,0 +1,157 @@+// This file is part of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2008 Gael Guennebaud <gael.guennebaud@inria.fr>+// Copyright (C) 2009 Benoit Jacob <jacob.benoit.1@gmail.com>+//+// 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 <Eigen/QR>++template<typename MatrixType> void qr()+{+  Index max_size = EIGEN_TEST_MAX_SIZE;+  Index min_size = numext::maxi(1,EIGEN_TEST_MAX_SIZE/10);+  Index rows  = internal::random<Index>(min_size,max_size),+        cols  = internal::random<Index>(min_size,max_size),+        cols2 = internal::random<Index>(min_size,max_size),+        rank  = internal::random<Index>(1, (std::min)(rows, cols)-1);++  typedef typename MatrixType::Scalar Scalar;+  typedef Matrix<Scalar, MatrixType::RowsAtCompileTime, MatrixType::RowsAtCompileTime> MatrixQType;+  MatrixType m1;+  createRandomPIMatrixOfRank(rank,rows,cols,m1);+  FullPivHouseholderQR<MatrixType> qr(m1);+  VERIFY_IS_EQUAL(rank, qr.rank());+  VERIFY_IS_EQUAL(cols - qr.rank(), qr.dimensionOfKernel());+  VERIFY(!qr.isInjective());+  VERIFY(!qr.isInvertible());+  VERIFY(!qr.isSurjective());++  MatrixType r = qr.matrixQR();+  +  MatrixQType q = qr.matrixQ();+  VERIFY_IS_UNITARY(q);+  +  // FIXME need better way to construct trapezoid+  for(int i = 0; i < rows; i++) for(int j = 0; j < cols; j++) if(i>j) r(i,j) = Scalar(0);++  MatrixType c = qr.matrixQ() * r * qr.colsPermutation().inverse();++  VERIFY_IS_APPROX(m1, c);+  +  // stress the ReturnByValue mechanism+  MatrixType tmp;+  VERIFY_IS_APPROX(tmp.noalias() = qr.matrixQ() * r, (qr.matrixQ() * r).eval());+  +  MatrixType m2 = MatrixType::Random(cols,cols2);+  MatrixType m3 = m1*m2;+  m2 = MatrixType::Random(cols,cols2);+  m2 = qr.solve(m3);+  VERIFY_IS_APPROX(m3, m1*m2);++  {+    Index size = rows;+    do {+      m1 = MatrixType::Random(size,size);+      qr.compute(m1);+    } while(!qr.isInvertible());+    MatrixType m1_inv = qr.inverse();+    m3 = m1 * MatrixType::Random(size,cols2);+    m2 = qr.solve(m3);+    VERIFY_IS_APPROX(m2, m1_inv*m3);+  }+}++template<typename MatrixType> void qr_invertible()+{+  using std::log;+  using std::abs;+  typedef typename NumTraits<typename MatrixType::Scalar>::Real RealScalar;+  typedef typename MatrixType::Scalar Scalar;++  Index max_size = numext::mini(50,EIGEN_TEST_MAX_SIZE);+  Index min_size = numext::maxi(1,EIGEN_TEST_MAX_SIZE/10);+  Index size = internal::random<Index>(min_size,max_size);++  MatrixType m1(size, size), m2(size, size), m3(size, size);+  m1 = MatrixType::Random(size,size);++  if (internal::is_same<RealScalar,float>::value)+  {+    // let's build a matrix more stable to inverse+    MatrixType a = MatrixType::Random(size,size*2);+    m1 += a * a.adjoint();+  }++  FullPivHouseholderQR<MatrixType> qr(m1);+  VERIFY(qr.isInjective());+  VERIFY(qr.isInvertible());+  VERIFY(qr.isSurjective());++  m3 = MatrixType::Random(size,size);+  m2 = qr.solve(m3);+  VERIFY_IS_APPROX(m3, m1*m2);++  // now construct a matrix with prescribed determinant+  m1.setZero();+  for(int i = 0; i < size; i++) m1(i,i) = internal::random<Scalar>();+  RealScalar absdet = abs(m1.diagonal().prod());+  m3 = qr.matrixQ(); // get a unitary+  m1 = m3 * m1 * m3;+  qr.compute(m1);+  VERIFY_IS_APPROX(absdet, qr.absDeterminant());+  VERIFY_IS_APPROX(log(absdet), qr.logAbsDeterminant());+}++template<typename MatrixType> void qr_verify_assert()+{+  MatrixType tmp;++  FullPivHouseholderQR<MatrixType> qr;+  VERIFY_RAISES_ASSERT(qr.matrixQR())+  VERIFY_RAISES_ASSERT(qr.solve(tmp))+  VERIFY_RAISES_ASSERT(qr.matrixQ())+  VERIFY_RAISES_ASSERT(qr.dimensionOfKernel())+  VERIFY_RAISES_ASSERT(qr.isInjective())+  VERIFY_RAISES_ASSERT(qr.isSurjective())+  VERIFY_RAISES_ASSERT(qr.isInvertible())+  VERIFY_RAISES_ASSERT(qr.inverse())+  VERIFY_RAISES_ASSERT(qr.absDeterminant())+  VERIFY_RAISES_ASSERT(qr.logAbsDeterminant())+}++void test_qr_fullpivoting()+{+ for(int i = 0; i < 1; i++) {+    // FIXME : very weird bug here+//     CALL_SUBTEST(qr(Matrix2f()) );+    CALL_SUBTEST_1( qr<MatrixXf>() );+    CALL_SUBTEST_2( qr<MatrixXd>() );+    CALL_SUBTEST_3( qr<MatrixXcd>() );+  }++  for(int i = 0; i < g_repeat; i++) {+    CALL_SUBTEST_1( qr_invertible<MatrixXf>() );+    CALL_SUBTEST_2( qr_invertible<MatrixXd>() );+    CALL_SUBTEST_4( qr_invertible<MatrixXcf>() );+    CALL_SUBTEST_3( qr_invertible<MatrixXcd>() );+  }++  CALL_SUBTEST_5(qr_verify_assert<Matrix3f>());+  CALL_SUBTEST_6(qr_verify_assert<Matrix3d>());+  CALL_SUBTEST_1(qr_verify_assert<MatrixXf>());+  CALL_SUBTEST_2(qr_verify_assert<MatrixXd>());+  CALL_SUBTEST_4(qr_verify_assert<MatrixXcf>());+  CALL_SUBTEST_3(qr_verify_assert<MatrixXcd>());++  // Test problem size constructors+  CALL_SUBTEST_7(FullPivHouseholderQR<MatrixXf>(10, 20));+  CALL_SUBTEST_7((FullPivHouseholderQR<Matrix<float,10,20> >(10,20)));+  CALL_SUBTEST_7((FullPivHouseholderQR<Matrix<float,10,20> >(Matrix<float,10,20>::Random())));+  CALL_SUBTEST_7((FullPivHouseholderQR<Matrix<float,20,10> >(20,10)));+  CALL_SUBTEST_7((FullPivHouseholderQR<Matrix<float,20,10> >(Matrix<float,20,10>::Random())));+}
+ eigen3/test/qtvector.cpp view
@@ -0,0 +1,156 @@+// This file is part of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2008 Gael Guennebaud <gael.guennebaud@inria.fr>+// Copyright (C) 2008 Benoit Jacob <jacob.benoit.1@gmail.com>+//+// 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_WORK_AROUND_QT_BUG_CALLING_WRONG_OPERATOR_NEW_FIXED_IN_QT_4_5++#include "main.h"+#include <QtCore/QVector>+#include <Eigen/Geometry>+#include <Eigen/QtAlignedMalloc>++template<typename MatrixType>+void check_qtvector_matrix(const MatrixType& m)+{+  Index rows = m.rows();+  Index cols = m.cols();+  MatrixType x = MatrixType::Random(rows,cols), y = MatrixType::Random(rows,cols);+  QVector<MatrixType> v(10, MatrixType(rows,cols)), w(20, y);+  for(int i = 0; i < 20; i++)+  {+    VERIFY_IS_APPROX(w[i], y);+  }+  v[5] = x;+  w[6] = v[5];+  VERIFY_IS_APPROX(w[6], v[5]);+  v = w;+  for(int i = 0; i < 20; i++)+  {+    VERIFY_IS_APPROX(w[i], v[i]);+  }++  v.resize(21);+  v[20] = x;+  VERIFY_IS_APPROX(v[20], x);+  v.fill(y,22);+  VERIFY_IS_APPROX(v[21], y);+  v.push_back(x);+  VERIFY_IS_APPROX(v[22], x);+  VERIFY((size_t)&(v[22]) == (size_t)&(v[21]) + sizeof(MatrixType));++  // do a lot of push_back such that the vector gets internally resized+  // (with memory reallocation)+  MatrixType* ref = &w[0];+  for(int i=0; i<30 || ((ref==&w[0]) && i<300); ++i)+    v.push_back(w[i%w.size()]);+  for(int i=23; i<v.size(); ++i)+  {+    VERIFY(v[i]==w[(i-23)%w.size()]);+  }+}++template<typename TransformType>+void check_qtvector_transform(const TransformType&)+{+  typedef typename TransformType::MatrixType MatrixType;+  TransformType x(MatrixType::Random()), y(MatrixType::Random());+  QVector<TransformType> v(10), w(20, y);+  v[5] = x;+  w[6] = v[5];+  VERIFY_IS_APPROX(w[6], v[5]);+  v = w;+  for(int i = 0; i < 20; i++)+  {+    VERIFY_IS_APPROX(w[i], v[i]);+  }++  v.resize(21);+  v[20] = x;+  VERIFY_IS_APPROX(v[20], x);+  v.fill(y,22);+  VERIFY_IS_APPROX(v[21], y);+  v.push_back(x);+  VERIFY_IS_APPROX(v[22], x);+  VERIFY((size_t)&(v[22]) == (size_t)&(v[21]) + sizeof(TransformType));++  // do a lot of push_back such that the vector gets internally resized+  // (with memory reallocation)+  TransformType* ref = &w[0];+  for(int i=0; i<30 || ((ref==&w[0]) && i<300); ++i)+    v.push_back(w[i%w.size()]);+  for(unsigned int i=23; int(i)<v.size(); ++i)+  {+    VERIFY(v[i].matrix()==w[(i-23)%w.size()].matrix());+  }+}++template<typename QuaternionType>+void check_qtvector_quaternion(const QuaternionType&)+{+  typedef typename QuaternionType::Coefficients Coefficients;+  QuaternionType x(Coefficients::Random()), y(Coefficients::Random());+  QVector<QuaternionType> v(10), w(20, y);+  v[5] = x;+  w[6] = v[5];+  VERIFY_IS_APPROX(w[6], v[5]);+  v = w;+  for(int i = 0; i < 20; i++)+  {+    VERIFY_IS_APPROX(w[i], v[i]);+  }++  v.resize(21);+  v[20] = x;+  VERIFY_IS_APPROX(v[20], x);+  v.fill(y,22);+  VERIFY_IS_APPROX(v[21], y);+  v.push_back(x);+  VERIFY_IS_APPROX(v[22], x);+  VERIFY((size_t)&(v[22]) == (size_t)&(v[21]) + sizeof(QuaternionType));++  // do a lot of push_back such that the vector gets internally resized+  // (with memory reallocation)+  QuaternionType* ref = &w[0];+  for(int i=0; i<30 || ((ref==&w[0]) && i<300); ++i)+    v.push_back(w[i%w.size()]);+  for(unsigned int i=23; int(i)<v.size(); ++i)+  {+    VERIFY(v[i].coeffs()==w[(i-23)%w.size()].coeffs());+  }+}++void test_qtvector()+{+  // some non vectorizable fixed sizes+  CALL_SUBTEST(check_qtvector_matrix(Vector2f()));+  CALL_SUBTEST(check_qtvector_matrix(Matrix3f()));+  CALL_SUBTEST(check_qtvector_matrix(Matrix3d()));++  // some vectorizable fixed sizes+  CALL_SUBTEST(check_qtvector_matrix(Matrix2f()));+  CALL_SUBTEST(check_qtvector_matrix(Vector4f()));+  CALL_SUBTEST(check_qtvector_matrix(Matrix4f()));+  CALL_SUBTEST(check_qtvector_matrix(Matrix4d()));++  // some dynamic sizes+  CALL_SUBTEST(check_qtvector_matrix(MatrixXd(1,1)));+  CALL_SUBTEST(check_qtvector_matrix(VectorXd(20)));+  CALL_SUBTEST(check_qtvector_matrix(RowVectorXf(20)));+  CALL_SUBTEST(check_qtvector_matrix(MatrixXcf(10,10)));++  // some Transform+  CALL_SUBTEST(check_qtvector_transform(Affine2f()));+  CALL_SUBTEST(check_qtvector_transform(Affine3f()));+  CALL_SUBTEST(check_qtvector_transform(Affine3d()));+  //CALL_SUBTEST(check_qtvector_transform(Transform4d()));++  // some Quaternion+  CALL_SUBTEST(check_qtvector_quaternion(Quaternionf()));+  CALL_SUBTEST(check_qtvector_quaternion(Quaternionf()));+}
+ eigen3/test/rand.cpp view
@@ -0,0 +1,118 @@+// This file is part of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2015 Gael Guennebaud <gael.guennebaud@inria.fr>+//+// 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"++typedef long long int64;++template<typename Scalar> Scalar check_in_range(Scalar x, Scalar y)+{+  Scalar r = internal::random<Scalar>(x,y);+  VERIFY(r>=x);+  if(y>=x)+  {+    VERIFY(r<=y);+  }+  return r;+}++template<typename Scalar> void check_all_in_range(Scalar x, Scalar y)+{+  Array<int,1,Dynamic> mask(y-x+1);+  mask.fill(0);+  long n = (y-x+1)*32;+  for(long k=0; k<n; ++k)+  {+    mask( check_in_range(x,y)-x )++;+  }+  for(Index i=0; i<mask.size(); ++i)+    if(mask(i)==0)+      std::cout << "WARNING: value " << x+i << " not reached." << std::endl;+  VERIFY( (mask>0).all() );+}++template<typename Scalar> void check_histogram(Scalar x, Scalar y, int bins)+{+  Array<int,1,Dynamic> hist(bins);+  hist.fill(0);+  int f = 100000;+  int n = bins*f;+  int64 range = int64(y)-int64(x);+  int divisor = int((range+1)/bins);+  assert(((range+1)%bins)==0);+  for(int k=0; k<n; ++k)+  {+    Scalar r = check_in_range(x,y);+    hist( int((int64(r)-int64(x))/divisor) )++;+  }+  VERIFY( (((hist.cast<double>()/double(f))-1.0).abs()<0.02).all() );+}++void test_rand()+{+  long long_ref = NumTraits<long>::highest()/10;+  signed char char_offset = (std::min)(g_repeat,64);+  signed char short_offset = (std::min)(g_repeat,16000);++  for(int i = 0; i < g_repeat*10000; i++) {+    CALL_SUBTEST(check_in_range<float>(10,11));+    CALL_SUBTEST(check_in_range<float>(1.24234523,1.24234523));+    CALL_SUBTEST(check_in_range<float>(-1,1));+    CALL_SUBTEST(check_in_range<float>(-1432.2352,-1432.2352));++    CALL_SUBTEST(check_in_range<double>(10,11));+    CALL_SUBTEST(check_in_range<double>(1.24234523,1.24234523));+    CALL_SUBTEST(check_in_range<double>(-1,1));+    CALL_SUBTEST(check_in_range<double>(-1432.2352,-1432.2352));++    CALL_SUBTEST(check_in_range<int>(0,-1));+    CALL_SUBTEST(check_in_range<short>(0,-1));+    CALL_SUBTEST(check_in_range<long>(0,-1));+    CALL_SUBTEST(check_in_range<int>(-673456,673456));+    CALL_SUBTEST(check_in_range<int>(-RAND_MAX+10,RAND_MAX-10));+    CALL_SUBTEST(check_in_range<short>(-24345,24345));+    CALL_SUBTEST(check_in_range<long>(-long_ref,long_ref));+  }++  CALL_SUBTEST(check_all_in_range<signed char>(11,11));+  CALL_SUBTEST(check_all_in_range<signed char>(11,11+char_offset));+  CALL_SUBTEST(check_all_in_range<signed char>(-5,5));+  CALL_SUBTEST(check_all_in_range<signed char>(-11-char_offset,-11));+  CALL_SUBTEST(check_all_in_range<signed char>(-126,-126+char_offset));+  CALL_SUBTEST(check_all_in_range<signed char>(126-char_offset,126));+  CALL_SUBTEST(check_all_in_range<signed char>(-126,126));++  CALL_SUBTEST(check_all_in_range<short>(11,11));+  CALL_SUBTEST(check_all_in_range<short>(11,11+short_offset));+  CALL_SUBTEST(check_all_in_range<short>(-5,5));+  CALL_SUBTEST(check_all_in_range<short>(-11-short_offset,-11));+  CALL_SUBTEST(check_all_in_range<short>(-24345,-24345+short_offset));+  CALL_SUBTEST(check_all_in_range<short>(24345,24345+short_offset));++  CALL_SUBTEST(check_all_in_range<int>(11,11));+  CALL_SUBTEST(check_all_in_range<int>(11,11+g_repeat));+  CALL_SUBTEST(check_all_in_range<int>(-5,5));+  CALL_SUBTEST(check_all_in_range<int>(-11-g_repeat,-11));+  CALL_SUBTEST(check_all_in_range<int>(-673456,-673456+g_repeat));+  CALL_SUBTEST(check_all_in_range<int>(673456,673456+g_repeat));++  CALL_SUBTEST(check_all_in_range<long>(11,11));+  CALL_SUBTEST(check_all_in_range<long>(11,11+g_repeat));+  CALL_SUBTEST(check_all_in_range<long>(-5,5));+  CALL_SUBTEST(check_all_in_range<long>(-11-g_repeat,-11));+  CALL_SUBTEST(check_all_in_range<long>(-long_ref,-long_ref+g_repeat));+  CALL_SUBTEST(check_all_in_range<long>( long_ref, long_ref+g_repeat));++  CALL_SUBTEST(check_histogram<int>(-5,5,11));+  int bins = 100;+  CALL_SUBTEST(check_histogram<int>(-3333,-3333+bins*(3333/bins)-1,bins));+  bins = 1000;+  CALL_SUBTEST(check_histogram<int>(-RAND_MAX+10,-RAND_MAX+10+bins*(RAND_MAX/bins)-1,bins));+  CALL_SUBTEST(check_histogram<int>(-RAND_MAX+10,-int64(RAND_MAX)+10+bins*(2*int64(RAND_MAX)/bins)-1,bins));+}
+ eigen3/test/real_qz.cpp view
@@ -0,0 +1,94 @@+// This file is part of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2012 Alexey Korepanov <kaikaikai@yandex.ru>+//+// 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 <limits>+#include <Eigen/Eigenvalues>++template<typename MatrixType> void real_qz(const MatrixType& m)+{+  /* this test covers the following files:+     RealQZ.h+  */+  using std::abs;+  typedef typename MatrixType::Scalar Scalar;+  +  Index dim = m.cols();+  +  MatrixType A = MatrixType::Random(dim,dim),+             B = MatrixType::Random(dim,dim);+++  // Regression test for bug 985: Randomly set rows or columns to zero+  Index k=internal::random<Index>(0, dim-1);+  switch(internal::random<int>(0,10)) {+  case 0:+    A.row(k).setZero(); break;+  case 1:+    A.col(k).setZero(); break;+  case 2:+    B.row(k).setZero(); break;+  case 3:+    B.col(k).setZero(); break;+  default:+    break;+  }++  RealQZ<MatrixType> qz(dim);+  // TODO enable full-prealocation of required memory, this probably requires an in-place mode for HessenbergDecomposition+  //Eigen::internal::set_is_malloc_allowed(false);+  qz.compute(A,B);+  //Eigen::internal::set_is_malloc_allowed(true);+  +  VERIFY_IS_EQUAL(qz.info(), Success);+  // check for zeros+  bool all_zeros = true;+  for (Index i=0; i<A.cols(); i++)+    for (Index j=0; j<i; j++) {+      if (abs(qz.matrixT()(i,j))!=Scalar(0.0))+      {+        std::cerr << "Error: T(" << i << "," << j << ") = " << qz.matrixT()(i,j) << std::endl;+        all_zeros = false;+      }+      if (j<i-1 && abs(qz.matrixS()(i,j))!=Scalar(0.0))+      {+        std::cerr << "Error: S(" << i << "," << j << ") = " << qz.matrixS()(i,j) << std::endl;+        all_zeros = false;+      }+      if (j==i-1 && j>0 && abs(qz.matrixS()(i,j))!=Scalar(0.0) && abs(qz.matrixS()(i-1,j-1))!=Scalar(0.0))+      {+        std::cerr << "Error: S(" << i << "," << j << ") = " << qz.matrixS()(i,j)  << " && S(" << i-1 << "," << j-1 << ") = " << qz.matrixS()(i-1,j-1) << std::endl;+        all_zeros = false;+      }+    }+  VERIFY_IS_EQUAL(all_zeros, true);+  VERIFY_IS_APPROX(qz.matrixQ()*qz.matrixS()*qz.matrixZ(), A);+  VERIFY_IS_APPROX(qz.matrixQ()*qz.matrixT()*qz.matrixZ(), B);+  VERIFY_IS_APPROX(qz.matrixQ()*qz.matrixQ().adjoint(), MatrixType::Identity(dim,dim));+  VERIFY_IS_APPROX(qz.matrixZ()*qz.matrixZ().adjoint(), MatrixType::Identity(dim,dim));+}++void test_real_qz()+{+  int s = 0;+  for(int i = 0; i < g_repeat; i++) {+    CALL_SUBTEST_1( real_qz(Matrix4f()) );+    s = internal::random<int>(1,EIGEN_TEST_MAX_SIZE/4);+    CALL_SUBTEST_2( real_qz(MatrixXd(s,s)) );++    // some trivial but implementation-wise tricky cases+    CALL_SUBTEST_2( real_qz(MatrixXd(1,1)) );+    CALL_SUBTEST_2( real_qz(MatrixXd(2,2)) );+    CALL_SUBTEST_3( real_qz(Matrix<double,1,1>()) );+    CALL_SUBTEST_4( real_qz(Matrix2d()) );+  }+  +  TEST_SET_BUT_UNUSED_VARIABLE(s)+}
+ eigen3/test/redux.cpp view
@@ -0,0 +1,178 @@+// This file is part of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2008 Benoit Jacob <jacob.benoit.1@gmail.com>+// Copyright (C) 2015 Gael Guennebaud <gael.guennebaud@inria.fr>+//+// 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+#define EIGEN_CACHEFRIENDLY_PRODUCT_THRESHOLD 8+// ^^ see bug 1449++#include "main.h"++template<typename MatrixType> void matrixRedux(const MatrixType& m)+{+  typedef typename MatrixType::Scalar Scalar;+  typedef typename MatrixType::RealScalar RealScalar;++  Index rows = m.rows();+  Index cols = m.cols();++  MatrixType m1 = MatrixType::Random(rows, cols);++  // The entries of m1 are uniformly distributed in [0,1], so m1.prod() is very small. This may lead to test+  // failures if we underflow into denormals. Thus, we scale so that entries are close to 1.+  MatrixType m1_for_prod = MatrixType::Ones(rows, cols) + RealScalar(0.2) * m1;++  VERIFY_IS_MUCH_SMALLER_THAN(MatrixType::Zero(rows, cols).sum(), Scalar(1));+  VERIFY_IS_APPROX(MatrixType::Ones(rows, cols).sum(), Scalar(float(rows*cols))); // the float() here to shut up excessive MSVC warning about int->complex conversion being lossy+  Scalar s(0), p(1), minc(numext::real(m1.coeff(0))), maxc(numext::real(m1.coeff(0)));+  for(int j = 0; j < cols; j++)+  for(int i = 0; i < rows; i++)+  {+    s += m1(i,j);+    p *= m1_for_prod(i,j);+    minc = (std::min)(numext::real(minc), numext::real(m1(i,j)));+    maxc = (std::max)(numext::real(maxc), numext::real(m1(i,j)));+  }+  const Scalar mean = s/Scalar(RealScalar(rows*cols));++  VERIFY_IS_APPROX(m1.sum(), s);+  VERIFY_IS_APPROX(m1.mean(), mean);+  VERIFY_IS_APPROX(m1_for_prod.prod(), p);+  VERIFY_IS_APPROX(m1.real().minCoeff(), numext::real(minc));+  VERIFY_IS_APPROX(m1.real().maxCoeff(), numext::real(maxc));++  // test slice vectorization assuming assign is ok+  Index r0 = internal::random<Index>(0,rows-1);+  Index c0 = internal::random<Index>(0,cols-1);+  Index r1 = internal::random<Index>(r0+1,rows)-r0;+  Index c1 = internal::random<Index>(c0+1,cols)-c0;+  VERIFY_IS_APPROX(m1.block(r0,c0,r1,c1).sum(), m1.block(r0,c0,r1,c1).eval().sum());+  VERIFY_IS_APPROX(m1.block(r0,c0,r1,c1).mean(), m1.block(r0,c0,r1,c1).eval().mean());+  VERIFY_IS_APPROX(m1_for_prod.block(r0,c0,r1,c1).prod(), m1_for_prod.block(r0,c0,r1,c1).eval().prod());+  VERIFY_IS_APPROX(m1.block(r0,c0,r1,c1).real().minCoeff(), m1.block(r0,c0,r1,c1).real().eval().minCoeff());+  VERIFY_IS_APPROX(m1.block(r0,c0,r1,c1).real().maxCoeff(), m1.block(r0,c0,r1,c1).real().eval().maxCoeff());++  // regression for bug 1090+  const int R1 = MatrixType::RowsAtCompileTime>=2 ? MatrixType::RowsAtCompileTime/2 : 6;+  const int C1 = MatrixType::ColsAtCompileTime>=2 ? MatrixType::ColsAtCompileTime/2 : 6;+  if(R1<=rows-r0 && C1<=cols-c0)+  {+    VERIFY_IS_APPROX( (m1.template block<R1,C1>(r0,c0).sum()), m1.block(r0,c0,R1,C1).sum() );+  }+  +  // test empty objects+  VERIFY_IS_APPROX(m1.block(r0,c0,0,0).sum(),   Scalar(0));+  VERIFY_IS_APPROX(m1.block(r0,c0,0,0).prod(),  Scalar(1));++  // test nesting complex expression+  VERIFY_EVALUATION_COUNT( (m1.matrix()*m1.matrix().transpose()).sum(), (MatrixType::IsVectorAtCompileTime && MatrixType::SizeAtCompileTime!=1 ? 0 : 1) );+  Matrix<Scalar, MatrixType::RowsAtCompileTime, MatrixType::RowsAtCompileTime> m2(rows,rows);+  m2.setRandom();+  VERIFY_EVALUATION_COUNT( ((m1.matrix()*m1.matrix().transpose())+m2).sum(),(MatrixType::IsVectorAtCompileTime && MatrixType::SizeAtCompileTime!=1 ? 0 : 1));+}++template<typename VectorType> void vectorRedux(const VectorType& w)+{+  using std::abs;+  typedef typename VectorType::Scalar Scalar;+  typedef typename NumTraits<Scalar>::Real RealScalar;+  Index size = w.size();++  VectorType v = VectorType::Random(size);+  VectorType v_for_prod = VectorType::Ones(size) + Scalar(0.2) * v; // see comment above declaration of m1_for_prod++  for(int i = 1; i < size; i++)+  {+    Scalar s(0), p(1);+    RealScalar minc(numext::real(v.coeff(0))), maxc(numext::real(v.coeff(0)));+    for(int j = 0; j < i; j++)+    {+      s += v[j];+      p *= v_for_prod[j];+      minc = (std::min)(minc, numext::real(v[j]));+      maxc = (std::max)(maxc, numext::real(v[j]));+    }+    VERIFY_IS_MUCH_SMALLER_THAN(abs(s - v.head(i).sum()), Scalar(1));+    VERIFY_IS_APPROX(p, v_for_prod.head(i).prod());+    VERIFY_IS_APPROX(minc, v.real().head(i).minCoeff());+    VERIFY_IS_APPROX(maxc, v.real().head(i).maxCoeff());+  }++  for(int i = 0; i < size-1; i++)+  {+    Scalar s(0), p(1);+    RealScalar minc(numext::real(v.coeff(i))), maxc(numext::real(v.coeff(i)));+    for(int j = i; j < size; j++)+    {+      s += v[j];+      p *= v_for_prod[j];+      minc = (std::min)(minc, numext::real(v[j]));+      maxc = (std::max)(maxc, numext::real(v[j]));+    }+    VERIFY_IS_MUCH_SMALLER_THAN(abs(s - v.tail(size-i).sum()), Scalar(1));+    VERIFY_IS_APPROX(p, v_for_prod.tail(size-i).prod());+    VERIFY_IS_APPROX(minc, v.real().tail(size-i).minCoeff());+    VERIFY_IS_APPROX(maxc, v.real().tail(size-i).maxCoeff());+  }++  for(int i = 0; i < size/2; i++)+  {+    Scalar s(0), p(1);+    RealScalar minc(numext::real(v.coeff(i))), maxc(numext::real(v.coeff(i)));+    for(int j = i; j < size-i; j++)+    {+      s += v[j];+      p *= v_for_prod[j];+      minc = (std::min)(minc, numext::real(v[j]));+      maxc = (std::max)(maxc, numext::real(v[j]));+    }+    VERIFY_IS_MUCH_SMALLER_THAN(abs(s - v.segment(i, size-2*i).sum()), Scalar(1));+    VERIFY_IS_APPROX(p, v_for_prod.segment(i, size-2*i).prod());+    VERIFY_IS_APPROX(minc, v.real().segment(i, size-2*i).minCoeff());+    VERIFY_IS_APPROX(maxc, v.real().segment(i, size-2*i).maxCoeff());+  }+  +  // test empty objects+  VERIFY_IS_APPROX(v.head(0).sum(),   Scalar(0));+  VERIFY_IS_APPROX(v.tail(0).prod(),  Scalar(1));+  VERIFY_RAISES_ASSERT(v.head(0).mean());+  VERIFY_RAISES_ASSERT(v.head(0).minCoeff());+  VERIFY_RAISES_ASSERT(v.head(0).maxCoeff());+}++void test_redux()+{+  // the max size cannot be too large, otherwise reduxion operations obviously generate large errors.+  int maxsize = (std::min)(100,EIGEN_TEST_MAX_SIZE);+  TEST_SET_BUT_UNUSED_VARIABLE(maxsize);+  for(int i = 0; i < g_repeat; i++) {+    CALL_SUBTEST_1( matrixRedux(Matrix<float, 1, 1>()) );+    CALL_SUBTEST_1( matrixRedux(Array<float, 1, 1>()) );+    CALL_SUBTEST_2( matrixRedux(Matrix2f()) );+    CALL_SUBTEST_2( matrixRedux(Array2f()) );+    CALL_SUBTEST_2( matrixRedux(Array22f()) );+    CALL_SUBTEST_3( matrixRedux(Matrix4d()) );+    CALL_SUBTEST_3( matrixRedux(Array4d()) );+    CALL_SUBTEST_3( matrixRedux(Array44d()) );+    CALL_SUBTEST_4( matrixRedux(MatrixXcf(internal::random<int>(1,maxsize), internal::random<int>(1,maxsize))) );+    CALL_SUBTEST_4( matrixRedux(ArrayXXcf(internal::random<int>(1,maxsize), internal::random<int>(1,maxsize))) );+    CALL_SUBTEST_5( matrixRedux(MatrixXd (internal::random<int>(1,maxsize), internal::random<int>(1,maxsize))) );+    CALL_SUBTEST_5( matrixRedux(ArrayXXd (internal::random<int>(1,maxsize), internal::random<int>(1,maxsize))) );+    CALL_SUBTEST_6( matrixRedux(MatrixXi (internal::random<int>(1,maxsize), internal::random<int>(1,maxsize))) );+    CALL_SUBTEST_6( matrixRedux(ArrayXXi (internal::random<int>(1,maxsize), internal::random<int>(1,maxsize))) );+  }+  for(int i = 0; i < g_repeat; i++) {+    CALL_SUBTEST_7( vectorRedux(Vector4f()) );+    CALL_SUBTEST_7( vectorRedux(Array4f()) );+    CALL_SUBTEST_5( vectorRedux(VectorXd(internal::random<int>(1,maxsize))) );+    CALL_SUBTEST_5( vectorRedux(ArrayXd(internal::random<int>(1,maxsize))) );+    CALL_SUBTEST_8( vectorRedux(VectorXf(internal::random<int>(1,maxsize))) );+    CALL_SUBTEST_8( vectorRedux(ArrayXf(internal::random<int>(1,maxsize))) );+  }+}
+ eigen3/test/ref.cpp view
@@ -0,0 +1,290 @@+// This file is part of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 20013 Gael Guennebaud <gael.guennebaud@inria.fr>+//+// 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 unit test cannot be easily written to work with EIGEN_DEFAULT_TO_ROW_MAJOR+#ifdef EIGEN_DEFAULT_TO_ROW_MAJOR+#undef EIGEN_DEFAULT_TO_ROW_MAJOR+#endif++#define TEST_ENABLE_TEMPORARY_TRACKING+#define TEST_CHECK_STATIC_ASSERTIONS+#include "main.h"++// test Ref.h++// Deal with i387 extended precision+#if EIGEN_ARCH_i386 && !(EIGEN_ARCH_x86_64)++#if EIGEN_COMP_GNUC_STRICT && EIGEN_GNUC_AT_LEAST(4,4)+#pragma GCC optimize ("-ffloat-store")+#else+#undef VERIFY_IS_EQUAL+#define VERIFY_IS_EQUAL(X,Y) VERIFY_IS_APPROX(X,Y)+#endif++#endif++template<typename MatrixType> void ref_matrix(const MatrixType& m)+{+  typedef typename MatrixType::Scalar Scalar;+  typedef typename MatrixType::RealScalar RealScalar;+  typedef Matrix<Scalar,Dynamic,Dynamic,MatrixType::Options> DynMatrixType;+  typedef Matrix<RealScalar,Dynamic,Dynamic,MatrixType::Options> RealDynMatrixType;+  +  typedef Ref<MatrixType> RefMat;+  typedef Ref<DynMatrixType> RefDynMat;+  typedef Ref<const DynMatrixType> ConstRefDynMat;+  typedef Ref<RealDynMatrixType , 0, Stride<Dynamic,Dynamic> > RefRealMatWithStride;++  Index rows = m.rows(), cols = m.cols();+  +  MatrixType  m1 = MatrixType::Random(rows, cols),+              m2 = m1;+  +  Index i = internal::random<Index>(0,rows-1);+  Index j = internal::random<Index>(0,cols-1);+  Index brows = internal::random<Index>(1,rows-i);+  Index bcols = internal::random<Index>(1,cols-j);+  +  RefMat rm0 = m1;+  VERIFY_IS_EQUAL(rm0, m1);+  RefDynMat rm1 = m1;+  VERIFY_IS_EQUAL(rm1, m1);+  RefDynMat rm2 = m1.block(i,j,brows,bcols);+  VERIFY_IS_EQUAL(rm2, m1.block(i,j,brows,bcols));+  rm2.setOnes();+  m2.block(i,j,brows,bcols).setOnes();+  VERIFY_IS_EQUAL(m1, m2);+  +  m2.block(i,j,brows,bcols).setRandom();+  rm2 = m2.block(i,j,brows,bcols);+  VERIFY_IS_EQUAL(m1, m2);+  +  ConstRefDynMat rm3 = m1.block(i,j,brows,bcols);+  m1.block(i,j,brows,bcols) *= 2;+  m2.block(i,j,brows,bcols) *= 2;+  VERIFY_IS_EQUAL(rm3, m2.block(i,j,brows,bcols));+  RefRealMatWithStride rm4 = m1.real();+  VERIFY_IS_EQUAL(rm4, m2.real());+  rm4.array() += 1;+  m2.real().array() += 1;+  VERIFY_IS_EQUAL(m1, m2);+}++template<typename VectorType> void ref_vector(const VectorType& m)+{+  typedef typename VectorType::Scalar Scalar;+  typedef typename VectorType::RealScalar RealScalar;+  typedef Matrix<Scalar,Dynamic,1,VectorType::Options> DynMatrixType;+  typedef Matrix<Scalar,Dynamic,Dynamic,ColMajor> MatrixType;+  typedef Matrix<RealScalar,Dynamic,1,VectorType::Options> RealDynMatrixType;+  +  typedef Ref<VectorType> RefMat;+  typedef Ref<DynMatrixType> RefDynMat;+  typedef Ref<const DynMatrixType> ConstRefDynMat;+  typedef Ref<RealDynMatrixType , 0, InnerStride<> > RefRealMatWithStride;+  typedef Ref<DynMatrixType , 0, InnerStride<> > RefMatWithStride;++  Index size = m.size();+  +  VectorType  v1 = VectorType::Random(size),+              v2 = v1;+  MatrixType mat1 = MatrixType::Random(size,size),+             mat2 = mat1,+             mat3 = MatrixType::Random(size,size);+  +  Index i = internal::random<Index>(0,size-1);+  Index bsize = internal::random<Index>(1,size-i);+  +  RefMat rm0 = v1;+  VERIFY_IS_EQUAL(rm0, v1);+  RefDynMat rv1 = v1;+  VERIFY_IS_EQUAL(rv1, v1);+  RefDynMat rv2 = v1.segment(i,bsize);+  VERIFY_IS_EQUAL(rv2, v1.segment(i,bsize));+  rv2.setOnes();+  v2.segment(i,bsize).setOnes();+  VERIFY_IS_EQUAL(v1, v2);+  +  v2.segment(i,bsize).setRandom();+  rv2 = v2.segment(i,bsize);+  VERIFY_IS_EQUAL(v1, v2);+  +  ConstRefDynMat rm3 = v1.segment(i,bsize);+  v1.segment(i,bsize) *= 2;+  v2.segment(i,bsize) *= 2;+  VERIFY_IS_EQUAL(rm3, v2.segment(i,bsize));+  +  RefRealMatWithStride rm4 = v1.real();+  VERIFY_IS_EQUAL(rm4, v2.real());+  rm4.array() += 1;+  v2.real().array() += 1;+  VERIFY_IS_EQUAL(v1, v2);+  +  RefMatWithStride rm5 = mat1.row(i).transpose();+  VERIFY_IS_EQUAL(rm5, mat1.row(i).transpose());+  rm5.array() += 1;+  mat2.row(i).array() += 1;+  VERIFY_IS_EQUAL(mat1, mat2);+  rm5.noalias() = rm4.transpose() * mat3;+  mat2.row(i) = v2.real().transpose() * mat3;+  VERIFY_IS_APPROX(mat1, mat2);+}++template<typename PlainObjectType> void check_const_correctness(const PlainObjectType&)+{+  // verify that ref-to-const don't have LvalueBit+  typedef typename internal::add_const<PlainObjectType>::type ConstPlainObjectType;+  VERIFY( !(internal::traits<Ref<ConstPlainObjectType> >::Flags & LvalueBit) );+  VERIFY( !(internal::traits<Ref<ConstPlainObjectType, Aligned> >::Flags & LvalueBit) );+  VERIFY( !(Ref<ConstPlainObjectType>::Flags & LvalueBit) );+  VERIFY( !(Ref<ConstPlainObjectType, Aligned>::Flags & LvalueBit) );+}++template<typename B>+EIGEN_DONT_INLINE void call_ref_1(Ref<VectorXf> a, const B &b) { VERIFY_IS_EQUAL(a,b); }+template<typename B>+EIGEN_DONT_INLINE void call_ref_2(const Ref<const VectorXf>& a, const B &b) { VERIFY_IS_EQUAL(a,b); }+template<typename B>+EIGEN_DONT_INLINE void call_ref_3(Ref<VectorXf,0,InnerStride<> > a, const B &b) { VERIFY_IS_EQUAL(a,b); }+template<typename B>+EIGEN_DONT_INLINE void call_ref_4(const Ref<const VectorXf,0,InnerStride<> >& a, const B &b) { VERIFY_IS_EQUAL(a,b); }+template<typename B>+EIGEN_DONT_INLINE void call_ref_5(Ref<MatrixXf,0,OuterStride<> > a, const B &b) { VERIFY_IS_EQUAL(a,b); }+template<typename B>+EIGEN_DONT_INLINE void call_ref_6(const Ref<const MatrixXf,0,OuterStride<> >& a, const B &b) { VERIFY_IS_EQUAL(a,b); }+template<typename B>+EIGEN_DONT_INLINE void call_ref_7(Ref<Matrix<float,Dynamic,3> > a, const B &b) { VERIFY_IS_EQUAL(a,b); }++void call_ref()+{+  VectorXcf ca  = VectorXcf::Random(10);+  VectorXf a    = VectorXf::Random(10);+  RowVectorXf b = RowVectorXf::Random(10);+  MatrixXf A    = MatrixXf::Random(10,10);+  RowVector3f c = RowVector3f::Random();+  const VectorXf& ac(a);+  VectorBlock<VectorXf> ab(a,0,3);+  const VectorBlock<VectorXf> abc(a,0,3);+  ++  VERIFY_EVALUATION_COUNT( call_ref_1(a,a), 0);+  VERIFY_EVALUATION_COUNT( call_ref_1(b,b.transpose()), 0);+//   call_ref_1(ac,a<c);           // does not compile because ac is const+  VERIFY_EVALUATION_COUNT( call_ref_1(ab,ab), 0);+  VERIFY_EVALUATION_COUNT( call_ref_1(a.head(4),a.head(4)), 0);+  VERIFY_EVALUATION_COUNT( call_ref_1(abc,abc), 0);+  VERIFY_EVALUATION_COUNT( call_ref_1(A.col(3),A.col(3)), 0);+//   call_ref_1(A.row(3),A.row(3));    // does not compile because innerstride!=1+  VERIFY_EVALUATION_COUNT( call_ref_3(A.row(3),A.row(3).transpose()), 0);+  VERIFY_EVALUATION_COUNT( call_ref_4(A.row(3),A.row(3).transpose()), 0);+//   call_ref_1(a+a, a+a);          // does not compile for obvious reason++  MatrixXf tmp = A*A.col(1);+  VERIFY_EVALUATION_COUNT( call_ref_2(A*A.col(1), tmp), 1);     // evaluated into a temp+  VERIFY_EVALUATION_COUNT( call_ref_2(ac.head(5),ac.head(5)), 0);+  VERIFY_EVALUATION_COUNT( call_ref_2(ac,ac), 0);+  VERIFY_EVALUATION_COUNT( call_ref_2(a,a), 0);+  VERIFY_EVALUATION_COUNT( call_ref_2(ab,ab), 0);+  VERIFY_EVALUATION_COUNT( call_ref_2(a.head(4),a.head(4)), 0);+  tmp = a+a;+  VERIFY_EVALUATION_COUNT( call_ref_2(a+a,tmp), 1);            // evaluated into a temp+  VERIFY_EVALUATION_COUNT( call_ref_2(ca.imag(),ca.imag()), 1);      // evaluated into a temp++  VERIFY_EVALUATION_COUNT( call_ref_4(ac.head(5),ac.head(5)), 0);+  tmp = a+a;+  VERIFY_EVALUATION_COUNT( call_ref_4(a+a,tmp), 1);           // evaluated into a temp+  VERIFY_EVALUATION_COUNT( call_ref_4(ca.imag(),ca.imag()), 0);++  VERIFY_EVALUATION_COUNT( call_ref_5(a,a), 0);+  VERIFY_EVALUATION_COUNT( call_ref_5(a.head(3),a.head(3)), 0);+  VERIFY_EVALUATION_COUNT( call_ref_5(A,A), 0);+//   call_ref_5(A.transpose(),A.transpose());   // does not compile because storage order does not match+  VERIFY_EVALUATION_COUNT( call_ref_5(A.block(1,1,2,2),A.block(1,1,2,2)), 0);+  VERIFY_EVALUATION_COUNT( call_ref_5(b,b), 0);             // storage order do not match, but this is a degenerate case that should work+  VERIFY_EVALUATION_COUNT( call_ref_5(a.row(3),a.row(3)), 0);++  VERIFY_EVALUATION_COUNT( call_ref_6(a,a), 0);+  VERIFY_EVALUATION_COUNT( call_ref_6(a.head(3),a.head(3)), 0);+  VERIFY_EVALUATION_COUNT( call_ref_6(A.row(3),A.row(3)), 1);           // evaluated into a temp thouth it could be avoided by viewing it as a 1xn matrix+  tmp = A+A;+  VERIFY_EVALUATION_COUNT( call_ref_6(A+A,tmp), 1);                // evaluated into a temp+  VERIFY_EVALUATION_COUNT( call_ref_6(A,A), 0);+  VERIFY_EVALUATION_COUNT( call_ref_6(A.transpose(),A.transpose()), 1);      // evaluated into a temp because the storage orders do not match+  VERIFY_EVALUATION_COUNT( call_ref_6(A.block(1,1,2,2),A.block(1,1,2,2)), 0);+  +  VERIFY_EVALUATION_COUNT( call_ref_7(c,c), 0);+}++typedef Matrix<double,Dynamic,Dynamic,RowMajor> RowMatrixXd;+int test_ref_overload_fun1(Ref<MatrixXd> )       { return 1; }+int test_ref_overload_fun1(Ref<RowMatrixXd> )    { return 2; }+int test_ref_overload_fun1(Ref<MatrixXf> )       { return 3; }++int test_ref_overload_fun2(Ref<const MatrixXd> ) { return 4; }+int test_ref_overload_fun2(Ref<const MatrixXf> ) { return 5; }++void test_ref_ambiguous(const Ref<const ArrayXd> &A, Ref<ArrayXd> B)+{+  B = A;+  B = A - A;+}++// See also bug 969+void test_ref_overloads()+{+  MatrixXd Ad, Bd;+  RowMatrixXd rAd, rBd;+  VERIFY( test_ref_overload_fun1(Ad)==1 );+  VERIFY( test_ref_overload_fun1(rAd)==2 );+  +  MatrixXf Af, Bf;+  VERIFY( test_ref_overload_fun2(Ad)==4 );+  VERIFY( test_ref_overload_fun2(Ad+Bd)==4 );+  VERIFY( test_ref_overload_fun2(Af+Bf)==5 );+  +  ArrayXd A, B;+  test_ref_ambiguous(A, B);+}++void test_ref_fixed_size_assert()+{+  Vector4f v4;+  VectorXf vx(10);+  VERIFY_RAISES_STATIC_ASSERT( Ref<Vector3f> y = v4; (void)y; );+  VERIFY_RAISES_STATIC_ASSERT( Ref<Vector3f> y = vx.head<4>(); (void)y; );+  VERIFY_RAISES_STATIC_ASSERT( Ref<const Vector3f> y = v4; (void)y; );+  VERIFY_RAISES_STATIC_ASSERT( Ref<const Vector3f> y = vx.head<4>(); (void)y; );+  VERIFY_RAISES_STATIC_ASSERT( Ref<const Vector3f> y = 2*v4; (void)y; );+}++void test_ref()+{+  for(int i = 0; i < g_repeat; i++) {+    CALL_SUBTEST_1( ref_vector(Matrix<float, 1, 1>()) );+    CALL_SUBTEST_1( check_const_correctness(Matrix<float, 1, 1>()) );+    CALL_SUBTEST_2( ref_vector(Vector4d()) );+    CALL_SUBTEST_2( check_const_correctness(Matrix4d()) );+    CALL_SUBTEST_3( ref_vector(Vector4cf()) );+    CALL_SUBTEST_4( ref_vector(VectorXcf(8)) );+    CALL_SUBTEST_5( ref_vector(VectorXi(12)) );+    CALL_SUBTEST_5( check_const_correctness(VectorXi(12)) );++    CALL_SUBTEST_1( ref_matrix(Matrix<float, 1, 1>()) );+    CALL_SUBTEST_2( ref_matrix(Matrix4d()) );+    CALL_SUBTEST_1( ref_matrix(Matrix<float,3,5>()) );+    CALL_SUBTEST_4( ref_matrix(MatrixXcf(internal::random<int>(1,10),internal::random<int>(1,10))) );+    CALL_SUBTEST_4( ref_matrix(Matrix<std::complex<double>,10,15>()) );+    CALL_SUBTEST_5( ref_matrix(MatrixXi(internal::random<int>(1,10),internal::random<int>(1,10))) );+    CALL_SUBTEST_6( call_ref() );+  }+  +  CALL_SUBTEST_7( test_ref_overloads() );+  CALL_SUBTEST_7( test_ref_fixed_size_assert() );+}
+ eigen3/test/resize.cpp view
@@ -0,0 +1,41 @@+// This file is part of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2009 Keir Mierle <mierle@gmail.com>+//+// 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<DenseIndex rows, DenseIndex cols>+void resizeLikeTest()+{+  MatrixXf A(rows, cols);+  MatrixXf B;+  Matrix<double, rows, cols> C;+  B.resizeLike(A);+  C.resizeLike(B);  // Shouldn't crash.+  VERIFY(B.rows() == rows && B.cols() == cols);++  VectorXf x(rows);+  RowVectorXf y;+  y.resizeLike(x);+  VERIFY(y.rows() == 1 && y.cols() == rows);++  y.resize(cols);+  x.resizeLike(y);+  VERIFY(x.rows() == cols && x.cols() == 1);+}++void resizeLikeTest12() { resizeLikeTest<1,2>(); }+void resizeLikeTest1020() { resizeLikeTest<10,20>(); }+void resizeLikeTest31() { resizeLikeTest<3,1>(); }++void test_resize()+{+  CALL_SUBTEST(resizeLikeTest12() );+  CALL_SUBTEST(resizeLikeTest1020() );+  CALL_SUBTEST(resizeLikeTest31() );+}
+ eigen3/test/rvalue_types.cpp view
@@ -0,0 +1,64 @@+// This file is part of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2013 Hauke Heibel <hauke.heibel@gmail.com>+//+// 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 <Eigen/Core>++using internal::UIntPtr;++#if EIGEN_HAS_RVALUE_REFERENCES+template <typename MatrixType>+void rvalue_copyassign(const MatrixType& m)+{++  typedef typename internal::traits<MatrixType>::Scalar Scalar;+  +  // create a temporary which we are about to destroy by moving+  MatrixType tmp = m;+  UIntPtr src_address = reinterpret_cast<UIntPtr>(tmp.data());+  +  // move the temporary to n+  MatrixType n = std::move(tmp);+  UIntPtr dst_address = reinterpret_cast<UIntPtr>(n.data());++  if (MatrixType::RowsAtCompileTime==Dynamic|| MatrixType::ColsAtCompileTime==Dynamic)+  {+    // verify that we actually moved the guts+    VERIFY_IS_EQUAL(src_address, dst_address);+  }++  // verify that the content did not change+  Scalar abs_diff = (m-n).array().abs().sum();+  VERIFY_IS_EQUAL(abs_diff, Scalar(0));+}+#else+template <typename MatrixType>+void rvalue_copyassign(const MatrixType&) {}+#endif++void test_rvalue_types()+{+  CALL_SUBTEST_1(rvalue_copyassign( MatrixXf::Random(50,50).eval() ));+  CALL_SUBTEST_1(rvalue_copyassign( ArrayXXf::Random(50,50).eval() ));++  CALL_SUBTEST_1(rvalue_copyassign( Matrix<float,1,Dynamic>::Random(50).eval() ));+  CALL_SUBTEST_1(rvalue_copyassign( Array<float,1,Dynamic>::Random(50).eval() ));++  CALL_SUBTEST_1(rvalue_copyassign( Matrix<float,Dynamic,1>::Random(50).eval() ));+  CALL_SUBTEST_1(rvalue_copyassign( Array<float,Dynamic,1>::Random(50).eval() ));+  +  CALL_SUBTEST_2(rvalue_copyassign( Array<float,2,1>::Random().eval() ));+  CALL_SUBTEST_2(rvalue_copyassign( Array<float,3,1>::Random().eval() ));+  CALL_SUBTEST_2(rvalue_copyassign( Array<float,4,1>::Random().eval() ));++  CALL_SUBTEST_2(rvalue_copyassign( Array<float,2,2>::Random().eval() ));+  CALL_SUBTEST_2(rvalue_copyassign( Array<float,3,3>::Random().eval() ));+  CALL_SUBTEST_2(rvalue_copyassign( Array<float,4,4>::Random().eval() ));+}
+ eigen3/test/schur_complex.cpp view
@@ -0,0 +1,91 @@+// This file is part of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2010,2012 Jitse Niesen <jitse@maths.leeds.ac.uk>+//+// 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 <limits>+#include <Eigen/Eigenvalues>++template<typename MatrixType> void schur(int size = MatrixType::ColsAtCompileTime)+{+  typedef typename ComplexSchur<MatrixType>::ComplexScalar ComplexScalar;+  typedef typename ComplexSchur<MatrixType>::ComplexMatrixType ComplexMatrixType;++  // Test basic functionality: T is triangular and A = U T U*+  for(int counter = 0; counter < g_repeat; ++counter) {+    MatrixType A = MatrixType::Random(size, size);+    ComplexSchur<MatrixType> schurOfA(A);+    VERIFY_IS_EQUAL(schurOfA.info(), Success);+    ComplexMatrixType U = schurOfA.matrixU();+    ComplexMatrixType T = schurOfA.matrixT();+    for(int row = 1; row < size; ++row) {+      for(int col = 0; col < row; ++col) {+        VERIFY(T(row,col) == (typename MatrixType::Scalar)0);+      }+    }+    VERIFY_IS_APPROX(A.template cast<ComplexScalar>(), U * T * U.adjoint());+  }++  // Test asserts when not initialized+  ComplexSchur<MatrixType> csUninitialized;+  VERIFY_RAISES_ASSERT(csUninitialized.matrixT());+  VERIFY_RAISES_ASSERT(csUninitialized.matrixU());+  VERIFY_RAISES_ASSERT(csUninitialized.info());+  +  // Test whether compute() and constructor returns same result+  MatrixType A = MatrixType::Random(size, size);+  ComplexSchur<MatrixType> cs1;+  cs1.compute(A);+  ComplexSchur<MatrixType> cs2(A);+  VERIFY_IS_EQUAL(cs1.info(), Success);+  VERIFY_IS_EQUAL(cs2.info(), Success);+  VERIFY_IS_EQUAL(cs1.matrixT(), cs2.matrixT());+  VERIFY_IS_EQUAL(cs1.matrixU(), cs2.matrixU());++  // Test maximum number of iterations+  ComplexSchur<MatrixType> cs3;+  cs3.setMaxIterations(ComplexSchur<MatrixType>::m_maxIterationsPerRow * size).compute(A);+  VERIFY_IS_EQUAL(cs3.info(), Success);+  VERIFY_IS_EQUAL(cs3.matrixT(), cs1.matrixT());+  VERIFY_IS_EQUAL(cs3.matrixU(), cs1.matrixU());+  cs3.setMaxIterations(1).compute(A);+  VERIFY_IS_EQUAL(cs3.info(), size > 1 ? NoConvergence : Success);+  VERIFY_IS_EQUAL(cs3.getMaxIterations(), 1);++  MatrixType Atriangular = A;+  Atriangular.template triangularView<StrictlyLower>().setZero(); +  cs3.setMaxIterations(1).compute(Atriangular); // triangular matrices do not need any iterations+  VERIFY_IS_EQUAL(cs3.info(), Success);+  VERIFY_IS_EQUAL(cs3.matrixT(), Atriangular.template cast<ComplexScalar>());+  VERIFY_IS_EQUAL(cs3.matrixU(), ComplexMatrixType::Identity(size, size));++  // Test computation of only T, not U+  ComplexSchur<MatrixType> csOnlyT(A, false);+  VERIFY_IS_EQUAL(csOnlyT.info(), Success);+  VERIFY_IS_EQUAL(cs1.matrixT(), csOnlyT.matrixT());+  VERIFY_RAISES_ASSERT(csOnlyT.matrixU());++  if (size > 1 && size < 20)+  {+    // Test matrix with NaN+    A(0,0) = std::numeric_limits<typename MatrixType::RealScalar>::quiet_NaN();+    ComplexSchur<MatrixType> csNaN(A);+    VERIFY_IS_EQUAL(csNaN.info(), NoConvergence);+  }+}++void test_schur_complex()+{+  CALL_SUBTEST_1(( schur<Matrix4cd>() ));+  CALL_SUBTEST_2(( schur<MatrixXcf>(internal::random<int>(1,EIGEN_TEST_MAX_SIZE/4)) ));+  CALL_SUBTEST_3(( schur<Matrix<std::complex<float>, 1, 1> >() ));+  CALL_SUBTEST_4(( schur<Matrix<float, 3, 3, Eigen::RowMajor> >() ));++  // Test problem size constructors+  CALL_SUBTEST_5(ComplexSchur<MatrixXf>(10));+}
+ eigen3/test/schur_real.cpp view
@@ -0,0 +1,110 @@+// This file is part of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2010,2012 Jitse Niesen <jitse@maths.leeds.ac.uk>+//+// 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 <limits>+#include <Eigen/Eigenvalues>++template<typename MatrixType> void verifyIsQuasiTriangular(const MatrixType& T)+{+  const Index size = T.cols();+  typedef typename MatrixType::Scalar Scalar;++  // Check T is lower Hessenberg+  for(int row = 2; row < size; ++row) {+    for(int col = 0; col < row - 1; ++col) {+      VERIFY(T(row,col) == Scalar(0));+    }+  }++  // Check that any non-zero on the subdiagonal is followed by a zero and is+  // part of a 2x2 diagonal block with imaginary eigenvalues.+  for(int row = 1; row < size; ++row) {+    if (T(row,row-1) != Scalar(0)) {+      VERIFY(row == size-1 || T(row+1,row) == 0);+      Scalar tr = T(row-1,row-1) + T(row,row);+      Scalar det = T(row-1,row-1) * T(row,row) - T(row-1,row) * T(row,row-1);+      VERIFY(4 * det > tr * tr);+    }+  }+}++template<typename MatrixType> void schur(int size = MatrixType::ColsAtCompileTime)+{+  // Test basic functionality: T is quasi-triangular and A = U T U*+  for(int counter = 0; counter < g_repeat; ++counter) {+    MatrixType A = MatrixType::Random(size, size);+    RealSchur<MatrixType> schurOfA(A);+    VERIFY_IS_EQUAL(schurOfA.info(), Success);+    MatrixType U = schurOfA.matrixU();+    MatrixType T = schurOfA.matrixT();+    verifyIsQuasiTriangular(T);+    VERIFY_IS_APPROX(A, U * T * U.transpose());+  }++  // Test asserts when not initialized+  RealSchur<MatrixType> rsUninitialized;+  VERIFY_RAISES_ASSERT(rsUninitialized.matrixT());+  VERIFY_RAISES_ASSERT(rsUninitialized.matrixU());+  VERIFY_RAISES_ASSERT(rsUninitialized.info());+  +  // Test whether compute() and constructor returns same result+  MatrixType A = MatrixType::Random(size, size);+  RealSchur<MatrixType> rs1;+  rs1.compute(A);+  RealSchur<MatrixType> rs2(A);+  VERIFY_IS_EQUAL(rs1.info(), Success);+  VERIFY_IS_EQUAL(rs2.info(), Success);+  VERIFY_IS_EQUAL(rs1.matrixT(), rs2.matrixT());+  VERIFY_IS_EQUAL(rs1.matrixU(), rs2.matrixU());++  // Test maximum number of iterations+  RealSchur<MatrixType> rs3;+  rs3.setMaxIterations(RealSchur<MatrixType>::m_maxIterationsPerRow * size).compute(A);+  VERIFY_IS_EQUAL(rs3.info(), Success);+  VERIFY_IS_EQUAL(rs3.matrixT(), rs1.matrixT());+  VERIFY_IS_EQUAL(rs3.matrixU(), rs1.matrixU());+  if (size > 2) {+    rs3.setMaxIterations(1).compute(A);+    VERIFY_IS_EQUAL(rs3.info(), NoConvergence);+    VERIFY_IS_EQUAL(rs3.getMaxIterations(), 1);+  }++  MatrixType Atriangular = A;+  Atriangular.template triangularView<StrictlyLower>().setZero(); +  rs3.setMaxIterations(1).compute(Atriangular); // triangular matrices do not need any iterations+  VERIFY_IS_EQUAL(rs3.info(), Success);+  VERIFY_IS_APPROX(rs3.matrixT(), Atriangular); // approx because of scaling...+  VERIFY_IS_EQUAL(rs3.matrixU(), MatrixType::Identity(size, size));++  // Test computation of only T, not U+  RealSchur<MatrixType> rsOnlyT(A, false);+  VERIFY_IS_EQUAL(rsOnlyT.info(), Success);+  VERIFY_IS_EQUAL(rs1.matrixT(), rsOnlyT.matrixT());+  VERIFY_RAISES_ASSERT(rsOnlyT.matrixU());++  if (size > 2 && size < 20)+  {+    // Test matrix with NaN+    A(0,0) = std::numeric_limits<typename MatrixType::Scalar>::quiet_NaN();+    RealSchur<MatrixType> rsNaN(A);+    VERIFY_IS_EQUAL(rsNaN.info(), NoConvergence);+  }+}++void test_schur_real()+{+  CALL_SUBTEST_1(( schur<Matrix4f>() ));+  CALL_SUBTEST_2(( schur<MatrixXd>(internal::random<int>(1,EIGEN_TEST_MAX_SIZE/4)) ));+  CALL_SUBTEST_3(( schur<Matrix<float, 1, 1> >() ));+  CALL_SUBTEST_4(( schur<Matrix<double, 3, 3, Eigen::RowMajor> >() ));++  // Test problem size constructors+  CALL_SUBTEST_5(RealSchur<MatrixXf>(10));+}
+ eigen3/test/selfadjoint.cpp view
@@ -0,0 +1,75 @@+// This file is triangularView of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2010 Gael Guennebaud <gael.guennebaud@inria.fr>+//+// 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_CHECK_STATIC_ASSERTIONS+#include "main.h"++// This file tests the basic selfadjointView API,+// the related products and decompositions are tested in specific files.++template<typename MatrixType> void selfadjoint(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),+             m3(rows, cols),+             m4(rows, cols);++  m1.diagonal() = m1.diagonal().real().template cast<Scalar>();++  // check selfadjoint to dense+  m3 = m1.template selfadjointView<Upper>();+  VERIFY_IS_APPROX(MatrixType(m3.template triangularView<Upper>()), MatrixType(m1.template triangularView<Upper>()));+  VERIFY_IS_APPROX(m3, m3.adjoint());++  m3 = m1.template selfadjointView<Lower>();+  VERIFY_IS_APPROX(MatrixType(m3.template triangularView<Lower>()), MatrixType(m1.template triangularView<Lower>()));+  VERIFY_IS_APPROX(m3, m3.adjoint());++  m3 = m1.template selfadjointView<Upper>();+  m4 = m2;+  m4 += m1.template selfadjointView<Upper>();+  VERIFY_IS_APPROX(m4, m2+m3);++  m3 = m1.template selfadjointView<Lower>();+  m4 = m2;+  m4 -= m1.template selfadjointView<Lower>();+  VERIFY_IS_APPROX(m4, m2-m3);++  VERIFY_RAISES_STATIC_ASSERT(m2.template selfadjointView<StrictlyUpper>());+  VERIFY_RAISES_STATIC_ASSERT(m2.template selfadjointView<UnitLower>());+}++void bug_159()+{+  Matrix3d m = Matrix3d::Random().selfadjointView<Lower>();+  EIGEN_UNUSED_VARIABLE(m)+}++void test_selfadjoint()+{+  for(int i = 0; i < g_repeat ; i++)+  {+    int s = internal::random<int>(1,EIGEN_TEST_MAX_SIZE);++    CALL_SUBTEST_1( selfadjoint(Matrix<float, 1, 1>()) );+    CALL_SUBTEST_2( selfadjoint(Matrix<float, 2, 2>()) );+    CALL_SUBTEST_3( selfadjoint(Matrix3cf()) );+    CALL_SUBTEST_4( selfadjoint(MatrixXcd(s,s)) );+    CALL_SUBTEST_5( selfadjoint(Matrix<float,Dynamic,Dynamic,RowMajor>(s, s)) );+    +    TEST_SET_BUT_UNUSED_VARIABLE(s)+  }+  +  CALL_SUBTEST_1( bug_159() );+}
+ eigen3/test/simplicial_cholesky.cpp view
@@ -0,0 +1,47 @@+// This file is part of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2011 Gael Guennebaud <g.gael@free.fr>+//+// 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"++template<typename T, typename I> void test_simplicial_cholesky_T()+{+  typedef SparseMatrix<T,0,I> SparseMatrixType;+  SimplicialCholesky<SparseMatrixType, Lower> chol_colmajor_lower_amd;+  SimplicialCholesky<SparseMatrixType, Upper> chol_colmajor_upper_amd;+  SimplicialLLT<     SparseMatrixType, Lower> llt_colmajor_lower_amd;+  SimplicialLLT<     SparseMatrixType, Upper> llt_colmajor_upper_amd;+  SimplicialLDLT<    SparseMatrixType, Lower> ldlt_colmajor_lower_amd;+  SimplicialLDLT<    SparseMatrixType, Upper> ldlt_colmajor_upper_amd;+  SimplicialLDLT<    SparseMatrixType, Lower, NaturalOrdering<I> > ldlt_colmajor_lower_nat;+  SimplicialLDLT<    SparseMatrixType, Upper, NaturalOrdering<I> > ldlt_colmajor_upper_nat;++  check_sparse_spd_solving(chol_colmajor_lower_amd);+  check_sparse_spd_solving(chol_colmajor_upper_amd);+  check_sparse_spd_solving(llt_colmajor_lower_amd);+  check_sparse_spd_solving(llt_colmajor_upper_amd);+  check_sparse_spd_solving(ldlt_colmajor_lower_amd);+  check_sparse_spd_solving(ldlt_colmajor_upper_amd);+  +  check_sparse_spd_determinant(chol_colmajor_lower_amd);+  check_sparse_spd_determinant(chol_colmajor_upper_amd);+  check_sparse_spd_determinant(llt_colmajor_lower_amd);+  check_sparse_spd_determinant(llt_colmajor_upper_amd);+  check_sparse_spd_determinant(ldlt_colmajor_lower_amd);+  check_sparse_spd_determinant(ldlt_colmajor_upper_amd);+  +  check_sparse_spd_solving(ldlt_colmajor_lower_nat, 300, 1000);+  check_sparse_spd_solving(ldlt_colmajor_upper_nat, 300, 1000);+}++void test_simplicial_cholesky()+{+  CALL_SUBTEST_1(( test_simplicial_cholesky_T<double,int>() ));+  CALL_SUBTEST_2(( test_simplicial_cholesky_T<std::complex<double>, int>() ));+  CALL_SUBTEST_3(( test_simplicial_cholesky_T<double,long int>() ));+}
+ eigen3/test/sizeof.cpp view
@@ -0,0 +1,47 @@+// This file is part of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2008 Gael Guennebaud <gael.guennebaud@inria.fr>+//+// 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<typename MatrixType> void verifySizeOf(const MatrixType&)+{+  typedef typename MatrixType::Scalar Scalar;+  if (MatrixType::RowsAtCompileTime!=Dynamic && MatrixType::ColsAtCompileTime!=Dynamic)+    VERIFY_IS_EQUAL(std::ptrdiff_t(sizeof(MatrixType)),std::ptrdiff_t(sizeof(Scalar))*std::ptrdiff_t(MatrixType::SizeAtCompileTime));+  else+    VERIFY_IS_EQUAL(sizeof(MatrixType),sizeof(Scalar*) + 2 * sizeof(typename MatrixType::Index));+}++void test_sizeof()+{+  CALL_SUBTEST(verifySizeOf(Matrix<float, 1, 1>()) );+  CALL_SUBTEST(verifySizeOf(Array<float, 2, 1>()) );+  CALL_SUBTEST(verifySizeOf(Array<float, 3, 1>()) );+  CALL_SUBTEST(verifySizeOf(Array<float, 4, 1>()) );+  CALL_SUBTEST(verifySizeOf(Array<float, 5, 1>()) );+  CALL_SUBTEST(verifySizeOf(Array<float, 6, 1>()) );+  CALL_SUBTEST(verifySizeOf(Array<float, 7, 1>()) );+  CALL_SUBTEST(verifySizeOf(Array<float, 8, 1>()) );+  CALL_SUBTEST(verifySizeOf(Array<float, 9, 1>()) );+  CALL_SUBTEST(verifySizeOf(Array<float, 10, 1>()) );+  CALL_SUBTEST(verifySizeOf(Array<float, 11, 1>()) );+  CALL_SUBTEST(verifySizeOf(Array<float, 12, 1>()) );+  CALL_SUBTEST(verifySizeOf(Vector2d()) );+  CALL_SUBTEST(verifySizeOf(Vector4f()) );+  CALL_SUBTEST(verifySizeOf(Matrix4d()) );+  CALL_SUBTEST(verifySizeOf(Matrix<double, 4, 2>()) );+  CALL_SUBTEST(verifySizeOf(Matrix<bool, 7, 5>()) );+  CALL_SUBTEST(verifySizeOf(MatrixXcf(3, 3)) );+  CALL_SUBTEST(verifySizeOf(MatrixXi(8, 12)) );+  CALL_SUBTEST(verifySizeOf(MatrixXcd(20, 20)) );+  CALL_SUBTEST(verifySizeOf(Matrix<float, 100, 100>()) );+  +  VERIFY(sizeof(std::complex<float>) == 2*sizeof(float));+  VERIFY(sizeof(std::complex<double>) == 2*sizeof(double));+}
+ eigen3/test/sizeoverflow.cpp view
@@ -0,0 +1,64 @@+// This file is part of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2011 Benoit Jacob <jacob.benoit.1@gmail.com>+//+// 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 VERIFY_THROWS_BADALLOC(a) {                           \+    bool threw = false;                                       \+    try {                                                     \+      a;                                                      \+    }                                                         \+    catch (std::bad_alloc&) { threw = true; }                 \+    VERIFY(threw && "should have thrown bad_alloc: " #a);     \+  }++template<typename MatrixType>+void triggerMatrixBadAlloc(Index rows, Index cols)+{+  VERIFY_THROWS_BADALLOC( MatrixType m(rows, cols) );+  VERIFY_THROWS_BADALLOC( MatrixType m; m.resize(rows, cols) );+  VERIFY_THROWS_BADALLOC( MatrixType m; m.conservativeResize(rows, cols) );+}++template<typename VectorType>+void triggerVectorBadAlloc(Index size)+{+  VERIFY_THROWS_BADALLOC( VectorType v(size) );+  VERIFY_THROWS_BADALLOC( VectorType v; v.resize(size) );+  VERIFY_THROWS_BADALLOC( VectorType v; v.conservativeResize(size) );+}++void test_sizeoverflow()+{+  // there are 2 levels of overflow checking. first in PlainObjectBase.h we check for overflow in rows*cols computations.+  // this is tested in tests of the form times_itself_gives_0 * times_itself_gives_0+  // Then in Memory.h we check for overflow in size * sizeof(T) computations.+  // this is tested in tests of the form times_4_gives_0 * sizeof(float)+  +  size_t times_itself_gives_0 = size_t(1) << (8 * sizeof(Index) / 2);+  VERIFY(times_itself_gives_0 * times_itself_gives_0 == 0);++  size_t times_4_gives_0 = size_t(1) << (8 * sizeof(Index) - 2);+  VERIFY(times_4_gives_0 * 4 == 0);++  size_t times_8_gives_0 = size_t(1) << (8 * sizeof(Index) - 3);+  VERIFY(times_8_gives_0 * 8 == 0);++  triggerMatrixBadAlloc<MatrixXf>(times_itself_gives_0, times_itself_gives_0);+  triggerMatrixBadAlloc<MatrixXf>(times_itself_gives_0 / 4, times_itself_gives_0);+  triggerMatrixBadAlloc<MatrixXf>(times_4_gives_0, 1);++  triggerMatrixBadAlloc<MatrixXd>(times_itself_gives_0, times_itself_gives_0);+  triggerMatrixBadAlloc<MatrixXd>(times_itself_gives_0 / 8, times_itself_gives_0);+  triggerMatrixBadAlloc<MatrixXd>(times_8_gives_0, 1);+  +  triggerVectorBadAlloc<VectorXf>(times_4_gives_0);+  +  triggerVectorBadAlloc<VectorXd>(times_8_gives_0);+}
+ eigen3/test/smallvectors.cpp view
@@ -0,0 +1,67 @@+// This file is part of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2006-2008 Benoit Jacob <jacob.benoit.1@gmail.com>+//+// 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<typename Scalar> void smallVectors()+{+  typedef Matrix<Scalar, 1, 2> V2;+  typedef Matrix<Scalar, 3, 1> V3;+  typedef Matrix<Scalar, 1, 4> V4;+  typedef Matrix<Scalar, Dynamic, 1> VX;+  Scalar x1 = internal::random<Scalar>(),+         x2 = internal::random<Scalar>(),+         x3 = internal::random<Scalar>(),+         x4 = internal::random<Scalar>();+  V2 v2(x1, x2);+  V3 v3(x1, x2, x3);+  V4 v4(x1, x2, x3, x4);+  VERIFY_IS_APPROX(x1, v2.x());+  VERIFY_IS_APPROX(x1, v3.x());+  VERIFY_IS_APPROX(x1, v4.x());+  VERIFY_IS_APPROX(x2, v2.y());+  VERIFY_IS_APPROX(x2, v3.y());+  VERIFY_IS_APPROX(x2, v4.y());+  VERIFY_IS_APPROX(x3, v3.z());+  VERIFY_IS_APPROX(x3, v4.z());+  VERIFY_IS_APPROX(x4, v4.w());++  if (!NumTraits<Scalar>::IsInteger)+  {+    VERIFY_RAISES_ASSERT(V3(2, 1))+    VERIFY_RAISES_ASSERT(V3(3, 2))+    VERIFY_RAISES_ASSERT(V3(Scalar(3), 1))+    VERIFY_RAISES_ASSERT(V3(3, Scalar(1)))+    VERIFY_RAISES_ASSERT(V3(Scalar(3), Scalar(1)))+    VERIFY_RAISES_ASSERT(V3(Scalar(123), Scalar(123)))++    VERIFY_RAISES_ASSERT(V4(1, 3))+    VERIFY_RAISES_ASSERT(V4(2, 4))+    VERIFY_RAISES_ASSERT(V4(1, Scalar(4)))+    VERIFY_RAISES_ASSERT(V4(Scalar(1), 4))+    VERIFY_RAISES_ASSERT(V4(Scalar(1), Scalar(4)))+    VERIFY_RAISES_ASSERT(V4(Scalar(123), Scalar(123)))++    VERIFY_RAISES_ASSERT(VX(3, 2))+    VERIFY_RAISES_ASSERT(VX(Scalar(3), 1))+    VERIFY_RAISES_ASSERT(VX(3, Scalar(1)))+    VERIFY_RAISES_ASSERT(VX(Scalar(3), Scalar(1)))+    VERIFY_RAISES_ASSERT(VX(Scalar(123), Scalar(123)))+  }+}++void test_smallvectors()+{+  for(int i = 0; i < g_repeat; i++) {+    CALL_SUBTEST(smallVectors<int>() );+    CALL_SUBTEST(smallVectors<float>() );+    CALL_SUBTEST(smallVectors<double>() );+  }+}
+ eigen3/test/sparse.h view
@@ -0,0 +1,210 @@+// This file is part of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2008-2011 Gael Guennebaud <gael.guennebaud@inria.fr>+//+// 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_TESTSPARSE_H+#define EIGEN_TESTSPARSE_H++#define EIGEN_YES_I_KNOW_SPARSE_MODULE_IS_NOT_STABLE_YET++#include "main.h"++#if EIGEN_GNUC_AT_LEAST(4,0) && !defined __ICC && !defined(__clang__)++#ifdef min+#undef min+#endif++#ifdef max+#undef max+#endif++#include <tr1/unordered_map>+#define EIGEN_UNORDERED_MAP_SUPPORT+namespace std {+  using std::tr1::unordered_map;+}+#endif++#ifdef EIGEN_GOOGLEHASH_SUPPORT+  #include <google/sparse_hash_map>+#endif++#include <Eigen/Cholesky>+#include <Eigen/LU>+#include <Eigen/Sparse>++enum {+  ForceNonZeroDiag = 1,+  MakeLowerTriangular = 2,+  MakeUpperTriangular = 4,+  ForceRealDiag = 8+};++/* Initializes both a sparse and dense matrix with same random values,+ * and a ratio of \a density non zero entries.+ * \param flags is a union of ForceNonZeroDiag, MakeLowerTriangular and MakeUpperTriangular+ *        allowing to control the shape of the matrix.+ * \param zeroCoords and nonzeroCoords allows to get the coordinate lists of the non zero,+ *        and zero coefficients respectively.+ */+template<typename Scalar,int Opt1,int Opt2,typename StorageIndex> void+initSparse(double density,+           Matrix<Scalar,Dynamic,Dynamic,Opt1>& refMat,+           SparseMatrix<Scalar,Opt2,StorageIndex>& sparseMat,+           int flags = 0,+           std::vector<Matrix<StorageIndex,2,1> >* zeroCoords = 0,+           std::vector<Matrix<StorageIndex,2,1> >* nonzeroCoords = 0)+{+  enum { IsRowMajor = SparseMatrix<Scalar,Opt2,StorageIndex>::IsRowMajor };+  sparseMat.setZero();+  //sparseMat.reserve(int(refMat.rows()*refMat.cols()*density));+  sparseMat.reserve(VectorXi::Constant(IsRowMajor ? refMat.rows() : refMat.cols(), int((1.5*density)*(IsRowMajor?refMat.cols():refMat.rows()))));+  +  for(Index j=0; j<sparseMat.outerSize(); j++)+  {+    //sparseMat.startVec(j);+    for(Index i=0; i<sparseMat.innerSize(); i++)+    {+      Index ai(i), aj(j);+      if(IsRowMajor)+        std::swap(ai,aj);+      Scalar v = (internal::random<double>(0,1) < density) ? internal::random<Scalar>() : Scalar(0);+      if ((flags&ForceNonZeroDiag) && (i==j))+      {+        // FIXME: the following is too conservative+        v = internal::random<Scalar>()*Scalar(3.);+        v = v*v;+        if(numext::real(v)>0) v += Scalar(5);+        else                  v -= Scalar(5);+      }+      if ((flags & MakeLowerTriangular) && aj>ai)+        v = Scalar(0);+      else if ((flags & MakeUpperTriangular) && aj<ai)+        v = Scalar(0);++      if ((flags&ForceRealDiag) && (i==j))+        v = numext::real(v);++      if (v!=Scalar(0))+      {+        //sparseMat.insertBackByOuterInner(j,i) = v;+        sparseMat.insertByOuterInner(j,i) = v;+        if (nonzeroCoords)+          nonzeroCoords->push_back(Matrix<StorageIndex,2,1> (ai,aj));+      }+      else if (zeroCoords)+      {+        zeroCoords->push_back(Matrix<StorageIndex,2,1> (ai,aj));+      }+      refMat(ai,aj) = v;+    }+  }+  //sparseMat.finalize();+}++template<typename Scalar,int Opt1,int Opt2,typename Index> void+initSparse(double density,+           Matrix<Scalar,Dynamic,Dynamic, Opt1>& refMat,+           DynamicSparseMatrix<Scalar, Opt2, Index>& sparseMat,+           int flags = 0,+           std::vector<Matrix<Index,2,1> >* zeroCoords = 0,+           std::vector<Matrix<Index,2,1> >* nonzeroCoords = 0)+{+  enum { IsRowMajor = DynamicSparseMatrix<Scalar,Opt2,Index>::IsRowMajor };+  sparseMat.setZero();+  sparseMat.reserve(int(refMat.rows()*refMat.cols()*density));+  for(int j=0; j<sparseMat.outerSize(); j++)+  {+    sparseMat.startVec(j); // not needed for DynamicSparseMatrix+    for(int i=0; i<sparseMat.innerSize(); i++)+    {+      int ai(i), aj(j);+      if(IsRowMajor)+        std::swap(ai,aj);+      Scalar v = (internal::random<double>(0,1) < density) ? internal::random<Scalar>() : Scalar(0);+      if ((flags&ForceNonZeroDiag) && (i==j))+      {+        v = internal::random<Scalar>()*Scalar(3.);+        v = v*v + Scalar(5.);+      }+      if ((flags & MakeLowerTriangular) && aj>ai)+        v = Scalar(0);+      else if ((flags & MakeUpperTriangular) && aj<ai)+        v = Scalar(0);++      if ((flags&ForceRealDiag) && (i==j))+        v = numext::real(v);++      if (v!=Scalar(0))+      {+        sparseMat.insertBackByOuterInner(j,i) = v;+        if (nonzeroCoords)+          nonzeroCoords->push_back(Matrix<Index,2,1> (ai,aj));+      }+      else if (zeroCoords)+      {+        zeroCoords->push_back(Matrix<Index,2,1> (ai,aj));+      }+      refMat(ai,aj) = v;+    }+  }+  sparseMat.finalize();+}++template<typename Scalar,int Options,typename Index> void+initSparse(double density,+           Matrix<Scalar,Dynamic,1>& refVec,+           SparseVector<Scalar,Options,Index>& sparseVec,+           std::vector<int>* zeroCoords = 0,+           std::vector<int>* nonzeroCoords = 0)+{+  sparseVec.reserve(int(refVec.size()*density));+  sparseVec.setZero();+  for(int i=0; i<refVec.size(); i++)+  {+    Scalar v = (internal::random<double>(0,1) < density) ? internal::random<Scalar>() : Scalar(0);+    if (v!=Scalar(0))+    {+      sparseVec.insertBack(i) = v;+      if (nonzeroCoords)+        nonzeroCoords->push_back(i);+    }+    else if (zeroCoords)+        zeroCoords->push_back(i);+    refVec[i] = v;+  }+}++template<typename Scalar,int Options,typename Index> void+initSparse(double density,+           Matrix<Scalar,1,Dynamic>& refVec,+           SparseVector<Scalar,Options,Index>& sparseVec,+           std::vector<int>* zeroCoords = 0,+           std::vector<int>* nonzeroCoords = 0)+{+  sparseVec.reserve(int(refVec.size()*density));+  sparseVec.setZero();+  for(int i=0; i<refVec.size(); i++)+  {+    Scalar v = (internal::random<double>(0,1) < density) ? internal::random<Scalar>() : Scalar(0);+    if (v!=Scalar(0))+    {+      sparseVec.insertBack(i) = v;+      if (nonzeroCoords)+        nonzeroCoords->push_back(i);+    }+    else if (zeroCoords)+        zeroCoords->push_back(i);+    refVec[i] = v;+  }+}+++#include <unsupported/Eigen/SparseExtra>+#endif // EIGEN_TESTSPARSE_H
+ eigen3/test/sparseLM.cpp view
@@ -0,0 +1,176 @@+// This file is part of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2012 Desire Nuentsa <desire.nuentsa_wakam@inria.fr>+// Copyright (C) 2012 Gael Guennebaud <gael.guennebaud@inria.fr>+//+// 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 <iostream>+#include <fstream>+#include <iomanip>++#include "main.h"+#include <Eigen/LevenbergMarquardt>++using namespace std;+using namespace Eigen;++template <typename Scalar>+struct sparseGaussianTest : SparseFunctor<Scalar, int>+{+  typedef Matrix<Scalar,Dynamic,1> VectorType;+  typedef SparseFunctor<Scalar,int> Base;+  typedef typename Base::JacobianType JacobianType;+  sparseGaussianTest(int inputs, int values) : SparseFunctor<Scalar,int>(inputs,values)+  { }+  +  VectorType model(const VectorType& uv, VectorType& x)+  {+    VectorType y; //Change this 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<const VectorType> u(uv, 0, half);+    VectorBlock<const VectorType> v(uv, half, half);+    Scalar coeff;+    for (int j = 0; j < m; j++)+    {+      for (int i = 0; i < half; i++) +      {+        coeff = (x(j)-i)/v(i);+        coeff *= coeff;+        if (coeff < 1. && coeff > 0.)+          y(j) += u(i)*std::pow((1-coeff), 2);+      }+    }+    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);+    int half = n/2;+    VectorBlock<const VectorType> u(uv, 0, half);+    VectorBlock<const VectorType> v(uv, half, half);+    fvec = m_y;+    Scalar coeff;+    for (int j = 0; j < m; j++)+    {+      for (int i = 0; i < half; i++)+      {+        coeff = (m_x(j)-i)/v(i);+        coeff *= coeff;+        if (coeff < 1. && coeff > 0.)+          fvec(j) -= u(i)*std::pow((1-coeff), 2);+      }+    }+    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<const VectorType> u(uv, 0, half);+    VectorBlock<const VectorType> v(uv, half, half);+    Scalar coeff;+    +    //Derivatives with respect to u+    for (int col = 0; col < half; col++)+    {+      for (int row = 0; row < m; row++)+      {+        coeff = (m_x(row)-col)/v(col);+          coeff = coeff*coeff;+        if(coeff < 1. && coeff > 0.)+        {+          fjac.coeffRef(row,col) = -(1-coeff)*(1-coeff);+        }+      }+    }+    //Derivatives with respect to v+    for (int col = 0; col < half; col++)+    {+      for (int row = 0; row < m; row++)+      {+        coeff = (m_x(row)-col)/v(col);+        coeff = coeff*coeff;+        if(coeff < 1. && coeff > 0.)+        {+          fjac.coeffRef(row,col+half) = -4 * (u(col)/v(col))*coeff*(1-coeff);+        }+      }+    }+    return 0;+  }+  +  VectorType m_x, m_y; //Data points+};+++template<typename T>+void test_sparseLM_T()+{+  typedef Matrix<T,Dynamic,1> VectorType;+  +  int inputs = 10;+  int values = 2000;+  sparseGaussianTest<T> sparse_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;+  sparse_gaussian.initPoints(uv_ref, x);+  +  +  // Generate the initial parameters +  VectorBlock<VectorType> u(uv, 0, inputs/2); +  VectorBlock<VectorType> v(uv, inputs/2, inputs/2);+  v.setOnes();+  //Generate u or Solve for u from v+  u.setOnes();+  +  // Solve the optimization problem+  LevenbergMarquardt<sparseGaussianTest<T> > lm(sparse_gaussian);+  int info;+//   info = lm.minimize(uv);+  +  VERIFY_IS_EQUAL(info,1);+    // Do a step by step solution and save the residual +  int maxiter = 200;+  int iter = 0;+  MatrixXd Err(values, maxiter);+  MatrixXd Mod(values, maxiter);+  LevenbergMarquardtSpace::Status status; +  status = lm.minimizeInit(uv);+  if (status==LevenbergMarquardtSpace::ImproperInputParameters)+      return ;++}+void test_sparseLM()+{+  CALL_SUBTEST_1(test_sparseLM_T<double>());+  +  // CALL_SUBTEST_2(test_sparseLM_T<std::complex<double>());+}
+ eigen3/test/sparse_basic.cpp view
@@ -0,0 +1,689 @@+// This file is part of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2008-2011 Gael Guennebaud <gael.guennebaud@inria.fr>+// Copyright (C) 2008 Daniel Gomez Ferro <dgomezferro@gmail.com>+// Copyright (C) 2013 Désiré Nuentsa-Wakam <desire.nuentsa_wakam@inria.fr>+//+// 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 long g_realloc_count = 0;+#define EIGEN_SPARSE_COMPRESSED_STORAGE_REALLOCATE_PLUGIN g_realloc_count++;++#include "sparse.h"++template<typename SparseMatrixType> void sparse_basic(const SparseMatrixType& ref)+{+  typedef typename SparseMatrixType::StorageIndex StorageIndex;+  typedef Matrix<StorageIndex,2,1> Vector2;+  +  const Index rows = ref.rows();+  const Index cols = ref.cols();+  //const Index inner = ref.innerSize();+  //const Index outer = ref.outerSize();++  typedef typename SparseMatrixType::Scalar Scalar;+  typedef typename SparseMatrixType::RealScalar RealScalar;+  enum { Flags = SparseMatrixType::Flags };++  double density = (std::max)(8./(rows*cols), 0.01);+  typedef Matrix<Scalar,Dynamic,Dynamic> DenseMatrix;+  typedef Matrix<Scalar,Dynamic,1> DenseVector;+  Scalar eps = 1e-6;++  Scalar s1 = internal::random<Scalar>();+  {+    SparseMatrixType m(rows, cols);+    DenseMatrix refMat = DenseMatrix::Zero(rows, cols);+    DenseVector vec1 = DenseVector::Random(rows);++    std::vector<Vector2> zeroCoords;+    std::vector<Vector2> nonzeroCoords;+    initSparse<Scalar>(density, refMat, m, 0, &zeroCoords, &nonzeroCoords);++    // test coeff and coeffRef+    for (std::size_t i=0; i<zeroCoords.size(); ++i)+    {+      VERIFY_IS_MUCH_SMALLER_THAN( m.coeff(zeroCoords[i].x(),zeroCoords[i].y()), eps );+      if(internal::is_same<SparseMatrixType,SparseMatrix<Scalar,Flags> >::value)+        VERIFY_RAISES_ASSERT( m.coeffRef(zeroCoords[i].x(),zeroCoords[i].y()) = 5 );+    }+    VERIFY_IS_APPROX(m, refMat);++    if(!nonzeroCoords.empty()) {+      m.coeffRef(nonzeroCoords[0].x(), nonzeroCoords[0].y()) = Scalar(5);+      refMat.coeffRef(nonzeroCoords[0].x(), nonzeroCoords[0].y()) = Scalar(5);+    }++    VERIFY_IS_APPROX(m, refMat);++      // test assertion+      VERIFY_RAISES_ASSERT( m.coeffRef(-1,1) = 0 );+      VERIFY_RAISES_ASSERT( m.coeffRef(0,m.cols()) = 0 );+    }++    // test insert (inner random)+    {+      DenseMatrix m1(rows,cols);+      m1.setZero();+      SparseMatrixType m2(rows,cols);+      bool call_reserve = internal::random<int>()%2;+      Index nnz = internal::random<int>(1,int(rows)/2);+      if(call_reserve)+      {+        if(internal::random<int>()%2)+          m2.reserve(VectorXi::Constant(m2.outerSize(), int(nnz)));+        else+          m2.reserve(m2.outerSize() * nnz);+      }+      g_realloc_count = 0;+      for (Index j=0; j<cols; ++j)+      {+        for (Index k=0; k<nnz; ++k)+        {+          Index i = internal::random<Index>(0,rows-1);+          if (m1.coeff(i,j)==Scalar(0))+            m2.insert(i,j) = m1(i,j) = internal::random<Scalar>();+        }+      }+      +      if(call_reserve && !SparseMatrixType::IsRowMajor)+      {+        VERIFY(g_realloc_count==0);+      }+      +      m2.finalize();+      VERIFY_IS_APPROX(m2,m1);+    }++    // test insert (fully random)+    {+      DenseMatrix m1(rows,cols);+      m1.setZero();+      SparseMatrixType m2(rows,cols);+      if(internal::random<int>()%2)+        m2.reserve(VectorXi::Constant(m2.outerSize(), 2));+      for (int k=0; k<rows*cols; ++k)+      {+        Index i = internal::random<Index>(0,rows-1);+        Index j = internal::random<Index>(0,cols-1);+        if ((m1.coeff(i,j)==Scalar(0)) && (internal::random<int>()%2))+          m2.insert(i,j) = m1(i,j) = internal::random<Scalar>();+        else+        {+          Scalar v = internal::random<Scalar>();+          m2.coeffRef(i,j) += v;+          m1(i,j) += v;+        }+      }+      VERIFY_IS_APPROX(m2,m1);+    }+    +    // test insert (un-compressed)+    for(int mode=0;mode<4;++mode)+    {+      DenseMatrix m1(rows,cols);+      m1.setZero();+      SparseMatrixType m2(rows,cols);+      VectorXi r(VectorXi::Constant(m2.outerSize(), ((mode%2)==0) ? int(m2.innerSize()) : std::max<int>(1,int(m2.innerSize())/8)));+      m2.reserve(r);+      for (Index k=0; k<rows*cols; ++k)+      {+        Index i = internal::random<Index>(0,rows-1);+        Index j = internal::random<Index>(0,cols-1);+        if (m1.coeff(i,j)==Scalar(0))+          m2.insert(i,j) = m1(i,j) = internal::random<Scalar>();+        if(mode==3)+          m2.reserve(r);+      }+      if(internal::random<int>()%2)+        m2.makeCompressed();+      VERIFY_IS_APPROX(m2,m1);+    }++  // test basic computations+  {+    DenseMatrix refM1 = DenseMatrix::Zero(rows, cols);+    DenseMatrix refM2 = DenseMatrix::Zero(rows, cols);+    DenseMatrix refM3 = DenseMatrix::Zero(rows, cols);+    DenseMatrix refM4 = DenseMatrix::Zero(rows, cols);+    SparseMatrixType m1(rows, cols);+    SparseMatrixType m2(rows, cols);+    SparseMatrixType m3(rows, cols);+    SparseMatrixType m4(rows, cols);+    initSparse<Scalar>(density, refM1, m1);+    initSparse<Scalar>(density, refM2, m2);+    initSparse<Scalar>(density, refM3, m3);+    initSparse<Scalar>(density, refM4, m4);++    if(internal::random<bool>())+      m1.makeCompressed();++    Index m1_nnz = m1.nonZeros();++    VERIFY_IS_APPROX(m1*s1, refM1*s1);+    VERIFY_IS_APPROX(m1+m2, refM1+refM2);+    VERIFY_IS_APPROX(m1+m2+m3, refM1+refM2+refM3);+    VERIFY_IS_APPROX(m3.cwiseProduct(m1+m2), refM3.cwiseProduct(refM1+refM2));+    VERIFY_IS_APPROX(m1*s1-m2, refM1*s1-refM2);+    VERIFY_IS_APPROX(m4=m1/s1, refM1/s1);+    VERIFY_IS_EQUAL(m4.nonZeros(), m1_nnz);++    if(SparseMatrixType::IsRowMajor)+      VERIFY_IS_APPROX(m1.innerVector(0).dot(refM2.row(0)), refM1.row(0).dot(refM2.row(0)));+    else+      VERIFY_IS_APPROX(m1.innerVector(0).dot(refM2.col(0)), refM1.col(0).dot(refM2.col(0)));++    DenseVector rv = DenseVector::Random(m1.cols());+    DenseVector cv = DenseVector::Random(m1.rows());+    Index r = internal::random<Index>(0,m1.rows()-2);+    Index c = internal::random<Index>(0,m1.cols()-1);+    VERIFY_IS_APPROX(( m1.template block<1,Dynamic>(r,0,1,m1.cols()).dot(rv)) , refM1.row(r).dot(rv));+    VERIFY_IS_APPROX(m1.row(r).dot(rv), refM1.row(r).dot(rv));+    VERIFY_IS_APPROX(m1.col(c).dot(cv), refM1.col(c).dot(cv));++    VERIFY_IS_APPROX(m1.conjugate(), refM1.conjugate());+    VERIFY_IS_APPROX(m1.real(), refM1.real());++    refM4.setRandom();+    // sparse cwise* dense+    VERIFY_IS_APPROX(m3.cwiseProduct(refM4), refM3.cwiseProduct(refM4));+    // dense cwise* sparse+    VERIFY_IS_APPROX(refM4.cwiseProduct(m3), refM4.cwiseProduct(refM3));+//     VERIFY_IS_APPROX(m3.cwise()/refM4, refM3.cwise()/refM4);++    VERIFY_IS_APPROX(refM4 + m3, refM4 + refM3);+    VERIFY_IS_APPROX(m3 + refM4, refM3 + refM4);+    VERIFY_IS_APPROX(refM4 - m3, refM4 - refM3);+    VERIFY_IS_APPROX(m3 - refM4, refM3 - refM4);+    VERIFY_IS_APPROX((RealScalar(0.5)*refM4 + RealScalar(0.5)*m3).eval(), RealScalar(0.5)*refM4 + RealScalar(0.5)*refM3);+    VERIFY_IS_APPROX((RealScalar(0.5)*refM4 + m3*RealScalar(0.5)).eval(), RealScalar(0.5)*refM4 + RealScalar(0.5)*refM3);+    VERIFY_IS_APPROX((RealScalar(0.5)*refM4 + m3.cwiseProduct(m3)).eval(), RealScalar(0.5)*refM4 + refM3.cwiseProduct(refM3));++    VERIFY_IS_APPROX((RealScalar(0.5)*refM4 + RealScalar(0.5)*m3).eval(), RealScalar(0.5)*refM4 + RealScalar(0.5)*refM3);+    VERIFY_IS_APPROX((RealScalar(0.5)*refM4 + m3*RealScalar(0.5)).eval(), RealScalar(0.5)*refM4 + RealScalar(0.5)*refM3);+    VERIFY_IS_APPROX((RealScalar(0.5)*refM4 + (m3+m3)).eval(), RealScalar(0.5)*refM4 + (refM3+refM3));+    VERIFY_IS_APPROX(((refM3+m3)+RealScalar(0.5)*m3).eval(), RealScalar(0.5)*refM3 + (refM3+refM3));+    VERIFY_IS_APPROX((RealScalar(0.5)*refM4 + (refM3+m3)).eval(), RealScalar(0.5)*refM4 + (refM3+refM3));+    VERIFY_IS_APPROX((RealScalar(0.5)*refM4 + (m3+refM3)).eval(), RealScalar(0.5)*refM4 + (refM3+refM3));+++    VERIFY_IS_APPROX(m1.sum(), refM1.sum());++    m4 = m1; refM4 = m4;++    VERIFY_IS_APPROX(m1*=s1, refM1*=s1);+    VERIFY_IS_EQUAL(m1.nonZeros(), m1_nnz);+    VERIFY_IS_APPROX(m1/=s1, refM1/=s1);+    VERIFY_IS_EQUAL(m1.nonZeros(), m1_nnz);++    VERIFY_IS_APPROX(m1+=m2, refM1+=refM2);+    VERIFY_IS_APPROX(m1-=m2, refM1-=refM2);++    if (rows>=2 && cols>=2)+    {+      VERIFY_RAISES_ASSERT( m1 += m1.innerVector(0) );+      VERIFY_RAISES_ASSERT( m1 -= m1.innerVector(0) );+      VERIFY_RAISES_ASSERT( refM1 -= m1.innerVector(0) );+      VERIFY_RAISES_ASSERT( refM1 += m1.innerVector(0) );+    }+    m1 = m4; refM1 = refM4;++    // test aliasing+    VERIFY_IS_APPROX((m1 = -m1), (refM1 = -refM1));+    VERIFY_IS_EQUAL(m1.nonZeros(), m1_nnz);+    m1 = m4; refM1 = refM4;+    VERIFY_IS_APPROX((m1 = m1.transpose()), (refM1 = refM1.transpose().eval()));+    VERIFY_IS_EQUAL(m1.nonZeros(), m1_nnz);+    m1 = m4; refM1 = refM4;+    VERIFY_IS_APPROX((m1 = -m1.transpose()), (refM1 = -refM1.transpose().eval()));+    VERIFY_IS_EQUAL(m1.nonZeros(), m1_nnz);+    m1 = m4; refM1 = refM4;+    VERIFY_IS_APPROX((m1 += -m1), (refM1 += -refM1));+    VERIFY_IS_EQUAL(m1.nonZeros(), m1_nnz);+    m1 = m4; refM1 = refM4;++    if(m1.isCompressed())+    {+      VERIFY_IS_APPROX(m1.coeffs().sum(), m1.sum());+      m1.coeffs() += s1;+      for(Index j = 0; j<m1.outerSize(); ++j)+        for(typename SparseMatrixType::InnerIterator it(m1,j); it; ++it)+          refM1(it.row(), it.col()) += s1;+      VERIFY_IS_APPROX(m1, refM1);+    }++    // and/or+    {+      typedef SparseMatrix<bool, SparseMatrixType::Options, typename SparseMatrixType::StorageIndex> SpBool;+      SpBool mb1 = m1.real().template cast<bool>();+      SpBool mb2 = m2.real().template cast<bool>();+      VERIFY_IS_EQUAL(mb1.template cast<int>().sum(), refM1.real().template cast<bool>().count());+      VERIFY_IS_EQUAL((mb1 && mb2).template cast<int>().sum(), (refM1.real().template cast<bool>() && refM2.real().template cast<bool>()).count());+      VERIFY_IS_EQUAL((mb1 || mb2).template cast<int>().sum(), (refM1.real().template cast<bool>() || refM2.real().template cast<bool>()).count());+      SpBool mb3 = mb1 && mb2;+      if(mb1.coeffs().all() && mb2.coeffs().all())+      {+        VERIFY_IS_EQUAL(mb3.nonZeros(), (refM1.real().template cast<bool>() && refM2.real().template cast<bool>()).count());+      }+    }+  }++  // test reverse iterators+  {+    DenseMatrix refMat2 = DenseMatrix::Zero(rows, cols);+    SparseMatrixType m2(rows, cols);+    initSparse<Scalar>(density, refMat2, m2);+    std::vector<Scalar> ref_value(m2.innerSize());+    std::vector<Index> ref_index(m2.innerSize());+    if(internal::random<bool>())+      m2.makeCompressed();+    for(Index j = 0; j<m2.outerSize(); ++j)+    {+      Index count_forward = 0;++      for(typename SparseMatrixType::InnerIterator it(m2,j); it; ++it)+      {+        ref_value[ref_value.size()-1-count_forward] = it.value();+        ref_index[ref_index.size()-1-count_forward] = it.index();+        count_forward++;+      }+      Index count_reverse = 0;+      for(typename SparseMatrixType::ReverseInnerIterator it(m2,j); it; --it)+      {+        VERIFY_IS_APPROX( std::abs(ref_value[ref_value.size()-count_forward+count_reverse])+1, std::abs(it.value())+1);+        VERIFY_IS_EQUAL( ref_index[ref_index.size()-count_forward+count_reverse] , it.index());+        count_reverse++;+      }+      VERIFY_IS_EQUAL(count_forward, count_reverse);+    }+  }++  // test transpose+  {+    DenseMatrix refMat2 = DenseMatrix::Zero(rows, cols);+    SparseMatrixType m2(rows, cols);+    initSparse<Scalar>(density, refMat2, m2);+    VERIFY_IS_APPROX(m2.transpose().eval(), refMat2.transpose().eval());+    VERIFY_IS_APPROX(m2.transpose(), refMat2.transpose());++    VERIFY_IS_APPROX(SparseMatrixType(m2.adjoint()), refMat2.adjoint());+    +    // check isApprox handles opposite storage order+    typename Transpose<SparseMatrixType>::PlainObject m3(m2);+    VERIFY(m2.isApprox(m3));+  }++  // test prune+  {+    SparseMatrixType m2(rows, cols);+    DenseMatrix refM2(rows, cols);+    refM2.setZero();+    int countFalseNonZero = 0;+    int countTrueNonZero = 0;+    m2.reserve(VectorXi::Constant(m2.outerSize(), int(m2.innerSize())));+    for (Index j=0; j<m2.cols(); ++j)+    {+      for (Index i=0; i<m2.rows(); ++i)+      {+        float x = internal::random<float>(0,1);+        if (x<0.1f)+        {+          // do nothing+        }+        else if (x<0.5f)+        {+          countFalseNonZero++;+          m2.insert(i,j) = Scalar(0);+        }+        else+        {+          countTrueNonZero++;+          m2.insert(i,j) = Scalar(1);+          refM2(i,j) = Scalar(1);+        }+      }+    }+    if(internal::random<bool>())+      m2.makeCompressed();+    VERIFY(countFalseNonZero+countTrueNonZero == m2.nonZeros());+    if(countTrueNonZero>0)+      VERIFY_IS_APPROX(m2, refM2);+    m2.prune(Scalar(1));+    VERIFY(countTrueNonZero==m2.nonZeros());+    VERIFY_IS_APPROX(m2, refM2);+  }++  // test setFromTriplets+  {+    typedef Triplet<Scalar,StorageIndex> TripletType;+    std::vector<TripletType> triplets;+    Index ntriplets = rows*cols;+    triplets.reserve(ntriplets);+    DenseMatrix refMat_sum  = DenseMatrix::Zero(rows,cols);+    DenseMatrix refMat_prod = DenseMatrix::Zero(rows,cols);+    DenseMatrix refMat_last = DenseMatrix::Zero(rows,cols);++    for(Index i=0;i<ntriplets;++i)+    {+      StorageIndex r = internal::random<StorageIndex>(0,StorageIndex(rows-1));+      StorageIndex c = internal::random<StorageIndex>(0,StorageIndex(cols-1));+      Scalar v = internal::random<Scalar>();+      triplets.push_back(TripletType(r,c,v));+      refMat_sum(r,c) += v;+      if(std::abs(refMat_prod(r,c))==0)+        refMat_prod(r,c) = v;+      else+        refMat_prod(r,c) *= v;+      refMat_last(r,c) = v;+    }+    SparseMatrixType m(rows,cols);+    m.setFromTriplets(triplets.begin(), triplets.end());+    VERIFY_IS_APPROX(m, refMat_sum);++    m.setFromTriplets(triplets.begin(), triplets.end(), std::multiplies<Scalar>());+    VERIFY_IS_APPROX(m, refMat_prod);+#if (defined(__cplusplus) && __cplusplus >= 201103L)+    m.setFromTriplets(triplets.begin(), triplets.end(), [] (Scalar,Scalar b) { return b; });+    VERIFY_IS_APPROX(m, refMat_last);+#endif+  }+  +  // test Map+  {+    DenseMatrix refMat2(rows, cols), refMat3(rows, cols);+    SparseMatrixType m2(rows, cols), m3(rows, cols);+    initSparse<Scalar>(density, refMat2, m2);+    initSparse<Scalar>(density, refMat3, m3);+    {+      Map<SparseMatrixType> mapMat2(m2.rows(), m2.cols(), m2.nonZeros(), m2.outerIndexPtr(), m2.innerIndexPtr(), m2.valuePtr(), m2.innerNonZeroPtr());+      Map<SparseMatrixType> mapMat3(m3.rows(), m3.cols(), m3.nonZeros(), m3.outerIndexPtr(), m3.innerIndexPtr(), m3.valuePtr(), m3.innerNonZeroPtr());+      VERIFY_IS_APPROX(mapMat2+mapMat3, refMat2+refMat3);+      VERIFY_IS_APPROX(mapMat2+mapMat3, refMat2+refMat3);+    }+    {+      MappedSparseMatrix<Scalar,SparseMatrixType::Options,StorageIndex> mapMat2(m2.rows(), m2.cols(), m2.nonZeros(), m2.outerIndexPtr(), m2.innerIndexPtr(), m2.valuePtr(), m2.innerNonZeroPtr());+      MappedSparseMatrix<Scalar,SparseMatrixType::Options,StorageIndex> mapMat3(m3.rows(), m3.cols(), m3.nonZeros(), m3.outerIndexPtr(), m3.innerIndexPtr(), m3.valuePtr(), m3.innerNonZeroPtr());+      VERIFY_IS_APPROX(mapMat2+mapMat3, refMat2+refMat3);+      VERIFY_IS_APPROX(mapMat2+mapMat3, refMat2+refMat3);+    }++    Index i = internal::random<Index>(0,rows-1);+    Index j = internal::random<Index>(0,cols-1);+    m2.coeffRef(i,j) = 123;+    if(internal::random<bool>())+      m2.makeCompressed();+    Map<SparseMatrixType> mapMat2(rows, cols, m2.nonZeros(), m2.outerIndexPtr(), m2.innerIndexPtr(), m2.valuePtr(),  m2.innerNonZeroPtr());+    VERIFY_IS_EQUAL(m2.coeff(i,j),Scalar(123));+    VERIFY_IS_EQUAL(mapMat2.coeff(i,j),Scalar(123));+    mapMat2.coeffRef(i,j) = -123;+    VERIFY_IS_EQUAL(m2.coeff(i,j),Scalar(-123));+  }++  // test triangularView+  {+    DenseMatrix refMat2(rows, cols), refMat3(rows, cols);+    SparseMatrixType m2(rows, cols), m3(rows, cols);+    initSparse<Scalar>(density, refMat2, m2);+    refMat3 = refMat2.template triangularView<Lower>();+    m3 = m2.template triangularView<Lower>();+    VERIFY_IS_APPROX(m3, refMat3);++    refMat3 = refMat2.template triangularView<Upper>();+    m3 = m2.template triangularView<Upper>();+    VERIFY_IS_APPROX(m3, refMat3);++    {+      refMat3 = refMat2.template triangularView<UnitUpper>();+      m3 = m2.template triangularView<UnitUpper>();+      VERIFY_IS_APPROX(m3, refMat3);++      refMat3 = refMat2.template triangularView<UnitLower>();+      m3 = m2.template triangularView<UnitLower>();+      VERIFY_IS_APPROX(m3, refMat3);+    }++    refMat3 = refMat2.template triangularView<StrictlyUpper>();+    m3 = m2.template triangularView<StrictlyUpper>();+    VERIFY_IS_APPROX(m3, refMat3);++    refMat3 = refMat2.template triangularView<StrictlyLower>();+    m3 = m2.template triangularView<StrictlyLower>();+    VERIFY_IS_APPROX(m3, refMat3);++    // check sparse-triangular to dense+    refMat3 = m2.template triangularView<StrictlyUpper>();+    VERIFY_IS_APPROX(refMat3, DenseMatrix(refMat2.template triangularView<StrictlyUpper>()));+  }+  +  // test selfadjointView+  if(!SparseMatrixType::IsRowMajor)+  {+    DenseMatrix refMat2(rows, rows), refMat3(rows, rows);+    SparseMatrixType m2(rows, rows), m3(rows, rows);+    initSparse<Scalar>(density, refMat2, m2);+    refMat3 = refMat2.template selfadjointView<Lower>();+    m3 = m2.template selfadjointView<Lower>();+    VERIFY_IS_APPROX(m3, refMat3);++    refMat3 += refMat2.template selfadjointView<Lower>();+    m3 += m2.template selfadjointView<Lower>();+    VERIFY_IS_APPROX(m3, refMat3);++    refMat3 -= refMat2.template selfadjointView<Lower>();+    m3 -= m2.template selfadjointView<Lower>();+    VERIFY_IS_APPROX(m3, refMat3);++    // selfadjointView only works for square matrices:+    SparseMatrixType m4(rows, rows+1);+    VERIFY_RAISES_ASSERT(m4.template selfadjointView<Lower>());+    VERIFY_RAISES_ASSERT(m4.template selfadjointView<Upper>());+  }+  +  // test sparseView+  {+    DenseMatrix refMat2 = DenseMatrix::Zero(rows, rows);+    SparseMatrixType m2(rows, rows);+    initSparse<Scalar>(density, refMat2, m2);+    VERIFY_IS_APPROX(m2.eval(), refMat2.sparseView().eval());++    // sparse view on expressions:+    VERIFY_IS_APPROX((s1*m2).eval(), (s1*refMat2).sparseView().eval());+    VERIFY_IS_APPROX((m2+m2).eval(), (refMat2+refMat2).sparseView().eval());+    VERIFY_IS_APPROX((m2*m2).eval(), (refMat2.lazyProduct(refMat2)).sparseView().eval());+    VERIFY_IS_APPROX((m2*m2).eval(), (refMat2*refMat2).sparseView().eval());+  }++  // test diagonal+  {+    DenseMatrix refMat2 = DenseMatrix::Zero(rows, cols);+    SparseMatrixType m2(rows, cols);+    initSparse<Scalar>(density, refMat2, m2);+    VERIFY_IS_APPROX(m2.diagonal(), refMat2.diagonal().eval());+    DenseVector d = m2.diagonal();+    VERIFY_IS_APPROX(d, refMat2.diagonal().eval());+    d = m2.diagonal().array();+    VERIFY_IS_APPROX(d, refMat2.diagonal().eval());+    VERIFY_IS_APPROX(const_cast<const SparseMatrixType&>(m2).diagonal(), refMat2.diagonal().eval());+    +    initSparse<Scalar>(density, refMat2, m2, ForceNonZeroDiag);+    m2.diagonal()      += refMat2.diagonal();+    refMat2.diagonal() += refMat2.diagonal();+    VERIFY_IS_APPROX(m2, refMat2);+  }+  +  // test diagonal to sparse+  {+    DenseVector d = DenseVector::Random(rows);+    DenseMatrix refMat2 = d.asDiagonal();+    SparseMatrixType m2(rows, rows);+    m2 = d.asDiagonal();+    VERIFY_IS_APPROX(m2, refMat2);+    SparseMatrixType m3(d.asDiagonal());+    VERIFY_IS_APPROX(m3, refMat2);+    refMat2 += d.asDiagonal();+    m2 += d.asDiagonal();+    VERIFY_IS_APPROX(m2, refMat2);+  }+  +  // test conservative resize+  {+      std::vector< std::pair<StorageIndex,StorageIndex> > inc;+      if(rows > 3 && cols > 2)+        inc.push_back(std::pair<StorageIndex,StorageIndex>(-3,-2));+      inc.push_back(std::pair<StorageIndex,StorageIndex>(0,0));+      inc.push_back(std::pair<StorageIndex,StorageIndex>(3,2));+      inc.push_back(std::pair<StorageIndex,StorageIndex>(3,0));+      inc.push_back(std::pair<StorageIndex,StorageIndex>(0,3));+      +      for(size_t i = 0; i< inc.size(); i++) {+        StorageIndex incRows = inc[i].first;+        StorageIndex incCols = inc[i].second;+        SparseMatrixType m1(rows, cols);+        DenseMatrix refMat1 = DenseMatrix::Zero(rows, cols);+        initSparse<Scalar>(density, refMat1, m1);+        +        m1.conservativeResize(rows+incRows, cols+incCols);+        refMat1.conservativeResize(rows+incRows, cols+incCols);+        if (incRows > 0) refMat1.bottomRows(incRows).setZero();+        if (incCols > 0) refMat1.rightCols(incCols).setZero();+        +        VERIFY_IS_APPROX(m1, refMat1);+        +        // Insert new values+        if (incRows > 0) +          m1.insert(m1.rows()-1, 0) = refMat1(refMat1.rows()-1, 0) = 1;+        if (incCols > 0) +          m1.insert(0, m1.cols()-1) = refMat1(0, refMat1.cols()-1) = 1;+          +        VERIFY_IS_APPROX(m1, refMat1);+          +          +      }+  }++  // test Identity matrix+  {+    DenseMatrix refMat1 = DenseMatrix::Identity(rows, rows);+    SparseMatrixType m1(rows, rows);+    m1.setIdentity();+    VERIFY_IS_APPROX(m1, refMat1);+    for(int k=0; k<rows*rows/4; ++k)+    {+      Index i = internal::random<Index>(0,rows-1);+      Index j = internal::random<Index>(0,rows-1);+      Scalar v = internal::random<Scalar>();+      m1.coeffRef(i,j) = v;+      refMat1.coeffRef(i,j) = v;+      VERIFY_IS_APPROX(m1, refMat1);+      if(internal::random<Index>(0,10)<2)+        m1.makeCompressed();+    }+    m1.setIdentity();+    refMat1.setIdentity();+    VERIFY_IS_APPROX(m1, refMat1);+  }++  // test array/vector of InnerIterator+  {+    typedef typename SparseMatrixType::InnerIterator IteratorType;++    DenseMatrix refMat2 = DenseMatrix::Zero(rows, cols);+    SparseMatrixType m2(rows, cols);+    initSparse<Scalar>(density, refMat2, m2);+    IteratorType static_array[2];+    static_array[0] = IteratorType(m2,0);+    static_array[1] = IteratorType(m2,m2.outerSize()-1);+    VERIFY( static_array[0] || m2.innerVector(static_array[0].outer()).nonZeros() == 0 );+    VERIFY( static_array[1] || m2.innerVector(static_array[1].outer()).nonZeros() == 0 );+    if(static_array[0] && static_array[1])+    {+      ++(static_array[1]);+      static_array[1] = IteratorType(m2,0);+      VERIFY( static_array[1] );+      VERIFY( static_array[1].index() == static_array[0].index() );+      VERIFY( static_array[1].outer() == static_array[0].outer() );+      VERIFY( static_array[1].value() == static_array[0].value() );+    }++    std::vector<IteratorType> iters(2);+    iters[0] = IteratorType(m2,0);+    iters[1] = IteratorType(m2,m2.outerSize()-1);+  }+}+++template<typename SparseMatrixType>+void big_sparse_triplet(Index rows, Index cols, double density) {+  typedef typename SparseMatrixType::StorageIndex StorageIndex;+  typedef typename SparseMatrixType::Scalar Scalar;+  typedef Triplet<Scalar,Index> TripletType;+  std::vector<TripletType> triplets;+  double nelements = density * rows*cols;+  VERIFY(nelements>=0 && nelements <  NumTraits<StorageIndex>::highest());+  Index ntriplets = Index(nelements);+  triplets.reserve(ntriplets);+  Scalar sum = Scalar(0);+  for(Index i=0;i<ntriplets;++i)+  {+    Index r = internal::random<Index>(0,rows-1);+    Index c = internal::random<Index>(0,cols-1);+    // use positive values to prevent numerical cancellation errors in sum+    Scalar v = numext::abs(internal::random<Scalar>());+    triplets.push_back(TripletType(r,c,v));+    sum += v;+  }+  SparseMatrixType m(rows,cols);+  m.setFromTriplets(triplets.begin(), triplets.end());+  VERIFY(m.nonZeros() <= ntriplets);+  VERIFY_IS_APPROX(sum, m.sum());+}+++void test_sparse_basic()+{+  for(int i = 0; i < g_repeat; i++) {+    int r = Eigen::internal::random<int>(1,200), c = Eigen::internal::random<int>(1,200);+    if(Eigen::internal::random<int>(0,4) == 0) {+      r = c; // check square matrices in 25% of tries+    }+    EIGEN_UNUSED_VARIABLE(r+c);+    CALL_SUBTEST_1(( sparse_basic(SparseMatrix<double>(1, 1)) ));+    CALL_SUBTEST_1(( sparse_basic(SparseMatrix<double>(8, 8)) ));+    CALL_SUBTEST_2(( sparse_basic(SparseMatrix<std::complex<double>, ColMajor>(r, c)) ));+    CALL_SUBTEST_2(( sparse_basic(SparseMatrix<std::complex<double>, RowMajor>(r, c)) ));+    CALL_SUBTEST_1(( sparse_basic(SparseMatrix<double>(r, c)) ));+    CALL_SUBTEST_5(( sparse_basic(SparseMatrix<double,ColMajor,long int>(r, c)) ));+    CALL_SUBTEST_5(( sparse_basic(SparseMatrix<double,RowMajor,long int>(r, c)) ));+    +    r = Eigen::internal::random<int>(1,100);+    c = Eigen::internal::random<int>(1,100);+    if(Eigen::internal::random<int>(0,4) == 0) {+      r = c; // check square matrices in 25% of tries+    }+    +    CALL_SUBTEST_6(( sparse_basic(SparseMatrix<double,ColMajor,short int>(short(r), short(c))) ));+    CALL_SUBTEST_6(( sparse_basic(SparseMatrix<double,RowMajor,short int>(short(r), short(c))) ));+  }++  // Regression test for bug 900: (manually insert higher values here, if you have enough RAM):+  CALL_SUBTEST_3((big_sparse_triplet<SparseMatrix<float, RowMajor, int> >(10000, 10000, 0.125)));+  CALL_SUBTEST_4((big_sparse_triplet<SparseMatrix<double, ColMajor, long int> >(10000, 10000, 0.125)));++  // Regression test for bug 1105+#ifdef EIGEN_TEST_PART_7+  {+    int n = Eigen::internal::random<int>(200,600);+    SparseMatrix<std::complex<double>,0, long> mat(n, n);+    std::complex<double> val;++    for(int i=0; i<n; ++i)+    {+      mat.coeffRef(i, i%(n/10)) = val;+      VERIFY(mat.data().allocatedSize()<20*n);+    }+  }+#endif+}
+ eigen3/test/sparse_block.cpp view
@@ -0,0 +1,317 @@+// This file is part of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2008-2015 Gael Guennebaud <gael.guennebaud@inria.fr>+//+// 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.h"++template<typename T>+typename Eigen::internal::enable_if<(T::Flags&RowMajorBit)==RowMajorBit, typename T::RowXpr>::type+innervec(T& A, Index i)+{+  return A.row(i);+}++template<typename T>+typename Eigen::internal::enable_if<(T::Flags&RowMajorBit)==0, typename T::ColXpr>::type+innervec(T& A, Index i)+{+  return A.col(i);+}++template<typename SparseMatrixType> void sparse_block(const SparseMatrixType& ref)+{+  const Index rows = ref.rows();+  const Index cols = ref.cols();+  const Index inner = ref.innerSize();+  const Index outer = ref.outerSize();++  typedef typename SparseMatrixType::Scalar Scalar;+  typedef typename SparseMatrixType::StorageIndex StorageIndex;++  double density = (std::max)(8./(rows*cols), 0.01);+  typedef Matrix<Scalar,Dynamic,Dynamic,SparseMatrixType::IsRowMajor?RowMajor:ColMajor> DenseMatrix;+  typedef Matrix<Scalar,Dynamic,1> DenseVector;+  typedef Matrix<Scalar,1,Dynamic> RowDenseVector;+  typedef SparseVector<Scalar> SparseVectorType;++  Scalar s1 = internal::random<Scalar>();+  {+    SparseMatrixType m(rows, cols);+    DenseMatrix refMat = DenseMatrix::Zero(rows, cols);+    initSparse<Scalar>(density, refMat, m);++    VERIFY_IS_APPROX(m, refMat);++    // test InnerIterators and Block expressions+    for (int t=0; t<10; ++t)+    {+      Index j = internal::random<Index>(0,cols-2);+      Index i = internal::random<Index>(0,rows-2);+      Index w = internal::random<Index>(1,cols-j);+      Index h = internal::random<Index>(1,rows-i);++      VERIFY_IS_APPROX(m.block(i,j,h,w), refMat.block(i,j,h,w));+      for(Index c=0; c<w; c++)+      {+        VERIFY_IS_APPROX(m.block(i,j,h,w).col(c), refMat.block(i,j,h,w).col(c));+        for(Index r=0; r<h; r++)+        {+          VERIFY_IS_APPROX(m.block(i,j,h,w).col(c).coeff(r), refMat.block(i,j,h,w).col(c).coeff(r));+          VERIFY_IS_APPROX(m.block(i,j,h,w).coeff(r,c), refMat.block(i,j,h,w).coeff(r,c));+        }+      }+      for(Index r=0; r<h; r++)+      {+        VERIFY_IS_APPROX(m.block(i,j,h,w).row(r), refMat.block(i,j,h,w).row(r));+        for(Index c=0; c<w; c++)+        {+          VERIFY_IS_APPROX(m.block(i,j,h,w).row(r).coeff(c), refMat.block(i,j,h,w).row(r).coeff(c));+          VERIFY_IS_APPROX(m.block(i,j,h,w).coeff(r,c), refMat.block(i,j,h,w).coeff(r,c));+        }+      }+      +      VERIFY_IS_APPROX(m.middleCols(j,w), refMat.middleCols(j,w));+      VERIFY_IS_APPROX(m.middleRows(i,h), refMat.middleRows(i,h));+      for(Index r=0; r<h; r++)+      {+        VERIFY_IS_APPROX(m.middleCols(j,w).row(r), refMat.middleCols(j,w).row(r));+        VERIFY_IS_APPROX(m.middleRows(i,h).row(r), refMat.middleRows(i,h).row(r));+        for(Index c=0; c<w; c++)+        {+          VERIFY_IS_APPROX(m.col(c).coeff(r), refMat.col(c).coeff(r));+          VERIFY_IS_APPROX(m.row(r).coeff(c), refMat.row(r).coeff(c));+          +          VERIFY_IS_APPROX(m.middleCols(j,w).coeff(r,c), refMat.middleCols(j,w).coeff(r,c));+          VERIFY_IS_APPROX(m.middleRows(i,h).coeff(r,c), refMat.middleRows(i,h).coeff(r,c));+          if(m.middleCols(j,w).coeff(r,c) != Scalar(0))+          {+            VERIFY_IS_APPROX(m.middleCols(j,w).coeffRef(r,c), refMat.middleCols(j,w).coeff(r,c));+          }+          if(m.middleRows(i,h).coeff(r,c) != Scalar(0))+          {+            VERIFY_IS_APPROX(m.middleRows(i,h).coeff(r,c), refMat.middleRows(i,h).coeff(r,c));+          }+        }+      }+      for(Index c=0; c<w; c++)+      {+        VERIFY_IS_APPROX(m.middleCols(j,w).col(c), refMat.middleCols(j,w).col(c));+        VERIFY_IS_APPROX(m.middleRows(i,h).col(c), refMat.middleRows(i,h).col(c));+      }+    }++    for(Index c=0; c<cols; c++)+    {+      VERIFY_IS_APPROX(m.col(c) + m.col(c), (m + m).col(c));+      VERIFY_IS_APPROX(m.col(c) + m.col(c), refMat.col(c) + refMat.col(c));+    }++    for(Index r=0; r<rows; r++)+    {+      VERIFY_IS_APPROX(m.row(r) + m.row(r), (m + m).row(r));+      VERIFY_IS_APPROX(m.row(r) + m.row(r), refMat.row(r) + refMat.row(r));+    }+  }++  // test innerVector()+  {+    DenseMatrix refMat2 = DenseMatrix::Zero(rows, cols);+    SparseMatrixType m2(rows, cols);+    initSparse<Scalar>(density, refMat2, m2);+    Index j0 = internal::random<Index>(0,outer-1);+    Index j1 = internal::random<Index>(0,outer-1);+    Index r0 = internal::random<Index>(0,rows-1);+    Index c0 = internal::random<Index>(0,cols-1);++    VERIFY_IS_APPROX(m2.innerVector(j0), innervec(refMat2,j0));+    VERIFY_IS_APPROX(m2.innerVector(j0)+m2.innerVector(j1), innervec(refMat2,j0)+innervec(refMat2,j1));++    m2.innerVector(j0) *= Scalar(2);+    innervec(refMat2,j0) *= Scalar(2);+    VERIFY_IS_APPROX(m2, refMat2);++    m2.row(r0) *= Scalar(3);+    refMat2.row(r0) *= Scalar(3);+    VERIFY_IS_APPROX(m2, refMat2);++    m2.col(c0) *= Scalar(4);+    refMat2.col(c0) *= Scalar(4);+    VERIFY_IS_APPROX(m2, refMat2);++    m2.row(r0) /= Scalar(3);+    refMat2.row(r0) /= Scalar(3);+    VERIFY_IS_APPROX(m2, refMat2);++    m2.col(c0) /= Scalar(4);+    refMat2.col(c0) /= Scalar(4);+    VERIFY_IS_APPROX(m2, refMat2);++    SparseVectorType v1;+    VERIFY_IS_APPROX(v1 = m2.col(c0) * 4, refMat2.col(c0)*4);+    VERIFY_IS_APPROX(v1 = m2.row(r0) * 4, refMat2.row(r0).transpose()*4);++    SparseMatrixType m3(rows,cols);+    m3.reserve(VectorXi::Constant(outer,int(inner/2)));+    for(Index j=0; j<outer; ++j)+      for(Index k=0; k<(std::min)(j,inner); ++k)+        m3.insertByOuterInner(j,k) = internal::convert_index<StorageIndex>(k+1);+    for(Index j=0; j<(std::min)(outer, inner); ++j)+    {+      VERIFY(j==numext::real(m3.innerVector(j).nonZeros()));+      if(j>0)+        VERIFY(j==numext::real(m3.innerVector(j).lastCoeff()));+    }+    m3.makeCompressed();+    for(Index j=0; j<(std::min)(outer, inner); ++j)+    {+      VERIFY(j==numext::real(m3.innerVector(j).nonZeros()));+      if(j>0)+        VERIFY(j==numext::real(m3.innerVector(j).lastCoeff()));+    }++    VERIFY(m3.innerVector(j0).nonZeros() == m3.transpose().innerVector(j0).nonZeros());++//     m2.innerVector(j0) = 2*m2.innerVector(j1);+//     refMat2.col(j0) = 2*refMat2.col(j1);+//     VERIFY_IS_APPROX(m2, refMat2);+  }++  // test innerVectors()+  {+    DenseMatrix refMat2 = DenseMatrix::Zero(rows, cols);+    SparseMatrixType m2(rows, cols);+    initSparse<Scalar>(density, refMat2, m2);+    if(internal::random<float>(0,1)>0.5f) m2.makeCompressed();+    Index j0 = internal::random<Index>(0,outer-2);+    Index j1 = internal::random<Index>(0,outer-2);+    Index n0 = internal::random<Index>(1,outer-(std::max)(j0,j1));+    if(SparseMatrixType::IsRowMajor)+      VERIFY_IS_APPROX(m2.innerVectors(j0,n0), refMat2.block(j0,0,n0,cols));+    else+      VERIFY_IS_APPROX(m2.innerVectors(j0,n0), refMat2.block(0,j0,rows,n0));+    if(SparseMatrixType::IsRowMajor)+      VERIFY_IS_APPROX(m2.innerVectors(j0,n0)+m2.innerVectors(j1,n0),+                       refMat2.middleRows(j0,n0)+refMat2.middleRows(j1,n0));+    else+      VERIFY_IS_APPROX(m2.innerVectors(j0,n0)+m2.innerVectors(j1,n0),+                      refMat2.block(0,j0,rows,n0)+refMat2.block(0,j1,rows,n0));+    +    VERIFY_IS_APPROX(m2, refMat2);+    +    VERIFY(m2.innerVectors(j0,n0).nonZeros() == m2.transpose().innerVectors(j0,n0).nonZeros());+    +    m2.innerVectors(j0,n0) = m2.innerVectors(j0,n0) + m2.innerVectors(j1,n0);+    if(SparseMatrixType::IsRowMajor)+      refMat2.middleRows(j0,n0) = (refMat2.middleRows(j0,n0) + refMat2.middleRows(j1,n0)).eval();+    else+      refMat2.middleCols(j0,n0) = (refMat2.middleCols(j0,n0) + refMat2.middleCols(j1,n0)).eval();+    +    VERIFY_IS_APPROX(m2, refMat2);+  }++  // test generic blocks+  {+    DenseMatrix refMat2 = DenseMatrix::Zero(rows, cols);+    SparseMatrixType m2(rows, cols);+    initSparse<Scalar>(density, refMat2, m2);+    Index j0 = internal::random<Index>(0,outer-2);+    Index j1 = internal::random<Index>(0,outer-2);+    Index n0 = internal::random<Index>(1,outer-(std::max)(j0,j1));+    if(SparseMatrixType::IsRowMajor)+      VERIFY_IS_APPROX(m2.block(j0,0,n0,cols), refMat2.block(j0,0,n0,cols));+    else+      VERIFY_IS_APPROX(m2.block(0,j0,rows,n0), refMat2.block(0,j0,rows,n0));+    +    if(SparseMatrixType::IsRowMajor)+      VERIFY_IS_APPROX(m2.block(j0,0,n0,cols)+m2.block(j1,0,n0,cols),+                      refMat2.block(j0,0,n0,cols)+refMat2.block(j1,0,n0,cols));+    else+      VERIFY_IS_APPROX(m2.block(0,j0,rows,n0)+m2.block(0,j1,rows,n0),+                      refMat2.block(0,j0,rows,n0)+refMat2.block(0,j1,rows,n0));+      +    Index i = internal::random<Index>(0,m2.outerSize()-1);+    if(SparseMatrixType::IsRowMajor) {+      m2.innerVector(i) = m2.innerVector(i) * s1;+      refMat2.row(i) = refMat2.row(i) * s1;+      VERIFY_IS_APPROX(m2,refMat2);+    } else {+      m2.innerVector(i) = m2.innerVector(i) * s1;+      refMat2.col(i) = refMat2.col(i) * s1;+      VERIFY_IS_APPROX(m2,refMat2);+    }+    +    Index r0 = internal::random<Index>(0,rows-2);+    Index c0 = internal::random<Index>(0,cols-2);+    Index r1 = internal::random<Index>(1,rows-r0);+    Index c1 = internal::random<Index>(1,cols-c0);+    +    VERIFY_IS_APPROX(DenseVector(m2.col(c0)), refMat2.col(c0));+    VERIFY_IS_APPROX(m2.col(c0), refMat2.col(c0));+    +    VERIFY_IS_APPROX(RowDenseVector(m2.row(r0)), refMat2.row(r0));+    VERIFY_IS_APPROX(m2.row(r0), refMat2.row(r0));++    VERIFY_IS_APPROX(m2.block(r0,c0,r1,c1), refMat2.block(r0,c0,r1,c1));+    VERIFY_IS_APPROX((2*m2).block(r0,c0,r1,c1), (2*refMat2).block(r0,c0,r1,c1));++    if(m2.nonZeros()>0)+    {+      VERIFY_IS_APPROX(m2, refMat2);+      SparseMatrixType m3(rows, cols);+      DenseMatrix refMat3(rows, cols); refMat3.setZero();+      Index n = internal::random<Index>(1,10);+      for(Index k=0; k<n; ++k)+      {+        Index o1 = internal::random<Index>(0,outer-1);+        Index o2 = internal::random<Index>(0,outer-1);+        if(SparseMatrixType::IsRowMajor)+        {+          m3.innerVector(o1) = m2.row(o2);+          refMat3.row(o1) = refMat2.row(o2);+        }+        else+        {+          m3.innerVector(o1) = m2.col(o2);+          refMat3.col(o1) = refMat2.col(o2);+        }+        if(internal::random<bool>())+          m3.makeCompressed();+      }+      if(m3.nonZeros()>0)+      VERIFY_IS_APPROX(m3, refMat3);+    }+  }+}++void test_sparse_block()+{+  for(int i = 0; i < g_repeat; i++) {+    int r = Eigen::internal::random<int>(1,200), c = Eigen::internal::random<int>(1,200);+    if(Eigen::internal::random<int>(0,4) == 0) {+      r = c; // check square matrices in 25% of tries+    }+    EIGEN_UNUSED_VARIABLE(r+c);+    CALL_SUBTEST_1(( sparse_block(SparseMatrix<double>(1, 1)) ));+    CALL_SUBTEST_1(( sparse_block(SparseMatrix<double>(8, 8)) ));+    CALL_SUBTEST_1(( sparse_block(SparseMatrix<double>(r, c)) ));+    CALL_SUBTEST_2(( sparse_block(SparseMatrix<std::complex<double>, ColMajor>(r, c)) ));+    CALL_SUBTEST_2(( sparse_block(SparseMatrix<std::complex<double>, RowMajor>(r, c)) ));+    +    CALL_SUBTEST_3(( sparse_block(SparseMatrix<double,ColMajor,long int>(r, c)) ));+    CALL_SUBTEST_3(( sparse_block(SparseMatrix<double,RowMajor,long int>(r, c)) ));+    +    r = Eigen::internal::random<int>(1,100);+    c = Eigen::internal::random<int>(1,100);+    if(Eigen::internal::random<int>(0,4) == 0) {+      r = c; // check square matrices in 25% of tries+    }+    +    CALL_SUBTEST_4(( sparse_block(SparseMatrix<double,ColMajor,short int>(short(r), short(c))) ));+    CALL_SUBTEST_4(( sparse_block(SparseMatrix<double,RowMajor,short int>(short(r), short(c))) ));+  }+}
+ eigen3/test/sparse_permutations.cpp view
@@ -0,0 +1,236 @@+// This file is part of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2011-2015 Gael Guennebaud <gael.guennebaud@inria.fr>+//+// 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 long int nb_transposed_copies;+#define EIGEN_SPARSE_TRANSPOSED_COPY_PLUGIN {nb_transposed_copies++;}+#define VERIFY_TRANSPOSITION_COUNT(XPR,N) {\+    nb_transposed_copies = 0; \+    XPR; \+    if(nb_transposed_copies!=N) std::cerr << "nb_transposed_copies == " << nb_transposed_copies << "\n"; \+    VERIFY( (#XPR) && nb_transposed_copies==N ); \+  }++#include "sparse.h"++template<typename T>+bool is_sorted(const T& mat) {+  for(Index k = 0; k<mat.outerSize(); ++k)+  {+    Index prev = -1;+    for(typename T::InnerIterator it(mat,k); it; ++it)+    {+      if(prev>=it.index())+        return false;+      prev = it.index();+    }+  }+  return true;+}++template<typename T>+typename internal::nested_eval<T,1>::type eval(const T &xpr)+{+  VERIFY( int(internal::nested_eval<T,1>::type::Flags&RowMajorBit) == int(internal::evaluator<T>::Flags&RowMajorBit) );+  return xpr;+}++template<int OtherStorage, typename SparseMatrixType> void sparse_permutations(const SparseMatrixType& ref)+{+  const Index rows = ref.rows();+  const Index cols = ref.cols();+  typedef typename SparseMatrixType::Scalar Scalar;+  typedef typename SparseMatrixType::StorageIndex StorageIndex;+  typedef SparseMatrix<Scalar, OtherStorage, StorageIndex> OtherSparseMatrixType;+  typedef Matrix<Scalar,Dynamic,Dynamic> DenseMatrix;+  typedef Matrix<StorageIndex,Dynamic,1> VectorI;+//   bool IsRowMajor1 = SparseMatrixType::IsRowMajor;+//   bool IsRowMajor2 = OtherSparseMatrixType::IsRowMajor;+  +  double density = (std::max)(8./(rows*cols), 0.01);+  +  SparseMatrixType mat(rows, cols), up(rows,cols), lo(rows,cols);+  OtherSparseMatrixType res;+  DenseMatrix mat_d = DenseMatrix::Zero(rows, cols), up_sym_d, lo_sym_d, res_d;+  +  initSparse<Scalar>(density, mat_d, mat, 0);++  up = mat.template triangularView<Upper>();+  lo = mat.template triangularView<Lower>();+  +  up_sym_d = mat_d.template selfadjointView<Upper>();+  lo_sym_d = mat_d.template selfadjointView<Lower>();+  +  VERIFY_IS_APPROX(mat, mat_d);+  VERIFY_IS_APPROX(up, DenseMatrix(mat_d.template triangularView<Upper>()));+  VERIFY_IS_APPROX(lo, DenseMatrix(mat_d.template triangularView<Lower>()));+  +  PermutationMatrix<Dynamic> p, p_null;+  VectorI pi;+  randomPermutationVector(pi, cols);+  p.indices() = pi;++  VERIFY( is_sorted( ::eval(mat*p) ));+  VERIFY( is_sorted( res = mat*p ));+  VERIFY_TRANSPOSITION_COUNT( ::eval(mat*p), 0);+  //VERIFY_TRANSPOSITION_COUNT( res = mat*p, IsRowMajor ? 1 : 0 );+  res_d = mat_d*p;+  VERIFY(res.isApprox(res_d) && "mat*p");++  VERIFY( is_sorted( ::eval(p*mat) ));+  VERIFY( is_sorted( res = p*mat ));+  VERIFY_TRANSPOSITION_COUNT( ::eval(p*mat), 0);+  res_d = p*mat_d;+  VERIFY(res.isApprox(res_d) && "p*mat");++  VERIFY( is_sorted( (mat*p).eval() ));+  VERIFY( is_sorted( res = mat*p.inverse() ));+  VERIFY_TRANSPOSITION_COUNT( ::eval(mat*p.inverse()), 0);+  res_d = mat*p.inverse();+  VERIFY(res.isApprox(res_d) && "mat*inv(p)");++  VERIFY( is_sorted( (p*mat+p*mat).eval() ));+  VERIFY( is_sorted( res = p.inverse()*mat ));+  VERIFY_TRANSPOSITION_COUNT( ::eval(p.inverse()*mat), 0);+  res_d = p.inverse()*mat_d;+  VERIFY(res.isApprox(res_d) && "inv(p)*mat");++  VERIFY( is_sorted( (p * mat * p.inverse()).eval() ));+  VERIFY( is_sorted( res = mat.twistedBy(p) ));+  VERIFY_TRANSPOSITION_COUNT( ::eval(p * mat * p.inverse()), 0);+  res_d = (p * mat_d) * p.inverse();+  VERIFY(res.isApprox(res_d) && "p*mat*inv(p)");++  +  VERIFY( is_sorted( res = mat.template selfadjointView<Upper>().twistedBy(p_null) ));+  res_d = up_sym_d;+  VERIFY(res.isApprox(res_d) && "full selfadjoint upper to full");+  +  VERIFY( is_sorted( res = mat.template selfadjointView<Lower>().twistedBy(p_null) ));+  res_d = lo_sym_d;+  VERIFY(res.isApprox(res_d) && "full selfadjoint lower to full");+  +  +  VERIFY( is_sorted( res = up.template selfadjointView<Upper>().twistedBy(p_null) ));+  res_d = up_sym_d;+  VERIFY(res.isApprox(res_d) && "upper selfadjoint to full");+  +  VERIFY( is_sorted( res = lo.template selfadjointView<Lower>().twistedBy(p_null) ));+  res_d = lo_sym_d;+  VERIFY(res.isApprox(res_d) && "lower selfadjoint full");+++  VERIFY( is_sorted( res = mat.template selfadjointView<Upper>() ));+  res_d = up_sym_d;+  VERIFY(res.isApprox(res_d) && "full selfadjoint upper to full");++  VERIFY( is_sorted( res = mat.template selfadjointView<Lower>() ));+  res_d = lo_sym_d;+  VERIFY(res.isApprox(res_d) && "full selfadjoint lower to full");++  VERIFY( is_sorted( res = up.template selfadjointView<Upper>() ));+  res_d = up_sym_d;+  VERIFY(res.isApprox(res_d) && "upper selfadjoint to full");++  VERIFY( is_sorted( res = lo.template selfadjointView<Lower>() ));+  res_d = lo_sym_d;+  VERIFY(res.isApprox(res_d) && "lower selfadjoint full");+++  res.template selfadjointView<Upper>() = mat.template selfadjointView<Upper>();+  res_d = up_sym_d.template triangularView<Upper>();+  VERIFY(res.isApprox(res_d) && "full selfadjoint upper to upper");++  res.template selfadjointView<Lower>() = mat.template selfadjointView<Upper>();+  res_d = up_sym_d.template triangularView<Lower>();+  VERIFY(res.isApprox(res_d) && "full selfadjoint upper to lower");++  res.template selfadjointView<Upper>() = mat.template selfadjointView<Lower>();+  res_d = lo_sym_d.template triangularView<Upper>();+  VERIFY(res.isApprox(res_d) && "full selfadjoint lower to upper");++  res.template selfadjointView<Lower>() = mat.template selfadjointView<Lower>();+  res_d = lo_sym_d.template triangularView<Lower>();+  VERIFY(res.isApprox(res_d) && "full selfadjoint lower to lower");++  +  +  res.template selfadjointView<Upper>() = mat.template selfadjointView<Upper>().twistedBy(p);+  res_d = ((p * up_sym_d) * p.inverse()).eval().template triangularView<Upper>();+  VERIFY(res.isApprox(res_d) && "full selfadjoint upper twisted to upper");+  +  res.template selfadjointView<Upper>() = mat.template selfadjointView<Lower>().twistedBy(p);+  res_d = ((p * lo_sym_d) * p.inverse()).eval().template triangularView<Upper>();+  VERIFY(res.isApprox(res_d) && "full selfadjoint lower twisted to upper");+  +  res.template selfadjointView<Lower>() = mat.template selfadjointView<Lower>().twistedBy(p);+  res_d = ((p * lo_sym_d) * p.inverse()).eval().template triangularView<Lower>();+  VERIFY(res.isApprox(res_d) && "full selfadjoint lower twisted to lower");+  +  res.template selfadjointView<Lower>() = mat.template selfadjointView<Upper>().twistedBy(p);+  res_d = ((p * up_sym_d) * p.inverse()).eval().template triangularView<Lower>();+  VERIFY(res.isApprox(res_d) && "full selfadjoint upper twisted to lower");+  +  +  res.template selfadjointView<Upper>() = up.template selfadjointView<Upper>().twistedBy(p);+  res_d = ((p * up_sym_d) * p.inverse()).eval().template triangularView<Upper>();+  VERIFY(res.isApprox(res_d) && "upper selfadjoint twisted to upper");+  +  res.template selfadjointView<Upper>() = lo.template selfadjointView<Lower>().twistedBy(p);+  res_d = ((p * lo_sym_d) * p.inverse()).eval().template triangularView<Upper>();+  VERIFY(res.isApprox(res_d) && "lower selfadjoint twisted to upper");+  +  res.template selfadjointView<Lower>() = lo.template selfadjointView<Lower>().twistedBy(p);+  res_d = ((p * lo_sym_d) * p.inverse()).eval().template triangularView<Lower>();+  VERIFY(res.isApprox(res_d) && "lower selfadjoint twisted to lower");+  +  res.template selfadjointView<Lower>() = up.template selfadjointView<Upper>().twistedBy(p);+  res_d = ((p * up_sym_d) * p.inverse()).eval().template triangularView<Lower>();+  VERIFY(res.isApprox(res_d) && "upper selfadjoint twisted to lower");++  +  VERIFY( is_sorted( res = mat.template selfadjointView<Upper>().twistedBy(p) ));+  res_d = (p * up_sym_d) * p.inverse();+  VERIFY(res.isApprox(res_d) && "full selfadjoint upper twisted to full");+  +  VERIFY( is_sorted( res = mat.template selfadjointView<Lower>().twistedBy(p) ));+  res_d = (p * lo_sym_d) * p.inverse();+  VERIFY(res.isApprox(res_d) && "full selfadjoint lower twisted to full");+  +  VERIFY( is_sorted( res = up.template selfadjointView<Upper>().twistedBy(p) ));+  res_d = (p * up_sym_d) * p.inverse();+  VERIFY(res.isApprox(res_d) && "upper selfadjoint twisted to full");+  +  VERIFY( is_sorted( res = lo.template selfadjointView<Lower>().twistedBy(p) ));+  res_d = (p * lo_sym_d) * p.inverse();+  VERIFY(res.isApprox(res_d) && "lower selfadjoint twisted to full");+}++template<typename Scalar> void sparse_permutations_all(int size)+{+  CALL_SUBTEST(( sparse_permutations<ColMajor>(SparseMatrix<Scalar, ColMajor>(size,size)) ));+  CALL_SUBTEST(( sparse_permutations<ColMajor>(SparseMatrix<Scalar, RowMajor>(size,size)) ));+  CALL_SUBTEST(( sparse_permutations<RowMajor>(SparseMatrix<Scalar, ColMajor>(size,size)) ));+  CALL_SUBTEST(( sparse_permutations<RowMajor>(SparseMatrix<Scalar, RowMajor>(size,size)) ));+}++void test_sparse_permutations()+{+  for(int i = 0; i < g_repeat; i++) {+    int s = Eigen::internal::random<int>(1,50);+    CALL_SUBTEST_1((  sparse_permutations_all<double>(s) ));+    CALL_SUBTEST_2((  sparse_permutations_all<std::complex<double> >(s) ));+  }++  VERIFY((internal::is_same<internal::permutation_matrix_product<SparseMatrix<double>,OnTheRight,false,SparseShape>::ReturnType,+                            internal::nested_eval<Product<SparseMatrix<double>,PermutationMatrix<Dynamic,Dynamic>,AliasFreeProduct>,1>::type>::value));++  VERIFY((internal::is_same<internal::permutation_matrix_product<SparseMatrix<double>,OnTheLeft,false,SparseShape>::ReturnType,+                            internal::nested_eval<Product<PermutationMatrix<Dynamic,Dynamic>,SparseMatrix<double>,AliasFreeProduct>,1>::type>::value));+}
+ eigen3/test/sparse_product.cpp view
@@ -0,0 +1,475 @@+// This file is part of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2008-2011 Gael Guennebaud <gael.guennebaud@inria.fr>+//+// 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(_MSC_VER) && (_MSC_VER==1800)+// This unit test takes forever to compile in Release mode with MSVC 2013,+// multiple hours. So let's switch off optimization for this one.+#pragma optimize("",off)+#endif++static long int nb_temporaries;++inline void on_temporary_creation() {+  // here's a great place to set a breakpoint when debugging failures in this test!+  nb_temporaries++;+}++#define EIGEN_SPARSE_CREATE_TEMPORARY_PLUGIN { on_temporary_creation(); }++#include "sparse.h"++#define VERIFY_EVALUATION_COUNT(XPR,N) {\+    nb_temporaries = 0; \+    CALL_SUBTEST( XPR ); \+    if(nb_temporaries!=N) std::cerr << "nb_temporaries == " << nb_temporaries << "\n"; \+    VERIFY( (#XPR) && nb_temporaries==N ); \+  }++++template<typename SparseMatrixType> void sparse_product()+{+  typedef typename SparseMatrixType::StorageIndex StorageIndex;+  Index n = 100;+  const Index rows  = internal::random<Index>(1,n);+  const Index cols  = internal::random<Index>(1,n);+  const Index depth = internal::random<Index>(1,n);+  typedef typename SparseMatrixType::Scalar Scalar;+  enum { Flags = SparseMatrixType::Flags };++  double density = (std::max)(8./(rows*cols), 0.2);+  typedef Matrix<Scalar,Dynamic,Dynamic> DenseMatrix;+  typedef Matrix<Scalar,Dynamic,1> DenseVector;+  typedef Matrix<Scalar,1,Dynamic> RowDenseVector;+  typedef SparseVector<Scalar,0,StorageIndex> ColSpVector;+  typedef SparseVector<Scalar,RowMajor,StorageIndex> RowSpVector;++  Scalar s1 = internal::random<Scalar>();+  Scalar s2 = internal::random<Scalar>();++  // test matrix-matrix product+  {+    DenseMatrix refMat2  = DenseMatrix::Zero(rows, depth);+    DenseMatrix refMat2t = DenseMatrix::Zero(depth, rows);+    DenseMatrix refMat3  = DenseMatrix::Zero(depth, cols);+    DenseMatrix refMat3t = DenseMatrix::Zero(cols, depth);+    DenseMatrix refMat4  = DenseMatrix::Zero(rows, cols);+    DenseMatrix refMat4t = DenseMatrix::Zero(cols, rows);+    DenseMatrix refMat5  = DenseMatrix::Random(depth, cols);+    DenseMatrix refMat6  = DenseMatrix::Random(rows, rows);+    DenseMatrix dm4 = DenseMatrix::Zero(rows, rows);+//     DenseVector dv1 = DenseVector::Random(rows);+    SparseMatrixType m2 (rows, depth);+    SparseMatrixType m2t(depth, rows);+    SparseMatrixType m3 (depth, cols);+    SparseMatrixType m3t(cols, depth);+    SparseMatrixType m4 (rows, cols);+    SparseMatrixType m4t(cols, rows);+    SparseMatrixType m6(rows, rows);+    initSparse(density, refMat2,  m2);+    initSparse(density, refMat2t, m2t);+    initSparse(density, refMat3,  m3);+    initSparse(density, refMat3t, m3t);+    initSparse(density, refMat4,  m4);+    initSparse(density, refMat4t, m4t);+    initSparse(density, refMat6, m6);++//     int c = internal::random<int>(0,depth-1);++    // sparse * sparse+    VERIFY_IS_APPROX(m4=m2*m3, refMat4=refMat2*refMat3);+    VERIFY_IS_APPROX(m4=m2t.transpose()*m3, refMat4=refMat2t.transpose()*refMat3);+    VERIFY_IS_APPROX(m4=m2t.transpose()*m3t.transpose(), refMat4=refMat2t.transpose()*refMat3t.transpose());+    VERIFY_IS_APPROX(m4=m2*m3t.transpose(), refMat4=refMat2*refMat3t.transpose());++    VERIFY_IS_APPROX(m4 = m2*m3/s1, refMat4 = refMat2*refMat3/s1);+    VERIFY_IS_APPROX(m4 = m2*m3*s1, refMat4 = refMat2*refMat3*s1);+    VERIFY_IS_APPROX(m4 = s2*m2*m3*s1, refMat4 = s2*refMat2*refMat3*s1);+    VERIFY_IS_APPROX(m4 = (m2+m2)*m3, refMat4 = (refMat2+refMat2)*refMat3);+    VERIFY_IS_APPROX(m4 = m2*m3.leftCols(cols/2), refMat4 = refMat2*refMat3.leftCols(cols/2));+    VERIFY_IS_APPROX(m4 = m2*(m3+m3).leftCols(cols/2), refMat4 = refMat2*(refMat3+refMat3).leftCols(cols/2));++    VERIFY_IS_APPROX(m4=(m2*m3).pruned(0), refMat4=refMat2*refMat3);+    VERIFY_IS_APPROX(m4=(m2t.transpose()*m3).pruned(0), refMat4=refMat2t.transpose()*refMat3);+    VERIFY_IS_APPROX(m4=(m2t.transpose()*m3t.transpose()).pruned(0), refMat4=refMat2t.transpose()*refMat3t.transpose());+    VERIFY_IS_APPROX(m4=(m2*m3t.transpose()).pruned(0), refMat4=refMat2*refMat3t.transpose());++    // make sure the right product implementation is called:+    if((!SparseMatrixType::IsRowMajor) && m2.rows()<=m3.cols())+    {+      VERIFY_EVALUATION_COUNT(m4 = m2*m3, 3); // 1 temp for the result + 2 for transposing and get a sorted result.+      VERIFY_EVALUATION_COUNT(m4 = (m2*m3).pruned(0), 1);+      VERIFY_EVALUATION_COUNT(m4 = (m2*m3).eval().pruned(0), 4);+    }++    // and that pruning is effective:+    {+      DenseMatrix Ad(2,2);+      Ad << -1, 1, 1, 1;+      SparseMatrixType As(Ad.sparseView()), B(2,2);+      VERIFY_IS_EQUAL( (As*As.transpose()).eval().nonZeros(), 4);+      VERIFY_IS_EQUAL( (Ad*Ad.transpose()).eval().sparseView().eval().nonZeros(), 2);+      VERIFY_IS_EQUAL( (As*As.transpose()).pruned(1e-6).eval().nonZeros(), 2);+    }++    // dense ?= sparse * sparse+    VERIFY_IS_APPROX(dm4 =m2*m3, refMat4 =refMat2*refMat3);+    VERIFY_IS_APPROX(dm4+=m2*m3, refMat4+=refMat2*refMat3);+    VERIFY_IS_APPROX(dm4-=m2*m3, refMat4-=refMat2*refMat3);+    VERIFY_IS_APPROX(dm4 =m2t.transpose()*m3, refMat4 =refMat2t.transpose()*refMat3);+    VERIFY_IS_APPROX(dm4+=m2t.transpose()*m3, refMat4+=refMat2t.transpose()*refMat3);+    VERIFY_IS_APPROX(dm4-=m2t.transpose()*m3, refMat4-=refMat2t.transpose()*refMat3);+    VERIFY_IS_APPROX(dm4 =m2t.transpose()*m3t.transpose(), refMat4 =refMat2t.transpose()*refMat3t.transpose());+    VERIFY_IS_APPROX(dm4+=m2t.transpose()*m3t.transpose(), refMat4+=refMat2t.transpose()*refMat3t.transpose());+    VERIFY_IS_APPROX(dm4-=m2t.transpose()*m3t.transpose(), refMat4-=refMat2t.transpose()*refMat3t.transpose());+    VERIFY_IS_APPROX(dm4 =m2*m3t.transpose(), refMat4 =refMat2*refMat3t.transpose());+    VERIFY_IS_APPROX(dm4+=m2*m3t.transpose(), refMat4+=refMat2*refMat3t.transpose());+    VERIFY_IS_APPROX(dm4-=m2*m3t.transpose(), refMat4-=refMat2*refMat3t.transpose());+    VERIFY_IS_APPROX(dm4 = m2*m3*s1, refMat4 = refMat2*refMat3*s1);++    // test aliasing+    m4 = m2; refMat4 = refMat2;+    VERIFY_IS_APPROX(m4=m4*m3, refMat4=refMat4*refMat3);++    // sparse * dense matrix+    VERIFY_IS_APPROX(dm4=m2*refMat3, refMat4=refMat2*refMat3);+    VERIFY_IS_APPROX(dm4=m2*refMat3t.transpose(), refMat4=refMat2*refMat3t.transpose());+    VERIFY_IS_APPROX(dm4=m2t.transpose()*refMat3, refMat4=refMat2t.transpose()*refMat3);+    VERIFY_IS_APPROX(dm4=m2t.transpose()*refMat3t.transpose(), refMat4=refMat2t.transpose()*refMat3t.transpose());++    VERIFY_IS_APPROX(dm4=m2*refMat3, refMat4=refMat2*refMat3);+    VERIFY_IS_APPROX(dm4=dm4+m2*refMat3, refMat4=refMat4+refMat2*refMat3);+    VERIFY_IS_APPROX(dm4+=m2*refMat3, refMat4+=refMat2*refMat3);+    VERIFY_IS_APPROX(dm4-=m2*refMat3, refMat4-=refMat2*refMat3);+    VERIFY_IS_APPROX(dm4.noalias()+=m2*refMat3, refMat4+=refMat2*refMat3);+    VERIFY_IS_APPROX(dm4.noalias()-=m2*refMat3, refMat4-=refMat2*refMat3);+    VERIFY_IS_APPROX(dm4=m2*(refMat3+refMat3), refMat4=refMat2*(refMat3+refMat3));+    VERIFY_IS_APPROX(dm4=m2t.transpose()*(refMat3+refMat5)*0.5, refMat4=refMat2t.transpose()*(refMat3+refMat5)*0.5);+    +    // sparse * dense vector+    VERIFY_IS_APPROX(dm4.col(0)=m2*refMat3.col(0), refMat4.col(0)=refMat2*refMat3.col(0));+    VERIFY_IS_APPROX(dm4.col(0)=m2*refMat3t.transpose().col(0), refMat4.col(0)=refMat2*refMat3t.transpose().col(0));+    VERIFY_IS_APPROX(dm4.col(0)=m2t.transpose()*refMat3.col(0), refMat4.col(0)=refMat2t.transpose()*refMat3.col(0));+    VERIFY_IS_APPROX(dm4.col(0)=m2t.transpose()*refMat3t.transpose().col(0), refMat4.col(0)=refMat2t.transpose()*refMat3t.transpose().col(0));++    // dense * sparse+    VERIFY_IS_APPROX(dm4=refMat2*m3, refMat4=refMat2*refMat3);+    VERIFY_IS_APPROX(dm4=dm4+refMat2*m3, refMat4=refMat4+refMat2*refMat3);+    VERIFY_IS_APPROX(dm4+=refMat2*m3, refMat4+=refMat2*refMat3);+    VERIFY_IS_APPROX(dm4-=refMat2*m3, refMat4-=refMat2*refMat3);+    VERIFY_IS_APPROX(dm4.noalias()+=refMat2*m3, refMat4+=refMat2*refMat3);+    VERIFY_IS_APPROX(dm4.noalias()-=refMat2*m3, refMat4-=refMat2*refMat3);+    VERIFY_IS_APPROX(dm4=refMat2*m3t.transpose(), refMat4=refMat2*refMat3t.transpose());+    VERIFY_IS_APPROX(dm4=refMat2t.transpose()*m3, refMat4=refMat2t.transpose()*refMat3);+    VERIFY_IS_APPROX(dm4=refMat2t.transpose()*m3t.transpose(), refMat4=refMat2t.transpose()*refMat3t.transpose());++    // sparse * dense and dense * sparse outer product+    {+      Index c  = internal::random<Index>(0,depth-1);+      Index r  = internal::random<Index>(0,rows-1);+      Index c1 = internal::random<Index>(0,cols-1);+      Index r1 = internal::random<Index>(0,depth-1);+      DenseMatrix dm5  = DenseMatrix::Random(depth, cols);++      VERIFY_IS_APPROX( m4=m2.col(c)*dm5.col(c1).transpose(), refMat4=refMat2.col(c)*dm5.col(c1).transpose());+      VERIFY_IS_EQUAL(m4.nonZeros(), (refMat4.array()!=0).count());+      VERIFY_IS_APPROX( m4=m2.middleCols(c,1)*dm5.col(c1).transpose(), refMat4=refMat2.col(c)*dm5.col(c1).transpose());+      VERIFY_IS_EQUAL(m4.nonZeros(), (refMat4.array()!=0).count());+      VERIFY_IS_APPROX(dm4=m2.col(c)*dm5.col(c1).transpose(), refMat4=refMat2.col(c)*dm5.col(c1).transpose());+      +      VERIFY_IS_APPROX(m4=dm5.col(c1)*m2.col(c).transpose(), refMat4=dm5.col(c1)*refMat2.col(c).transpose());+      VERIFY_IS_EQUAL(m4.nonZeros(), (refMat4.array()!=0).count());+      VERIFY_IS_APPROX(m4=dm5.col(c1)*m2.middleCols(c,1).transpose(), refMat4=dm5.col(c1)*refMat2.col(c).transpose());+      VERIFY_IS_EQUAL(m4.nonZeros(), (refMat4.array()!=0).count());+      VERIFY_IS_APPROX(dm4=dm5.col(c1)*m2.col(c).transpose(), refMat4=dm5.col(c1)*refMat2.col(c).transpose());++      VERIFY_IS_APPROX( m4=dm5.row(r1).transpose()*m2.col(c).transpose(), refMat4=dm5.row(r1).transpose()*refMat2.col(c).transpose());+      VERIFY_IS_EQUAL(m4.nonZeros(), (refMat4.array()!=0).count());+      VERIFY_IS_APPROX(dm4=dm5.row(r1).transpose()*m2.col(c).transpose(), refMat4=dm5.row(r1).transpose()*refMat2.col(c).transpose());++      VERIFY_IS_APPROX( m4=m2.row(r).transpose()*dm5.col(c1).transpose(), refMat4=refMat2.row(r).transpose()*dm5.col(c1).transpose());+      VERIFY_IS_EQUAL(m4.nonZeros(), (refMat4.array()!=0).count());+      VERIFY_IS_APPROX( m4=m2.middleRows(r,1).transpose()*dm5.col(c1).transpose(), refMat4=refMat2.row(r).transpose()*dm5.col(c1).transpose());+      VERIFY_IS_EQUAL(m4.nonZeros(), (refMat4.array()!=0).count());+      VERIFY_IS_APPROX(dm4=m2.row(r).transpose()*dm5.col(c1).transpose(), refMat4=refMat2.row(r).transpose()*dm5.col(c1).transpose());++      VERIFY_IS_APPROX( m4=dm5.col(c1)*m2.row(r), refMat4=dm5.col(c1)*refMat2.row(r));+      VERIFY_IS_EQUAL(m4.nonZeros(), (refMat4.array()!=0).count());+      VERIFY_IS_APPROX( m4=dm5.col(c1)*m2.middleRows(r,1), refMat4=dm5.col(c1)*refMat2.row(r));+      VERIFY_IS_EQUAL(m4.nonZeros(), (refMat4.array()!=0).count());+      VERIFY_IS_APPROX(dm4=dm5.col(c1)*m2.row(r), refMat4=dm5.col(c1)*refMat2.row(r));++      VERIFY_IS_APPROX( m4=dm5.row(r1).transpose()*m2.row(r), refMat4=dm5.row(r1).transpose()*refMat2.row(r));+      VERIFY_IS_EQUAL(m4.nonZeros(), (refMat4.array()!=0).count());+      VERIFY_IS_APPROX(dm4=dm5.row(r1).transpose()*m2.row(r), refMat4=dm5.row(r1).transpose()*refMat2.row(r));+    }++    VERIFY_IS_APPROX(m6=m6*m6, refMat6=refMat6*refMat6);+    +    // sparse matrix * sparse vector+    ColSpVector cv0(cols), cv1;+    DenseVector dcv0(cols), dcv1;+    initSparse(2*density,dcv0, cv0);+    +    RowSpVector rv0(depth), rv1;+    RowDenseVector drv0(depth), drv1(rv1);+    initSparse(2*density,drv0, rv0);++    VERIFY_IS_APPROX(cv1=m3*cv0, dcv1=refMat3*dcv0);    +    VERIFY_IS_APPROX(rv1=rv0*m3, drv1=drv0*refMat3);+    VERIFY_IS_APPROX(cv1=m3t.adjoint()*cv0, dcv1=refMat3t.adjoint()*dcv0);+    VERIFY_IS_APPROX(cv1=rv0*m3, dcv1=drv0*refMat3);+    VERIFY_IS_APPROX(rv1=m3*cv0, drv1=refMat3*dcv0);+  }+  +  // test matrix - diagonal product+  {+    DenseMatrix refM2 = DenseMatrix::Zero(rows, cols);+    DenseMatrix refM3 = DenseMatrix::Zero(rows, cols);+    DenseMatrix d3 = DenseMatrix::Zero(rows, cols);+    DiagonalMatrix<Scalar,Dynamic> d1(DenseVector::Random(cols));+    DiagonalMatrix<Scalar,Dynamic> d2(DenseVector::Random(rows));+    SparseMatrixType m2(rows, cols);+    SparseMatrixType m3(rows, cols);+    initSparse<Scalar>(density, refM2, m2);+    initSparse<Scalar>(density, refM3, m3);+    VERIFY_IS_APPROX(m3=m2*d1, refM3=refM2*d1);+    VERIFY_IS_APPROX(m3=m2.transpose()*d2, refM3=refM2.transpose()*d2);+    VERIFY_IS_APPROX(m3=d2*m2, refM3=d2*refM2);+    VERIFY_IS_APPROX(m3=d1*m2.transpose(), refM3=d1*refM2.transpose());+    +    // also check with a SparseWrapper:+    DenseVector v1 = DenseVector::Random(cols);+    DenseVector v2 = DenseVector::Random(rows);+    DenseVector v3 = DenseVector::Random(rows);+    VERIFY_IS_APPROX(m3=m2*v1.asDiagonal(), refM3=refM2*v1.asDiagonal());+    VERIFY_IS_APPROX(m3=m2.transpose()*v2.asDiagonal(), refM3=refM2.transpose()*v2.asDiagonal());+    VERIFY_IS_APPROX(m3=v2.asDiagonal()*m2, refM3=v2.asDiagonal()*refM2);+    VERIFY_IS_APPROX(m3=v1.asDiagonal()*m2.transpose(), refM3=v1.asDiagonal()*refM2.transpose());+    +    VERIFY_IS_APPROX(m3=v2.asDiagonal()*m2*v1.asDiagonal(), refM3=v2.asDiagonal()*refM2*v1.asDiagonal());++    VERIFY_IS_APPROX(v2=m2*v1.asDiagonal()*v1, refM2*v1.asDiagonal()*v1);+    VERIFY_IS_APPROX(v3=v2.asDiagonal()*m2*v1, v2.asDiagonal()*refM2*v1);+    +    // evaluate to a dense matrix to check the .row() and .col() iterator functions+    VERIFY_IS_APPROX(d3=m2*d1, refM3=refM2*d1);+    VERIFY_IS_APPROX(d3=m2.transpose()*d2, refM3=refM2.transpose()*d2);+    VERIFY_IS_APPROX(d3=d2*m2, refM3=d2*refM2);+    VERIFY_IS_APPROX(d3=d1*m2.transpose(), refM3=d1*refM2.transpose());+  }++  // test self-adjoint and triangular-view products+  {+    DenseMatrix b = DenseMatrix::Random(rows, rows);+    DenseMatrix x = DenseMatrix::Random(rows, rows);+    DenseMatrix refX = DenseMatrix::Random(rows, rows);+    DenseMatrix refUp = DenseMatrix::Zero(rows, rows);+    DenseMatrix refLo = DenseMatrix::Zero(rows, rows);+    DenseMatrix refS = DenseMatrix::Zero(rows, rows);+    DenseMatrix refA = DenseMatrix::Zero(rows, rows);+    SparseMatrixType mUp(rows, rows);+    SparseMatrixType mLo(rows, rows);+    SparseMatrixType mS(rows, rows);+    SparseMatrixType mA(rows, rows);+    initSparse<Scalar>(density, refA, mA);+    do {+      initSparse<Scalar>(density, refUp, mUp, ForceRealDiag|/*ForceNonZeroDiag|*/MakeUpperTriangular);+    } while (refUp.isZero());+    refLo = refUp.adjoint();+    mLo = mUp.adjoint();+    refS = refUp + refLo;+    refS.diagonal() *= 0.5;+    mS = mUp + mLo;+    // TODO be able to address the diagonal....+    for (int k=0; k<mS.outerSize(); ++k)+      for (typename SparseMatrixType::InnerIterator it(mS,k); it; ++it)+        if (it.index() == k)+          it.valueRef() *= Scalar(0.5);++    VERIFY_IS_APPROX(refS.adjoint(), refS);+    VERIFY_IS_APPROX(mS.adjoint(), mS);+    VERIFY_IS_APPROX(mS, refS);+    VERIFY_IS_APPROX(x=mS*b, refX=refS*b);++    // sparse selfadjointView with dense matrices+    VERIFY_IS_APPROX(x=mUp.template selfadjointView<Upper>()*b, refX=refS*b);+    VERIFY_IS_APPROX(x=mLo.template selfadjointView<Lower>()*b, refX=refS*b);+    VERIFY_IS_APPROX(x=mS.template selfadjointView<Upper|Lower>()*b, refX=refS*b);++    VERIFY_IS_APPROX(x=b * mUp.template selfadjointView<Upper>(),       refX=b*refS);+    VERIFY_IS_APPROX(x=b * mLo.template selfadjointView<Lower>(),       refX=b*refS);+    VERIFY_IS_APPROX(x=b * mS.template selfadjointView<Upper|Lower>(),  refX=b*refS);++    VERIFY_IS_APPROX(x.noalias()+=mUp.template selfadjointView<Upper>()*b, refX+=refS*b);+    VERIFY_IS_APPROX(x.noalias()-=mLo.template selfadjointView<Lower>()*b, refX-=refS*b);+    VERIFY_IS_APPROX(x.noalias()+=mS.template selfadjointView<Upper|Lower>()*b, refX+=refS*b);+    +    // sparse selfadjointView with sparse matrices+    SparseMatrixType mSres(rows,rows);+    VERIFY_IS_APPROX(mSres = mLo.template selfadjointView<Lower>()*mS,+                     refX = refLo.template selfadjointView<Lower>()*refS);+    VERIFY_IS_APPROX(mSres = mS * mLo.template selfadjointView<Lower>(),+                     refX = refS * refLo.template selfadjointView<Lower>());+    +    // sparse triangularView with dense matrices+    VERIFY_IS_APPROX(x=mA.template triangularView<Upper>()*b, refX=refA.template triangularView<Upper>()*b);+    VERIFY_IS_APPROX(x=mA.template triangularView<Lower>()*b, refX=refA.template triangularView<Lower>()*b);+    VERIFY_IS_APPROX(x=b*mA.template triangularView<Upper>(), refX=b*refA.template triangularView<Upper>());+    VERIFY_IS_APPROX(x=b*mA.template triangularView<Lower>(), refX=b*refA.template triangularView<Lower>());+    +    // sparse triangularView with sparse matrices+    VERIFY_IS_APPROX(mSres = mA.template triangularView<Lower>()*mS,   refX = refA.template triangularView<Lower>()*refS);+    VERIFY_IS_APPROX(mSres = mS * mA.template triangularView<Lower>(), refX = refS * refA.template triangularView<Lower>());+    VERIFY_IS_APPROX(mSres = mA.template triangularView<Upper>()*mS,   refX = refA.template triangularView<Upper>()*refS);+    VERIFY_IS_APPROX(mSres = mS * mA.template triangularView<Upper>(), refX = refS * refA.template triangularView<Upper>());+  }+}++// New test for Bug in SparseTimeDenseProduct+template<typename SparseMatrixType, typename DenseMatrixType> void sparse_product_regression_test()+{+  // This code does not compile with afflicted versions of the bug+  SparseMatrixType sm1(3,2);+  DenseMatrixType m2(2,2);+  sm1.setZero();+  m2.setZero();++  DenseMatrixType m3 = sm1*m2;+++  // This code produces a segfault with afflicted versions of another SparseTimeDenseProduct+  // bug++  SparseMatrixType sm2(20000,2);+  sm2.setZero();+  DenseMatrixType m4(sm2*m2);++  VERIFY_IS_APPROX( m4(0,0), 0.0 );+}++template<typename Scalar>+void bug_942()+{+  typedef Matrix<Scalar, Dynamic, 1>     Vector;+  typedef SparseMatrix<Scalar, ColMajor> ColSpMat;+  typedef SparseMatrix<Scalar, RowMajor> RowSpMat;+  ColSpMat cmA(1,1);+  cmA.insert(0,0) = 1;++  RowSpMat rmA(1,1);+  rmA.insert(0,0) = 1;++  Vector d(1);+  d[0] = 2;+  +  double res = 2;+  +  VERIFY_IS_APPROX( ( cmA*d.asDiagonal() ).eval().coeff(0,0), res );+  VERIFY_IS_APPROX( ( d.asDiagonal()*rmA ).eval().coeff(0,0), res );+  VERIFY_IS_APPROX( ( rmA*d.asDiagonal() ).eval().coeff(0,0), res );+  VERIFY_IS_APPROX( ( d.asDiagonal()*cmA ).eval().coeff(0,0), res );+}++template<typename Real>+void test_mixing_types()+{+  typedef std::complex<Real> Cplx;+  typedef SparseMatrix<Real> SpMatReal;+  typedef SparseMatrix<Cplx> SpMatCplx;+  typedef SparseMatrix<Cplx,RowMajor> SpRowMatCplx;+  typedef Matrix<Real,Dynamic,Dynamic> DenseMatReal;+  typedef Matrix<Cplx,Dynamic,Dynamic> DenseMatCplx;++  Index n = internal::random<Index>(1,100);+  double density = (std::max)(8./(n*n), 0.2);++  SpMatReal sR1(n,n);+  SpMatCplx sC1(n,n), sC2(n,n), sC3(n,n);+  SpRowMatCplx sCR(n,n);+  DenseMatReal dR1(n,n);+  DenseMatCplx dC1(n,n), dC2(n,n), dC3(n,n);++  initSparse<Real>(density, dR1, sR1);+  initSparse<Cplx>(density, dC1, sC1);+  initSparse<Cplx>(density, dC2, sC2);++  VERIFY_IS_APPROX( sC2 = (sR1 * sC1),                         dC3 = dR1.template cast<Cplx>() * dC1 );+  VERIFY_IS_APPROX( sC2 = (sC1 * sR1),                         dC3 = dC1 * dR1.template cast<Cplx>() );+  VERIFY_IS_APPROX( sC2 = (sR1.transpose() * sC1),             dC3 = dR1.template cast<Cplx>().transpose() * dC1 );+  VERIFY_IS_APPROX( sC2 = (sC1.transpose() * sR1),             dC3 = dC1.transpose() * dR1.template cast<Cplx>() );+  VERIFY_IS_APPROX( sC2 = (sR1 * sC1.transpose()),             dC3 = dR1.template cast<Cplx>() * dC1.transpose() );+  VERIFY_IS_APPROX( sC2 = (sC1 * sR1.transpose()),             dC3 = dC1 * dR1.template cast<Cplx>().transpose() );+  VERIFY_IS_APPROX( sC2 = (sR1.transpose() * sC1.transpose()), dC3 = dR1.template cast<Cplx>().transpose() * dC1.transpose() );+  VERIFY_IS_APPROX( sC2 = (sC1.transpose() * sR1.transpose()), dC3 = dC1.transpose() * dR1.template cast<Cplx>().transpose() );++  VERIFY_IS_APPROX( sCR = (sR1 * sC1),                         dC3 = dR1.template cast<Cplx>() * dC1 );+  VERIFY_IS_APPROX( sCR = (sC1 * sR1),                         dC3 = dC1 * dR1.template cast<Cplx>() );+  VERIFY_IS_APPROX( sCR = (sR1.transpose() * sC1),             dC3 = dR1.template cast<Cplx>().transpose() * dC1 );+  VERIFY_IS_APPROX( sCR = (sC1.transpose() * sR1),             dC3 = dC1.transpose() * dR1.template cast<Cplx>() );+  VERIFY_IS_APPROX( sCR = (sR1 * sC1.transpose()),             dC3 = dR1.template cast<Cplx>() * dC1.transpose() );+  VERIFY_IS_APPROX( sCR = (sC1 * sR1.transpose()),             dC3 = dC1 * dR1.template cast<Cplx>().transpose() );+  VERIFY_IS_APPROX( sCR = (sR1.transpose() * sC1.transpose()), dC3 = dR1.template cast<Cplx>().transpose() * dC1.transpose() );+  VERIFY_IS_APPROX( sCR = (sC1.transpose() * sR1.transpose()), dC3 = dC1.transpose() * dR1.template cast<Cplx>().transpose() );+++  VERIFY_IS_APPROX( sC2 = (sR1 * sC1).pruned(),                         dC3 = dR1.template cast<Cplx>() * dC1 );+  VERIFY_IS_APPROX( sC2 = (sC1 * sR1).pruned(),                         dC3 = dC1 * dR1.template cast<Cplx>() );+  VERIFY_IS_APPROX( sC2 = (sR1.transpose() * sC1).pruned(),             dC3 = dR1.template cast<Cplx>().transpose() * dC1 );+  VERIFY_IS_APPROX( sC2 = (sC1.transpose() * sR1).pruned(),             dC3 = dC1.transpose() * dR1.template cast<Cplx>() );+  VERIFY_IS_APPROX( sC2 = (sR1 * sC1.transpose()).pruned(),             dC3 = dR1.template cast<Cplx>() * dC1.transpose() );+  VERIFY_IS_APPROX( sC2 = (sC1 * sR1.transpose()).pruned(),             dC3 = dC1 * dR1.template cast<Cplx>().transpose() );+  VERIFY_IS_APPROX( sC2 = (sR1.transpose() * sC1.transpose()).pruned(), dC3 = dR1.template cast<Cplx>().transpose() * dC1.transpose() );+  VERIFY_IS_APPROX( sC2 = (sC1.transpose() * sR1.transpose()).pruned(), dC3 = dC1.transpose() * dR1.template cast<Cplx>().transpose() );++  VERIFY_IS_APPROX( sCR = (sR1 * sC1).pruned(),                         dC3 = dR1.template cast<Cplx>() * dC1 );+  VERIFY_IS_APPROX( sCR = (sC1 * sR1).pruned(),                         dC3 = dC1 * dR1.template cast<Cplx>() );+  VERIFY_IS_APPROX( sCR = (sR1.transpose() * sC1).pruned(),             dC3 = dR1.template cast<Cplx>().transpose() * dC1 );+  VERIFY_IS_APPROX( sCR = (sC1.transpose() * sR1).pruned(),             dC3 = dC1.transpose() * dR1.template cast<Cplx>() );+  VERIFY_IS_APPROX( sCR = (sR1 * sC1.transpose()).pruned(),             dC3 = dR1.template cast<Cplx>() * dC1.transpose() );+  VERIFY_IS_APPROX( sCR = (sC1 * sR1.transpose()).pruned(),             dC3 = dC1 * dR1.template cast<Cplx>().transpose() );+  VERIFY_IS_APPROX( sCR = (sR1.transpose() * sC1.transpose()).pruned(), dC3 = dR1.template cast<Cplx>().transpose() * dC1.transpose() );+  VERIFY_IS_APPROX( sCR = (sC1.transpose() * sR1.transpose()).pruned(), dC3 = dC1.transpose() * dR1.template cast<Cplx>().transpose() );+++  VERIFY_IS_APPROX( dC2 = (sR1 * sC1),                         dC3 = dR1.template cast<Cplx>() * dC1 );+  VERIFY_IS_APPROX( dC2 = (sC1 * sR1),                         dC3 = dC1 * dR1.template cast<Cplx>() );+  VERIFY_IS_APPROX( dC2 = (sR1.transpose() * sC1),             dC3 = dR1.template cast<Cplx>().transpose() * dC1 );+  VERIFY_IS_APPROX( dC2 = (sC1.transpose() * sR1),             dC3 = dC1.transpose() * dR1.template cast<Cplx>() );+  VERIFY_IS_APPROX( dC2 = (sR1 * sC1.transpose()),             dC3 = dR1.template cast<Cplx>() * dC1.transpose() );+  VERIFY_IS_APPROX( dC2 = (sC1 * sR1.transpose()),             dC3 = dC1 * dR1.template cast<Cplx>().transpose() );+  VERIFY_IS_APPROX( dC2 = (sR1.transpose() * sC1.transpose()), dC3 = dR1.template cast<Cplx>().transpose() * dC1.transpose() );+  VERIFY_IS_APPROX( dC2 = (sC1.transpose() * sR1.transpose()), dC3 = dC1.transpose() * dR1.template cast<Cplx>().transpose() );+++  VERIFY_IS_APPROX( dC2 = dR1 * sC1, dC3 = dR1.template cast<Cplx>() * sC1 );+  VERIFY_IS_APPROX( dC2 = sR1 * dC1, dC3 = sR1.template cast<Cplx>() * dC1 );+  VERIFY_IS_APPROX( dC2 = dC1 * sR1, dC3 = dC1 * sR1.template cast<Cplx>() );+  VERIFY_IS_APPROX( dC2 = sC1 * dR1, dC3 = sC1 * dR1.template cast<Cplx>() );++  VERIFY_IS_APPROX( dC2 = dR1.row(0) * sC1, dC3 = dR1.template cast<Cplx>().row(0) * sC1 );+  VERIFY_IS_APPROX( dC2 = sR1 * dC1.col(0), dC3 = sR1.template cast<Cplx>() * dC1.col(0) );+  VERIFY_IS_APPROX( dC2 = dC1.row(0) * sR1, dC3 = dC1.row(0) * sR1.template cast<Cplx>() );+  VERIFY_IS_APPROX( dC2 = sC1 * dR1.col(0), dC3 = sC1 * dR1.template cast<Cplx>().col(0) );+}++void test_sparse_product()+{+  for(int i = 0; i < g_repeat; i++) {+    CALL_SUBTEST_1( (sparse_product<SparseMatrix<double,ColMajor> >()) );+    CALL_SUBTEST_1( (sparse_product<SparseMatrix<double,RowMajor> >()) );+    CALL_SUBTEST_1( (bug_942<double>()) );+    CALL_SUBTEST_2( (sparse_product<SparseMatrix<std::complex<double>, ColMajor > >()) );+    CALL_SUBTEST_2( (sparse_product<SparseMatrix<std::complex<double>, RowMajor > >()) );+    CALL_SUBTEST_3( (sparse_product<SparseMatrix<float,ColMajor,long int> >()) );+    CALL_SUBTEST_4( (sparse_product_regression_test<SparseMatrix<double,RowMajor>, Matrix<double, Dynamic, Dynamic, RowMajor> >()) );++    CALL_SUBTEST_5( (test_mixing_types<float>()) );+  }+}
+ eigen3/test/sparse_ref.cpp view
@@ -0,0 +1,139 @@+// This file is part of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 20015 Gael Guennebaud <gael.guennebaud@inria.fr>+//+// 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 unit test cannot be easily written to work with EIGEN_DEFAULT_TO_ROW_MAJOR+#ifdef EIGEN_DEFAULT_TO_ROW_MAJOR+#undef EIGEN_DEFAULT_TO_ROW_MAJOR+#endif++static long int nb_temporaries;++inline void on_temporary_creation() {+  // here's a great place to set a breakpoint when debugging failures in this test!+  nb_temporaries++;+}++#define EIGEN_SPARSE_CREATE_TEMPORARY_PLUGIN { on_temporary_creation(); }++#include "main.h"+#include <Eigen/SparseCore>++#define VERIFY_EVALUATION_COUNT(XPR,N) {\+    nb_temporaries = 0; \+    CALL_SUBTEST( XPR ); \+    if(nb_temporaries!=N) std::cerr << "nb_temporaries == " << nb_temporaries << "\n"; \+    VERIFY( (#XPR) && nb_temporaries==N ); \+  }++template<typename PlainObjectType> void check_const_correctness(const PlainObjectType&)+{+  // verify that ref-to-const don't have LvalueBit+  typedef typename internal::add_const<PlainObjectType>::type ConstPlainObjectType;+  VERIFY( !(internal::traits<Ref<ConstPlainObjectType> >::Flags & LvalueBit) );+  VERIFY( !(internal::traits<Ref<ConstPlainObjectType, Aligned> >::Flags & LvalueBit) );+  VERIFY( !(Ref<ConstPlainObjectType>::Flags & LvalueBit) );+  VERIFY( !(Ref<ConstPlainObjectType, Aligned>::Flags & LvalueBit) );+}++template<typename B>+EIGEN_DONT_INLINE void call_ref_1(Ref<SparseMatrix<float> > a, const B &b) { VERIFY_IS_EQUAL(a.toDense(),b.toDense()); }++template<typename B>+EIGEN_DONT_INLINE void call_ref_2(const Ref<const SparseMatrix<float> >& a, const B &b) { VERIFY_IS_EQUAL(a.toDense(),b.toDense()); }++template<typename B>+EIGEN_DONT_INLINE void call_ref_3(const Ref<const SparseMatrix<float>, StandardCompressedFormat>& a, const B &b) {+  VERIFY(a.isCompressed());+  VERIFY_IS_EQUAL(a.toDense(),b.toDense());+}++template<typename B>+EIGEN_DONT_INLINE void call_ref_4(Ref<SparseVector<float> > a, const B &b) { VERIFY_IS_EQUAL(a.toDense(),b.toDense()); }++template<typename B>+EIGEN_DONT_INLINE void call_ref_5(const Ref<const SparseVector<float> >& a, const B &b) { VERIFY_IS_EQUAL(a.toDense(),b.toDense()); }++void call_ref()+{+  SparseMatrix<float>               A = MatrixXf::Random(10,10).sparseView(0.5,1);+  SparseMatrix<float,RowMajor>      B = MatrixXf::Random(10,10).sparseView(0.5,1);+  SparseMatrix<float>               C = MatrixXf::Random(10,10).sparseView(0.5,1);+  C.reserve(VectorXi::Constant(C.outerSize(), 2));+  const SparseMatrix<float>&        Ac(A);+  Block<SparseMatrix<float> >       Ab(A,0,1, 3,3);+  const Block<SparseMatrix<float> > Abc(A,0,1,3,3);+  SparseVector<float>               vc =  VectorXf::Random(10).sparseView(0.5,1);+  SparseVector<float,RowMajor>      vr =  VectorXf::Random(10).sparseView(0.5,1);+  SparseMatrix<float> AA = A*A;+  ++  VERIFY_EVALUATION_COUNT( call_ref_1(A, A),  0);+//   VERIFY_EVALUATION_COUNT( call_ref_1(Ac, Ac),  0); // does not compile on purpose+  VERIFY_EVALUATION_COUNT( call_ref_2(A, A),  0);+  VERIFY_EVALUATION_COUNT( call_ref_3(A, A),  0);+  VERIFY_EVALUATION_COUNT( call_ref_2(A.transpose(), A.transpose()),  1);+  VERIFY_EVALUATION_COUNT( call_ref_3(A.transpose(), A.transpose()),  1);+  VERIFY_EVALUATION_COUNT( call_ref_2(Ac,Ac), 0);+  VERIFY_EVALUATION_COUNT( call_ref_3(Ac,Ac), 0);+  VERIFY_EVALUATION_COUNT( call_ref_2(A+A,2*Ac), 1);+  VERIFY_EVALUATION_COUNT( call_ref_3(A+A,2*Ac), 1);+  VERIFY_EVALUATION_COUNT( call_ref_2(B, B),  1);+  VERIFY_EVALUATION_COUNT( call_ref_3(B, B),  1);+  VERIFY_EVALUATION_COUNT( call_ref_2(B.transpose(), B.transpose()),  0);+  VERIFY_EVALUATION_COUNT( call_ref_3(B.transpose(), B.transpose()),  0);+  VERIFY_EVALUATION_COUNT( call_ref_2(A*A, AA),  3);+  VERIFY_EVALUATION_COUNT( call_ref_3(A*A, AA),  3);+  +  VERIFY(!C.isCompressed());+  VERIFY_EVALUATION_COUNT( call_ref_3(C, C),  1);+  +  Ref<SparseMatrix<float> > Ar(A);+  VERIFY_IS_APPROX(Ar+Ar, A+A);+  VERIFY_EVALUATION_COUNT( call_ref_1(Ar, A),  0);+  VERIFY_EVALUATION_COUNT( call_ref_2(Ar, A),  0);+  +  Ref<SparseMatrix<float,RowMajor> > Br(B);+  VERIFY_EVALUATION_COUNT( call_ref_1(Br.transpose(), Br.transpose()),  0);+  VERIFY_EVALUATION_COUNT( call_ref_2(Br, Br),  1);+  VERIFY_EVALUATION_COUNT( call_ref_2(Br.transpose(), Br.transpose()),  0);+  +  Ref<const SparseMatrix<float> > Arc(A);+//   VERIFY_EVALUATION_COUNT( call_ref_1(Arc, Arc),  0); // does not compile on purpose+  VERIFY_EVALUATION_COUNT( call_ref_2(Arc, Arc),  0);+  +  VERIFY_EVALUATION_COUNT( call_ref_2(A.middleCols(1,3), A.middleCols(1,3)),  0);+  +  VERIFY_EVALUATION_COUNT( call_ref_2(A.col(2), A.col(2)),  0);+  VERIFY_EVALUATION_COUNT( call_ref_2(vc, vc),  0);+  VERIFY_EVALUATION_COUNT( call_ref_2(vr.transpose(), vr.transpose()),  0);+  VERIFY_EVALUATION_COUNT( call_ref_2(vr, vr.transpose()),  0);+  +  VERIFY_EVALUATION_COUNT( call_ref_2(A.block(1,1,3,3), A.block(1,1,3,3)),  1); // should be 0 (allocate starts/nnz only)++  VERIFY_EVALUATION_COUNT( call_ref_4(vc, vc),  0);+  VERIFY_EVALUATION_COUNT( call_ref_4(vr, vr.transpose()),  0);+  VERIFY_EVALUATION_COUNT( call_ref_5(vc, vc),  0);+  VERIFY_EVALUATION_COUNT( call_ref_5(vr, vr.transpose()),  0);+  VERIFY_EVALUATION_COUNT( call_ref_4(A.col(2), A.col(2)),  0);+  VERIFY_EVALUATION_COUNT( call_ref_5(A.col(2), A.col(2)),  0);+  // VERIFY_EVALUATION_COUNT( call_ref_4(A.row(2), A.row(2).transpose()),  1); // does not compile on purpose+  VERIFY_EVALUATION_COUNT( call_ref_5(A.row(2), A.row(2).transpose()),  1);+}++void test_sparse_ref()+{+  for(int i = 0; i < g_repeat; i++) {+    CALL_SUBTEST_1( check_const_correctness(SparseMatrix<float>()) );+    CALL_SUBTEST_1( check_const_correctness(SparseMatrix<double,RowMajor>()) );+    CALL_SUBTEST_2( call_ref() );++    CALL_SUBTEST_3( check_const_correctness(SparseVector<float>()) );+    CALL_SUBTEST_3( check_const_correctness(SparseVector<double,RowMajor>()) );+  }+}
+ eigen3/test/sparse_solver.h view
@@ -0,0 +1,565 @@+// This file is part of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2011 Gael Guennebaud <g.gael@free.fr>+//+// 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.h"+#include <Eigen/SparseCore>+#include <sstream>++template<typename Solver, typename Rhs, typename Guess,typename Result>+void solve_with_guess(IterativeSolverBase<Solver>& solver, const MatrixBase<Rhs>& b, const Guess& g, Result &x) {+  if(internal::random<bool>())+  {+    // With a temporary through evaluator<SolveWithGuess>+    x = solver.derived().solveWithGuess(b,g) + Result::Zero(x.rows(), x.cols());+  }+  else+  {+    // direct evaluation within x through Assignment<Result,SolveWithGuess>+    x = solver.derived().solveWithGuess(b.derived(),g);+  }+}++template<typename Solver, typename Rhs, typename Guess,typename Result>+void solve_with_guess(SparseSolverBase<Solver>& solver, const MatrixBase<Rhs>& b, const Guess& , Result& x) {+  if(internal::random<bool>())+    x = solver.derived().solve(b) + Result::Zero(x.rows(), x.cols());+  else+    x = solver.derived().solve(b);+}++template<typename Solver, typename Rhs, typename Guess,typename Result>+void solve_with_guess(SparseSolverBase<Solver>& solver, const SparseMatrixBase<Rhs>& b, const Guess& , Result& x) {+  x = solver.derived().solve(b);+}++template<typename Solver, typename Rhs, typename DenseMat, typename DenseRhs>+void check_sparse_solving(Solver& solver, const typename Solver::MatrixType& A, const Rhs& b, const DenseMat& dA, const DenseRhs& db)+{+  typedef typename Solver::MatrixType Mat;+  typedef typename Mat::Scalar Scalar;+  typedef typename Mat::StorageIndex StorageIndex;++  DenseRhs refX = dA.householderQr().solve(db);+  {+    Rhs x(A.cols(), b.cols());+    Rhs oldb = b;++    solver.compute(A);+    if (solver.info() != Success)+    {+      std::cerr << "ERROR | sparse solver testing, factorization failed (" << typeid(Solver).name() << ")\n";+      VERIFY(solver.info() == Success);+    }+    x = solver.solve(b);+    if (solver.info() != Success)+    {+      std::cerr << "WARNING | sparse solver testing: solving failed (" << typeid(Solver).name() << ")\n";+      return;+    }+    VERIFY(oldb.isApprox(b) && "sparse solver testing: the rhs should not be modified!");+    VERIFY(x.isApprox(refX,test_precision<Scalar>()));++    x.setZero();+    solve_with_guess(solver, b, x, x);+    VERIFY(solver.info() == Success && "solving failed when using analyzePattern/factorize API");+    VERIFY(oldb.isApprox(b) && "sparse solver testing: the rhs should not be modified!");+    VERIFY(x.isApprox(refX,test_precision<Scalar>()));+    +    x.setZero();+    // test the analyze/factorize API+    solver.analyzePattern(A);+    solver.factorize(A);+    VERIFY(solver.info() == Success && "factorization failed when using analyzePattern/factorize API");+    x = solver.solve(b);+    VERIFY(solver.info() == Success && "solving failed when using analyzePattern/factorize API");+    VERIFY(oldb.isApprox(b) && "sparse solver testing: the rhs should not be modified!");+    VERIFY(x.isApprox(refX,test_precision<Scalar>()));+    +    x.setZero();+    // test with Map+    MappedSparseMatrix<Scalar,Mat::Options,StorageIndex> Am(A.rows(), A.cols(), A.nonZeros(), const_cast<StorageIndex*>(A.outerIndexPtr()), const_cast<StorageIndex*>(A.innerIndexPtr()), const_cast<Scalar*>(A.valuePtr()));+    solver.compute(Am);+    VERIFY(solver.info() == Success && "factorization failed when using Map");+    DenseRhs dx(refX);+    dx.setZero();+    Map<DenseRhs> xm(dx.data(), dx.rows(), dx.cols());+    Map<const DenseRhs> bm(db.data(), db.rows(), db.cols());+    xm = solver.solve(bm);+    VERIFY(solver.info() == Success && "solving failed when using Map");+    VERIFY(oldb.isApprox(bm) && "sparse solver testing: the rhs should not be modified!");+    VERIFY(xm.isApprox(refX,test_precision<Scalar>()));+  }+  +  // if not too large, do some extra check:+  if(A.rows()<2000)+  {+    // test initialization ctor+    {+      Rhs x(b.rows(), b.cols());+      Solver solver2(A);+      VERIFY(solver2.info() == Success);+      x = solver2.solve(b);+      VERIFY(x.isApprox(refX,test_precision<Scalar>()));+    }++    // test dense Block as the result and rhs:+    {+      DenseRhs x(refX.rows(), refX.cols());+      DenseRhs oldb(db);+      x.setZero();+      x.block(0,0,x.rows(),x.cols()) = solver.solve(db.block(0,0,db.rows(),db.cols()));+      VERIFY(oldb.isApprox(db) && "sparse solver testing: the rhs should not be modified!");+      VERIFY(x.isApprox(refX,test_precision<Scalar>()));+    }++    // test uncompressed inputs+    {+      Mat A2 = A;+      A2.reserve((ArrayXf::Random(A.outerSize())+2).template cast<typename Mat::StorageIndex>().eval());+      solver.compute(A2);+      Rhs x = solver.solve(b);+      VERIFY(x.isApprox(refX,test_precision<Scalar>()));+    }++    // test expression as input+    {+      solver.compute(0.5*(A+A));+      Rhs x = solver.solve(b);+      VERIFY(x.isApprox(refX,test_precision<Scalar>()));++      Solver solver2(0.5*(A+A));+      Rhs x2 = solver2.solve(b);+      VERIFY(x2.isApprox(refX,test_precision<Scalar>()));+    }+  }+}++template<typename Solver, typename Rhs>+void check_sparse_solving_real_cases(Solver& solver, const typename Solver::MatrixType& A, const Rhs& b, const typename Solver::MatrixType& fullA, const Rhs& refX)+{+  typedef typename Solver::MatrixType Mat;+  typedef typename Mat::Scalar Scalar;+  typedef typename Mat::RealScalar RealScalar;+  +  Rhs x(A.cols(), b.cols());++  solver.compute(A);+  if (solver.info() != Success)+  {+    std::cerr << "ERROR | sparse solver testing, factorization failed (" << typeid(Solver).name() << ")\n";+    VERIFY(solver.info() == Success);+  }+  x = solver.solve(b);+  +  if (solver.info() != Success)+  {+    std::cerr << "WARNING | sparse solver testing, solving failed (" << typeid(Solver).name() << ")\n";+    return;+  }+  +  RealScalar res_error = (fullA*x-b).norm()/b.norm();  +  VERIFY( (res_error <= test_precision<Scalar>() ) && "sparse solver failed without noticing it"); ++  +  if(refX.size() != 0 && (refX - x).norm()/refX.norm() > test_precision<Scalar>())+  {+    std::cerr << "WARNING | found solution is different from the provided reference one\n";+  }+  +}+template<typename Solver, typename DenseMat>+void check_sparse_determinant(Solver& solver, const typename Solver::MatrixType& A, const DenseMat& dA)+{+  typedef typename Solver::MatrixType Mat;+  typedef typename Mat::Scalar Scalar;+  +  solver.compute(A);+  if (solver.info() != Success)+  {+    std::cerr << "WARNING | sparse solver testing: factorization failed (check_sparse_determinant)\n";+    return;+  }++  Scalar refDet = dA.determinant();+  VERIFY_IS_APPROX(refDet,solver.determinant());+}+template<typename Solver, typename DenseMat>+void check_sparse_abs_determinant(Solver& solver, const typename Solver::MatrixType& A, const DenseMat& dA)+{+  using std::abs;+  typedef typename Solver::MatrixType Mat;+  typedef typename Mat::Scalar Scalar;+  +  solver.compute(A);+  if (solver.info() != Success)+  {+    std::cerr << "WARNING | sparse solver testing: factorization failed (check_sparse_abs_determinant)\n";+    return;+  }++  Scalar refDet = abs(dA.determinant());+  VERIFY_IS_APPROX(refDet,solver.absDeterminant());+}++template<typename Solver, typename DenseMat>+int generate_sparse_spd_problem(Solver& , typename Solver::MatrixType& A, typename Solver::MatrixType& halfA, DenseMat& dA, int maxSize = 300)+{+  typedef typename Solver::MatrixType Mat;+  typedef typename Mat::Scalar Scalar;+  typedef Matrix<Scalar,Dynamic,Dynamic> DenseMatrix;++  int size = internal::random<int>(1,maxSize);+  double density = (std::max)(8./(size*size), 0.01);++  Mat M(size, size);+  DenseMatrix dM(size, size);++  initSparse<Scalar>(density, dM, M, ForceNonZeroDiag);++  A = M * M.adjoint();+  dA = dM * dM.adjoint();+  +  halfA.resize(size,size);+  if(Solver::UpLo==(Lower|Upper))+    halfA = A;+  else+    halfA.template selfadjointView<Solver::UpLo>().rankUpdate(M);+  +  return size;+}+++#ifdef TEST_REAL_CASES+template<typename Scalar>+inline std::string get_matrixfolder()+{+  std::string mat_folder = TEST_REAL_CASES; +  if( internal::is_same<Scalar, std::complex<float> >::value || internal::is_same<Scalar, std::complex<double> >::value )+    mat_folder  = mat_folder + static_cast<std::string>("/complex/");+  else+    mat_folder = mat_folder + static_cast<std::string>("/real/");+  return mat_folder;+}+std::string sym_to_string(int sym)+{+  if(sym==Symmetric) return "Symmetric ";+  if(sym==SPD)       return "SPD ";+  return "";+}+template<typename Derived>+std::string solver_stats(const IterativeSolverBase<Derived> &solver)+{+  std::stringstream ss;+  ss << solver.iterations() << " iters, error: " << solver.error();+  return ss.str();+}+template<typename Derived>+std::string solver_stats(const SparseSolverBase<Derived> &/*solver*/)+{+  return "";+}+#endif++template<typename Solver> void check_sparse_spd_solving(Solver& solver, int maxSize = 300, int maxRealWorldSize = 100000)+{+  typedef typename Solver::MatrixType Mat;+  typedef typename Mat::Scalar Scalar;+  typedef typename Mat::StorageIndex StorageIndex;+  typedef SparseMatrix<Scalar,ColMajor, StorageIndex> SpMat;+  typedef SparseVector<Scalar, 0, StorageIndex> SpVec;+  typedef Matrix<Scalar,Dynamic,Dynamic> DenseMatrix;+  typedef Matrix<Scalar,Dynamic,1> DenseVector;++  // generate the problem+  Mat A, halfA;+  DenseMatrix dA;+  for (int i = 0; i < g_repeat; i++) {+    int size = generate_sparse_spd_problem(solver, A, halfA, dA, maxSize);++    // generate the right hand sides+    int rhsCols = internal::random<int>(1,16);+    double density = (std::max)(8./(size*rhsCols), 0.1);+    SpMat B(size,rhsCols);+    DenseVector b = DenseVector::Random(size);+    DenseMatrix dB(size,rhsCols);+    initSparse<Scalar>(density, dB, B, ForceNonZeroDiag);+    SpVec c = B.col(0);+    DenseVector dc = dB.col(0);+  +    CALL_SUBTEST( check_sparse_solving(solver, A,     b,  dA, b)  );+    CALL_SUBTEST( check_sparse_solving(solver, halfA, b,  dA, b)  );+    CALL_SUBTEST( check_sparse_solving(solver, A,     dB, dA, dB) );+    CALL_SUBTEST( check_sparse_solving(solver, halfA, dB, dA, dB) );+    CALL_SUBTEST( check_sparse_solving(solver, A,     B,  dA, dB) );+    CALL_SUBTEST( check_sparse_solving(solver, halfA, B,  dA, dB) );+    CALL_SUBTEST( check_sparse_solving(solver, A,     c,  dA, dc) );+    CALL_SUBTEST( check_sparse_solving(solver, halfA, c,  dA, dc) );+    +    // check only once+    if(i==0)+    {+      b = DenseVector::Zero(size);+      check_sparse_solving(solver, A, b, dA, b);+    }+  }+  +  // First, get the folder +#ifdef TEST_REAL_CASES+  // Test real problems with double precision only+  if (internal::is_same<typename NumTraits<Scalar>::Real, double>::value)+  {+    std::string mat_folder = get_matrixfolder<Scalar>();+    MatrixMarketIterator<Scalar> it(mat_folder);+    for (; it; ++it)+    {+      if (it.sym() == SPD){+        A = it.matrix();+        if(A.diagonal().size() <= maxRealWorldSize)+        {+          DenseVector b = it.rhs();+          DenseVector refX = it.refX();+          PermutationMatrix<Dynamic, Dynamic, StorageIndex> pnull;+          halfA.resize(A.rows(), A.cols());+          if(Solver::UpLo == (Lower|Upper))+            halfA = A;+          else+            halfA.template selfadjointView<Solver::UpLo>() = A.template triangularView<Eigen::Lower>().twistedBy(pnull);+          +          std::cout << "INFO | Testing " << sym_to_string(it.sym()) << "sparse problem " << it.matname()+                  << " (" << A.rows() << "x" << A.cols() << ") using " << typeid(Solver).name() << "..." << std::endl;+          CALL_SUBTEST( check_sparse_solving_real_cases(solver, A,     b, A, refX) );+          std::string stats = solver_stats(solver);+          if(stats.size()>0)+            std::cout << "INFO |  " << stats << std::endl;+          CALL_SUBTEST( check_sparse_solving_real_cases(solver, halfA, b, A, refX) );+        }+        else+        {+          std::cout << "INFO | Skip sparse problem \"" << it.matname() << "\" (too large)" << std::endl;+        }+      }+    }+  }+#else+  EIGEN_UNUSED_VARIABLE(maxRealWorldSize);+#endif+}++template<typename Solver> void check_sparse_spd_determinant(Solver& solver)+{+  typedef typename Solver::MatrixType Mat;+  typedef typename Mat::Scalar Scalar;+  typedef Matrix<Scalar,Dynamic,Dynamic> DenseMatrix;++  // generate the problem+  Mat A, halfA;+  DenseMatrix dA;+  generate_sparse_spd_problem(solver, A, halfA, dA, 30);+  +  for (int i = 0; i < g_repeat; i++) {+    check_sparse_determinant(solver, A,     dA);+    check_sparse_determinant(solver, halfA, dA );+  }+}++template<typename Solver, typename DenseMat>+Index generate_sparse_square_problem(Solver&, typename Solver::MatrixType& A, DenseMat& dA, int maxSize = 300, int options = ForceNonZeroDiag)+{+  typedef typename Solver::MatrixType Mat;+  typedef typename Mat::Scalar Scalar;++  Index size = internal::random<int>(1,maxSize);+  double density = (std::max)(8./(size*size), 0.01);+  +  A.resize(size,size);+  dA.resize(size,size);++  initSparse<Scalar>(density, dA, A, options);+  +  return size;+}+++struct prune_column {+  Index m_col;+  prune_column(Index col) : m_col(col) {}+  template<class Scalar>+  bool operator()(Index, Index col, const Scalar&) const {+    return col != m_col;+  }+};+++template<typename Solver> void check_sparse_square_solving(Solver& solver, int maxSize = 300, int maxRealWorldSize = 100000, bool checkDeficient = false)+{+  typedef typename Solver::MatrixType Mat;+  typedef typename Mat::Scalar Scalar;+  typedef SparseMatrix<Scalar,ColMajor, typename Mat::StorageIndex> SpMat;+  typedef SparseVector<Scalar, 0, typename Mat::StorageIndex> SpVec;+  typedef Matrix<Scalar,Dynamic,Dynamic> DenseMatrix;+  typedef Matrix<Scalar,Dynamic,1> DenseVector;++  int rhsCols = internal::random<int>(1,16);++  Mat A;+  DenseMatrix dA;+  for (int i = 0; i < g_repeat; i++) {+    Index size = generate_sparse_square_problem(solver, A, dA, maxSize);++    A.makeCompressed();+    DenseVector b = DenseVector::Random(size);+    DenseMatrix dB(size,rhsCols);+    SpMat B(size,rhsCols);+    double density = (std::max)(8./(size*rhsCols), 0.1);+    initSparse<Scalar>(density, dB, B, ForceNonZeroDiag);+    B.makeCompressed();+    SpVec c = B.col(0);+    DenseVector dc = dB.col(0);+    CALL_SUBTEST(check_sparse_solving(solver, A, b,  dA, b));+    CALL_SUBTEST(check_sparse_solving(solver, A, dB, dA, dB));+    CALL_SUBTEST(check_sparse_solving(solver, A, B,  dA, dB));+    CALL_SUBTEST(check_sparse_solving(solver, A, c,  dA, dc));+    +    // check only once+    if(i==0)+    {+      b = DenseVector::Zero(size);+      check_sparse_solving(solver, A, b, dA, b);+    }+    // regression test for Bug 792 (structurally rank deficient matrices):+    if(checkDeficient && size>1) {+      Index col = internal::random<int>(0,int(size-1));+      A.prune(prune_column(col));+      solver.compute(A);+      VERIFY_IS_EQUAL(solver.info(), NumericalIssue);+    }+  }+  +  // First, get the folder +#ifdef TEST_REAL_CASES+  // Test real problems with double precision only+  if (internal::is_same<typename NumTraits<Scalar>::Real, double>::value)+  {+    std::string mat_folder = get_matrixfolder<Scalar>();+    MatrixMarketIterator<Scalar> it(mat_folder);+    for (; it; ++it)+    {+      A = it.matrix();+      if(A.diagonal().size() <= maxRealWorldSize)+      {+        DenseVector b = it.rhs();+        DenseVector refX = it.refX();+        std::cout << "INFO | Testing " << sym_to_string(it.sym()) << "sparse problem " << it.matname()+                  << " (" << A.rows() << "x" << A.cols() << ") using " << typeid(Solver).name() << "..." << std::endl;+        CALL_SUBTEST(check_sparse_solving_real_cases(solver, A, b, A, refX));+        std::string stats = solver_stats(solver);+        if(stats.size()>0)+          std::cout << "INFO |  " << stats << std::endl;+      }+      else+      {+        std::cout << "INFO | SKIP sparse problem \"" << it.matname() << "\" (too large)" << std::endl;+      }+    }+  }+#else+  EIGEN_UNUSED_VARIABLE(maxRealWorldSize);+#endif++}++template<typename Solver> void check_sparse_square_determinant(Solver& solver)+{+  typedef typename Solver::MatrixType Mat;+  typedef typename Mat::Scalar Scalar;+  typedef Matrix<Scalar,Dynamic,Dynamic> DenseMatrix;+  +  for (int i = 0; i < g_repeat; i++) {+    // generate the problem+    Mat A;+    DenseMatrix dA;+    +    int size = internal::random<int>(1,30);+    dA.setRandom(size,size);+    +    dA = (dA.array().abs()<0.3).select(0,dA);+    dA.diagonal() = (dA.diagonal().array()==0).select(1,dA.diagonal());+    A = dA.sparseView();+    A.makeCompressed();+  +    check_sparse_determinant(solver, A, dA);+  }+}++template<typename Solver> void check_sparse_square_abs_determinant(Solver& solver)+{+  typedef typename Solver::MatrixType Mat;+  typedef typename Mat::Scalar Scalar;+  typedef Matrix<Scalar,Dynamic,Dynamic> DenseMatrix;++  for (int i = 0; i < g_repeat; i++) {+    // generate the problem+    Mat A;+    DenseMatrix dA;+    generate_sparse_square_problem(solver, A, dA, 30);+    A.makeCompressed();+    check_sparse_abs_determinant(solver, A, dA);+  }+}++template<typename Solver, typename DenseMat>+void generate_sparse_leastsquare_problem(Solver&, typename Solver::MatrixType& A, DenseMat& dA, int maxSize = 300, int options = ForceNonZeroDiag)+{+  typedef typename Solver::MatrixType Mat;+  typedef typename Mat::Scalar Scalar;++  int rows = internal::random<int>(1,maxSize);+  int cols = internal::random<int>(1,rows);+  double density = (std::max)(8./(rows*cols), 0.01);+  +  A.resize(rows,cols);+  dA.resize(rows,cols);++  initSparse<Scalar>(density, dA, A, options);+}++template<typename Solver> void check_sparse_leastsquare_solving(Solver& solver)+{+  typedef typename Solver::MatrixType Mat;+  typedef typename Mat::Scalar Scalar;+  typedef SparseMatrix<Scalar,ColMajor, typename Mat::StorageIndex> SpMat;+  typedef Matrix<Scalar,Dynamic,Dynamic> DenseMatrix;+  typedef Matrix<Scalar,Dynamic,1> DenseVector;++  int rhsCols = internal::random<int>(1,16);++  Mat A;+  DenseMatrix dA;+  for (int i = 0; i < g_repeat; i++) {+    generate_sparse_leastsquare_problem(solver, A, dA);++    A.makeCompressed();+    DenseVector b = DenseVector::Random(A.rows());+    DenseMatrix dB(A.rows(),rhsCols);+    SpMat B(A.rows(),rhsCols);+    double density = (std::max)(8./(A.rows()*rhsCols), 0.1);+    initSparse<Scalar>(density, dB, B, ForceNonZeroDiag);+    B.makeCompressed();+    check_sparse_solving(solver, A, b,  dA, b);+    check_sparse_solving(solver, A, dB, dA, dB);+    check_sparse_solving(solver, A, B,  dA, dB);+    +    // check only once+    if(i==0)+    {+      b = DenseVector::Zero(A.rows());+      check_sparse_solving(solver, A, b, dA, b);+    }+  }+}
+ eigen3/test/sparse_solvers.cpp view
@@ -0,0 +1,112 @@+// This file is part of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2008-2010 Gael Guennebaud <gael.guennebaud@inria.fr>+//+// 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.h"++template<typename Scalar> void+initSPD(double density,+        Matrix<Scalar,Dynamic,Dynamic>& refMat,+        SparseMatrix<Scalar>& sparseMat)+{+  Matrix<Scalar,Dynamic,Dynamic> aux(refMat.rows(),refMat.cols());+  initSparse(density,refMat,sparseMat);+  refMat = refMat * refMat.adjoint();+  for (int k=0; k<2; ++k)+  {+    initSparse(density,aux,sparseMat,ForceNonZeroDiag);+    refMat += aux * aux.adjoint();+  }+  sparseMat.setZero();+  for (int j=0 ; j<sparseMat.cols(); ++j)+    for (int i=j ; i<sparseMat.rows(); ++i)+      if (refMat(i,j)!=Scalar(0))+        sparseMat.insert(i,j) = refMat(i,j);+  sparseMat.finalize();+}++template<typename Scalar> void sparse_solvers(int rows, int cols)+{+  double density = (std::max)(8./(rows*cols), 0.01);+  typedef Matrix<Scalar,Dynamic,Dynamic> DenseMatrix;+  typedef Matrix<Scalar,Dynamic,1> DenseVector;+  // Scalar eps = 1e-6;++  DenseVector vec1 = DenseVector::Random(rows);++  std::vector<Vector2i> zeroCoords;+  std::vector<Vector2i> nonzeroCoords;++  // test triangular solver+  {+    DenseVector vec2 = vec1, vec3 = vec1;+    SparseMatrix<Scalar> m2(rows, cols);+    DenseMatrix refMat2 = DenseMatrix::Zero(rows, cols);++    // lower - dense+    initSparse<Scalar>(density, refMat2, m2, ForceNonZeroDiag|MakeLowerTriangular, &zeroCoords, &nonzeroCoords);+    VERIFY_IS_APPROX(refMat2.template triangularView<Lower>().solve(vec2),+                     m2.template triangularView<Lower>().solve(vec3));++    // upper - dense+    initSparse<Scalar>(density, refMat2, m2, ForceNonZeroDiag|MakeUpperTriangular, &zeroCoords, &nonzeroCoords);+    VERIFY_IS_APPROX(refMat2.template triangularView<Upper>().solve(vec2),+                     m2.template triangularView<Upper>().solve(vec3));+    VERIFY_IS_APPROX(refMat2.conjugate().template triangularView<Upper>().solve(vec2),+                     m2.conjugate().template triangularView<Upper>().solve(vec3));+    {+      SparseMatrix<Scalar> cm2(m2);+      //Index rows, Index cols, Index nnz, Index* outerIndexPtr, Index* innerIndexPtr, Scalar* valuePtr+      MappedSparseMatrix<Scalar> mm2(rows, cols, cm2.nonZeros(), cm2.outerIndexPtr(), cm2.innerIndexPtr(), cm2.valuePtr());+      VERIFY_IS_APPROX(refMat2.conjugate().template triangularView<Upper>().solve(vec2),+                       mm2.conjugate().template triangularView<Upper>().solve(vec3));+    }++    // lower - transpose+    initSparse<Scalar>(density, refMat2, m2, ForceNonZeroDiag|MakeLowerTriangular, &zeroCoords, &nonzeroCoords);+    VERIFY_IS_APPROX(refMat2.transpose().template triangularView<Upper>().solve(vec2),+                     m2.transpose().template triangularView<Upper>().solve(vec3));++    // upper - transpose+    initSparse<Scalar>(density, refMat2, m2, ForceNonZeroDiag|MakeUpperTriangular, &zeroCoords, &nonzeroCoords);+    VERIFY_IS_APPROX(refMat2.transpose().template triangularView<Lower>().solve(vec2),+                     m2.transpose().template triangularView<Lower>().solve(vec3));++    SparseMatrix<Scalar> matB(rows, rows);+    DenseMatrix refMatB = DenseMatrix::Zero(rows, rows);++    // lower - sparse+    initSparse<Scalar>(density, refMat2, m2, ForceNonZeroDiag|MakeLowerTriangular);+    initSparse<Scalar>(density, refMatB, matB);+    refMat2.template triangularView<Lower>().solveInPlace(refMatB);+    m2.template triangularView<Lower>().solveInPlace(matB);+    VERIFY_IS_APPROX(matB.toDense(), refMatB);++    // upper - sparse+    initSparse<Scalar>(density, refMat2, m2, ForceNonZeroDiag|MakeUpperTriangular);+    initSparse<Scalar>(density, refMatB, matB);+    refMat2.template triangularView<Upper>().solveInPlace(refMatB);+    m2.template triangularView<Upper>().solveInPlace(matB);+    VERIFY_IS_APPROX(matB, refMatB);++    // test deprecated API+    initSparse<Scalar>(density, refMat2, m2, ForceNonZeroDiag|MakeLowerTriangular, &zeroCoords, &nonzeroCoords);+    VERIFY_IS_APPROX(refMat2.template triangularView<Lower>().solve(vec2),+                     m2.template triangularView<Lower>().solve(vec3));+  }+}++void test_sparse_solvers()+{+  for(int i = 0; i < g_repeat; i++) {+    CALL_SUBTEST_1(sparse_solvers<double>(8, 8) );+    int s = internal::random<int>(1,300);+    CALL_SUBTEST_2(sparse_solvers<std::complex<double> >(s,s) );+    CALL_SUBTEST_1(sparse_solvers<double>(s,s) );+  }+}
+ eigen3/test/sparse_vector.cpp view
@@ -0,0 +1,163 @@+// This file is part of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2008-2011 Gael Guennebaud <gael.guennebaud@inria.fr>+//+// 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.h"++template<typename Scalar,typename StorageIndex> void sparse_vector(int rows, int cols)+{+  double densityMat = (std::max)(8./(rows*cols), 0.01);+  double densityVec = (std::max)(8./(rows), 0.1);+  typedef Matrix<Scalar,Dynamic,Dynamic> DenseMatrix;+  typedef Matrix<Scalar,Dynamic,1> DenseVector;+  typedef SparseVector<Scalar,0,StorageIndex> SparseVectorType;+  typedef SparseMatrix<Scalar,0,StorageIndex> SparseMatrixType;+  Scalar eps = 1e-6;++  SparseMatrixType m1(rows,rows);+  SparseVectorType v1(rows), v2(rows), v3(rows);+  DenseMatrix refM1 = DenseMatrix::Zero(rows, rows);+  DenseVector refV1 = DenseVector::Random(rows),+              refV2 = DenseVector::Random(rows),+              refV3 = DenseVector::Random(rows);++  std::vector<int> zerocoords, nonzerocoords;+  initSparse<Scalar>(densityVec, refV1, v1, &zerocoords, &nonzerocoords);+  initSparse<Scalar>(densityMat, refM1, m1);++  initSparse<Scalar>(densityVec, refV2, v2);+  initSparse<Scalar>(densityVec, refV3, v3);++  Scalar s1 = internal::random<Scalar>();++  // test coeff and coeffRef+  for (unsigned int i=0; i<zerocoords.size(); ++i)+  {+    VERIFY_IS_MUCH_SMALLER_THAN( v1.coeff(zerocoords[i]), eps );+    //VERIFY_RAISES_ASSERT( v1.coeffRef(zerocoords[i]) = 5 );+  }+  {+    VERIFY(int(nonzerocoords.size()) == v1.nonZeros());+    int j=0;+    for (typename SparseVectorType::InnerIterator it(v1); it; ++it,++j)+    {+      VERIFY(nonzerocoords[j]==it.index());+      VERIFY(it.value()==v1.coeff(it.index()));+      VERIFY(it.value()==refV1.coeff(it.index()));+    }+  }+  VERIFY_IS_APPROX(v1, refV1);+  +  // test coeffRef with reallocation+  {+    SparseVectorType v4(rows);+    DenseVector v5 = DenseVector::Zero(rows);+    for(int k=0; k<rows; ++k)+    {+      int i = internal::random<int>(0,rows-1);+      Scalar v = internal::random<Scalar>();+      v4.coeffRef(i) += v;+      v5.coeffRef(i) += v;+    }+    VERIFY_IS_APPROX(v4,v5);+  }++  v1.coeffRef(nonzerocoords[0]) = Scalar(5);+  refV1.coeffRef(nonzerocoords[0]) = Scalar(5);+  VERIFY_IS_APPROX(v1, refV1);++  VERIFY_IS_APPROX(v1+v2, refV1+refV2);+  VERIFY_IS_APPROX(v1+v2+v3, refV1+refV2+refV3);++  VERIFY_IS_APPROX(v1*s1-v2, refV1*s1-refV2);++  VERIFY_IS_APPROX(v1*=s1, refV1*=s1);+  VERIFY_IS_APPROX(v1/=s1, refV1/=s1);++  VERIFY_IS_APPROX(v1+=v2, refV1+=refV2);+  VERIFY_IS_APPROX(v1-=v2, refV1-=refV2);++  VERIFY_IS_APPROX(v1.dot(v2), refV1.dot(refV2));+  VERIFY_IS_APPROX(v1.dot(refV2), refV1.dot(refV2));++  VERIFY_IS_APPROX(m1*v2, refM1*refV2);+  VERIFY_IS_APPROX(v1.dot(m1*v2), refV1.dot(refM1*refV2));+  {+    int i = internal::random<int>(0,rows-1);+    VERIFY_IS_APPROX(v1.dot(m1.col(i)), refV1.dot(refM1.col(i)));+  }+++  VERIFY_IS_APPROX(v1.squaredNorm(), refV1.squaredNorm());+  +  VERIFY_IS_APPROX(v1.blueNorm(), refV1.blueNorm());++  // test aliasing+  VERIFY_IS_APPROX((v1 = -v1), (refV1 = -refV1));+  VERIFY_IS_APPROX((v1 = v1.transpose()), (refV1 = refV1.transpose().eval()));+  VERIFY_IS_APPROX((v1 += -v1), (refV1 += -refV1));+  +  // sparse matrix to sparse vector+  SparseMatrixType mv1;+  VERIFY_IS_APPROX((mv1=v1),v1);+  VERIFY_IS_APPROX(mv1,(v1=mv1));+  VERIFY_IS_APPROX(mv1,(v1=mv1.transpose()));+  +  // check copy to dense vector with transpose+  refV3.resize(0);+  VERIFY_IS_APPROX(refV3 = v1.transpose(),v1.toDense()); +  VERIFY_IS_APPROX(DenseVector(v1),v1.toDense()); ++  // test conservative resize+  {+    std::vector<StorageIndex> inc;+    if(rows > 3)+      inc.push_back(-3);+    inc.push_back(0);+    inc.push_back(3);+    inc.push_back(1);+    inc.push_back(10);++    for(std::size_t i = 0; i< inc.size(); i++) {+      StorageIndex incRows = inc[i];+      SparseVectorType vec1(rows);+      DenseVector refVec1 = DenseVector::Zero(rows);+      initSparse<Scalar>(densityVec, refVec1, vec1);++      vec1.conservativeResize(rows+incRows);+      refVec1.conservativeResize(rows+incRows);+      if (incRows > 0) refVec1.tail(incRows).setZero();++      VERIFY_IS_APPROX(vec1, refVec1);++      // Insert new values+      if (incRows > 0)+        vec1.insert(vec1.rows()-1) = refVec1(refVec1.rows()-1) = 1;++      VERIFY_IS_APPROX(vec1, refVec1);+    }+  }++}++void test_sparse_vector()+{+  for(int i = 0; i < g_repeat; i++) {+    int r = Eigen::internal::random<int>(1,500), c = Eigen::internal::random<int>(1,500);+    if(Eigen::internal::random<int>(0,4) == 0) {+      r = c; // check square matrices in 25% of tries+    }+    EIGEN_UNUSED_VARIABLE(r+c);++    CALL_SUBTEST_1(( sparse_vector<double,int>(8, 8) ));+    CALL_SUBTEST_2(( sparse_vector<std::complex<double>, int>(r, c) ));+    CALL_SUBTEST_1(( sparse_vector<double,long int>(r, c) ));+    CALL_SUBTEST_1(( sparse_vector<double,short>(r, c) ));+  }+}+
+ eigen3/test/sparselu.cpp view
@@ -0,0 +1,45 @@+// This file is part of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2012 Désiré Nuentsa-Wakam <desire.nuentsa_wakam@inria.fr>+//+// 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/.++// SparseLU solve does not accept column major matrices for the destination.+// However, as expected, the generic check_sparse_square_solving routines produces row-major+// rhs and destination matrices when compiled with EIGEN_DEFAULT_TO_ROW_MAJOR++#ifdef EIGEN_DEFAULT_TO_ROW_MAJOR+#undef EIGEN_DEFAULT_TO_ROW_MAJOR+#endif++#include "sparse_solver.h"+#include <Eigen/SparseLU>+#include <unsupported/Eigen/SparseExtra>++template<typename T> void test_sparselu_T()+{+  SparseLU<SparseMatrix<T, ColMajor> /*, COLAMDOrdering<int>*/ > sparselu_colamd; // COLAMDOrdering is the default+  SparseLU<SparseMatrix<T, ColMajor>, AMDOrdering<int> > sparselu_amd; +  SparseLU<SparseMatrix<T, ColMajor, long int>, NaturalOrdering<long int> > sparselu_natural;+  +  check_sparse_square_solving(sparselu_colamd,  300, 100000, true); +  check_sparse_square_solving(sparselu_amd,     300,  10000, true);+  check_sparse_square_solving(sparselu_natural, 300,   2000, true);+  +  check_sparse_square_abs_determinant(sparselu_colamd);+  check_sparse_square_abs_determinant(sparselu_amd);+  +  check_sparse_square_determinant(sparselu_colamd);+  check_sparse_square_determinant(sparselu_amd);+}++void test_sparselu()+{+  CALL_SUBTEST_1(test_sparselu_T<float>()); +  CALL_SUBTEST_2(test_sparselu_T<double>());+  CALL_SUBTEST_3(test_sparselu_T<std::complex<float> >()); +  CALL_SUBTEST_4(test_sparselu_T<std::complex<double> >());+}
+ eigen3/test/sparseqr.cpp view
@@ -0,0 +1,128 @@+// This file is part of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2012 Desire Nuentsa Wakam <desire.nuentsa_wakam@inria.fr>+// Copyright (C) 2014 Gael Guennebaud <gael.guennebaud@inria.fr>+//+// 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+#include "sparse.h"+#include <Eigen/SparseQR>++template<typename MatrixType,typename DenseMat>+int generate_sparse_rectangular_problem(MatrixType& A, DenseMat& dA, int maxRows = 300, int maxCols = 150)+{+  eigen_assert(maxRows >= maxCols);+  typedef typename MatrixType::Scalar Scalar;+  int rows = internal::random<int>(1,maxRows);+  int cols = internal::random<int>(1,maxCols);+  double density = (std::max)(8./(rows*cols), 0.01);+  +  A.resize(rows,cols);+  dA.resize(rows,cols);+  initSparse<Scalar>(density, dA, A,ForceNonZeroDiag);+  A.makeCompressed();+  int nop = internal::random<int>(0, internal::random<double>(0,1) > 0.5 ? cols/2 : 0);+  for(int k=0; k<nop; ++k)+  {+    int j0 = internal::random<int>(0,cols-1);+    int j1 = internal::random<int>(0,cols-1);+    Scalar s = internal::random<Scalar>();+    A.col(j0)  = s * A.col(j1);+    dA.col(j0) = s * dA.col(j1);+  }+  +//   if(rows<cols) {+//     A.conservativeResize(cols,cols);+//     dA.conservativeResize(cols,cols);+//     dA.bottomRows(cols-rows).setZero();+//   }+  +  return rows;+}++template<typename Scalar> void test_sparseqr_scalar()+{+  typedef SparseMatrix<Scalar,ColMajor> MatrixType; +  typedef Matrix<Scalar,Dynamic,Dynamic> DenseMat;+  typedef Matrix<Scalar,Dynamic,1> DenseVector;+  MatrixType A;+  DenseMat dA;+  DenseVector refX,x,b; +  SparseQR<MatrixType, COLAMDOrdering<int> > solver; +  generate_sparse_rectangular_problem(A,dA);+  +  b = dA * DenseVector::Random(A.cols());+  solver.compute(A);++  // Q should be MxM+  VERIFY_IS_EQUAL(solver.matrixQ().rows(), A.rows());+  VERIFY_IS_EQUAL(solver.matrixQ().cols(), A.rows());++  // R should be MxN+  VERIFY_IS_EQUAL(solver.matrixR().rows(), A.rows());+  VERIFY_IS_EQUAL(solver.matrixR().cols(), A.cols());++  // Q and R can be multiplied+  DenseMat recoveredA = solver.matrixQ()+                      * DenseMat(solver.matrixR().template triangularView<Upper>())+                      * solver.colsPermutation().transpose();+  VERIFY_IS_EQUAL(recoveredA.rows(), A.rows());+  VERIFY_IS_EQUAL(recoveredA.cols(), A.cols());++  // and in the full rank case the original matrix is recovered+  if (solver.rank() == A.cols())+  {+      VERIFY_IS_APPROX(A, recoveredA);+  }++  if(internal::random<float>(0,1)>0.5f)+    solver.factorize(A);  // this checks that calling analyzePattern is not needed if the pattern do not change.+  if (solver.info() != Success)+  {+    std::cerr << "sparse QR factorization failed\n";+    exit(0);+    return;+  }+  x = solver.solve(b);+  if (solver.info() != Success)+  {+    std::cerr << "sparse QR factorization failed\n";+    exit(0);+    return;+  }+  +  VERIFY_IS_APPROX(A * x, b);+  +  //Compare with a dense QR solver+  ColPivHouseholderQR<DenseMat> dqr(dA);+  refX = dqr.solve(b);+  +  VERIFY_IS_EQUAL(dqr.rank(), solver.rank());+  if(solver.rank()==A.cols()) // full rank+    VERIFY_IS_APPROX(x, refX);+//   else+//     VERIFY((dA * refX - b).norm() * 2 > (A * x - b).norm() );++  // Compute explicitly the matrix Q+  MatrixType Q, QtQ, idM;+  Q = solver.matrixQ();+  //Check  ||Q' * Q - I ||+  QtQ = Q * Q.adjoint();+  idM.resize(Q.rows(), Q.rows()); idM.setIdentity();+  VERIFY(idM.isApprox(QtQ));+  +  // Q to dense+  DenseMat dQ;+  dQ = solver.matrixQ();+  VERIFY_IS_APPROX(Q, dQ);+}+void test_sparseqr()+{+  for(int i=0; i<g_repeat; ++i)+  {+    CALL_SUBTEST_1(test_sparseqr_scalar<double>());+    CALL_SUBTEST_2(test_sparseqr_scalar<std::complex<double> >());+  }+}+
+ eigen3/test/special_numbers.cpp view
@@ -0,0 +1,58 @@+// This file is part of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2013 Gael Guennebaud <gael.guennebaud@inria.fr>+//+// 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<typename Scalar> void special_numbers()+{+  typedef Matrix<Scalar, Dynamic,Dynamic> MatType;+  int rows = internal::random<int>(1,300);+  int cols = internal::random<int>(1,300);+  +  Scalar nan = std::numeric_limits<Scalar>::quiet_NaN();+  Scalar inf = std::numeric_limits<Scalar>::infinity();+  Scalar s1 = internal::random<Scalar>();+  +  MatType m1    = MatType::Random(rows,cols),+          mnan  = MatType::Random(rows,cols),+          minf  = MatType::Random(rows,cols),+          mboth = MatType::Random(rows,cols);+          +  int n = internal::random<int>(1,10);+  for(int k=0; k<n; ++k)+  {+    mnan(internal::random<int>(0,rows-1), internal::random<int>(0,cols-1)) = nan;+    minf(internal::random<int>(0,rows-1), internal::random<int>(0,cols-1)) = inf;+  }+  mboth = mnan + minf;+  +  VERIFY(!m1.hasNaN());+  VERIFY(m1.allFinite());+  +  VERIFY(mnan.hasNaN());+  VERIFY((s1*mnan).hasNaN());+  VERIFY(!minf.hasNaN());+  VERIFY(!(2*minf).hasNaN());+  VERIFY(mboth.hasNaN());+  VERIFY(mboth.array().hasNaN());+  +  VERIFY(!mnan.allFinite());+  VERIFY(!minf.allFinite());+  VERIFY(!(minf-mboth).allFinite());+  VERIFY(!mboth.allFinite());+  VERIFY(!mboth.array().allFinite());+}++void test_special_numbers()+{+  for(int i = 0; i < 10*g_repeat; i++) {+    CALL_SUBTEST_1( special_numbers<float>() );+    CALL_SUBTEST_1( special_numbers<double>() );+  }+}
+ eigen3/test/spqr_support.cpp view
@@ -0,0 +1,64 @@+// This file is part of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2012 Desire Nuentsa Wakam <desire.nuentsa_wakam@inria.fr>+//+// 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++#define EIGEN_NO_DEBUG_SMALL_PRODUCT_BLOCKS+#include "sparse.h"+#include <Eigen/SPQRSupport>+++template<typename MatrixType,typename DenseMat>+int generate_sparse_rectangular_problem(MatrixType& A, DenseMat& dA, int maxRows = 300, int maxCols = 300)+{+  eigen_assert(maxRows >= maxCols);+  typedef typename MatrixType::Scalar Scalar;+  int rows = internal::random<int>(1,maxRows);+  int cols = internal::random<int>(1,rows);+  double density = (std::max)(8./(rows*cols), 0.01);+  +  A.resize(rows,cols);+  dA.resize(rows,cols);+  initSparse<Scalar>(density, dA, A,ForceNonZeroDiag);+  A.makeCompressed();+  return rows;+}++template<typename Scalar> void test_spqr_scalar()+{+  typedef SparseMatrix<Scalar,ColMajor> MatrixType; +  MatrixType A;+  Matrix<Scalar,Dynamic,Dynamic> dA;+  typedef Matrix<Scalar,Dynamic,1> DenseVector;+  DenseVector refX,x,b; +  SPQR<MatrixType> solver; +  generate_sparse_rectangular_problem(A,dA);+  +  Index m = A.rows();+  b = DenseVector::Random(m);+  solver.compute(A);+  if (solver.info() != Success)+  {+    std::cerr << "sparse QR factorization failed\n";+    exit(0);+    return;+  }+  x = solver.solve(b);+  if (solver.info() != Success)+  {+    std::cerr << "sparse QR factorization failed\n";+    exit(0);+    return;+  }  +  //Compare with a dense solver+  refX = dA.colPivHouseholderQr().solve(b);+  VERIFY(x.isApprox(refX,test_precision<Scalar>()));+}+void test_spqr_support()+{+  CALL_SUBTEST_1(test_spqr_scalar<double>());+  CALL_SUBTEST_2(test_spqr_scalar<std::complex<double> >());+}
+ eigen3/test/stable_norm.cpp view
@@ -0,0 +1,201 @@+// This file is part of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2009-2014 Gael Guennebaud <gael.guennebaud@inria.fr>+//+// 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<typename T> EIGEN_DONT_INLINE T copy(const T& x)+{+  return x;+}++template<typename MatrixType> void stable_norm(const MatrixType& m)+{+  /* this test covers the following files:+     StableNorm.h+  */+  using std::sqrt;+  using std::abs;+  typedef typename MatrixType::Scalar Scalar;+  typedef typename NumTraits<Scalar>::Real RealScalar;+  +  bool complex_real_product_ok = true;++  // Check the basic machine-dependent constants.+  {+    int ibeta, it, iemin, iemax;++    ibeta = std::numeric_limits<RealScalar>::radix;         // base for floating-point numbers+    it    = std::numeric_limits<RealScalar>::digits;        // number of base-beta digits in mantissa+    iemin = std::numeric_limits<RealScalar>::min_exponent;  // minimum exponent+    iemax = std::numeric_limits<RealScalar>::max_exponent;  // maximum exponent++    VERIFY( (!(iemin > 1 - 2*it || 1+it>iemax || (it==2 && ibeta<5) || (it<=4 && ibeta <= 3 ) || it<2))+           && "the stable norm algorithm cannot be guaranteed on this computer");+    +    Scalar inf = std::numeric_limits<RealScalar>::infinity();+    if(NumTraits<Scalar>::IsComplex && (numext::isnan)(inf*RealScalar(1)) )+    {+      complex_real_product_ok = false;+      static bool first = true;+      if(first)+        std::cerr << "WARNING: compiler mess up complex*real product, " << inf << " * " << 1.0 << " = " << inf*RealScalar(1) << std::endl;+      first = false;+    }+  }+++  Index rows = m.rows();+  Index cols = m.cols();++  // get a non-zero random factor+  Scalar factor = internal::random<Scalar>();+  while(numext::abs2(factor)<RealScalar(1e-4))+    factor = internal::random<Scalar>();+  Scalar big = factor * ((std::numeric_limits<RealScalar>::max)() * RealScalar(1e-4));+  +  factor = internal::random<Scalar>();+  while(numext::abs2(factor)<RealScalar(1e-4))+    factor = internal::random<Scalar>();+  Scalar small = factor * ((std::numeric_limits<RealScalar>::min)() * RealScalar(1e4));++  Scalar one(1);++  MatrixType  vzero = MatrixType::Zero(rows, cols),+              vrand = MatrixType::Random(rows, cols),+              vbig(rows, cols),+              vsmall(rows,cols);++  vbig.fill(big);+  vsmall.fill(small);++  VERIFY_IS_MUCH_SMALLER_THAN(vzero.norm(), static_cast<RealScalar>(1));+  VERIFY_IS_APPROX(vrand.stableNorm(),      vrand.norm());+  VERIFY_IS_APPROX(vrand.blueNorm(),        vrand.norm());+  VERIFY_IS_APPROX(vrand.hypotNorm(),       vrand.norm());++  // test with expressions as input+  VERIFY_IS_APPROX((one*vrand).stableNorm(),      vrand.norm());+  VERIFY_IS_APPROX((one*vrand).blueNorm(),        vrand.norm());+  VERIFY_IS_APPROX((one*vrand).hypotNorm(),       vrand.norm());+  VERIFY_IS_APPROX((one*vrand+one*vrand-one*vrand).stableNorm(),      vrand.norm());+  VERIFY_IS_APPROX((one*vrand+one*vrand-one*vrand).blueNorm(),        vrand.norm());+  VERIFY_IS_APPROX((one*vrand+one*vrand-one*vrand).hypotNorm(),       vrand.norm());++  RealScalar size = static_cast<RealScalar>(m.size());++  // test numext::isfinite+  VERIFY(!(numext::isfinite)( std::numeric_limits<RealScalar>::infinity()));+  VERIFY(!(numext::isfinite)(sqrt(-abs(big))));++  // test overflow+  VERIFY((numext::isfinite)(sqrt(size)*abs(big)));+  VERIFY_IS_NOT_APPROX(sqrt(copy(vbig.squaredNorm())), abs(sqrt(size)*big)); // here the default norm must fail+  VERIFY_IS_APPROX(vbig.stableNorm(), sqrt(size)*abs(big));+  VERIFY_IS_APPROX(vbig.blueNorm(),   sqrt(size)*abs(big));+  VERIFY_IS_APPROX(vbig.hypotNorm(),  sqrt(size)*abs(big));++  // test underflow+  VERIFY((numext::isfinite)(sqrt(size)*abs(small)));+  VERIFY_IS_NOT_APPROX(sqrt(copy(vsmall.squaredNorm())),   abs(sqrt(size)*small)); // here the default norm must fail+  VERIFY_IS_APPROX(vsmall.stableNorm(), sqrt(size)*abs(small));+  VERIFY_IS_APPROX(vsmall.blueNorm(),   sqrt(size)*abs(small));+  VERIFY_IS_APPROX(vsmall.hypotNorm(),  sqrt(size)*abs(small));++  // Test compilation of cwise() version+  VERIFY_IS_APPROX(vrand.colwise().stableNorm(),      vrand.colwise().norm());+  VERIFY_IS_APPROX(vrand.colwise().blueNorm(),        vrand.colwise().norm());+  VERIFY_IS_APPROX(vrand.colwise().hypotNorm(),       vrand.colwise().norm());+  VERIFY_IS_APPROX(vrand.rowwise().stableNorm(),      vrand.rowwise().norm());+  VERIFY_IS_APPROX(vrand.rowwise().blueNorm(),        vrand.rowwise().norm());+  VERIFY_IS_APPROX(vrand.rowwise().hypotNorm(),       vrand.rowwise().norm());+  +  // test NaN, +inf, -inf +  MatrixType v;+  Index i = internal::random<Index>(0,rows-1);+  Index j = internal::random<Index>(0,cols-1);++  // NaN+  {+    v = vrand;+    v(i,j) = std::numeric_limits<RealScalar>::quiet_NaN();+    VERIFY(!(numext::isfinite)(v.squaredNorm()));   VERIFY((numext::isnan)(v.squaredNorm()));+    VERIFY(!(numext::isfinite)(v.norm()));          VERIFY((numext::isnan)(v.norm()));+    VERIFY(!(numext::isfinite)(v.stableNorm()));    VERIFY((numext::isnan)(v.stableNorm()));+    VERIFY(!(numext::isfinite)(v.blueNorm()));      VERIFY((numext::isnan)(v.blueNorm()));+    VERIFY(!(numext::isfinite)(v.hypotNorm()));     VERIFY((numext::isnan)(v.hypotNorm()));+  }+  +  // +inf+  {+    v = vrand;+    v(i,j) = std::numeric_limits<RealScalar>::infinity();+    VERIFY(!(numext::isfinite)(v.squaredNorm()));   VERIFY(isPlusInf(v.squaredNorm()));+    VERIFY(!(numext::isfinite)(v.norm()));          VERIFY(isPlusInf(v.norm()));+    VERIFY(!(numext::isfinite)(v.stableNorm()));+    if(complex_real_product_ok){+      VERIFY(isPlusInf(v.stableNorm()));+    }+    VERIFY(!(numext::isfinite)(v.blueNorm()));      VERIFY(isPlusInf(v.blueNorm()));+    VERIFY(!(numext::isfinite)(v.hypotNorm()));     VERIFY(isPlusInf(v.hypotNorm()));+  }+  +  // -inf+  {+    v = vrand;+    v(i,j) = -std::numeric_limits<RealScalar>::infinity();+    VERIFY(!(numext::isfinite)(v.squaredNorm()));   VERIFY(isPlusInf(v.squaredNorm()));+    VERIFY(!(numext::isfinite)(v.norm()));          VERIFY(isPlusInf(v.norm()));+    VERIFY(!(numext::isfinite)(v.stableNorm()));+    if(complex_real_product_ok) {+      VERIFY(isPlusInf(v.stableNorm()));+    }+    VERIFY(!(numext::isfinite)(v.blueNorm()));      VERIFY(isPlusInf(v.blueNorm()));+    VERIFY(!(numext::isfinite)(v.hypotNorm()));     VERIFY(isPlusInf(v.hypotNorm()));+  }+  +  // mix+  {+    Index i2 = internal::random<Index>(0,rows-1);+    Index j2 = internal::random<Index>(0,cols-1);+    v = vrand;+    v(i,j) = -std::numeric_limits<RealScalar>::infinity();+    v(i2,j2) = std::numeric_limits<RealScalar>::quiet_NaN();+    VERIFY(!(numext::isfinite)(v.squaredNorm()));   VERIFY((numext::isnan)(v.squaredNorm()));+    VERIFY(!(numext::isfinite)(v.norm()));          VERIFY((numext::isnan)(v.norm()));+    VERIFY(!(numext::isfinite)(v.stableNorm()));    VERIFY((numext::isnan)(v.stableNorm()));+    VERIFY(!(numext::isfinite)(v.blueNorm()));      VERIFY((numext::isnan)(v.blueNorm()));+    VERIFY(!(numext::isfinite)(v.hypotNorm()));     VERIFY((numext::isnan)(v.hypotNorm()));+  }++  // stableNormalize[d]+  {+    VERIFY_IS_APPROX(vrand.stableNormalized(), vrand.normalized());+    MatrixType vcopy(vrand);+    vcopy.stableNormalize();+    VERIFY_IS_APPROX(vcopy, vrand.normalized());+    VERIFY_IS_APPROX((vrand.stableNormalized()).norm(), RealScalar(1));+    VERIFY_IS_APPROX(vcopy.norm(), RealScalar(1));+    VERIFY_IS_APPROX((vbig.stableNormalized()).norm(), RealScalar(1));+    VERIFY_IS_APPROX((vsmall.stableNormalized()).norm(), RealScalar(1));+    RealScalar big_scaling = ((std::numeric_limits<RealScalar>::max)() * RealScalar(1e-4));+    VERIFY_IS_APPROX(vbig/big_scaling, (vbig.stableNorm() * vbig.stableNormalized()).eval()/big_scaling);+    VERIFY_IS_APPROX(vsmall, vsmall.stableNorm() * vsmall.stableNormalized());+  }+}++void test_stable_norm()+{+  for(int i = 0; i < g_repeat; i++) {+    CALL_SUBTEST_1( stable_norm(Matrix<float, 1, 1>()) );+    CALL_SUBTEST_2( stable_norm(Vector4d()) );+    CALL_SUBTEST_3( stable_norm(VectorXd(internal::random<int>(10,2000))) );+    CALL_SUBTEST_4( stable_norm(VectorXf(internal::random<int>(10,2000))) );+    CALL_SUBTEST_5( stable_norm(VectorXcd(internal::random<int>(10,2000))) );+  }+}
+ eigen3/test/stddeque.cpp view
@@ -0,0 +1,130 @@+// This file is part of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2008 Benoit Jacob <jacob.benoit.1@gmail.com>+// Copyright (C) 2010 Hauke Heibel <hauke.heibel@gmail.com>+//+// 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 <Eigen/StdDeque>+#include <Eigen/Geometry>++template<typename MatrixType>+void check_stddeque_matrix(const MatrixType& m)+{+  Index rows = m.rows();+  Index cols = m.cols();+  MatrixType x = MatrixType::Random(rows,cols), y = MatrixType::Random(rows,cols);+  std::deque<MatrixType,Eigen::aligned_allocator<MatrixType> > v(10, MatrixType(rows,cols)), w(20, y);+  v.front() = x;+  w.front() = w.back();+  VERIFY_IS_APPROX(w.front(), w.back());+  v = w;++  typename std::deque<MatrixType,Eigen::aligned_allocator<MatrixType> >::iterator vi = v.begin();+  typename std::deque<MatrixType,Eigen::aligned_allocator<MatrixType> >::iterator wi = w.begin();+  for(int i = 0; i < 20; i++)+  {+    VERIFY_IS_APPROX(*vi, *wi);+    ++vi;+    ++wi;+  }++  v.resize(21);  +  v.back() = x;+  VERIFY_IS_APPROX(v.back(), x);+  v.resize(22,y);+  VERIFY_IS_APPROX(v.back(), y);+  v.push_back(x);+  VERIFY_IS_APPROX(v.back(), x);+}++template<typename TransformType>+void check_stddeque_transform(const TransformType&)+{+  typedef typename TransformType::MatrixType MatrixType;+  TransformType x(MatrixType::Random()), y(MatrixType::Random());+  std::deque<TransformType,Eigen::aligned_allocator<TransformType> > v(10), w(20, y);+  v.front() = x;+  w.front() = w.back();+  VERIFY_IS_APPROX(w.front(), w.back());+  v = w;++  typename std::deque<TransformType,Eigen::aligned_allocator<TransformType> >::iterator vi = v.begin();+  typename std::deque<TransformType,Eigen::aligned_allocator<TransformType> >::iterator wi = w.begin();+  for(int i = 0; i < 20; i++)+  {+    VERIFY_IS_APPROX(*vi, *wi);+    ++vi;+    ++wi;+  }++  v.resize(21);+  v.back() = x;+  VERIFY_IS_APPROX(v.back(), x);+  v.resize(22,y);+  VERIFY_IS_APPROX(v.back(), y);+  v.push_back(x);+  VERIFY_IS_APPROX(v.back(), x);+}++template<typename QuaternionType>+void check_stddeque_quaternion(const QuaternionType&)+{+  typedef typename QuaternionType::Coefficients Coefficients;+  QuaternionType x(Coefficients::Random()), y(Coefficients::Random());+  std::deque<QuaternionType,Eigen::aligned_allocator<QuaternionType> > v(10), w(20, y);+  v.front() = x;+  w.front() = w.back();+  VERIFY_IS_APPROX(w.front(), w.back());+  v = w;++  typename std::deque<QuaternionType,Eigen::aligned_allocator<QuaternionType> >::iterator vi = v.begin();+  typename std::deque<QuaternionType,Eigen::aligned_allocator<QuaternionType> >::iterator wi = w.begin();+  for(int i = 0; i < 20; i++)+  {+    VERIFY_IS_APPROX(*vi, *wi);+    ++vi;+    ++wi;+  }++  v.resize(21);+  v.back() = x;+  VERIFY_IS_APPROX(v.back(), x);+  v.resize(22,y);+  VERIFY_IS_APPROX(v.back(), y);+  v.push_back(x);+  VERIFY_IS_APPROX(v.back(), x);+}++void test_stddeque()+{+  // some non vectorizable fixed sizes+  CALL_SUBTEST_1(check_stddeque_matrix(Vector2f()));+  CALL_SUBTEST_1(check_stddeque_matrix(Matrix3f()));+  CALL_SUBTEST_2(check_stddeque_matrix(Matrix3d()));++  // some vectorizable fixed sizes+  CALL_SUBTEST_1(check_stddeque_matrix(Matrix2f()));+  CALL_SUBTEST_1(check_stddeque_matrix(Vector4f()));+  CALL_SUBTEST_1(check_stddeque_matrix(Matrix4f()));+  CALL_SUBTEST_2(check_stddeque_matrix(Matrix4d()));++  // some dynamic sizes+  CALL_SUBTEST_3(check_stddeque_matrix(MatrixXd(1,1)));+  CALL_SUBTEST_3(check_stddeque_matrix(VectorXd(20)));+  CALL_SUBTEST_3(check_stddeque_matrix(RowVectorXf(20)));+  CALL_SUBTEST_3(check_stddeque_matrix(MatrixXcf(10,10)));++  // some Transform+  CALL_SUBTEST_4(check_stddeque_transform(Affine2f()));+  CALL_SUBTEST_4(check_stddeque_transform(Affine3f()));+  CALL_SUBTEST_4(check_stddeque_transform(Affine3d()));++  // some Quaternion+  CALL_SUBTEST_5(check_stddeque_quaternion(Quaternionf()));+  CALL_SUBTEST_5(check_stddeque_quaternion(Quaterniond()));+}
+ eigen3/test/stddeque_overload.cpp view
@@ -0,0 +1,158 @@+// This file is part of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2008 Benoit Jacob <jacob.benoit.1@gmail.com>+// Copyright (C) 2010 Hauke Heibel <hauke.heibel@gmail.com>+//+// 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 <Eigen/StdDeque>+#include <Eigen/Geometry>++EIGEN_DEFINE_STL_DEQUE_SPECIALIZATION(Vector4f)++EIGEN_DEFINE_STL_DEQUE_SPECIALIZATION(Matrix2f)+EIGEN_DEFINE_STL_DEQUE_SPECIALIZATION(Matrix4f)+EIGEN_DEFINE_STL_DEQUE_SPECIALIZATION(Matrix4d)++EIGEN_DEFINE_STL_DEQUE_SPECIALIZATION(Affine3f)+EIGEN_DEFINE_STL_DEQUE_SPECIALIZATION(Affine3d)++EIGEN_DEFINE_STL_DEQUE_SPECIALIZATION(Quaternionf)+EIGEN_DEFINE_STL_DEQUE_SPECIALIZATION(Quaterniond)++template<typename MatrixType>+void check_stddeque_matrix(const MatrixType& m)+{+  typename MatrixType::Index rows = m.rows();+  typename MatrixType::Index cols = m.cols();+  MatrixType x = MatrixType::Random(rows,cols), y = MatrixType::Random(rows,cols);+  std::deque<MatrixType> v(10, MatrixType(rows,cols)), w(20, y);+  v[5] = x;+  w[6] = v[5];+  VERIFY_IS_APPROX(w[6], v[5]);+  v = w;+  for(int i = 0; i < 20; i++)+  {+    VERIFY_IS_APPROX(w[i], v[i]);+  }++  v.resize(21);+  v[20] = x;+  VERIFY_IS_APPROX(v[20], x);+  v.resize(22,y);+  VERIFY_IS_APPROX(v[21], y);+  v.push_back(x);+  VERIFY_IS_APPROX(v[22], x);++  // do a lot of push_back such that the deque gets internally resized+  // (with memory reallocation)+  MatrixType* ref = &w[0];+  for(int i=0; i<30 || ((ref==&w[0]) && i<300); ++i)+    v.push_back(w[i%w.size()]);+  for(unsigned int i=23; i<v.size(); ++i)+  {+    VERIFY(v[i]==w[(i-23)%w.size()]);+  }+}++template<typename TransformType>+void check_stddeque_transform(const TransformType&)+{+  typedef typename TransformType::MatrixType MatrixType;+  TransformType x(MatrixType::Random()), y(MatrixType::Random());+  std::deque<TransformType> v(10), w(20, y);+  v[5] = x;+  w[6] = v[5];+  VERIFY_IS_APPROX(w[6], v[5]);+  v = w;+  for(int i = 0; i < 20; i++)+  {+    VERIFY_IS_APPROX(w[i], v[i]);+  }++  v.resize(21);+  v[20] = x;+  VERIFY_IS_APPROX(v[20], x);+  v.resize(22,y);+  VERIFY_IS_APPROX(v[21], y);+  v.push_back(x);+  VERIFY_IS_APPROX(v[22], x);++  // do a lot of push_back such that the deque gets internally resized+  // (with memory reallocation)+  TransformType* ref = &w[0];+  for(int i=0; i<30 || ((ref==&w[0]) && i<300); ++i)+    v.push_back(w[i%w.size()]);+  for(unsigned int i=23; i<v.size(); ++i)+  {+    VERIFY(v[i].matrix()==w[(i-23)%w.size()].matrix());+  }+}++template<typename QuaternionType>+void check_stddeque_quaternion(const QuaternionType&)+{+  typedef typename QuaternionType::Coefficients Coefficients;+  QuaternionType x(Coefficients::Random()), y(Coefficients::Random());+  std::deque<QuaternionType> v(10), w(20, y);+  v[5] = x;+  w[6] = v[5];+  VERIFY_IS_APPROX(w[6], v[5]);+  v = w;+  for(int i = 0; i < 20; i++)+  {+    VERIFY_IS_APPROX(w[i], v[i]);+  }++  v.resize(21);+  v[20] = x;+  VERIFY_IS_APPROX(v[20], x);+  v.resize(22,y);+  VERIFY_IS_APPROX(v[21], y);+  v.push_back(x);+  VERIFY_IS_APPROX(v[22], x);++  // do a lot of push_back such that the deque gets internally resized+  // (with memory reallocation)+  QuaternionType* ref = &w[0];+  for(int i=0; i<30 || ((ref==&w[0]) && i<300); ++i)+    v.push_back(w[i%w.size()]);+  for(unsigned int i=23; i<v.size(); ++i)+  {+    VERIFY(v[i].coeffs()==w[(i-23)%w.size()].coeffs());+  }+}++void test_stddeque_overload()+{+  // some non vectorizable fixed sizes+  CALL_SUBTEST_1(check_stddeque_matrix(Vector2f()));+  CALL_SUBTEST_1(check_stddeque_matrix(Matrix3f()));+  CALL_SUBTEST_2(check_stddeque_matrix(Matrix3d()));++  // some vectorizable fixed sizes+  CALL_SUBTEST_1(check_stddeque_matrix(Matrix2f()));+  CALL_SUBTEST_1(check_stddeque_matrix(Vector4f()));+  CALL_SUBTEST_1(check_stddeque_matrix(Matrix4f()));+  CALL_SUBTEST_2(check_stddeque_matrix(Matrix4d()));++  // some dynamic sizes+  CALL_SUBTEST_3(check_stddeque_matrix(MatrixXd(1,1)));+  CALL_SUBTEST_3(check_stddeque_matrix(VectorXd(20)));+  CALL_SUBTEST_3(check_stddeque_matrix(RowVectorXf(20)));+  CALL_SUBTEST_3(check_stddeque_matrix(MatrixXcf(10,10)));++  // some Transform+  CALL_SUBTEST_4(check_stddeque_transform(Affine2f())); // does not need the specialization (2+1)^2 = 9+  CALL_SUBTEST_4(check_stddeque_transform(Affine3f()));+  CALL_SUBTEST_4(check_stddeque_transform(Affine3d()));++  // some Quaternion+  CALL_SUBTEST_5(check_stddeque_quaternion(Quaternionf()));+  CALL_SUBTEST_5(check_stddeque_quaternion(Quaterniond()));+}
+ eigen3/test/stdlist.cpp view
@@ -0,0 +1,130 @@+// This file is part of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2008 Benoit Jacob <jacob.benoit.1@gmail.com>+// Copyright (C) 2010 Hauke Heibel <hauke.heibel@gmail.com>+//+// 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 <Eigen/StdList>+#include <Eigen/Geometry>++template<typename MatrixType>+void check_stdlist_matrix(const MatrixType& m)+{+  Index rows = m.rows();+  Index cols = m.cols();+  MatrixType x = MatrixType::Random(rows,cols), y = MatrixType::Random(rows,cols);+  std::list<MatrixType,Eigen::aligned_allocator<MatrixType> > v(10, MatrixType(rows,cols)), w(20, y);+  v.front() = x;+  w.front() = w.back();+  VERIFY_IS_APPROX(w.front(), w.back());+  v = w;++  typename std::list<MatrixType,Eigen::aligned_allocator<MatrixType> >::iterator vi = v.begin();+  typename std::list<MatrixType,Eigen::aligned_allocator<MatrixType> >::iterator wi = w.begin();+  for(int i = 0; i < 20; i++)+  {+    VERIFY_IS_APPROX(*vi, *wi);+    ++vi;+    ++wi;+  }++  v.resize(21);  +  v.back() = x;+  VERIFY_IS_APPROX(v.back(), x);+  v.resize(22,y);+  VERIFY_IS_APPROX(v.back(), y);+  v.push_back(x);+  VERIFY_IS_APPROX(v.back(), x);+}++template<typename TransformType>+void check_stdlist_transform(const TransformType&)+{+  typedef typename TransformType::MatrixType MatrixType;+  TransformType x(MatrixType::Random()), y(MatrixType::Random());+  std::list<TransformType,Eigen::aligned_allocator<TransformType> > v(10), w(20, y);+  v.front() = x;+  w.front() = w.back();+  VERIFY_IS_APPROX(w.front(), w.back());+  v = w;++  typename std::list<TransformType,Eigen::aligned_allocator<TransformType> >::iterator vi = v.begin();+  typename std::list<TransformType,Eigen::aligned_allocator<TransformType> >::iterator wi = w.begin();+  for(int i = 0; i < 20; i++)+  {+    VERIFY_IS_APPROX(*vi, *wi);+    ++vi;+    ++wi;+  }++  v.resize(21);+  v.back() = x;+  VERIFY_IS_APPROX(v.back(), x);+  v.resize(22,y);+  VERIFY_IS_APPROX(v.back(), y);+  v.push_back(x);+  VERIFY_IS_APPROX(v.back(), x);+}++template<typename QuaternionType>+void check_stdlist_quaternion(const QuaternionType&)+{+  typedef typename QuaternionType::Coefficients Coefficients;+  QuaternionType x(Coefficients::Random()), y(Coefficients::Random());+  std::list<QuaternionType,Eigen::aligned_allocator<QuaternionType> > v(10), w(20, y);+  v.front() = x;+  w.front() = w.back();+  VERIFY_IS_APPROX(w.front(), w.back());+  v = w;++  typename std::list<QuaternionType,Eigen::aligned_allocator<QuaternionType> >::iterator vi = v.begin();+  typename std::list<QuaternionType,Eigen::aligned_allocator<QuaternionType> >::iterator wi = w.begin();+  for(int i = 0; i < 20; i++)+  {+    VERIFY_IS_APPROX(*vi, *wi);+    ++vi;+    ++wi;+  }++  v.resize(21);+  v.back() = x;+  VERIFY_IS_APPROX(v.back(), x);+  v.resize(22,y);+  VERIFY_IS_APPROX(v.back(), y);+  v.push_back(x);+  VERIFY_IS_APPROX(v.back(), x);+}++void test_stdlist()+{+  // some non vectorizable fixed sizes+  CALL_SUBTEST_1(check_stdlist_matrix(Vector2f()));+  CALL_SUBTEST_1(check_stdlist_matrix(Matrix3f()));+  CALL_SUBTEST_2(check_stdlist_matrix(Matrix3d()));++  // some vectorizable fixed sizes+  CALL_SUBTEST_1(check_stdlist_matrix(Matrix2f()));+  CALL_SUBTEST_1(check_stdlist_matrix(Vector4f()));+  CALL_SUBTEST_1(check_stdlist_matrix(Matrix4f()));+  CALL_SUBTEST_2(check_stdlist_matrix(Matrix4d()));++  // some dynamic sizes+  CALL_SUBTEST_3(check_stdlist_matrix(MatrixXd(1,1)));+  CALL_SUBTEST_3(check_stdlist_matrix(VectorXd(20)));+  CALL_SUBTEST_3(check_stdlist_matrix(RowVectorXf(20)));+  CALL_SUBTEST_3(check_stdlist_matrix(MatrixXcf(10,10)));++  // some Transform+  CALL_SUBTEST_4(check_stdlist_transform(Affine2f()));+  CALL_SUBTEST_4(check_stdlist_transform(Affine3f()));+  CALL_SUBTEST_4(check_stdlist_transform(Affine3d()));++  // some Quaternion+  CALL_SUBTEST_5(check_stdlist_quaternion(Quaternionf()));+  CALL_SUBTEST_5(check_stdlist_quaternion(Quaterniond()));+}
+ eigen3/test/stdlist_overload.cpp view
@@ -0,0 +1,192 @@+// This file is part of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2008 Benoit Jacob <jacob.benoit.1@gmail.com>+// Copyright (C) 2010 Hauke Heibel <hauke.heibel@gmail.com>+//+// 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 <Eigen/StdList>+#include <Eigen/Geometry>++EIGEN_DEFINE_STL_LIST_SPECIALIZATION(Vector4f)++EIGEN_DEFINE_STL_LIST_SPECIALIZATION(Matrix2f)+EIGEN_DEFINE_STL_LIST_SPECIALIZATION(Matrix4f)+EIGEN_DEFINE_STL_LIST_SPECIALIZATION(Matrix4d)++EIGEN_DEFINE_STL_LIST_SPECIALIZATION(Affine3f)+EIGEN_DEFINE_STL_LIST_SPECIALIZATION(Affine3d)++EIGEN_DEFINE_STL_LIST_SPECIALIZATION(Quaternionf)+EIGEN_DEFINE_STL_LIST_SPECIALIZATION(Quaterniond)++template <class Container, class Position>+typename Container::iterator get(Container & c, Position position)+{+  typename Container::iterator it = c.begin();+  std::advance(it, position);+  return it;+}++template <class Container, class Position, class Value>+void set(Container & c, Position position, const Value & value)+{+  typename Container::iterator it = c.begin();+  std::advance(it, position);+  *it = value;+}++template<typename MatrixType>+void check_stdlist_matrix(const MatrixType& m)+{+  typename MatrixType::Index rows = m.rows();+  typename MatrixType::Index cols = m.cols();+  MatrixType x = MatrixType::Random(rows,cols), y = MatrixType::Random(rows,cols);+  std::list<MatrixType> v(10, MatrixType(rows,cols)), w(20, y);+  typename std::list<MatrixType>::iterator itv = get(v, 5);+  typename std::list<MatrixType>::iterator itw = get(w, 6);+  *itv = x;+  *itw = *itv;+  VERIFY_IS_APPROX(*itw, *itv);+  v = w;+  itv = v.begin();+  itw = w.begin();+  for(int i = 0; i < 20; i++)+  {+    VERIFY_IS_APPROX(*itw, *itv);+    ++itv;+    ++itw;+  }++  v.resize(21);+  set(v, 20, x);+  VERIFY_IS_APPROX(*get(v, 20), x);+  v.resize(22,y);+  VERIFY_IS_APPROX(*get(v, 21), y);+  v.push_back(x);+  VERIFY_IS_APPROX(*get(v, 22), x);++  // do a lot of push_back such that the list gets internally resized+  // (with memory reallocation)+  MatrixType* ref = &(*get(w, 0));+  for(int i=0; i<30 || ((ref==&(*get(w, 0))) && i<300); ++i)+    v.push_back(*get(w, i%w.size()));+  for(unsigned int i=23; i<v.size(); ++i)+  {+    VERIFY((*get(v, i))==(*get(w, (i-23)%w.size())));+  }+}++template<typename TransformType>+void check_stdlist_transform(const TransformType&)+{+  typedef typename TransformType::MatrixType MatrixType;+  TransformType x(MatrixType::Random()), y(MatrixType::Random());+  std::list<TransformType> v(10), w(20, y);+  typename std::list<TransformType>::iterator itv = get(v, 5);+  typename std::list<TransformType>::iterator itw = get(w, 6);+  *itv = x;+  *itw = *itv;+  VERIFY_IS_APPROX(*itw, *itv);+  v = w;+  itv = v.begin();+  itw = w.begin();+  for(int i = 0; i < 20; i++)+  {+    VERIFY_IS_APPROX(*itw, *itv);+    ++itv;+    ++itw;+  }++  v.resize(21);+  set(v, 20, x);+  VERIFY_IS_APPROX(*get(v, 20), x);+  v.resize(22,y);+  VERIFY_IS_APPROX(*get(v, 21), y);+  v.push_back(x);+  VERIFY_IS_APPROX(*get(v, 22), x);++  // do a lot of push_back such that the list gets internally resized+  // (with memory reallocation)+  TransformType* ref = &(*get(w, 0));+  for(int i=0; i<30 || ((ref==&(*get(w, 0))) && i<300); ++i)+    v.push_back(*get(w, i%w.size()));+  for(unsigned int i=23; i<v.size(); ++i)+  {+    VERIFY(get(v, i)->matrix()==get(w, (i-23)%w.size())->matrix());+  }+}++template<typename QuaternionType>+void check_stdlist_quaternion(const QuaternionType&)+{+  typedef typename QuaternionType::Coefficients Coefficients;+  QuaternionType x(Coefficients::Random()), y(Coefficients::Random());+  std::list<QuaternionType> v(10), w(20, y);+  typename std::list<QuaternionType>::iterator itv = get(v, 5);+  typename std::list<QuaternionType>::iterator itw = get(w, 6);+  *itv = x;+  *itw = *itv;+  VERIFY_IS_APPROX(*itw, *itv);+  v = w;+  itv = v.begin();+  itw = w.begin();+  for(int i = 0; i < 20; i++)+  {+    VERIFY_IS_APPROX(*itw, *itv);+    ++itv;+    ++itw;+  }++  v.resize(21);+  set(v, 20, x);+  VERIFY_IS_APPROX(*get(v, 20), x);+  v.resize(22,y);+  VERIFY_IS_APPROX(*get(v, 21), y);+  v.push_back(x);+  VERIFY_IS_APPROX(*get(v, 22), x);++  // do a lot of push_back such that the list gets internally resized+  // (with memory reallocation)+  QuaternionType* ref = &(*get(w, 0));+  for(int i=0; i<30 || ((ref==&(*get(w, 0))) && i<300); ++i)+    v.push_back(*get(w, i%w.size()));+  for(unsigned int i=23; i<v.size(); ++i)+  {+    VERIFY(get(v, i)->coeffs()==get(w, (i-23)%w.size())->coeffs());+  }+}++void test_stdlist_overload()+{+  // some non vectorizable fixed sizes+  CALL_SUBTEST_1(check_stdlist_matrix(Vector2f()));+  CALL_SUBTEST_1(check_stdlist_matrix(Matrix3f()));+  CALL_SUBTEST_2(check_stdlist_matrix(Matrix3d()));++  // some vectorizable fixed sizes+  CALL_SUBTEST_1(check_stdlist_matrix(Matrix2f()));+  CALL_SUBTEST_1(check_stdlist_matrix(Vector4f()));+  CALL_SUBTEST_1(check_stdlist_matrix(Matrix4f()));+  CALL_SUBTEST_2(check_stdlist_matrix(Matrix4d()));++  // some dynamic sizes+  CALL_SUBTEST_3(check_stdlist_matrix(MatrixXd(1,1)));+  CALL_SUBTEST_3(check_stdlist_matrix(VectorXd(20)));+  CALL_SUBTEST_3(check_stdlist_matrix(RowVectorXf(20)));+  CALL_SUBTEST_3(check_stdlist_matrix(MatrixXcf(10,10)));++  // some Transform+  CALL_SUBTEST_4(check_stdlist_transform(Affine2f())); // does not need the specialization (2+1)^2 = 9+  CALL_SUBTEST_4(check_stdlist_transform(Affine3f()));+  CALL_SUBTEST_4(check_stdlist_transform(Affine3d()));++  // some Quaternion+  CALL_SUBTEST_5(check_stdlist_quaternion(Quaternionf()));+  CALL_SUBTEST_5(check_stdlist_quaternion(Quaterniond()));+}
+ eigen3/test/stdvector.cpp view
@@ -0,0 +1,158 @@+// This file is part of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2008 Benoit Jacob <jacob.benoit.1@gmail.com>+//+// 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 <Eigen/StdVector>+#include <Eigen/Geometry>++template<typename MatrixType>+void check_stdvector_matrix(const MatrixType& m)+{+  typename MatrixType::Index rows = m.rows();+  typename MatrixType::Index cols = m.cols();+  MatrixType x = MatrixType::Random(rows,cols), y = MatrixType::Random(rows,cols);+  std::vector<MatrixType,Eigen::aligned_allocator<MatrixType> > v(10, MatrixType(rows,cols)), w(20, y);+  v[5] = x;+  w[6] = v[5];+  VERIFY_IS_APPROX(w[6], v[5]);+  v = w;+  for(int i = 0; i < 20; i++)+  {+    VERIFY_IS_APPROX(w[i], v[i]);+  }++  v.resize(21);+  v[20] = x;+  VERIFY_IS_APPROX(v[20], x);+  v.resize(22,y);+  VERIFY_IS_APPROX(v[21], y);+  v.push_back(x);+  VERIFY_IS_APPROX(v[22], x);+  VERIFY((internal::UIntPtr)&(v[22]) == (internal::UIntPtr)&(v[21]) + sizeof(MatrixType));++  // do a lot of push_back such that the vector gets internally resized+  // (with memory reallocation)+  MatrixType* ref = &w[0];+  for(int i=0; i<30 || ((ref==&w[0]) && i<300); ++i)+    v.push_back(w[i%w.size()]);+  for(unsigned int i=23; i<v.size(); ++i)+  {+    VERIFY(v[i]==w[(i-23)%w.size()]);+  }+}++template<typename TransformType>+void check_stdvector_transform(const TransformType&)+{+  typedef typename TransformType::MatrixType MatrixType;+  TransformType x(MatrixType::Random()), y(MatrixType::Random());+  std::vector<TransformType,Eigen::aligned_allocator<TransformType> > v(10), w(20, y);+  v[5] = x;+  w[6] = v[5];+  VERIFY_IS_APPROX(w[6], v[5]);+  v = w;+  for(int i = 0; i < 20; i++)+  {+    VERIFY_IS_APPROX(w[i], v[i]);+  }++  v.resize(21);+  v[20] = x;+  VERIFY_IS_APPROX(v[20], x);+  v.resize(22,y);+  VERIFY_IS_APPROX(v[21], y);+  v.push_back(x);+  VERIFY_IS_APPROX(v[22], x);+  VERIFY((internal::UIntPtr)&(v[22]) == (internal::UIntPtr)&(v[21]) + sizeof(TransformType));++  // do a lot of push_back such that the vector gets internally resized+  // (with memory reallocation)+  TransformType* ref = &w[0];+  for(int i=0; i<30 || ((ref==&w[0]) && i<300); ++i)+    v.push_back(w[i%w.size()]);+  for(unsigned int i=23; i<v.size(); ++i)+  {+    VERIFY(v[i].matrix()==w[(i-23)%w.size()].matrix());+  }+}++template<typename QuaternionType>+void check_stdvector_quaternion(const QuaternionType&)+{+  typedef typename QuaternionType::Coefficients Coefficients;+  QuaternionType x(Coefficients::Random()), y(Coefficients::Random());+  std::vector<QuaternionType,Eigen::aligned_allocator<QuaternionType> > v(10), w(20, y);+  v[5] = x;+  w[6] = v[5];+  VERIFY_IS_APPROX(w[6], v[5]);+  v = w;+  for(int i = 0; i < 20; i++)+  {+    VERIFY_IS_APPROX(w[i], v[i]);+  }++  v.resize(21);+  v[20] = x;+  VERIFY_IS_APPROX(v[20], x);+  v.resize(22,y);+  VERIFY_IS_APPROX(v[21], y);+  v.push_back(x);+  VERIFY_IS_APPROX(v[22], x);+  VERIFY((internal::UIntPtr)&(v[22]) == (internal::UIntPtr)&(v[21]) + sizeof(QuaternionType));++  // do a lot of push_back such that the vector gets internally resized+  // (with memory reallocation)+  QuaternionType* ref = &w[0];+  for(int i=0; i<30 || ((ref==&w[0]) && i<300); ++i)+    v.push_back(w[i%w.size()]);+  for(unsigned int i=23; i<v.size(); ++i)+  {+    VERIFY(v[i].coeffs()==w[(i-23)%w.size()].coeffs());+  }+}++// the code below triggered an invalid warning with gcc >= 7+// eigen/Eigen/src/Core/util/Memory.h:189:12: warning: argument 1 value '18446744073709551612' exceeds maximum object size 9223372036854775807+// This has been reported to gcc there: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87544+void std_vector_gcc_warning()+{+  typedef Eigen::Vector3f T;+  std::vector<T, Eigen::aligned_allocator<T> > v;+  v.push_back(T());+}++void test_stdvector()+{+  // some non vectorizable fixed sizes+  CALL_SUBTEST_1(check_stdvector_matrix(Vector2f()));+  CALL_SUBTEST_1(check_stdvector_matrix(Matrix3f()));+  CALL_SUBTEST_2(check_stdvector_matrix(Matrix3d()));++  // some vectorizable fixed sizes+  CALL_SUBTEST_1(check_stdvector_matrix(Matrix2f()));+  CALL_SUBTEST_1(check_stdvector_matrix(Vector4f()));+  CALL_SUBTEST_1(check_stdvector_matrix(Matrix4f()));+  CALL_SUBTEST_2(check_stdvector_matrix(Matrix4d()));++  // some dynamic sizes+  CALL_SUBTEST_3(check_stdvector_matrix(MatrixXd(1,1)));+  CALL_SUBTEST_3(check_stdvector_matrix(VectorXd(20)));+  CALL_SUBTEST_3(check_stdvector_matrix(RowVectorXf(20)));+  CALL_SUBTEST_3(check_stdvector_matrix(MatrixXcf(10,10)));++  // some Transform+  CALL_SUBTEST_4(check_stdvector_transform(Projective2f()));+  CALL_SUBTEST_4(check_stdvector_transform(Projective3f()));+  CALL_SUBTEST_4(check_stdvector_transform(Projective3d()));+  //CALL_SUBTEST(heck_stdvector_transform(Projective4d()));++  // some Quaternion+  CALL_SUBTEST_5(check_stdvector_quaternion(Quaternionf()));+  CALL_SUBTEST_5(check_stdvector_quaternion(Quaterniond()));+}
+ eigen3/test/stdvector_overload.cpp view
@@ -0,0 +1,161 @@+// This file is part of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2008 Benoit Jacob <jacob.benoit.1@gmail.com>+// Copyright (C) 2010 Hauke Heibel <hauke.heibel@gmail.com>+//+// 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 <Eigen/StdVector>+#include <Eigen/Geometry>++EIGEN_DEFINE_STL_VECTOR_SPECIALIZATION(Vector4f)++EIGEN_DEFINE_STL_VECTOR_SPECIALIZATION(Matrix2f)+EIGEN_DEFINE_STL_VECTOR_SPECIALIZATION(Matrix4f)+EIGEN_DEFINE_STL_VECTOR_SPECIALIZATION(Matrix4d)++EIGEN_DEFINE_STL_VECTOR_SPECIALIZATION(Affine3f)+EIGEN_DEFINE_STL_VECTOR_SPECIALIZATION(Affine3d)++EIGEN_DEFINE_STL_VECTOR_SPECIALIZATION(Quaternionf)+EIGEN_DEFINE_STL_VECTOR_SPECIALIZATION(Quaterniond)++template<typename MatrixType>+void check_stdvector_matrix(const MatrixType& m)+{+  typename MatrixType::Index rows = m.rows();+  typename MatrixType::Index cols = m.cols();+  MatrixType x = MatrixType::Random(rows,cols), y = MatrixType::Random(rows,cols);+  std::vector<MatrixType> v(10, MatrixType(rows,cols)), w(20, y);+  v[5] = x;+  w[6] = v[5];+  VERIFY_IS_APPROX(w[6], v[5]);+  v = w;+  for(int i = 0; i < 20; i++)+  {+    VERIFY_IS_APPROX(w[i], v[i]);+  }++  v.resize(21);+  v[20] = x;+  VERIFY_IS_APPROX(v[20], x);+  v.resize(22,y);+  VERIFY_IS_APPROX(v[21], y);+  v.push_back(x);+  VERIFY_IS_APPROX(v[22], x);+  VERIFY((internal::UIntPtr)&(v[22]) == (internal::UIntPtr)&(v[21]) + sizeof(MatrixType));++  // do a lot of push_back such that the vector gets internally resized+  // (with memory reallocation)+  MatrixType* ref = &w[0];+  for(int i=0; i<30 || ((ref==&w[0]) && i<300); ++i)+    v.push_back(w[i%w.size()]);+  for(unsigned int i=23; i<v.size(); ++i)+  {+    VERIFY(v[i]==w[(i-23)%w.size()]);+  }+}++template<typename TransformType>+void check_stdvector_transform(const TransformType&)+{+  typedef typename TransformType::MatrixType MatrixType;+  TransformType x(MatrixType::Random()), y(MatrixType::Random());+  std::vector<TransformType> v(10), w(20, y);+  v[5] = x;+  w[6] = v[5];+  VERIFY_IS_APPROX(w[6], v[5]);+  v = w;+  for(int i = 0; i < 20; i++)+  {+    VERIFY_IS_APPROX(w[i], v[i]);+  }++  v.resize(21);+  v[20] = x;+  VERIFY_IS_APPROX(v[20], x);+  v.resize(22,y);+  VERIFY_IS_APPROX(v[21], y);+  v.push_back(x);+  VERIFY_IS_APPROX(v[22], x);+  VERIFY((internal::UIntPtr)&(v[22]) == (internal::UIntPtr)&(v[21]) + sizeof(TransformType));++  // do a lot of push_back such that the vector gets internally resized+  // (with memory reallocation)+  TransformType* ref = &w[0];+  for(int i=0; i<30 || ((ref==&w[0]) && i<300); ++i)+    v.push_back(w[i%w.size()]);+  for(unsigned int i=23; i<v.size(); ++i)+  {+    VERIFY(v[i].matrix()==w[(i-23)%w.size()].matrix());+  }+}++template<typename QuaternionType>+void check_stdvector_quaternion(const QuaternionType&)+{+  typedef typename QuaternionType::Coefficients Coefficients;+  QuaternionType x(Coefficients::Random()), y(Coefficients::Random());+  std::vector<QuaternionType> v(10), w(20, y);+  v[5] = x;+  w[6] = v[5];+  VERIFY_IS_APPROX(w[6], v[5]);+  v = w;+  for(int i = 0; i < 20; i++)+  {+    VERIFY_IS_APPROX(w[i], v[i]);+  }++  v.resize(21);+  v[20] = x;+  VERIFY_IS_APPROX(v[20], x);+  v.resize(22,y);+  VERIFY_IS_APPROX(v[21], y);+  v.push_back(x);+  VERIFY_IS_APPROX(v[22], x);+  VERIFY((internal::UIntPtr)&(v[22]) == (internal::UIntPtr)&(v[21]) + sizeof(QuaternionType));++  // do a lot of push_back such that the vector gets internally resized+  // (with memory reallocation)+  QuaternionType* ref = &w[0];+  for(int i=0; i<30 || ((ref==&w[0]) && i<300); ++i)+    v.push_back(w[i%w.size()]);+  for(unsigned int i=23; i<v.size(); ++i)+  {+    VERIFY(v[i].coeffs()==w[(i-23)%w.size()].coeffs());+  }+}++void test_stdvector_overload()+{+  // some non vectorizable fixed sizes+  CALL_SUBTEST_1(check_stdvector_matrix(Vector2f()));+  CALL_SUBTEST_1(check_stdvector_matrix(Matrix3f()));+  CALL_SUBTEST_2(check_stdvector_matrix(Matrix3d()));++  // some vectorizable fixed sizes+  CALL_SUBTEST_1(check_stdvector_matrix(Matrix2f()));+  CALL_SUBTEST_1(check_stdvector_matrix(Vector4f()));+  CALL_SUBTEST_1(check_stdvector_matrix(Matrix4f()));+  CALL_SUBTEST_2(check_stdvector_matrix(Matrix4d()));++  // some dynamic sizes+  CALL_SUBTEST_3(check_stdvector_matrix(MatrixXd(1,1)));+  CALL_SUBTEST_3(check_stdvector_matrix(VectorXd(20)));+  CALL_SUBTEST_3(check_stdvector_matrix(RowVectorXf(20)));+  CALL_SUBTEST_3(check_stdvector_matrix(MatrixXcf(10,10)));++  // some Transform+  CALL_SUBTEST_4(check_stdvector_transform(Affine2f())); // does not need the specialization (2+1)^2 = 9+  CALL_SUBTEST_4(check_stdvector_transform(Affine3f()));+  CALL_SUBTEST_4(check_stdvector_transform(Affine3d()));++  // some Quaternion+  CALL_SUBTEST_5(check_stdvector_quaternion(Quaternionf()));+  CALL_SUBTEST_5(check_stdvector_quaternion(Quaterniond()));+}
+ eigen3/test/superlu_support.cpp view
@@ -0,0 +1,23 @@+// This file is part of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2011 Gael Guennebaud <g.gael@free.fr>+//+// 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 <Eigen/SuperLUSupport>++void test_superlu_support()+{+  SuperLU<SparseMatrix<double> > superlu_double_colmajor;+  SuperLU<SparseMatrix<std::complex<double> > > superlu_cplxdouble_colmajor;+  CALL_SUBTEST_1( check_sparse_square_solving(superlu_double_colmajor)      );+  CALL_SUBTEST_2( check_sparse_square_solving(superlu_cplxdouble_colmajor)  );+  CALL_SUBTEST_1( check_sparse_square_determinant(superlu_double_colmajor)      );+  CALL_SUBTEST_2( check_sparse_square_determinant(superlu_cplxdouble_colmajor)  );+}
+ eigen3/test/svd_common.h view
@@ -0,0 +1,478 @@+// This file is part of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2008-2014 Gael Guennebaud <gael.guennebaud@inria.fr>+// Copyright (C) 2009 Benoit Jacob <jacob.benoit.1@gmail.com>+//+// 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 SVD_DEFAULT+#error a macro SVD_DEFAULT(MatrixType) must be defined prior to including svd_common.h+#endif++#ifndef SVD_FOR_MIN_NORM+#error a macro SVD_FOR_MIN_NORM(MatrixType) must be defined prior to including svd_common.h+#endif++#include "svd_fill.h"++// Check that the matrix m is properly reconstructed and that the U and V factors are unitary+// The SVD must have already been computed.+template<typename SvdType, typename MatrixType>+void svd_check_full(const MatrixType& m, const SvdType& svd)+{+  Index rows = m.rows();+  Index cols = m.cols();++  enum {+    RowsAtCompileTime = MatrixType::RowsAtCompileTime,+    ColsAtCompileTime = MatrixType::ColsAtCompileTime+  };++  typedef typename MatrixType::Scalar Scalar;+  typedef typename MatrixType::RealScalar RealScalar;+  typedef Matrix<Scalar, RowsAtCompileTime, RowsAtCompileTime> MatrixUType;+  typedef Matrix<Scalar, ColsAtCompileTime, ColsAtCompileTime> MatrixVType;++  MatrixType sigma = MatrixType::Zero(rows,cols);+  sigma.diagonal() = svd.singularValues().template cast<Scalar>();+  MatrixUType u = svd.matrixU();+  MatrixVType v = svd.matrixV();+  RealScalar scaling = m.cwiseAbs().maxCoeff();+  if(scaling<(std::numeric_limits<RealScalar>::min)())+  {+    VERIFY(sigma.cwiseAbs().maxCoeff() <= (std::numeric_limits<RealScalar>::min)());+  }+  else+  {+    VERIFY_IS_APPROX(m/scaling, u * (sigma/scaling) * v.adjoint());+  }+  VERIFY_IS_UNITARY(u);+  VERIFY_IS_UNITARY(v);+}++// Compare partial SVD defined by computationOptions to a full SVD referenceSvd+template<typename SvdType, typename MatrixType>+void svd_compare_to_full(const MatrixType& m,+                         unsigned int computationOptions,+                         const SvdType& referenceSvd)+{+  typedef typename MatrixType::RealScalar RealScalar;+  Index rows = m.rows();+  Index cols = m.cols();+  Index diagSize = (std::min)(rows, cols);+  RealScalar prec = test_precision<RealScalar>();++  SvdType svd(m, computationOptions);++  VERIFY_IS_APPROX(svd.singularValues(), referenceSvd.singularValues());+  +  if(computationOptions & (ComputeFullV|ComputeThinV))+  {+    VERIFY( (svd.matrixV().adjoint()*svd.matrixV()).isIdentity(prec) );+    VERIFY_IS_APPROX( svd.matrixV().leftCols(diagSize) * svd.singularValues().asDiagonal() * svd.matrixV().leftCols(diagSize).adjoint(),+                      referenceSvd.matrixV().leftCols(diagSize) * referenceSvd.singularValues().asDiagonal() * referenceSvd.matrixV().leftCols(diagSize).adjoint());+  }+  +  if(computationOptions & (ComputeFullU|ComputeThinU))+  {+    VERIFY( (svd.matrixU().adjoint()*svd.matrixU()).isIdentity(prec) );+    VERIFY_IS_APPROX( svd.matrixU().leftCols(diagSize) * svd.singularValues().cwiseAbs2().asDiagonal() * svd.matrixU().leftCols(diagSize).adjoint(),+                      referenceSvd.matrixU().leftCols(diagSize) * referenceSvd.singularValues().cwiseAbs2().asDiagonal() * referenceSvd.matrixU().leftCols(diagSize).adjoint());+  }+  +  // The following checks are not critical.+  // For instance, with Dived&Conquer SVD, if only the factor 'V' is computedt then different matrix-matrix product implementation will be used+  // and the resulting 'V' factor might be significantly different when the SVD decomposition is not unique, especially with single precision float.+  ++g_test_level;+  if(computationOptions & ComputeFullU)  VERIFY_IS_APPROX(svd.matrixU(), referenceSvd.matrixU());+  if(computationOptions & ComputeThinU)  VERIFY_IS_APPROX(svd.matrixU(), referenceSvd.matrixU().leftCols(diagSize));+  if(computationOptions & ComputeFullV)  VERIFY_IS_APPROX(svd.matrixV().cwiseAbs(), referenceSvd.matrixV().cwiseAbs());+  if(computationOptions & ComputeThinV)  VERIFY_IS_APPROX(svd.matrixV(), referenceSvd.matrixV().leftCols(diagSize));+  --g_test_level;+}++//+template<typename SvdType, typename MatrixType>+void svd_least_square(const MatrixType& m, unsigned int computationOptions)+{+  typedef typename MatrixType::Scalar Scalar;+  typedef typename MatrixType::RealScalar RealScalar;+  Index rows = m.rows();+  Index cols = m.cols();++  enum {+    RowsAtCompileTime = MatrixType::RowsAtCompileTime,+    ColsAtCompileTime = MatrixType::ColsAtCompileTime+  };++  typedef Matrix<Scalar, RowsAtCompileTime, Dynamic> RhsType;+  typedef Matrix<Scalar, ColsAtCompileTime, Dynamic> SolutionType;++  RhsType rhs = RhsType::Random(rows, internal::random<Index>(1, cols));+  SvdType svd(m, computationOptions);++       if(internal::is_same<RealScalar,double>::value) svd.setThreshold(1e-8);+  else if(internal::is_same<RealScalar,float>::value)  svd.setThreshold(2e-4);++  SolutionType x = svd.solve(rhs);+   +  RealScalar residual = (m*x-rhs).norm();+  RealScalar rhs_norm = rhs.norm();+  if(!test_isMuchSmallerThan(residual,rhs.norm()))+  {+    // ^^^ If the residual is very small, then we have an exact solution, so we are already good.+    +    // evaluate normal equation which works also for least-squares solutions+    if(internal::is_same<RealScalar,double>::value || svd.rank()==m.diagonal().size())+    {+      using std::sqrt;+      // This test is not stable with single precision.+      // This is probably because squaring m signicantly affects the precision.      +      if(internal::is_same<RealScalar,float>::value) ++g_test_level;+      +      VERIFY_IS_APPROX(m.adjoint()*(m*x),m.adjoint()*rhs);+      +      if(internal::is_same<RealScalar,float>::value) --g_test_level;+    }+    +    // Check that there is no significantly better solution in the neighborhood of x+    for(Index k=0;k<x.rows();++k)+    {+      using std::abs;+      +      SolutionType y(x);+      y.row(k) = (RealScalar(1)+2*NumTraits<RealScalar>::epsilon())*x.row(k);+      RealScalar residual_y = (m*y-rhs).norm();+      VERIFY( test_isMuchSmallerThan(abs(residual_y-residual), rhs_norm) || residual < residual_y );+      if(internal::is_same<RealScalar,float>::value) ++g_test_level;+      VERIFY( test_isApprox(residual_y,residual) || residual < residual_y );+      if(internal::is_same<RealScalar,float>::value) --g_test_level;+      +      y.row(k) = (RealScalar(1)-2*NumTraits<RealScalar>::epsilon())*x.row(k);+      residual_y = (m*y-rhs).norm();+      VERIFY( test_isMuchSmallerThan(abs(residual_y-residual), rhs_norm) || residual < residual_y );+      if(internal::is_same<RealScalar,float>::value) ++g_test_level;+      VERIFY( test_isApprox(residual_y,residual) || residual < residual_y );+      if(internal::is_same<RealScalar,float>::value) --g_test_level;+    }+  }+}++// check minimal norm solutions, the inoput matrix m is only used to recover problem size+template<typename MatrixType>+void svd_min_norm(const MatrixType& m, unsigned int computationOptions)+{+  typedef typename MatrixType::Scalar Scalar;+  Index cols = m.cols();++  enum {+    ColsAtCompileTime = MatrixType::ColsAtCompileTime+  };++  typedef Matrix<Scalar, ColsAtCompileTime, Dynamic> SolutionType;++  // generate a full-rank m x n problem with m<n+  enum {+    RankAtCompileTime2 = ColsAtCompileTime==Dynamic ? Dynamic : (ColsAtCompileTime)/2+1,+    RowsAtCompileTime3 = ColsAtCompileTime==Dynamic ? Dynamic : ColsAtCompileTime+1+  };+  typedef Matrix<Scalar, RankAtCompileTime2, ColsAtCompileTime> MatrixType2;+  typedef Matrix<Scalar, RankAtCompileTime2, 1> RhsType2;+  typedef Matrix<Scalar, ColsAtCompileTime, RankAtCompileTime2> MatrixType2T;+  Index rank = RankAtCompileTime2==Dynamic ? internal::random<Index>(1,cols) : Index(RankAtCompileTime2);+  MatrixType2 m2(rank,cols);+  int guard = 0;+  do {+    m2.setRandom();+  } while(SVD_FOR_MIN_NORM(MatrixType2)(m2).setThreshold(test_precision<Scalar>()).rank()!=rank && (++guard)<10);+  VERIFY(guard<10);++  RhsType2 rhs2 = RhsType2::Random(rank);+  // use QR to find a reference minimal norm solution+  HouseholderQR<MatrixType2T> qr(m2.adjoint());+  Matrix<Scalar,Dynamic,1> tmp = qr.matrixQR().topLeftCorner(rank,rank).template triangularView<Upper>().adjoint().solve(rhs2);+  tmp.conservativeResize(cols);+  tmp.tail(cols-rank).setZero();+  SolutionType x21 = qr.householderQ() * tmp;+  // now check with SVD+  SVD_FOR_MIN_NORM(MatrixType2) svd2(m2, computationOptions);+  SolutionType x22 = svd2.solve(rhs2);+  VERIFY_IS_APPROX(m2*x21, rhs2);+  VERIFY_IS_APPROX(m2*x22, rhs2);+  VERIFY_IS_APPROX(x21, x22);++  // Now check with a rank deficient matrix+  typedef Matrix<Scalar, RowsAtCompileTime3, ColsAtCompileTime> MatrixType3;+  typedef Matrix<Scalar, RowsAtCompileTime3, 1> RhsType3;+  Index rows3 = RowsAtCompileTime3==Dynamic ? internal::random<Index>(rank+1,2*cols) : Index(RowsAtCompileTime3);+  Matrix<Scalar,RowsAtCompileTime3,Dynamic> C = Matrix<Scalar,RowsAtCompileTime3,Dynamic>::Random(rows3,rank);+  MatrixType3 m3 = C * m2;+  RhsType3 rhs3 = C * rhs2;+  SVD_FOR_MIN_NORM(MatrixType3) svd3(m3, computationOptions);+  SolutionType x3 = svd3.solve(rhs3);+  VERIFY_IS_APPROX(m3*x3, rhs3);+  VERIFY_IS_APPROX(m3*x21, rhs3);+  VERIFY_IS_APPROX(m2*x3, rhs2);+  VERIFY_IS_APPROX(x21, x3);+}++// Check full, compare_to_full, least_square, and min_norm for all possible compute-options+template<typename SvdType, typename MatrixType>+void svd_test_all_computation_options(const MatrixType& m, bool full_only)+{+//   if (QRPreconditioner == NoQRPreconditioner && m.rows() != m.cols())+//     return;+  SvdType fullSvd(m, ComputeFullU|ComputeFullV);+  CALL_SUBTEST(( svd_check_full(m, fullSvd) ));+  CALL_SUBTEST(( svd_least_square<SvdType>(m, ComputeFullU | ComputeFullV) ));+  CALL_SUBTEST(( svd_min_norm(m, ComputeFullU | ComputeFullV) ));+  +  #if defined __INTEL_COMPILER+  // remark #111: statement is unreachable+  #pragma warning disable 111+  #endif+  if(full_only)+    return;++  CALL_SUBTEST(( svd_compare_to_full(m, ComputeFullU, fullSvd) ));+  CALL_SUBTEST(( svd_compare_to_full(m, ComputeFullV, fullSvd) ));+  CALL_SUBTEST(( svd_compare_to_full(m, 0, fullSvd) ));++  if (MatrixType::ColsAtCompileTime == Dynamic) {+    // thin U/V are only available with dynamic number of columns+    CALL_SUBTEST(( svd_compare_to_full(m, ComputeFullU|ComputeThinV, fullSvd) ));+    CALL_SUBTEST(( svd_compare_to_full(m,              ComputeThinV, fullSvd) ));+    CALL_SUBTEST(( svd_compare_to_full(m, ComputeThinU|ComputeFullV, fullSvd) ));+    CALL_SUBTEST(( svd_compare_to_full(m, ComputeThinU             , fullSvd) ));+    CALL_SUBTEST(( svd_compare_to_full(m, ComputeThinU|ComputeThinV, fullSvd) ));+    +    CALL_SUBTEST(( svd_least_square<SvdType>(m, ComputeFullU | ComputeThinV) ));+    CALL_SUBTEST(( svd_least_square<SvdType>(m, ComputeThinU | ComputeFullV) ));+    CALL_SUBTEST(( svd_least_square<SvdType>(m, ComputeThinU | ComputeThinV) ));++    CALL_SUBTEST(( svd_min_norm(m, ComputeFullU | ComputeThinV) ));+    CALL_SUBTEST(( svd_min_norm(m, ComputeThinU | ComputeFullV) ));+    CALL_SUBTEST(( svd_min_norm(m, ComputeThinU | ComputeThinV) ));++    // test reconstruction+    Index diagSize = (std::min)(m.rows(), m.cols());+    SvdType svd(m, ComputeThinU | ComputeThinV);+    VERIFY_IS_APPROX(m, svd.matrixU().leftCols(diagSize) * svd.singularValues().asDiagonal() * svd.matrixV().leftCols(diagSize).adjoint());+  }+}+++// work around stupid msvc error when constructing at compile time an expression that involves+// a division by zero, even if the numeric type has floating point+template<typename Scalar>+EIGEN_DONT_INLINE Scalar zero() { return Scalar(0); }++// workaround aggressive optimization in ICC+template<typename T> EIGEN_DONT_INLINE  T sub(T a, T b) { return a - b; }++// all this function does is verify we don't iterate infinitely on nan/inf values+template<typename SvdType, typename MatrixType>+void svd_inf_nan()+{+  SvdType svd;+  typedef typename MatrixType::Scalar Scalar;+  Scalar some_inf = Scalar(1) / zero<Scalar>();+  VERIFY(sub(some_inf, some_inf) != sub(some_inf, some_inf));+  svd.compute(MatrixType::Constant(10,10,some_inf), ComputeFullU | ComputeFullV);++  Scalar nan = std::numeric_limits<Scalar>::quiet_NaN();+  VERIFY(nan != nan);+  svd.compute(MatrixType::Constant(10,10,nan), ComputeFullU | ComputeFullV);++  MatrixType m = MatrixType::Zero(10,10);+  m(internal::random<int>(0,9), internal::random<int>(0,9)) = some_inf;+  svd.compute(m, ComputeFullU | ComputeFullV);++  m = MatrixType::Zero(10,10);+  m(internal::random<int>(0,9), internal::random<int>(0,9)) = nan;+  svd.compute(m, ComputeFullU | ComputeFullV);+  +  // regression test for bug 791+  m.resize(3,3);+  m << 0,    2*NumTraits<Scalar>::epsilon(),  0.5,+       0,   -0.5,                             0,+       nan,  0,                               0;+  svd.compute(m, ComputeFullU | ComputeFullV);+  +  m.resize(4,4);+  m <<  1, 0, 0, 0,+        0, 3, 1, 2e-308,+        1, 0, 1, nan,+        0, nan, nan, 0;+  svd.compute(m, ComputeFullU | ComputeFullV);+}++// Regression test for bug 286: JacobiSVD loops indefinitely with some+// matrices containing denormal numbers.+template<typename>+void svd_underoverflow()+{+#if defined __INTEL_COMPILER+// shut up warning #239: floating point underflow+#pragma warning push+#pragma warning disable 239+#endif+  Matrix2d M;+  M << -7.90884e-313, -4.94e-324,+                 0, 5.60844e-313;+  SVD_DEFAULT(Matrix2d) svd;+  svd.compute(M,ComputeFullU|ComputeFullV);+  CALL_SUBTEST( svd_check_full(M,svd) );+  +  // Check all 2x2 matrices made with the following coefficients:+  VectorXd value_set(9);+  value_set << 0, 1, -1, 5.60844e-313, -5.60844e-313, 4.94e-324, -4.94e-324, -4.94e-223, 4.94e-223;+  Array4i id(0,0,0,0);+  int k = 0;+  do+  {+    M << value_set(id(0)), value_set(id(1)), value_set(id(2)), value_set(id(3));+    svd.compute(M,ComputeFullU|ComputeFullV);+    CALL_SUBTEST( svd_check_full(M,svd) );++    id(k)++;+    if(id(k)>=value_set.size())+    {+      while(k<3 && id(k)>=value_set.size()) id(++k)++;+      id.head(k).setZero();+      k=0;+    }++  } while((id<int(value_set.size())).all());+  +#if defined __INTEL_COMPILER+#pragma warning pop+#endif+  +  // Check for overflow:+  Matrix3d M3;+  M3 << 4.4331978442502944e+307, -5.8585363752028680e+307,  6.4527017443412964e+307,+        3.7841695601406358e+307,  2.4331702789740617e+306, -3.5235707140272905e+307,+       -8.7190887618028355e+307, -7.3453213709232193e+307, -2.4367363684472105e+307;++  SVD_DEFAULT(Matrix3d) svd3;+  svd3.compute(M3,ComputeFullU|ComputeFullV); // just check we don't loop indefinitely+  CALL_SUBTEST( svd_check_full(M3,svd3) );+}++// void jacobisvd(const MatrixType& a = MatrixType(), bool pickrandom = true)++template<typename MatrixType>+void svd_all_trivial_2x2( void (*cb)(const MatrixType&,bool) )+{+  MatrixType M;+  VectorXd value_set(3);+  value_set << 0, 1, -1;+  Array4i id(0,0,0,0);+  int k = 0;+  do+  {+    M << value_set(id(0)), value_set(id(1)), value_set(id(2)), value_set(id(3));+    +    cb(M,false);+    +    id(k)++;+    if(id(k)>=value_set.size())+    {+      while(k<3 && id(k)>=value_set.size()) id(++k)++;+      id.head(k).setZero();+      k=0;+    }+    +  } while((id<int(value_set.size())).all());+}++template<typename>+void svd_preallocate()+{+  Vector3f v(3.f, 2.f, 1.f);+  MatrixXf m = v.asDiagonal();++  internal::set_is_malloc_allowed(false);+  VERIFY_RAISES_ASSERT(VectorXf tmp(10);)+  SVD_DEFAULT(MatrixXf) svd;+  internal::set_is_malloc_allowed(true);+  svd.compute(m);+  VERIFY_IS_APPROX(svd.singularValues(), v);++  SVD_DEFAULT(MatrixXf) svd2(3,3);+  internal::set_is_malloc_allowed(false);+  svd2.compute(m);+  internal::set_is_malloc_allowed(true);+  VERIFY_IS_APPROX(svd2.singularValues(), v);+  VERIFY_RAISES_ASSERT(svd2.matrixU());+  VERIFY_RAISES_ASSERT(svd2.matrixV());+  svd2.compute(m, ComputeFullU | ComputeFullV);+  VERIFY_IS_APPROX(svd2.matrixU(), Matrix3f::Identity());+  VERIFY_IS_APPROX(svd2.matrixV(), Matrix3f::Identity());+  internal::set_is_malloc_allowed(false);+  svd2.compute(m);+  internal::set_is_malloc_allowed(true);++  SVD_DEFAULT(MatrixXf) svd3(3,3,ComputeFullU|ComputeFullV);+  internal::set_is_malloc_allowed(false);+  svd2.compute(m);+  internal::set_is_malloc_allowed(true);+  VERIFY_IS_APPROX(svd2.singularValues(), v);+  VERIFY_IS_APPROX(svd2.matrixU(), Matrix3f::Identity());+  VERIFY_IS_APPROX(svd2.matrixV(), Matrix3f::Identity());+  internal::set_is_malloc_allowed(false);+  svd2.compute(m, ComputeFullU|ComputeFullV);+  internal::set_is_malloc_allowed(true);+}++template<typename SvdType,typename MatrixType> +void svd_verify_assert(const MatrixType& m)+{+  typedef typename MatrixType::Scalar Scalar;+  Index rows = m.rows();+  Index cols = m.cols();++  enum {+    RowsAtCompileTime = MatrixType::RowsAtCompileTime,+    ColsAtCompileTime = MatrixType::ColsAtCompileTime+  };++  typedef Matrix<Scalar, RowsAtCompileTime, 1> RhsType;+  RhsType rhs(rows);+  SvdType svd;+  VERIFY_RAISES_ASSERT(svd.matrixU())+  VERIFY_RAISES_ASSERT(svd.singularValues())+  VERIFY_RAISES_ASSERT(svd.matrixV())+  VERIFY_RAISES_ASSERT(svd.solve(rhs))+  MatrixType a = MatrixType::Zero(rows, cols);+  a.setZero();+  svd.compute(a, 0);+  VERIFY_RAISES_ASSERT(svd.matrixU())+  VERIFY_RAISES_ASSERT(svd.matrixV())+  svd.singularValues();+  VERIFY_RAISES_ASSERT(svd.solve(rhs))+    +  if (ColsAtCompileTime == Dynamic)+  {+    svd.compute(a, ComputeThinU);+    svd.matrixU();+    VERIFY_RAISES_ASSERT(svd.matrixV())+    VERIFY_RAISES_ASSERT(svd.solve(rhs))+    svd.compute(a, ComputeThinV);+    svd.matrixV();+    VERIFY_RAISES_ASSERT(svd.matrixU())+    VERIFY_RAISES_ASSERT(svd.solve(rhs))+  }+  else+  {+    VERIFY_RAISES_ASSERT(svd.compute(a, ComputeThinU))+    VERIFY_RAISES_ASSERT(svd.compute(a, ComputeThinV))+  }+}++#undef SVD_DEFAULT+#undef SVD_FOR_MIN_NORM
+ eigen3/test/svd_fill.h view
@@ -0,0 +1,118 @@+// This file is part of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2014-2015 Gael Guennebaud <gael.guennebaud@inria.fr>+//+// 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/.++template<typename T>+Array<T,4,1> four_denorms();++template<>+Array4f four_denorms() { return Array4f(5.60844e-39f, -5.60844e-39f, 4.94e-44f, -4.94e-44f); }+template<>+Array4d four_denorms() { return Array4d(5.60844e-313, -5.60844e-313, 4.94e-324, -4.94e-324); }+template<typename T>+Array<T,4,1> four_denorms() { return four_denorms<double>().cast<T>(); }++template<typename MatrixType>+void svd_fill_random(MatrixType &m, int Option = 0)+{+  using std::pow;+  typedef typename MatrixType::Scalar Scalar;+  typedef typename MatrixType::RealScalar RealScalar;+  Index diagSize = (std::min)(m.rows(), m.cols());+  RealScalar s = std::numeric_limits<RealScalar>::max_exponent10/4;+  s = internal::random<RealScalar>(1,s);+  Matrix<RealScalar,Dynamic,1> d =  Matrix<RealScalar,Dynamic,1>::Random(diagSize);+  for(Index k=0; k<diagSize; ++k)+    d(k) = d(k)*pow(RealScalar(10),internal::random<RealScalar>(-s,s));++  bool dup     = internal::random<int>(0,10) < 3;+  bool unit_uv = internal::random<int>(0,10) < (dup?7:3); // if we duplicate some diagonal entries, then increase the chance to preserve them using unitary U and V factors+  +  // duplicate some singular values+  if(dup)+  {+    Index n = internal::random<Index>(0,d.size()-1);+    for(Index i=0; i<n; ++i)+      d(internal::random<Index>(0,d.size()-1)) = d(internal::random<Index>(0,d.size()-1));+  }+  +  Matrix<Scalar,Dynamic,Dynamic> U(m.rows(),diagSize);+  Matrix<Scalar,Dynamic,Dynamic> VT(diagSize,m.cols());+  if(unit_uv)+  {+    // in very rare cases let's try with a pure diagonal matrix+    if(internal::random<int>(0,10) < 1)+    {+      U.setIdentity();+      VT.setIdentity();+    }+    else+    {+      createRandomPIMatrixOfRank(diagSize,U.rows(), U.cols(), U);+      createRandomPIMatrixOfRank(diagSize,VT.rows(), VT.cols(), VT);+    }+  }+  else+  {+    U.setRandom();+    VT.setRandom();+  }+  +  Matrix<Scalar,Dynamic,1> samples(9);+  samples << 0, four_denorms<RealScalar>(),+            -RealScalar(1)/NumTraits<RealScalar>::highest(), RealScalar(1)/NumTraits<RealScalar>::highest(), (std::numeric_limits<RealScalar>::min)(), pow((std::numeric_limits<RealScalar>::min)(),0.8);+  +  if(Option==Symmetric)+  {+    m = U * d.asDiagonal() * U.transpose();+    +    // randomly nullify some rows/columns+    {+      Index count = internal::random<Index>(-diagSize,diagSize);+      for(Index k=0; k<count; ++k)+      {+        Index i = internal::random<Index>(0,diagSize-1);+        m.row(i).setZero();+        m.col(i).setZero();+      }+      if(count<0)+      // (partly) cancel some coeffs+      if(!(dup && unit_uv))+      {+        +        Index n = internal::random<Index>(0,m.size()-1);+        for(Index k=0; k<n; ++k)+        {+          Index i = internal::random<Index>(0,m.rows()-1);+          Index j = internal::random<Index>(0,m.cols()-1);+          m(j,i) = m(i,j) = samples(internal::random<Index>(0,samples.size()-1));+          if(NumTraits<Scalar>::IsComplex)+            *(&numext::real_ref(m(j,i))+1) = *(&numext::real_ref(m(i,j))+1) = samples.real()(internal::random<Index>(0,samples.size()-1));+        }+      }+    }+  }+  else+  {+    m = U * d.asDiagonal() * VT;+    // (partly) cancel some coeffs+    if(!(dup && unit_uv))+    {+      Index n = internal::random<Index>(0,m.size()-1);+      for(Index k=0; k<n; ++k)+      {+        Index i = internal::random<Index>(0,m.rows()-1);+        Index j = internal::random<Index>(0,m.cols()-1);+        m(i,j) = samples(internal::random<Index>(0,samples.size()-1));+        if(NumTraits<Scalar>::IsComplex)+          *(&numext::real_ref(m(i,j))+1) = samples.real()(internal::random<Index>(0,samples.size()-1));+      }+    }+  }+}+
+ eigen3/test/swap.cpp view
@@ -0,0 +1,94 @@+// This file is part of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2009 Benoit Jacob <jacob.benoit.1@gmail.com>+//+// 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<typename T>+struct other_matrix_type+{+  typedef int type;+};++template<typename _Scalar, int _Rows, int _Cols, int _Options, int _MaxRows, int _MaxCols>+struct other_matrix_type<Matrix<_Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols> >+{+  typedef Matrix<_Scalar, _Rows, _Cols, _Options^RowMajor, _MaxRows, _MaxCols> type;+};++template<typename MatrixType> void swap(const MatrixType& m)+{+  typedef typename other_matrix_type<MatrixType>::type OtherMatrixType;+  typedef typename MatrixType::Scalar Scalar;++  eigen_assert((!internal::is_same<MatrixType,OtherMatrixType>::value));+  typename MatrixType::Index rows = m.rows();+  typename MatrixType::Index cols = m.cols();+  +  // construct 3 matrix guaranteed to be distinct+  MatrixType m1 = MatrixType::Random(rows,cols);+  MatrixType m2 = MatrixType::Random(rows,cols) + Scalar(100) * MatrixType::Identity(rows,cols);+  OtherMatrixType m3 = OtherMatrixType::Random(rows,cols) + Scalar(200) * OtherMatrixType::Identity(rows,cols);+  +  MatrixType m1_copy = m1;+  MatrixType m2_copy = m2;+  OtherMatrixType m3_copy = m3;+  +  // test swapping 2 matrices of same type+  Scalar *d1=m1.data(), *d2=m2.data();+  m1.swap(m2);+  VERIFY_IS_APPROX(m1,m2_copy);+  VERIFY_IS_APPROX(m2,m1_copy);+  if(MatrixType::SizeAtCompileTime==Dynamic)+  {+    VERIFY(m1.data()==d2);+    VERIFY(m2.data()==d1);+  }+  m1 = m1_copy;+  m2 = m2_copy;+  +  // test swapping 2 matrices of different types+  m1.swap(m3);+  VERIFY_IS_APPROX(m1,m3_copy);+  VERIFY_IS_APPROX(m3,m1_copy);+  m1 = m1_copy;+  m3 = m3_copy;+  +  // test swapping matrix with expression+  m1.swap(m2.block(0,0,rows,cols));+  VERIFY_IS_APPROX(m1,m2_copy);+  VERIFY_IS_APPROX(m2,m1_copy);+  m1 = m1_copy;+  m2 = m2_copy;++  // test swapping two expressions of different types+  m1.transpose().swap(m3.transpose());+  VERIFY_IS_APPROX(m1,m3_copy);+  VERIFY_IS_APPROX(m3,m1_copy);+  m1 = m1_copy;+  m3 = m3_copy;+  +  if(m1.rows()>1)+  {+    // test assertion on mismatching size -- matrix case+    VERIFY_RAISES_ASSERT(m1.swap(m1.row(0)));+    // test assertion on mismatching size -- xpr case+    VERIFY_RAISES_ASSERT(m1.row(0).swap(m1));+  }+}++void test_swap()+{+  int s = internal::random<int>(1,EIGEN_TEST_MAX_SIZE);+  CALL_SUBTEST_1( swap(Matrix3f()) ); // fixed size, no vectorization +  CALL_SUBTEST_2( swap(Matrix4d()) ); // fixed size, possible vectorization +  CALL_SUBTEST_3( swap(MatrixXd(s,s)) ); // dyn size, no vectorization +  CALL_SUBTEST_4( swap(MatrixXf(s,s)) ); // dyn size, possible vectorization +  TEST_SET_BUT_UNUSED_VARIABLE(s)+}
+ eigen3/test/triangular.cpp view
@@ -0,0 +1,246 @@+// This file is triangularView of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2008-2009 Gael Guennebaud <gael.guennebaud@inria.fr>+//+// 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<typename MatrixType> void triangular_square(const MatrixType& m)+{+  typedef typename MatrixType::Scalar Scalar;+  typedef typename NumTraits<Scalar>::Real RealScalar;+  typedef Matrix<Scalar, MatrixType::RowsAtCompileTime, 1> VectorType;++  RealScalar largerEps = 10*test_precision<RealScalar>();++  typename MatrixType::Index rows = m.rows();+  typename MatrixType::Index cols = m.cols();++  MatrixType m1 = MatrixType::Random(rows, cols),+             m2 = MatrixType::Random(rows, cols),+             m3(rows, cols),+             m4(rows, cols),+             r1(rows, cols),+             r2(rows, cols);+  VectorType v2 = VectorType::Random(rows);++  MatrixType m1up = m1.template triangularView<Upper>();+  MatrixType m2up = m2.template triangularView<Upper>();++  if (rows*cols>1)+  {+    VERIFY(m1up.isUpperTriangular());+    VERIFY(m2up.transpose().isLowerTriangular());+    VERIFY(!m2.isLowerTriangular());+  }++//   VERIFY_IS_APPROX(m1up.transpose() * m2, m1.upper().transpose().lower() * m2);++  // test overloaded operator+=+  r1.setZero();+  r2.setZero();+  r1.template triangularView<Upper>() +=  m1;+  r2 += m1up;+  VERIFY_IS_APPROX(r1,r2);++  // test overloaded operator=+  m1.setZero();+  m1.template triangularView<Upper>() = m2.transpose() + m2;+  m3 = m2.transpose() + m2;+  VERIFY_IS_APPROX(m3.template triangularView<Lower>().transpose().toDenseMatrix(), m1);++  // test overloaded operator=+  m1.setZero();+  m1.template triangularView<Lower>() = m2.transpose() + m2;+  VERIFY_IS_APPROX(m3.template triangularView<Lower>().toDenseMatrix(), m1);++  VERIFY_IS_APPROX(m3.template triangularView<Lower>().conjugate().toDenseMatrix(),+                   m3.conjugate().template triangularView<Lower>().toDenseMatrix());++  m1 = MatrixType::Random(rows, cols);+  for (int i=0; i<rows; ++i)+    while (numext::abs2(m1(i,i))<RealScalar(1e-1)) m1(i,i) = internal::random<Scalar>();++  Transpose<MatrixType> trm4(m4);+  // test back and forward subsitution with a vector as the rhs+  m3 = m1.template triangularView<Upper>();+  VERIFY(v2.isApprox(m3.adjoint() * (m1.adjoint().template triangularView<Lower>().solve(v2)), largerEps));+  m3 = m1.template triangularView<Lower>();+  VERIFY(v2.isApprox(m3.transpose() * (m1.transpose().template triangularView<Upper>().solve(v2)), largerEps));+  m3 = m1.template triangularView<Upper>();+  VERIFY(v2.isApprox(m3 * (m1.template triangularView<Upper>().solve(v2)), largerEps));+  m3 = m1.template triangularView<Lower>();+  VERIFY(v2.isApprox(m3.conjugate() * (m1.conjugate().template triangularView<Lower>().solve(v2)), largerEps));++  // test back and forward substitution with a matrix as the rhs+  m3 = m1.template triangularView<Upper>();+  VERIFY(m2.isApprox(m3.adjoint() * (m1.adjoint().template triangularView<Lower>().solve(m2)), largerEps));+  m3 = m1.template triangularView<Lower>();+  VERIFY(m2.isApprox(m3.transpose() * (m1.transpose().template triangularView<Upper>().solve(m2)), largerEps));+  m3 = m1.template triangularView<Upper>();+  VERIFY(m2.isApprox(m3 * (m1.template triangularView<Upper>().solve(m2)), largerEps));+  m3 = m1.template triangularView<Lower>();+  VERIFY(m2.isApprox(m3.conjugate() * (m1.conjugate().template triangularView<Lower>().solve(m2)), largerEps));++  // check M * inv(L) using in place API+  m4 = m3;+  m1.transpose().template triangularView<Eigen::Upper>().solveInPlace(trm4);+  VERIFY_IS_APPROX(m4 * m1.template triangularView<Eigen::Lower>(), m3);++  // check M * inv(U) using in place API+  m3 = m1.template triangularView<Upper>();+  m4 = m3;+  m3.transpose().template triangularView<Eigen::Lower>().solveInPlace(trm4);+  VERIFY_IS_APPROX(m4 * m1.template triangularView<Eigen::Upper>(), m3);++  // check solve with unit diagonal+  m3 = m1.template triangularView<UnitUpper>();+  VERIFY(m2.isApprox(m3 * (m1.template triangularView<UnitUpper>().solve(m2)), largerEps));++//   VERIFY((  m1.template triangularView<Upper>()+//           * m2.template triangularView<Upper>()).isUpperTriangular());++  // test swap+  m1.setOnes();+  m2.setZero();+  m2.template triangularView<Upper>().swap(m1);+  m3.setZero();+  m3.template triangularView<Upper>().setOnes();+  VERIFY_IS_APPROX(m2,m3);+  +  m1.setRandom();+  m3 = m1.template triangularView<Upper>();+  Matrix<Scalar, MatrixType::ColsAtCompileTime, Dynamic> m5(cols, internal::random<int>(1,20));  m5.setRandom();+  Matrix<Scalar, Dynamic, MatrixType::RowsAtCompileTime> m6(internal::random<int>(1,20), rows);  m6.setRandom();+  VERIFY_IS_APPROX(m1.template triangularView<Upper>() * m5, m3*m5);+  VERIFY_IS_APPROX(m6*m1.template triangularView<Upper>(), m6*m3);++  m1up = m1.template triangularView<Upper>();+  VERIFY_IS_APPROX(m1.template selfadjointView<Upper>().template triangularView<Upper>().toDenseMatrix(), m1up);+  VERIFY_IS_APPROX(m1up.template selfadjointView<Upper>().template triangularView<Upper>().toDenseMatrix(), m1up);+  VERIFY_IS_APPROX(m1.template selfadjointView<Upper>().template triangularView<Lower>().toDenseMatrix(), m1up.adjoint());+  VERIFY_IS_APPROX(m1up.template selfadjointView<Upper>().template triangularView<Lower>().toDenseMatrix(), m1up.adjoint());++  VERIFY_IS_APPROX(m1.template selfadjointView<Upper>().diagonal(), m1.diagonal());++}+++template<typename MatrixType> void triangular_rect(const MatrixType& m)+{+  typedef typename MatrixType::Scalar Scalar;+  typedef typename NumTraits<Scalar>::Real RealScalar;+  enum { Rows =  MatrixType::RowsAtCompileTime, Cols =  MatrixType::ColsAtCompileTime };++  Index rows = m.rows();+  Index cols = m.cols();++  MatrixType m1 = MatrixType::Random(rows, cols),+             m2 = MatrixType::Random(rows, cols),+             m3(rows, cols),+             m4(rows, cols),+             r1(rows, cols),+             r2(rows, cols);++  MatrixType m1up = m1.template triangularView<Upper>();+  MatrixType m2up = m2.template triangularView<Upper>();++  if (rows>1 && cols>1)+  {+    VERIFY(m1up.isUpperTriangular());+    VERIFY(m2up.transpose().isLowerTriangular());+    VERIFY(!m2.isLowerTriangular());+  }++  // test overloaded operator+=+  r1.setZero();+  r2.setZero();+  r1.template triangularView<Upper>() +=  m1;+  r2 += m1up;+  VERIFY_IS_APPROX(r1,r2);++  // test overloaded operator=+  m1.setZero();+  m1.template triangularView<Upper>() = 3 * m2;+  m3 = 3 * m2;+  VERIFY_IS_APPROX(m3.template triangularView<Upper>().toDenseMatrix(), m1);+++  m1.setZero();+  m1.template triangularView<Lower>() = 3 * m2;+  VERIFY_IS_APPROX(m3.template triangularView<Lower>().toDenseMatrix(), m1);++  m1.setZero();+  m1.template triangularView<StrictlyUpper>() = 3 * m2;+  VERIFY_IS_APPROX(m3.template triangularView<StrictlyUpper>().toDenseMatrix(), m1);+++  m1.setZero();+  m1.template triangularView<StrictlyLower>() = 3 * m2;+  VERIFY_IS_APPROX(m3.template triangularView<StrictlyLower>().toDenseMatrix(), m1);+  m1.setRandom();+  m2 = m1.template triangularView<Upper>();+  VERIFY(m2.isUpperTriangular());+  VERIFY(!m2.isLowerTriangular());+  m2 = m1.template triangularView<StrictlyUpper>();+  VERIFY(m2.isUpperTriangular());+  VERIFY(m2.diagonal().isMuchSmallerThan(RealScalar(1)));+  m2 = m1.template triangularView<UnitUpper>();+  VERIFY(m2.isUpperTriangular());+  m2.diagonal().array() -= Scalar(1);+  VERIFY(m2.diagonal().isMuchSmallerThan(RealScalar(1)));+  m2 = m1.template triangularView<Lower>();+  VERIFY(m2.isLowerTriangular());+  VERIFY(!m2.isUpperTriangular());+  m2 = m1.template triangularView<StrictlyLower>();+  VERIFY(m2.isLowerTriangular());+  VERIFY(m2.diagonal().isMuchSmallerThan(RealScalar(1)));+  m2 = m1.template triangularView<UnitLower>();+  VERIFY(m2.isLowerTriangular());+  m2.diagonal().array() -= Scalar(1);+  VERIFY(m2.diagonal().isMuchSmallerThan(RealScalar(1)));+  // test swap+  m1.setOnes();+  m2.setZero();+  m2.template triangularView<Upper>().swap(m1);+  m3.setZero();+  m3.template triangularView<Upper>().setOnes();+  VERIFY_IS_APPROX(m2,m3);+}++void bug_159()+{+  Matrix3d m = Matrix3d::Random().triangularView<Lower>();+  EIGEN_UNUSED_VARIABLE(m)+}++void test_triangular()+{+  int maxsize = (std::min)(EIGEN_TEST_MAX_SIZE,20);+  for(int i = 0; i < g_repeat ; i++)+  {+    int r = internal::random<int>(2,maxsize); TEST_SET_BUT_UNUSED_VARIABLE(r)+    int c = internal::random<int>(2,maxsize); TEST_SET_BUT_UNUSED_VARIABLE(c)++    CALL_SUBTEST_1( triangular_square(Matrix<float, 1, 1>()) );+    CALL_SUBTEST_2( triangular_square(Matrix<float, 2, 2>()) );+    CALL_SUBTEST_3( triangular_square(Matrix3d()) );+    CALL_SUBTEST_4( triangular_square(Matrix<std::complex<float>,8, 8>()) );+    CALL_SUBTEST_5( triangular_square(MatrixXcd(r,r)) );+    CALL_SUBTEST_6( triangular_square(Matrix<float,Dynamic,Dynamic,RowMajor>(r, r)) );++    CALL_SUBTEST_7( triangular_rect(Matrix<float, 4, 5>()) );+    CALL_SUBTEST_8( triangular_rect(Matrix<double, 6, 2>()) );+    CALL_SUBTEST_9( triangular_rect(MatrixXcf(r, c)) );+    CALL_SUBTEST_5( triangular_rect(MatrixXcd(r, c)) );+    CALL_SUBTEST_6( triangular_rect(Matrix<float,Dynamic,Dynamic,RowMajor>(r, c)) );+  }+  +  CALL_SUBTEST_1( bug_159() );+}
+ eigen3/test/umeyama.cpp view
@@ -0,0 +1,183 @@+// This file is part of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2009 Hauke Heibel <hauke.heibel@gmail.com>+//+// 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 <Eigen/Core>+#include <Eigen/Geometry>++#include <Eigen/LU> // required for MatrixBase::determinant+#include <Eigen/SVD> // required for SVD++using namespace Eigen;++//  Constructs a random matrix from the unitary group U(size).+template <typename T>+Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic> randMatrixUnitary(int size)+{+  typedef T Scalar;+  typedef Eigen::Matrix<Scalar, Eigen::Dynamic, Eigen::Dynamic> MatrixType;++  MatrixType Q;++  int max_tries = 40;+  double is_unitary = false;++  while (!is_unitary && max_tries > 0)+  {+    // initialize random matrix+    Q = MatrixType::Random(size, size);++    // orthogonalize columns using the Gram-Schmidt algorithm+    for (int col = 0; col < size; ++col)+    {+      typename MatrixType::ColXpr colVec = Q.col(col);+      for (int prevCol = 0; prevCol < col; ++prevCol)+      {+        typename MatrixType::ColXpr prevColVec = Q.col(prevCol);+        colVec -= colVec.dot(prevColVec)*prevColVec;+      }+      Q.col(col) = colVec.normalized();+    }++    // this additional orthogonalization is not necessary in theory but should enhance+    // the numerical orthogonality of the matrix+    for (int row = 0; row < size; ++row)+    {+      typename MatrixType::RowXpr rowVec = Q.row(row);+      for (int prevRow = 0; prevRow < row; ++prevRow)+      {+        typename MatrixType::RowXpr prevRowVec = Q.row(prevRow);+        rowVec -= rowVec.dot(prevRowVec)*prevRowVec;+      }+      Q.row(row) = rowVec.normalized();+    }++    // final check+    is_unitary = Q.isUnitary();+    --max_tries;+  }++  if (max_tries == 0)+    eigen_assert(false && "randMatrixUnitary: Could not construct unitary matrix!");++  return Q;+}++//  Constructs a random matrix from the special unitary group SU(size).+template <typename T>+Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic> randMatrixSpecialUnitary(int size)+{+  typedef T Scalar;++  typedef Eigen::Matrix<Scalar, Eigen::Dynamic, Eigen::Dynamic> MatrixType;++  // initialize unitary matrix+  MatrixType Q = randMatrixUnitary<Scalar>(size);++  // tweak the first column to make the determinant be 1+  Q.col(0) *= numext::conj(Q.determinant());++  return Q;+}++template <typename MatrixType>+void run_test(int dim, int num_elements)+{+  using std::abs;+  typedef typename internal::traits<MatrixType>::Scalar Scalar;+  typedef Matrix<Scalar, Eigen::Dynamic, Eigen::Dynamic> MatrixX;+  typedef Matrix<Scalar, Eigen::Dynamic, 1> VectorX;++  // MUST be positive because in any other case det(cR_t) may become negative for+  // odd dimensions!+  const Scalar c = abs(internal::random<Scalar>());++  MatrixX R = randMatrixSpecialUnitary<Scalar>(dim);+  VectorX t = Scalar(50)*VectorX::Random(dim,1);++  MatrixX cR_t = MatrixX::Identity(dim+1,dim+1);+  cR_t.block(0,0,dim,dim) = c*R;+  cR_t.block(0,dim,dim,1) = t;++  MatrixX src = MatrixX::Random(dim+1, num_elements);+  src.row(dim) = Matrix<Scalar, 1, Dynamic>::Constant(num_elements, Scalar(1));++  MatrixX dst = cR_t*src;++  MatrixX cR_t_umeyama = umeyama(src.block(0,0,dim,num_elements), dst.block(0,0,dim,num_elements));++  const Scalar error = ( cR_t_umeyama*src - dst ).norm() / dst.norm();+  VERIFY(error < Scalar(40)*std::numeric_limits<Scalar>::epsilon());+}++template<typename Scalar, int Dimension>+void run_fixed_size_test(int num_elements)+{+  using std::abs;+  typedef Matrix<Scalar, Dimension+1, Dynamic> MatrixX;+  typedef Matrix<Scalar, Dimension+1, Dimension+1> HomMatrix;+  typedef Matrix<Scalar, Dimension, Dimension> FixedMatrix;+  typedef Matrix<Scalar, Dimension, 1> FixedVector;++  const int dim = Dimension;++  // MUST be positive because in any other case det(cR_t) may become negative for+  // odd dimensions!+  // Also if c is to small compared to t.norm(), problem is ill-posed (cf. Bug 744)+  const Scalar c = internal::random<Scalar>(0.5, 2.0);++  FixedMatrix R = randMatrixSpecialUnitary<Scalar>(dim);+  FixedVector t = Scalar(32)*FixedVector::Random(dim,1);++  HomMatrix cR_t = HomMatrix::Identity(dim+1,dim+1);+  cR_t.block(0,0,dim,dim) = c*R;+  cR_t.block(0,dim,dim,1) = t;++  MatrixX src = MatrixX::Random(dim+1, num_elements);+  src.row(dim) = Matrix<Scalar, 1, Dynamic>::Constant(num_elements, Scalar(1));++  MatrixX dst = cR_t*src;++  Block<MatrixX, Dimension, Dynamic> src_block(src,0,0,dim,num_elements);+  Block<MatrixX, Dimension, Dynamic> dst_block(dst,0,0,dim,num_elements);++  HomMatrix cR_t_umeyama = umeyama(src_block, dst_block);++  const Scalar error = ( cR_t_umeyama*src - dst ).squaredNorm();++  VERIFY(error < Scalar(16)*std::numeric_limits<Scalar>::epsilon());+}++void test_umeyama()+{+  for (int i=0; i<g_repeat; ++i)+  {+    const int num_elements = internal::random<int>(40,500);++    // works also for dimensions bigger than 3...+    for (int dim=2; dim<8; ++dim)+    {+      CALL_SUBTEST_1(run_test<MatrixXd>(dim, num_elements));+      CALL_SUBTEST_2(run_test<MatrixXf>(dim, num_elements));+    }++    CALL_SUBTEST_3((run_fixed_size_test<float, 2>(num_elements)));+    CALL_SUBTEST_4((run_fixed_size_test<float, 3>(num_elements)));+    CALL_SUBTEST_5((run_fixed_size_test<float, 4>(num_elements)));++    CALL_SUBTEST_6((run_fixed_size_test<double, 2>(num_elements)));+    CALL_SUBTEST_7((run_fixed_size_test<double, 3>(num_elements)));+    CALL_SUBTEST_8((run_fixed_size_test<double, 4>(num_elements)));+  }++  // Those two calls don't compile and result in meaningful error messages!+  // umeyama(MatrixXcf(),MatrixXcf());+  // umeyama(MatrixXcd(),MatrixXcd());+}
+ eigen3/test/umfpack_support.cpp view
@@ -0,0 +1,32 @@+// This file is part of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2011 Gael Guennebaud <g.gael@free.fr>+//+// 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 <Eigen/UmfPackSupport>++template<typename T> void test_umfpack_support_T()+{+  UmfPackLU<SparseMatrix<T, ColMajor> > umfpack_colmajor;+  UmfPackLU<SparseMatrix<T, RowMajor> > umfpack_rowmajor;+  +  check_sparse_square_solving(umfpack_colmajor);+  check_sparse_square_solving(umfpack_rowmajor);+  +  check_sparse_square_determinant(umfpack_colmajor);+  check_sparse_square_determinant(umfpack_rowmajor);+}++void test_umfpack_support()+{+  CALL_SUBTEST_1(test_umfpack_support_T<double>());+  CALL_SUBTEST_2(test_umfpack_support_T<std::complex<double> >());+}+
+ eigen3/test/unalignedassert.cpp view
@@ -0,0 +1,180 @@+// This file is part of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2008 Benoit Jacob <jacob.benoit.1@gmail.com>+// Copyright (C) 2015 Gael Guennebaud <gael.guennebaud@inria.fr>+//+// 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)+  // default+#elif defined(EIGEN_TEST_PART_2)+  #define EIGEN_MAX_STATIC_ALIGN_BYTES 16+  #define EIGEN_MAX_ALIGN_BYTES 16+#elif defined(EIGEN_TEST_PART_3)+  #define EIGEN_MAX_STATIC_ALIGN_BYTES 32+  #define EIGEN_MAX_ALIGN_BYTES 32+#elif defined(EIGEN_TEST_PART_4)+  #define EIGEN_MAX_STATIC_ALIGN_BYTES 64+  #define EIGEN_MAX_ALIGN_BYTES 64+#endif++#include "main.h"++typedef Matrix<float,  6,1> Vector6f;+typedef Matrix<float,  8,1> Vector8f;+typedef Matrix<float, 12,1> Vector12f;++typedef Matrix<double, 5,1> Vector5d;+typedef Matrix<double, 6,1> Vector6d;+typedef Matrix<double, 7,1> Vector7d;+typedef Matrix<double, 8,1> Vector8d;+typedef Matrix<double, 9,1> Vector9d;+typedef Matrix<double,10,1> Vector10d;+typedef Matrix<double,12,1> Vector12d;++struct TestNew1+{+  MatrixXd m; // good: m will allocate its own array, taking care of alignment.+  TestNew1() : m(20,20) {}+};++struct TestNew2+{+  Matrix3d m; // good: m's size isn't a multiple of 16 bytes, so m doesn't have to be 16-byte aligned,+              // 8-byte alignment is good enough here, which we'll get automatically+};++struct TestNew3+{+  Vector2f m; // good: m's size isn't a multiple of 16 bytes, so m doesn't have to be 16-byte aligned+};++struct TestNew4+{+  EIGEN_MAKE_ALIGNED_OPERATOR_NEW+  Vector2d m;+  float f; // make the struct have sizeof%16!=0 to make it a little more tricky when we allow an array of 2 such objects+};++struct TestNew5+{+  EIGEN_MAKE_ALIGNED_OPERATOR_NEW+  float f; // try the f at first -- the EIGEN_ALIGN_MAX attribute of m should make that still work+  Matrix4f m;+};++struct TestNew6+{+  Matrix<float,2,2,DontAlign> m; // good: no alignment requested+  float f;+};++template<bool Align> struct Depends+{+  EIGEN_MAKE_ALIGNED_OPERATOR_NEW_IF(Align)+  Vector2d m;+  float f;+};++template<typename T>+void check_unalignedassert_good()+{+  T *x, *y;+  x = new T;+  delete x;+  y = new T[2];+  delete[] y;+}++#if EIGEN_MAX_STATIC_ALIGN_BYTES>0+template<typename T>+void construct_at_boundary(int boundary)+{+  char buf[sizeof(T)+256];+  size_t _buf = reinterpret_cast<internal::UIntPtr>(buf);+  _buf += (EIGEN_MAX_ALIGN_BYTES - (_buf % EIGEN_MAX_ALIGN_BYTES)); // make 16/32/...-byte aligned+  _buf += boundary; // make exact boundary-aligned+  T *x = ::new(reinterpret_cast<void*>(_buf)) T;+  x[0].setZero(); // just in order to silence warnings+  x->~T();+}+#endif++void unalignedassert()+{+#if EIGEN_MAX_STATIC_ALIGN_BYTES>0+  construct_at_boundary<Vector2f>(4);+  construct_at_boundary<Vector3f>(4);+  construct_at_boundary<Vector4f>(16);+  construct_at_boundary<Vector6f>(4);+  construct_at_boundary<Vector8f>(EIGEN_MAX_ALIGN_BYTES);+  construct_at_boundary<Vector12f>(16);+  construct_at_boundary<Matrix2f>(16);+  construct_at_boundary<Matrix3f>(4);+  construct_at_boundary<Matrix4f>(EIGEN_MAX_ALIGN_BYTES);++  construct_at_boundary<Vector2d>(16);+  construct_at_boundary<Vector3d>(4);+  construct_at_boundary<Vector4d>(EIGEN_MAX_ALIGN_BYTES);+  construct_at_boundary<Vector5d>(4);+  construct_at_boundary<Vector6d>(16);+  construct_at_boundary<Vector7d>(4);+  construct_at_boundary<Vector8d>(EIGEN_MAX_ALIGN_BYTES);+  construct_at_boundary<Vector9d>(4);+  construct_at_boundary<Vector10d>(16);+  construct_at_boundary<Vector12d>(EIGEN_MAX_ALIGN_BYTES);+  construct_at_boundary<Matrix2d>(EIGEN_MAX_ALIGN_BYTES);+  construct_at_boundary<Matrix3d>(4);+  construct_at_boundary<Matrix4d>(EIGEN_MAX_ALIGN_BYTES);++  construct_at_boundary<Vector2cf>(16);+  construct_at_boundary<Vector3cf>(4);+  construct_at_boundary<Vector2cd>(EIGEN_MAX_ALIGN_BYTES);+  construct_at_boundary<Vector3cd>(16);+#endif++  check_unalignedassert_good<TestNew1>();+  check_unalignedassert_good<TestNew2>();+  check_unalignedassert_good<TestNew3>();++  check_unalignedassert_good<TestNew4>();+  check_unalignedassert_good<TestNew5>();+  check_unalignedassert_good<TestNew6>();+  check_unalignedassert_good<Depends<true> >();++#if EIGEN_MAX_STATIC_ALIGN_BYTES>0+  if(EIGEN_MAX_ALIGN_BYTES>=16)+  {+    VERIFY_RAISES_ASSERT(construct_at_boundary<Vector4f>(8));+    VERIFY_RAISES_ASSERT(construct_at_boundary<Vector8f>(8));+    VERIFY_RAISES_ASSERT(construct_at_boundary<Vector12f>(8));+    VERIFY_RAISES_ASSERT(construct_at_boundary<Vector2d>(8));+    VERIFY_RAISES_ASSERT(construct_at_boundary<Vector4d>(8));+    VERIFY_RAISES_ASSERT(construct_at_boundary<Vector6d>(8));+    VERIFY_RAISES_ASSERT(construct_at_boundary<Vector8d>(8));+    VERIFY_RAISES_ASSERT(construct_at_boundary<Vector10d>(8));+    VERIFY_RAISES_ASSERT(construct_at_boundary<Vector12d>(8));+    // Complexes are disabled because the compiler might aggressively vectorize+    // the initialization of complex coeffs to 0 before we can check for alignedness+    //VERIFY_RAISES_ASSERT(construct_at_boundary<Vector2cf>(8));+    VERIFY_RAISES_ASSERT(construct_at_boundary<Vector4i>(8));+  }+  for(int b=8; b<EIGEN_MAX_ALIGN_BYTES; b+=8)+  {+    if(b<32)  VERIFY_RAISES_ASSERT(construct_at_boundary<Vector8f>(b));+    if(b<64)  VERIFY_RAISES_ASSERT(construct_at_boundary<Matrix4f>(b));+    if(b<32)  VERIFY_RAISES_ASSERT(construct_at_boundary<Vector4d>(b));+    if(b<32)  VERIFY_RAISES_ASSERT(construct_at_boundary<Matrix2d>(b));+    if(b<128) VERIFY_RAISES_ASSERT(construct_at_boundary<Matrix4d>(b));+    //if(b<32)  VERIFY_RAISES_ASSERT(construct_at_boundary<Vector2cd>(b));+  }+#endif+}++void test_unalignedassert()+{+  CALL_SUBTEST(unalignedassert());+}
+ eigen3/test/unalignedcount.cpp view
@@ -0,0 +1,53 @@+// This file is part of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2009 Gael Guennebaud <gael.guennebaud@inria.fr>+//+// 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 int nb_load;+static int nb_loadu;+static int nb_store;+static int nb_storeu;++#define EIGEN_DEBUG_ALIGNED_LOAD    { nb_load++;    }+#define EIGEN_DEBUG_UNALIGNED_LOAD  { nb_loadu++;   }+#define EIGEN_DEBUG_ALIGNED_STORE   { nb_store++;   }+#define EIGEN_DEBUG_UNALIGNED_STORE { nb_storeu++;  }++#define VERIFY_ALIGNED_UNALIGNED_COUNT(XPR,AL,UL,AS,US) {\+    nb_load = nb_loadu = nb_store = nb_storeu = 0; \+    XPR; \+    if(!(nb_load==AL && nb_loadu==UL && nb_store==AS && nb_storeu==US)) \+      std::cerr << " >> " << nb_load << ", " << nb_loadu << ", " << nb_store << ", " << nb_storeu << "\n"; \+    VERIFY( (#XPR) && nb_load==AL && nb_loadu==UL && nb_store==AS && nb_storeu==US ); \+  }+++#include "main.h"++void test_unalignedcount()+{+  #if defined(EIGEN_VECTORIZE_AVX)+  VectorXf a(40), b(40);+  VERIFY_ALIGNED_UNALIGNED_COUNT(a += b, 10, 0, 5, 0);+  VERIFY_ALIGNED_UNALIGNED_COUNT(a.segment(0,40) += b.segment(0,40), 5, 5, 5, 0);+  VERIFY_ALIGNED_UNALIGNED_COUNT(a.segment(0,40) -= b.segment(0,40), 5, 5, 5, 0);+  VERIFY_ALIGNED_UNALIGNED_COUNT(a.segment(0,40) *= 3.5, 5, 0, 5, 0);+  VERIFY_ALIGNED_UNALIGNED_COUNT(a.segment(0,40) /= 3.5, 5, 0, 5, 0);+  #elif defined(EIGEN_VECTORIZE_SSE)+  VectorXf a(40), b(40);+  VERIFY_ALIGNED_UNALIGNED_COUNT(a += b, 20, 0, 10, 0);+  VERIFY_ALIGNED_UNALIGNED_COUNT(a.segment(0,40) += b.segment(0,40), 10, 10, 10, 0);+  VERIFY_ALIGNED_UNALIGNED_COUNT(a.segment(0,40) -= b.segment(0,40), 10, 10, 10, 0);+  VERIFY_ALIGNED_UNALIGNED_COUNT(a.segment(0,40) *= 3.5, 10, 0, 10, 0);+  VERIFY_ALIGNED_UNALIGNED_COUNT(a.segment(0,40) /= 3.5, 10, 0, 10, 0);+  #else+  // The following line is to eliminate "variable not used" warnings+  nb_load = nb_loadu = nb_store = nb_storeu = 0;+  int a(0), b(0);+  VERIFY(a==b);+  #endif+}
+ eigen3/test/upperbidiagonalization.cpp view
@@ -0,0 +1,43 @@+// This file is part of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2010 Benoit Jacob <jacob.benoit.1@gmail.com>+//+// 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 <Eigen/SVD>++template<typename MatrixType> void upperbidiag(const MatrixType& m)+{+  const typename MatrixType::Index rows = m.rows();+  const typename MatrixType::Index cols = m.cols();++  typedef Matrix<typename MatrixType::RealScalar, MatrixType::RowsAtCompileTime,  MatrixType::ColsAtCompileTime> RealMatrixType;+  typedef Matrix<typename MatrixType::Scalar, MatrixType::ColsAtCompileTime,  MatrixType::RowsAtCompileTime> TransposeMatrixType;++  MatrixType a = MatrixType::Random(rows,cols);+  internal::UpperBidiagonalization<MatrixType> ubd(a);+  RealMatrixType b(rows, cols);+  b.setZero();+  b.block(0,0,cols,cols) = ubd.bidiagonal();+  MatrixType c = ubd.householderU() * b * ubd.householderV().adjoint();+  VERIFY_IS_APPROX(a,c);+  TransposeMatrixType d = ubd.householderV() * b.adjoint() * ubd.householderU().adjoint();+  VERIFY_IS_APPROX(a.adjoint(),d);+}++void test_upperbidiagonalization()+{+  for(int i = 0; i < g_repeat; i++) {+   CALL_SUBTEST_1( upperbidiag(MatrixXf(3,3)) );+   CALL_SUBTEST_2( upperbidiag(MatrixXd(17,12)) );+   CALL_SUBTEST_3( upperbidiag(MatrixXcf(20,20)) );+   CALL_SUBTEST_4( upperbidiag(Matrix<std::complex<double>,Dynamic,Dynamic,RowMajor>(16,15)) );+   CALL_SUBTEST_5( upperbidiag(Matrix<float,6,4>()) );+   CALL_SUBTEST_6( upperbidiag(Matrix<float,5,5>()) );+   CALL_SUBTEST_7( upperbidiag(Matrix<double,4,3>()) );+  }+}
+ eigen3/test/vectorization_logic.cpp view
@@ -0,0 +1,425 @@+// This file is part of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2015 Gael Guennebaud <gael.guennebaud@inria.fr>+//+// 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_1+#define EIGEN_UNALIGNED_VECTORIZE 1+#endif++#ifdef EIGEN_TEST_PART_2+#define EIGEN_UNALIGNED_VECTORIZE 0+#endif++#ifdef EIGEN_DEFAULT_TO_ROW_MAJOR+#undef EIGEN_DEFAULT_TO_ROW_MAJOR+#endif+#define EIGEN_DEBUG_ASSIGN+#include "main.h"+#include <typeinfo>++using internal::demangle_flags;+using internal::demangle_traversal;+using internal::demangle_unrolling;++template<typename Dst, typename Src>+bool test_assign(const Dst&, const Src&, int traversal, int unrolling)+{+  typedef internal::copy_using_evaluator_traits<internal::evaluator<Dst>,internal::evaluator<Src>, internal::assign_op<typename Dst::Scalar,typename Src::Scalar> > traits;+  bool res = traits::Traversal==traversal;+  if(unrolling==InnerUnrolling+CompleteUnrolling)+    res = res && (int(traits::Unrolling)==InnerUnrolling || int(traits::Unrolling)==CompleteUnrolling);+  else+    res = res && int(traits::Unrolling)==unrolling;+  if(!res)+  {+    std::cerr << "Src: " << demangle_flags(Src::Flags) << std::endl;+    std::cerr << "     " << demangle_flags(internal::evaluator<Src>::Flags) << std::endl;+    std::cerr << "Dst: " << demangle_flags(Dst::Flags) << std::endl;+    std::cerr << "     " << demangle_flags(internal::evaluator<Dst>::Flags) << std::endl;+    traits::debug();+    std::cerr << " Expected Traversal == " << demangle_traversal(traversal)+              << " got " << demangle_traversal(traits::Traversal) << "\n";+    std::cerr << " Expected Unrolling == " << demangle_unrolling(unrolling)+              << " got " << demangle_unrolling(traits::Unrolling) << "\n";+  }+  return res;+}++template<typename Dst, typename Src>+bool test_assign(int traversal, int unrolling)+{+  typedef internal::copy_using_evaluator_traits<internal::evaluator<Dst>,internal::evaluator<Src>, internal::assign_op<typename Dst::Scalar,typename Src::Scalar> > traits;+  bool res = traits::Traversal==traversal && traits::Unrolling==unrolling;+  if(!res)+  {+    std::cerr << "Src: " << demangle_flags(Src::Flags) << std::endl;+    std::cerr << "     " << demangle_flags(internal::evaluator<Src>::Flags) << std::endl;+    std::cerr << "Dst: " << demangle_flags(Dst::Flags) << std::endl;+    std::cerr << "     " << demangle_flags(internal::evaluator<Dst>::Flags) << std::endl;+    traits::debug();+    std::cerr << " Expected Traversal == " << demangle_traversal(traversal)+              << " got " << demangle_traversal(traits::Traversal) << "\n";+    std::cerr << " Expected Unrolling == " << demangle_unrolling(unrolling)+              << " got " << demangle_unrolling(traits::Unrolling) << "\n";+  }+  return res;+}++template<typename Xpr>+bool test_redux(const Xpr&, int traversal, int unrolling)+{+  typedef typename Xpr::Scalar Scalar;+  typedef internal::redux_traits<internal::scalar_sum_op<Scalar,Scalar>,internal::redux_evaluator<Xpr> > traits;+  +  bool res = traits::Traversal==traversal && traits::Unrolling==unrolling;+  if(!res)+  {+    std::cerr << demangle_flags(Xpr::Flags) << std::endl;+    std::cerr << demangle_flags(internal::evaluator<Xpr>::Flags) << std::endl;+    traits::debug();+    +    std::cerr << " Expected Traversal == " << demangle_traversal(traversal)+              << " got " << demangle_traversal(traits::Traversal) << "\n";+    std::cerr << " Expected Unrolling == " << demangle_unrolling(unrolling)+              << " got " << demangle_unrolling(traits::Unrolling) << "\n";+  }+  return res;+}++template<typename Scalar, bool Enable = internal::packet_traits<Scalar>::Vectorizable>+struct vectorization_logic+{+  typedef internal::packet_traits<Scalar> PacketTraits;+  +  typedef typename internal::packet_traits<Scalar>::type PacketType;+  typedef typename internal::unpacket_traits<PacketType>::half HalfPacketType;+  enum {+    PacketSize = internal::unpacket_traits<PacketType>::size,+    HalfPacketSize = internal::unpacket_traits<HalfPacketType>::size+  };+  static void run()+  {+    +    typedef Matrix<Scalar,PacketSize,1> Vector1;+    typedef Matrix<Scalar,Dynamic,1> VectorX;+    typedef Matrix<Scalar,Dynamic,Dynamic> MatrixXX;+    typedef Matrix<Scalar,PacketSize,PacketSize> Matrix11;+    typedef Matrix<Scalar,2*PacketSize,2*PacketSize> Matrix22;+    typedef Matrix<Scalar,(Matrix11::Flags&RowMajorBit)?16:4*PacketSize,(Matrix11::Flags&RowMajorBit)?4*PacketSize:16> Matrix44;+    typedef Matrix<Scalar,(Matrix11::Flags&RowMajorBit)?16:4*PacketSize,(Matrix11::Flags&RowMajorBit)?4*PacketSize:16,DontAlign|EIGEN_DEFAULT_MATRIX_STORAGE_ORDER_OPTION> Matrix44u;+    typedef Matrix<Scalar,4*PacketSize,4*PacketSize,ColMajor> Matrix44c;+    typedef Matrix<Scalar,4*PacketSize,4*PacketSize,RowMajor> Matrix44r;++    typedef Matrix<Scalar,+        (PacketSize==8 ? 4 : PacketSize==4 ? 2 : PacketSize==2 ? 1 : /*PacketSize==1 ?*/ 1),+        (PacketSize==8 ? 2 : PacketSize==4 ? 2 : PacketSize==2 ? 2 : /*PacketSize==1 ?*/ 1)+      > Matrix1;++    typedef Matrix<Scalar,+        (PacketSize==8 ? 4 : PacketSize==4 ? 2 : PacketSize==2 ? 1 : /*PacketSize==1 ?*/ 1),+        (PacketSize==8 ? 2 : PacketSize==4 ? 2 : PacketSize==2 ? 2 : /*PacketSize==1 ?*/ 1),+      DontAlign|((Matrix1::Flags&RowMajorBit)?RowMajor:ColMajor)> Matrix1u;++    // this type is made such that it can only be vectorized when viewed as a linear 1D vector+    typedef Matrix<Scalar,+        (PacketSize==8 ? 4 : PacketSize==4 ? 6 : PacketSize==2 ? ((Matrix11::Flags&RowMajorBit)?2:3) : /*PacketSize==1 ?*/ 1),+        (PacketSize==8 ? 6 : PacketSize==4 ? 2 : PacketSize==2 ? ((Matrix11::Flags&RowMajorBit)?3:2) : /*PacketSize==1 ?*/ 3)+      > Matrix3;+    +    #if !EIGEN_GCC_AND_ARCH_DOESNT_WANT_STACK_ALIGNMENT+    VERIFY(test_assign(Vector1(),Vector1(),+      InnerVectorizedTraversal,CompleteUnrolling));+    VERIFY(test_assign(Vector1(),Vector1()+Vector1(),+      InnerVectorizedTraversal,CompleteUnrolling));+    VERIFY(test_assign(Vector1(),Vector1().cwiseProduct(Vector1()),+      InnerVectorizedTraversal,CompleteUnrolling));+    VERIFY(test_assign(Vector1(),Vector1().template cast<Scalar>(),+      InnerVectorizedTraversal,CompleteUnrolling));+++    VERIFY(test_assign(Vector1(),Vector1(),+      InnerVectorizedTraversal,CompleteUnrolling));+    VERIFY(test_assign(Vector1(),Vector1()+Vector1(),+      InnerVectorizedTraversal,CompleteUnrolling));+    VERIFY(test_assign(Vector1(),Vector1().cwiseProduct(Vector1()),+      InnerVectorizedTraversal,CompleteUnrolling));++    VERIFY(test_assign(Matrix44(),Matrix44()+Matrix44(),+      InnerVectorizedTraversal,InnerUnrolling));++    VERIFY(test_assign(Matrix44u(),Matrix44()+Matrix44(),+      EIGEN_UNALIGNED_VECTORIZE ? InnerVectorizedTraversal : LinearTraversal,+      EIGEN_UNALIGNED_VECTORIZE ? InnerUnrolling : NoUnrolling));++    VERIFY(test_assign(Matrix1(),Matrix1()+Matrix1(),+      (Matrix1::InnerSizeAtCompileTime % PacketSize)==0 ? InnerVectorizedTraversal : LinearVectorizedTraversal,+      CompleteUnrolling));++    VERIFY(test_assign(Matrix1u(),Matrix1()+Matrix1(),+      EIGEN_UNALIGNED_VECTORIZE ? ((Matrix1::InnerSizeAtCompileTime % PacketSize)==0 ? InnerVectorizedTraversal : LinearVectorizedTraversal)+                                : LinearTraversal, CompleteUnrolling));++    VERIFY(test_assign(Matrix44c().col(1),Matrix44c().col(2)+Matrix44c().col(3),+      InnerVectorizedTraversal,CompleteUnrolling));++    VERIFY(test_assign(Matrix44r().row(2),Matrix44r().row(1)+Matrix44r().row(1),+      InnerVectorizedTraversal,CompleteUnrolling));++    if(PacketSize>1)+    {+      typedef Matrix<Scalar,3,3,ColMajor> Matrix33c;+      typedef Matrix<Scalar,3,1,ColMajor> Vector3;+      VERIFY(test_assign(Matrix33c().row(2),Matrix33c().row(1)+Matrix33c().row(1),+        LinearTraversal,CompleteUnrolling));+      VERIFY(test_assign(Vector3(),Vector3()+Vector3(),+        EIGEN_UNALIGNED_VECTORIZE ? (HalfPacketSize==1 ? InnerVectorizedTraversal : LinearVectorizedTraversal) : (HalfPacketSize==1 ? InnerVectorizedTraversal : LinearTraversal), CompleteUnrolling));+      VERIFY(test_assign(Matrix33c().col(0),Matrix33c().col(1)+Matrix33c().col(1),+        EIGEN_UNALIGNED_VECTORIZE ? (HalfPacketSize==1 ? InnerVectorizedTraversal : LinearVectorizedTraversal) : (HalfPacketSize==1 ? SliceVectorizedTraversal : LinearTraversal),+        ((!EIGEN_UNALIGNED_VECTORIZE) && HalfPacketSize==1) ? NoUnrolling : CompleteUnrolling));++      VERIFY(test_assign(Matrix3(),Matrix3().cwiseProduct(Matrix3()),+        LinearVectorizedTraversal,CompleteUnrolling));++      VERIFY(test_assign(Matrix<Scalar,17,17>(),Matrix<Scalar,17,17>()+Matrix<Scalar,17,17>(),+        HalfPacketSize==1             ? InnerVectorizedTraversal  :+        EIGEN_UNALIGNED_VECTORIZE ? LinearVectorizedTraversal :+                                        LinearTraversal,+        NoUnrolling));++      VERIFY(test_assign(Matrix11(), Matrix11()+Matrix11(),InnerVectorizedTraversal,CompleteUnrolling));+++      VERIFY(test_assign(Matrix11(),Matrix<Scalar,17,17>().template block<PacketSize,PacketSize>(2,3)+Matrix<Scalar,17,17>().template block<PacketSize,PacketSize>(8,4),+        (EIGEN_UNALIGNED_VECTORIZE) ? InnerVectorizedTraversal : DefaultTraversal, CompleteUnrolling|InnerUnrolling));++      VERIFY(test_assign(Vector1(),Matrix11()*Vector1(),+                         InnerVectorizedTraversal,CompleteUnrolling));++      VERIFY(test_assign(Matrix11(),Matrix11().lazyProduct(Matrix11()),+                         InnerVectorizedTraversal,InnerUnrolling+CompleteUnrolling));+    }++    VERIFY(test_redux(Vector1(),+      LinearVectorizedTraversal,CompleteUnrolling));++    VERIFY(test_redux(Vector1().array()*Vector1().array(),+      LinearVectorizedTraversal,CompleteUnrolling));++    VERIFY(test_redux((Vector1().array()*Vector1().array()).col(0),+      LinearVectorizedTraversal,CompleteUnrolling));++    VERIFY(test_redux(Matrix<Scalar,PacketSize,3>(),+      LinearVectorizedTraversal,CompleteUnrolling));++    VERIFY(test_redux(Matrix3(),+      LinearVectorizedTraversal,CompleteUnrolling));++    VERIFY(test_redux(Matrix44(),+      LinearVectorizedTraversal,NoUnrolling));++    VERIFY(test_redux(Matrix44().template block<(Matrix1::Flags&RowMajorBit)?4:PacketSize,(Matrix1::Flags&RowMajorBit)?PacketSize:4>(1,2),+      DefaultTraversal,CompleteUnrolling));++    VERIFY(test_redux(Matrix44c().template block<2*PacketSize,1>(1,2),+      LinearVectorizedTraversal,CompleteUnrolling));++    VERIFY(test_redux(Matrix44r().template block<1,2*PacketSize>(2,1),+      LinearVectorizedTraversal,CompleteUnrolling));++    VERIFY((test_assign<+            Map<Matrix22, AlignedMax, OuterStride<3*PacketSize> >,+            Matrix22+            >(InnerVectorizedTraversal,CompleteUnrolling)));++    VERIFY((test_assign<+            Map<Matrix<Scalar,EIGEN_PLAIN_ENUM_MAX(2,PacketSize),EIGEN_PLAIN_ENUM_MAX(2,PacketSize)>, AlignedMax, InnerStride<3*PacketSize> >,+            Matrix<Scalar,EIGEN_PLAIN_ENUM_MAX(2,PacketSize),EIGEN_PLAIN_ENUM_MAX(2,PacketSize)>+            >(DefaultTraversal,PacketSize>=8?InnerUnrolling:CompleteUnrolling)));++    VERIFY((test_assign(Matrix11(), Matrix<Scalar,PacketSize,EIGEN_PLAIN_ENUM_MIN(2,PacketSize)>()*Matrix<Scalar,EIGEN_PLAIN_ENUM_MIN(2,PacketSize),PacketSize>(),+                        InnerVectorizedTraversal, CompleteUnrolling)));+    #endif++    VERIFY(test_assign(MatrixXX(10,10),MatrixXX(20,20).block(10,10,2,3),+      SliceVectorizedTraversal,NoUnrolling));++    VERIFY(test_redux(VectorX(10),+      LinearVectorizedTraversal,NoUnrolling));+  }+};++template<typename Scalar> struct vectorization_logic<Scalar,false>+{+  static void run() {}+};++template<typename Scalar, bool Enable = !internal::is_same<typename internal::unpacket_traits<typename internal::packet_traits<Scalar>::type>::half,+                                                           typename internal::packet_traits<Scalar>::type>::value >+struct vectorization_logic_half+{+  typedef internal::packet_traits<Scalar> PacketTraits;+  typedef typename internal::unpacket_traits<typename internal::packet_traits<Scalar>::type>::half PacketType;+  enum {+    PacketSize = internal::unpacket_traits<PacketType>::size+  };+  static void run()+  {+    +    typedef Matrix<Scalar,PacketSize,1> Vector1;+    typedef Matrix<Scalar,PacketSize,PacketSize> Matrix11;+    typedef Matrix<Scalar,5*PacketSize,7,ColMajor> Matrix57;+    typedef Matrix<Scalar,3*PacketSize,5,ColMajor> Matrix35;+    typedef Matrix<Scalar,5*PacketSize,7,DontAlign|ColMajor> Matrix57u;+//     typedef Matrix<Scalar,(Matrix11::Flags&RowMajorBit)?16:4*PacketSize,(Matrix11::Flags&RowMajorBit)?4*PacketSize:16> Matrix44;+//     typedef Matrix<Scalar,(Matrix11::Flags&RowMajorBit)?16:4*PacketSize,(Matrix11::Flags&RowMajorBit)?4*PacketSize:16,DontAlign|EIGEN_DEFAULT_MATRIX_STORAGE_ORDER_OPTION> Matrix44u;+//     typedef Matrix<Scalar,4*PacketSize,4*PacketSize,ColMajor> Matrix44c;+//     typedef Matrix<Scalar,4*PacketSize,4*PacketSize,RowMajor> Matrix44r;++    typedef Matrix<Scalar,+        (PacketSize==8 ? 4 : PacketSize==4 ? 2 : PacketSize==2 ? 1 : /*PacketSize==1 ?*/ 1),+        (PacketSize==8 ? 2 : PacketSize==4 ? 2 : PacketSize==2 ? 2 : /*PacketSize==1 ?*/ 1)+      > Matrix1;++    typedef Matrix<Scalar,+        (PacketSize==8 ? 4 : PacketSize==4 ? 2 : PacketSize==2 ? 1 : /*PacketSize==1 ?*/ 1),+        (PacketSize==8 ? 2 : PacketSize==4 ? 2 : PacketSize==2 ? 2 : /*PacketSize==1 ?*/ 1),+      DontAlign|((Matrix1::Flags&RowMajorBit)?RowMajor:ColMajor)> Matrix1u;++    // this type is made such that it can only be vectorized when viewed as a linear 1D vector+    typedef Matrix<Scalar,+        (PacketSize==8 ? 4 : PacketSize==4 ? 6 : PacketSize==2 ? ((Matrix11::Flags&RowMajorBit)?2:3) : /*PacketSize==1 ?*/ 1),+        (PacketSize==8 ? 6 : PacketSize==4 ? 2 : PacketSize==2 ? ((Matrix11::Flags&RowMajorBit)?3:2) : /*PacketSize==1 ?*/ 3)+      > Matrix3;+    +    #if !EIGEN_GCC_AND_ARCH_DOESNT_WANT_STACK_ALIGNMENT+    VERIFY(test_assign(Vector1(),Vector1(),+      InnerVectorizedTraversal,CompleteUnrolling));+    VERIFY(test_assign(Vector1(),Vector1()+Vector1(),+      InnerVectorizedTraversal,CompleteUnrolling));+    VERIFY(test_assign(Vector1(),Vector1().template segment<PacketSize>(0).derived(),+      EIGEN_UNALIGNED_VECTORIZE ? InnerVectorizedTraversal : LinearVectorizedTraversal,CompleteUnrolling));+    VERIFY(test_assign(Vector1(),Scalar(2.1)*Vector1()-Vector1(),+      InnerVectorizedTraversal,CompleteUnrolling));+    VERIFY(test_assign(Vector1(),(Scalar(2.1)*Vector1().template segment<PacketSize>(0)-Vector1().template segment<PacketSize>(0)).derived(),+      EIGEN_UNALIGNED_VECTORIZE ? InnerVectorizedTraversal : LinearVectorizedTraversal,CompleteUnrolling));+    VERIFY(test_assign(Vector1(),Vector1().cwiseProduct(Vector1()),+      InnerVectorizedTraversal,CompleteUnrolling));+    VERIFY(test_assign(Vector1(),Vector1().template cast<Scalar>(),+      InnerVectorizedTraversal,CompleteUnrolling));+++    VERIFY(test_assign(Vector1(),Vector1(),+      InnerVectorizedTraversal,CompleteUnrolling));+    VERIFY(test_assign(Vector1(),Vector1()+Vector1(),+      InnerVectorizedTraversal,CompleteUnrolling));+    VERIFY(test_assign(Vector1(),Vector1().cwiseProduct(Vector1()),+      InnerVectorizedTraversal,CompleteUnrolling));++    VERIFY(test_assign(Matrix57(),Matrix57()+Matrix57(),+      InnerVectorizedTraversal,InnerUnrolling));++    VERIFY(test_assign(Matrix57u(),Matrix57()+Matrix57(),+      EIGEN_UNALIGNED_VECTORIZE ? InnerVectorizedTraversal : LinearTraversal,+      EIGEN_UNALIGNED_VECTORIZE ? InnerUnrolling : NoUnrolling));++    VERIFY(test_assign(Matrix1u(),Matrix1()+Matrix1(),+      EIGEN_UNALIGNED_VECTORIZE ? ((Matrix1::InnerSizeAtCompileTime % PacketSize)==0 ? InnerVectorizedTraversal : LinearVectorizedTraversal) : LinearTraversal,CompleteUnrolling));+        +    if(PacketSize>1)+    {+      typedef Matrix<Scalar,3,3,ColMajor> Matrix33c;+      VERIFY(test_assign(Matrix33c().row(2),Matrix33c().row(1)+Matrix33c().row(1),+        LinearTraversal,CompleteUnrolling));+      VERIFY(test_assign(Matrix33c().col(0),Matrix33c().col(1)+Matrix33c().col(1),+        EIGEN_UNALIGNED_VECTORIZE ? (PacketSize==1 ? InnerVectorizedTraversal : LinearVectorizedTraversal) : LinearTraversal,CompleteUnrolling));+              +      VERIFY(test_assign(Matrix3(),Matrix3().cwiseQuotient(Matrix3()),+        PacketTraits::HasDiv ? LinearVectorizedTraversal : LinearTraversal,CompleteUnrolling));+        +      VERIFY(test_assign(Matrix<Scalar,17,17>(),Matrix<Scalar,17,17>()+Matrix<Scalar,17,17>(),+        EIGEN_UNALIGNED_VECTORIZE ? (PacketSize==1 ? InnerVectorizedTraversal : LinearVectorizedTraversal) : LinearTraversal,+        NoUnrolling));+        +      VERIFY(test_assign(Matrix11(),Matrix<Scalar,17,17>().template block<PacketSize,PacketSize>(2,3)+Matrix<Scalar,17,17>().template block<PacketSize,PacketSize>(8,4),+        EIGEN_UNALIGNED_VECTORIZE ? InnerVectorizedTraversal : DefaultTraversal,PacketSize>4?InnerUnrolling:CompleteUnrolling));++      VERIFY(test_assign(Vector1(),Matrix11()*Vector1(),+                         InnerVectorizedTraversal,CompleteUnrolling));++      VERIFY(test_assign(Matrix11(),Matrix11().lazyProduct(Matrix11()),+                         InnerVectorizedTraversal,InnerUnrolling+CompleteUnrolling));+    }+    +    VERIFY(test_redux(Vector1(),+      LinearVectorizedTraversal,CompleteUnrolling));++    VERIFY(test_redux(Matrix<Scalar,PacketSize,3>(),+      LinearVectorizedTraversal,CompleteUnrolling));++    VERIFY(test_redux(Matrix3(),+      LinearVectorizedTraversal,CompleteUnrolling));++    VERIFY(test_redux(Matrix35(),+      LinearVectorizedTraversal,CompleteUnrolling));++    VERIFY(test_redux(Matrix57().template block<PacketSize,3>(1,0),+      DefaultTraversal,CompleteUnrolling));++    VERIFY((test_assign<+            Map<Matrix<Scalar,EIGEN_PLAIN_ENUM_MAX(2,PacketSize),EIGEN_PLAIN_ENUM_MAX(2,PacketSize)>, AlignedMax, InnerStride<3*PacketSize> >,+            Matrix<Scalar,EIGEN_PLAIN_ENUM_MAX(2,PacketSize),EIGEN_PLAIN_ENUM_MAX(2,PacketSize)>+            >(DefaultTraversal,CompleteUnrolling)));++    VERIFY((test_assign(Matrix57(), Matrix<Scalar,5*PacketSize,3>()*Matrix<Scalar,3,7>(),+                        InnerVectorizedTraversal, InnerUnrolling|CompleteUnrolling)));+    #endif+  }+};++template<typename Scalar> struct vectorization_logic_half<Scalar,false>+{+  static void run() {}+};++void test_vectorization_logic()+{++#ifdef EIGEN_VECTORIZE++  CALL_SUBTEST( vectorization_logic<int>::run() );+  CALL_SUBTEST( vectorization_logic<float>::run() );+  CALL_SUBTEST( vectorization_logic<double>::run() );+  CALL_SUBTEST( vectorization_logic<std::complex<float> >::run() );+  CALL_SUBTEST( vectorization_logic<std::complex<double> >::run() );+  +  CALL_SUBTEST( vectorization_logic_half<int>::run() );+  CALL_SUBTEST( vectorization_logic_half<float>::run() );+  CALL_SUBTEST( vectorization_logic_half<double>::run() );+  CALL_SUBTEST( vectorization_logic_half<std::complex<float> >::run() );+  CALL_SUBTEST( vectorization_logic_half<std::complex<double> >::run() );+  +  if(internal::packet_traits<float>::Vectorizable)+  {+    VERIFY(test_assign(Matrix<float,3,3>(),Matrix<float,3,3>()+Matrix<float,3,3>(),+      EIGEN_UNALIGNED_VECTORIZE ? LinearVectorizedTraversal : LinearTraversal,CompleteUnrolling));+      +    VERIFY(test_redux(Matrix<float,5,2>(),+      EIGEN_UNALIGNED_VECTORIZE ? LinearVectorizedTraversal : DefaultTraversal,CompleteUnrolling));+  }+  +  if(internal::packet_traits<double>::Vectorizable)+  {+    VERIFY(test_assign(Matrix<double,3,3>(),Matrix<double,3,3>()+Matrix<double,3,3>(),+      EIGEN_UNALIGNED_VECTORIZE ? LinearVectorizedTraversal : LinearTraversal,CompleteUnrolling));+    +    VERIFY(test_redux(Matrix<double,7,3>(),+      EIGEN_UNALIGNED_VECTORIZE ? LinearVectorizedTraversal : DefaultTraversal,CompleteUnrolling));+  }+#endif // EIGEN_VECTORIZE++}
+ eigen3/test/vectorwiseop.cpp view
@@ -0,0 +1,250 @@+// This file is part of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2011 Benoit Jacob <jacob.benoit.1@gmail.com>+// Copyright (C) 2015 Gael Guennebaud <gael.guennebaud@inria.fr>+//+// 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+#define EIGEN_NO_STATIC_ASSERT++#include "main.h"++template<typename ArrayType> void vectorwiseop_array(const ArrayType& m)+{+  typedef typename ArrayType::Scalar Scalar;+  typedef Array<Scalar, ArrayType::RowsAtCompileTime, 1> ColVectorType;+  typedef Array<Scalar, 1, ArrayType::ColsAtCompileTime> RowVectorType;++  Index rows = m.rows();+  Index cols = m.cols();+  Index r = internal::random<Index>(0, rows-1),+        c = internal::random<Index>(0, cols-1);++  ArrayType m1 = ArrayType::Random(rows, cols),+            m2(rows, cols),+            m3(rows, cols);++  ColVectorType colvec = ColVectorType::Random(rows);+  RowVectorType rowvec = RowVectorType::Random(cols);++  // test addition++  m2 = m1;+  m2.colwise() += colvec;+  VERIFY_IS_APPROX(m2, m1.colwise() + colvec);+  VERIFY_IS_APPROX(m2.col(c), m1.col(c) + colvec);++  VERIFY_RAISES_ASSERT(m2.colwise() += colvec.transpose());+  VERIFY_RAISES_ASSERT(m1.colwise() + colvec.transpose());++  m2 = m1;+  m2.rowwise() += rowvec;+  VERIFY_IS_APPROX(m2, m1.rowwise() + rowvec);+  VERIFY_IS_APPROX(m2.row(r), m1.row(r) + rowvec);++  VERIFY_RAISES_ASSERT(m2.rowwise() += rowvec.transpose());+  VERIFY_RAISES_ASSERT(m1.rowwise() + rowvec.transpose());++  // test substraction++  m2 = m1;+  m2.colwise() -= colvec;+  VERIFY_IS_APPROX(m2, m1.colwise() - colvec);+  VERIFY_IS_APPROX(m2.col(c), m1.col(c) - colvec);++  VERIFY_RAISES_ASSERT(m2.colwise() -= colvec.transpose());+  VERIFY_RAISES_ASSERT(m1.colwise() - colvec.transpose());++  m2 = m1;+  m2.rowwise() -= rowvec;+  VERIFY_IS_APPROX(m2, m1.rowwise() - rowvec);+  VERIFY_IS_APPROX(m2.row(r), m1.row(r) - rowvec);++  VERIFY_RAISES_ASSERT(m2.rowwise() -= rowvec.transpose());+  VERIFY_RAISES_ASSERT(m1.rowwise() - rowvec.transpose());++  // test multiplication++  m2 = m1;+  m2.colwise() *= colvec;+  VERIFY_IS_APPROX(m2, m1.colwise() * colvec);+  VERIFY_IS_APPROX(m2.col(c), m1.col(c) * colvec);++  VERIFY_RAISES_ASSERT(m2.colwise() *= colvec.transpose());+  VERIFY_RAISES_ASSERT(m1.colwise() * colvec.transpose());++  m2 = m1;+  m2.rowwise() *= rowvec;+  VERIFY_IS_APPROX(m2, m1.rowwise() * rowvec);+  VERIFY_IS_APPROX(m2.row(r), m1.row(r) * rowvec);++  VERIFY_RAISES_ASSERT(m2.rowwise() *= rowvec.transpose());+  VERIFY_RAISES_ASSERT(m1.rowwise() * rowvec.transpose());++  // test quotient++  m2 = m1;+  m2.colwise() /= colvec;+  VERIFY_IS_APPROX(m2, m1.colwise() / colvec);+  VERIFY_IS_APPROX(m2.col(c), m1.col(c) / colvec);++  VERIFY_RAISES_ASSERT(m2.colwise() /= colvec.transpose());+  VERIFY_RAISES_ASSERT(m1.colwise() / colvec.transpose());++  m2 = m1;+  m2.rowwise() /= rowvec;+  VERIFY_IS_APPROX(m2, m1.rowwise() / rowvec);+  VERIFY_IS_APPROX(m2.row(r), m1.row(r) / rowvec);++  VERIFY_RAISES_ASSERT(m2.rowwise() /= rowvec.transpose());+  VERIFY_RAISES_ASSERT(m1.rowwise() / rowvec.transpose());++  m2 = m1;+  // yes, there might be an aliasing issue there but ".rowwise() /="+  // is supposed to evaluate " m2.colwise().sum()" into a temporary to avoid+  // evaluating the reduction multiple times+  if(ArrayType::RowsAtCompileTime>2 || ArrayType::RowsAtCompileTime==Dynamic)+  {+    m2.rowwise() /= m2.colwise().sum();+    VERIFY_IS_APPROX(m2, m1.rowwise() / m1.colwise().sum());+  }++  // all/any+  Array<bool,Dynamic,Dynamic> mb(rows,cols);+  mb = (m1.real()<=0.7).colwise().all();+  VERIFY( (mb.col(c) == (m1.real().col(c)<=0.7).all()).all() );+  mb = (m1.real()<=0.7).rowwise().all();+  VERIFY( (mb.row(r) == (m1.real().row(r)<=0.7).all()).all() );++  mb = (m1.real()>=0.7).colwise().any();+  VERIFY( (mb.col(c) == (m1.real().col(c)>=0.7).any()).all() );+  mb = (m1.real()>=0.7).rowwise().any();+  VERIFY( (mb.row(r) == (m1.real().row(r)>=0.7).any()).all() );+}++template<typename MatrixType> void vectorwiseop_matrix(const MatrixType& m)+{+  typedef typename MatrixType::Scalar Scalar;+  typedef typename NumTraits<Scalar>::Real RealScalar;+  typedef Matrix<Scalar, MatrixType::RowsAtCompileTime, 1> ColVectorType;+  typedef Matrix<Scalar, 1, MatrixType::ColsAtCompileTime> RowVectorType;+  typedef Matrix<RealScalar, MatrixType::RowsAtCompileTime, 1> RealColVectorType;+  typedef Matrix<RealScalar, 1, MatrixType::ColsAtCompileTime> RealRowVectorType;++  Index rows = m.rows();+  Index cols = m.cols();+  Index r = internal::random<Index>(0, rows-1),+        c = internal::random<Index>(0, cols-1);++  MatrixType m1 = MatrixType::Random(rows, cols),+            m2(rows, cols),+            m3(rows, cols);++  ColVectorType colvec = ColVectorType::Random(rows);+  RowVectorType rowvec = RowVectorType::Random(cols);+  RealColVectorType rcres;+  RealRowVectorType rrres;++  // test addition++  m2 = m1;+  m2.colwise() += colvec;+  VERIFY_IS_APPROX(m2, m1.colwise() + colvec);+  VERIFY_IS_APPROX(m2.col(c), m1.col(c) + colvec);++  if(rows>1)+  {+    VERIFY_RAISES_ASSERT(m2.colwise() += colvec.transpose());+    VERIFY_RAISES_ASSERT(m1.colwise() + colvec.transpose());+  }++  m2 = m1;+  m2.rowwise() += rowvec;+  VERIFY_IS_APPROX(m2, m1.rowwise() + rowvec);+  VERIFY_IS_APPROX(m2.row(r), m1.row(r) + rowvec);++  if(cols>1)+  {+    VERIFY_RAISES_ASSERT(m2.rowwise() += rowvec.transpose());+    VERIFY_RAISES_ASSERT(m1.rowwise() + rowvec.transpose());+  }++  // test substraction++  m2 = m1;+  m2.colwise() -= colvec;+  VERIFY_IS_APPROX(m2, m1.colwise() - colvec);+  VERIFY_IS_APPROX(m2.col(c), m1.col(c) - colvec);++  if(rows>1)+  {+    VERIFY_RAISES_ASSERT(m2.colwise() -= colvec.transpose());+    VERIFY_RAISES_ASSERT(m1.colwise() - colvec.transpose());+  }++  m2 = m1;+  m2.rowwise() -= rowvec;+  VERIFY_IS_APPROX(m2, m1.rowwise() - rowvec);+  VERIFY_IS_APPROX(m2.row(r), m1.row(r) - rowvec);++  if(cols>1)+  {+    VERIFY_RAISES_ASSERT(m2.rowwise() -= rowvec.transpose());+    VERIFY_RAISES_ASSERT(m1.rowwise() - rowvec.transpose());+  }++  // test norm+  rrres = m1.colwise().norm();+  VERIFY_IS_APPROX(rrres(c), m1.col(c).norm());+  rcres = m1.rowwise().norm();+  VERIFY_IS_APPROX(rcres(r), m1.row(r).norm());++  VERIFY_IS_APPROX(m1.cwiseAbs().colwise().sum(), m1.colwise().template lpNorm<1>());+  VERIFY_IS_APPROX(m1.cwiseAbs().rowwise().sum(), m1.rowwise().template lpNorm<1>());+  VERIFY_IS_APPROX(m1.cwiseAbs().colwise().maxCoeff(), m1.colwise().template lpNorm<Infinity>());+  VERIFY_IS_APPROX(m1.cwiseAbs().rowwise().maxCoeff(), m1.rowwise().template lpNorm<Infinity>());++  // regression for bug 1158+  VERIFY_IS_APPROX(m1.cwiseAbs().colwise().sum().x(), m1.col(0).cwiseAbs().sum());++  // test normalized+  m2 = m1.colwise().normalized();+  VERIFY_IS_APPROX(m2.col(c), m1.col(c).normalized());+  m2 = m1.rowwise().normalized();+  VERIFY_IS_APPROX(m2.row(r), m1.row(r).normalized());++  // test normalize+  m2 = m1;+  m2.colwise().normalize();+  VERIFY_IS_APPROX(m2.col(c), m1.col(c).normalized());+  m2 = m1;+  m2.rowwise().normalize();+  VERIFY_IS_APPROX(m2.row(r), m1.row(r).normalized());++  // test with partial reduction of products+  Matrix<Scalar,MatrixType::RowsAtCompileTime,MatrixType::RowsAtCompileTime> m1m1 = m1 * m1.transpose();+  VERIFY_IS_APPROX( (m1 * m1.transpose()).colwise().sum(), m1m1.colwise().sum());+  Matrix<Scalar,1,MatrixType::RowsAtCompileTime> tmp(rows);+  VERIFY_EVALUATION_COUNT( tmp = (m1 * m1.transpose()).colwise().sum(), 1);++  m2 = m1.rowwise() - (m1.colwise().sum()/RealScalar(m1.rows())).eval();+  m1 = m1.rowwise() - (m1.colwise().sum()/RealScalar(m1.rows()));+  VERIFY_IS_APPROX( m1, m2 );+  VERIFY_EVALUATION_COUNT( m2 = (m1.rowwise() - m1.colwise().sum()/RealScalar(m1.rows())), (MatrixType::RowsAtCompileTime!=1 ? 1 : 0) );+}++void test_vectorwiseop()+{+  CALL_SUBTEST_1( vectorwiseop_array(Array22cd()) );+  CALL_SUBTEST_2( vectorwiseop_array(Array<double, 3, 2>()) );+  CALL_SUBTEST_3( vectorwiseop_array(ArrayXXf(3, 4)) );+  CALL_SUBTEST_4( vectorwiseop_matrix(Matrix4cf()) );+  CALL_SUBTEST_5( vectorwiseop_matrix(Matrix<float,4,5>()) );+  CALL_SUBTEST_6( vectorwiseop_matrix(MatrixXd(internal::random<int>(1,EIGEN_TEST_MAX_SIZE), internal::random<int>(1,EIGEN_TEST_MAX_SIZE))) );+  CALL_SUBTEST_7( vectorwiseop_matrix(VectorXd(internal::random<int>(1,EIGEN_TEST_MAX_SIZE))) );+  CALL_SUBTEST_7( vectorwiseop_matrix(RowVectorXd(internal::random<int>(1,EIGEN_TEST_MAX_SIZE))) );+}
+ eigen3/test/visitor.cpp view
@@ -0,0 +1,133 @@+// This file is part of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2008 Benoit Jacob <jacob.benoit.1@gmail.com>+//+// 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<typename MatrixType> void matrixVisitor(const MatrixType& p)+{+  typedef typename MatrixType::Scalar Scalar;++  Index rows = p.rows();+  Index cols = p.cols();++  // construct a random matrix where all coefficients are different+  MatrixType m;+  m = MatrixType::Random(rows, cols);+  for(Index i = 0; i < m.size(); i++)+    for(Index i2 = 0; i2 < i; i2++)+      while(m(i) == m(i2)) // yes, ==+        m(i) = internal::random<Scalar>();+  +  Scalar minc = Scalar(1000), maxc = Scalar(-1000);+  Index minrow=0,mincol=0,maxrow=0,maxcol=0;+  for(Index j = 0; j < cols; j++)+  for(Index i = 0; i < rows; i++)+  {+    if(m(i,j) < minc)+    {+      minc = m(i,j);+      minrow = i;+      mincol = j;+    }+    if(m(i,j) > maxc)+    {+      maxc = m(i,j);+      maxrow = i;+      maxcol = j;+    }+  }+  Index eigen_minrow, eigen_mincol, eigen_maxrow, eigen_maxcol;+  Scalar eigen_minc, eigen_maxc;+  eigen_minc = m.minCoeff(&eigen_minrow,&eigen_mincol);+  eigen_maxc = m.maxCoeff(&eigen_maxrow,&eigen_maxcol);+  VERIFY(minrow == eigen_minrow);+  VERIFY(maxrow == eigen_maxrow);+  VERIFY(mincol == eigen_mincol);+  VERIFY(maxcol == eigen_maxcol);+  VERIFY_IS_APPROX(minc, eigen_minc);+  VERIFY_IS_APPROX(maxc, eigen_maxc);+  VERIFY_IS_APPROX(minc, m.minCoeff());+  VERIFY_IS_APPROX(maxc, m.maxCoeff());++  eigen_maxc = (m.adjoint()*m).maxCoeff(&eigen_maxrow,&eigen_maxcol);+  eigen_maxc = (m.adjoint()*m).eval().maxCoeff(&maxrow,&maxcol);+  VERIFY(maxrow == eigen_maxrow);+  VERIFY(maxcol == eigen_maxcol);+}++template<typename VectorType> void vectorVisitor(const VectorType& w)+{+  typedef typename VectorType::Scalar Scalar;++  Index size = w.size();++  // construct a random vector where all coefficients are different+  VectorType v;+  v = VectorType::Random(size);+  for(Index i = 0; i < size; i++)+    for(Index i2 = 0; i2 < i; i2++)+      while(v(i) == v(i2)) // yes, ==+        v(i) = internal::random<Scalar>();+  +  Scalar minc = v(0), maxc = v(0);+  Index minidx=0, maxidx=0;+  for(Index i = 0; i < size; i++)+  {+    if(v(i) < minc)+    {+      minc = v(i);+      minidx = i;+    }+    if(v(i) > maxc)+    {+      maxc = v(i);+      maxidx = i;+    }+  }+  Index eigen_minidx, eigen_maxidx;+  Scalar eigen_minc, eigen_maxc;+  eigen_minc = v.minCoeff(&eigen_minidx);+  eigen_maxc = v.maxCoeff(&eigen_maxidx);+  VERIFY(minidx == eigen_minidx);+  VERIFY(maxidx == eigen_maxidx);+  VERIFY_IS_APPROX(minc, eigen_minc);+  VERIFY_IS_APPROX(maxc, eigen_maxc);+  VERIFY_IS_APPROX(minc, v.minCoeff());+  VERIFY_IS_APPROX(maxc, v.maxCoeff());+  +  Index idx0 = internal::random<Index>(0,size-1);+  Index idx1 = eigen_minidx;+  Index idx2 = eigen_maxidx;+  VectorType v1(v), v2(v);+  v1(idx0) = v1(idx1);+  v2(idx0) = v2(idx2);+  v1.minCoeff(&eigen_minidx);+  v2.maxCoeff(&eigen_maxidx);+  VERIFY(eigen_minidx == (std::min)(idx0,idx1));+  VERIFY(eigen_maxidx == (std::min)(idx0,idx2));+}++void test_visitor()+{+  for(int i = 0; i < g_repeat; i++) {+    CALL_SUBTEST_1( matrixVisitor(Matrix<float, 1, 1>()) );+    CALL_SUBTEST_2( matrixVisitor(Matrix2f()) );+    CALL_SUBTEST_3( matrixVisitor(Matrix4d()) );+    CALL_SUBTEST_4( matrixVisitor(MatrixXd(8, 12)) );+    CALL_SUBTEST_5( matrixVisitor(Matrix<double,Dynamic,Dynamic,RowMajor>(20, 20)) );+    CALL_SUBTEST_6( matrixVisitor(MatrixXi(8, 12)) );+  }+  for(int i = 0; i < g_repeat; i++) {+    CALL_SUBTEST_7( vectorVisitor(Vector4f()) );+    CALL_SUBTEST_7( vectorVisitor(Matrix<int,12,1>()) );+    CALL_SUBTEST_8( vectorVisitor(VectorXd(10)) );+    CALL_SUBTEST_9( vectorVisitor(RowVectorXd(10)) );+    CALL_SUBTEST_10( vectorVisitor(VectorXf(33)) );+  }+}
+ eigen3/test/zerosized.cpp view
@@ -0,0 +1,102 @@+// This file is part of Eigen, a lightweight C++ template library+// for linear algebra.+//+// Copyright (C) 2011 Benoit Jacob <jacob.benoit.1@gmail.com>+//+// 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<typename MatrixType> void zeroReduction(const MatrixType& m) {+  // Reductions that must hold for zero sized objects+  VERIFY(m.all());+  VERIFY(!m.any());+  VERIFY(m.prod()==1);+  VERIFY(m.sum()==0);+  VERIFY(m.count()==0);+  VERIFY(m.allFinite());+  VERIFY(!m.hasNaN());+}+++template<typename MatrixType> void zeroSizedMatrix()+{+  MatrixType t1;+  typedef typename MatrixType::Scalar Scalar;++  if (MatrixType::SizeAtCompileTime == Dynamic || MatrixType::SizeAtCompileTime == 0)+  {+    zeroReduction(t1);+    if (MatrixType::RowsAtCompileTime == Dynamic)+      VERIFY(t1.rows() == 0);+    if (MatrixType::ColsAtCompileTime == Dynamic)+      VERIFY(t1.cols() == 0);++    if (MatrixType::RowsAtCompileTime == Dynamic && MatrixType::ColsAtCompileTime == Dynamic)+    {++      MatrixType t2(0, 0), t3(t1);+      VERIFY(t2.rows() == 0);+      VERIFY(t2.cols() == 0);++      zeroReduction(t2);+      VERIFY(t1==t2);+    }+  }++  if(MatrixType::MaxColsAtCompileTime!=0 && MatrixType::MaxRowsAtCompileTime!=0)+  {+    Index rows = MatrixType::RowsAtCompileTime==Dynamic ? internal::random<Index>(1,10) : Index(MatrixType::RowsAtCompileTime);+    Index cols = MatrixType::ColsAtCompileTime==Dynamic ? internal::random<Index>(1,10) : Index(MatrixType::ColsAtCompileTime);+    MatrixType m(rows,cols);+    zeroReduction(m.template block<0,MatrixType::ColsAtCompileTime>(0,0,0,cols));+    zeroReduction(m.template block<MatrixType::RowsAtCompileTime,0>(0,0,rows,0));+    zeroReduction(m.template block<0,1>(0,0));+    zeroReduction(m.template block<1,0>(0,0));+    Matrix<Scalar,Dynamic,Dynamic> prod = m.template block<MatrixType::RowsAtCompileTime,0>(0,0,rows,0) * m.template block<0,MatrixType::ColsAtCompileTime>(0,0,0,cols);+    VERIFY(prod.rows()==rows && prod.cols()==cols);+    VERIFY(prod.isZero());+    prod = m.template block<1,0>(0,0) * m.template block<0,1>(0,0);+    VERIFY(prod.size()==1);+    VERIFY(prod.isZero());+  }+}++template<typename VectorType> void zeroSizedVector()+{+  VectorType t1;++  if (VectorType::SizeAtCompileTime == Dynamic || VectorType::SizeAtCompileTime==0)+  {+    zeroReduction(t1);+    VERIFY(t1.size() == 0);+    VectorType t2(DenseIndex(0)); // DenseIndex disambiguates with 0-the-null-pointer (error with gcc 4.4 and MSVC8)+    VERIFY(t2.size() == 0);+    zeroReduction(t2);++    VERIFY(t1==t2);+  }+}++void test_zerosized()+{+  zeroSizedMatrix<Matrix2d>();+  zeroSizedMatrix<Matrix3i>();+  zeroSizedMatrix<Matrix<float, 2, Dynamic> >();+  zeroSizedMatrix<MatrixXf>();+  zeroSizedMatrix<Matrix<float, 0, 0> >();+  zeroSizedMatrix<Matrix<float, Dynamic, 0, 0, 0, 0> >();+  zeroSizedMatrix<Matrix<float, 0, Dynamic, 0, 0, 0> >();+  zeroSizedMatrix<Matrix<float, Dynamic, Dynamic, 0, 0, 0> >();+  zeroSizedMatrix<Matrix<float, 0, 4> >();+  zeroSizedMatrix<Matrix<float, 4, 0> >();++  zeroSizedVector<Vector2d>();+  zeroSizedVector<Vector3i>();+  zeroSizedVector<VectorXf>();+  zeroSizedVector<Matrix<float, 0, 1> >();+  zeroSizedVector<Matrix<float, 1, 0> >();+}
eigen3/unsupported/CMakeLists.txt view
@@ -1,7 +1,9 @@ add_subdirectory(Eigen) add_subdirectory(doc EXCLUDE_FROM_ALL)-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)+if(BUILD_TESTING)+  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() endif()
eigen3/unsupported/Eigen/CXX11/Tensor view
@@ -39,6 +39,8 @@   * \code   * #include <Eigen/CXX11/Tensor>   * \endcode+  *+  * Much of the documentation can be found \ref eigen_tensors "here".   */  #include <cmath>
eigen3/unsupported/Eigen/CXX11/src/Tensor/README.md view
@@ -1,4 +1,4 @@-# Eigen Tensors+# Eigen Tensors {#eigen_tensors}  Tensors are multidimensional arrays of elements. Elements are typically scalars, but more complex types such as strings are also supported.@@ -8,7 +8,7 @@ ## Tensor Classes  You can manipulate a tensor with one of the following classes.  They all are in-the namespace ```::Eigen.```+the namespace `::Eigen.`   ### Class Tensor<data_type, rank>@@ -21,10 +21,10 @@ Tensors of this class are resizable.  For example, if you assign a tensor of a different size to a Tensor, that tensor is resized to match its new value. -#### Constructor Tensor<data_type, rank>(size0, size1, ...)+#### Constructor `Tensor<data_type, rank>(size0, size1, ...)` -Constructor for a Tensor.  The constructor must be passed ```rank``` integers-indicating the sizes of the instance along each of the the ```rank```+Constructor for a Tensor.  The constructor must be passed `rank` integers+indicating the sizes of the instance along each of the the `rank` dimensions.      // Create a tensor of rank 3 of sizes 2, 3, 4.  This tensor owns@@ -34,18 +34,18 @@     // Resize t_3d by assigning a tensor of different sizes, but same rank.     t_3d = Tensor<float, 3>(3, 4, 3); -#### Constructor Tensor<data_type, rank>(size_array)+#### Constructor `Tensor<data_type, rank>(size_array)`  Constructor where the sizes for the constructor are specified as an array of values instead of an explicitly list of parameters.  The array type to use is-```Eigen::array<Eigen::Index>```.  The array can be constructed automatically+`Eigen::array<Eigen::Index>`.  The array can be constructed automatically from an initializer list.      // Create a tensor of strings of rank 2 with sizes 5, 7.     Tensor<string, 2> t_2d({5, 7});  -### Class TensorFixedSize<data_type, Sizes<size0, size1, ...>>+### Class `TensorFixedSize<data_type, Sizes<size0, size1, ...>>`  Class to use for tensors of fixed size, where the size is known at compile time.  Fixed sized tensors can provide very fast computations because all their@@ -57,7 +57,7 @@     // Create a 4 x 3 tensor of floats.     TensorFixedSize<float, Sizes<4, 3>> t_4x3; -### Class TensorMap<Tensor<data_type, rank>>+### Class `TensorMap<Tensor<data_type, rank>>`  This is the class to use to create a tensor on top of memory allocated and owned by another part of your code.  It allows to view any piece of allocated@@ -67,7 +67,7 @@ A TensorMap is not resizable because it does not own the memory where its data are stored. -#### Constructor TensorMap<Tensor<data_type, rank>>(data, size0, size1, ...)+#### Constructor `TensorMap<Tensor<data_type, rank>>(data, size0, size1, ...)`  Constructor for a Tensor.  The constructor must be passed a pointer to the storage for the data, and "rank" size attributes.  The storage has to be@@ -83,20 +83,20 @@      // You can also map fixed-size tensors.  Here we get a 1d view of     // the 2d fixed-size tensor.-    Tensor<float, Sizes<4, 5>> t_4x3;-    TensorMap<Tensor<float, 1>> t_12(t_4x3, 12);+    TensorFixedSize<float, Sizes<4, 5>> t_4x3;+    TensorMap<Tensor<float, 1>> t_12(t_4x3.data(), 12);  -#### Class TensorRef+#### Class `TensorRef`  See Assigning to a TensorRef below.  ## Accessing Tensor Elements -#### <data_type> tensor(index0, index1...)+#### `<data_type> tensor(index0, index1...)` -Return the element at position ```(index0, index1...)``` in tensor-```tensor```.  You must pass as many parameters as the rank of ```tensor```.+Return the element at position `(index0, index1...)` in tensor+`tensor`.  You must pass as many parameters as the rank of `tensor`. The expression can be used as an l-value to set the value of the element at the specified position.  The value returned is of the datatype of the tensor. @@ -121,8 +121,8 @@  ## TensorLayout -The tensor library supports 2 layouts: ```ColMajor``` (the default) and-```RowMajor```.  Only the default column major layout is currently fully+The tensor library supports 2 layouts: `ColMajor` (the default) and+`RowMajor`.  Only the default column major layout is currently fully supported, and it is therefore not recommended to attempt to use the row major layout at the moment. @@ -136,7 +136,7 @@ different layouts will result in a compilation error.  It is possible to change the layout of a tensor or an expression using the-```swap_layout()``` method.  Note that this will also reverse the order of the+`swap_layout()` method.  Note that this will also reverse the order of the dimensions.      Tensor<float, 2, ColMajor> col_major(2, 4);@@ -173,35 +173,35 @@     Tensor<float, 3> t3 = t1 + t2;  While the code above looks easy enough, it is important to understand that the-expression ```t1 + t2``` is not actually adding the values of the tensors.  The+expression `t1 + t2` is not actually adding the values of the tensors.  The expression instead constructs a "tensor operator" object of the class TensorCwiseBinaryOp<scalar_sum>, which has references to the tensors-```t1``` and ```t2```.  This is a small C++ object that knows how to add-```t1``` and ```t2```.  It is only when the value of the expression is assigned-to the tensor ```t3``` that the addition is actually performed.  Technically,-this happens through the overloading of ```operator=()``` in the Tensor class.+`t1` and `t2`.  This is a small C++ object that knows how to add+`t1` and `t2`.  It is only when the value of the expression is assigned+to the tensor `t3` that the addition is actually performed.  Technically,+this happens through the overloading of `operator=()` in the Tensor class.  This mechanism for computing tensor expressions allows for lazy evaluation and optimizations which are what make the tensor library very fast. -Of course, the tensor operators do nest, and the expression ```t1 + t2 *-0.3f``` is actually represented with the (approximate) tree of operators:+Of course, the tensor operators do nest, and the expression `t1 + t2 * 0.3f`+is actually represented with the (approximate) tree of operators:      TensorCwiseBinaryOp<scalar_sum>(t1, TensorCwiseUnaryOp<scalar_mul>(t2, 0.3f))   ### Tensor Operations and C++ "auto" -Because Tensor operations create tensor operators, the C++ ```auto``` keyword+Because Tensor operations create tensor operators, the C++ `auto` keyword does not have its intuitive meaning.  Consider these 2 lines of code:      Tensor<float, 3> t3 = t1 + t2;     auto t4 = t1 + t2; -In the first line we allocate the tensor ```t3``` and it will contain the-result of the addition of ```t1``` and ```t2```.  In the second line, ```t4```+In the first line we allocate the tensor `t3` and it will contain the+result of the addition of `t1` and `t2`.  In the second line, `t4` is actually the tree of tensor operators that will compute the addition of-```t1``` and ```t2```.  In fact, ```t4``` is *not* a tensor and you cannot get+`t1` and `t2`.  In fact, `t4` is *not* a tensor and you cannot get the values of its elements:      Tensor<float, 3> t3 = t1 + t2;@@ -210,8 +210,8 @@     auto t4 = t1 + t2;     cout << t4(0, 0, 0);  // Compilation error! -When you use ```auto``` you do not get a Tensor as a result but instead a-non-evaluated expression.  So only use ```auto``` to delay evaluation.+When you use `auto` you do not get a Tensor as a result but instead a+non-evaluated expression.  So only use `auto` to delay evaluation.  Unfortunately, there is no single underlying concrete type for holding non-evaluated expressions, hence you have to use auto in the case when you do@@ -257,9 +257,9 @@ #### Assigning to a Tensor, TensorFixedSize, or TensorMap.  The most common way to evaluate an expression is to assign it to a Tensor.  In-the example below, the ```auto``` declarations make the intermediate values+the example below, the `auto` declarations make the intermediate values "Operations", not Tensors, and do not cause the expressions to be evaluated.-The assignment to the Tensor ```result``` causes the evaluation of all the+The assignment to the Tensor `result` causes the evaluation of all the operations.      auto t3 = t1 + t2;             // t3 is an Operation.@@ -272,17 +272,17 @@ efficient.      // We know that the result is a 4x4x2 tensor!-    TensorFixedSize<float, 4, 4, 2> result = t5;+    TensorFixedSize<float, Sizes<4, 4, 2>> result = t5;  Simiarly, assigning an expression to a TensorMap causes its evaluation.  Like tensors of type TensorFixedSize, TensorMaps cannot be resized so they have to have the rank and sizes of the expression that are assigned to them. -#### Calling eval().+#### Calling `eval()`.  When you compute large composite expressions, you sometimes want to tell Eigen that an intermediate value in the expression tree is worth evaluating ahead of-time.  This is done by inserting a call to the ```eval()``` method of the+time.  This is done by inserting a call to the `eval()` method of the expression Operation.      // The previous example could have been written:@@ -291,15 +291,15 @@     // If you want to compute (t1 + t2) once ahead of time you can write:     Tensor<float, 3> result = ((t1 + t2).eval() * 0.2f).exp(); -Semantically, calling ```eval()``` is equivalent to materializing the value of+Semantically, calling `eval()` is equivalent to materializing the value of the expression in a temporary Tensor of the right size.  The code above in effect does:      // .eval() knows the size!-    TensorFixedSize<float, 4, 4, 2> tmp = t1 + t2;+    TensorFixedSize<float, Sizes<4, 4, 2>> tmp = t1 + t2;     Tensor<float, 3> result = (tmp * 0.2f).exp(); -Note that the return value of ```eval()``` is itself an Operation, so the+Note that the return value of `eval()` is itself an Operation, so the following code does not do what you may think:      // Here t3 is an evaluation Operation.  t3 has not been evaluated yet.@@ -312,24 +312,24 @@     // an intermediate tensor to represent t3.x     Tensor<float, 3> result = t4; -While in the examples above calling ```eval()``` does not make a difference in+While in the examples above calling `eval()` does not make a difference in performance, in other cases it can make a huge difference.  In the expression-below the ```broadcast()``` expression causes the ```X.maximum()``` expression+below the `broadcast()` expression causes the `X.maximum()` expression to be evaluated many times:      Tensor<...> X ...;     Tensor<...> Y = ((X - X.maximum(depth_dim).reshape(dims2d).broadcast(bcast))                      * beta).exp(); -Inserting a call to ```eval()``` between the ```maximum()``` and-```reshape()``` calls guarantees that maximum() is only computed once and+Inserting a call to `eval()` between the `maximum()` and+`reshape()` calls guarantees that maximum() is only computed once and greatly speeds-up execution:      Tensor<...> Y =       ((X - X.maximum(depth_dim).eval().reshape(dims2d).broadcast(bcast))         * beta).exp(); -In the other example below, the tensor ```Y``` is both used in the expression+In the other example below, the tensor `Y` is both used in the expression and its assignment.  This is an aliasing problem and if the evaluation is not done in the right order Y will be updated incrementally during the evaluation resulting in bogus results:@@ -337,8 +337,8 @@      Tensor<...> Y ...;      Y = Y / (Y.sum(depth_dim).reshape(dims2d).broadcast(bcast)); -Inserting a call to ```eval()``` between the ```sum()``` and ```reshape()```-expressions ensures that the sum is computed before any updates to ```Y``` are+Inserting a call to `eval()` between the `sum()` and `reshape()`+expressions ensures that the sum is computed before any updates to `Y` are done.       Y = Y / (Y.sum(depth_dim).eval().reshape(dims2d).broadcast(bcast));@@ -347,21 +347,21 @@ because the generated has to compute the i-th value of the right hand side before assigning it to the left hand side. -However, if you were assigning the expression value to a shuffle of ```Y```-then you would need to force an eval for correctness by adding an ```eval()```+However, if you were assigning the expression value to a shuffle of `Y`+then you would need to force an eval for correctness by adding an `eval()` call for the right hand side:       Y.shuffle(...) =         (Y / (Y.sum(depth_dim).eval().reshape(dims2d).broadcast(bcast))).eval();  -#### Assigning to a TensorRef.+#### Assigning to a `TensorRef`.  If you need to access only a few elements from the value of an expression you can avoid materializing the value in a full tensor by using a TensorRef.  A TensorRef is a small wrapper class for any Eigen Operation.  It provides-overloads for the ```()``` operator that let you access individual values in+overloads for the `()` operator that let you access individual values in the expression.  TensorRef is convenient, because the Operation themselves do not provide a way to access individual elements. @@ -390,7 +390,7 @@ different environments: single threaded on CPU, multi threaded on CPU, or on a GPU using cuda.  Additional implementations may be added later. -You can choose which implementation to use with the ```device()``` call.  If+You can choose which implementation to use with the `device()` call.  If you do not choose an implementation explicitly the default implementation that uses a single thread on the CPU is used. @@ -406,7 +406,7 @@     Tensor<float, 2> b(30, 40);     Tensor<float, 2> c = a + b; -To choose a different implementation you have to insert a ```device()``` call+To choose a different implementation you have to insert a `device()` call before the assignment of the result.  For technical C++ reasons this requires that the Tensor for the result be declared on its own.  This means that you have to know the size of the result.@@ -414,16 +414,16 @@     Eigen::Tensor<float, 2> c(30, 40);     c.device(...) = a + b; -The call to ```device()``` must be the last call on the left of the operator=.+The call to `device()` must be the last call on the left of the operator=. -You must pass to the ```device()``` call an Eigen device object.  There are+You must pass to the `device()` call an Eigen device object.  There are presently three devices you can use: DefaultDevice, ThreadPoolDevice and GpuDevice.   #### Evaluating With the DefaultDevice -This is exactly the same as not inserting a ```device()``` call.+This is exactly the same as not inserting a `device()` call.      DefaultDevice my_device;     c.device(my_device) = a + b;@@ -452,24 +452,24 @@ In the documentation of the tensor methods and Operation we mention datatypes that are tensor-type specific: -#### <Tensor-Type>::Dimensions+#### `<Tensor-Type>::``Dimensions` -Acts like an array of ints.  Has an ```int size``` attribute, and can be+Acts like an array of ints.  Has an `int size` attribute, and can be indexed like an array to access individual values.  Used to represent the-dimensions of a tensor.  See ```dimensions()```.+dimensions of a tensor.  See `dimensions()`. -#### <Tensor-Type>::Index+#### `<Tensor-Type>::``Index` -Acts like an ```int```.  Used for indexing tensors along their dimensions.  See-```operator()```, ```dimension()```, and ```size()```.+Acts like an `int`.  Used for indexing tensors along their dimensions.  See+`operator()`, `dimension()`, and `size()`. -#### <Tensor-Type>::Scalar+#### `<Tensor-Type>::``Scalar`  Represents the datatype of individual tensor elements.  For example, for a-```Tensor<float>```, ```Scalar``` is the type ```float```.  See-```setConstant()```.+`Tensor<float>`, `Scalar` is the type `float`.  See+`setConstant()`. -#### <Operation>+#### `<Operation>`  We use this pseudo type to indicate that a tensor Operation is returned by a method.  We indicate in the text the type and dimensions of the tensor that the@@ -489,7 +489,7 @@  ## Metadata -### int NumDimensions+### `int NumDimensions`  Constant value indicating the number of dimensions of a Tensor.  This is also known as the tensor "rank".@@ -498,10 +498,10 @@       cout << "Dims " << a.NumDimensions;       => Dims 2 -### Dimensions dimensions()+### `Dimensions dimensions()`  Returns an array-like object representing the dimensions of the tensor.-The actual type of the dimensions() result is <Tensor-Type>::Dimensions.+The actual type of the `dimensions()` result is `<Tensor-Type>::``Dimensions`.      Eigen::Tensor<float, 2> a(3, 4);     const Eigen::Tensor<float, 2>::Dimensions& d = a.dimensions();@@ -509,17 +509,17 @@          << ", dim 1: " << d[1];     => Dim size: 2, dim 0: 3, dim 1: 4 -If you use a C++11 compiler, you can use ```auto``` to simplify the code:+If you use a C++11 compiler, you can use `auto` to simplify the code:      const auto& d = a.dimensions();     cout << "Dim size: " << d.size << ", dim 0: " << d[0]          << ", dim 1: " << d[1];     => Dim size: 2, dim 0: 3, dim 1: 4 -### Index dimension(Index n)+### `Index dimension(Index n)`  Returns the n-th dimension of the tensor.  The actual type of the-```dimension()``` result is ```<Tensor-Type>::Index```, but you can+`dimension()` result is `<Tensor-Type>::``Index`, but you can always use it like an int.        Eigen::Tensor<float, 2> a(3, 4);@@ -527,11 +527,11 @@       cout << "Dim 1: " << dim1;       => Dim 1: 4 -### Index size()+### `Index size()`  Returns the total number of elements in the tensor.  This is the product of all-the tensor dimensions.  The actual type of the ```size()``` result is-```<Tensor-Type>::Index```, but you can always use it like an int.+the tensor dimensions.  The actual type of the `size()` result is+`<Tensor-Type>::``Index`, but you can always use it like an int.      Eigen::Tensor<float, 2> a(3, 4);     cout << "Size: " << a.size();@@ -540,11 +540,11 @@  ### Getting Dimensions From An Operation -A few operations provide ```dimensions()``` directly,-e.g. ```TensorReslicingOp```.  Most operations defer calculating dimensions+A few operations provide `dimensions()` directly,+e.g. `TensorReslicingOp`.  Most operations defer calculating dimensions until the operation is being evaluated.  If you need access to the dimensions of a deferred operation, you can wrap it in a TensorRef (see Assigning to a-TensorRef above), which provides ```dimensions()``` and ```dimension()``` as+TensorRef above), which provides `dimensions()` and `dimension()` as above.  TensorRef can also wrap the plain Tensor types, so this is a useful idiom in@@ -567,11 +567,11 @@  ### TensorFixedSize -Creates a tensor of the specified size. The number of arguments in the Size<>+Creates a tensor of the specified size. The number of arguments in the Sizes<> template parameter determines the rank of the tensor. The content of the tensor is not initialized. -    Eigen::TensorFixedSize<float, Size<3, 4>> a;+    Eigen::TensorFixedSize<float, Sizes<3, 4>> a;     cout << "Rank: " << a.rank() << endl;     => Rank: 2     cout << "NumRows: " << a.dimension(0) << " NumCols: " << a.dimension(1) << endl;@@ -581,14 +581,14 @@  Creates a tensor mapping an existing array of data. The data must not be freed until the TensorMap is discarded, and the size of the data must be large enough-to accomodate of the coefficients of the tensor.+to accommodate the coefficients of the tensor.      float data[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11};-    Eigen::TensorMap<float, 2> a(data, 3, 4);+    Eigen::TensorMap<Tensor<float, 2>> a(data, 3, 4);     cout << "NumRows: " << a.dimension(0) << " NumCols: " << a.dimension(1) << endl;     => NumRows: 3 NumCols: 4     cout << "a(1, 2): " << a(1, 2) << endl;-    => a(1, 2): 9+    => a(1, 2): 7   ## Contents Initialization@@ -602,9 +602,9 @@ have an immediate effect on the tensor and return the tensor itself as a result.  These are not tensor Operations which delay evaluation. -### <Tensor-Type> setConstant(const Scalar& val)+### `<Tensor-Type> setConstant(const Scalar& val)` -Sets all elements of the tensor to the constant value ```val```.  ```Scalar```+Sets all elements of the tensor to the constant value `val`.  `Scalar` is the type of data stored in the tensor.  You can pass any value that is convertible to that type. @@ -618,8 +618,8 @@     12.3 12.3 12.3 12.3     12.3 12.3 12.3 12.3 -Note that ```setConstant()``` can be used on any tensor where the element type-has a copy constructor and an ```operator=()```:+Note that `setConstant()` can be used on any tensor where the element type+has a copy constructor and an `operator=()`:      Eigen::Tensor<string, 2> a(2, 3);     a.setConstant("yolo");@@ -630,9 +630,9 @@     yolo yolo yolo  -### <Tensor-Type> setZero()+### `<Tensor-Type> setZero()` -Fills the tensor with zeros.  Equivalent to ```setConstant(Scalar(0))```.+Fills the tensor with zeros.  Equivalent to `setConstant(Scalar(0))`. Returns the tensor itself in case you want to chain another call.      a.setZero();@@ -644,7 +644,7 @@     0 0 0 0  -### <Tensor-Type> setValues({..initializer_list})+### `<Tensor-Type> setValues({..initializer_list})`  Fills the tensor with explicit values specified in a std::initializer_list. The type of the initializer list depends on the type and rank of the tensor.@@ -653,10 +653,10 @@ most deeply nested lists must contains P scalars of the Tensor type where P is the size of the last dimension of the Tensor. -For example, for a ```TensorFixedSize<float, 2, 3>``` the initializer list must+For example, for a `TensorFixedSize<float, 2, 3>` the initializer list must contains 2 lists of 3 floats each. -```setValues()``` returns the tensor itself in case you want to chain another+`setValues()` returns the tensor itself in case you want to chain another call.      Eigen::Tensor<float, 2> a(2, 3);@@ -680,7 +680,7 @@     10   20   30     1000 1000 1000 -### <Tensor-Type> setRandom()+### `<Tensor-Type> setRandom()`  Fills the tensor with random values.  Returns the tensor itself in case you want to chain another call.@@ -693,16 +693,16 @@      -0.211234   0.823295   0.536459 -0.0452059       0.566198  -0.604897  -0.444451   0.257742 -You can customize ```setRandom()``` by providing your own random number+You can customize `setRandom()` by providing your own random number generator as a template argument:      a.setRandom<MyRandomGenerator>(); -Here, ```MyRandomGenerator``` must be a struct with the following member-functions, where Scalar and Index are the same as ```<Tensor-Type>::Scalar```-and ```<Tensor-Type>::Index```.+Here, `MyRandomGenerator` must be a struct with the following member+functions, where Scalar and Index are the same as `<Tensor-Type>::``Scalar`+and `<Tensor-Type>::``Index`. -See ```struct UniformRandomGenerator``` in TensorFunctors.h for an example.+See `struct UniformRandomGenerator` in TensorFunctors.h for an example.      // Custom number generator for use with setRandom().     struct MyRandomGenerator {@@ -747,7 +747,7 @@ wrapped in a TensorRef.  -### Scalar* data() and const Scalar* data() const+### `Scalar* data()` and `const Scalar* data() const`  Returns a pointer to the storage for the tensor.  The pointer is const if the tensor was const.  This allows direct access to the data.  The layout of the@@ -767,7 +767,7 @@  ## Tensor Operations -All the methods documented below return non evaluated tensor ```Operations```.+All the methods documented below return non evaluated tensor `Operations`. These can be chained: you can apply another Tensor Operation to the value returned by the method. @@ -775,10 +775,10 @@ tensor.  See "Controlling when Expression are Evaluated" for more details about their evaluation. -### <Operation> constant(const Scalar& val)+### `<Operation> constant(const Scalar& val)`  Returns a tensor of the same type and dimensions as the original tensor but-where all elements have the value ```val```.+where all elements have the value `val`.  This is useful, for example, when you want to add or subtract a constant from a tensor, or multiply every element of a tensor by a scalar.@@ -803,14 +803,14 @@     0.6 0.6 0.6     0.6 0.6 0.6 -### <Operation> random()+### `<Operation> random()`  Returns a tensor of the same type and dimensions as the current tensor but where all elements have random values.  This is for example useful to add random values to an existing tensor. The generation of random values can be customized in the same manner-as for ```setRandom()```.+as for `setRandom()`.      Eigen::Tensor<float, 2> a(2, 3);     a.setConstant(1.0f);@@ -833,7 +833,7 @@ of the same type and dimensions as the tensor to which they are applied.  The requested operations are applied to each element independently. -### <Operation> operator-()+### `<Operation> operator-()`  Returns a tensor of the same type and dimensions as the original tensor containing the opposite values of the original tensor.@@ -852,42 +852,42 @@     -1 -1 -1     -1 -1 -1 -### <Operation> sqrt()+### `<Operation> sqrt()`  Returns a tensor of the same type and dimensions as the original tensor containing the square roots of the original tensor. -### <Operation> rsqrt()+### `<Operation> rsqrt()`  Returns a tensor of the same type and dimensions as the original tensor containing the inverse square roots of the original tensor. -### <Operation> square()+### `<Operation> square()`  Returns a tensor of the same type and dimensions as the original tensor containing the squares of the original tensor values. -### <Operation> inverse()+### `<Operation> inverse()`  Returns a tensor of the same type and dimensions as the original tensor containing the inverse of the original tensor values. -### <Operation> exp()+### `<Operation> exp()`  Returns a tensor of the same type and dimensions as the original tensor containing the exponential of the original tensor. -### <Operation> log()+### `<Operation> log()`  Returns a tensor of the same type and dimensions as the original tensor containing the natural logarithms of the original tensor. -### <Operation> abs()+### `<Operation> abs()`  Returns a tensor of the same type and dimensions as the original tensor containing the absolute values of the original tensor. -### <Operation> pow(Scalar exponent)+### `<Operation> pow(Scalar exponent)`  Returns a tensor of the same type and dimensions as the original tensor containing the coefficients of the original tensor to the power of the@@ -914,17 +914,17 @@     0 1 2     3 4 5 -### <Operation>  operator * (Scalar scale)+### `<Operation>  operator * (Scalar scale)`  Multiplies all the coefficients of the input tensor by the provided scale. -### <Operation>  cwiseMax(Scalar threshold)+### `<Operation>  cwiseMax(Scalar threshold)` TODO -### <Operation>  cwiseMin(Scalar threshold)+### `<Operation>  cwiseMin(Scalar threshold)` TODO -### <Operation>  unaryExpr(const CustomUnaryOp& func)+### `<Operation>  unaryExpr(const CustomUnaryOp& func)` TODO  @@ -936,39 +936,39 @@ specified it is also of the same type. The requested operations are applied to each pair of elements independently. -### <Operation> operator+(const OtherDerived& other)+### `<Operation> operator+(const OtherDerived& other)`  Returns a tensor of the same type and dimensions as the input tensors containing the coefficient wise sums of the inputs. -### <Operation> operator-(const OtherDerived& other)+### `<Operation> operator-(const OtherDerived& other)`  Returns a tensor of the same type and dimensions as the input tensors containing the coefficient wise differences of the inputs. -### <Operation> operator*(const OtherDerived& other)+### `<Operation> operator*(const OtherDerived& other)`  Returns a tensor of the same type and dimensions as the input tensors containing the coefficient wise products of the inputs. -### <Operation> operator/(const OtherDerived& other)+### `<Operation> operator/(const OtherDerived& other)`  Returns a tensor of the same type and dimensions as the input tensors containing the coefficient wise quotients of the inputs.  This operator is not supported for integer types. -### <Operation> cwiseMax(const OtherDerived& other)+### `<Operation> cwiseMax(const OtherDerived& other)`  Returns a tensor of the same type and dimensions as the input tensors containing the coefficient wise maximums of the inputs. -### <Operation> cwiseMin(const OtherDerived& other)+### `<Operation> cwiseMin(const OtherDerived& other)`  Returns a tensor of the same type and dimensions as the input tensors containing the coefficient wise mimimums of the inputs. -### <Operation> Logical operators+### `<Operation> Logical operators`  The following logical operators are supported as well: @@ -1013,17 +1013,24 @@     Eigen::Tensor<int, 2> a(2, 3);     a.setValues({{1, 2, 3}, {6, 5, 4}});     Eigen::Tensor<int, 2> b(3, 2);-    a.setValues({{1, 2}, {4, 5}, {5, 6}});+    b.setValues({{1, 2}, {4, 5}, {5, 6}});      // Compute the traditional matrix product-    array<IndexPair<int>, 1> product_dims = { IndexPair(1, 0) };+    Eigen::array<Eigen::IndexPair<int>, 1> product_dims = { Eigen::IndexPair<int>(1, 0) };     Eigen::Tensor<int, 2> AB = a.contract(b, product_dims);      // Compute the product of the transpose of the matrices-    array<IndexPair<int>, 1> transpose_product_dims = { IndexPair(0, 1) };+    Eigen::array<Eigen::IndexPair<int>, 1> transposed_product_dims = { Eigen::IndexPair<int>(0, 1) };     Eigen::Tensor<int, 2> AtBt = a.contract(b, transposed_product_dims); +    // Contraction to scalar value using a double contraction.+    // First coordinate of both tensors are contracted as well as both second coordinates, i.e., this computes the sum of the squares of the elements.+    Eigen::array<Eigen::IndexPair<int>, 2> double_contraction_product_dims = { Eigen::IndexPair<int>(0, 0), Eigen::IndexPair<int>(1, 1) };+    Eigen::Tensor<int, 0> AdoubleContractedA = a.contract(a, double_contraction_product_dims); +    // Extracting the scalar value of the tensor contraction for further usage+    int value = AdoubleContractedA(0);+ ## Reduction Operations  A *Reduction* operation returns a tensor with fewer dimensions than the@@ -1032,13 +1039,13 @@ the dimensions along which the slices are made.  The Eigen Tensor library provides a set of predefined reduction operators such-as ```maximum()``` and ```sum()``` and lets you define additional operators by+as `maximum()` and `sum()` and lets you define additional operators by implementing a few methods from a reductor template.  ### Reduction Dimensions  All reduction operations take a single parameter of type-```<TensorType>::Dimensions``` which can always be specified as an array of+`<TensorType>::``Dimensions` which can always be specified as an array of ints.  These are called the "reduction dimensions."  The values are the indices of the dimensions of the input tensor over which the reduction is done.  The parameter can have at most as many element as the rank of the input tensor;@@ -1119,52 +1126,52 @@     276  -### <Operation> sum(const Dimensions& new_dims)-### <Operation> sum()+### `<Operation> sum(const Dimensions& new_dims)`+### `<Operation> sum()`  Reduce a tensor using the sum() operator.  The resulting values are the sum of the reduced values. -### <Operation> mean(const Dimensions& new_dims)-### <Operation> mean()+### `<Operation> mean(const Dimensions& new_dims)`+### `<Operation> mean()`  Reduce a tensor using the mean() operator.  The resulting values are the mean of the reduced values. -### <Operation> maximum(const Dimensions& new_dims)-### <Operation> maximum()+### `<Operation> maximum(const Dimensions& new_dims)`+### `<Operation> maximum()`  Reduce a tensor using the maximum() operator.  The resulting values are the largest of the reduced values. -### <Operation> minimum(const Dimensions& new_dims)-### <Operation> minimum()+### `<Operation> minimum(const Dimensions& new_dims)`+### `<Operation> minimum()`  Reduce a tensor using the minimum() operator.  The resulting values are the smallest of the reduced values. -### <Operation> prod(const Dimensions& new_dims)-### <Operation> prod()+### `<Operation> prod(const Dimensions& new_dims)`+### `<Operation> prod()`  Reduce a tensor using the prod() operator.  The resulting values are the product of the reduced values. -### <Operation> all(const Dimensions& new_dims)-### <Operation> all()+### `<Operation> all(const Dimensions& new_dims)`+### `<Operation> all()` Reduce a tensor using the all() operator.  Casts tensor to bool and then checks whether all elements are true.  Runs through all elements rather than short-circuiting, so may be significantly inefficient. -### <Operation> any(const Dimensions& new_dims)-### <Operation> any()+### `<Operation> any(const Dimensions& new_dims)`+### `<Operation> any()` Reduce a tensor using the any() operator.  Casts tensor to bool and then checks whether any element is true.  Runs through all elements rather than short-circuiting, so may be significantly inefficient.  -### <Operation> reduce(const Dimensions& new_dims, const Reducer& reducer)+### `<Operation> reduce(const Dimensions& new_dims, const Reducer& reducer)` -Reduce a tensor using a user-defined reduction operator.  See ```SumReducer```+Reduce a tensor using a user-defined reduction operator.  See `SumReducer` in TensorFunctors.h for information on how to implement a reduction operator.  @@ -1191,24 +1198,24 @@     =>     a     1 2 3-    6 5 4+    4 5 6      b     1  3  6     4  9 15 -### <Operation> cumsum(const Index& axis)+### `<Operation> cumsum(const Index& axis)`  Perform a scan by summing consecutive entries. -### <Operation> cumprod(const Index& axis)+### `<Operation> cumprod(const Index& axis)`  Perform a scan by multiplying consecutive entries.   ## Convolutions -### <Operation> convolve(const Kernel& kernel, const Dimensions& dims)+### `<Operation> convolve(const Kernel& kernel, const Dimensions& dims)`  Returns a tensor that is the output of the convolution of the input tensor with the kernel, along the specified dimensions of the input tensor. The dimension size for dimensions of the output tensor@@ -1251,7 +1258,7 @@ Tensor.  They can be used to access slices of tensors, see them with different dimensions, or pad tensors with additional data. -### <Operation> reshape(const Dimensions& new_dims)+### `<Operation> reshape(const Dimensions& new_dims)`  Returns a view of the input tensor that has been reshaped to the specified new dimensions.  The argument new_dims is an array of Index values.  The@@ -1273,7 +1280,7 @@ This operation does not move any data in the input tensor, so the resulting contents of a reshaped Tensor depend on the data layout of the original Tensor. -For example this is what happens when you ```reshape()``` a 2D ColMajor tensor+For example this is what happens when you `reshape()` a 2D ColMajor tensor to one dimension:      Eigen::Tensor<float, 2, Eigen::ColMajor> a(2, 3);@@ -1314,7 +1321,7 @@     Eigen::Tensor<float, 2, Eigen::ColMajor> a(2, 3);     a.setValues({{0.0f, 100.0f, 200.0f}, {300.0f, 400.0f, 500.0f}});     Eigen::array<Eigen::DenseIndex, 2> two_dim({2, 3});-    Eigen::Tensor<float, 1, Eigen::ColMajor> b;+    Eigen::Tensor<float, 1, Eigen::ColMajor> b(6);     b.reshape(two_dim) = a;     cout << "b" << endl << b << endl;     =>@@ -1330,7 +1337,7 @@ the reshape view of b.  -### <Operation> shuffle(const Shuffle& shuffle)+### `<Operation> shuffle(const Shuffle& shuffle)`  Returns a copy of the input tensor whose dimensions have been reordered according to the specified permutation. The argument shuffle@@ -1371,14 +1378,14 @@     output.shuffle({2, 0, 1}) = input;  -### <Operation> stride(const Strides& strides)+### `<Operation> stride(const Strides& strides)`  Returns a view of the input tensor that strides (skips stride-1 elements) along each of the dimensions.  The argument strides is an array of Index values.  The dimensions of the resulting tensor are ceil(input_dimensions[i] / strides[i]). -For example this is what happens when you ```stride()``` a 2D tensor:+For example this is what happens when you `stride()` a 2D tensor:      Eigen::Tensor<int, 2> a(4, 3);     a.setValues({{0, 100, 200}, {300, 400, 500}, {600, 700, 800}, {900, 1000, 1100}});@@ -1397,7 +1404,7 @@     output.stride({2, 3, 4}) = input;  -### <Operation> slice(const StartIndices& offsets, const Sizes& extents)+### `<Operation> slice(const StartIndices& offsets, const Sizes& extents)`  Returns a sub-tensor of the given tensor. For each dimension i, the slice is made of the coefficients stored between offset[i] and offset[i] + extents[i] in@@ -1423,7 +1430,7 @@      600   700  -### <Operation> chip(const Index offset, const Index dim)+### `<Operation> chip(const Index offset, const Index dim)`  A chip is a special kind of slice. It is the subtensor at the given offset in the dimension dim. The returned tensor has one fewer dimension than the input@@ -1474,7 +1481,7 @@          0     0     0  -### <Operation> reverse(const ReverseDimensions& reverse)+### `<Operation> reverse(const ReverseDimensions& reverse)`  Returns a view of the input tensor that reverses the order of the coefficients along a subset of the dimensions.  The argument reverse is an array of boolean@@ -1482,7 +1489,7 @@ reversed along each of the dimensions.  This operation preserves the dimensions of the input tensor. -For example this is what happens when you ```reverse()``` the first dimension+For example this is what happens when you `reverse()` the first dimension of a 2D tensor:      Eigen::Tensor<int, 2> a(4, 3);@@ -1504,7 +1511,7 @@        0   100   200  -### <Operation> broadcast(const Broadcast& broadcast)+### `<Operation> broadcast(const Broadcast& broadcast)`  Returns a view of the input tensor in which the input is replicated one to many times.@@ -1528,11 +1535,11 @@        0   100   200    0   100   200      300   400   500  300   400   500 -### <Operation> concatenate(const OtherDerived& other, Axis axis)+### `<Operation> concatenate(const OtherDerived& other, Axis axis)`  TODO -### <Operation>  pad(const PaddingDimensions& padding)+### `<Operation>  pad(const PaddingDimensions& padding)`  Returns a view of the input tensor in which the input is padded with zeros. @@ -1557,7 +1564,7 @@        0     0     0    0  -### <Operation>  extract_patches(const PatchDims& patch_dims)+### `<Operation>  extract_patches(const PatchDims& patch_dims)`  Returns a tensor of coefficient patches extracted from the input tensor, where each patch is of dimension specified by 'patch_dims'. The returned tensor has@@ -1644,9 +1651,7 @@ 6 7 10 11 -### <Operation>  extract_image_patches(const Index patch_rows, const Index patch_cols,-                          const Index row_stride, const Index col_stride,-                          const PaddingType padding_type)+### `<Operation>  extract_image_patches(const Index patch_rows, const Index patch_cols, const Index row_stride, const Index col_stride, const PaddingType padding_type)`  Returns a tensor of coefficient image patches extracted from the input tensor, which is expected to have dimensions ordered as follows (depending on the data@@ -1701,7 +1706,7 @@  ## Special Operations -### <Operation> cast<T>()+### `<Operation> cast<T>()`  Returns a tensor of type T with the same dimensions as the original tensor. The returned tensor contains the values of the original tensor converted to@@ -1730,18 +1735,16 @@     1 2 2  -### <Operation>     eval()+### `<Operation>     eval()`  TODO   ## Representation of scalar values -Scalar values are often represented by tensors of size 1 and rank 1. It would be-more logical and user friendly to use tensors of rank 0 instead. For example-Tensor<T, N>::maximum() currently returns a Tensor<T, 1>. Similarly, the inner-product of 2 1d tensors (through contractions) returns a 1d tensor. In the-future these operations might be updated to return 0d tensors instead.+Scalar values are often represented by tensors of size 1 and rank 0.For example+Tensor<T, N>::maximum() currently returns a Tensor<T, 0>. Similarly, the inner+product of 2 1d tensors (through contractions) returns a 0d tensor.  ## Limitations 
eigen3/unsupported/Eigen/CXX11/src/Tensor/Tensor.h view
@@ -23,12 +23,12 @@   * The %Tensor class encompasses only dynamic-size objects so far.   *   * The first two template parameters are required:-  * \tparam Scalar_ \anchor tensor_tparam_scalar Numeric type, e.g. float, double, int or std::complex<float>.+  * \tparam Scalar_  Numeric type, e.g. float, double, int or `std::complex<float>`.   *                 User defined scalar types are supported as well (see \ref user_defined_scalars "here").   * \tparam NumIndices_ Number of indices (i.e. rank of the tensor)   *   * The remaining template parameters are optional -- in most cases you don't have to worry about them.-  * \tparam Options_ \anchor tensor_tparam_options A combination of either \b #RowMajor or \b #ColMajor, and of either+  * \tparam Options_  A combination of either \b #RowMajor or \b #ColMajor, and of either   *                 \b #AutoAlign or \b #DontAlign.   *                 The former controls \ref TopicStorageOrders "storage order", and defaults to column-major. The latter controls alignment, which is required   *                 for vectorization. It defaults to aligning tensors. Note that tensors currently do not support any operations that profit from vectorization.@@ -42,13 +42,13 @@   * \endcode   *   * This class can be extended with the help of the plugin mechanism described on the page-  * \ref TopicCustomizingEigen by defining the preprocessor symbol \c EIGEN_TENSOR_PLUGIN.+  * \ref TopicCustomizing_Plugins by defining the preprocessor symbol \c EIGEN_TENSOR_PLUGIN.   *   * <i><b>Some notes:</b></i>   *   * <dl>   * <dt><b>Relation to other parts of Eigen:</b></dt>-  * <dd>The midterm developement goal for this class is to have a similar hierarchy as Eigen uses for matrices, so that+  * <dd>The midterm development goal for this class is to have a similar hierarchy as Eigen uses for matrices, so that   * taking blocks or using tensors in expressions is easily possible, including an interface with the vector/matrix code   * by providing .asMatrix() and .asVector() (or similar) methods for rank 2 and 1 tensors. However, currently, the %Tensor   * class does not provide any of these features and is only available as a stand-alone class that just allows for
eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorBase.h view
@@ -22,7 +22,9 @@   * This class is the common parent of the Tensor and TensorMap class, thus   * making it possible to use either class interchangably in expressions.   */-+#ifndef EIGEN_PARSED_BY_DOXYGEN+// FIXME Doxygen does not like the inheritance with different template parameters+// Since there is no doxygen documentation inside, we disable it for now template<typename Derived> class TensorBase<Derived, ReadOnlyAccessors> {@@ -1004,7 +1006,7 @@     EIGEN_DEVICE_FUNC     EIGEN_STRONG_INLINE const Derived& derived() const { return *static_cast<const Derived*>(this); } };-+#endif // EIGEN_PARSED_BY_DOXYGEN } // end namespace Eigen  #endif // EIGEN_CXX11_TENSOR_TENSOR_BASE_H
eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorContractionThreadPool.h view
@@ -116,15 +116,6 @@   template <bool lhs_inner_dim_contiguous, bool rhs_inner_dim_contiguous,             bool rhs_inner_dim_reordered, int Alignment>   void evalProduct(Scalar* buffer) const {-    typedef-        typename internal::remove_const<typename EvalLeftArgType::Scalar>::type-            LhsScalar;-    typedef-        typename internal::remove_const<typename EvalRightArgType::Scalar>::type-            RhsScalar;-    typedef typename internal::gebp_traits<LhsScalar, RhsScalar> Traits;-    typedef TensorEvaluator<EvalLeftArgType, Device> LeftEvaluator;-    typedef TensorEvaluator<EvalRightArgType, Device> RightEvaluator;     typedef internal::TensorContractionInputMapper<         LhsScalar, Index, internal::Lhs, LeftEvaluator, left_nocontract_t,         contract_t, internal::packet_traits<LhsScalar>::size,
eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorDeviceThreadPool.h view
@@ -196,9 +196,11 @@     // of blocks to be evenly dividable across threads.      double block_size_f = 1.0 / CostModel::taskSize(1, cost);-    Index block_size = numext::mini(n, numext::maxi<Index>(1, block_size_f));-    const Index max_block_size =-        numext::mini(n, numext::maxi<Index>(1, 2 * block_size_f));+    const Index max_oversharding_factor = 4;+    Index block_size = numext::mini(+        n, numext::maxi<Index>(divup<Index>(n, max_oversharding_factor * numThreads()),+                               block_size_f));+    const Index max_block_size = numext::mini(n, 2 * block_size);     if (block_align) {       Index new_block_size = block_align(block_size);       eigen_assert(new_block_size >= block_size);@@ -212,7 +214,8 @@         (divup<int>(block_count, numThreads()) * numThreads());     // Now try to increase block size up to max_block_size as long as it     // doesn't decrease parallel efficiency.-    for (Index prev_block_count = block_count; prev_block_count > 1;) {+    for (Index prev_block_count = block_count;+         max_efficiency < 1.0 && prev_block_count > 1;) {       // This is the next block size that divides size into a smaller number       // of blocks than the current block_size.       Index coarser_block_size = divup(n, prev_block_count - 1);
eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorDimensions.h view
@@ -192,7 +192,7 @@   } #endif -  EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE DenseIndex operator[] (const int index) const {+  EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Index operator[] (const Index index) const {     switch (index) {       case 0:         return internal::get<0, Base>::value;@@ -206,7 +206,7 @@         return internal::get<4, Base>::value;       default:         eigen_assert(false && "index overflow");-        return static_cast<DenseIndex>(-1);+        return static_cast<Index>(-1);     }   } 
eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorForcedEval.h view
@@ -12,19 +12,6 @@  namespace Eigen { -/** \class TensorForcedEval-  * \ingroup CXX11_Tensor_Module-  *-  * \brief Tensor reshaping class.-  *-  *-  */-/// template <class> class MakePointer_ is added to convert the host pointer to the device pointer.-/// It is added due to the fact that for our device compiler T* is not allowed.-/// If we wanted to use the same Evaluator functions we have to convert that type to our pointer T.-/// This is done through our MakePointer_ class. By default the Type in the MakePointer_<T> is T* .-/// Therefore, by adding the default value, we managed to convert the type and it does not break any-/// existing code as its default value is T*. namespace internal { template<typename XprType, template <class> class MakePointer_> struct traits<TensorForcedEvalOp<XprType, MakePointer_> >@@ -65,6 +52,21 @@   +// FIXME use proper doxygen documentation (e.g. \tparam MakePointer_)++/** \class TensorForcedEvalOp+  * \ingroup CXX11_Tensor_Module+  *+  * \brief Tensor reshaping class.+  *+  *+  */+/// `template <class> class MakePointer_` is added to convert the host pointer to the device pointer.+/// It is added due to the fact that for our device compiler `T*` is not allowed.+/// If we wanted to use the same Evaluator functions we have to convert that type to our pointer `T`.+/// This is done through our `MakePointer_` class. By default the Type in the `MakePointer_<T>` is `T*` .+/// Therefore, by adding the default value, we managed to convert the type and it does not break any+/// existing code as its default value is `T*`. template<typename XprType, template <class> class MakePointer_> class TensorForcedEvalOp : public TensorBase<TensorForcedEvalOp<XprType, MakePointer_>, ReadOnlyAccessors> {
eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorGenerator.h view
@@ -12,7 +12,7 @@  namespace Eigen { -/** \class TensorGenerator+/** \class TensorGeneratorOp   * \ingroup CXX11_Tensor_Module   *   * \brief Tensor generator class.
eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorMap.h view
@@ -12,18 +12,20 @@  namespace Eigen { +// FIXME use proper doxygen documentation (e.g. \tparam MakePointer_)+ /** \class TensorMap   * \ingroup CXX11_Tensor_Module   *   * \brief A tensor expression mapping an existing array of data.   *   */-/// template <class> class MakePointer_ is added to convert the host pointer to the device pointer.-/// It is added due to the fact that for our device compiler T* is not allowed.-/// If we wanted to use the same Evaluator functions we have to convert that type to our pointer T.-/// This is done through our MakePointer_ class. By default the Type in the MakePointer_<T> is T* .+/// `template <class> class MakePointer_` is added to convert the host pointer to the device pointer.+/// It is added due to the fact that for our device compiler `T*` is not allowed.+/// If we wanted to use the same Evaluator functions we have to convert that type to our pointer `T`.+/// This is done through our `MakePointer_` class. By default the Type in the `MakePointer_<T>` is `T*` . /// Therefore, by adding the default value, we managed to convert the type and it does not break any-/// existing code as its default value is T*.+/// existing code as its default value is `T*`. template<typename PlainObjectType, int Options_, template <class> class MakePointer_> class TensorMap : public TensorBase<TensorMap<PlainObjectType, Options_, MakePointer_> > {   public:
eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorStorage.h view
@@ -31,12 +31,12 @@   *   * \sa Tensor   */-template<typename T, typename Dimensions, int Options_> class TensorStorage;+template<typename T, typename Dimensions, int Options> class TensorStorage;   // Pure fixed-size storage-template<typename T, int Options_, typename FixedDimensions>-class TensorStorage<T, FixedDimensions, Options_>+template<typename T, typename FixedDimensions, int Options_>+class TensorStorage {  private:   static const std::size_t Size = FixedDimensions::total_size;@@ -66,7 +66,7 @@   // pure dynamic-template<typename T, int Options_, typename IndexType, int NumIndices_>+template<typename T, typename IndexType, int NumIndices_, int Options_> class TensorStorage<T, DSizes<IndexType, NumIndices_>, Options_> {   public:
eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorSyclExprConstructor.h view
@@ -33,7 +33,7 @@   EvalToLHSConstructor(const utility::tuple::Tuple<Params...> &t): expr((&(*(utility::tuple::get<N>(t).get_pointer())))) {} }; -/// \struct ExprConstructor is used to reconstruct the expression on the device and+/// struct ExprConstructor is used to reconstruct the expression on the device and /// recreate the expression with MakeGlobalPointer containing the device address /// space for the TensorMap pointers used in eval function. /// It receives the original expression type, the functor of the node, the tuple
eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorSyclExtractAccessor.h view
@@ -35,7 +35,7 @@ namespace Eigen { namespace TensorSycl { namespace internal {-/// \struct ExtractAccessor: Extract Accessor Class is used to extract the+/// struct ExtractAccessor: Extract Accessor Class is used to extract the /// accessor from a buffer. /// Depending on the type of the leaf node we can get a read accessor or a /// read_write accessor
eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorSyclExtractFunctors.h view
@@ -25,7 +25,7 @@ namespace Eigen { namespace TensorSycl { namespace internal {-/// \struct FunctorExtractor:  This struct is used to extract the functors+/// struct FunctorExtractor:  This struct is used to extract the functors /// constructed on /// the host-side, to pack them and reuse them in reconstruction of the /// expression on the device.
eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorSyclTuple.h view
@@ -34,7 +34,7 @@  /// \struct Tuple /// \brief is a fixed-size collection of heterogeneous values-/// \ztparam Ts...	-	the types of the elements that the tuple stores.+/// \tparam Ts...	-	the types of the elements that the tuple stores. /// Empty list is supported. template <class... Ts> struct Tuple {};@@ -147,6 +147,8 @@ template <size_t MIN, size_t N, size_t... Is> struct RangeBuilder; +// FIXME Doxygen has problems with recursive inheritance+#ifndef EIGEN_PARSED_BY_DOXYGEN /// \brief base Step: Specialisation of the \ref RangeBuilder when the /// MIN==MAX. In this case the Is... is [0 to sizeof...(tuple elements)) /// \tparam MIN is the starting index of the tuple@@ -164,6 +166,7 @@ /// \tparam Is... are the list of generated index so far template <size_t MIN, size_t N, size_t... Is> struct RangeBuilder : public RangeBuilder<MIN, N - 1, N - 1, Is...> {};+#endif // EIGEN_PARSED_BY_DOXYGEN  /// \brief IndexRange that returns a [MIN, MAX) index range /// \tparam MIN is the starting index in the tuple
eigen3/unsupported/Eigen/CXX11/src/TensorSymmetry/util/TemplateGroupTheory.h view
@@ -17,7 +17,7 @@ namespace group_theory {  /** \internal-  * \file CXX11/Tensor/util/TemplateGroupTheory.h+  * \file CXX11/src/TensorSymmetry/util/TemplateGroupTheory.h   * This file contains C++ templates that implement group theory algorithms.   *   * The algorithms allow for a compile-time analysis of finite groups.@@ -167,7 +167,9 @@   typename elements,   bool dont_add_current_element   // = false >-struct dimino_first_step_elements_helper :+struct dimino_first_step_elements_helper+#ifndef EIGEN_PARSED_BY_DOXYGEN+  : // recursive inheritance is too difficult for Doxygen   public dimino_first_step_elements_helper<     Multiply,     Equality,@@ -187,6 +189,7 @@   typename elements > struct dimino_first_step_elements_helper<Multiply, Equality, id, g, current_element, elements, true>+#endif // EIGEN_PARSED_BY_DOXYGEN {   typedef elements type;   constexpr static int global_flags = Equality<current_element, id>::global_flags;
eigen3/unsupported/Eigen/CXX11/src/util/EmulateCXX11Meta.h view
@@ -188,7 +188,7 @@ } template<typename t> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE t array_prod(const array<t, 0>& /*a*/) {-  return 0;+  return 1; }  template<typename t>
eigen3/unsupported/Eigen/FFT view
@@ -289,6 +289,7 @@     void inv( MatrixBase<OutputDerived> & dst, const MatrixBase<ComplexDerived> & src, Index nfft=-1)     {       typedef typename ComplexDerived::Scalar src_type;+      typedef typename ComplexDerived::RealScalar real_type;       typedef typename OutputDerived::Scalar dst_type;       const bool realfft= (NumTraits<dst_type>::IsComplex == 0);       EIGEN_STATIC_ASSERT_VECTOR_ONLY(OutputDerived)@@ -329,9 +330,9 @@             tmp.head(nhead) = src.head(nhead);             tmp.tail(ntail) = src.tail(ntail);             if (resize_input<0) { //shrinking -- create the Nyquist bin as the average of the two bins that fold into it-              tmp(nhead) = ( src(nfft/2) + src( src.size() - nfft/2 ) )*src_type(.5);+              tmp(nhead) = ( src(nfft/2) + src( src.size() - nfft/2 ) )*real_type(.5);             }else{ // expanding -- split the old Nyquist bin into two halves-              tmp(nhead) = src(nhead) * src_type(.5);+              tmp(nhead) = src(nhead) * real_type(.5);               tmp(tmp.size()-nhead) = tmp(nhead);             }           }
eigen3/unsupported/Eigen/MatrixFunctions view
@@ -161,8 +161,8 @@ \include MatrixExponential.cpp Output: \verbinclude MatrixExponential.out -\note \p M has to be a matrix of \c float, \c double, \c long double-\c complex<float>, \c complex<double>, or \c complex<long double> .+\note \p M has to be a matrix of \c float, \c double, `long double`+\c complex<float>, \c complex<double>, or `complex<long double>` .   \subsection matrixbase_log MatrixBase::log()@@ -219,9 +219,8 @@ \include MatrixLogarithm.cpp Output: \verbinclude MatrixLogarithm.out -\note \p M has to be a matrix of \c float, \c double, <tt>long-double</tt>, \c complex<float>, \c complex<double>, or \c complex<long-double> .+\note \p M has to be a matrix of \c float, \c double, `long+double`, \c complex<float>, \c complex<double>, or `complex<long double>`.  \sa MatrixBase::exp(), MatrixBase::matrixFunction(),      class MatrixLogarithmAtomic, MatrixBase::sqrt().@@ -326,9 +325,9 @@ \include MatrixPower_optimal.cpp Output: \verbinclude MatrixPower_optimal.out -\note \p M has to be a matrix of \c float, \c double, <tt>long-double</tt>, \c complex<float>, \c complex<double>, or \c complex<long-double> .+\note \p M has to be a matrix of \c float, \c double, `long+double`, \c complex<float>, \c complex<double>, or+\c complex<long double> .  \sa MatrixBase::exp(), MatrixBase::log(), class MatrixPower. 
eigen3/unsupported/Eigen/OpenGLSupport view
@@ -184,7 +184,7 @@ } inline void glRotate(const Rotation2D<double>& rot) {-  glRotated(rot.angle()*180.0/EIGEN_PI, 0.0, 0.0, 1.0);+  glRotated(rot.angle()*180.0/double(EIGEN_PI), 0.0, 0.0, 1.0); }  template<typename Derived> void glRotate(const RotationBase<Derived,3>& rot)
eigen3/unsupported/Eigen/src/AutoDiff/AutoDiffScalar.h view
@@ -534,7 +534,8 @@   EIGEN_EXPR_BINARYOP_SCALAR_RETURN_TYPE(typename Eigen::internal::remove_all<DerType>::type, typename Eigen::internal::traits<typename Eigen::internal::remove_all<DerType>::type>::Scalar, product) > \   FUNC(const Eigen::AutoDiffScalar<DerType>& x) { \     using namespace Eigen; \-    EIGEN_UNUSED typedef typename Eigen::internal::traits<typename Eigen::internal::remove_all<DerType>::type>::Scalar Scalar; \+    typedef typename Eigen::internal::traits<typename Eigen::internal::remove_all<DerType>::type>::Scalar Scalar; \+    EIGEN_UNUSED_VARIABLE(sizeof(Scalar)); \     CODE; \   } 
eigen3/unsupported/Eigen/src/BVH/KdBVH.h view
@@ -35,6 +35,7 @@   {     outBoxes.insert(outBoxes.end(), boxBegin, boxEnd);     eigen_assert(outBoxes.size() == objects.size());+    EIGEN_ONLY_USED_FOR_DEBUG(objects);   } }; 
eigen3/unsupported/Eigen/src/IterativeSolvers/DGMRES.h view
@@ -39,7 +39,6 @@ void sortWithPermutation (VectorType& vec, IndexType& perm, typename IndexType::Scalar& ncut) {   eigen_assert(vec.size() == perm.size());-  typedef typename IndexType::Scalar Index;    bool flag;    for (Index k  = 0; k < ncut; k++)   {@@ -112,7 +111,6 @@     using Base::_solve_impl;     typedef _MatrixType MatrixType;     typedef typename MatrixType::Scalar Scalar;-    typedef typename MatrixType::Index Index;     typedef typename MatrixType::StorageIndex StorageIndex;     typedef typename MatrixType::RealScalar RealScalar;     typedef _Preconditioner Preconditioner;@@ -146,7 +144,7 @@   void _solve_with_guess_impl(const Rhs& b, Dest& x) const   {         bool failed = false;-    for(int j=0; j<b.cols(); ++j)+    for(Index j=0; j<b.cols(); ++j)     {       m_iterations = Base::maxIterations();       m_error = Base::m_tolerance;@@ -170,17 +168,17 @@   /**     * Get the restart value     */-  int restart() { return m_restart; }+  Index restart() { return m_restart; }      /**     * Set the restart value (default is 30)      */-  void set_restart(const int restart) { m_restart=restart; }+  void set_restart(const Index restart) { m_restart=restart; }      /**     * Set the number of eigenvalues to deflate at each restart     */-  void setEigenv(const int neig) +  void setEigenv(const Index neig)    {     m_neig = neig;     if (neig+1 > m_maxNeig) m_maxNeig = neig+1; // To allow for complex conjugates@@ -189,12 +187,12 @@   /**     * Get the size of the deflation subspace size    */ -  int deflSize() {return m_r; }+  Index deflSize() {return m_r; }      /**    * Set the maximum size of the deflation subspace    */-  void setMaxEigenv(const int maxNeig) { m_maxNeig = maxNeig; }+  void setMaxEigenv(const Index maxNeig) { m_maxNeig = maxNeig; }      protected:     // DGMRES algorithm @@ -202,12 +200,12 @@     void dgmres(const MatrixType& mat,const Rhs& rhs, Dest& x, const Preconditioner& precond) const;     // Perform one cycle of GMRES     template<typename Dest>-    int dgmresCycle(const MatrixType& mat, const Preconditioner& precond, Dest& x, DenseVector& r0, RealScalar& beta, const RealScalar& normRhs, int& nbIts) const; +    Index dgmresCycle(const MatrixType& mat, const Preconditioner& precond, Dest& x, DenseVector& r0, RealScalar& beta, const RealScalar& normRhs, Index& nbIts) const;      // Compute data to use for deflation -    int dgmresComputeDeflationData(const MatrixType& mat, const Preconditioner& precond, const Index& it, StorageIndex& neig) const;+    Index dgmresComputeDeflationData(const MatrixType& mat, const Preconditioner& precond, const Index& it, StorageIndex& neig) const;     // Apply deflation to a vector     template<typename RhsType, typename DestType>-    int dgmresApplyDeflation(const RhsType& In, DestType& Out) const; +    Index dgmresApplyDeflation(const RhsType& In, DestType& Out) const;      ComplexVector schurValues(const ComplexSchur<DenseMatrix>& schurofH) const;     ComplexVector schurValues(const RealSchur<DenseMatrix>& schurofH) const;     // Init data for deflation@@ -221,8 +219,8 @@     mutable DenseMatrix m_T; /* T=U^T*M^{-1}*A*U */     mutable PartialPivLU<DenseMatrix> m_luT; // LU factorization of m_T     mutable StorageIndex m_neig; //Number of eigenvalues to extract at each restart-    mutable int m_r; // Current number of deflated eigenvalues, size of m_U-    mutable int m_maxNeig; // Maximum number of eigenvalues to deflate+    mutable Index m_r; // Current number of deflated eigenvalues, size of m_U+    mutable Index m_maxNeig; // Maximum number of eigenvalues to deflate     mutable RealScalar m_lambdaN; //Modulus of the largest eigenvalue of A     mutable bool m_isDeflAllocated;     mutable bool m_isDeflInitialized;@@ -244,9 +242,9 @@               const Preconditioner& precond) const {   //Initialization-  int n = mat.rows(); +  Index n = mat.rows();    DenseVector r0(n); -  int nbIts = 0; +  Index nbIts = 0;    m_H.resize(m_restart+1, m_restart);   m_Hes.resize(m_restart, m_restart);   m_V.resize(n,m_restart+1);@@ -284,7 +282,7 @@  */ template< typename _MatrixType, typename _Preconditioner> template<typename Dest>-int DGMRES<_MatrixType, _Preconditioner>::dgmresCycle(const MatrixType& mat, const Preconditioner& precond, Dest& x, DenseVector& r0, RealScalar& beta, const RealScalar& normRhs, int& nbIts) const+Index DGMRES<_MatrixType, _Preconditioner>::dgmresCycle(const MatrixType& mat, const Preconditioner& precond, Dest& x, DenseVector& r0, RealScalar& beta, const RealScalar& normRhs, Index& nbIts) const {   //Initialization    DenseVector g(m_restart+1); // Right hand side of the least square problem@@ -293,8 +291,8 @@   m_V.col(0) = r0/beta;    m_info = NoConvergence;    std::vector<JacobiRotation<Scalar> >gr(m_restart); // Givens rotations-  int it = 0; // Number of inner iterations -  int n = mat.rows();+  Index it = 0; // Number of inner iterations +  Index n = mat.rows();   DenseVector tv1(n), tv2(n);  //Temporary vectors   while (m_info == NoConvergence && it < m_restart && nbIts < m_iterations)   {    @@ -312,7 +310,7 @@         // Orthogonalize it with the previous basis in the basis using modified Gram-Schmidt     Scalar coef; -    for (int i = 0; i <= it; ++i)+    for (Index i = 0; i <= it; ++i)     {        coef = tv1.dot(m_V.col(i));       tv1 = tv1 - coef * m_V.col(i); @@ -328,7 +326,7 @@     // FIXME Check for happy breakdown           // Update Hessenberg matrix with Givens rotations-    for (int i = 1; i <= it; ++i) +    for (Index i = 1; i <= it; ++i)      {       m_H.col(it).applyOnTheLeft(i-1,i,gr[i-1].adjoint());     }@@ -394,7 +392,6 @@ template< typename _MatrixType, typename _Preconditioner> inline typename DGMRES<_MatrixType, _Preconditioner>::ComplexVector DGMRES<_MatrixType, _Preconditioner>::schurValues(const RealSchur<DenseMatrix>& schurofH) const {-  typedef typename MatrixType::Index Index;   const DenseMatrix& T = schurofH.matrixT();   Index it = T.rows();   ComplexVector eig(it);@@ -418,7 +415,7 @@ }  template< typename _MatrixType, typename _Preconditioner>-int DGMRES<_MatrixType, _Preconditioner>::dgmresComputeDeflationData(const MatrixType& mat, const Preconditioner& precond, const Index& it, StorageIndex& neig) const+Index DGMRES<_MatrixType, _Preconditioner>::dgmresComputeDeflationData(const MatrixType& mat, const Preconditioner& precond, const Index& it, StorageIndex& neig) const {   // First, find the Schur form of the Hessenberg matrix H   typename internal::conditional<NumTraits<Scalar>::IsComplex, ComplexSchur<DenseMatrix>, RealSchur<DenseMatrix> >::type schurofH; @@ -433,8 +430,8 @@      // Reorder the absolute values of Schur values   DenseRealVector modulEig(it); -  for (int j=0; j<it; ++j) modulEig(j) = std::abs(eig(j)); -  perm.setLinSpaced(it,0,it-1);+  for (Index j=0; j<it; ++j) modulEig(j) = std::abs(eig(j)); +  perm.setLinSpaced(it,0,internal::convert_index<StorageIndex>(it-1));   internal::sortWithPermutation(modulEig, perm, neig);      if (!m_lambdaN)@@ -442,7 +439,7 @@     m_lambdaN = (std::max)(modulEig.maxCoeff(), m_lambdaN);   }   //Count the real number of extracted eigenvalues (with complex conjugates)-  int nbrEig = 0; +  Index nbrEig = 0;    while (nbrEig < neig)   {     if(eig(perm(it-nbrEig-1)).imag() == RealScalar(0)) nbrEig++; @@ -451,7 +448,7 @@   // Extract the  Schur vectors corresponding to the smallest Ritz values   DenseMatrix Sr(it, nbrEig);    Sr.setZero();-  for (int j = 0; j < nbrEig; j++)+  for (Index j = 0; j < nbrEig; j++)   {     Sr.col(j) = schurofH.matrixU().col(perm(it-j-1));   }@@ -462,8 +459,8 @@   if (m_r)   {    // Orthogonalize X against m_U using modified Gram-Schmidt-   for (int j = 0; j < nbrEig; j++)-     for (int k =0; k < m_r; k++)+   for (Index j = 0; j < nbrEig; j++)+     for (Index k =0; k < m_r; k++)       X.col(j) = X.col(j) - (m_U.col(k).dot(X.col(j)))*m_U.col(k);    }   @@ -473,7 +470,7 @@     dgmresInitDeflation(m);    DenseMatrix MX(m, nbrEig);   DenseVector tv1(m);-  for (int j = 0; j < nbrEig; j++)+  for (Index j = 0; j < nbrEig; j++)   {     tv1 = mat * X.col(j);     MX.col(j) = precond.solve(tv1);@@ -488,8 +485,8 @@   }      // Save X into m_U and m_MX in m_MU-  for (int j = 0; j < nbrEig; j++) m_U.col(m_r+j) = X.col(j);-  for (int j = 0; j < nbrEig; j++) m_MU.col(m_r+j) = MX.col(j);+  for (Index j = 0; j < nbrEig; j++) m_U.col(m_r+j) = X.col(j);+  for (Index j = 0; j < nbrEig; j++) m_MU.col(m_r+j) = MX.col(j);   // Increase the size of the invariant subspace   m_r += nbrEig;    @@ -502,7 +499,7 @@ } template<typename _MatrixType, typename _Preconditioner> template<typename RhsType, typename DestType>-int DGMRES<_MatrixType, _Preconditioner>::dgmresApplyDeflation(const RhsType &x, DestType &y) const+Index DGMRES<_MatrixType, _Preconditioner>::dgmresApplyDeflation(const RhsType &x, DestType &y) const {   DenseVector x1 = m_U.leftCols(m_r).transpose() * x;    y = x + m_U.leftCols(m_r) * ( m_lambdaN * m_luT.solve(x1) - x1);
eigen3/unsupported/Eigen/src/IterativeSolvers/GMRES.h view
@@ -21,7 +21,7 @@ * * Parameters: *  \param mat       matrix of linear system of equations-*  \param Rhs       right hand side vector of linear system of equations+*  \param rhs       right hand side vector of linear system of equations *  \param x         on input: initial guess, on output: solution *  \param precond   preconditioner used *  \param iters     on input: maximum number of iterations to perform
eigen3/unsupported/Eigen/src/MatrixFunctions/MatrixExponential.h view
@@ -234,12 +234,13 @@ template <typename MatrixType> struct matrix_exp_computeUV<MatrixType, double> {+  typedef typename NumTraits<typename traits<MatrixType>::Scalar>::Real RealScalar;   template <typename ArgType>   static void run(const ArgType& arg, MatrixType& U, MatrixType& V, int& squarings)   {     using std::frexp;     using std::pow;-    const double l1norm = arg.cwiseAbs().colwise().sum().maxCoeff();+    const RealScalar l1norm = arg.cwiseAbs().colwise().sum().maxCoeff();     squarings = 0;     if (l1norm < 1.495585217958292e-002) {       matrix_exp_pade3(arg, U, V);@@ -250,10 +251,10 @@     } else if (l1norm < 2.097847961257068e+000) {       matrix_exp_pade9(arg, U, V);     } else {-      const double maxnorm = 5.371920351148152;+      const RealScalar maxnorm = 5.371920351148152;       frexp(l1norm / maxnorm, &squarings);       if (squarings < 0) squarings = 0;-      MatrixType A = arg.unaryExpr(MatrixExponentialScalingOp<double>(squarings));+      MatrixType A = arg.unaryExpr(MatrixExponentialScalingOp<RealScalar>(squarings));       matrix_exp_pade13(A, U, V);     }   }@@ -326,6 +327,7 @@     } else if (l1norm < 1.125358383453143065081397882891878e+000L) {       matrix_exp_pade13(arg, U, V);     } else {+      const long double maxnorm = 2.884233277829519311757165057717815L;       frexp(l1norm / maxnorm, &squarings);       if (squarings < 0) squarings = 0;       MatrixType A = arg.unaryExpr(MatrixExponentialScalingOp<long double>(squarings));@@ -342,33 +344,41 @@   } }; +template<typename T> struct is_exp_known_type : false_type {};+template<> struct is_exp_known_type<float> : true_type {};+template<> struct is_exp_known_type<double> : true_type {};+#if LDBL_MANT_DIG <= 112+template<> struct is_exp_known_type<long double> : true_type {};+#endif +template <typename ArgType, typename ResultType>+void matrix_exp_compute(const ArgType& arg, ResultType &result, true_type) // natively supported scalar type+{+  typedef typename ArgType::PlainObject MatrixType;+  MatrixType U, V;+  int squarings;+  matrix_exp_computeUV<MatrixType>::run(arg, U, V, squarings); // Pade approximant is (U+V) / (-U+V)+  MatrixType numer = U + V;+  MatrixType denom = -U + V;+  result = denom.partialPivLu().solve(numer);+  for (int i=0; i<squarings; i++)+    result *= result;   // undo scaling by repeated squaring+}++ /* Computes the matrix exponential  *  * \param arg    argument of matrix exponential (should be plain object)  * \param result variable in which result will be stored  */ template <typename ArgType, typename ResultType>-void matrix_exp_compute(const ArgType& arg, ResultType &result)+void matrix_exp_compute(const ArgType& arg, ResultType &result, false_type) // default {   typedef typename ArgType::PlainObject MatrixType;-#if LDBL_MANT_DIG > 112 // rarely happens   typedef typename traits<MatrixType>::Scalar Scalar;   typedef typename NumTraits<Scalar>::Real RealScalar;   typedef typename std::complex<RealScalar> ComplexScalar;-  if (sizeof(RealScalar) > 14) {-    result = arg.matrixFunction(internal::stem_function_exp<ComplexScalar>);-    return;-  }-#endif-  MatrixType U, V;-  int squarings; -  matrix_exp_computeUV<MatrixType>::run(arg, U, V, squarings); // Pade approximant is (U+V) / (-U+V)-  MatrixType numer = U + V;-  MatrixType denom = -U + V;-  result = denom.partialPivLu().solve(numer);-  for (int i=0; i<squarings; i++)-    result *= result;   // undo scaling by repeated squaring+  result = arg.matrixFunction(internal::stem_function_exp<ComplexScalar>); }  } // end namespace Eigen::internal@@ -402,7 +412,7 @@     inline void evalTo(ResultType& result) const     {       const typename internal::nested_eval<Derived, 10>::type tmp(m_src);-      internal::matrix_exp_compute(tmp, result);+      internal::matrix_exp_compute(tmp, result, internal::is_exp_known_type<typename Derived::Scalar>());     }      Index rows() const { return m_src.rows(); }
eigen3/unsupported/Eigen/src/MatrixFunctions/MatrixFunction.h view
@@ -7,8 +7,8 @@ // Public License v. 2.0. If a copy of the MPL was not distributed // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. -#ifndef EIGEN_MATRIX_FUNCTION-#define EIGEN_MATRIX_FUNCTION+#ifndef EIGEN_MATRIX_FUNCTION_H+#define EIGEN_MATRIX_FUNCTION_H  #include "StemFunction.h" @@ -577,4 +577,4 @@  } // end namespace Eigen -#endif // EIGEN_MATRIX_FUNCTION+#endif // EIGEN_MATRIX_FUNCTION_H
eigen3/unsupported/Eigen/src/MatrixFunctions/MatrixLogarithm.h view
@@ -324,7 +324,7 @@      /** \brief Compute the matrix logarithm.     *-    * \param[out]  result  Logarithm of \p A, where \A is as specified in the constructor.+    * \param[out]  result  Logarithm of \c A, where \c A is as specified in the constructor.     */   template <typename ResultType>   inline void evalTo(ResultType& result) const
eigen3/unsupported/Eigen/src/MatrixFunctions/MatrixPower.h view
@@ -57,8 +57,8 @@      * \param[out] result      */     template<typename ResultType>-    inline void evalTo(ResultType& res) const-    { m_pow.compute(res, m_p); }+    inline void evalTo(ResultType& result) const+    { m_pow.compute(result, m_p); }      Index rows() const { return m_pow.rows(); }     Index cols() const { return m_pow.cols(); }@@ -618,8 +618,8 @@      * constructor.      */     template<typename ResultType>-    inline void evalTo(ResultType& res) const-    { MatrixPower<PlainObject>(m_A.eval()).compute(res, m_p); }+    inline void evalTo(ResultType& result) const+    { MatrixPower<PlainObject>(m_A.eval()).compute(result, m_p); }      Index rows() const { return m_A.rows(); }     Index cols() const { return m_A.cols(); }@@ -669,8 +669,8 @@      * constructor.      */     template<typename ResultType>-    inline void evalTo(ResultType& res) const-    { res = (m_p * m_A.log()).exp(); }+    inline void evalTo(ResultType& result) const+    { result = (m_p * m_A.log()).exp(); }      Index rows() const { return m_A.rows(); }     Index cols() const { return m_A.cols(); }
eigen3/unsupported/Eigen/src/MatrixFunctions/MatrixSquareRoot.h view
@@ -120,7 +120,6 @@ void matrix_sqrt_quasi_triangular_diagonal(const MatrixType& T, ResultType& sqrtT) {   using std::sqrt;-  typedef typename MatrixType::Index Index;   const Index size = T.rows();   for (Index i = 0; i < size; i++) {     if (i == size - 1 || T.coeff(i+1, i) == 0) {@@ -139,7 +138,6 @@ template <typename MatrixType, typename ResultType> void matrix_sqrt_quasi_triangular_off_diagonal(const MatrixType& T, ResultType& sqrtT) {-  typedef typename MatrixType::Index Index;   const Index size = T.rows();   for (Index j = 1; j < size; j++) {       if (T.coeff(j, j-1) != 0)  // if T(j-1:j, j-1:j) is a 2-by-2 block@@ -206,7 +204,6 @@ void matrix_sqrt_triangular(const MatrixType &arg, ResultType &result) {   using std::sqrt;-  typedef typename MatrixType::Index Index;       typedef typename MatrixType::Scalar Scalar;    eigen_assert(arg.rows() == arg.cols());@@ -318,7 +315,6 @@ : public ReturnByValue<MatrixSquareRootReturnValue<Derived> > {   protected:-    typedef typename Derived::Index Index;     typedef typename internal::ref_selector<Derived>::type DerivedNested;    public:
eigen3/unsupported/Eigen/src/Polynomials/PolynomialUtils.h view
@@ -20,8 +20,8 @@  *  e.g. \f$ 1 + 3x^2 \f$ is stored as a vector \f$ [ 1, 0, 3 ] \f$.  * \param[in] x : the value to evaluate the polynomial at.  *- * <i><b>Note for stability:</b></i>- *  <dd> \f$ |x| \le 1 \f$ </dd>+ * \note for stability:+ *   \f$ |x| \le 1 \f$  */ template <typename Polynomials, typename T> inline@@ -67,8 +67,8 @@  *  by degrees i.e. poly[i] is the coefficient of degree i of the polynomial  *  e.g. \f$ 1 + 3x^2 \f$ is stored as a vector \f$ [ 1, 0, 3 ] \f$.  *- *  <i><b>Precondition:</b></i>- *  <dd> the leading coefficient of the input polynomial poly must be non zero </dd>+ *  \pre+ *   the leading coefficient of the input polynomial poly must be non zero  */ template <typename Polynomial> inline
eigen3/unsupported/Eigen/src/SparseExtra/BlockSparseMatrix.h view
@@ -931,7 +931,7 @@     }      /**-      * \returns the starting position of the block <id> in the array of values+      * \returns the starting position of the block \p id in the array of values       */     Index blockPtr(Index id) const     {
eigen3/unsupported/Eigen/src/SparseExtra/DynamicSparseMatrix.h view
@@ -228,6 +228,9 @@     EIGEN_DEPRECATED inline DynamicSparseMatrix()       : m_innerSize(0), m_data(0)     {+      #ifdef EIGEN_SPARSE_CREATE_TEMPORARY_PLUGIN+        EIGEN_SPARSE_CREATE_TEMPORARY_PLUGIN+      #endif       eigen_assert(innerSize()==0 && outerSize()==0);     } @@ -235,6 +238,9 @@     EIGEN_DEPRECATED inline DynamicSparseMatrix(Index rows, Index cols)       : m_innerSize(0)     {+      #ifdef EIGEN_SPARSE_CREATE_TEMPORARY_PLUGIN+        EIGEN_SPARSE_CREATE_TEMPORARY_PLUGIN+      #endif       resize(rows, cols);     } @@ -243,12 +249,18 @@     EIGEN_DEPRECATED explicit inline DynamicSparseMatrix(const SparseMatrixBase<OtherDerived>& other)       : m_innerSize(0)     {-    Base::operator=(other.derived());+      #ifdef EIGEN_SPARSE_CREATE_TEMPORARY_PLUGIN+        EIGEN_SPARSE_CREATE_TEMPORARY_PLUGIN+      #endif+      Base::operator=(other.derived());     }      inline DynamicSparseMatrix(const DynamicSparseMatrix& other)       : Base(), m_innerSize(0)     {+      #ifdef EIGEN_SPARSE_CREATE_TEMPORARY_PLUGIN+        EIGEN_SPARSE_CREATE_TEMPORARY_PLUGIN+      #endif       *this = other.derived();     } 
eigen3/unsupported/Eigen/src/SparseExtra/MarketIO.h view
@@ -17,8 +17,8 @@  namespace internal  {-  template <typename Scalar>-  inline bool GetMarketLine (std::stringstream& line, Index& M, Index& N, Index& i, Index& j, Scalar& value)+  template <typename Scalar,typename IndexType>+  inline bool GetMarketLine (std::stringstream& line, IndexType& M, IndexType& N, IndexType& i, IndexType& j, Scalar& value)   {     line >> i >> j >> value;     i--;@@ -30,8 +30,8 @@     else       return false;   }-  template <typename Scalar>-  inline bool GetMarketLine (std::stringstream& line, Index& M, Index& N, Index& i, Index& j, std::complex<Scalar>& value)+  template <typename Scalar,typename IndexType>+  inline bool GetMarketLine (std::stringstream& line, IndexType& M, IndexType& N, IndexType& i, IndexType& j, std::complex<Scalar>& value)   {     Scalar valR, valI;     line >> i >> j >> valR >> valI;@@ -109,6 +109,7 @@ inline bool getMarketHeader(const std::string& filename, int& sym, bool& iscomplex, bool& isvector) {   sym = 0; +  iscomplex = false;   isvector = false;   std::ifstream in(filename.c_str(),std::ios::in);   if(!in)@@ -133,7 +134,7 @@ bool loadMarket(SparseMatrixType& mat, const std::string& filename) {   typedef typename SparseMatrixType::Scalar Scalar;-  typedef typename SparseMatrixType::Index Index;+  typedef typename SparseMatrixType::StorageIndex StorageIndex;   std::ifstream input(filename.c_str(),std::ios::in);   if(!input)     return false;@@ -143,11 +144,11 @@      bool readsizes = false; -  typedef Triplet<Scalar,Index> T;+  typedef Triplet<Scalar,StorageIndex> T;   std::vector<T> elements;   -  Index M(-1), N(-1), NNZ(-1);-  Index count = 0;+  StorageIndex M(-1), N(-1), NNZ(-1);+  StorageIndex count = 0;   while(input.getline(buffer, maxBuffersize))   {     // skip comments   @@ -170,7 +171,7 @@     }     else     { -      Index i(-1), j(-1);+      StorageIndex i(-1), j(-1);       Scalar value;        if( internal::GetMarketLine(line, M, N, i, j, value) )        {
eigen3/unsupported/Eigen/src/Splines/Spline.h view
@@ -249,8 +249,6 @@     DenseIndex degree,     const typename Spline<_Scalar, _Dim, _Degree>::KnotVectorType& knots)   {-    typedef typename Spline<_Scalar, _Dim, _Degree>::BasisVectorType BasisVectorType;-     const DenseIndex p = degree;     const DenseIndex i = Spline::Span(u, degree, knots); @@ -380,9 +378,6 @@     typedef Spline<_Scalar, _Dim, _Degree> SplineType;     enum { Order = SplineTraits<SplineType>::OrderAtCompileTime }; -    typedef typename SplineTraits<SplineType>::Scalar Scalar;-    typedef typename SplineTraits<SplineType>::BasisVectorType BasisVectorType;-       const DenseIndex span = SplineType::Span(u, p, U);      const DenseIndex n = (std::min)(p, order);
eigen3/unsupported/doc/examples/FFT.cpp view
@@ -61,14 +61,14 @@ void RandomFill(std::vector<T> & vec) {     for (size_t k=0;k<vec.size();++k)-        vec[k] = T( rand() )/T(RAND_MAX) - .5;+        vec[k] = T( rand() )/T(RAND_MAX) - T(.5); }  template <typename T> void RandomFill(std::vector<std::complex<T> > & vec) {     for (size_t k=0;k<vec.size();++k)-        vec[k] = std::complex<T> ( T( rand() )/T(RAND_MAX) - .5, T( rand() )/T(RAND_MAX) - .5);+        vec[k] = std::complex<T> ( T( rand() )/T(RAND_MAX) - T(.5), T( rand() )/T(RAND_MAX) - T(.5)); }  template <typename T_time,typename T_freq>@@ -85,7 +85,7 @@     vector<T_time> timebuf2;     fft.inv(timebuf2,freqbuf); -    long double rmse = mag2(timebuf - timebuf2) / mag2(timebuf);+    T_time rmse = mag2(timebuf - timebuf2) / mag2(timebuf);     cout << "roundtrip rmse: " << rmse << endl; } 
eigen3/unsupported/test/CMakeLists.txt view
@@ -30,11 +30,16 @@   ei_add_property(EIGEN_MISSING_BACKENDS  "GoogleHash, ") endif(GOOGLEHASH_FOUND) + find_package(Adolc) if(ADOLC_FOUND)   include_directories(${ADOLC_INCLUDES})   ei_add_property(EIGEN_TESTED_BACKENDS "Adolc, ")-  ei_add_test(forward_adolc "" ${ADOLC_LIBRARIES})+  if(EIGEN_TEST_CXX11)+    ei_add_test(forward_adolc "" ${ADOLC_LIBRARIES})+  else()+    message(STATUS "Adolc found, but tests require C++11 mode")+  endif() else(ADOLC_FOUND)   ei_add_property(EIGEN_MISSING_BACKENDS "Adolc, ") endif(ADOLC_FOUND)@@ -63,7 +68,7 @@  find_package(MPFR 2.3.0) find_package(GMP)-if(MPFR_FOUND AND EIGEN_COMPILER_SUPPORT_CXX11)+if(MPFR_FOUND AND EIGEN_COMPILER_SUPPORT_CPP11)   include_directories(${MPFR_INCLUDES} ./mpreal)   ei_add_property(EIGEN_TESTED_BACKENDS "MPFR C++, ")   set(EIGEN_MPFR_TEST_LIBRARIES ${MPFR_LIBRARIES} ${GMP_LIBRARIES})@@ -149,7 +154,8 @@   endif(EIGEN_TEST_SYCL)   # It should be safe to always run these tests as there is some fallback code for   # older compiler that don't support cxx11.-  set(CMAKE_CXX_STANDARD 11)+  # This is already set if EIGEN_TEST_CXX11 is enabled:+  # set(CMAKE_CXX_STANDARD 11)    ei_add_test(cxx11_eventcount "-pthread" "${CMAKE_THREAD_LIBS_INIT}")   ei_add_test(cxx11_runqueue "-pthread" "${CMAKE_THREAD_LIBS_INIT}")
eigen3/unsupported/test/NonLinearOptimization.cpp view
@@ -565,7 +565,7 @@    // do the computation   lmdif_functor functor;-  DenseIndex nfev;+  DenseIndex nfev = -1; // initialize to avoid maybe-uninitialized warning   info = LevenbergMarquardt<lmdif_functor>::lmdif1(functor, x, &nfev);    // check return value
eigen3/unsupported/test/autodiff.cpp view
@@ -306,6 +306,8 @@   return denom.value(); } +#ifdef EIGEN_TEST_PART_5+ double bug_1223() {   using std::min;   typedef Eigen::AutoDiffScalar<Eigen::Vector3d> AD;@@ -326,8 +328,8 @@  // regression test for some compilation issues with specializations of ScalarBinaryOpTraits void bug_1260() {-  Matrix4d A;-  Vector4d v;+  Matrix4d A = Matrix4d::Ones();+  Vector4d v = Vector4d::Ones();   A*v; } @@ -336,7 +338,7 @@   typedef AutoDiffScalar<Matrix2d> AD;   typedef Matrix<AD,2,1> VectorAD; -  VectorAD v;+  VectorAD v(0.,0.);   const AD maxVal = v.maxCoeff();   const AD minVal = v.minCoeff();   return maxVal.value() + minVal.value();@@ -344,12 +346,14 @@  double bug_1264() {   typedef AutoDiffScalar<Vector2d> AD;-  const AD s;-  const Matrix<AD, 3, 1> v1;+  const AD s = 0.;+  const Matrix<AD, 3, 1> v1(0.,0.,0.);   const Matrix<AD, 3, 1> v2 = (s + 3.0) * v1;   return v2(0).value(); } +#endif+ void test_autodiff() {   for(int i = 0; i < g_repeat; i++) {@@ -359,9 +363,9 @@     CALL_SUBTEST_4( test_autodiff_hessian<1>() );   } -  bug_1222();-  bug_1223();-  bug_1260();-  bug_1261();+  CALL_SUBTEST_5( bug_1222() );+  CALL_SUBTEST_5( bug_1223() );+  CALL_SUBTEST_5( bug_1260() );+  CALL_SUBTEST_5( bug_1261() ); } 
eigen3/unsupported/test/autodiff_scalar.cpp view
@@ -81,6 +81,9 @@   typedef std::numeric_limits<AD> A;   typedef std::numeric_limits<Scalar> B; +  // workaround "unsed typedef" warning:+  VERIFY(!bool(internal::is_same<B, A>::value));+ #if EIGEN_HAS_CXX11   VERIFY(bool(std::is_base_of<B, A>::value)); #endif
eigen3/unsupported/test/cxx11_tensor_argmax_cuda.cu view
@@ -12,9 +12,6 @@ #define EIGEN_TEST_FUNC cxx11_tensor_cuda #define EIGEN_USE_GPU -#if defined __CUDACC_VER__ && __CUDACC_VER__ >= 70500-#include <cuda_fp16.h>-#endif #include "main.h" #include <unsupported/Eigen/CXX11/Tensor> 
eigen3/unsupported/test/cxx11_tensor_cast_float16_cuda.cu view
@@ -13,9 +13,6 @@ #define EIGEN_DEFAULT_DENSE_INDEX_TYPE int #define EIGEN_USE_GPU -#if defined __CUDACC_VER__ && __CUDACC_VER__ >= 70500-#include <cuda_fp16.h>-#endif #include "main.h" #include <unsupported/Eigen/CXX11/Tensor> 
eigen3/unsupported/test/cxx11_tensor_complex_cuda.cu view
@@ -11,9 +11,6 @@ #define EIGEN_TEST_FUNC cxx11_tensor_complex #define EIGEN_USE_GPU -#if defined __CUDACC_VER__ && __CUDACC_VER__ >= 70500-#include <cuda_fp16.h>-#endif #include "main.h" #include <unsupported/Eigen/CXX11/Tensor> 
eigen3/unsupported/test/cxx11_tensor_complex_cwise_ops_cuda.cu view
@@ -11,9 +11,6 @@ #define EIGEN_TEST_FUNC cxx11_tensor_complex_cwise_ops #define EIGEN_USE_GPU -#if defined __CUDACC_VER__ && __CUDACC_VER__ >= 70500-#include <cuda_fp16.h>-#endif #include "main.h" #include <unsupported/Eigen/CXX11/Tensor> 
eigen3/unsupported/test/cxx11_tensor_contract_cuda.cu view
@@ -14,9 +14,6 @@ #define EIGEN_DEFAULT_DENSE_INDEX_TYPE int #define EIGEN_USE_GPU -#if defined __CUDACC_VER__ && __CUDACC_VER__ >= 70500-#include <cuda_fp16.h>-#endif #include "main.h" #include <unsupported/Eigen/CXX11/Tensor> 
eigen3/unsupported/test/cxx11_tensor_cuda.cu view
@@ -12,9 +12,6 @@ #define EIGEN_TEST_FUNC cxx11_tensor_cuda #define EIGEN_USE_GPU -#if defined __CUDACC_VER__ && __CUDACC_VER__ >= 70500-#include <cuda_fp16.h>-#endif #include "main.h" #include <unsupported/Eigen/CXX11/Tensor> 
eigen3/unsupported/test/cxx11_tensor_device.cu view
@@ -13,9 +13,6 @@ #define EIGEN_DEFAULT_DENSE_INDEX_TYPE int #define EIGEN_USE_GPU -#if defined __CUDACC_VER__ && __CUDACC_VER__ >= 70500-#include <cuda_fp16.h>-#endif #include "main.h" #include <unsupported/Eigen/CXX11/Tensor> 
eigen3/unsupported/test/cxx11_tensor_of_float16_cuda.cu view
@@ -13,9 +13,6 @@ #define EIGEN_DEFAULT_DENSE_INDEX_TYPE int #define EIGEN_USE_GPU -#if defined __CUDACC_VER__ && __CUDACC_VER__ >= 70500-#include <cuda_fp16.h>-#endif #include "main.h" #include <unsupported/Eigen/CXX11/Tensor> 
eigen3/unsupported/test/cxx11_tensor_random_cuda.cu view
@@ -13,9 +13,6 @@ #define EIGEN_DEFAULT_DENSE_INDEX_TYPE int #define EIGEN_USE_GPU -#if defined __CUDACC_VER__ && __CUDACC_VER__ >= 70500-#include <cuda_fp16.h>-#endif #include "main.h" #include <Eigen/CXX11/Tensor> 
eigen3/unsupported/test/cxx11_tensor_reduction_cuda.cu view
@@ -12,9 +12,6 @@ #define EIGEN_TEST_FUNC cxx11_tensor_reduction_cuda #define EIGEN_USE_GPU -#if defined __CUDACC_VER__ && __CUDACC_VER__ >= 70500-#include <cuda_fp16.h>-#endif #include "main.h" #include <unsupported/Eigen/CXX11/Tensor> 
eigen3/unsupported/test/cxx11_tensor_scan_cuda.cu view
@@ -13,9 +13,6 @@ #define EIGEN_DEFAULT_DENSE_INDEX_TYPE int #define EIGEN_USE_GPU -#if defined __CUDACC_VER__ && __CUDACC_VER__ >= 70500-#include <cuda_fp16.h>-#endif #include "main.h" #include <unsupported/Eigen/CXX11/Tensor> 
eigen3/unsupported/test/matrix_function.cpp view
@@ -25,7 +25,6 @@ template<typename MatrixType> MatrixType randomMatrixWithRealEivals(const typename MatrixType::Index size) {-  typedef typename MatrixType::Index Index;   typedef typename MatrixType::Scalar Scalar;   typedef typename MatrixType::RealScalar RealScalar;   MatrixType diag = MatrixType::Zero(size, size);@@ -51,7 +50,6 @@ {   static MatrixType run(const typename MatrixType::Index size)   {-    typedef typename MatrixType::Index Index;     typedef typename MatrixType::Scalar Scalar;     MatrixType diag = MatrixType::Zero(size, size);     Index i = 0;@@ -79,7 +77,6 @@ {   static MatrixType run(const typename MatrixType::Index size)   {-    typedef typename MatrixType::Index Index;     typedef typename MatrixType::Scalar Scalar;     typedef typename MatrixType::RealScalar RealScalar;     const Scalar imagUnit(0, 1);@@ -171,7 +168,6 @@ {   // Matrices with clustered eigenvalue lead to different code paths   // in MatrixFunction.h and are thus useful for testing.-  typedef typename MatrixType::Index Index;    const Index size = m.rows();   for (int i = 0; i < g_repeat; i++) {
eigen3/unsupported/test/openglsupport.cpp view
@@ -318,10 +318,6 @@                GLint prg_id = createShader(vtx,frg);       -      typedef Vector2d Vector2d;-      typedef Vector3d Vector3d;-      typedef Vector4d Vector4d;-             VERIFY_UNIFORM(dv,v2d, Vector2d);       VERIFY_UNIFORM(dv,v3d, Vector3d);       VERIFY_UNIFORM(dv,v4d, Vector4d);
eigen3/unsupported/test/polynomialsolver.cpp view
@@ -30,7 +30,6 @@ template<int Deg, typename POLYNOMIAL, typename SOLVER> bool aux_evalSolver( const POLYNOMIAL& pols, SOLVER& psolve ) {-  typedef typename POLYNOMIAL::Index Index;   typedef typename POLYNOMIAL::Scalar Scalar;    typedef typename SOLVER::RootsType    RootsType;@@ -107,7 +106,6 @@     // 1) the roots found are correct     // 2) the roots have distinct moduli -    typedef typename POLYNOMIAL::Scalar                 Scalar;     typedef typename REAL_ROOTS::Scalar                 Real;      //Test realRoots
eigen3/unsupported/test/sparse_extra.cpp view
@@ -8,10 +8,10 @@ // with this file, You can obtain one at http://mozilla.org/MPL/2.0/.  -// import basic and product tests for deprectaed DynamicSparseMatrix+// import basic and product tests for deprecated DynamicSparseMatrix #define EIGEN_NO_DEPRECATED_WARNING-#include "sparse_basic.cpp" #include "sparse_product.cpp"+#include "sparse_basic.cpp" #include <Eigen/SparseExtra>  template<typename SetterType,typename DenseType, typename Scalar, int Options>
src/Eigen/Matrix.hs view
@@ -334,6 +334,7 @@  {- | Apply a given function to each element of the matrix. Here is an example how to implement scalar matrix multiplication:+ >>> let a = fromList [[1,2],[3,4]] :: MatrixXf 2 2 >>> a Matrix 2x2
src/Eigen/SparseMatrix.hs view
@@ -30,12 +30,20 @@   , (!)   , getRow   , getCol+  , getRows+  , getCols+  , unsafeGetCol+  , unsafeGetRow+  , unsafeFromRows+  , unsafeFromCols      -- * Matrix conversions   , fromList   , toList   , fromVector   , toVector+  , fromVectorSized+  , fromListSized   , fromDenseList   , toDenseList   , fromMatrix@@ -46,6 +54,7 @@   , squaredNorm   , blueNorm   , block+  , unsafeBlock   , nonZeros   , innerSize   , outerSize@@ -230,7 +239,6 @@ cols_ :: forall n m a. (Elem a, KnownNat n, KnownNat m) => SparseMatrix n m a -> Int cols_ _ = natToInt @m - -- | Sparse matrix coefficient at the given row and column coeff :: forall n m r c a. (Elem a, KnownNat n, KnownNat m, KnownNat r, KnownNat c, r <= n, c <= m)   => Row r -> Col c -> SparseMatrix n m a -> a@@ -261,6 +269,21 @@ blueNorm :: Elem a => SparseMatrix n m a -> a blueNorm = _unop Internal.sparse_blueNorm (pure . fromC) +unsafeBlock ::+     (Elem a)+  => Int+  -> Int+  -> Int+  -> Int+  -> SparseMatrix n m a+  -> SparseMatrix n1 m1 a+unsafeBlock !sr !sc !br !bc =+  let !c_startRow = toC $! sr+      !c_startCol = toC $! sc+      !c_rows     = toC $! br+      !c_cols     = toC $! bc+  in _unop (\p pq -> Internal.sparse_block p c_startRow c_startCol c_rows c_cols pq) _mk+ -- | Extract a rectangular block from the sparse matrix, given a startRow, startCol, blockRows, blockCols block :: forall sr sc br bc n m a.      (Elem a, KnownNat sr, KnownNat sc, KnownNat br, KnownNat bc, KnownNat n, KnownNat m)@@ -352,14 +375,7 @@ fromVector :: forall n m a. (Elem a, KnownNat n, KnownNat m)   => VS.Vector (CTriplet a)   -> SparseMatrix n m a-fromVector tris =-  let !c_rs = toC $! natToInt @n-      !c_cs = toC $! natToInt @m-      !len  = toC $! VS.length tris-  in Internal.performIO $ VS.unsafeWith tris $ \p ->-       alloca $ \pq -> do-         Internal.call $ Internal.sparse_fromList c_rs c_cs p len pq-         peek pq >>= _mk+fromVector = fromVectorSized (natToInt @n) (natToInt @m)  -- | Convert a sparse matrix to the list of triplets (row, col, val). Compressed elements will not be included. toVector :: Elem a => SparseMatrix n m a -> VS.Vector (CTriplet a)@@ -380,6 +396,39 @@ fromList :: (Elem a, KnownNat n, KnownNat m) => [(Int, Int, a)] -> SparseMatrix n m a fromList = fromVector . VS.fromList . fmap toC +fromListSized :: (Elem a, KnownNat n, KnownNat m) => Int -> Int -> [(Int, Int, a)] -> SparseMatrix n m a+fromListSized _rows _cols = fromVectorSized _rows _cols . VS.fromList . Prelude.map Internal.toC++fromVectorSized :: forall n m a. (Elem a, KnownNat n, KnownNat m)+  => Int+  -> Int+  -> VS.Vector (CTriplet a)+  -> SparseMatrix n m a+fromVectorSized _rows _cols tris =+  let !c_rs = toC $! _rows+      !c_cs = toC $! _cols+      !len  = toC $! VS.length tris+  in Internal.performIO $ VS.unsafeWith tris $ \p ->+       alloca $ \pq -> do+         Internal.call $ Internal.sparse_fromList c_rs c_cs p len pq+         peek pq >>= _mk+++-- | Construct asparse matrix of the given size from the storable vector of triplets (row, col, val)+--fromVector :: forall n m a. (Elem a, KnownNat n, KnownNat m)+--  => VS.Vector (CTriplet a)+--  -> SparseMatrix n m a+--fromVector tris =+--  let !c_rs = toC $! natToInt @n+--      !c_cs = toC $! natToInt @m+--      !len  = toC $! VS.length tris+--  in Internal.performIO $ VS.unsafeWith tris $ \p ->+--       alloca $ \pq -> do+--         Internal.call $ Internal.sparse_fromList c_rs c_cs p len pq+--         peek pq >>= _mk+++ -- | Convert a sparse matrix to a (n X m) dense list of values. toDenseList :: forall n m a. (Elem a, KnownNat n, KnownNat m) => SparseMatrix n m a -> [[a]] toDenseList mat = [[_unsafeCoeff row col mat | col <- [0 .. _unsafeCols mat - 1]] | row <- [0 .. _unsafeRows mat - 1]]@@ -448,6 +497,59 @@ -- | Return a single column of the sparse matrix. getCol :: forall n m c a. (Elem a, KnownNat n, KnownNat m, KnownNat c, c <= m, 1 <= m) => Col c -> SparseMatrix n m a -> SparseMatrix n 1 a getCol col mat = block (Row @0) col (Row @n) (Col @1) mat++-- | Return all rows of the sparse matrix.+getRows :: forall n m a. (Elem a, KnownNat n, KnownNat m) => SparseMatrix n m a -> [SparseMatrix 1 m a]+getRows mat = fmap (flip unsafeGetRow mat) [0 .. (natToInt @n) - 1]++-- | Return all columns of a sparse matrix.+getCols :: forall n m a. (Elem a, KnownNat n, KnownNat m) => SparseMatrix n m a -> [SparseMatrix n 1 a]+getCols mat = fmap (flip unsafeGetCol mat) [0 .. (natToInt @m) - 1]++-- | Returns a single row of the sparse matrix. This is unsafe because it allows out-of-bounds access.+unsafeGetRow :: forall n m a. (Elem a, KnownNat n, KnownNat m) => Int -> SparseMatrix n m a -> SparseMatrix 1 m a+unsafeGetRow row mat = unsafeBlock row 0 1 (natToInt @m) mat++-- | Returns a single column of the sparse matrix. This is unsafe because it allows out-of-bounds access.+unsafeGetCol :: forall n m a. (Elem a, KnownNat n, KnownNat m) => Int -> SparseMatrix n m a -> SparseMatrix n 1 a+unsafeGetCol col mat = unsafeBlock 0 col (natToInt @n) 1 mat++-- | Get a sparse matrix from a list of columns.+--   This operation is unsafe because we cannot unify the length of the list with the type variable 'm'.+unsafeFromCols :: forall n m a. (Elem a, KnownNat n, KnownNat m) => [SparseMatrix n 1 a] -> SparseMatrix n m a+unsafeFromCols [] = fromListSized 0 0 []+unsafeFromCols _cols = fromListSized n m . concatMap toList . zipWith updateColIdx [0..] $ _cols+  where+    n = maximum . fmap _unsafeRows $ _cols+    m = length _cols++-- | Get a sparse matrix from a list of rows.+--   This operation is unsafe because we cannot unify the length of the list with the type variable 'n'.+unsafeFromRows :: forall n m a. (Elem a, KnownNat n, KnownNat m) => [SparseMatrix 1 m a] -> SparseMatrix n m a+unsafeFromRows [] = fromListSized 0 0 []+unsafeFromRows _rows = fromListSized n m . concatMap toList . zipWith updateRowIdx [0..] $ _rows+  where+    n = length _rows+    m = maximum . fmap _unsafeCols $ _rows++-- | Update the row indices of a sparse matrix.+updateRowIdx :: forall n m a. (KnownNat n, KnownNat m, Elem a) => Int -> SparseMatrix n m a -> SparseMatrix n m a+updateRowIdx row mat = fromListSized n m . fmap (\(_, j, v) -> (row, j, v)) . toList $ mat+  where+    n = row + 1+    m = _unsafeCols mat++-- | Update the column indices of a sparse matrix.+updateColIdx :: forall n m a. (KnownNat n, KnownNat m, Elem a) => Int -> SparseMatrix n m a -> SparseMatrix n m a+updateColIdx col mat = fromListSized n m . fmap (\(i, _, v) -> (i, col, v)) . toList $ mat+  where+    n = _unsafeRows mat+    m = col + 1++--fromRows :: forall n m a. (Elem a, KnownNat n, KnownNat m)+--  => [SparseMatrix 1 m a]+--  -> SparseMatrix n m a+  _unop :: Storable b => (CSparseMatrixPtr a -> Ptr b -> IO CString) -> (b -> IO c) -> SparseMatrix n m a -> c _unop f g (SparseMatrix fp) = Internal.performIO $