├── Makefile ├── README.md ├── data ├── SNPbam2vcf_data │ ├── NA12877_S1_play.bam │ ├── NA12877_S1_play.bam.bai │ ├── NA12883_S1_play.bam │ ├── NA12883_S1_play.bam.bai │ ├── NA12885_S1_play.bam │ ├── NA12885_S1_play.bam.bai │ ├── NA12889_S1_play.bam │ ├── NA12889_S1_play.bam.bai │ ├── NA12890_S1_play.bam │ ├── NA12890_S1_play.bam.bai │ ├── SNP.list │ └── bam.list ├── sim2_10K.vcf ├── sim2_5.vcf ├── sim_GLlog_PL2.vcf ├── sim_GLlog_PL20.vcf ├── sim_PL2_10K.vcf ├── test.vcf └── test_extrahead.vcf ├── include ├── Eigen │ ├── Array │ ├── CMakeLists.txt │ ├── Cholesky │ ├── CholmodSupport │ ├── Core │ ├── Dense │ ├── Eigen │ ├── Eigen2Support │ ├── Eigenvalues │ ├── Geometry │ ├── Householder │ ├── IterativeLinearSolvers │ ├── Jacobi │ ├── LU │ ├── LeastSquares │ ├── MetisSupport │ ├── OrderingMethods │ ├── PaStiXSupport │ ├── PardisoSupport │ ├── QR │ ├── QtAlignedMalloc │ ├── SPQRSupport │ ├── SVD │ ├── Sparse │ ├── SparseCholesky │ ├── SparseCore │ ├── SparseLU │ ├── SparseQR │ ├── StdDeque │ ├── StdList │ ├── StdVector │ ├── SuperLUSupport │ ├── UmfPackSupport │ └── src │ │ ├── CMakeLists.txt │ │ ├── Cholesky │ │ ├── CMakeLists.txt │ │ ├── LDLT.h │ │ ├── LLT.h │ │ └── LLT_MKL.h │ │ ├── CholmodSupport │ │ ├── CMakeLists.txt │ │ └── CholmodSupport.h │ │ ├── Core │ │ ├── Array.h │ │ ├── ArrayBase.h │ │ ├── ArrayWrapper.h │ │ ├── Assign.h │ │ ├── Assign_MKL.h │ │ ├── BandMatrix.h │ │ ├── Block.h │ │ ├── BooleanRedux.h │ │ ├── CMakeLists.txt │ │ ├── CommaInitializer.h │ │ ├── CoreIterators.h │ │ ├── CwiseBinaryOp.h │ │ ├── CwiseNullaryOp.h │ │ ├── CwiseUnaryOp.h │ │ ├── CwiseUnaryView.h │ │ ├── DenseBase.h │ │ ├── DenseCoeffsBase.h │ │ ├── DenseStorage.h │ │ ├── Diagonal.h │ │ ├── DiagonalMatrix.h │ │ ├── DiagonalProduct.h │ │ ├── Dot.h │ │ ├── EigenBase.h │ │ ├── Flagged.h │ │ ├── ForceAlignedAccess.h │ │ ├── Functors.h │ │ ├── Fuzzy.h │ │ ├── GeneralProduct.h │ │ ├── GenericPacketMath.h │ │ ├── GlobalFunctions.h │ │ ├── IO.h │ │ ├── Map.h │ │ ├── MapBase.h │ │ ├── MathFunctions.h │ │ ├── Matrix.h │ │ ├── MatrixBase.h │ │ ├── NestByValue.h │ │ ├── NoAlias.h │ │ ├── NumTraits.h │ │ ├── PermutationMatrix.h │ │ ├── PlainObjectBase.h │ │ ├── ProductBase.h │ │ ├── Random.h │ │ ├── Redux.h │ │ ├── Ref.h │ │ ├── Replicate.h │ │ ├── ReturnByValue.h │ │ ├── Reverse.h │ │ ├── Select.h │ │ ├── SelfAdjointView.h │ │ ├── SelfCwiseBinaryOp.h │ │ ├── SolveTriangular.h │ │ ├── StableNorm.h │ │ ├── Stride.h │ │ ├── Swap.h │ │ ├── Transpose.h │ │ ├── Transpositions.h │ │ ├── TriangularMatrix.h │ │ ├── VectorBlock.h │ │ ├── VectorwiseOp.h │ │ ├── Visitor.h │ │ ├── arch │ │ │ ├── AltiVec │ │ │ │ ├── CMakeLists.txt │ │ │ │ ├── Complex.h │ │ │ │ └── PacketMath.h │ │ │ ├── CMakeLists.txt │ │ │ ├── Default │ │ │ │ ├── CMakeLists.txt │ │ │ │ └── Settings.h │ │ │ ├── NEON │ │ │ │ ├── CMakeLists.txt │ │ │ │ ├── Complex.h │ │ │ │ └── PacketMath.h │ │ │ └── SSE │ │ │ │ ├── CMakeLists.txt │ │ │ │ ├── Complex.h │ │ │ │ ├── MathFunctions.h │ │ │ │ └── PacketMath.h │ │ ├── products │ │ │ ├── CMakeLists.txt │ │ │ ├── CoeffBasedProduct.h │ │ │ ├── GeneralBlockPanelKernel.h │ │ │ ├── GeneralMatrixMatrix.h │ │ │ ├── GeneralMatrixMatrixTriangular.h │ │ │ ├── GeneralMatrixMatrixTriangular_MKL.h │ │ │ ├── GeneralMatrixMatrix_MKL.h │ │ │ ├── GeneralMatrixVector.h │ │ │ ├── GeneralMatrixVector_MKL.h │ │ │ ├── Parallelizer.h │ │ │ ├── SelfadjointMatrixMatrix.h │ │ │ ├── SelfadjointMatrixMatrix_MKL.h │ │ │ ├── SelfadjointMatrixVector.h │ │ │ ├── SelfadjointMatrixVector_MKL.h │ │ │ ├── SelfadjointProduct.h │ │ │ ├── SelfadjointRank2Update.h │ │ │ ├── TriangularMatrixMatrix.h │ │ │ ├── TriangularMatrixMatrix_MKL.h │ │ │ ├── TriangularMatrixVector.h │ │ │ ├── TriangularMatrixVector_MKL.h │ │ │ ├── TriangularSolverMatrix.h │ │ │ ├── TriangularSolverMatrix_MKL.h │ │ │ └── TriangularSolverVector.h │ │ └── util │ │ │ ├── BlasUtil.h │ │ │ ├── CMakeLists.txt │ │ │ ├── Constants.h │ │ │ ├── DisableStupidWarnings.h │ │ │ ├── ForwardDeclarations.h │ │ │ ├── MKL_support.h │ │ │ ├── Macros.h │ │ │ ├── Memory.h │ │ │ ├── Meta.h │ │ │ ├── NonMPL2.h │ │ │ ├── ReenableStupidWarnings.h │ │ │ ├── StaticAssert.h │ │ │ └── XprHelper.h │ │ ├── Eigen2Support │ │ ├── Block.h │ │ ├── CMakeLists.txt │ │ ├── Cwise.h │ │ ├── CwiseOperators.h │ │ ├── Geometry │ │ │ ├── AlignedBox.h │ │ │ ├── All.h │ │ │ ├── AngleAxis.h │ │ │ ├── CMakeLists.txt │ │ │ ├── Hyperplane.h │ │ │ ├── ParametrizedLine.h │ │ │ ├── Quaternion.h │ │ │ ├── Rotation2D.h │ │ │ ├── RotationBase.h │ │ │ ├── Scaling.h │ │ │ ├── Transform.h │ │ │ └── Translation.h │ │ ├── LU.h │ │ ├── Lazy.h │ │ ├── LeastSquares.h │ │ ├── Macros.h │ │ ├── MathFunctions.h │ │ ├── Memory.h │ │ ├── Meta.h │ │ ├── Minor.h │ │ ├── QR.h │ │ ├── SVD.h │ │ ├── TriangularSolver.h │ │ └── VectorBlock.h │ │ ├── Eigenvalues │ │ ├── CMakeLists.txt │ │ ├── ComplexEigenSolver.h │ │ ├── ComplexSchur.h │ │ ├── ComplexSchur_MKL.h │ │ ├── EigenSolver.h │ │ ├── GeneralizedEigenSolver.h │ │ ├── GeneralizedSelfAdjointEigenSolver.h │ │ ├── HessenbergDecomposition.h │ │ ├── MatrixBaseEigenvalues.h │ │ ├── RealQZ.h │ │ ├── RealSchur.h │ │ ├── RealSchur_MKL.h │ │ ├── SelfAdjointEigenSolver.h │ │ ├── SelfAdjointEigenSolver_MKL.h │ │ └── Tridiagonalization.h │ │ ├── Geometry │ │ ├── AlignedBox.h │ │ ├── AngleAxis.h │ │ ├── CMakeLists.txt │ │ ├── EulerAngles.h │ │ ├── Homogeneous.h │ │ ├── Hyperplane.h │ │ ├── OrthoMethods.h │ │ ├── ParametrizedLine.h │ │ ├── Quaternion.h │ │ ├── Rotation2D.h │ │ ├── RotationBase.h │ │ ├── Scaling.h │ │ ├── Transform.h │ │ ├── Translation.h │ │ ├── Umeyama.h │ │ └── arch │ │ │ ├── CMakeLists.txt │ │ │ └── Geometry_SSE.h │ │ ├── Householder │ │ ├── BlockHouseholder.h │ │ ├── CMakeLists.txt │ │ ├── Householder.h │ │ └── HouseholderSequence.h │ │ ├── IterativeLinearSolvers │ │ ├── BasicPreconditioners.h │ │ ├── BiCGSTAB.h │ │ ├── CMakeLists.txt │ │ ├── ConjugateGradient.h │ │ ├── IncompleteLUT.h │ │ └── IterativeSolverBase.h │ │ ├── Jacobi │ │ ├── CMakeLists.txt │ │ └── Jacobi.h │ │ ├── LU │ │ ├── CMakeLists.txt │ │ ├── Determinant.h │ │ ├── FullPivLU.h │ │ ├── Inverse.h │ │ ├── PartialPivLU.h │ │ ├── PartialPivLU_MKL.h │ │ └── arch │ │ │ ├── CMakeLists.txt │ │ │ └── Inverse_SSE.h │ │ ├── MetisSupport │ │ ├── CMakeLists.txt │ │ └── MetisSupport.h │ │ ├── OrderingMethods │ │ ├── Amd.h │ │ ├── CMakeLists.txt │ │ ├── Eigen_Colamd.h │ │ └── Ordering.h │ │ ├── PaStiXSupport │ │ ├── CMakeLists.txt │ │ └── PaStiXSupport.h │ │ ├── PardisoSupport │ │ ├── CMakeLists.txt │ │ └── PardisoSupport.h │ │ ├── QR │ │ ├── CMakeLists.txt │ │ ├── ColPivHouseholderQR.h │ │ ├── ColPivHouseholderQR_MKL.h │ │ ├── FullPivHouseholderQR.h │ │ ├── HouseholderQR.h │ │ └── HouseholderQR_MKL.h │ │ ├── SPQRSupport │ │ ├── CMakeLists.txt │ │ └── SuiteSparseQRSupport.h │ │ ├── SVD │ │ ├── CMakeLists.txt │ │ ├── JacobiSVD.h │ │ ├── JacobiSVD_MKL.h │ │ └── UpperBidiagonalization.h │ │ ├── SparseCholesky │ │ ├── CMakeLists.txt │ │ ├── SimplicialCholesky.h │ │ └── SimplicialCholesky_impl.h │ │ ├── SparseCore │ │ ├── AmbiVector.h │ │ ├── CMakeLists.txt │ │ ├── CompressedStorage.h │ │ ├── ConservativeSparseSparseProduct.h │ │ ├── MappedSparseMatrix.h │ │ ├── SparseBlock.h │ │ ├── SparseColEtree.h │ │ ├── SparseCwiseBinaryOp.h │ │ ├── SparseCwiseUnaryOp.h │ │ ├── SparseDenseProduct.h │ │ ├── SparseDiagonalProduct.h │ │ ├── SparseDot.h │ │ ├── SparseFuzzy.h │ │ ├── SparseMatrix.h │ │ ├── SparseMatrixBase.h │ │ ├── SparsePermutation.h │ │ ├── SparseProduct.h │ │ ├── SparseRedux.h │ │ ├── SparseSelfAdjointView.h │ │ ├── SparseSparseProductWithPruning.h │ │ ├── SparseTranspose.h │ │ ├── SparseTriangularView.h │ │ ├── SparseUtil.h │ │ ├── SparseVector.h │ │ ├── SparseView.h │ │ └── TriangularSolver.h │ │ ├── SparseLU │ │ ├── CMakeLists.txt │ │ ├── SparseLU.h │ │ ├── SparseLUImpl.h │ │ ├── SparseLU_Memory.h │ │ ├── SparseLU_Structs.h │ │ ├── SparseLU_SupernodalMatrix.h │ │ ├── SparseLU_Utils.h │ │ ├── SparseLU_column_bmod.h │ │ ├── SparseLU_column_dfs.h │ │ ├── SparseLU_copy_to_ucol.h │ │ ├── SparseLU_gemm_kernel.h │ │ ├── SparseLU_heap_relax_snode.h │ │ ├── SparseLU_kernel_bmod.h │ │ ├── SparseLU_panel_bmod.h │ │ ├── SparseLU_panel_dfs.h │ │ ├── SparseLU_pivotL.h │ │ ├── SparseLU_pruneL.h │ │ └── SparseLU_relax_snode.h │ │ ├── SparseQR │ │ ├── CMakeLists.txt │ │ └── SparseQR.h │ │ ├── StlSupport │ │ ├── CMakeLists.txt │ │ ├── StdDeque.h │ │ ├── StdList.h │ │ ├── StdVector.h │ │ └── details.h │ │ ├── SuperLUSupport │ │ ├── CMakeLists.txt │ │ └── SuperLUSupport.h │ │ ├── UmfPackSupport │ │ ├── CMakeLists.txt │ │ └── UmfPackSupport.h │ │ ├── misc │ │ ├── CMakeLists.txt │ │ ├── Image.h │ │ ├── Kernel.h │ │ ├── Solve.h │ │ ├── SparseSolve.h │ │ └── blas.h │ │ └── plugins │ │ ├── ArrayCwiseBinaryOps.h │ │ ├── ArrayCwiseUnaryOps.h │ │ ├── BlockMethods.h │ │ ├── CMakeLists.txt │ │ ├── CommonCwiseBinaryOps.h │ │ ├── CommonCwiseUnaryOps.h │ │ ├── MatrixCwiseBinaryOps.h │ │ └── MatrixCwiseUnaryOps.h ├── Variant.h ├── concurrentqueue.h ├── convert.h ├── cppitertools │ ├── accumulate.hpp │ ├── chain.hpp │ ├── combinations.hpp │ ├── combinations_with_replacement.hpp │ ├── compress.hpp │ ├── count.hpp │ ├── cycle.hpp │ ├── dropwhile.hpp │ ├── enumerate.hpp │ ├── filter.hpp │ ├── filterfalse.hpp │ ├── groupby.hpp │ ├── grouper.hpp │ ├── imap.hpp │ ├── iteratoriterator.hpp │ ├── iterbase.hpp │ ├── itertools.hpp │ ├── permutations.hpp │ ├── powerset.hpp │ ├── product.hpp │ ├── range.hpp │ ├── repeat.hpp │ ├── reversed.hpp │ ├── slice.hpp │ ├── sliding_window.hpp │ ├── sorted.hpp │ ├── takewhile.hpp │ ├── unique_everseen.hpp │ ├── unique_justseen.hpp │ ├── zip.hpp │ └── zip_longest.hpp ├── filevercmp │ └── filevercmp.h ├── join.h ├── multichoose │ └── multichoose.h ├── relatedness.hpp ├── spdlog │ ├── async_logger.h │ ├── common.h │ ├── details │ │ ├── async_log_helper.h │ │ ├── async_logger_impl.h │ │ ├── file_helper.h │ │ ├── format.cc │ │ ├── format.h │ │ ├── line_logger.h │ │ ├── log_msg.h │ │ ├── logger_impl.h │ │ ├── mpmc_bounded_q.h │ │ ├── null_mutex.h │ │ ├── os.h │ │ ├── pattern_formatter_impl.h │ │ ├── registry.h │ │ └── spdlog_impl.h │ ├── formatter.h │ ├── logger.h │ ├── sinks │ │ ├── base_sink.h │ │ ├── file_sinks.h │ │ ├── null_sink.h │ │ ├── ostream_sink.h │ │ ├── sink.h │ │ ├── stdout_sinks.h │ │ └── syslog_sink.h │ ├── spdlog.h │ └── tweakme.h ├── split.h ├── tclap │ ├── Arg.h │ ├── ArgException.h │ ├── ArgTraits.h │ ├── CmdLine.h │ ├── CmdLineInterface.h │ ├── CmdLineOutput.h │ ├── Constraint.h │ ├── DocBookOutput.h │ ├── HelpVisitor.h │ ├── IgnoreRestVisitor.h │ ├── Makefile.am │ ├── Makefile.in │ ├── MultiArg.h │ ├── MultiSwitchArg.h │ ├── OptionalUnlabeledTracker.h │ ├── StandardTraits.h │ ├── StdOutput.h │ ├── SwitchArg.h │ ├── UnlabeledMultiArg.h │ ├── UnlabeledValueArg.h │ ├── ValueArg.h │ ├── ValuesConstraint.h │ ├── VersionVisitor.h │ ├── Visitor.h │ ├── XorHandler.h │ └── ZshCompletionOutput.h └── utils.hpp ├── src ├── Variant.cpp ├── filevercmp.c ├── relatedness.cpp ├── split.cpp └── utils.cpp ├── src_python ├── SNPbam2vcf │ ├── Readme.md │ └── SNPbam2vcf.py ├── lcMLkin_optim_customAF.py ├── lcMLkin_optim_customAF_AWfst.py ├── lcMLkin_v2_em.py ├── lcMLkin_v2_em_parallel.py └── lcMLkin_v2_em_parallel.py.bak └── validationScripts └── ValidateCoefficients.py /Makefile: -------------------------------------------------------------------------------- 1 | CXX ?= c++ 2 | CFLAGS = -Wall -Werror -fmax-errors=3 3 | CCFLAGS = -pthread -Wall 4 | LIBARG = -g -std=c++11 -O3 5 | EIGEN = include 6 | INC = -I $(EIGEN) 7 | TARGET = lcmlkin #Variant split 8 | FILES = relatedness utils Variant split 9 | SRC = $(addprefix src/, $(addsuffix .cpp, $(FILES))) #src/filevercmp.c 10 | 11 | $(TARGET): $(SRC) 12 | $(CXX) $(CCFLAGS) $(SRC) $(LIBARG) $(INC) -o $@ 13 | 14 | clean: 15 | rm -f $(TARGET) 16 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | lcMLkin (Maximum Likelihood Estimation of Relatedness) 2 | ====================================================== 3 | 4 | [![Join the chat at https://gitter.im/COMBINE-lab/maximum-likelihood-relatedness-estimation](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/COMBINE-lab/maximum-likelihood-relatedness-estimation?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) 5 | 6 | How to Compile: 7 | 8 | *Note: This code requires a C++11 compliant compiler. g++ >= 4.7.3 and clang >= 3.4 should be OK* 9 | 10 | 1.) `> git clone https://github.com/COMBINE-lab/maximum-likelihood-relatedness-estimation.git` 11 | 12 | 2.) `> cd maximum-likelihood-relatedness-estimation` 13 | 14 | 3.) `> make` 15 | 16 | Now, you should have an executable in this directory called `lcmlkin`. You can run it with the `-h` option 17 | to get help. A typical run would look something like: 18 | 19 | 4.) `> lcmlkin -i input.vcf -o output.relate -g all -t 8` 20 | 21 | This will run `lcmlkin` on the file `input.vcf`, estimate background allele frequencies assuming all individuals are unrelated, and using the variant of the algorithm that sums over all genotypes given their likelihoods (`-g all`). It will write the output to the file `output.relate`, and will make use of up to 8 worker threads (`-t 8`). 22 | 23 | Producing VCF input from BAM files 24 | ----------------------------------- 25 | 26 | A preliminary implementation of a script to generate lcMLkin-ready VCF files from a set of indexed BAM files is available under the `src_python/SNPbam2vcf` directory of the repository ([here](https://github.com/COMBINE-lab/maximum-likelihood-relatedness-estimation/tree/master/src_python/SNPbam2vcf)). There, you will find more information on the script including usage examples. 27 | 28 | Best Practices 29 | ----------------------------------- 30 | Detailed information on how to prepare input files with likelihoods and how to choose SNPs for analysis can be found in our [wiki] (https://github.com/COMBINE-lab/maximum-likelihood-relatedness-estimation/wiki). 31 | -------------------------------------------------------------------------------- /data/SNPbam2vcf_data/NA12877_S1_play.bam: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/COMBINE-lab/maximum-likelihood-relatedness-estimation/8ec5bbe8f6797accfcafec35abdf5bb6a24e47e6/data/SNPbam2vcf_data/NA12877_S1_play.bam -------------------------------------------------------------------------------- /data/SNPbam2vcf_data/NA12877_S1_play.bam.bai: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/COMBINE-lab/maximum-likelihood-relatedness-estimation/8ec5bbe8f6797accfcafec35abdf5bb6a24e47e6/data/SNPbam2vcf_data/NA12877_S1_play.bam.bai -------------------------------------------------------------------------------- /data/SNPbam2vcf_data/NA12883_S1_play.bam: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/COMBINE-lab/maximum-likelihood-relatedness-estimation/8ec5bbe8f6797accfcafec35abdf5bb6a24e47e6/data/SNPbam2vcf_data/NA12883_S1_play.bam -------------------------------------------------------------------------------- /data/SNPbam2vcf_data/NA12883_S1_play.bam.bai: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/COMBINE-lab/maximum-likelihood-relatedness-estimation/8ec5bbe8f6797accfcafec35abdf5bb6a24e47e6/data/SNPbam2vcf_data/NA12883_S1_play.bam.bai -------------------------------------------------------------------------------- /data/SNPbam2vcf_data/NA12885_S1_play.bam: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/COMBINE-lab/maximum-likelihood-relatedness-estimation/8ec5bbe8f6797accfcafec35abdf5bb6a24e47e6/data/SNPbam2vcf_data/NA12885_S1_play.bam -------------------------------------------------------------------------------- /data/SNPbam2vcf_data/NA12885_S1_play.bam.bai: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/COMBINE-lab/maximum-likelihood-relatedness-estimation/8ec5bbe8f6797accfcafec35abdf5bb6a24e47e6/data/SNPbam2vcf_data/NA12885_S1_play.bam.bai -------------------------------------------------------------------------------- /data/SNPbam2vcf_data/NA12889_S1_play.bam: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/COMBINE-lab/maximum-likelihood-relatedness-estimation/8ec5bbe8f6797accfcafec35abdf5bb6a24e47e6/data/SNPbam2vcf_data/NA12889_S1_play.bam -------------------------------------------------------------------------------- /data/SNPbam2vcf_data/NA12889_S1_play.bam.bai: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/COMBINE-lab/maximum-likelihood-relatedness-estimation/8ec5bbe8f6797accfcafec35abdf5bb6a24e47e6/data/SNPbam2vcf_data/NA12889_S1_play.bam.bai -------------------------------------------------------------------------------- /data/SNPbam2vcf_data/NA12890_S1_play.bam: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/COMBINE-lab/maximum-likelihood-relatedness-estimation/8ec5bbe8f6797accfcafec35abdf5bb6a24e47e6/data/SNPbam2vcf_data/NA12890_S1_play.bam -------------------------------------------------------------------------------- /data/SNPbam2vcf_data/NA12890_S1_play.bam.bai: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/COMBINE-lab/maximum-likelihood-relatedness-estimation/8ec5bbe8f6797accfcafec35abdf5bb6a24e47e6/data/SNPbam2vcf_data/NA12890_S1_play.bam.bai -------------------------------------------------------------------------------- /data/SNPbam2vcf_data/SNP.list: -------------------------------------------------------------------------------- 1 | chr1 752566 G A 2 | chr1 1018704 A G 3 | chr1 1297422 C T 4 | chr1 1581586 T C 5 | chr1 1852134 A G 6 | chr1 2118339 A G 7 | chr1 2368706 T C 8 | chr1 2713327 C T 9 | chr1 2994717 C A 10 | chr1 3251159 T C 11 | -------------------------------------------------------------------------------- /data/SNPbam2vcf_data/bam.list: -------------------------------------------------------------------------------- 1 | NA12877_S1_play.bam 2 | NA12883_S1_play.bam 3 | NA12885_S1_play.bam 4 | NA12889_S1_play.bam 5 | NA12890_S1_play.bam 6 | -------------------------------------------------------------------------------- /data/test.vcf: -------------------------------------------------------------------------------- 1 | #CHROM POS ID REF ALT QUAL FILTER INFO FORMAT NA12877 NA12883 NA12885 NA12889 NA12890 2 | chr1 752566 . G A 100 ALT ALT_AF=0.3 GT:GL:GQ 0/1:2.13029714134e-42,1.90734863281e-06,1.01282982878e-38:323 1/1:2.05030001582e-78,3.81469726562e-06,0.998574693453:54 0/1:1.01329600691e-40,1.52587890625e-05,2.88405298116e-31:257 1/1:1.33724548871e-99,1.19209289551e-07,0.997507426302:69 0/1:3.10004745384e-16,3.24749725744e-06,2.02236614889e-38:100 3 | chr1 1018704 . A G 100 ALT ALT_AF=0.3 GT:GL:GQ 1/1:3.56177267738e-46,0.00048828125,0.999110727412:33 0/1:4.25234314882e-43,6.103515625e-05,2.46163368879e-17:124 0/1:2.02125179925e-35,3.81469726562e-06,1.60308705982e-38:293 0/1:3.26557333003e-22,3.0517578125e-05,1.69295946892e-41:170 1/1:2.09075158129e-53,6.103515625e-05,0.94422864001:42 4 | chr1 1297422 . C T 100 ALT ALT_AF=0.0 GT:GL:GQ 1/1:2.49702958907e-54,0.0001220703125,0.998857324099:39 1/1:2.44871741425e-69,7.62939453125e-06,0.994319909081:51 1/1:6.03189330451e-83,4.76837158203e-07,0.992069435278:63 1/1:2.40133997654e-84,4.76837158203e-07,0.996382070507:63 1/1:8.77366765144e-59,3.0517578125e-05,0.997554981538:45 5 | chr1 1581586 . T C 100 ALT ALT_AF=0.0 GT:GL:GQ 1/1:1.69350878084e-38,0.0009765625,0.94630121519:30 1/1:1.66074301281e-56,6.103515625e-05,0.998190425667:42 1/1:2.54629494298e-37,0.001953125,0.999064397999:27 1/1:7.63888482895e-35,0.00390625,0.999516515207:24 1/1:5.4610037113e-26,0.015625,0.999534350268:18 6 | chr1 1852134 . A G 100 ALT ALT_AF=0.5 GT:GL:GQ 0/1:6.73232394168e-41,5.96046447754e-08,5.23137965765e-59:329 0/1:1.25079650302e-54,5.96046447754e-08,1.12472504605e-48:407 0/1:3.25114398498e-62,1.86264514923e-09,2.08364329952e-54:450 1/1:1.36362878531e-78,1.90734863281e-06,0.997974335057:57 0/0:0.996467734876,4.76837158203e-07,3.8058673816e-87:63 7 | chr1 2118339 . A G 100 ALT ALT_AF=1.0 GT:GL:GQ 0/0:0.992503619431,6.103515625e-05,3.31361794831e-58:42 0/0:0.990714614319,2.38418579102e-07,6.35817381513e-90:66 0/0:0.945641734877,2.38418579102e-07,8.00446658847e-90:66 0/0:0.997567010244,5.96046447754e-08,2.81248287492e-103:72 0/0:0.998816768307,3.0517578125e-05,3.49286000409e-64:45 8 | chr1 2368706 . T C 100 ALT ALT_AF=0.9 GT:GL:GQ 0/0:0.991575107965,9.53674316406e-07,9.06932375647e-81:60 0/0:0.995656203447,9.53674316406e-07,1.43739094819e-79:60 0/0:0.894374675536,2.38418579102e-07,3.18663554532e-84:66 0/0:0.996362660296,2.38418579102e-07,1.26862246053e-88:66 0/1:7.21239416379e-31,5.96046447754e-08,2.44779410338e-68:229 9 | chr1 2713327 . C T 100 ALT ALT_AF=0.9 GT:GL:GQ 0/0:0.996292473037,1.19209289551e-07,6.70210367168e-94:69 0/0:0.994733085152,3.0517578125e-05,6.96917193763e-63:45 0/0:0.915046470184,0.0001220703125,6.27225474386e-51:39 0/1:3.13728663754e-50,2.38418579102e-07,5.03501708315e-37:297 0/0:0.994190441237,0.0009765625,1.34520184038e-41:30 10 | chr1 2994717 . C A 100 ALT ALT_AF=1.0 GT:GL:GQ 0/0:0.996821748747,1.52587890625e-05,2.32305731254e-63:48 0/0:0.926698262744,7.62939453125e-06,1.54503623708e-64:51 0/0:0.997192435381,4.76837158203e-07,3.8058673816e-85:63 0/0:0.983166157626,7.45058059692e-09,3.29401917221e-105:81 0/0:0.989098383336,1.19209289551e-07,2.66815552949e-92:69 11 | chr1 3251159 . T C 100 ALT ALT_AF=1.0 GT:GL:GQ 0/0:0.991647297538,1.49011611938e-08,1.97172969573e-105:78 0/0:0.994214296843,3.72529029846e-09,6.92795196521e-113:84 0/0:0.998592211112,7.62939453125e-06,7.74352437514e-72:51 0/0:0.92777201631,5.96046447754e-08,8.89385176496e-97:72 0/0:0.997840554297,1.19209289551e-07,2.66815552949e-95:69 12 | -------------------------------------------------------------------------------- /data/test_extrahead.vcf: -------------------------------------------------------------------------------- 1 | ##Custom variant caller for_lcMLkin 2 | ##Bayesian_caller=0,MappingQuality_filter=20,BaseQuality_filter=5,GenotypeQuality_filter=0.1,bamlist=bam.list,filenameout=test_extrahead.vcf,SNPfile=SNP.list 3 | ##Time created: 17:01:16 14/08/2015 4 | #CHROM POS ID REF ALT QUAL FILTER INFO FORMAT NA12877 NA12883 NA12885 NA12889 NA12890 5 | chr1 752566 . G A 100 ALT ALT_AF=0.3 GT:GL:GQ 0/1:2.13029714134e-42,1.90734863281e-06,1.01282982878e-38:323 1/1:2.05030001582e-78,3.81469726562e-06,0.998574693453:54 0/1:1.01329600691e-40,1.52587890625e-05,2.88405298116e-31:257 1/1:1.33724548871e-99,1.19209289551e-07,0.997507426302:69 0/1:3.10004745384e-16,3.24749725744e-06,2.02236614889e-38:100 6 | chr1 1018704 . A G 100 ALT ALT_AF=0.3 GT:GL:GQ 1/1:3.56177267738e-46,0.00048828125,0.999110727412:33 0/1:4.25234314882e-43,6.103515625e-05,2.46163368879e-17:124 0/1:2.02125179925e-35,3.81469726562e-06,1.60308705982e-38:293 0/1:3.26557333003e-22,3.0517578125e-05,1.69295946892e-41:170 1/1:2.09075158129e-53,6.103515625e-05,0.94422864001:42 7 | chr1 1297422 . C T 100 ALT ALT_AF=0.0 GT:GL:GQ 1/1:2.49702958907e-54,0.0001220703125,0.998857324099:39 1/1:2.44871741425e-69,7.62939453125e-06,0.994319909081:51 1/1:6.03189330451e-83,4.76837158203e-07,0.992069435278:63 1/1:2.40133997654e-84,4.76837158203e-07,0.996382070507:63 1/1:8.77366765144e-59,3.0517578125e-05,0.997554981538:45 8 | chr1 1581586 . T C 100 ALT ALT_AF=0.0 GT:GL:GQ 1/1:1.69350878084e-38,0.0009765625,0.94630121519:30 1/1:1.66074301281e-56,6.103515625e-05,0.998190425667:42 1/1:2.54629494298e-37,0.001953125,0.999064397999:27 1/1:7.63888482895e-35,0.00390625,0.999516515207:24 1/1:5.4610037113e-26,0.015625,0.999534350268:18 9 | chr1 1852134 . A G 100 ALT ALT_AF=0.5 GT:GL:GQ 0/1:6.73232394168e-41,5.96046447754e-08,5.23137965765e-59:329 0/1:1.25079650302e-54,5.96046447754e-08,1.12472504605e-48:407 0/1:3.25114398498e-62,1.86264514923e-09,2.08364329952e-54:450 1/1:1.36362878531e-78,1.90734863281e-06,0.997974335057:57 0/0:0.996467734876,4.76837158203e-07,3.8058673816e-87:63 10 | chr1 2118339 . A G 100 ALT ALT_AF=1.0 GT:GL:GQ 0/0:0.992503619431,6.103515625e-05,3.31361794831e-58:42 0/0:0.990714614319,2.38418579102e-07,6.35817381513e-90:66 0/0:0.945641734877,2.38418579102e-07,8.00446658847e-90:66 0/0:0.997567010244,5.96046447754e-08,2.81248287492e-103:72 0/0:0.998816768307,3.0517578125e-05,3.49286000409e-64:45 11 | chr1 2368706 . T C 100 ALT ALT_AF=0.9 GT:GL:GQ 0/0:0.991575107965,9.53674316406e-07,9.06932375647e-81:60 0/0:0.995656203447,9.53674316406e-07,1.43739094819e-79:60 0/0:0.894374675536,2.38418579102e-07,3.18663554532e-84:66 0/0:0.996362660296,2.38418579102e-07,1.26862246053e-88:66 0/1:7.21239416379e-31,5.96046447754e-08,2.44779410338e-68:229 12 | chr1 2713327 . C T 100 ALT ALT_AF=0.9 GT:GL:GQ 0/0:0.996292473037,1.19209289551e-07,6.70210367168e-94:69 0/0:0.994733085152,3.0517578125e-05,6.96917193763e-63:45 0/0:0.915046470184,0.0001220703125,6.27225474386e-51:39 0/1:3.13728663754e-50,2.38418579102e-07,5.03501708315e-37:297 0/0:0.994190441237,0.0009765625,1.34520184038e-41:30 13 | chr1 2994717 . C A 100 ALT ALT_AF=1.0 GT:GL:GQ 0/0:0.996821748747,1.52587890625e-05,2.32305731254e-63:48 0/0:0.926698262744,7.62939453125e-06,1.54503623708e-64:51 0/0:0.997192435381,4.76837158203e-07,3.8058673816e-85:63 0/0:0.983166157626,7.45058059692e-09,3.29401917221e-105:81 0/0:0.989098383336,1.19209289551e-07,2.66815552949e-92:69 14 | chr1 3251159 . T C 100 ALT ALT_AF=1.0 GT:GL:GQ 0/0:0.991647297538,1.49011611938e-08,1.97172969573e-105:78 0/0:0.994214296843,3.72529029846e-09,6.92795196521e-113:84 0/0:0.998592211112,7.62939453125e-06,7.74352437514e-72:51 0/0:0.92777201631,5.96046447754e-08,8.89385176496e-97:72 0/0:0.997840554297,1.19209289551e-07,2.66815552949e-95:69 15 | -------------------------------------------------------------------------------- /include/Eigen/Array: -------------------------------------------------------------------------------- 1 | #ifndef EIGEN_ARRAY_MODULE_H 2 | #define EIGEN_ARRAY_MODULE_H 3 | 4 | // include Core first to handle Eigen2 support macros 5 | #include "Core" 6 | 7 | #ifndef EIGEN2_SUPPORT 8 | #error The Eigen/Array header does no longer exist in Eigen3. All that functionality has moved to Eigen/Core. 9 | #endif 10 | 11 | #endif // EIGEN_ARRAY_MODULE_H 12 | -------------------------------------------------------------------------------- /include/Eigen/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | include(RegexUtils) 2 | test_escape_string_as_regex() 3 | 4 | file(GLOB Eigen_directory_files "*") 5 | 6 | escape_string_as_regex(ESCAPED_CMAKE_CURRENT_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}") 7 | 8 | foreach(f ${Eigen_directory_files}) 9 | if(NOT f MATCHES "\\.txt" AND NOT f MATCHES "${ESCAPED_CMAKE_CURRENT_SOURCE_DIR}/[.].+" AND NOT f MATCHES "${ESCAPED_CMAKE_CURRENT_SOURCE_DIR}/src") 10 | list(APPEND Eigen_directory_files_to_install ${f}) 11 | endif() 12 | endforeach(f ${Eigen_directory_files}) 13 | 14 | install(FILES 15 | ${Eigen_directory_files_to_install} 16 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen COMPONENT Devel 17 | ) 18 | 19 | add_subdirectory(src) 20 | -------------------------------------------------------------------------------- /include/Eigen/Cholesky: -------------------------------------------------------------------------------- 1 | #ifndef EIGEN_CHOLESKY_MODULE_H 2 | #define EIGEN_CHOLESKY_MODULE_H 3 | 4 | #include "Core" 5 | 6 | #include "src/Core/util/DisableStupidWarnings.h" 7 | 8 | /** \defgroup Cholesky_Module Cholesky module 9 | * 10 | * 11 | * 12 | * This module provides two variants of the Cholesky decomposition for selfadjoint (hermitian) matrices. 13 | * Those decompositions are accessible via the following MatrixBase methods: 14 | * - MatrixBase::llt(), 15 | * - MatrixBase::ldlt() 16 | * 17 | * \code 18 | * #include 19 | * \endcode 20 | */ 21 | 22 | #include "src/misc/Solve.h" 23 | #include "src/Cholesky/LLT.h" 24 | #include "src/Cholesky/LDLT.h" 25 | #ifdef EIGEN_USE_LAPACKE 26 | #include "src/Cholesky/LLT_MKL.h" 27 | #endif 28 | 29 | #include "src/Core/util/ReenableStupidWarnings.h" 30 | 31 | #endif // EIGEN_CHOLESKY_MODULE_H 32 | /* vim: set filetype=cpp et sw=2 ts=2 ai: */ 33 | -------------------------------------------------------------------------------- /include/Eigen/CholmodSupport: -------------------------------------------------------------------------------- 1 | #ifndef EIGEN_CHOLMODSUPPORT_MODULE_H 2 | #define EIGEN_CHOLMODSUPPORT_MODULE_H 3 | 4 | #include "SparseCore" 5 | 6 | #include "src/Core/util/DisableStupidWarnings.h" 7 | 8 | extern "C" { 9 | #include 10 | } 11 | 12 | /** \ingroup Support_modules 13 | * \defgroup CholmodSupport_Module CholmodSupport module 14 | * 15 | * This module provides an interface to the Cholmod library which is part of the suitesparse package. 16 | * It provides the two following main factorization classes: 17 | * - class CholmodSupernodalLLT: a supernodal LLT Cholesky factorization. 18 | * - class CholmodDecomposiiton: a general L(D)LT Cholesky factorization with automatic or explicit runtime selection of the underlying factorization method (supernodal or simplicial). 19 | * 20 | * For the sake of completeness, this module also propose the two following classes: 21 | * - class CholmodSimplicialLLT 22 | * - class CholmodSimplicialLDLT 23 | * Note that these classes does not bring any particular advantage compared to the built-in 24 | * SimplicialLLT and SimplicialLDLT factorization classes. 25 | * 26 | * \code 27 | * #include 28 | * \endcode 29 | * 30 | * In order to use this module, the cholmod headers must be accessible from the include paths, and your binary must be linked to the cholmod library and its dependencies. 31 | * The dependencies depend on how cholmod has been compiled. 32 | * For a cmake based project, you can use our FindCholmod.cmake module to help you in this task. 33 | * 34 | */ 35 | 36 | #include "src/misc/Solve.h" 37 | #include "src/misc/SparseSolve.h" 38 | 39 | #include "src/CholmodSupport/CholmodSupport.h" 40 | 41 | 42 | #include "src/Core/util/ReenableStupidWarnings.h" 43 | 44 | #endif // EIGEN_CHOLMODSUPPORT_MODULE_H 45 | 46 | -------------------------------------------------------------------------------- /include/Eigen/Dense: -------------------------------------------------------------------------------- 1 | #include "Core" 2 | #include "LU" 3 | #include "Cholesky" 4 | #include "QR" 5 | #include "SVD" 6 | #include "Geometry" 7 | #include "Eigenvalues" 8 | -------------------------------------------------------------------------------- /include/Eigen/Eigen: -------------------------------------------------------------------------------- 1 | #include "Dense" 2 | //#include "Sparse" 3 | -------------------------------------------------------------------------------- /include/Eigen/Eigen2Support: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2009 Gael Guennebaud 5 | // 6 | // This Source Code Form is subject to the terms of the Mozilla 7 | // Public License v. 2.0. If a copy of the MPL was not distributed 8 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 9 | 10 | #ifndef EIGEN2SUPPORT_H 11 | #define EIGEN2SUPPORT_H 12 | 13 | #if (!defined(EIGEN2_SUPPORT)) || (!defined(EIGEN_CORE_H)) 14 | #error Eigen2 support must be enabled by defining EIGEN2_SUPPORT before including any Eigen header 15 | #endif 16 | 17 | #ifndef EIGEN_NO_EIGEN2_DEPRECATED_WARNING 18 | 19 | #if defined(__GNUC__) || defined(__INTEL_COMPILER) || defined(__clang__) 20 | #warning "Eigen2 support is deprecated in Eigen 3.2.x and it will be removed in Eigen 3.3. (Define EIGEN_NO_EIGEN2_DEPRECATED_WARNING to disable this warning)" 21 | #else 22 | #pragma message ("Eigen2 support is deprecated in Eigen 3.2.x and it will be removed in Eigen 3.3. (Define EIGEN_NO_EIGEN2_DEPRECATED_WARNING to disable this warning)") 23 | #endif 24 | 25 | #endif // EIGEN_NO_EIGEN2_DEPRECATED_WARNING 26 | 27 | #include "src/Core/util/DisableStupidWarnings.h" 28 | 29 | /** \ingroup Support_modules 30 | * \defgroup Eigen2Support_Module Eigen2 support module 31 | * 32 | * \warning Eigen2 support is deprecated in Eigen 3.2.x and it will be removed in Eigen 3.3. 33 | * 34 | * This module provides a couple of deprecated functions improving the compatibility with Eigen2. 35 | * 36 | * To use it, define EIGEN2_SUPPORT before including any Eigen header 37 | * \code 38 | * #define EIGEN2_SUPPORT 39 | * \endcode 40 | * 41 | */ 42 | 43 | #include "src/Eigen2Support/Macros.h" 44 | #include "src/Eigen2Support/Memory.h" 45 | #include "src/Eigen2Support/Meta.h" 46 | #include "src/Eigen2Support/Lazy.h" 47 | #include "src/Eigen2Support/Cwise.h" 48 | #include "src/Eigen2Support/CwiseOperators.h" 49 | #include "src/Eigen2Support/TriangularSolver.h" 50 | #include "src/Eigen2Support/Block.h" 51 | #include "src/Eigen2Support/VectorBlock.h" 52 | #include "src/Eigen2Support/Minor.h" 53 | #include "src/Eigen2Support/MathFunctions.h" 54 | 55 | 56 | #include "src/Core/util/ReenableStupidWarnings.h" 57 | 58 | // Eigen2 used to include iostream 59 | #include 60 | 61 | #define EIGEN_USING_MATRIX_TYPEDEFS_FOR_TYPE_AND_SIZE(TypeSuffix, SizeSuffix) \ 62 | using Eigen::Matrix##SizeSuffix##TypeSuffix; \ 63 | using Eigen::Vector##SizeSuffix##TypeSuffix; \ 64 | using Eigen::RowVector##SizeSuffix##TypeSuffix; 65 | 66 | #define EIGEN_USING_MATRIX_TYPEDEFS_FOR_TYPE(TypeSuffix) \ 67 | EIGEN_USING_MATRIX_TYPEDEFS_FOR_TYPE_AND_SIZE(TypeSuffix, 2) \ 68 | EIGEN_USING_MATRIX_TYPEDEFS_FOR_TYPE_AND_SIZE(TypeSuffix, 3) \ 69 | EIGEN_USING_MATRIX_TYPEDEFS_FOR_TYPE_AND_SIZE(TypeSuffix, 4) \ 70 | EIGEN_USING_MATRIX_TYPEDEFS_FOR_TYPE_AND_SIZE(TypeSuffix, X) \ 71 | 72 | #define EIGEN_USING_MATRIX_TYPEDEFS \ 73 | EIGEN_USING_MATRIX_TYPEDEFS_FOR_TYPE(i) \ 74 | EIGEN_USING_MATRIX_TYPEDEFS_FOR_TYPE(f) \ 75 | EIGEN_USING_MATRIX_TYPEDEFS_FOR_TYPE(d) \ 76 | EIGEN_USING_MATRIX_TYPEDEFS_FOR_TYPE(cf) \ 77 | EIGEN_USING_MATRIX_TYPEDEFS_FOR_TYPE(cd) 78 | 79 | #define USING_PART_OF_NAMESPACE_EIGEN \ 80 | EIGEN_USING_MATRIX_TYPEDEFS \ 81 | using Eigen::Matrix; \ 82 | using Eigen::MatrixBase; \ 83 | using Eigen::ei_random; \ 84 | using Eigen::ei_real; \ 85 | using Eigen::ei_imag; \ 86 | using Eigen::ei_conj; \ 87 | using Eigen::ei_abs; \ 88 | using Eigen::ei_abs2; \ 89 | using Eigen::ei_sqrt; \ 90 | using Eigen::ei_exp; \ 91 | using Eigen::ei_log; \ 92 | using Eigen::ei_sin; \ 93 | using Eigen::ei_cos; 94 | 95 | #endif // EIGEN2SUPPORT_H 96 | -------------------------------------------------------------------------------- /include/Eigen/Eigenvalues: -------------------------------------------------------------------------------- 1 | #ifndef EIGEN_EIGENVALUES_MODULE_H 2 | #define EIGEN_EIGENVALUES_MODULE_H 3 | 4 | #include "Core" 5 | 6 | #include "src/Core/util/DisableStupidWarnings.h" 7 | 8 | #include "Cholesky" 9 | #include "Jacobi" 10 | #include "Householder" 11 | #include "LU" 12 | #include "Geometry" 13 | 14 | /** \defgroup Eigenvalues_Module Eigenvalues module 15 | * 16 | * 17 | * 18 | * This module mainly provides various eigenvalue solvers. 19 | * This module also provides some MatrixBase methods, including: 20 | * - MatrixBase::eigenvalues(), 21 | * - MatrixBase::operatorNorm() 22 | * 23 | * \code 24 | * #include 25 | * \endcode 26 | */ 27 | 28 | #include "src/Eigenvalues/Tridiagonalization.h" 29 | #include "src/Eigenvalues/RealSchur.h" 30 | #include "src/Eigenvalues/EigenSolver.h" 31 | #include "src/Eigenvalues/SelfAdjointEigenSolver.h" 32 | #include "src/Eigenvalues/GeneralizedSelfAdjointEigenSolver.h" 33 | #include "src/Eigenvalues/HessenbergDecomposition.h" 34 | #include "src/Eigenvalues/ComplexSchur.h" 35 | #include "src/Eigenvalues/ComplexEigenSolver.h" 36 | #include "src/Eigenvalues/RealQZ.h" 37 | #include "src/Eigenvalues/GeneralizedEigenSolver.h" 38 | #include "src/Eigenvalues/MatrixBaseEigenvalues.h" 39 | #ifdef EIGEN_USE_LAPACKE 40 | #include "src/Eigenvalues/RealSchur_MKL.h" 41 | #include "src/Eigenvalues/ComplexSchur_MKL.h" 42 | #include "src/Eigenvalues/SelfAdjointEigenSolver_MKL.h" 43 | #endif 44 | 45 | #include "src/Core/util/ReenableStupidWarnings.h" 46 | 47 | #endif // EIGEN_EIGENVALUES_MODULE_H 48 | /* vim: set filetype=cpp et sw=2 ts=2 ai: */ 49 | -------------------------------------------------------------------------------- /include/Eigen/Geometry: -------------------------------------------------------------------------------- 1 | #ifndef EIGEN_GEOMETRY_MODULE_H 2 | #define EIGEN_GEOMETRY_MODULE_H 3 | 4 | #include "Core" 5 | 6 | #include "src/Core/util/DisableStupidWarnings.h" 7 | 8 | #include "SVD" 9 | #include "LU" 10 | #include 11 | 12 | #ifndef M_PI 13 | #define M_PI 3.14159265358979323846 14 | #endif 15 | 16 | /** \defgroup Geometry_Module Geometry module 17 | * 18 | * 19 | * 20 | * This module provides support for: 21 | * - fixed-size homogeneous transformations 22 | * - translation, scaling, 2D and 3D rotations 23 | * - quaternions 24 | * - \ref MatrixBase::cross() "cross product" 25 | * - \ref MatrixBase::unitOrthogonal() "orthognal vector generation" 26 | * - some linear components: parametrized-lines and hyperplanes 27 | * 28 | * \code 29 | * #include 30 | * \endcode 31 | */ 32 | 33 | #include "src/Geometry/OrthoMethods.h" 34 | #include "src/Geometry/EulerAngles.h" 35 | 36 | #if EIGEN2_SUPPORT_STAGE > STAGE20_RESOLVE_API_CONFLICTS 37 | #include "src/Geometry/Homogeneous.h" 38 | #include "src/Geometry/RotationBase.h" 39 | #include "src/Geometry/Rotation2D.h" 40 | #include "src/Geometry/Quaternion.h" 41 | #include "src/Geometry/AngleAxis.h" 42 | #include "src/Geometry/Transform.h" 43 | #include "src/Geometry/Translation.h" 44 | #include "src/Geometry/Scaling.h" 45 | #include "src/Geometry/Hyperplane.h" 46 | #include "src/Geometry/ParametrizedLine.h" 47 | #include "src/Geometry/AlignedBox.h" 48 | #include "src/Geometry/Umeyama.h" 49 | 50 | #if defined EIGEN_VECTORIZE_SSE 51 | #include "src/Geometry/arch/Geometry_SSE.h" 52 | #endif 53 | #endif 54 | 55 | #ifdef EIGEN2_SUPPORT 56 | #include "src/Eigen2Support/Geometry/All.h" 57 | #endif 58 | 59 | #include "src/Core/util/ReenableStupidWarnings.h" 60 | 61 | #endif // EIGEN_GEOMETRY_MODULE_H 62 | /* vim: set filetype=cpp et sw=2 ts=2 ai: */ 63 | 64 | -------------------------------------------------------------------------------- /include/Eigen/Householder: -------------------------------------------------------------------------------- 1 | #ifndef EIGEN_HOUSEHOLDER_MODULE_H 2 | #define EIGEN_HOUSEHOLDER_MODULE_H 3 | 4 | #include "Core" 5 | 6 | #include "src/Core/util/DisableStupidWarnings.h" 7 | 8 | /** \defgroup Householder_Module Householder module 9 | * This module provides Householder transformations. 10 | * 11 | * \code 12 | * #include 13 | * \endcode 14 | */ 15 | 16 | #include "src/Householder/Householder.h" 17 | #include "src/Householder/HouseholderSequence.h" 18 | #include "src/Householder/BlockHouseholder.h" 19 | 20 | #include "src/Core/util/ReenableStupidWarnings.h" 21 | 22 | #endif // EIGEN_HOUSEHOLDER_MODULE_H 23 | /* vim: set filetype=cpp et sw=2 ts=2 ai: */ 24 | -------------------------------------------------------------------------------- /include/Eigen/IterativeLinearSolvers: -------------------------------------------------------------------------------- 1 | #ifndef EIGEN_ITERATIVELINEARSOLVERS_MODULE_H 2 | #define EIGEN_ITERATIVELINEARSOLVERS_MODULE_H 3 | 4 | #include "SparseCore" 5 | #include "OrderingMethods" 6 | 7 | #include "src/Core/util/DisableStupidWarnings.h" 8 | 9 | /** 10 | * \defgroup IterativeLinearSolvers_Module IterativeLinearSolvers module 11 | * 12 | * This module currently provides iterative methods to solve problems of the form \c A \c x = \c b, where \c A is a squared matrix, usually very large and sparse. 13 | * Those solvers are accessible via the following classes: 14 | * - ConjugateGradient for selfadjoint (hermitian) matrices, 15 | * - BiCGSTAB for general square matrices. 16 | * 17 | * These iterative solvers are associated with some preconditioners: 18 | * - IdentityPreconditioner - not really useful 19 | * - DiagonalPreconditioner - also called JAcobi preconditioner, work very well on diagonal dominant matrices. 20 | * - IncompleteILUT - incomplete LU factorization with dual thresholding 21 | * 22 | * Such problems can also be solved using the direct sparse decomposition modules: SparseCholesky, CholmodSupport, UmfPackSupport, SuperLUSupport. 23 | * 24 | * \code 25 | * #include 26 | * \endcode 27 | */ 28 | 29 | #include "src/misc/Solve.h" 30 | #include "src/misc/SparseSolve.h" 31 | 32 | #include "src/IterativeLinearSolvers/IterativeSolverBase.h" 33 | #include "src/IterativeLinearSolvers/BasicPreconditioners.h" 34 | #include "src/IterativeLinearSolvers/ConjugateGradient.h" 35 | #include "src/IterativeLinearSolvers/BiCGSTAB.h" 36 | #include "src/IterativeLinearSolvers/IncompleteLUT.h" 37 | 38 | #include "src/Core/util/ReenableStupidWarnings.h" 39 | 40 | #endif // EIGEN_ITERATIVELINEARSOLVERS_MODULE_H 41 | -------------------------------------------------------------------------------- /include/Eigen/Jacobi: -------------------------------------------------------------------------------- 1 | #ifndef EIGEN_JACOBI_MODULE_H 2 | #define EIGEN_JACOBI_MODULE_H 3 | 4 | #include "Core" 5 | 6 | #include "src/Core/util/DisableStupidWarnings.h" 7 | 8 | /** \defgroup Jacobi_Module Jacobi module 9 | * This module provides Jacobi and Givens rotations. 10 | * 11 | * \code 12 | * #include 13 | * \endcode 14 | * 15 | * In addition to listed classes, it defines the two following MatrixBase methods to apply a Jacobi or Givens rotation: 16 | * - MatrixBase::applyOnTheLeft() 17 | * - MatrixBase::applyOnTheRight(). 18 | */ 19 | 20 | #include "src/Jacobi/Jacobi.h" 21 | 22 | #include "src/Core/util/ReenableStupidWarnings.h" 23 | 24 | #endif // EIGEN_JACOBI_MODULE_H 25 | /* vim: set filetype=cpp et sw=2 ts=2 ai: */ 26 | 27 | -------------------------------------------------------------------------------- /include/Eigen/LU: -------------------------------------------------------------------------------- 1 | #ifndef EIGEN_LU_MODULE_H 2 | #define EIGEN_LU_MODULE_H 3 | 4 | #include "Core" 5 | 6 | #include "src/Core/util/DisableStupidWarnings.h" 7 | 8 | /** \defgroup LU_Module LU module 9 | * This module includes %LU decomposition and related notions such as matrix inversion and determinant. 10 | * This module defines the following MatrixBase methods: 11 | * - MatrixBase::inverse() 12 | * - MatrixBase::determinant() 13 | * 14 | * \code 15 | * #include 16 | * \endcode 17 | */ 18 | 19 | #include "src/misc/Solve.h" 20 | #include "src/misc/Kernel.h" 21 | #include "src/misc/Image.h" 22 | #include "src/LU/FullPivLU.h" 23 | #include "src/LU/PartialPivLU.h" 24 | #ifdef EIGEN_USE_LAPACKE 25 | #include "src/LU/PartialPivLU_MKL.h" 26 | #endif 27 | #include "src/LU/Determinant.h" 28 | #include "src/LU/Inverse.h" 29 | 30 | #if defined EIGEN_VECTORIZE_SSE 31 | #include "src/LU/arch/Inverse_SSE.h" 32 | #endif 33 | 34 | #ifdef EIGEN2_SUPPORT 35 | #include "src/Eigen2Support/LU.h" 36 | #endif 37 | 38 | #include "src/Core/util/ReenableStupidWarnings.h" 39 | 40 | #endif // EIGEN_LU_MODULE_H 41 | /* vim: set filetype=cpp et sw=2 ts=2 ai: */ 42 | -------------------------------------------------------------------------------- /include/Eigen/LeastSquares: -------------------------------------------------------------------------------- 1 | #ifndef EIGEN_REGRESSION_MODULE_H 2 | #define EIGEN_REGRESSION_MODULE_H 3 | 4 | #ifndef EIGEN2_SUPPORT 5 | #error LeastSquares is only available in Eigen2 support mode (define EIGEN2_SUPPORT) 6 | #endif 7 | 8 | // exclude from normal eigen3-only documentation 9 | #ifdef EIGEN2_SUPPORT 10 | 11 | #include "Core" 12 | 13 | #include "src/Core/util/DisableStupidWarnings.h" 14 | 15 | #include "Eigenvalues" 16 | #include "Geometry" 17 | 18 | /** \defgroup LeastSquares_Module LeastSquares module 19 | * This module provides linear regression and related features. 20 | * 21 | * \code 22 | * #include 23 | * \endcode 24 | */ 25 | 26 | #include "src/Eigen2Support/LeastSquares.h" 27 | 28 | #include "src/Core/util/ReenableStupidWarnings.h" 29 | 30 | #endif // EIGEN2_SUPPORT 31 | 32 | #endif // EIGEN_REGRESSION_MODULE_H 33 | -------------------------------------------------------------------------------- /include/Eigen/MetisSupport: -------------------------------------------------------------------------------- 1 | #ifndef EIGEN_METISSUPPORT_MODULE_H 2 | #define EIGEN_METISSUPPORT_MODULE_H 3 | 4 | #include "SparseCore" 5 | 6 | #include "src/Core/util/DisableStupidWarnings.h" 7 | 8 | extern "C" { 9 | #include 10 | } 11 | 12 | 13 | /** \ingroup Support_modules 14 | * \defgroup MetisSupport_Module MetisSupport module 15 | * 16 | * \code 17 | * #include 18 | * \endcode 19 | * This module defines an interface to the METIS reordering package (http://glaros.dtc.umn.edu/gkhome/views/metis). 20 | * It can be used just as any other built-in method as explained in \link OrderingMethods_Module here. \endlink 21 | */ 22 | 23 | 24 | #include "src/MetisSupport/MetisSupport.h" 25 | 26 | #include "src/Core/util/ReenableStupidWarnings.h" 27 | 28 | #endif // EIGEN_METISSUPPORT_MODULE_H 29 | -------------------------------------------------------------------------------- /include/Eigen/OrderingMethods: -------------------------------------------------------------------------------- 1 | #ifndef EIGEN_ORDERINGMETHODS_MODULE_H 2 | #define EIGEN_ORDERINGMETHODS_MODULE_H 3 | 4 | #include "SparseCore" 5 | 6 | #include "src/Core/util/DisableStupidWarnings.h" 7 | 8 | /** 9 | * \defgroup OrderingMethods_Module OrderingMethods module 10 | * 11 | * This module is currently for internal use only 12 | * 13 | * It defines various built-in and external ordering methods for sparse matrices. 14 | * They are typically used to reduce the number of elements during 15 | * the sparse matrix decomposition (LLT, LU, QR). 16 | * Precisely, in a preprocessing step, a permutation matrix P is computed using 17 | * those ordering methods and applied to the columns of the matrix. 18 | * Using for instance the sparse Cholesky decomposition, it is expected that 19 | * the nonzeros elements in LLT(A*P) will be much smaller than that in LLT(A). 20 | * 21 | * 22 | * Usage : 23 | * \code 24 | * #include 25 | * \endcode 26 | * 27 | * A simple usage is as a template parameter in the sparse decomposition classes : 28 | * 29 | * \code 30 | * SparseLU > solver; 31 | * \endcode 32 | * 33 | * \code 34 | * SparseQR > solver; 35 | * \endcode 36 | * 37 | * It is possible as well to call directly a particular ordering method for your own purpose, 38 | * \code 39 | * AMDOrdering ordering; 40 | * PermutationMatrix perm; 41 | * SparseMatrix A; 42 | * //Fill the matrix ... 43 | * 44 | * ordering(A, perm); // Call AMD 45 | * \endcode 46 | * 47 | * \note Some of these methods (like AMD or METIS), need the sparsity pattern 48 | * of the input matrix to be symmetric. When the matrix is structurally unsymmetric, 49 | * Eigen computes internally the pattern of \f$A^T*A\f$ before calling the method. 50 | * If your matrix is already symmetric (at leat in structure), you can avoid that 51 | * by calling the method with a SelfAdjointView type. 52 | * 53 | * \code 54 | * // Call the ordering on the pattern of the lower triangular matrix A 55 | * ordering(A.selfadjointView(), perm); 56 | * \endcode 57 | */ 58 | 59 | #ifndef EIGEN_MPL2_ONLY 60 | #include "src/OrderingMethods/Amd.h" 61 | #endif 62 | 63 | #include "src/OrderingMethods/Ordering.h" 64 | #include "src/Core/util/ReenableStupidWarnings.h" 65 | 66 | #endif // EIGEN_ORDERINGMETHODS_MODULE_H 67 | -------------------------------------------------------------------------------- /include/Eigen/PaStiXSupport: -------------------------------------------------------------------------------- 1 | #ifndef EIGEN_PASTIXSUPPORT_MODULE_H 2 | #define EIGEN_PASTIXSUPPORT_MODULE_H 3 | 4 | #include "SparseCore" 5 | 6 | #include "src/Core/util/DisableStupidWarnings.h" 7 | 8 | #include 9 | extern "C" { 10 | #include 11 | #include 12 | } 13 | 14 | #ifdef complex 15 | #undef complex 16 | #endif 17 | 18 | /** \ingroup Support_modules 19 | * \defgroup PaStiXSupport_Module PaStiXSupport module 20 | * 21 | * This module provides an interface to the PaSTiX library. 22 | * PaSTiX is a general \b supernodal, \b parallel and \b opensource sparse solver. 23 | * It provides the two following main factorization classes: 24 | * - class PastixLLT : a supernodal, parallel LLt Cholesky factorization. 25 | * - class PastixLDLT: a supernodal, parallel LDLt Cholesky factorization. 26 | * - class PastixLU : a supernodal, parallel LU factorization (optimized for a symmetric pattern). 27 | * 28 | * \code 29 | * #include 30 | * \endcode 31 | * 32 | * 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. 33 | * The dependencies depend on how PaSTiX has been compiled. 34 | * For a cmake based project, you can use our FindPaSTiX.cmake module to help you in this task. 35 | * 36 | */ 37 | 38 | #include "src/misc/Solve.h" 39 | #include "src/misc/SparseSolve.h" 40 | 41 | #include "src/PaStiXSupport/PaStiXSupport.h" 42 | 43 | 44 | #include "src/Core/util/ReenableStupidWarnings.h" 45 | 46 | #endif // EIGEN_PASTIXSUPPORT_MODULE_H 47 | -------------------------------------------------------------------------------- /include/Eigen/PardisoSupport: -------------------------------------------------------------------------------- 1 | #ifndef EIGEN_PARDISOSUPPORT_MODULE_H 2 | #define EIGEN_PARDISOSUPPORT_MODULE_H 3 | 4 | #include "SparseCore" 5 | 6 | #include "src/Core/util/DisableStupidWarnings.h" 7 | 8 | #include 9 | 10 | #include 11 | 12 | /** \ingroup Support_modules 13 | * \defgroup PardisoSupport_Module PardisoSupport module 14 | * 15 | * This module brings support for the Intel(R) MKL PARDISO direct sparse solvers. 16 | * 17 | * \code 18 | * #include 19 | * \endcode 20 | * 21 | * In order to use this module, the MKL headers must be accessible from the include paths, and your binary must be linked to the MKL library and its dependencies. 22 | * See this \ref TopicUsingIntelMKL "page" for more information on MKL-Eigen integration. 23 | * 24 | */ 25 | 26 | #include "src/PardisoSupport/PardisoSupport.h" 27 | 28 | #include "src/Core/util/ReenableStupidWarnings.h" 29 | 30 | #endif // EIGEN_PARDISOSUPPORT_MODULE_H 31 | -------------------------------------------------------------------------------- /include/Eigen/QR: -------------------------------------------------------------------------------- 1 | #ifndef EIGEN_QR_MODULE_H 2 | #define EIGEN_QR_MODULE_H 3 | 4 | #include "Core" 5 | 6 | #include "src/Core/util/DisableStupidWarnings.h" 7 | 8 | #include "Cholesky" 9 | #include "Jacobi" 10 | #include "Householder" 11 | 12 | /** \defgroup QR_Module QR module 13 | * 14 | * 15 | * 16 | * This module provides various QR decompositions 17 | * This module also provides some MatrixBase methods, including: 18 | * - MatrixBase::qr(), 19 | * 20 | * \code 21 | * #include 22 | * \endcode 23 | */ 24 | 25 | #include "src/misc/Solve.h" 26 | #include "src/QR/HouseholderQR.h" 27 | #include "src/QR/FullPivHouseholderQR.h" 28 | #include "src/QR/ColPivHouseholderQR.h" 29 | #ifdef EIGEN_USE_LAPACKE 30 | #include "src/QR/HouseholderQR_MKL.h" 31 | #include "src/QR/ColPivHouseholderQR_MKL.h" 32 | #endif 33 | 34 | #ifdef EIGEN2_SUPPORT 35 | #include "src/Eigen2Support/QR.h" 36 | #endif 37 | 38 | #include "src/Core/util/ReenableStupidWarnings.h" 39 | 40 | #ifdef EIGEN2_SUPPORT 41 | #include "Eigenvalues" 42 | #endif 43 | 44 | #endif // EIGEN_QR_MODULE_H 45 | /* vim: set filetype=cpp et sw=2 ts=2 ai: */ 46 | -------------------------------------------------------------------------------- /include/Eigen/QtAlignedMalloc: -------------------------------------------------------------------------------- 1 | 2 | #ifndef EIGEN_QTMALLOC_MODULE_H 3 | #define EIGEN_QTMALLOC_MODULE_H 4 | 5 | #include "Core" 6 | 7 | #if (!EIGEN_MALLOC_ALREADY_ALIGNED) 8 | 9 | #include "src/Core/util/DisableStupidWarnings.h" 10 | 11 | void *qMalloc(size_t size) 12 | { 13 | return Eigen::internal::aligned_malloc(size); 14 | } 15 | 16 | void qFree(void *ptr) 17 | { 18 | Eigen::internal::aligned_free(ptr); 19 | } 20 | 21 | void *qRealloc(void *ptr, size_t size) 22 | { 23 | void* newPtr = Eigen::internal::aligned_malloc(size); 24 | memcpy(newPtr, ptr, size); 25 | Eigen::internal::aligned_free(ptr); 26 | return newPtr; 27 | } 28 | 29 | #include "src/Core/util/ReenableStupidWarnings.h" 30 | 31 | #endif 32 | 33 | #endif // EIGEN_QTMALLOC_MODULE_H 34 | /* vim: set filetype=cpp et sw=2 ts=2 ai: */ 35 | -------------------------------------------------------------------------------- /include/Eigen/SPQRSupport: -------------------------------------------------------------------------------- 1 | #ifndef EIGEN_SPQRSUPPORT_MODULE_H 2 | #define EIGEN_SPQRSUPPORT_MODULE_H 3 | 4 | #include "SparseCore" 5 | 6 | #include "src/Core/util/DisableStupidWarnings.h" 7 | 8 | #include "SuiteSparseQR.hpp" 9 | 10 | /** \ingroup Support_modules 11 | * \defgroup SPQRSupport_Module SuiteSparseQR module 12 | * 13 | * This module provides an interface to the SPQR library, which is part of the suitesparse package. 14 | * 15 | * \code 16 | * #include 17 | * \endcode 18 | * 19 | * In order to use this module, the SPQR headers must be accessible from the include paths, and your binary must be linked to the SPQR library and its dependencies (Cholmod, AMD, COLAMD,...). 20 | * For a cmake based project, you can use our FindSPQR.cmake and FindCholmod.Cmake modules 21 | * 22 | */ 23 | 24 | #include "src/misc/Solve.h" 25 | #include "src/misc/SparseSolve.h" 26 | #include "src/CholmodSupport/CholmodSupport.h" 27 | #include "src/SPQRSupport/SuiteSparseQRSupport.h" 28 | 29 | #endif 30 | -------------------------------------------------------------------------------- /include/Eigen/SVD: -------------------------------------------------------------------------------- 1 | #ifndef EIGEN_SVD_MODULE_H 2 | #define EIGEN_SVD_MODULE_H 3 | 4 | #include "QR" 5 | #include "Householder" 6 | #include "Jacobi" 7 | 8 | #include "src/Core/util/DisableStupidWarnings.h" 9 | 10 | /** \defgroup SVD_Module SVD module 11 | * 12 | * 13 | * 14 | * This module provides SVD decomposition for matrices (both real and complex). 15 | * This decomposition is accessible via the following MatrixBase method: 16 | * - MatrixBase::jacobiSvd() 17 | * 18 | * \code 19 | * #include 20 | * \endcode 21 | */ 22 | 23 | #include "src/misc/Solve.h" 24 | #include "src/SVD/JacobiSVD.h" 25 | #if defined(EIGEN_USE_LAPACKE) && !defined(EIGEN_USE_LAPACKE_STRICT) 26 | #include "src/SVD/JacobiSVD_MKL.h" 27 | #endif 28 | #include "src/SVD/UpperBidiagonalization.h" 29 | 30 | #ifdef EIGEN2_SUPPORT 31 | #include "src/Eigen2Support/SVD.h" 32 | #endif 33 | 34 | #include "src/Core/util/ReenableStupidWarnings.h" 35 | 36 | #endif // EIGEN_SVD_MODULE_H 37 | /* vim: set filetype=cpp et sw=2 ts=2 ai: */ 38 | -------------------------------------------------------------------------------- /include/Eigen/Sparse: -------------------------------------------------------------------------------- 1 | #ifndef EIGEN_SPARSE_MODULE_H 2 | #define EIGEN_SPARSE_MODULE_H 3 | 4 | /** \defgroup Sparse_Module Sparse meta-module 5 | * 6 | * Meta-module including all related modules: 7 | * - \ref SparseCore_Module 8 | * - \ref OrderingMethods_Module 9 | * - \ref SparseCholesky_Module 10 | * - \ref SparseLU_Module 11 | * - \ref SparseQR_Module 12 | * - \ref IterativeLinearSolvers_Module 13 | * 14 | * \code 15 | * #include 16 | * \endcode 17 | */ 18 | 19 | #include "SparseCore" 20 | #include "OrderingMethods" 21 | #include "SparseCholesky" 22 | #include "SparseLU" 23 | #include "SparseQR" 24 | #include "IterativeLinearSolvers" 25 | 26 | #endif // EIGEN_SPARSE_MODULE_H 27 | 28 | -------------------------------------------------------------------------------- /include/Eigen/SparseCholesky: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2008-2013 Gael Guennebaud 5 | // 6 | // This Source Code Form is subject to the terms of the Mozilla 7 | // Public License v. 2.0. If a copy of the MPL was not distributed 8 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 9 | 10 | #ifndef EIGEN_SPARSECHOLESKY_MODULE_H 11 | #define EIGEN_SPARSECHOLESKY_MODULE_H 12 | 13 | #include "SparseCore" 14 | #include "OrderingMethods" 15 | 16 | #include "src/Core/util/DisableStupidWarnings.h" 17 | 18 | /** 19 | * \defgroup SparseCholesky_Module SparseCholesky module 20 | * 21 | * This module currently provides two variants of the direct sparse Cholesky decomposition for selfadjoint (hermitian) matrices. 22 | * Those decompositions are accessible via the following classes: 23 | * - SimplicialLLt, 24 | * - SimplicialLDLt 25 | * 26 | * Such problems can also be solved using the ConjugateGradient solver from the IterativeLinearSolvers module. 27 | * 28 | * \code 29 | * #include 30 | * \endcode 31 | */ 32 | 33 | #ifdef EIGEN_MPL2_ONLY 34 | #error The SparseCholesky module has nothing to offer in MPL2 only mode 35 | #endif 36 | 37 | #include "src/misc/Solve.h" 38 | #include "src/misc/SparseSolve.h" 39 | #include "src/SparseCholesky/SimplicialCholesky.h" 40 | 41 | #ifndef EIGEN_MPL2_ONLY 42 | #include "src/SparseCholesky/SimplicialCholesky_impl.h" 43 | #endif 44 | 45 | #include "src/Core/util/ReenableStupidWarnings.h" 46 | 47 | #endif // EIGEN_SPARSECHOLESKY_MODULE_H 48 | -------------------------------------------------------------------------------- /include/Eigen/SparseCore: -------------------------------------------------------------------------------- 1 | #ifndef EIGEN_SPARSECORE_MODULE_H 2 | #define EIGEN_SPARSECORE_MODULE_H 3 | 4 | #include "Core" 5 | 6 | #include "src/Core/util/DisableStupidWarnings.h" 7 | 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | 14 | /** 15 | * \defgroup SparseCore_Module SparseCore module 16 | * 17 | * This module provides a sparse matrix representation, and basic associatd matrix manipulations 18 | * and operations. 19 | * 20 | * See the \ref TutorialSparse "Sparse tutorial" 21 | * 22 | * \code 23 | * #include 24 | * \endcode 25 | * 26 | * This module depends on: Core. 27 | */ 28 | 29 | namespace Eigen { 30 | 31 | /** The type used to identify a general sparse storage. */ 32 | struct Sparse {}; 33 | 34 | } 35 | 36 | #include "src/SparseCore/SparseUtil.h" 37 | #include "src/SparseCore/SparseMatrixBase.h" 38 | #include "src/SparseCore/CompressedStorage.h" 39 | #include "src/SparseCore/AmbiVector.h" 40 | #include "src/SparseCore/SparseMatrix.h" 41 | #include "src/SparseCore/MappedSparseMatrix.h" 42 | #include "src/SparseCore/SparseVector.h" 43 | #include "src/SparseCore/SparseBlock.h" 44 | #include "src/SparseCore/SparseTranspose.h" 45 | #include "src/SparseCore/SparseCwiseUnaryOp.h" 46 | #include "src/SparseCore/SparseCwiseBinaryOp.h" 47 | #include "src/SparseCore/SparseDot.h" 48 | #include "src/SparseCore/SparsePermutation.h" 49 | #include "src/SparseCore/SparseRedux.h" 50 | #include "src/SparseCore/SparseFuzzy.h" 51 | #include "src/SparseCore/ConservativeSparseSparseProduct.h" 52 | #include "src/SparseCore/SparseSparseProductWithPruning.h" 53 | #include "src/SparseCore/SparseProduct.h" 54 | #include "src/SparseCore/SparseDenseProduct.h" 55 | #include "src/SparseCore/SparseDiagonalProduct.h" 56 | #include "src/SparseCore/SparseTriangularView.h" 57 | #include "src/SparseCore/SparseSelfAdjointView.h" 58 | #include "src/SparseCore/TriangularSolver.h" 59 | #include "src/SparseCore/SparseView.h" 60 | 61 | #include "src/Core/util/ReenableStupidWarnings.h" 62 | 63 | #endif // EIGEN_SPARSECORE_MODULE_H 64 | 65 | -------------------------------------------------------------------------------- /include/Eigen/SparseLU: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2012 Désiré Nuentsa-Wakam 5 | // Copyright (C) 2012 Gael Guennebaud 6 | // 7 | // This Source Code Form is subject to the terms of the Mozilla 8 | // Public License v. 2.0. If a copy of the MPL was not distributed 9 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 10 | 11 | #ifndef EIGEN_SPARSELU_MODULE_H 12 | #define EIGEN_SPARSELU_MODULE_H 13 | 14 | #include "SparseCore" 15 | 16 | /** 17 | * \defgroup SparseLU_Module SparseLU module 18 | * This module defines a supernodal factorization of general sparse matrices. 19 | * The code is fully optimized for supernode-panel updates with specialized kernels. 20 | * Please, see the documentation of the SparseLU class for more details. 21 | */ 22 | 23 | #include "src/misc/Solve.h" 24 | #include "src/misc/SparseSolve.h" 25 | 26 | // Ordering interface 27 | #include "OrderingMethods" 28 | 29 | #include "src/SparseLU/SparseLU_gemm_kernel.h" 30 | 31 | #include "src/SparseLU/SparseLU_Structs.h" 32 | #include "src/SparseLU/SparseLU_SupernodalMatrix.h" 33 | #include "src/SparseLU/SparseLUImpl.h" 34 | #include "src/SparseCore/SparseColEtree.h" 35 | #include "src/SparseLU/SparseLU_Memory.h" 36 | #include "src/SparseLU/SparseLU_heap_relax_snode.h" 37 | #include "src/SparseLU/SparseLU_relax_snode.h" 38 | #include "src/SparseLU/SparseLU_pivotL.h" 39 | #include "src/SparseLU/SparseLU_panel_dfs.h" 40 | #include "src/SparseLU/SparseLU_kernel_bmod.h" 41 | #include "src/SparseLU/SparseLU_panel_bmod.h" 42 | #include "src/SparseLU/SparseLU_column_dfs.h" 43 | #include "src/SparseLU/SparseLU_column_bmod.h" 44 | #include "src/SparseLU/SparseLU_copy_to_ucol.h" 45 | #include "src/SparseLU/SparseLU_pruneL.h" 46 | #include "src/SparseLU/SparseLU_Utils.h" 47 | #include "src/SparseLU/SparseLU.h" 48 | 49 | #endif // EIGEN_SPARSELU_MODULE_H 50 | -------------------------------------------------------------------------------- /include/Eigen/SparseQR: -------------------------------------------------------------------------------- 1 | #ifndef EIGEN_SPARSEQR_MODULE_H 2 | #define EIGEN_SPARSEQR_MODULE_H 3 | 4 | #include "SparseCore" 5 | #include "OrderingMethods" 6 | #include "src/Core/util/DisableStupidWarnings.h" 7 | 8 | /** \defgroup SparseQR_Module SparseQR module 9 | * \brief Provides QR decomposition for sparse matrices 10 | * 11 | * This module provides a simplicial version of the left-looking Sparse QR decomposition. 12 | * The columns of the input matrix should be reordered to limit the fill-in during the 13 | * decomposition. Built-in methods (COLAMD, AMD) or external methods (METIS) can be used to this end. 14 | * See the \link OrderingMethods_Module OrderingMethods\endlink module for the list 15 | * of built-in and external ordering methods. 16 | * 17 | * \code 18 | * #include 19 | * \endcode 20 | * 21 | * 22 | */ 23 | 24 | #include "src/misc/Solve.h" 25 | #include "src/misc/SparseSolve.h" 26 | 27 | #include "OrderingMethods" 28 | #include "src/SparseCore/SparseColEtree.h" 29 | #include "src/SparseQR/SparseQR.h" 30 | 31 | #include "src/Core/util/ReenableStupidWarnings.h" 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /include/Eigen/StdDeque: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2009 Gael Guennebaud 5 | // Copyright (C) 2009 Hauke Heibel 6 | // 7 | // This Source Code Form is subject to the terms of the Mozilla 8 | // Public License v. 2.0. If a copy of the MPL was not distributed 9 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 10 | 11 | #ifndef EIGEN_STDDEQUE_MODULE_H 12 | #define EIGEN_STDDEQUE_MODULE_H 13 | 14 | #include "Core" 15 | #include 16 | 17 | #if (defined(_MSC_VER) && defined(_WIN64)) /* MSVC auto aligns in 64 bit builds */ 18 | 19 | #define EIGEN_DEFINE_STL_DEQUE_SPECIALIZATION(...) 20 | 21 | #else 22 | 23 | #include "src/StlSupport/StdDeque.h" 24 | 25 | #endif 26 | 27 | #endif // EIGEN_STDDEQUE_MODULE_H 28 | -------------------------------------------------------------------------------- /include/Eigen/StdList: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2009 Hauke Heibel 5 | // 6 | // This Source Code Form is subject to the terms of the Mozilla 7 | // Public License v. 2.0. If a copy of the MPL was not distributed 8 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 9 | 10 | #ifndef EIGEN_STDLIST_MODULE_H 11 | #define EIGEN_STDLIST_MODULE_H 12 | 13 | #include "Core" 14 | #include 15 | 16 | #if (defined(_MSC_VER) && defined(_WIN64)) /* MSVC auto aligns in 64 bit builds */ 17 | 18 | #define EIGEN_DEFINE_STL_LIST_SPECIALIZATION(...) 19 | 20 | #else 21 | 22 | #include "src/StlSupport/StdList.h" 23 | 24 | #endif 25 | 26 | #endif // EIGEN_STDLIST_MODULE_H 27 | -------------------------------------------------------------------------------- /include/Eigen/StdVector: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2009 Gael Guennebaud 5 | // Copyright (C) 2009 Hauke Heibel 6 | // 7 | // This Source Code Form is subject to the terms of the Mozilla 8 | // Public License v. 2.0. If a copy of the MPL was not distributed 9 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 10 | 11 | #ifndef EIGEN_STDVECTOR_MODULE_H 12 | #define EIGEN_STDVECTOR_MODULE_H 13 | 14 | #include "Core" 15 | #include 16 | 17 | #if (defined(_MSC_VER) && defined(_WIN64)) /* MSVC auto aligns in 64 bit builds */ 18 | 19 | #define EIGEN_DEFINE_STL_VECTOR_SPECIALIZATION(...) 20 | 21 | #else 22 | 23 | #include "src/StlSupport/StdVector.h" 24 | 25 | #endif 26 | 27 | #endif // EIGEN_STDVECTOR_MODULE_H 28 | -------------------------------------------------------------------------------- /include/Eigen/SuperLUSupport: -------------------------------------------------------------------------------- 1 | #ifndef EIGEN_SUPERLUSUPPORT_MODULE_H 2 | #define EIGEN_SUPERLUSUPPORT_MODULE_H 3 | 4 | #include "SparseCore" 5 | 6 | #include "src/Core/util/DisableStupidWarnings.h" 7 | 8 | #ifdef EMPTY 9 | #define EIGEN_EMPTY_WAS_ALREADY_DEFINED 10 | #endif 11 | 12 | typedef int int_t; 13 | #include 14 | #include 15 | #include 16 | 17 | // slu_util.h defines a preprocessor token named EMPTY which is really polluting, 18 | // so we remove it in favor of a SUPERLU_EMPTY token. 19 | // If EMPTY was already defined then we don't undef it. 20 | 21 | #if defined(EIGEN_EMPTY_WAS_ALREADY_DEFINED) 22 | # undef EIGEN_EMPTY_WAS_ALREADY_DEFINED 23 | #elif defined(EMPTY) 24 | # undef EMPTY 25 | #endif 26 | 27 | #define SUPERLU_EMPTY (-1) 28 | 29 | namespace Eigen { struct SluMatrix; } 30 | 31 | /** \ingroup Support_modules 32 | * \defgroup SuperLUSupport_Module SuperLUSupport module 33 | * 34 | * This module provides an interface to the SuperLU library. 35 | * It provides the following factorization class: 36 | * - class SuperLU: a supernodal sequential LU factorization. 37 | * - class SuperILU: a supernodal sequential incomplete LU factorization (to be used as a preconditioner for iterative methods). 38 | * 39 | * \warning When including this module, you have to use SUPERLU_EMPTY instead of EMPTY which is no longer defined because it is too polluting. 40 | * 41 | * \code 42 | * #include 43 | * \endcode 44 | * 45 | * In order to use this module, the superlu headers must be accessible from the include paths, and your binary must be linked to the superlu library and its dependencies. 46 | * The dependencies depend on how superlu has been compiled. 47 | * For a cmake based project, you can use our FindSuperLU.cmake module to help you in this task. 48 | * 49 | */ 50 | 51 | #include "src/misc/Solve.h" 52 | #include "src/misc/SparseSolve.h" 53 | 54 | #include "src/SuperLUSupport/SuperLUSupport.h" 55 | 56 | 57 | #include "src/Core/util/ReenableStupidWarnings.h" 58 | 59 | #endif // EIGEN_SUPERLUSUPPORT_MODULE_H 60 | -------------------------------------------------------------------------------- /include/Eigen/UmfPackSupport: -------------------------------------------------------------------------------- 1 | #ifndef EIGEN_UMFPACKSUPPORT_MODULE_H 2 | #define EIGEN_UMFPACKSUPPORT_MODULE_H 3 | 4 | #include "SparseCore" 5 | 6 | #include "src/Core/util/DisableStupidWarnings.h" 7 | 8 | extern "C" { 9 | #include 10 | } 11 | 12 | /** \ingroup Support_modules 13 | * \defgroup UmfPackSupport_Module UmfPackSupport module 14 | * 15 | * This module provides an interface to the UmfPack library which is part of the suitesparse package. 16 | * It provides the following factorization class: 17 | * - class UmfPackLU: a multifrontal sequential LU factorization. 18 | * 19 | * \code 20 | * #include 21 | * \endcode 22 | * 23 | * In order to use this module, the umfpack headers must be accessible from the include paths, and your binary must be linked to the umfpack library and its dependencies. 24 | * The dependencies depend on how umfpack has been compiled. 25 | * For a cmake based project, you can use our FindUmfPack.cmake module to help you in this task. 26 | * 27 | */ 28 | 29 | #include "src/misc/Solve.h" 30 | #include "src/misc/SparseSolve.h" 31 | 32 | #include "src/UmfPackSupport/UmfPackSupport.h" 33 | 34 | #include "src/Core/util/ReenableStupidWarnings.h" 35 | 36 | #endif // EIGEN_UMFPACKSUPPORT_MODULE_H 37 | -------------------------------------------------------------------------------- /include/Eigen/src/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | file(GLOB Eigen_src_subdirectories "*") 2 | escape_string_as_regex(ESCAPED_CMAKE_CURRENT_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}") 3 | foreach(f ${Eigen_src_subdirectories}) 4 | if(NOT f MATCHES "\\.txt" AND NOT f MATCHES "${ESCAPED_CMAKE_CURRENT_SOURCE_DIR}/[.].+" ) 5 | add_subdirectory(${f}) 6 | endif() 7 | endforeach() 8 | -------------------------------------------------------------------------------- /include/Eigen/src/Cholesky/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_Cholesky_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_Cholesky_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/Cholesky COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /include/Eigen/src/CholmodSupport/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_CholmodSupport_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_CholmodSupport_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/CholmodSupport COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /include/Eigen/src/Core/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_Core_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_Core_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/Core COMPONENT Devel 6 | ) 7 | 8 | ADD_SUBDIRECTORY(products) 9 | ADD_SUBDIRECTORY(util) 10 | ADD_SUBDIRECTORY(arch) 11 | -------------------------------------------------------------------------------- /include/Eigen/src/Core/CoreIterators.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2008-2010 Gael Guennebaud 5 | // 6 | // This Source Code Form is subject to the terms of the Mozilla 7 | // Public License v. 2.0. If a copy of the MPL was not distributed 8 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 9 | 10 | #ifndef EIGEN_COREITERATORS_H 11 | #define EIGEN_COREITERATORS_H 12 | 13 | namespace Eigen { 14 | 15 | /* This file contains the respective InnerIterator definition of the expressions defined in Eigen/Core 16 | */ 17 | 18 | /** \ingroup SparseCore_Module 19 | * \class InnerIterator 20 | * \brief An InnerIterator allows to loop over the element of a sparse (or dense) matrix or expression 21 | * 22 | * todo 23 | */ 24 | 25 | // generic version for dense matrix and expressions 26 | template class DenseBase::InnerIterator 27 | { 28 | protected: 29 | typedef typename Derived::Scalar Scalar; 30 | typedef typename Derived::Index Index; 31 | 32 | enum { IsRowMajor = (Derived::Flags&RowMajorBit)==RowMajorBit }; 33 | public: 34 | EIGEN_STRONG_INLINE InnerIterator(const Derived& expr, Index outer) 35 | : m_expression(expr), m_inner(0), m_outer(outer), m_end(expr.innerSize()) 36 | {} 37 | 38 | EIGEN_STRONG_INLINE Scalar value() const 39 | { 40 | return (IsRowMajor) ? m_expression.coeff(m_outer, m_inner) 41 | : m_expression.coeff(m_inner, m_outer); 42 | } 43 | 44 | EIGEN_STRONG_INLINE InnerIterator& operator++() { m_inner++; return *this; } 45 | 46 | EIGEN_STRONG_INLINE Index index() const { return m_inner; } 47 | inline Index row() const { return IsRowMajor ? m_outer : index(); } 48 | inline Index col() const { return IsRowMajor ? index() : m_outer; } 49 | 50 | EIGEN_STRONG_INLINE operator bool() const { return m_inner < m_end && m_inner>=0; } 51 | 52 | protected: 53 | const Derived& m_expression; 54 | Index m_inner; 55 | const Index m_outer; 56 | const Index m_end; 57 | }; 58 | 59 | } // end namespace Eigen 60 | 61 | #endif // EIGEN_COREITERATORS_H 62 | -------------------------------------------------------------------------------- /include/Eigen/src/Core/NestByValue.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2008 Gael Guennebaud 5 | // Copyright (C) 2006-2008 Benoit Jacob 6 | // 7 | // This Source Code Form is subject to the terms of the Mozilla 8 | // Public License v. 2.0. If a copy of the MPL was not distributed 9 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 10 | 11 | #ifndef EIGEN_NESTBYVALUE_H 12 | #define EIGEN_NESTBYVALUE_H 13 | 14 | namespace Eigen { 15 | 16 | /** \class NestByValue 17 | * \ingroup Core_Module 18 | * 19 | * \brief Expression which must be nested by value 20 | * 21 | * \param ExpressionType the type of the object of which we are requiring nesting-by-value 22 | * 23 | * This class is the return type of MatrixBase::nestByValue() 24 | * and most of the time this is the only way it is used. 25 | * 26 | * \sa MatrixBase::nestByValue() 27 | */ 28 | 29 | namespace internal { 30 | template 31 | struct traits > : public traits 32 | {}; 33 | } 34 | 35 | template class NestByValue 36 | : public internal::dense_xpr_base< NestByValue >::type 37 | { 38 | public: 39 | 40 | typedef typename internal::dense_xpr_base::type Base; 41 | EIGEN_DENSE_PUBLIC_INTERFACE(NestByValue) 42 | 43 | inline NestByValue(const ExpressionType& matrix) : m_expression(matrix) {} 44 | 45 | inline Index rows() const { return m_expression.rows(); } 46 | inline Index cols() const { return m_expression.cols(); } 47 | inline Index outerStride() const { return m_expression.outerStride(); } 48 | inline Index innerStride() const { return m_expression.innerStride(); } 49 | 50 | inline const CoeffReturnType coeff(Index row, Index col) const 51 | { 52 | return m_expression.coeff(row, col); 53 | } 54 | 55 | inline Scalar& coeffRef(Index row, Index col) 56 | { 57 | return m_expression.const_cast_derived().coeffRef(row, col); 58 | } 59 | 60 | inline const CoeffReturnType coeff(Index index) const 61 | { 62 | return m_expression.coeff(index); 63 | } 64 | 65 | inline Scalar& coeffRef(Index index) 66 | { 67 | return m_expression.const_cast_derived().coeffRef(index); 68 | } 69 | 70 | template 71 | inline const PacketScalar packet(Index row, Index col) const 72 | { 73 | return m_expression.template packet(row, col); 74 | } 75 | 76 | template 77 | inline void writePacket(Index row, Index col, const PacketScalar& x) 78 | { 79 | m_expression.const_cast_derived().template writePacket(row, col, x); 80 | } 81 | 82 | template 83 | inline const PacketScalar packet(Index index) const 84 | { 85 | return m_expression.template packet(index); 86 | } 87 | 88 | template 89 | inline void writePacket(Index index, const PacketScalar& x) 90 | { 91 | m_expression.const_cast_derived().template writePacket(index, x); 92 | } 93 | 94 | operator const ExpressionType&() const { return m_expression; } 95 | 96 | protected: 97 | const ExpressionType m_expression; 98 | }; 99 | 100 | /** \returns an expression of the temporary version of *this. 101 | */ 102 | template 103 | inline const NestByValue 104 | DenseBase::nestByValue() const 105 | { 106 | return NestByValue(derived()); 107 | } 108 | 109 | } // end namespace Eigen 110 | 111 | #endif // EIGEN_NESTBYVALUE_H 112 | -------------------------------------------------------------------------------- /include/Eigen/src/Core/ReturnByValue.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2009-2010 Gael Guennebaud 5 | // Copyright (C) 2009-2010 Benoit Jacob 6 | // 7 | // This Source Code Form is subject to the terms of the Mozilla 8 | // Public License v. 2.0. If a copy of the MPL was not distributed 9 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 10 | 11 | #ifndef EIGEN_RETURNBYVALUE_H 12 | #define EIGEN_RETURNBYVALUE_H 13 | 14 | namespace Eigen { 15 | 16 | /** \class ReturnByValue 17 | * \ingroup Core_Module 18 | * 19 | */ 20 | 21 | namespace internal { 22 | 23 | template 24 | struct traits > 25 | : public traits::ReturnType> 26 | { 27 | enum { 28 | // We're disabling the DirectAccess because e.g. the constructor of 29 | // the Block-with-DirectAccess expression requires to have a coeffRef method. 30 | // Also, we don't want to have to implement the stride stuff. 31 | Flags = (traits::ReturnType>::Flags 32 | | EvalBeforeNestingBit) & ~DirectAccessBit 33 | }; 34 | }; 35 | 36 | /* The ReturnByValue object doesn't even have a coeff() method. 37 | * So the only way that nesting it in an expression can work, is by evaluating it into a plain matrix. 38 | * So internal::nested always gives the plain return matrix type. 39 | * 40 | * FIXME: I don't understand why we need this specialization: isn't this taken care of by the EvalBeforeNestingBit ?? 41 | */ 42 | template 43 | struct nested, n, PlainObject> 44 | { 45 | typedef typename traits::ReturnType type; 46 | }; 47 | 48 | } // end namespace internal 49 | 50 | template class ReturnByValue 51 | : internal::no_assignment_operator, public internal::dense_xpr_base< ReturnByValue >::type 52 | { 53 | public: 54 | typedef typename internal::traits::ReturnType ReturnType; 55 | 56 | typedef typename internal::dense_xpr_base::type Base; 57 | EIGEN_DENSE_PUBLIC_INTERFACE(ReturnByValue) 58 | 59 | template 60 | inline void evalTo(Dest& dst) const 61 | { static_cast(this)->evalTo(dst); } 62 | inline Index rows() const { return static_cast(this)->rows(); } 63 | inline Index cols() const { return static_cast(this)->cols(); } 64 | 65 | #ifndef EIGEN_PARSED_BY_DOXYGEN 66 | #define Unusable YOU_ARE_TRYING_TO_ACCESS_A_SINGLE_COEFFICIENT_IN_A_SPECIAL_EXPRESSION_WHERE_THAT_IS_NOT_ALLOWED_BECAUSE_THAT_WOULD_BE_INEFFICIENT 67 | class Unusable{ 68 | Unusable(const Unusable&) {} 69 | Unusable& operator=(const Unusable&) {return *this;} 70 | }; 71 | const Unusable& coeff(Index) const { return *reinterpret_cast(this); } 72 | const Unusable& coeff(Index,Index) const { return *reinterpret_cast(this); } 73 | Unusable& coeffRef(Index) { return *reinterpret_cast(this); } 74 | Unusable& coeffRef(Index,Index) { return *reinterpret_cast(this); } 75 | #endif 76 | }; 77 | 78 | template 79 | template 80 | Derived& DenseBase::operator=(const ReturnByValue& other) 81 | { 82 | other.evalTo(derived()); 83 | return derived(); 84 | } 85 | 86 | } // end namespace Eigen 87 | 88 | #endif // EIGEN_RETURNBYVALUE_H 89 | -------------------------------------------------------------------------------- /include/Eigen/src/Core/arch/AltiVec/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_Core_arch_AltiVec_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_Core_arch_AltiVec_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/Core/arch/AltiVec COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /include/Eigen/src/Core/arch/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ADD_SUBDIRECTORY(SSE) 2 | ADD_SUBDIRECTORY(AltiVec) 3 | ADD_SUBDIRECTORY(NEON) 4 | ADD_SUBDIRECTORY(Default) 5 | -------------------------------------------------------------------------------- /include/Eigen/src/Core/arch/Default/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_Core_arch_Default_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_Core_arch_Default_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/Core/arch/Default COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /include/Eigen/src/Core/arch/Default/Settings.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2008-2010 Gael Guennebaud 5 | // Copyright (C) 2006-2008 Benoit Jacob 6 | // 7 | // This Source Code Form is subject to the terms of the Mozilla 8 | // Public License v. 2.0. If a copy of the MPL was not distributed 9 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 10 | 11 | 12 | /* All the parameters defined in this file can be specialized in the 13 | * architecture specific files, and/or by the user. 14 | * More to come... */ 15 | 16 | #ifndef EIGEN_DEFAULT_SETTINGS_H 17 | #define EIGEN_DEFAULT_SETTINGS_H 18 | 19 | /** Defines the maximal loop size to enable meta unrolling of loops. 20 | * Note that the value here is expressed in Eigen's own notion of "number of FLOPS", 21 | * it does not correspond to the number of iterations or the number of instructions 22 | */ 23 | #ifndef EIGEN_UNROLLING_LIMIT 24 | #define EIGEN_UNROLLING_LIMIT 100 25 | #endif 26 | 27 | /** Defines the threshold between a "small" and a "large" matrix. 28 | * This threshold is mainly used to select the proper product implementation. 29 | */ 30 | #ifndef EIGEN_CACHEFRIENDLY_PRODUCT_THRESHOLD 31 | #define EIGEN_CACHEFRIENDLY_PRODUCT_THRESHOLD 8 32 | #endif 33 | 34 | /** Defines the maximal width of the blocks used in the triangular product and solver 35 | * for vectors (level 2 blas xTRMV and xTRSV). The default is 8. 36 | */ 37 | #ifndef EIGEN_TUNE_TRIANGULAR_PANEL_WIDTH 38 | #define EIGEN_TUNE_TRIANGULAR_PANEL_WIDTH 8 39 | #endif 40 | 41 | 42 | /** Defines the default number of registers available for that architecture. 43 | * Currently it must be 8 or 16. Other values will fail. 44 | */ 45 | #ifndef EIGEN_ARCH_DEFAULT_NUMBER_OF_REGISTERS 46 | #define EIGEN_ARCH_DEFAULT_NUMBER_OF_REGISTERS 8 47 | #endif 48 | 49 | #endif // EIGEN_DEFAULT_SETTINGS_H 50 | -------------------------------------------------------------------------------- /include/Eigen/src/Core/arch/NEON/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_Core_arch_NEON_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_Core_arch_NEON_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/Core/arch/NEON COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /include/Eigen/src/Core/arch/SSE/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_Core_arch_SSE_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_Core_arch_SSE_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/Core/arch/SSE COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /include/Eigen/src/Core/products/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_Core_Product_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_Core_Product_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/Core/products COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /include/Eigen/src/Core/util/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_Core_util_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_Core_util_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/Core/util COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /include/Eigen/src/Core/util/DisableStupidWarnings.h: -------------------------------------------------------------------------------- 1 | #ifndef EIGEN_WARNINGS_DISABLED 2 | #define EIGEN_WARNINGS_DISABLED 3 | 4 | #ifdef _MSC_VER 5 | // 4100 - unreferenced formal parameter (occurred e.g. in aligned_allocator::destroy(pointer p)) 6 | // 4101 - unreferenced local variable 7 | // 4127 - conditional expression is constant 8 | // 4181 - qualifier applied to reference type ignored 9 | // 4211 - nonstandard extension used : redefined extern to static 10 | // 4244 - 'argument' : conversion from 'type1' to 'type2', possible loss of data 11 | // 4273 - QtAlignedMalloc, inconsistent DLL linkage 12 | // 4324 - structure was padded due to declspec(align()) 13 | // 4512 - assignment operator could not be generated 14 | // 4522 - 'class' : multiple assignment operators specified 15 | // 4700 - uninitialized local variable 'xyz' used 16 | // 4717 - 'function' : recursive on all control paths, function will cause runtime stack overflow 17 | #ifndef EIGEN_PERMANENTLY_DISABLE_STUPID_WARNINGS 18 | #pragma warning( push ) 19 | #endif 20 | #pragma warning( disable : 4100 4101 4127 4181 4211 4244 4273 4324 4512 4522 4700 4717 ) 21 | #elif defined __INTEL_COMPILER 22 | // 2196 - routine is both "inline" and "noinline" ("noinline" assumed) 23 | // ICC 12 generates this warning even without any inline keyword, when defining class methods 'inline' i.e. inside of class body 24 | // typedef that may be a reference type. 25 | // 279 - controlling expression is constant 26 | // ICC 12 generates this warning on assert(constant_expression_depending_on_template_params) and frankly this is a legitimate use case. 27 | #ifndef EIGEN_PERMANENTLY_DISABLE_STUPID_WARNINGS 28 | #pragma warning push 29 | #endif 30 | #pragma warning disable 2196 279 31 | #elif defined __clang__ 32 | // -Wconstant-logical-operand - warning: use of logical && with constant operand; switch to bitwise & or remove constant 33 | // this is really a stupid warning as it warns on compile-time expressions involving enums 34 | #ifndef EIGEN_PERMANENTLY_DISABLE_STUPID_WARNINGS 35 | #pragma clang diagnostic push 36 | #endif 37 | #pragma clang diagnostic ignored "-Wconstant-logical-operand" 38 | #endif 39 | 40 | #endif // not EIGEN_WARNINGS_DISABLED 41 | -------------------------------------------------------------------------------- /include/Eigen/src/Core/util/NonMPL2.h: -------------------------------------------------------------------------------- 1 | #ifdef EIGEN_MPL2_ONLY 2 | #error Including non-MPL2 code in EIGEN_MPL2_ONLY mode 3 | #endif 4 | -------------------------------------------------------------------------------- /include/Eigen/src/Core/util/ReenableStupidWarnings.h: -------------------------------------------------------------------------------- 1 | #ifdef EIGEN_WARNINGS_DISABLED 2 | #undef EIGEN_WARNINGS_DISABLED 3 | 4 | #ifndef EIGEN_PERMANENTLY_DISABLE_STUPID_WARNINGS 5 | #ifdef _MSC_VER 6 | #pragma warning( pop ) 7 | #elif defined __INTEL_COMPILER 8 | #pragma warning pop 9 | #elif defined __clang__ 10 | #pragma clang diagnostic pop 11 | #endif 12 | #endif 13 | 14 | #endif // EIGEN_WARNINGS_DISABLED 15 | -------------------------------------------------------------------------------- /include/Eigen/src/Eigen2Support/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_Eigen2Support_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_Eigen2Support_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/Eigen2Support COMPONENT Devel 6 | ) 7 | 8 | ADD_SUBDIRECTORY(Geometry) -------------------------------------------------------------------------------- /include/Eigen/src/Eigen2Support/Geometry/All.h: -------------------------------------------------------------------------------- 1 | #ifndef EIGEN2_GEOMETRY_MODULE_H 2 | #define EIGEN2_GEOMETRY_MODULE_H 3 | 4 | #include 5 | 6 | #ifndef M_PI 7 | #define M_PI 3.14159265358979323846 8 | #endif 9 | 10 | #if EIGEN2_SUPPORT_STAGE < STAGE20_RESOLVE_API_CONFLICTS 11 | #include "RotationBase.h" 12 | #include "Rotation2D.h" 13 | #include "Quaternion.h" 14 | #include "AngleAxis.h" 15 | #include "Transform.h" 16 | #include "Translation.h" 17 | #include "Scaling.h" 18 | #include "AlignedBox.h" 19 | #include "Hyperplane.h" 20 | #include "ParametrizedLine.h" 21 | #endif 22 | 23 | 24 | #define RotationBase eigen2_RotationBase 25 | #define Rotation2D eigen2_Rotation2D 26 | #define Rotation2Df eigen2_Rotation2Df 27 | #define Rotation2Dd eigen2_Rotation2Dd 28 | 29 | #define Quaternion eigen2_Quaternion 30 | #define Quaternionf eigen2_Quaternionf 31 | #define Quaterniond eigen2_Quaterniond 32 | 33 | #define AngleAxis eigen2_AngleAxis 34 | #define AngleAxisf eigen2_AngleAxisf 35 | #define AngleAxisd eigen2_AngleAxisd 36 | 37 | #define Transform eigen2_Transform 38 | #define Transform2f eigen2_Transform2f 39 | #define Transform2d eigen2_Transform2d 40 | #define Transform3f eigen2_Transform3f 41 | #define Transform3d eigen2_Transform3d 42 | 43 | #define Translation eigen2_Translation 44 | #define Translation2f eigen2_Translation2f 45 | #define Translation2d eigen2_Translation2d 46 | #define Translation3f eigen2_Translation3f 47 | #define Translation3d eigen2_Translation3d 48 | 49 | #define Scaling eigen2_Scaling 50 | #define Scaling2f eigen2_Scaling2f 51 | #define Scaling2d eigen2_Scaling2d 52 | #define Scaling3f eigen2_Scaling3f 53 | #define Scaling3d eigen2_Scaling3d 54 | 55 | #define AlignedBox eigen2_AlignedBox 56 | 57 | #define Hyperplane eigen2_Hyperplane 58 | #define ParametrizedLine eigen2_ParametrizedLine 59 | 60 | #define ei_toRotationMatrix eigen2_ei_toRotationMatrix 61 | #define ei_quaternion_assign_impl eigen2_ei_quaternion_assign_impl 62 | #define ei_transform_product_impl eigen2_ei_transform_product_impl 63 | 64 | #include "RotationBase.h" 65 | #include "Rotation2D.h" 66 | #include "Quaternion.h" 67 | #include "AngleAxis.h" 68 | #include "Transform.h" 69 | #include "Translation.h" 70 | #include "Scaling.h" 71 | #include "AlignedBox.h" 72 | #include "Hyperplane.h" 73 | #include "ParametrizedLine.h" 74 | 75 | #undef ei_toRotationMatrix 76 | #undef ei_quaternion_assign_impl 77 | #undef ei_transform_product_impl 78 | 79 | #undef RotationBase 80 | #undef Rotation2D 81 | #undef Rotation2Df 82 | #undef Rotation2Dd 83 | 84 | #undef Quaternion 85 | #undef Quaternionf 86 | #undef Quaterniond 87 | 88 | #undef AngleAxis 89 | #undef AngleAxisf 90 | #undef AngleAxisd 91 | 92 | #undef Transform 93 | #undef Transform2f 94 | #undef Transform2d 95 | #undef Transform3f 96 | #undef Transform3d 97 | 98 | #undef Translation 99 | #undef Translation2f 100 | #undef Translation2d 101 | #undef Translation3f 102 | #undef Translation3d 103 | 104 | #undef Scaling 105 | #undef Scaling2f 106 | #undef Scaling2d 107 | #undef Scaling3f 108 | #undef Scaling3d 109 | 110 | #undef AlignedBox 111 | 112 | #undef Hyperplane 113 | #undef ParametrizedLine 114 | 115 | #endif // EIGEN2_GEOMETRY_MODULE_H 116 | -------------------------------------------------------------------------------- /include/Eigen/src/Eigen2Support/Geometry/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_Eigen2Support_Geometry_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_Eigen2Support_Geometry_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/Eigen2Support/Geometry 6 | ) 7 | -------------------------------------------------------------------------------- /include/Eigen/src/Eigen2Support/Lazy.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2008 Benoit Jacob 5 | // 6 | // This Source Code Form is subject to the terms of the Mozilla 7 | // Public License v. 2.0. If a copy of the MPL was not distributed 8 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 9 | 10 | #ifndef EIGEN_LAZY_H 11 | #define EIGEN_LAZY_H 12 | 13 | namespace Eigen { 14 | 15 | /** \deprecated it is only used by lazy() which is deprecated 16 | * 17 | * \returns an expression of *this with added flags 18 | * 19 | * Example: \include MatrixBase_marked.cpp 20 | * Output: \verbinclude MatrixBase_marked.out 21 | * 22 | * \sa class Flagged, extract(), part() 23 | */ 24 | template 25 | template 26 | inline const Flagged 27 | MatrixBase::marked() const 28 | { 29 | return derived(); 30 | } 31 | 32 | /** \deprecated use MatrixBase::noalias() 33 | * 34 | * \returns an expression of *this with the EvalBeforeAssigningBit flag removed. 35 | * 36 | * Example: \include MatrixBase_lazy.cpp 37 | * Output: \verbinclude MatrixBase_lazy.out 38 | * 39 | * \sa class Flagged, marked() 40 | */ 41 | template 42 | inline const Flagged 43 | MatrixBase::lazy() const 44 | { 45 | return derived(); 46 | } 47 | 48 | 49 | /** \internal 50 | * Overloaded to perform an efficient C += (A*B).lazy() */ 51 | template 52 | template 53 | Derived& MatrixBase::operator+=(const Flagged, 0, 54 | EvalBeforeAssigningBit>& other) 55 | { 56 | other._expression().derived().addTo(derived()); return derived(); 57 | } 58 | 59 | /** \internal 60 | * Overloaded to perform an efficient C -= (A*B).lazy() */ 61 | template 62 | template 63 | Derived& MatrixBase::operator-=(const Flagged, 0, 64 | EvalBeforeAssigningBit>& other) 65 | { 66 | other._expression().derived().subTo(derived()); return derived(); 67 | } 68 | 69 | } // end namespace Eigen 70 | 71 | #endif // EIGEN_LAZY_H 72 | -------------------------------------------------------------------------------- /include/Eigen/src/Eigen2Support/Macros.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2011 Benoit Jacob 5 | // 6 | // This Source Code Form is subject to the terms of the Mozilla 7 | // Public License v. 2.0. If a copy of the MPL was not distributed 8 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 9 | 10 | #ifndef EIGEN2_MACROS_H 11 | #define EIGEN2_MACROS_H 12 | 13 | #define ei_assert eigen_assert 14 | #define ei_internal_assert eigen_internal_assert 15 | 16 | #define EIGEN_ALIGN_128 EIGEN_ALIGN16 17 | 18 | #define EIGEN_ARCH_WANTS_ALIGNMENT EIGEN_ALIGN_STATICALLY 19 | 20 | #endif // EIGEN2_MACROS_H 21 | -------------------------------------------------------------------------------- /include/Eigen/src/Eigen2Support/MathFunctions.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2010 Gael Guennebaud 5 | // 6 | // This Source Code Form is subject to the terms of the Mozilla 7 | // Public License v. 2.0. If a copy of the MPL was not distributed 8 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 9 | 10 | #ifndef EIGEN2_MATH_FUNCTIONS_H 11 | #define EIGEN2_MATH_FUNCTIONS_H 12 | 13 | namespace Eigen { 14 | 15 | template inline typename NumTraits::Real ei_real(const T& x) { return numext::real(x); } 16 | template inline typename NumTraits::Real ei_imag(const T& x) { return numext::imag(x); } 17 | template inline T ei_conj(const T& x) { return numext::conj(x); } 18 | template inline typename NumTraits::Real ei_abs (const T& x) { using std::abs; return abs(x); } 19 | template inline typename NumTraits::Real ei_abs2(const T& x) { return numext::abs2(x); } 20 | template inline T ei_sqrt(const T& x) { using std::sqrt; return sqrt(x); } 21 | template inline T ei_exp (const T& x) { using std::exp; return exp(x); } 22 | template inline T ei_log (const T& x) { using std::log; return log(x); } 23 | template inline T ei_sin (const T& x) { using std::sin; return sin(x); } 24 | template inline T ei_cos (const T& x) { using std::cos; return cos(x); } 25 | template inline T ei_atan2(const T& x,const T& y) { using std::atan2; return atan2(x,y); } 26 | template inline T ei_pow (const T& x,const T& y) { return numext::pow(x,y); } 27 | template inline T ei_random () { return internal::random(); } 28 | template inline T ei_random (const T& x, const T& y) { return internal::random(x, y); } 29 | 30 | template inline T precision () { return NumTraits::dummy_precision(); } 31 | template inline T machine_epsilon () { return NumTraits::epsilon(); } 32 | 33 | 34 | template 35 | inline bool ei_isMuchSmallerThan(const Scalar& x, const OtherScalar& y, 36 | typename NumTraits::Real precision = NumTraits::dummy_precision()) 37 | { 38 | return internal::isMuchSmallerThan(x, y, precision); 39 | } 40 | 41 | template 42 | inline bool ei_isApprox(const Scalar& x, const Scalar& y, 43 | typename NumTraits::Real precision = NumTraits::dummy_precision()) 44 | { 45 | return internal::isApprox(x, y, precision); 46 | } 47 | 48 | template 49 | inline bool ei_isApproxOrLessThan(const Scalar& x, const Scalar& y, 50 | typename NumTraits::Real precision = NumTraits::dummy_precision()) 51 | { 52 | return internal::isApproxOrLessThan(x, y, precision); 53 | } 54 | 55 | } // end namespace Eigen 56 | 57 | #endif // EIGEN2_MATH_FUNCTIONS_H 58 | -------------------------------------------------------------------------------- /include/Eigen/src/Eigen2Support/Memory.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2011 Benoit Jacob 5 | // 6 | // This Source Code Form is subject to the terms of the Mozilla 7 | // Public License v. 2.0. If a copy of the MPL was not distributed 8 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 9 | 10 | #ifndef EIGEN2_MEMORY_H 11 | #define EIGEN2_MEMORY_H 12 | 13 | namespace Eigen { 14 | 15 | inline void* ei_aligned_malloc(size_t size) { return internal::aligned_malloc(size); } 16 | inline void ei_aligned_free(void *ptr) { internal::aligned_free(ptr); } 17 | inline void* ei_aligned_realloc(void *ptr, size_t new_size, size_t old_size) { return internal::aligned_realloc(ptr, new_size, old_size); } 18 | inline void* ei_handmade_aligned_malloc(size_t size) { return internal::handmade_aligned_malloc(size); } 19 | inline void ei_handmade_aligned_free(void *ptr) { internal::handmade_aligned_free(ptr); } 20 | 21 | template inline void* ei_conditional_aligned_malloc(size_t size) 22 | { 23 | return internal::conditional_aligned_malloc(size); 24 | } 25 | template inline void ei_conditional_aligned_free(void *ptr) 26 | { 27 | internal::conditional_aligned_free(ptr); 28 | } 29 | template inline void* ei_conditional_aligned_realloc(void* ptr, size_t new_size, size_t old_size) 30 | { 31 | return internal::conditional_aligned_realloc(ptr, new_size, old_size); 32 | } 33 | 34 | template inline T* ei_aligned_new(size_t size) 35 | { 36 | return internal::aligned_new(size); 37 | } 38 | template inline void ei_aligned_delete(T *ptr, size_t size) 39 | { 40 | return internal::aligned_delete(ptr, size); 41 | } 42 | 43 | } // end namespace Eigen 44 | 45 | #endif // EIGEN2_MACROS_H 46 | -------------------------------------------------------------------------------- /include/Eigen/src/Eigen2Support/Meta.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2011 Benoit Jacob 5 | // 6 | // This Source Code Form is subject to the terms of the Mozilla 7 | // Public License v. 2.0. If a copy of the MPL was not distributed 8 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 9 | 10 | #ifndef EIGEN2_META_H 11 | #define EIGEN2_META_H 12 | 13 | namespace Eigen { 14 | 15 | template 16 | struct ei_traits : internal::traits 17 | {}; 18 | 19 | struct ei_meta_true { enum { ret = 1 }; }; 20 | struct ei_meta_false { enum { ret = 0 }; }; 21 | 22 | template 23 | struct ei_meta_if { typedef Then ret; }; 24 | 25 | template 26 | struct ei_meta_if { typedef Else ret; }; 27 | 28 | template struct ei_is_same_type { enum { ret = 0 }; }; 29 | template struct ei_is_same_type { enum { ret = 1 }; }; 30 | 31 | template struct ei_unref { typedef T type; }; 32 | template struct ei_unref { typedef T type; }; 33 | 34 | template struct ei_unpointer { typedef T type; }; 35 | template struct ei_unpointer { typedef T type; }; 36 | template struct ei_unpointer { typedef T type; }; 37 | 38 | template struct ei_unconst { typedef T type; }; 39 | template struct ei_unconst { typedef T type; }; 40 | template struct ei_unconst { typedef T & type; }; 41 | template struct ei_unconst { typedef T * type; }; 42 | 43 | template struct ei_cleantype { typedef T type; }; 44 | template struct ei_cleantype { typedef typename ei_cleantype::type type; }; 45 | template struct ei_cleantype { typedef typename ei_cleantype::type type; }; 46 | template struct ei_cleantype { typedef typename ei_cleantype::type type; }; 47 | template struct ei_cleantype { typedef typename ei_cleantype::type type; }; 48 | template struct ei_cleantype { typedef typename ei_cleantype::type type; }; 49 | 50 | /** \internal In short, it computes int(sqrt(\a Y)) with \a Y an integer. 51 | * Usage example: \code ei_meta_sqrt<1023>::ret \endcode 52 | */ 53 | template Y))) > 57 | // use ?: instead of || just to shut up a stupid gcc 4.3 warning 58 | class ei_meta_sqrt 59 | { 60 | enum { 61 | MidX = (InfX+SupX)/2, 62 | TakeInf = MidX*MidX > Y ? 1 : 0, 63 | NewInf = int(TakeInf) ? InfX : int(MidX), 64 | NewSup = int(TakeInf) ? int(MidX) : SupX 65 | }; 66 | public: 67 | enum { ret = ei_meta_sqrt::ret }; 68 | }; 69 | 70 | template 71 | class ei_meta_sqrt { public: enum { ret = (SupX*SupX <= Y) ? SupX : InfX }; }; 72 | 73 | } // end namespace Eigen 74 | 75 | #endif // EIGEN2_META_H 76 | -------------------------------------------------------------------------------- /include/Eigen/src/Eigen2Support/QR.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2008 Gael Guennebaud 5 | // Copyright (C) 2011 Benoit Jacob 6 | // 7 | // This Source Code Form is subject to the terms of the Mozilla 8 | // Public License v. 2.0. If a copy of the MPL was not distributed 9 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 10 | 11 | #ifndef EIGEN2_QR_H 12 | #define EIGEN2_QR_H 13 | 14 | namespace Eigen { 15 | 16 | template 17 | class QR : public HouseholderQR 18 | { 19 | public: 20 | 21 | typedef HouseholderQR Base; 22 | typedef Block MatrixRBlockType; 23 | 24 | QR() : Base() {} 25 | 26 | template 27 | explicit QR(const T& t) : Base(t) {} 28 | 29 | template 30 | bool solve(const MatrixBase& b, ResultType *result) const 31 | { 32 | *result = static_cast(this)->solve(b); 33 | return true; 34 | } 35 | 36 | MatrixType matrixQ(void) const { 37 | MatrixType ret = MatrixType::Identity(this->rows(), this->cols()); 38 | ret = this->householderQ() * ret; 39 | return ret; 40 | } 41 | 42 | bool isFullRank() const { 43 | return true; 44 | } 45 | 46 | const TriangularView 47 | matrixR(void) const 48 | { 49 | int cols = this->cols(); 50 | return MatrixRBlockType(this->matrixQR(), 0, 0, cols, cols).template triangularView(); 51 | } 52 | }; 53 | 54 | /** \return the QR decomposition of \c *this. 55 | * 56 | * \sa class QR 57 | */ 58 | template 59 | const QR::PlainObject> 60 | MatrixBase::qr() const 61 | { 62 | return QR(eval()); 63 | } 64 | 65 | } // end namespace Eigen 66 | 67 | #endif // EIGEN2_QR_H 68 | -------------------------------------------------------------------------------- /include/Eigen/src/Eigen2Support/TriangularSolver.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2010 Gael Guennebaud 5 | // 6 | // This Source Code Form is subject to the terms of the Mozilla 7 | // Public License v. 2.0. If a copy of the MPL was not distributed 8 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 9 | 10 | #ifndef EIGEN_TRIANGULAR_SOLVER2_H 11 | #define EIGEN_TRIANGULAR_SOLVER2_H 12 | 13 | namespace Eigen { 14 | 15 | const unsigned int UnitDiagBit = UnitDiag; 16 | const unsigned int SelfAdjointBit = SelfAdjoint; 17 | const unsigned int UpperTriangularBit = Upper; 18 | const unsigned int LowerTriangularBit = Lower; 19 | 20 | const unsigned int UpperTriangular = Upper; 21 | const unsigned int LowerTriangular = Lower; 22 | const unsigned int UnitUpperTriangular = UnitUpper; 23 | const unsigned int UnitLowerTriangular = UnitLower; 24 | 25 | template 26 | template 27 | typename ExpressionType::PlainObject 28 | Flagged::solveTriangular(const MatrixBase& other) const 29 | { 30 | return m_matrix.template triangularView().solve(other.derived()); 31 | } 32 | 33 | template 34 | template 35 | void Flagged::solveTriangularInPlace(const MatrixBase& other) const 36 | { 37 | m_matrix.template triangularView().solveInPlace(other.derived()); 38 | } 39 | 40 | } // end namespace Eigen 41 | 42 | #endif // EIGEN_TRIANGULAR_SOLVER2_H 43 | -------------------------------------------------------------------------------- /include/Eigen/src/Eigen2Support/VectorBlock.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2008-2009 Gael Guennebaud 5 | // Copyright (C) 2006-2008 Benoit Jacob 6 | // 7 | // This Source Code Form is subject to the terms of the Mozilla 8 | // Public License v. 2.0. If a copy of the MPL was not distributed 9 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 10 | 11 | #ifndef EIGEN2_VECTORBLOCK_H 12 | #define EIGEN2_VECTORBLOCK_H 13 | 14 | namespace Eigen { 15 | 16 | /** \deprecated use DenseMase::head(Index) */ 17 | template 18 | inline VectorBlock 19 | MatrixBase::start(Index size) 20 | { 21 | EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) 22 | return VectorBlock(derived(), 0, size); 23 | } 24 | 25 | /** \deprecated use DenseMase::head(Index) */ 26 | template 27 | inline const VectorBlock 28 | MatrixBase::start(Index size) const 29 | { 30 | EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) 31 | return VectorBlock(derived(), 0, size); 32 | } 33 | 34 | /** \deprecated use DenseMase::tail(Index) */ 35 | template 36 | inline VectorBlock 37 | MatrixBase::end(Index size) 38 | { 39 | EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) 40 | return VectorBlock(derived(), this->size() - size, size); 41 | } 42 | 43 | /** \deprecated use DenseMase::tail(Index) */ 44 | template 45 | inline const VectorBlock 46 | MatrixBase::end(Index size) const 47 | { 48 | EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) 49 | return VectorBlock(derived(), this->size() - size, size); 50 | } 51 | 52 | /** \deprecated use DenseMase::head() */ 53 | template 54 | template 55 | inline VectorBlock 56 | MatrixBase::start() 57 | { 58 | EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) 59 | return VectorBlock(derived(), 0); 60 | } 61 | 62 | /** \deprecated use DenseMase::head() */ 63 | template 64 | template 65 | inline const VectorBlock 66 | MatrixBase::start() const 67 | { 68 | EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) 69 | return VectorBlock(derived(), 0); 70 | } 71 | 72 | /** \deprecated use DenseMase::tail() */ 73 | template 74 | template 75 | inline VectorBlock 76 | MatrixBase::end() 77 | { 78 | EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) 79 | return VectorBlock(derived(), size() - Size); 80 | } 81 | 82 | /** \deprecated use DenseMase::tail() */ 83 | template 84 | template 85 | inline const VectorBlock 86 | MatrixBase::end() const 87 | { 88 | EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) 89 | return VectorBlock(derived(), size() - Size); 90 | } 91 | 92 | } // end namespace Eigen 93 | 94 | #endif // EIGEN2_VECTORBLOCK_H 95 | -------------------------------------------------------------------------------- /include/Eigen/src/Eigenvalues/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_EIGENVALUES_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_EIGENVALUES_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/Eigenvalues COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /include/Eigen/src/Geometry/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_Geometry_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_Geometry_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/Geometry COMPONENT Devel 6 | ) 7 | 8 | ADD_SUBDIRECTORY(arch) 9 | -------------------------------------------------------------------------------- /include/Eigen/src/Geometry/arch/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_Geometry_arch_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_Geometry_arch_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/Geometry/arch COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /include/Eigen/src/Householder/BlockHouseholder.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2010 Vincent Lejeune 5 | // Copyright (C) 2010 Gael Guennebaud 6 | // 7 | // This Source Code Form is subject to the terms of the Mozilla 8 | // Public License v. 2.0. If a copy of the MPL was not distributed 9 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 10 | 11 | #ifndef EIGEN_BLOCK_HOUSEHOLDER_H 12 | #define EIGEN_BLOCK_HOUSEHOLDER_H 13 | 14 | // This file contains some helper function to deal with block householder reflectors 15 | 16 | namespace Eigen { 17 | 18 | namespace internal { 19 | 20 | /** \internal */ 21 | template 22 | void make_block_householder_triangular_factor(TriangularFactorType& triFactor, const VectorsType& vectors, const CoeffsType& hCoeffs) 23 | { 24 | typedef typename TriangularFactorType::Index Index; 25 | typedef typename VectorsType::Scalar Scalar; 26 | const Index nbVecs = vectors.cols(); 27 | eigen_assert(triFactor.rows() == nbVecs && triFactor.cols() == nbVecs && vectors.rows()>=nbVecs); 28 | 29 | for(Index i = 0; i < nbVecs; i++) 30 | { 31 | Index rs = vectors.rows() - i; 32 | Scalar Vii = vectors(i,i); 33 | vectors.const_cast_derived().coeffRef(i,i) = Scalar(1); 34 | triFactor.col(i).head(i).noalias() = -hCoeffs(i) * vectors.block(i, 0, rs, i).adjoint() 35 | * vectors.col(i).tail(rs); 36 | vectors.const_cast_derived().coeffRef(i, i) = Vii; 37 | // FIXME add .noalias() once the triangular product can work inplace 38 | triFactor.col(i).head(i) = triFactor.block(0,0,i,i).template triangularView() 39 | * triFactor.col(i).head(i); 40 | triFactor(i,i) = hCoeffs(i); 41 | } 42 | } 43 | 44 | /** \internal */ 45 | template 46 | void apply_block_householder_on_the_left(MatrixType& mat, const VectorsType& vectors, const CoeffsType& hCoeffs) 47 | { 48 | typedef typename MatrixType::Index Index; 49 | enum { TFactorSize = MatrixType::ColsAtCompileTime }; 50 | Index nbVecs = vectors.cols(); 51 | Matrix T(nbVecs,nbVecs); 52 | make_block_householder_triangular_factor(T, vectors, hCoeffs); 53 | 54 | const TriangularView& V(vectors); 55 | 56 | // A -= V T V^* A 57 | Matrix tmp = V.adjoint() * mat; 59 | // FIXME add .noalias() once the triangular product can work inplace 60 | tmp = T.template triangularView().adjoint() * tmp; 61 | mat.noalias() -= V * tmp; 62 | } 63 | 64 | } // end namespace internal 65 | 66 | } // end namespace Eigen 67 | 68 | #endif // EIGEN_BLOCK_HOUSEHOLDER_H 69 | -------------------------------------------------------------------------------- /include/Eigen/src/Householder/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_Householder_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_Householder_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/Householder COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /include/Eigen/src/IterativeLinearSolvers/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_IterativeLinearSolvers_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_IterativeLinearSolvers_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/IterativeLinearSolvers COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /include/Eigen/src/Jacobi/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_Jacobi_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_Jacobi_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/Jacobi COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /include/Eigen/src/LU/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_LU_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_LU_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/LU COMPONENT Devel 6 | ) 7 | 8 | ADD_SUBDIRECTORY(arch) 9 | -------------------------------------------------------------------------------- /include/Eigen/src/LU/Determinant.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2008 Benoit Jacob 5 | // 6 | // This Source Code Form is subject to the terms of the Mozilla 7 | // Public License v. 2.0. If a copy of the MPL was not distributed 8 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 9 | 10 | #ifndef EIGEN_DETERMINANT_H 11 | #define EIGEN_DETERMINANT_H 12 | 13 | namespace Eigen { 14 | 15 | namespace internal { 16 | 17 | template 18 | inline const typename Derived::Scalar bruteforce_det3_helper 19 | (const MatrixBase& matrix, int a, int b, int c) 20 | { 21 | return matrix.coeff(0,a) 22 | * (matrix.coeff(1,b) * matrix.coeff(2,c) - matrix.coeff(1,c) * matrix.coeff(2,b)); 23 | } 24 | 25 | template 26 | const typename Derived::Scalar bruteforce_det4_helper 27 | (const MatrixBase& matrix, int j, int k, int m, int n) 28 | { 29 | return (matrix.coeff(j,0) * matrix.coeff(k,1) - matrix.coeff(k,0) * matrix.coeff(j,1)) 30 | * (matrix.coeff(m,2) * matrix.coeff(n,3) - matrix.coeff(n,2) * matrix.coeff(m,3)); 31 | } 32 | 33 | template struct determinant_impl 36 | { 37 | static inline typename traits::Scalar run(const Derived& m) 38 | { 39 | if(Derived::ColsAtCompileTime==Dynamic && m.rows()==0) 40 | return typename traits::Scalar(1); 41 | return m.partialPivLu().determinant(); 42 | } 43 | }; 44 | 45 | template struct determinant_impl 46 | { 47 | static inline typename traits::Scalar run(const Derived& m) 48 | { 49 | return m.coeff(0,0); 50 | } 51 | }; 52 | 53 | template struct determinant_impl 54 | { 55 | static inline typename traits::Scalar run(const Derived& m) 56 | { 57 | return m.coeff(0,0) * m.coeff(1,1) - m.coeff(1,0) * m.coeff(0,1); 58 | } 59 | }; 60 | 61 | template struct determinant_impl 62 | { 63 | static inline typename traits::Scalar run(const Derived& m) 64 | { 65 | return bruteforce_det3_helper(m,0,1,2) 66 | - bruteforce_det3_helper(m,1,0,2) 67 | + bruteforce_det3_helper(m,2,0,1); 68 | } 69 | }; 70 | 71 | template struct determinant_impl 72 | { 73 | static typename traits::Scalar run(const Derived& m) 74 | { 75 | // trick by Martin Costabel to compute 4x4 det with only 30 muls 76 | return bruteforce_det4_helper(m,0,1,2,3) 77 | - bruteforce_det4_helper(m,0,2,1,3) 78 | + bruteforce_det4_helper(m,0,3,1,2) 79 | + bruteforce_det4_helper(m,1,2,0,3) 80 | - bruteforce_det4_helper(m,1,3,0,2) 81 | + bruteforce_det4_helper(m,2,3,0,1); 82 | } 83 | }; 84 | 85 | } // end namespace internal 86 | 87 | /** \lu_module 88 | * 89 | * \returns the determinant of this matrix 90 | */ 91 | template 92 | inline typename internal::traits::Scalar MatrixBase::determinant() const 93 | { 94 | eigen_assert(rows() == cols()); 95 | typedef typename internal::nested::type Nested; 96 | return internal::determinant_impl::type>::run(derived()); 97 | } 98 | 99 | } // end namespace Eigen 100 | 101 | #endif // EIGEN_DETERMINANT_H 102 | -------------------------------------------------------------------------------- /include/Eigen/src/LU/arch/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_LU_arch_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_LU_arch_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/LU/arch COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /include/Eigen/src/MetisSupport/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_MetisSupport_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_MetisSupport_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/MetisSupport COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /include/Eigen/src/OrderingMethods/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_OrderingMethods_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_OrderingMethods_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/OrderingMethods COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /include/Eigen/src/PaStiXSupport/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_PastixSupport_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_PastixSupport_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/PaStiXSupport COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /include/Eigen/src/PardisoSupport/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_PardisoSupport_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_PardisoSupport_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/PardisoSupport COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /include/Eigen/src/QR/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_QR_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_QR_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/QR COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /include/Eigen/src/QR/HouseholderQR_MKL.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2011, Intel Corporation. All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without modification, 5 | are permitted provided that the following conditions are met: 6 | 7 | * Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright notice, 10 | this list of conditions and the following disclaimer in the documentation 11 | and/or other materials provided with the distribution. 12 | * Neither the name of Intel Corporation nor the names of its contributors may 13 | be used to endorse or promote products derived from this software without 14 | specific prior written permission. 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 17 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 20 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 23 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | 27 | ******************************************************************************** 28 | * Content : Eigen bindings to Intel(R) MKL 29 | * Householder QR decomposition of a matrix w/o pivoting based on 30 | * LAPACKE_?geqrf function. 31 | ******************************************************************************** 32 | */ 33 | 34 | #ifndef EIGEN_QR_MKL_H 35 | #define EIGEN_QR_MKL_H 36 | 37 | #include "Eigen/src/Core/util/MKL_support.h" 38 | 39 | namespace Eigen { 40 | 41 | namespace internal { 42 | 43 | /** \internal Specialization for the data types supported by MKL */ 44 | 45 | #define EIGEN_MKL_QR_NOPIV(EIGTYPE, MKLTYPE, MKLPREFIX) \ 46 | template \ 47 | void householder_qr_inplace_blocked(MatrixQR& mat, HCoeffs& hCoeffs, \ 48 | typename MatrixQR::Index maxBlockSize=32, \ 49 | EIGTYPE* tempData = 0) \ 50 | { \ 51 | lapack_int m = mat.rows(); \ 52 | lapack_int n = mat.cols(); \ 53 | lapack_int lda = mat.outerStride(); \ 54 | lapack_int matrix_order = (MatrixQR::IsRowMajor) ? LAPACK_ROW_MAJOR : LAPACK_COL_MAJOR; \ 55 | LAPACKE_##MKLPREFIX##geqrf( matrix_order, m, n, (MKLTYPE*)mat.data(), lda, (MKLTYPE*)hCoeffs.data()); \ 56 | hCoeffs.adjointInPlace(); \ 57 | \ 58 | } 59 | 60 | EIGEN_MKL_QR_NOPIV(double, double, d) 61 | EIGEN_MKL_QR_NOPIV(float, float, s) 62 | EIGEN_MKL_QR_NOPIV(dcomplex, MKL_Complex16, z) 63 | EIGEN_MKL_QR_NOPIV(scomplex, MKL_Complex8, c) 64 | 65 | } // end namespace internal 66 | 67 | } // end namespace Eigen 68 | 69 | #endif // EIGEN_QR_MKL_H 70 | -------------------------------------------------------------------------------- /include/Eigen/src/SPQRSupport/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_SPQRSupport_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_SPQRSupport_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/SPQRSupport/ COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /include/Eigen/src/SVD/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_SVD_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_SVD_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/SVD COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /include/Eigen/src/SparseCholesky/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_SparseCholesky_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_SparseCholesky_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/SparseCholesky COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /include/Eigen/src/SparseCore/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_SparseCore_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_SparseCore_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/SparseCore COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /include/Eigen/src/SparseCore/SparseDot.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2008 Gael Guennebaud 5 | // 6 | // This Source Code Form is subject to the terms of the Mozilla 7 | // Public License v. 2.0. If a copy of the MPL was not distributed 8 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 9 | 10 | #ifndef EIGEN_SPARSE_DOT_H 11 | #define EIGEN_SPARSE_DOT_H 12 | 13 | namespace Eigen { 14 | 15 | template 16 | template 17 | typename internal::traits::Scalar 18 | SparseMatrixBase::dot(const MatrixBase& other) const 19 | { 20 | EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) 21 | EIGEN_STATIC_ASSERT_VECTOR_ONLY(OtherDerived) 22 | EIGEN_STATIC_ASSERT_SAME_VECTOR_SIZE(Derived,OtherDerived) 23 | EIGEN_STATIC_ASSERT((internal::is_same::value), 24 | YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY) 25 | 26 | eigen_assert(size() == other.size()); 27 | eigen_assert(other.size()>0 && "you are using a non initialized vector"); 28 | 29 | typename Derived::InnerIterator i(derived(),0); 30 | Scalar res(0); 31 | while (i) 32 | { 33 | res += numext::conj(i.value()) * other.coeff(i.index()); 34 | ++i; 35 | } 36 | return res; 37 | } 38 | 39 | template 40 | template 41 | typename internal::traits::Scalar 42 | SparseMatrixBase::dot(const SparseMatrixBase& other) const 43 | { 44 | EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) 45 | EIGEN_STATIC_ASSERT_VECTOR_ONLY(OtherDerived) 46 | EIGEN_STATIC_ASSERT_SAME_VECTOR_SIZE(Derived,OtherDerived) 47 | EIGEN_STATIC_ASSERT((internal::is_same::value), 48 | YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY) 49 | 50 | eigen_assert(size() == other.size()); 51 | 52 | typedef typename Derived::Nested Nested; 53 | typedef typename OtherDerived::Nested OtherNested; 54 | typedef typename internal::remove_all::type NestedCleaned; 55 | typedef typename internal::remove_all::type OtherNestedCleaned; 56 | 57 | Nested nthis(derived()); 58 | OtherNested nother(other.derived()); 59 | 60 | typename NestedCleaned::InnerIterator i(nthis,0); 61 | typename OtherNestedCleaned::InnerIterator j(nother,0); 62 | Scalar res(0); 63 | while (i && j) 64 | { 65 | if (i.index()==j.index()) 66 | { 67 | res += numext::conj(i.value()) * j.value(); 68 | ++i; ++j; 69 | } 70 | else if (i.index() 79 | inline typename NumTraits::Scalar>::Real 80 | SparseMatrixBase::squaredNorm() const 81 | { 82 | return numext::real((*this).cwiseAbs2().sum()); 83 | } 84 | 85 | template 86 | inline typename NumTraits::Scalar>::Real 87 | SparseMatrixBase::norm() const 88 | { 89 | using std::sqrt; 90 | return sqrt(squaredNorm()); 91 | } 92 | 93 | template 94 | inline typename NumTraits::Scalar>::Real 95 | SparseMatrixBase::blueNorm() const 96 | { 97 | return internal::blueNorm_impl(*this); 98 | } 99 | } // end namespace Eigen 100 | 101 | #endif // EIGEN_SPARSE_DOT_H 102 | -------------------------------------------------------------------------------- /include/Eigen/src/SparseCore/SparseFuzzy.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2008 Gael Guennebaud 5 | // 6 | // This Source Code Form is subject to the terms of the Mozilla 7 | // Public License v. 2.0. If a copy of the MPL was not distributed 8 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 9 | 10 | #ifndef EIGEN_SPARSE_FUZZY_H 11 | #define EIGEN_SPARSE_FUZZY_H 12 | 13 | // template 14 | // template 15 | // bool SparseMatrixBase::isApprox( 16 | // const OtherDerived& other, 17 | // typename NumTraits::Real prec 18 | // ) const 19 | // { 20 | // const typename internal::nested::type nested(derived()); 21 | // const typename internal::nested::type otherNested(other.derived()); 22 | // return (nested - otherNested).cwise().abs2().sum() 23 | // <= prec * prec * (std::min)(nested.cwise().abs2().sum(), otherNested.cwise().abs2().sum()); 24 | // } 25 | 26 | #endif // EIGEN_SPARSE_FUZZY_H 27 | -------------------------------------------------------------------------------- /include/Eigen/src/SparseCore/SparseRedux.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2008 Gael Guennebaud 5 | // 6 | // This Source Code Form is subject to the terms of the Mozilla 7 | // Public License v. 2.0. If a copy of the MPL was not distributed 8 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 9 | 10 | #ifndef EIGEN_SPARSEREDUX_H 11 | #define EIGEN_SPARSEREDUX_H 12 | 13 | namespace Eigen { 14 | 15 | template 16 | typename internal::traits::Scalar 17 | SparseMatrixBase::sum() const 18 | { 19 | eigen_assert(rows()>0 && cols()>0 && "you are using a non initialized matrix"); 20 | Scalar res(0); 21 | for (Index j=0; j 28 | typename internal::traits >::Scalar 29 | SparseMatrix<_Scalar,_Options,_Index>::sum() const 30 | { 31 | eigen_assert(rows()>0 && cols()>0 && "you are using a non initialized matrix"); 32 | return Matrix::Map(&m_data.value(0), m_data.size()).sum(); 33 | } 34 | 35 | template 36 | typename internal::traits >::Scalar 37 | SparseVector<_Scalar,_Options,_Index>::sum() const 38 | { 39 | eigen_assert(rows()>0 && cols()>0 && "you are using a non initialized matrix"); 40 | return Matrix::Map(&m_data.value(0), m_data.size()).sum(); 41 | } 42 | 43 | } // end namespace Eigen 44 | 45 | #endif // EIGEN_SPARSEREDUX_H 46 | -------------------------------------------------------------------------------- /include/Eigen/src/SparseCore/SparseTranspose.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2008-2009 Gael Guennebaud 5 | // 6 | // This Source Code Form is subject to the terms of the Mozilla 7 | // Public License v. 2.0. If a copy of the MPL was not distributed 8 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 9 | 10 | #ifndef EIGEN_SPARSETRANSPOSE_H 11 | #define EIGEN_SPARSETRANSPOSE_H 12 | 13 | namespace Eigen { 14 | 15 | template class TransposeImpl 16 | : public SparseMatrixBase > 17 | { 18 | typedef typename internal::remove_all::type _MatrixTypeNested; 19 | public: 20 | 21 | EIGEN_SPARSE_PUBLIC_INTERFACE(Transpose ) 22 | 23 | class InnerIterator; 24 | class ReverseInnerIterator; 25 | 26 | inline Index nonZeros() const { return derived().nestedExpression().nonZeros(); } 27 | }; 28 | 29 | // NOTE: VC10 and VC11 trigger an ICE if don't put typename TransposeImpl:: in front of Index, 30 | // a typedef typename TransposeImpl::Index Index; 31 | // does not fix the issue. 32 | // An alternative is to define the nested class in the parent class itself. 33 | template class TransposeImpl::InnerIterator 34 | : public _MatrixTypeNested::InnerIterator 35 | { 36 | typedef typename _MatrixTypeNested::InnerIterator Base; 37 | typedef typename TransposeImpl::Index Index; 38 | public: 39 | 40 | EIGEN_STRONG_INLINE InnerIterator(const TransposeImpl& trans, typename TransposeImpl::Index outer) 41 | : Base(trans.derived().nestedExpression(), outer) 42 | {} 43 | typename TransposeImpl::Index row() const { return Base::col(); } 44 | typename TransposeImpl::Index col() const { return Base::row(); } 45 | }; 46 | 47 | template class TransposeImpl::ReverseInnerIterator 48 | : public _MatrixTypeNested::ReverseInnerIterator 49 | { 50 | typedef typename _MatrixTypeNested::ReverseInnerIterator Base; 51 | typedef typename TransposeImpl::Index Index; 52 | public: 53 | 54 | EIGEN_STRONG_INLINE ReverseInnerIterator(const TransposeImpl& xpr, typename TransposeImpl::Index outer) 55 | : Base(xpr.derived().nestedExpression(), outer) 56 | {} 57 | typename TransposeImpl::Index row() const { return Base::col(); } 58 | typename TransposeImpl::Index col() const { return Base::row(); } 59 | }; 60 | 61 | } // end namespace Eigen 62 | 63 | #endif // EIGEN_SPARSETRANSPOSE_H 64 | -------------------------------------------------------------------------------- /include/Eigen/src/SparseCore/SparseView.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2011 Gael Guennebaud 5 | // Copyright (C) 2010 Daniel Lowengrub 6 | // 7 | // This Source Code Form is subject to the terms of the Mozilla 8 | // Public License v. 2.0. If a copy of the MPL was not distributed 9 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 10 | 11 | #ifndef EIGEN_SPARSEVIEW_H 12 | #define EIGEN_SPARSEVIEW_H 13 | 14 | namespace Eigen { 15 | 16 | namespace internal { 17 | 18 | template 19 | struct traits > : traits 20 | { 21 | typedef typename MatrixType::Index Index; 22 | typedef Sparse StorageKind; 23 | enum { 24 | Flags = int(traits::Flags) & (RowMajorBit) 25 | }; 26 | }; 27 | 28 | } // end namespace internal 29 | 30 | template 31 | class SparseView : public SparseMatrixBase > 32 | { 33 | typedef typename MatrixType::Nested MatrixTypeNested; 34 | typedef typename internal::remove_all::type _MatrixTypeNested; 35 | public: 36 | EIGEN_SPARSE_PUBLIC_INTERFACE(SparseView) 37 | 38 | SparseView(const MatrixType& mat, const Scalar& m_reference = Scalar(0), 39 | typename NumTraits::Real m_epsilon = NumTraits::dummy_precision()) : 40 | m_matrix(mat), m_reference(m_reference), m_epsilon(m_epsilon) {} 41 | 42 | class InnerIterator; 43 | 44 | inline Index rows() const { return m_matrix.rows(); } 45 | inline Index cols() const { return m_matrix.cols(); } 46 | 47 | inline Index innerSize() const { return m_matrix.innerSize(); } 48 | inline Index outerSize() const { return m_matrix.outerSize(); } 49 | 50 | protected: 51 | MatrixTypeNested m_matrix; 52 | Scalar m_reference; 53 | typename NumTraits::Real m_epsilon; 54 | }; 55 | 56 | template 57 | class SparseView::InnerIterator : public _MatrixTypeNested::InnerIterator 58 | { 59 | typedef typename SparseView::Index Index; 60 | public: 61 | typedef typename _MatrixTypeNested::InnerIterator IterBase; 62 | InnerIterator(const SparseView& view, Index outer) : 63 | IterBase(view.m_matrix, outer), m_view(view) 64 | { 65 | incrementToNonZero(); 66 | } 67 | 68 | EIGEN_STRONG_INLINE InnerIterator& operator++() 69 | { 70 | IterBase::operator++(); 71 | incrementToNonZero(); 72 | return *this; 73 | } 74 | 75 | using IterBase::value; 76 | 77 | protected: 78 | const SparseView& m_view; 79 | 80 | private: 81 | void incrementToNonZero() 82 | { 83 | while((bool(*this)) && internal::isMuchSmallerThan(value(), m_view.m_reference, m_view.m_epsilon)) 84 | { 85 | IterBase::operator++(); 86 | } 87 | } 88 | }; 89 | 90 | template 91 | const SparseView MatrixBase::sparseView(const Scalar& m_reference, 92 | const typename NumTraits::Real& m_epsilon) const 93 | { 94 | return SparseView(derived(), m_reference, m_epsilon); 95 | } 96 | 97 | } // end namespace Eigen 98 | 99 | #endif 100 | -------------------------------------------------------------------------------- /include/Eigen/src/SparseLU/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_SparseLU_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_SparseLU_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/SparseLU COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /include/Eigen/src/SparseLU/SparseLU_Utils.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2012 Désiré Nuentsa-Wakam 5 | // 6 | // This Source Code Form is subject to the terms of the Mozilla 7 | // Public License v. 2.0. If a copy of the MPL was not distributed 8 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 9 | 10 | 11 | #ifndef EIGEN_SPARSELU_UTILS_H 12 | #define EIGEN_SPARSELU_UTILS_H 13 | 14 | namespace Eigen { 15 | namespace internal { 16 | 17 | /** 18 | * \brief Count Nonzero elements in the factors 19 | */ 20 | template 21 | void SparseLUImpl::countnz(const Index n, Index& nnzL, Index& nnzU, GlobalLU_t& glu) 22 | { 23 | nnzL = 0; 24 | nnzU = (glu.xusub)(n); 25 | Index nsuper = (glu.supno)(n); 26 | Index jlen; 27 | Index i, j, fsupc; 28 | if (n <= 0 ) return; 29 | // For each supernode 30 | for (i = 0; i <= nsuper; i++) 31 | { 32 | fsupc = glu.xsup(i); 33 | jlen = glu.xlsub(fsupc+1) - glu.xlsub(fsupc); 34 | 35 | for (j = fsupc; j < glu.xsup(i+1); j++) 36 | { 37 | nnzL += jlen; 38 | nnzU += j - fsupc + 1; 39 | jlen--; 40 | } 41 | } 42 | } 43 | 44 | /** 45 | * \brief Fix up the data storage lsub for L-subscripts. 46 | * 47 | * It removes the subscripts sets for structural pruning, 48 | * and applies permutation to the remaining subscripts 49 | * 50 | */ 51 | template 52 | void SparseLUImpl::fixupL(const Index n, const IndexVector& perm_r, GlobalLU_t& glu) 53 | { 54 | Index fsupc, i, j, k, jstart; 55 | 56 | Index nextl = 0; 57 | Index nsuper = (glu.supno)(n); 58 | 59 | // For each supernode 60 | for (i = 0; i <= nsuper; i++) 61 | { 62 | fsupc = glu.xsup(i); 63 | jstart = glu.xlsub(fsupc); 64 | glu.xlsub(fsupc) = nextl; 65 | for (j = jstart; j < glu.xlsub(fsupc + 1); j++) 66 | { 67 | glu.lsub(nextl) = perm_r(glu.lsub(j)); // Now indexed into P*A 68 | nextl++; 69 | } 70 | for (k = fsupc+1; k < glu.xsup(i+1); k++) 71 | glu.xlsub(k) = nextl; // other columns in supernode i 72 | } 73 | 74 | glu.xlsub(n) = nextl; 75 | } 76 | 77 | } // end namespace internal 78 | 79 | } // end namespace Eigen 80 | #endif // EIGEN_SPARSELU_UTILS_H 81 | -------------------------------------------------------------------------------- /include/Eigen/src/SparseLU/SparseLU_relax_snode.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2012 Désiré Nuentsa-Wakam 5 | // 6 | // This Source Code Form is subject to the terms of the Mozilla 7 | // Public License v. 2.0. If a copy of the MPL was not distributed 8 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 9 | 10 | /* This file is a modified version of heap_relax_snode.c file in SuperLU 11 | * -- SuperLU routine (version 3.0) -- 12 | * Univ. of California Berkeley, Xerox Palo Alto Research Center, 13 | * and Lawrence Berkeley National Lab. 14 | * October 15, 2003 15 | * 16 | * Copyright (c) 1994 by Xerox Corporation. All rights reserved. 17 | * 18 | * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY 19 | * EXPRESSED OR IMPLIED. ANY USE IS AT YOUR OWN RISK. 20 | * 21 | * Permission is hereby granted to use or copy this program for any 22 | * purpose, provided the above notices are retained on all copies. 23 | * Permission to modify the code and to distribute modified code is 24 | * granted, provided the above notices are retained, and a notice that 25 | * the code was modified is included with the above copyright notice. 26 | */ 27 | 28 | #ifndef SPARSELU_RELAX_SNODE_H 29 | #define SPARSELU_RELAX_SNODE_H 30 | 31 | namespace Eigen { 32 | 33 | namespace internal { 34 | 35 | /** 36 | * \brief Identify the initial relaxed supernodes 37 | * 38 | * This routine is applied to a column elimination tree. 39 | * It assumes that the matrix has been reordered according to the postorder of the etree 40 | * \param n the number of columns 41 | * \param et elimination tree 42 | * \param relax_columns Maximum number of columns allowed in a relaxed snode 43 | * \param descendants Number of descendants of each node in the etree 44 | * \param relax_end last column in a supernode 45 | */ 46 | template 47 | void SparseLUImpl::relax_snode (const Index n, IndexVector& et, const Index relax_columns, IndexVector& descendants, IndexVector& relax_end) 48 | { 49 | 50 | // compute the number of descendants of each node in the etree 51 | Index j, parent; 52 | relax_end.setConstant(emptyIdxLU); 53 | descendants.setZero(); 54 | for (j = 0; j < n; j++) 55 | { 56 | parent = et(j); 57 | if (parent != n) // not the dummy root 58 | descendants(parent) += descendants(j) + 1; 59 | } 60 | // Identify the relaxed supernodes by postorder traversal of the etree 61 | Index snode_start; // beginning of a snode 62 | for (j = 0; j < n; ) 63 | { 64 | parent = et(j); 65 | snode_start = j; 66 | while ( parent != n && descendants(parent) < relax_columns ) 67 | { 68 | j = parent; 69 | parent = et(j); 70 | } 71 | // Found a supernode in postordered etree, j is the last column 72 | relax_end(snode_start) = j; // Record last column 73 | j++; 74 | // Search for a new leaf 75 | while (descendants(j) != 0 && j < n) j++; 76 | } // End postorder traversal of the etree 77 | 78 | } 79 | 80 | } // end namespace internal 81 | 82 | } // end namespace Eigen 83 | #endif 84 | -------------------------------------------------------------------------------- /include/Eigen/src/SparseQR/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_SparseQR_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_SparseQR_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/SparseQR/ COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /include/Eigen/src/StlSupport/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_StlSupport_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_StlSupport_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/StlSupport COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /include/Eigen/src/StlSupport/details.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2009 Gael Guennebaud 5 | // Copyright (C) 2009 Hauke Heibel 6 | // 7 | // This Source Code Form is subject to the terms of the Mozilla 8 | // Public License v. 2.0. If a copy of the MPL was not distributed 9 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 10 | 11 | #ifndef EIGEN_STL_DETAILS_H 12 | #define EIGEN_STL_DETAILS_H 13 | 14 | #ifndef EIGEN_ALIGNED_ALLOCATOR 15 | #define EIGEN_ALIGNED_ALLOCATOR Eigen::aligned_allocator 16 | #endif 17 | 18 | namespace Eigen { 19 | 20 | // This one is needed to prevent reimplementing the whole std::vector. 21 | template 22 | class aligned_allocator_indirection : public EIGEN_ALIGNED_ALLOCATOR 23 | { 24 | public: 25 | typedef size_t size_type; 26 | typedef ptrdiff_t difference_type; 27 | typedef T* pointer; 28 | typedef const T* const_pointer; 29 | typedef T& reference; 30 | typedef const T& const_reference; 31 | typedef T value_type; 32 | 33 | template 34 | struct rebind 35 | { 36 | typedef aligned_allocator_indirection other; 37 | }; 38 | 39 | aligned_allocator_indirection() {} 40 | aligned_allocator_indirection(const aligned_allocator_indirection& ) : EIGEN_ALIGNED_ALLOCATOR() {} 41 | aligned_allocator_indirection(const EIGEN_ALIGNED_ALLOCATOR& ) {} 42 | template 43 | aligned_allocator_indirection(const aligned_allocator_indirection& ) {} 44 | template 45 | aligned_allocator_indirection(const EIGEN_ALIGNED_ALLOCATOR& ) {} 46 | ~aligned_allocator_indirection() {} 47 | }; 48 | 49 | #ifdef _MSC_VER 50 | 51 | // sometimes, MSVC detects, at compile time, that the argument x 52 | // in std::vector::resize(size_t s,T x) won't be aligned and generate an error 53 | // even if this function is never called. Whence this little wrapper. 54 | #define EIGEN_WORKAROUND_MSVC_STL_SUPPORT(T) \ 55 | typename Eigen::internal::conditional< \ 56 | Eigen::internal::is_arithmetic::value, \ 57 | T, \ 58 | Eigen::internal::workaround_msvc_stl_support \ 59 | >::type 60 | 61 | namespace internal { 62 | template struct workaround_msvc_stl_support : public T 63 | { 64 | inline workaround_msvc_stl_support() : T() {} 65 | inline workaround_msvc_stl_support(const T& other) : T(other) {} 66 | inline operator T& () { return *static_cast(this); } 67 | inline operator const T& () const { return *static_cast(this); } 68 | template 69 | inline T& operator=(const OtherT& other) 70 | { T::operator=(other); return *this; } 71 | inline workaround_msvc_stl_support& operator=(const workaround_msvc_stl_support& other) 72 | { T::operator=(other); return *this; } 73 | }; 74 | } 75 | 76 | #else 77 | 78 | #define EIGEN_WORKAROUND_MSVC_STL_SUPPORT(T) T 79 | 80 | #endif 81 | 82 | } 83 | 84 | #endif // EIGEN_STL_DETAILS_H 85 | -------------------------------------------------------------------------------- /include/Eigen/src/SuperLUSupport/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_SuperLUSupport_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_SuperLUSupport_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/SuperLUSupport COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /include/Eigen/src/UmfPackSupport/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_UmfPackSupport_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_UmfPackSupport_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/UmfPackSupport COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /include/Eigen/src/misc/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_misc_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_misc_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/misc COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /include/Eigen/src/misc/Image.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2009 Benoit Jacob 5 | // 6 | // This Source Code Form is subject to the terms of the Mozilla 7 | // Public License v. 2.0. If a copy of the MPL was not distributed 8 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 9 | 10 | #ifndef EIGEN_MISC_IMAGE_H 11 | #define EIGEN_MISC_IMAGE_H 12 | 13 | namespace Eigen { 14 | 15 | namespace internal { 16 | 17 | /** \class image_retval_base 18 | * 19 | */ 20 | template 21 | struct traits > 22 | { 23 | typedef typename DecompositionType::MatrixType MatrixType; 24 | typedef Matrix< 25 | typename MatrixType::Scalar, 26 | MatrixType::RowsAtCompileTime, // the image is a subspace of the destination space, whose 27 | // dimension is the number of rows of the original matrix 28 | Dynamic, // we don't know at compile time the dimension of the image (the rank) 29 | MatrixType::Options, 30 | MatrixType::MaxRowsAtCompileTime, // the image matrix will consist of columns from the original matrix, 31 | MatrixType::MaxColsAtCompileTime // so it has the same number of rows and at most as many columns. 32 | > ReturnType; 33 | }; 34 | 35 | template struct image_retval_base 36 | : public ReturnByValue > 37 | { 38 | typedef _DecompositionType DecompositionType; 39 | typedef typename DecompositionType::MatrixType MatrixType; 40 | typedef ReturnByValue Base; 41 | typedef typename Base::Index Index; 42 | 43 | image_retval_base(const DecompositionType& dec, const MatrixType& originalMatrix) 44 | : m_dec(dec), m_rank(dec.rank()), 45 | m_cols(m_rank == 0 ? 1 : m_rank), 46 | m_originalMatrix(originalMatrix) 47 | {} 48 | 49 | inline Index rows() const { return m_dec.rows(); } 50 | inline Index cols() const { return m_cols; } 51 | inline Index rank() const { return m_rank; } 52 | inline const DecompositionType& dec() const { return m_dec; } 53 | inline const MatrixType& originalMatrix() const { return m_originalMatrix; } 54 | 55 | template inline void evalTo(Dest& dst) const 56 | { 57 | static_cast*>(this)->evalTo(dst); 58 | } 59 | 60 | protected: 61 | const DecompositionType& m_dec; 62 | Index m_rank, m_cols; 63 | const MatrixType& m_originalMatrix; 64 | }; 65 | 66 | } // end namespace internal 67 | 68 | #define EIGEN_MAKE_IMAGE_HELPERS(DecompositionType) \ 69 | typedef typename DecompositionType::MatrixType MatrixType; \ 70 | typedef typename MatrixType::Scalar Scalar; \ 71 | typedef typename MatrixType::RealScalar RealScalar; \ 72 | typedef typename MatrixType::Index Index; \ 73 | typedef Eigen::internal::image_retval_base Base; \ 74 | using Base::dec; \ 75 | using Base::originalMatrix; \ 76 | using Base::rank; \ 77 | using Base::rows; \ 78 | using Base::cols; \ 79 | image_retval(const DecompositionType& dec, const MatrixType& originalMatrix) \ 80 | : Base(dec, originalMatrix) {} 81 | 82 | } // end namespace Eigen 83 | 84 | #endif // EIGEN_MISC_IMAGE_H 85 | -------------------------------------------------------------------------------- /include/Eigen/src/misc/Kernel.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2009 Benoit Jacob 5 | // 6 | // This Source Code Form is subject to the terms of the Mozilla 7 | // Public License v. 2.0. If a copy of the MPL was not distributed 8 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 9 | 10 | #ifndef EIGEN_MISC_KERNEL_H 11 | #define EIGEN_MISC_KERNEL_H 12 | 13 | namespace Eigen { 14 | 15 | namespace internal { 16 | 17 | /** \class kernel_retval_base 18 | * 19 | */ 20 | template 21 | struct traits > 22 | { 23 | typedef typename DecompositionType::MatrixType MatrixType; 24 | typedef Matrix< 25 | typename MatrixType::Scalar, 26 | MatrixType::ColsAtCompileTime, // the number of rows in the "kernel matrix" 27 | // is the number of cols of the original matrix 28 | // so that the product "matrix * kernel = zero" makes sense 29 | Dynamic, // we don't know at compile-time the dimension of the kernel 30 | MatrixType::Options, 31 | MatrixType::MaxColsAtCompileTime, // see explanation for 2nd template parameter 32 | MatrixType::MaxColsAtCompileTime // the kernel is a subspace of the domain space, 33 | // whose dimension is the number of columns of the original matrix 34 | > ReturnType; 35 | }; 36 | 37 | template struct kernel_retval_base 38 | : public ReturnByValue > 39 | { 40 | typedef _DecompositionType DecompositionType; 41 | typedef ReturnByValue Base; 42 | typedef typename Base::Index Index; 43 | 44 | kernel_retval_base(const DecompositionType& dec) 45 | : m_dec(dec), 46 | m_rank(dec.rank()), 47 | m_cols(m_rank==dec.cols() ? 1 : dec.cols() - m_rank) 48 | {} 49 | 50 | inline Index rows() const { return m_dec.cols(); } 51 | inline Index cols() const { return m_cols; } 52 | inline Index rank() const { return m_rank; } 53 | inline const DecompositionType& dec() const { return m_dec; } 54 | 55 | template inline void evalTo(Dest& dst) const 56 | { 57 | static_cast*>(this)->evalTo(dst); 58 | } 59 | 60 | protected: 61 | const DecompositionType& m_dec; 62 | Index m_rank, m_cols; 63 | }; 64 | 65 | } // end namespace internal 66 | 67 | #define EIGEN_MAKE_KERNEL_HELPERS(DecompositionType) \ 68 | typedef typename DecompositionType::MatrixType MatrixType; \ 69 | typedef typename MatrixType::Scalar Scalar; \ 70 | typedef typename MatrixType::RealScalar RealScalar; \ 71 | typedef typename MatrixType::Index Index; \ 72 | typedef Eigen::internal::kernel_retval_base Base; \ 73 | using Base::dec; \ 74 | using Base::rank; \ 75 | using Base::rows; \ 76 | using Base::cols; \ 77 | kernel_retval(const DecompositionType& dec) : Base(dec) {} 78 | 79 | } // end namespace Eigen 80 | 81 | #endif // EIGEN_MISC_KERNEL_H 82 | -------------------------------------------------------------------------------- /include/Eigen/src/misc/Solve.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2009 Benoit Jacob 5 | // 6 | // This Source Code Form is subject to the terms of the Mozilla 7 | // Public License v. 2.0. If a copy of the MPL was not distributed 8 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 9 | 10 | #ifndef EIGEN_MISC_SOLVE_H 11 | #define EIGEN_MISC_SOLVE_H 12 | 13 | namespace Eigen { 14 | 15 | namespace internal { 16 | 17 | /** \class solve_retval_base 18 | * 19 | */ 20 | template 21 | struct traits > 22 | { 23 | typedef typename DecompositionType::MatrixType MatrixType; 24 | typedef Matrix ReturnType; 30 | }; 31 | 32 | template struct solve_retval_base 33 | : public ReturnByValue > 34 | { 35 | typedef typename remove_all::type RhsNestedCleaned; 36 | typedef _DecompositionType DecompositionType; 37 | typedef ReturnByValue Base; 38 | typedef typename Base::Index Index; 39 | 40 | solve_retval_base(const DecompositionType& dec, const Rhs& rhs) 41 | : m_dec(dec), m_rhs(rhs) 42 | {} 43 | 44 | inline Index rows() const { return m_dec.cols(); } 45 | inline Index cols() const { return m_rhs.cols(); } 46 | inline const DecompositionType& dec() const { return m_dec; } 47 | inline const RhsNestedCleaned& rhs() const { return m_rhs; } 48 | 49 | template inline void evalTo(Dest& dst) const 50 | { 51 | static_cast*>(this)->evalTo(dst); 52 | } 53 | 54 | protected: 55 | const DecompositionType& m_dec; 56 | typename Rhs::Nested m_rhs; 57 | }; 58 | 59 | } // end namespace internal 60 | 61 | #define EIGEN_MAKE_SOLVE_HELPERS(DecompositionType,Rhs) \ 62 | typedef typename DecompositionType::MatrixType MatrixType; \ 63 | typedef typename MatrixType::Scalar Scalar; \ 64 | typedef typename MatrixType::RealScalar RealScalar; \ 65 | typedef typename MatrixType::Index Index; \ 66 | typedef Eigen::internal::solve_retval_base Base; \ 67 | using Base::dec; \ 68 | using Base::rhs; \ 69 | using Base::rows; \ 70 | using Base::cols; \ 71 | solve_retval(const DecompositionType& dec, const Rhs& rhs) \ 72 | : Base(dec, rhs) {} 73 | 74 | } // end namespace Eigen 75 | 76 | #endif // EIGEN_MISC_SOLVE_H 77 | -------------------------------------------------------------------------------- /include/Eigen/src/plugins/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_plugins_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_plugins_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/plugins COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /include/Eigen/src/plugins/CommonCwiseBinaryOps.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2008-2009 Gael Guennebaud 5 | // Copyright (C) 2006-2008 Benoit Jacob 6 | // 7 | // This Source Code Form is subject to the terms of the Mozilla 8 | // Public License v. 2.0. If a copy of the MPL was not distributed 9 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 10 | 11 | // This file is a base class plugin containing common coefficient wise functions. 12 | 13 | /** \returns an expression of the difference of \c *this and \a other 14 | * 15 | * \note If you want to substract a given scalar from all coefficients, see Cwise::operator-(). 16 | * 17 | * \sa class CwiseBinaryOp, operator-=() 18 | */ 19 | EIGEN_MAKE_CWISE_BINARY_OP(operator-,internal::scalar_difference_op) 20 | 21 | /** \returns an expression of the sum of \c *this and \a other 22 | * 23 | * \note If you want to add a given scalar to all coefficients, see Cwise::operator+(). 24 | * 25 | * \sa class CwiseBinaryOp, operator+=() 26 | */ 27 | EIGEN_MAKE_CWISE_BINARY_OP(operator+,internal::scalar_sum_op) 28 | 29 | /** \returns an expression of a custom coefficient-wise operator \a func of *this and \a other 30 | * 31 | * The template parameter \a CustomBinaryOp is the type of the functor 32 | * of the custom operator (see class CwiseBinaryOp for an example) 33 | * 34 | * Here is an example illustrating the use of custom functors: 35 | * \include class_CwiseBinaryOp.cpp 36 | * Output: \verbinclude class_CwiseBinaryOp.out 37 | * 38 | * \sa class CwiseBinaryOp, operator+(), operator-(), cwiseProduct() 39 | */ 40 | template 41 | EIGEN_STRONG_INLINE const CwiseBinaryOp 42 | binaryExpr(const EIGEN_CURRENT_STORAGE_BASE_CLASS &other, const CustomBinaryOp& func = CustomBinaryOp()) const 43 | { 44 | return CwiseBinaryOp(derived(), other.derived(), func); 45 | } 46 | 47 | -------------------------------------------------------------------------------- /include/Eigen/src/plugins/MatrixCwiseUnaryOps.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2008-2009 Gael Guennebaud 5 | // Copyright (C) 2006-2008 Benoit Jacob 6 | // 7 | // This Source Code Form is subject to the terms of the Mozilla 8 | // Public License v. 2.0. If a copy of the MPL was not distributed 9 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 10 | 11 | // This file is a base class plugin containing matrix specifics coefficient wise functions. 12 | 13 | /** \returns an expression of the coefficient-wise absolute value of \c *this 14 | * 15 | * Example: \include MatrixBase_cwiseAbs.cpp 16 | * Output: \verbinclude MatrixBase_cwiseAbs.out 17 | * 18 | * \sa cwiseAbs2() 19 | */ 20 | EIGEN_STRONG_INLINE const CwiseUnaryOp, const Derived> 21 | cwiseAbs() const { return derived(); } 22 | 23 | /** \returns an expression of the coefficient-wise squared absolute value of \c *this 24 | * 25 | * Example: \include MatrixBase_cwiseAbs2.cpp 26 | * Output: \verbinclude MatrixBase_cwiseAbs2.out 27 | * 28 | * \sa cwiseAbs() 29 | */ 30 | EIGEN_STRONG_INLINE const CwiseUnaryOp, const Derived> 31 | cwiseAbs2() const { return derived(); } 32 | 33 | /** \returns an expression of the coefficient-wise square root of *this. 34 | * 35 | * Example: \include MatrixBase_cwiseSqrt.cpp 36 | * Output: \verbinclude MatrixBase_cwiseSqrt.out 37 | * 38 | * \sa cwisePow(), cwiseSquare() 39 | */ 40 | inline const CwiseUnaryOp, const Derived> 41 | cwiseSqrt() const { return derived(); } 42 | 43 | /** \returns an expression of the coefficient-wise inverse of *this. 44 | * 45 | * Example: \include MatrixBase_cwiseInverse.cpp 46 | * Output: \verbinclude MatrixBase_cwiseInverse.out 47 | * 48 | * \sa cwiseProduct() 49 | */ 50 | inline const CwiseUnaryOp, const Derived> 51 | cwiseInverse() const { return derived(); } 52 | 53 | /** \returns an expression of the coefficient-wise == operator of \c *this and a scalar \a s 54 | * 55 | * \warning this performs an exact comparison, which is generally a bad idea with floating-point types. 56 | * In order to check for equality between two vectors or matrices with floating-point coefficients, it is 57 | * generally a far better idea to use a fuzzy comparison as provided by isApprox() and 58 | * isMuchSmallerThan(). 59 | * 60 | * \sa cwiseEqual(const MatrixBase &) const 61 | */ 62 | inline const CwiseUnaryOp >, const Derived> 63 | cwiseEqual(const Scalar& s) const 64 | { 65 | return CwiseUnaryOp >,const Derived> 66 | (derived(), std::bind1st(std::equal_to(), s)); 67 | } 68 | -------------------------------------------------------------------------------- /include/convert.h: -------------------------------------------------------------------------------- 1 | #ifndef __CONVERT_H 2 | #define __CONVERT_H 3 | 4 | #include 5 | 6 | // converts the string into the specified type, setting r to the converted 7 | // value and returning true/false on success or failure 8 | template 9 | bool convert(const std::string& s, T& r) { 10 | std::istringstream iss(s); 11 | iss >> r; 12 | return iss.eof() ? true : false; 13 | } 14 | 15 | template 16 | std::string convert(const T& r) { 17 | std::ostringstream oss; 18 | oss << r; 19 | return oss.str(); 20 | } 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /include/cppitertools/count.hpp: -------------------------------------------------------------------------------- 1 | #ifndef ITER_COUNT_H_ 2 | #define ITER_COUNT_H_ 3 | 4 | #include "range.hpp" 5 | 6 | #include 7 | 8 | namespace iter { 9 | 10 | template 11 | auto count(T start, T step) -> decltype(range(start, start, start)) { 12 | // if step is < 0, set the stop to numeric min, otherwise numeric max 13 | T stop = step < T(0) ? std::numeric_limits::min() : 14 | std::numeric_limits::max(); 15 | return range(start, stop, step); 16 | } 17 | 18 | template 19 | auto count(T start =T(0)) -> decltype(range(start, start)) { 20 | return count(start, T(1)); 21 | } 22 | } 23 | 24 | 25 | #endif 26 | -------------------------------------------------------------------------------- /include/cppitertools/cycle.hpp: -------------------------------------------------------------------------------- 1 | #ifndef ITER_CYCLE_H_ 2 | #define ITER_CYCLE_H_ 3 | 4 | #include "iterbase.hpp" 5 | 6 | #include 7 | #include 8 | #include 9 | 10 | namespace iter { 11 | 12 | template 13 | class Cycle; 14 | 15 | template 16 | Cycle cycle(Container&&); 17 | 18 | template 19 | Cycle> cycle(std::initializer_list); 20 | 21 | template 22 | class Cycle { 23 | private: 24 | friend Cycle cycle(Container&&); 25 | template 26 | friend Cycle> cycle( 27 | std::initializer_list); 28 | 29 | Container container; 30 | 31 | Cycle(Container&& in_container) 32 | : container(std::forward(in_container)) 33 | { } 34 | 35 | public: 36 | class Iterator 37 | : public std::iterator> 39 | { 40 | private: 41 | using iter_type = iterator_type; 42 | iterator_type sub_iter; 43 | iterator_type begin; 44 | iterator_type end; 45 | public: 46 | Iterator (const iterator_type& iter, 47 | iterator_type&& in_end) 48 | : sub_iter{iter}, 49 | begin{iter}, 50 | end{std::move(in_end)} 51 | { } 52 | 53 | iterator_deref operator*() { 54 | return *this->sub_iter; 55 | } 56 | 57 | Iterator& operator++() { 58 | ++this->sub_iter; 59 | // reset to beginning upon reaching the end 60 | if (!(this->sub_iter != this->end)) { 61 | this->sub_iter = this->begin; 62 | } 63 | return *this; 64 | } 65 | 66 | Iterator operator++(int) { 67 | auto ret = *this; 68 | ++*this; 69 | return ret; 70 | } 71 | 72 | bool operator!=(const Iterator& other) const { 73 | return this->sub_iter != other.sub_iter; 74 | } 75 | 76 | bool operator==(const Iterator& other) const { 77 | return !(*this != other); 78 | } 79 | }; 80 | 81 | Iterator begin() { 82 | return {std::begin(this->container), 83 | std::end(this->container)}; 84 | } 85 | 86 | Iterator end() { 87 | return {std::end(this->container), 88 | std::end(this->container)}; 89 | } 90 | 91 | }; 92 | 93 | template 94 | Cycle cycle(Container&& container) { 95 | return {std::forward(container)}; 96 | } 97 | 98 | template 99 | Cycle> cycle(std::initializer_list il) 100 | { 101 | return {std::move(il)}; 102 | } 103 | } 104 | 105 | #endif 106 | -------------------------------------------------------------------------------- /include/cppitertools/itertools.hpp: -------------------------------------------------------------------------------- 1 | #ifndef ITERTOOLS_ALL_HPP_ 2 | #define ITERTOOLS_ALL_HPP_ 3 | 4 | #include "accumulate.hpp" 5 | #include "chain.hpp" 6 | #include "combinations.hpp" 7 | #include "combinations_with_replacement.hpp" 8 | #include "compress.hpp" 9 | #include "count.hpp" 10 | #include "cycle.hpp" 11 | #include "dropwhile.hpp" 12 | #include "enumerate.hpp" 13 | #include "filter.hpp" 14 | #include "filterfalse.hpp" 15 | #include "groupby.hpp" 16 | #include "grouper.hpp" 17 | #include "imap.hpp" 18 | #include "sliding_window.hpp" 19 | #include "permutations.hpp" 20 | #include "powerset.hpp" 21 | #include "product.hpp" 22 | #include "range.hpp" 23 | #include "repeat.hpp" 24 | #include "reversed.hpp" 25 | #include "slice.hpp" 26 | #include "sorted.hpp" 27 | #include "takewhile.hpp" 28 | #include "unique_everseen.hpp" 29 | #include "unique_justseen.hpp" 30 | #include "zip.hpp" 31 | 32 | // zip_longest is the only itertool with a boost depedency, so it must be 33 | // included explicitly 34 | 35 | #endif 36 | 37 | 38 | -------------------------------------------------------------------------------- /include/cppitertools/repeat.hpp: -------------------------------------------------------------------------------- 1 | #ifndef ITER_REPEAT_HPP_ 2 | #define ITER_REPEAT_HPP_ 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | namespace iter { 9 | 10 | // must be negative 11 | constexpr int INFINITE_REPEAT = -1; 12 | 13 | template 14 | class Repeater; 15 | 16 | template 17 | Repeater repeat(T&&); 18 | 19 | template 20 | Repeater repeat(T&&, int); 21 | 22 | template 23 | class Repeater { 24 | friend Repeater repeat(T&&); 25 | friend Repeater repeat(T&&, int); 26 | private: 27 | using TPlain = typename std::remove_reference::type; 28 | T elem; 29 | int count; 30 | 31 | Repeater(T e, int c) 32 | : elem(std::forward(e)), 33 | count{c} 34 | { } 35 | public: 36 | 37 | class Iterator 38 | : public std::iterator 39 | { 40 | private: 41 | TPlain* elem; 42 | int count; 43 | public: 44 | Iterator(TPlain* e, int c) 45 | : elem{e}, 46 | count{c} 47 | { } 48 | 49 | // count down to 0 50 | // INFINITE_REPEAT will be negative, and in that case 51 | // the value is never decremented, it will always compare 52 | // != to an end iterator 53 | Iterator& operator++() { 54 | if (this->count > 0) { 55 | --this->count; 56 | } 57 | return *this; 58 | } 59 | 60 | Iterator operator++(int) { 61 | auto ret = *this; 62 | ++*this; 63 | return ret; 64 | } 65 | 66 | bool operator!=(const Iterator& other) const { 67 | return !(*this == other); 68 | } 69 | 70 | bool operator==(const Iterator& other) const { 71 | return this->count == other.count; 72 | } 73 | 74 | T& operator*() { 75 | return *this->elem; 76 | } 77 | }; 78 | 79 | Iterator begin() { 80 | return {&this->elem, this->count}; 81 | } 82 | 83 | Iterator end() { 84 | return {&this->elem, 0}; 85 | } 86 | 87 | }; 88 | 89 | template 90 | Repeater repeat(T&& e) { 91 | return {std::forward(e), INFINITE_REPEAT}; 92 | } 93 | 94 | template 95 | Repeater repeat(T&& e, int count) { 96 | // if count is negative, pass 0 instead 97 | return {std::forward(e), count < 0 ? 0 : count}; 98 | } 99 | } 100 | 101 | #endif 102 | -------------------------------------------------------------------------------- /include/cppitertools/sorted.hpp: -------------------------------------------------------------------------------- 1 | #ifndef ITER_SORTED_HPP_ 2 | #define ITER_SORTED_HPP_ 3 | 4 | #include "iterbase.hpp" 5 | #include "iteratoriterator.hpp" 6 | 7 | #include 8 | #include 9 | #include 10 | 11 | namespace iter { 12 | template 13 | class Sorted; 14 | 15 | template 16 | Sorted sorted(Container&&, CompareFunc); 17 | 18 | template 19 | class Sorted { 20 | private: 21 | using IterIterWrap = 22 | IterIterWrapper>>; 23 | using ItIt = iterator_type; 24 | 25 | template 26 | friend Sorted sorted(C&&, F); 27 | 28 | Container container; 29 | IterIterWrap sorted_iters; 30 | 31 | template 32 | Sorted(Container&& in_container, CompareFunc compare_func) 33 | : container(std::forward(in_container)) 34 | { 35 | // Fill the sorted_iters vector with an iterator to each 36 | // element in the container 37 | for (auto iter = std::begin(this->container); 38 | iter != std::end(this->container); 39 | ++iter) { 40 | this->sorted_iters.get().push_back(iter); 41 | } 42 | 43 | // sort by comparing the elements that the iterators point to 44 | std::sort(std::begin(sorted_iters.get()), 45 | std::end(sorted_iters.get()), 46 | [compare_func] (const iterator_type& it1, 47 | const iterator_type& it2) 48 | { return compare_func(*it1, *it2); }); 49 | } 50 | 51 | public: 52 | 53 | ItIt begin() { 54 | return std::begin(sorted_iters); 55 | 56 | } 57 | 58 | ItIt end() { 59 | return std::end(sorted_iters); 60 | } 61 | }; 62 | 63 | template 64 | Sorted sorted( 65 | Container&& container, CompareFunc compare_func) { 66 | return {std::forward(container), compare_func}; 67 | } 68 | 69 | template 70 | auto sorted(Container&& container) -> 71 | decltype(sorted(std::forward(container), 72 | std::less>())) 73 | { 74 | return sorted(std::forward(container), 75 | std::less>()); 76 | } 77 | 78 | } 79 | 80 | #endif 81 | -------------------------------------------------------------------------------- /include/cppitertools/unique_everseen.hpp: -------------------------------------------------------------------------------- 1 | #ifndef ITER_UNIQUE_EVERSEEN_HPP_ 2 | #define ITER_UNIQUE_EVERSEEN_HPP_ 3 | 4 | #include "iterbase.hpp" 5 | #include "filter.hpp" 6 | 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | 13 | namespace iter 14 | { 15 | //the container type must be usable in an unordered_map to achieve constant 16 | //performance checking if it has ever been seen 17 | template 18 | auto unique_everseen(Container&& container) 19 | -> Filter)>,Container> 20 | { 21 | using elem_t = iterator_deref; 22 | std::unordered_set::type> elem_seen; 23 | 24 | std::function func = 25 | //has to be captured by value because it goes out of scope when the 26 | //function returns 27 | [elem_seen](elem_t e) mutable 28 | { 29 | if (elem_seen.find(e) == std::end(elem_seen)){ 30 | elem_seen.insert(e); 31 | return true; 32 | } else { 33 | return false; 34 | } 35 | }; 36 | return filter(func, std::forward(container)); 37 | } 38 | 39 | template 40 | auto unique_everseen(std::initializer_list il) 41 | -> Filter, std::initializer_list> 42 | { 43 | std::unordered_set elem_seen; 44 | std::function func = [elem_seen](const T& e) mutable 45 | { 46 | if (elem_seen.find(e) == std::end(elem_seen)){ 47 | elem_seen.insert(e); 48 | return true; 49 | } else { 50 | return false; 51 | } 52 | }; 53 | return filter(func, il); 54 | } 55 | } 56 | 57 | #endif 58 | -------------------------------------------------------------------------------- /include/cppitertools/unique_justseen.hpp: -------------------------------------------------------------------------------- 1 | #ifndef ITER_UNIQUE_JUSTSEEN_HPP 2 | #define ITER_UNIQUE_JUSTSEEN_HPP 3 | 4 | #include "iterbase.hpp" 5 | #include "groupby.hpp" 6 | #include "imap.hpp" 7 | 8 | #include 9 | #include 10 | #include 11 | 12 | namespace iter 13 | { 14 | template 15 | struct GroupFrontGetter{ 16 | auto operator()(iterator_deref&& gb) -> 17 | decltype(*std::begin(gb.second)) { 18 | return *std::begin(gb.second); 19 | } 20 | 21 | auto operator()(iterator_deref& gb) -> 22 | decltype(*std::begin(gb.second)) { 23 | return *std::begin(gb.second); 24 | } 25 | }; 26 | 27 | 28 | // gets first of each group. since each group is decided based on equality 29 | // with the previous item, this results in each item only appearing once 30 | template 31 | auto unique_justseen(Container&& container) -> 32 | decltype(imap(GroupFrontGetter(container)))>{}, 34 | groupby(std::forward(container)))) { 35 | return imap(GroupFrontGetter(container)))>{}, 37 | groupby(std::forward(container))); 38 | } 39 | 40 | template 41 | auto unique_justseen(std::initializer_list il) -> 42 | decltype(imap(GroupFrontGetter>(il)))>{}, 44 | groupby(std::forward>(il)))) { 45 | return imap(GroupFrontGetter>(il)))>{}, 47 | groupby(std::forward>(il))); 48 | } 49 | } 50 | 51 | #endif 52 | -------------------------------------------------------------------------------- /include/filevercmp/filevercmp.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 1995 Ian Jackson 3 | Copyright (C) 2001 Anthony Towns 4 | Copyright (C) 2008-2009 Free Software Foundation, Inc. 5 | 6 | This program is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU General Public License as published by 8 | the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | This program is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with this program. If not, see . */ 18 | 19 | #ifndef FILEVERCMP_H 20 | #define FILEVERCMP_H 21 | 22 | /* Compare version strings: 23 | 24 | This function compares strings S1 and S2: 25 | 1) By PREFIX in the same way as strcmp. 26 | 2) Then by VERSION (most similarly to version compare of Debian's dpkg). 27 | Leading zeros in version numbers are ignored. 28 | 3) If both (PREFIX and VERSION) are equal, strcmp function is used for 29 | comparison. So this function can return 0 if (and only if) strings S1 30 | and S2 are identical. 31 | 32 | It returns number >0 for S1 > S2, 0 for S1 == S2 and number <0 for S1 < S2. 33 | 34 | This function compares strings, in a way that if VER1 and VER2 are version 35 | numbers and PREFIX and SUFFIX (SUFFIX defined as (\.[A-Za-z~][A-Za-z0-9~]*)*) 36 | are strings then VER1 < VER2 implies filevercmp (PREFIX VER1 SUFFIX, 37 | PREFIX VER2 SUFFIX) < 0. 38 | 39 | This function is intended to be a replacement for strverscmp. */ 40 | int filevercmp (const char *s1, const char *s2); 41 | 42 | #endif /* FILEVERCMP_H */ 43 | -------------------------------------------------------------------------------- /include/join.h: -------------------------------------------------------------------------------- 1 | #ifndef __JOIN_H 2 | #define __JOIN_H 3 | 4 | // functions to split a string by a specific delimiter 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | // join a vector of elements by a delimiter object. ostream<< must be defined 11 | // for both class S and T and an ostream, as it is e.g. in the case of strings 12 | // and character arrays 13 | template 14 | std::string join(std::vector& elems, S& delim) { 15 | std::stringstream ss; 16 | typename std::vector::iterator e = elems.begin(); 17 | ss << *e++; 18 | for (; e != elems.end(); ++e) { 19 | ss << delim << *e; 20 | } 21 | return ss.str(); 22 | } 23 | 24 | // same for lists 25 | template 26 | std::string join(std::list& elems, S& delim) { 27 | std::stringstream ss; 28 | typename std::list::iterator e = elems.begin(); 29 | ss << *e++; 30 | for (; e != elems.end(); ++e) { 31 | ss << delim << *e; 32 | } 33 | return ss.str(); 34 | } 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /include/multichoose/multichoose.h: -------------------------------------------------------------------------------- 1 | #ifndef __MULTICHOOSE_H 2 | #define __MULTICHOOSE_H 3 | 4 | /* 5 | 6 | multichoose.h -- n multichoose k for generic vectors 7 | 8 | author: Erik Garrison 9 | last revised: 2010-04-16 10 | 11 | Copyright (c) 2010 by Erik Garrison 12 | 13 | Permission is hereby granted, free of charge, to any person 14 | obtaining a copy of this software and associated documentation 15 | files (the "Software"), to deal in the Software without 16 | restriction, including without limitation the rights to use, 17 | copy, modify, merge, publish, distribute, sublicense, and/or sell 18 | copies of the Software, and to permit persons to whom the 19 | Software is furnished to do so, subject to the following 20 | conditions: 21 | 22 | The above copyright notice and this permission notice shall be 23 | included in all copies or substantial portions of the Software. 24 | 25 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 26 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 27 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 28 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 29 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 30 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 31 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 32 | OTHER DEALINGS IN THE SOFTWARE. 33 | 34 | */ 35 | 36 | 37 | // provides multiset combinations out of the std::vector of objects 38 | template 39 | std::vector< std::vector > multichoose(int k, std::vector& objects) { 40 | 41 | std::vector< std::vector > choices; 42 | 43 | int j,j_1,q,r; 44 | 45 | r = objects.size() - 1; 46 | 47 | // combination indexes 48 | std::vector a, b; 49 | 50 | for (int i=0;i multiset; 57 | for(int i=0;i 19 | #include 20 | #include "common.h" 21 | #include "logger.h" 22 | #include "spdlog.h" 23 | 24 | 25 | namespace spdlog 26 | { 27 | 28 | namespace details 29 | { 30 | class async_log_helper; 31 | } 32 | 33 | class async_logger :public logger 34 | { 35 | public: 36 | template 37 | async_logger(const std::string& name, 38 | const It& begin, 39 | const It& end, 40 | size_t queue_size, 41 | const async_overflow_policy overflow_policy = async_overflow_policy::block_retry, 42 | const std::function& worker_warmup_cb = nullptr, 43 | const std::chrono::milliseconds& flush_interval_ms = std::chrono::milliseconds::zero()); 44 | 45 | async_logger(const std::string& logger_name, 46 | sinks_init_list sinks, 47 | size_t queue_size, 48 | const async_overflow_policy overflow_policy = async_overflow_policy::block_retry, 49 | const std::function& worker_warmup_cb = nullptr, 50 | const std::chrono::milliseconds& flush_interval_ms = std::chrono::milliseconds::zero()); 51 | 52 | async_logger(const std::string& logger_name, 53 | sink_ptr single_sink, 54 | size_t queue_size, 55 | const async_overflow_policy overflow_policy = async_overflow_policy::block_retry, 56 | const std::function& worker_warmup_cb = nullptr, 57 | const std::chrono::milliseconds& flush_interval_ms = std::chrono::milliseconds::zero()); 58 | 59 | 60 | void flush() override; 61 | protected: 62 | void _log_msg(details::log_msg& msg) override; 63 | void _set_formatter(spdlog::formatter_ptr msg_formatter) override; 64 | void _set_pattern(const std::string& pattern) override; 65 | 66 | private: 67 | std::unique_ptr _async_log_helper; 68 | }; 69 | } 70 | 71 | 72 | #include "./details/async_logger_impl.h" 73 | -------------------------------------------------------------------------------- /include/spdlog/common.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright(c) 2015 Gabi Melman. 3 | // Distributed under the MIT License (http://opensource.org/licenses/MIT) 4 | // 5 | 6 | #pragma once 7 | 8 | #include 9 | #include 10 | #include 11 | #include 12 | 13 | //visual studio does not support noexcept yet 14 | #ifndef _MSC_VER 15 | #define SPDLOG_NOEXCEPT noexcept 16 | #else 17 | #define SPDLOG_NOEXCEPT throw() 18 | #endif 19 | 20 | 21 | namespace spdlog 22 | { 23 | 24 | class formatter; 25 | 26 | namespace sinks 27 | { 28 | class sink; 29 | } 30 | 31 | // Common types across the lib 32 | using log_clock = std::chrono::system_clock; 33 | using sink_ptr = std::shared_ptr < sinks::sink >; 34 | using sinks_init_list = std::initializer_list < sink_ptr >; 35 | using formatter_ptr = std::shared_ptr; 36 | 37 | 38 | //Log level enum 39 | namespace level 40 | { 41 | typedef enum 42 | { 43 | trace = 0, 44 | debug = 1, 45 | info = 2, 46 | notice = 3, 47 | warn = 4, 48 | err = 5, 49 | critical = 6, 50 | alert = 7, 51 | emerg = 8, 52 | off = 9 53 | } level_enum; 54 | 55 | static const char* level_names[] { "trace", "debug", "info", "notice", "warning", "error", "critical", "alert", "emerg", "off"}; 56 | 57 | static const char* short_level_names[] { "T", "D", "I", "N", "W", "E", "C", "A", "M", "O"}; 58 | 59 | inline const char* to_str(spdlog::level::level_enum l) 60 | { 61 | return level_names[l]; 62 | } 63 | 64 | inline const char* to_short_str(spdlog::level::level_enum l) 65 | { 66 | return short_level_names[l]; 67 | } 68 | } //level 69 | 70 | 71 | // 72 | // Async overflow policy - block by default. 73 | // 74 | enum class async_overflow_policy 75 | { 76 | block_retry, // Block / yield / sleep until message can be enqueued 77 | discard_log_msg // Discard the message it enqueue fails 78 | }; 79 | 80 | 81 | // 82 | // Log exception 83 | // 84 | class spdlog_ex : public std::exception 85 | { 86 | public: 87 | spdlog_ex(const std::string& msg) :_msg(msg) {} 88 | const char* what() const SPDLOG_NOEXCEPT override 89 | { 90 | return _msg.c_str(); 91 | } 92 | private: 93 | std::string _msg; 94 | 95 | }; 96 | 97 | } //spdlog -------------------------------------------------------------------------------- /include/spdlog/details/async_logger_impl.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright(c) 2015 Gabi Melman. 3 | // Distributed under the MIT License (http://opensource.org/licenses/MIT) 4 | // 5 | 6 | #pragma once 7 | 8 | // Async Logger implementation 9 | // Use an async_sink (queue per logger) to perform the logging in a worker thread 10 | 11 | #include "./async_log_helper.h" 12 | 13 | 14 | template 15 | inline spdlog::async_logger::async_logger(const std::string& logger_name, 16 | const It& begin, 17 | const It& end, 18 | size_t queue_size, 19 | const async_overflow_policy overflow_policy, 20 | const std::function& worker_warmup_cb, 21 | const std::chrono::milliseconds& flush_interval_ms) : 22 | logger(logger_name, begin, end), 23 | _async_log_helper(new details::async_log_helper(_formatter, _sinks, queue_size, overflow_policy, worker_warmup_cb, flush_interval_ms)) 24 | { 25 | } 26 | 27 | inline spdlog::async_logger::async_logger(const std::string& logger_name, 28 | sinks_init_list sinks, 29 | size_t queue_size, 30 | const async_overflow_policy overflow_policy, 31 | const std::function& worker_warmup_cb, 32 | const std::chrono::milliseconds& flush_interval_ms) : 33 | async_logger(logger_name, sinks.begin(), sinks.end(), queue_size, overflow_policy, worker_warmup_cb, flush_interval_ms) {} 34 | 35 | inline spdlog::async_logger::async_logger(const std::string& logger_name, 36 | sink_ptr single_sink, 37 | size_t queue_size, 38 | const async_overflow_policy overflow_policy, 39 | const std::function& worker_warmup_cb, 40 | const std::chrono::milliseconds& flush_interval_ms) : 41 | async_logger(logger_name, 42 | { 43 | single_sink 44 | }, queue_size, overflow_policy, worker_warmup_cb, flush_interval_ms) {} 45 | 46 | 47 | inline void spdlog::async_logger::flush() 48 | { 49 | 50 | _async_log_helper->flush(); 51 | } 52 | 53 | inline void spdlog::async_logger::_set_formatter(spdlog::formatter_ptr msg_formatter) 54 | { 55 | _formatter = msg_formatter; 56 | _async_log_helper->set_formatter(_formatter); 57 | } 58 | 59 | inline void spdlog::async_logger::_set_pattern(const std::string& pattern) 60 | { 61 | _formatter = std::make_shared(pattern); 62 | _async_log_helper->set_formatter(_formatter); 63 | } 64 | 65 | 66 | inline void spdlog::async_logger::_log_msg(details::log_msg& msg) 67 | { 68 | _async_log_helper->log(msg); 69 | } 70 | -------------------------------------------------------------------------------- /include/spdlog/details/file_helper.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright(c) 2015 Gabi Melman. 3 | // Distributed under the MIT License (http://opensource.org/licenses/MIT) 4 | // 5 | 6 | #pragma once 7 | 8 | // Helper class for file sink 9 | // When failing to open a file, retry several times(5) with small delay between the tries(10 ms) 10 | // Can be set to auto flush on every line 11 | // Throw spdlog_ex exception on errors 12 | 13 | #include 14 | #include 15 | #include 16 | #include "os.h" 17 | 18 | 19 | 20 | 21 | namespace spdlog 22 | { 23 | namespace details 24 | { 25 | 26 | class file_helper 27 | { 28 | public: 29 | const int open_tries = 5; 30 | const int open_interval = 10; 31 | 32 | explicit file_helper(bool force_flush) : 33 | _fd(nullptr), 34 | _force_flush(force_flush) 35 | {} 36 | 37 | file_helper(const file_helper&) = delete; 38 | file_helper& operator=(const file_helper&) = delete; 39 | 40 | ~file_helper() 41 | { 42 | close(); 43 | } 44 | 45 | 46 | void open(const std::string& fname, bool truncate = false) 47 | { 48 | 49 | close(); 50 | const char* mode = truncate ? "wb" : "ab"; 51 | _filename = fname; 52 | for (int tries = 0; tries < open_tries; ++tries) 53 | { 54 | if (!os::fopen_s(&_fd, fname, mode)) 55 | return; 56 | 57 | std::this_thread::sleep_for(std::chrono::milliseconds(open_interval)); 58 | } 59 | 60 | throw spdlog_ex("Failed opening file " + fname + " for writing"); 61 | } 62 | 63 | void reopen(bool truncate) 64 | { 65 | if (_filename.empty()) 66 | throw spdlog_ex("Failed re opening file - was not opened before"); 67 | open(_filename, truncate); 68 | 69 | } 70 | 71 | void flush() 72 | { 73 | std::fflush(_fd); 74 | } 75 | 76 | void close() 77 | { 78 | if (_fd) 79 | { 80 | std::fclose(_fd); 81 | _fd = nullptr; 82 | } 83 | } 84 | 85 | void write(const log_msg& msg) 86 | { 87 | 88 | size_t msg_size = msg.formatted.size(); 89 | auto data = msg.formatted.data(); 90 | if (std::fwrite(data, 1, msg_size, _fd) != msg_size) 91 | throw spdlog_ex("Failed writing to file " + _filename); 92 | 93 | if (_force_flush) 94 | std::fflush(_fd); 95 | 96 | } 97 | 98 | long size() 99 | { 100 | if (!_fd) 101 | throw spdlog_ex("Cannot use size() on closed file " + _filename); 102 | 103 | auto pos = ftell(_fd); 104 | if (fseek(_fd, 0, SEEK_END) != 0) 105 | throw spdlog_ex("fseek failed on file " + _filename); 106 | 107 | auto file_size = ftell(_fd); 108 | 109 | if(fseek(_fd, pos, SEEK_SET) !=0) 110 | throw spdlog_ex("fseek failed on file " + _filename); 111 | 112 | if (file_size == -1) 113 | throw spdlog_ex("ftell failed on file " + _filename); 114 | 115 | 116 | return file_size; 117 | 118 | 119 | } 120 | 121 | const std::string& filename() const 122 | { 123 | return _filename; 124 | } 125 | 126 | static bool file_exists(const std::string& name) 127 | { 128 | FILE* file; 129 | if (!os::fopen_s(&file, name.c_str(), "r")) 130 | { 131 | fclose(file); 132 | return true; 133 | } 134 | else 135 | { 136 | return false; 137 | } 138 | } 139 | 140 | 141 | 142 | private: 143 | FILE* _fd; 144 | std::string _filename; 145 | bool _force_flush; 146 | 147 | 148 | }; 149 | } 150 | } 151 | -------------------------------------------------------------------------------- /include/spdlog/details/log_msg.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright(c) 2015 Gabi Melman. 3 | // Distributed under the MIT License (http://opensource.org/licenses/MIT) 4 | // 5 | 6 | #pragma once 7 | 8 | #include 9 | #include "../common.h" 10 | #include "./format.h" 11 | 12 | namespace spdlog 13 | { 14 | namespace details 15 | { 16 | struct log_msg 17 | { 18 | log_msg() = default; 19 | log_msg(level::level_enum l): 20 | logger_name(), 21 | level(l), 22 | raw(), 23 | formatted() {} 24 | 25 | 26 | log_msg(const log_msg& other) : 27 | logger_name(other.logger_name), 28 | level(other.level), 29 | time(other.time), 30 | thread_id(other.thread_id) 31 | { 32 | if (other.raw.size()) 33 | raw << fmt::BasicStringRef(other.raw.data(), other.raw.size()); 34 | if (other.formatted.size()) 35 | formatted << fmt::BasicStringRef(other.formatted.data(), other.formatted.size()); 36 | } 37 | 38 | log_msg(log_msg&& other) : 39 | logger_name(std::move(other.logger_name)), 40 | level(other.level), 41 | time(std::move(other.time)), 42 | thread_id(other.thread_id), 43 | raw(std::move(other.raw)), 44 | formatted(std::move(other.formatted)) 45 | { 46 | other.clear(); 47 | } 48 | 49 | log_msg& operator=(log_msg&& other) 50 | { 51 | if (this == &other) 52 | return *this; 53 | 54 | logger_name = std::move(other.logger_name); 55 | level = other.level; 56 | time = std::move(other.time); 57 | thread_id = other.thread_id; 58 | raw = std::move(other.raw); 59 | formatted = std::move(other.formatted); 60 | other.clear(); 61 | return *this; 62 | } 63 | 64 | void clear() 65 | { 66 | level = level::off; 67 | raw.clear(); 68 | formatted.clear(); 69 | } 70 | 71 | std::string logger_name; 72 | level::level_enum level; 73 | log_clock::time_point time; 74 | size_t thread_id; 75 | fmt::MemoryWriter raw; 76 | fmt::MemoryWriter formatted; 77 | }; 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /include/spdlog/details/null_mutex.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright(c) 2015 Gabi Melman. 3 | // Distributed under the MIT License (http://opensource.org/licenses/MIT) 4 | // 5 | 6 | #pragma once 7 | 8 | // null, no cost mutex 9 | 10 | namespace spdlog 11 | { 12 | namespace details 13 | { 14 | struct null_mutex 15 | { 16 | void lock() {} 17 | void unlock() {} 18 | bool try_lock() 19 | { 20 | return true; 21 | } 22 | }; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /include/spdlog/formatter.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright(c) 2015 Gabi Melman. 3 | // Distributed under the MIT License (http://opensource.org/licenses/MIT) 4 | // 5 | 6 | #pragma once 7 | 8 | #include "details/log_msg.h" 9 | namespace spdlog 10 | { 11 | namespace details 12 | { 13 | class flag_formatter; 14 | } 15 | 16 | class formatter 17 | { 18 | public: 19 | virtual ~formatter() {} 20 | virtual void format(details::log_msg& msg) = 0; 21 | }; 22 | 23 | class pattern_formatter : public formatter 24 | { 25 | 26 | public: 27 | explicit pattern_formatter(const std::string& pattern); 28 | pattern_formatter(const pattern_formatter&) = delete; 29 | pattern_formatter& operator=(const pattern_formatter&) = delete; 30 | void format(details::log_msg& msg) override; 31 | private: 32 | const std::string _pattern; 33 | std::vector> _formatters; 34 | void handle_flag(char flag); 35 | void compile_pattern(const std::string& pattern); 36 | }; 37 | } 38 | 39 | #include "details/pattern_formatter_impl.h" 40 | 41 | -------------------------------------------------------------------------------- /include/spdlog/sinks/base_sink.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright(c) 2015 Gabi Melman. 3 | // Distributed under the MIT License (http://opensource.org/licenses/MIT) 4 | // 5 | 6 | #pragma once 7 | // 8 | // base sink templated over a mutex (either dummy or realy) 9 | // concrete implementation should only overrid the _sink_it method. 10 | // all locking is taken care of here so no locking needed by the implementors.. 11 | // 12 | 13 | #include 14 | #include 15 | #include 16 | #include "./sink.h" 17 | #include "../formatter.h" 18 | #include "../common.h" 19 | #include "../details/log_msg.h" 20 | 21 | 22 | namespace spdlog 23 | { 24 | namespace sinks 25 | { 26 | template 27 | class base_sink:public sink 28 | { 29 | public: 30 | base_sink():_mutex() {} 31 | virtual ~base_sink() = default; 32 | 33 | base_sink(const base_sink&) = delete; 34 | base_sink& operator=(const base_sink&) = delete; 35 | 36 | void log(const details::log_msg& msg) override 37 | { 38 | std::lock_guard lock(_mutex); 39 | _sink_it(msg); 40 | } 41 | 42 | protected: 43 | virtual void _sink_it(const details::log_msg& msg) = 0; 44 | Mutex _mutex; 45 | }; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /include/spdlog/sinks/null_sink.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright(c) 2015 Gabi Melman. 3 | // Distributed under the MIT License (http://opensource.org/licenses/MIT) 4 | // 5 | 6 | #pragma once 7 | #include 8 | #include "./base_sink.h" 9 | #include "../details/null_mutex.h" 10 | 11 | 12 | namespace spdlog 13 | { 14 | namespace sinks 15 | { 16 | 17 | template 18 | class null_sink : public base_sink < Mutex > 19 | { 20 | protected: 21 | void _sink_it(const details::log_msg&) override 22 | {} 23 | 24 | void flush() override 25 | {} 26 | 27 | }; 28 | typedef null_sink null_sink_st; 29 | typedef null_sink null_sink_mt; 30 | 31 | } 32 | } 33 | 34 | -------------------------------------------------------------------------------- /include/spdlog/sinks/ostream_sink.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright(c) 2015 Gabi Melman. 3 | // Distributed under the MIT License (http://opensource.org/licenses/MIT) 4 | // 5 | 6 | #pragma once 7 | 8 | #include 9 | #include 10 | #include 11 | 12 | #include "../details/null_mutex.h" 13 | #include "./base_sink.h" 14 | 15 | namespace spdlog 16 | { 17 | namespace sinks 18 | { 19 | template 20 | class ostream_sink: public base_sink 21 | { 22 | public: 23 | explicit ostream_sink(std::ostream& os, bool force_flush=false) :_ostream(os), _force_flush(force_flush) {} 24 | ostream_sink(const ostream_sink&) = delete; 25 | ostream_sink& operator=(const ostream_sink&) = delete; 26 | virtual ~ostream_sink() = default; 27 | 28 | protected: 29 | void _sink_it(const details::log_msg& msg) override 30 | { 31 | _ostream.write(msg.formatted.data(), msg.formatted.size()); 32 | if (_force_flush) 33 | _ostream.flush(); 34 | } 35 | 36 | void flush() override 37 | { 38 | _ostream.flush(); 39 | } 40 | 41 | std::ostream& _ostream; 42 | bool _force_flush; 43 | }; 44 | 45 | typedef ostream_sink ostream_sink_mt; 46 | typedef ostream_sink ostream_sink_st; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /include/spdlog/sinks/sink.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright(c) 2015 Gabi Melman. 3 | // Distributed under the MIT License (http://opensource.org/licenses/MIT) 4 | // 5 | 6 | 7 | #pragma once 8 | 9 | #include "../details/log_msg.h" 10 | 11 | namespace spdlog 12 | { 13 | namespace sinks 14 | { 15 | class sink 16 | { 17 | public: 18 | virtual ~sink() {} 19 | virtual void log(const details::log_msg& msg) = 0; 20 | virtual void flush() = 0; 21 | }; 22 | } 23 | } 24 | 25 | -------------------------------------------------------------------------------- /include/spdlog/sinks/stdout_sinks.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright(c) 2015 Gabi Melman. 3 | // Distributed under the MIT License (http://opensource.org/licenses/MIT) 4 | // 5 | 6 | #pragma once 7 | 8 | #include 9 | #include 10 | #include "./ostream_sink.h" 11 | #include "../details/null_mutex.h" 12 | 13 | namespace spdlog 14 | { 15 | namespace sinks 16 | { 17 | 18 | template 19 | class stdout_sink : public ostream_sink 20 | { 21 | using MyType = stdout_sink; 22 | public: 23 | stdout_sink() : ostream_sink(std::cout, true) {} 24 | static std::shared_ptr instance() 25 | { 26 | static std::shared_ptr instance = std::make_shared(); 27 | return instance; 28 | } 29 | }; 30 | 31 | typedef stdout_sink stdout_sink_st; 32 | typedef stdout_sink stdout_sink_mt; 33 | 34 | 35 | template 36 | class stderr_sink : public ostream_sink 37 | { 38 | using MyType = stderr_sink; 39 | public: 40 | stderr_sink() : ostream_sink(std::cerr, true) {} 41 | static std::shared_ptr instance() 42 | { 43 | static std::shared_ptr instance = std::make_shared(); 44 | return instance; 45 | } 46 | 47 | }; 48 | 49 | typedef stderr_sink stderr_sink_mt; 50 | typedef stderr_sink stderr_sink_st; 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /include/spdlog/sinks/syslog_sink.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright(c) 2015 Gabi Melman. 3 | // Distributed under the MIT License (http://opensource.org/licenses/MIT) 4 | // 5 | 6 | #pragma once 7 | 8 | #ifdef __linux__ 9 | 10 | #include 11 | #include 12 | #include 13 | 14 | #include "./sink.h" 15 | #include "../common.h" 16 | #include "../details/log_msg.h" 17 | 18 | 19 | namespace spdlog 20 | { 21 | namespace sinks 22 | { 23 | /** 24 | * Sink that write to syslog using the `syscall()` library call. 25 | * 26 | * Locking is not needed, as `syslog()` itself is thread-safe. 27 | */ 28 | class syslog_sink : public sink 29 | { 30 | public: 31 | // 32 | syslog_sink(const std::string& ident = "", int syslog_option=0, int syslog_facility=LOG_USER): 33 | _ident(ident) 34 | { 35 | _priorities[static_cast(level::trace)] = LOG_DEBUG; 36 | _priorities[static_cast(level::debug)] = LOG_DEBUG; 37 | _priorities[static_cast(level::info)] = LOG_INFO; 38 | _priorities[static_cast(level::notice)] = LOG_NOTICE; 39 | _priorities[static_cast(level::warn)] = LOG_WARNING; 40 | _priorities[static_cast(level::err)] = LOG_ERR; 41 | _priorities[static_cast(level::critical)] = LOG_CRIT; 42 | _priorities[static_cast(level::alert)] = LOG_ALERT; 43 | _priorities[static_cast(level::emerg)] = LOG_EMERG; 44 | _priorities[static_cast(level::off)] = LOG_INFO; 45 | 46 | //set ident to be program name if empty 47 | ::openlog(_ident.empty()? nullptr:_ident.c_str(), syslog_option, syslog_facility); 48 | } 49 | ~syslog_sink() 50 | { 51 | ::closelog(); 52 | } 53 | 54 | syslog_sink(const syslog_sink&) = delete; 55 | syslog_sink& operator=(const syslog_sink&) = delete; 56 | 57 | void log(const details::log_msg &msg) override 58 | { 59 | ::syslog(syslog_prio_from_level(msg), "%s", msg.raw.str().c_str()); 60 | } 61 | 62 | void flush() override 63 | { 64 | } 65 | 66 | 67 | private: 68 | std::array _priorities; 69 | //must store the ident because the man says openlog might use the pointer as is and not a string copy 70 | const std::string _ident; 71 | 72 | // 73 | // Simply maps spdlog's log level to syslog priority level. 74 | // 75 | int syslog_prio_from_level(const details::log_msg &msg) const 76 | { 77 | return _priorities[static_cast(msg.level)]; 78 | } 79 | }; 80 | } 81 | } 82 | 83 | #endif 84 | -------------------------------------------------------------------------------- /include/spdlog/tweakme.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright(c) 2015 Gabi Melman. 3 | // Distributed under the MIT License (http://opensource.org/licenses/MIT) 4 | // 5 | 6 | #pragma once 7 | 8 | // 9 | // Edit this file to squeeze every last drop of performance out of spdlog. 10 | // 11 | 12 | /////////////////////////////////////////////////////////////////////////////// 13 | // Under Linux, the much faster CLOCK_REALTIME_COARSE clock can be used. 14 | // This clock is less accurate - can be off by dozens of millis - depending on the kernel HZ. 15 | // Uncomment to use it instead of the regular (but slower) clock. 16 | // #define SPDLOG_CLOCK_COARSE 17 | /////////////////////////////////////////////////////////////////////////////// 18 | 19 | 20 | /////////////////////////////////////////////////////////////////////////////// 21 | // Uncomment if date/time logging is not needed. 22 | // This will prevent spdlog from quering the clock on each log call. 23 | // #define SPDLOG_NO_DATETIME 24 | /////////////////////////////////////////////////////////////////////////////// 25 | 26 | 27 | /////////////////////////////////////////////////////////////////////////////// 28 | // Uncomment if thread id logging is not needed (i.e. no %t in the log pattern). 29 | // This will prevent spdlog from quering the thread id on each log call. 30 | // #define SPDLOG_NO_THREAD_ID 31 | /////////////////////////////////////////////////////////////////////////////// 32 | 33 | 34 | /////////////////////////////////////////////////////////////////////////////// 35 | // Uncomment if logger name logging is not needed. 36 | // This will prevent spdlog from copying the logger name on each log call. 37 | // #define SPDLOG_NO_NAME 38 | /////////////////////////////////////////////////////////////////////////////// 39 | 40 | 41 | /////////////////////////////////////////////////////////////////////////////// 42 | // Uncomment to enable the SPDLOG_DEBUG/SPDLOG_TRACE macros. 43 | // #define SPDLOG_DEBUG_ON 44 | // #define SPDLOG_TRACE_ON 45 | /////////////////////////////////////////////////////////////////////////////// 46 | 47 | 48 | /////////////////////////////////////////////////////////////////////////////// 49 | // Uncomment to avoid locking in the registry operations (spdlog::get(), spdlog::drop() spdlog::register()). 50 | // Use only if your code never modifes concurrently the registry. 51 | // Note that upon creating a logger the registry is modified by spdlog.. 52 | // #define SPDLOG_NO_REGISTRY_MUTEX 53 | /////////////////////////////////////////////////////////////////////////////// 54 | -------------------------------------------------------------------------------- /include/split.h: -------------------------------------------------------------------------------- 1 | #ifndef __SPLIT_H 2 | #define __SPLIT_H 3 | 4 | // functions to split a string by a specific delimiter 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | // thanks to Evan Teran, http://stackoverflow.com/questions/236129/how-to-split-a-string/236803#236803 11 | 12 | // split a string on a single delimiter character (delim) 13 | std::vector& split(const std::string &s, char delim, std::vector &elems); 14 | std::vector split(const std::string &s, char delim); 15 | 16 | // split a string on any character found in the string of delimiters (delims) 17 | std::vector& split(const std::string &s, const std::string& delims, std::vector &elems); 18 | std::vector split(const std::string &s, const std::string& delims); 19 | 20 | // from Marius, http://stackoverflow.com/a/1493195/238609 21 | template < class ContainerT > 22 | void tokenize(const std::string& str, ContainerT& tokens, 23 | const std::string& delimiters = " ", const bool trimEmpty = false) 24 | { 25 | 26 | std::string::size_type pos, lastPos = 0; 27 | while(true) 28 | { 29 | pos = str.find_first_of(delimiters, lastPos); 30 | if(pos == std::string::npos) 31 | { 32 | 33 | pos = str.length(); 34 | 35 | if(pos != lastPos || !trimEmpty) { 36 | tokens.push_back(typename ContainerT::value_type(str.data()+lastPos, (typename ContainerT::value_type::size_type)pos-lastPos)); 37 | } 38 | 39 | break; 40 | } 41 | else 42 | { 43 | if(pos != lastPos || !trimEmpty) { 44 | tokens.push_back(typename ContainerT::value_type(str.data()+lastPos, (typename ContainerT::value_type::size_type)pos-lastPos)); 45 | } 46 | } 47 | 48 | lastPos = pos + 1; 49 | } 50 | }; 51 | 52 | 53 | #endif 54 | -------------------------------------------------------------------------------- /include/tclap/ArgTraits.h: -------------------------------------------------------------------------------- 1 | // -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*- 2 | 3 | /****************************************************************************** 4 | * 5 | * file: ArgTraits.h 6 | * 7 | * Copyright (c) 2007, Daniel Aarno, Michael E. Smoot . 8 | * All rights reverved. 9 | * 10 | * See the file COPYING in the top directory of this distribution for 11 | * more information. 12 | * 13 | * THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS 14 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 16 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 18 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 19 | * DEALINGS IN THE SOFTWARE. 20 | * 21 | *****************************************************************************/ 22 | 23 | // This is an internal tclap file, you should probably not have to 24 | // include this directly 25 | 26 | #ifndef TCLAP_ARGTRAITS_H 27 | #define TCLAP_ARGTRAITS_H 28 | 29 | namespace TCLAP { 30 | 31 | // We use two empty structs to get compile type specialization 32 | // function to work 33 | 34 | /** 35 | * A value like argument value type is a value that can be set using 36 | * operator>>. This is the default value type. 37 | */ 38 | struct ValueLike { 39 | typedef ValueLike ValueCategory; 40 | virtual ~ValueLike() {} 41 | }; 42 | 43 | /** 44 | * A string like argument value type is a value that can be set using 45 | * operator=(string). Usefull if the value type contains spaces which 46 | * will be broken up into individual tokens by operator>>. 47 | */ 48 | struct StringLike { 49 | virtual ~StringLike() {} 50 | }; 51 | 52 | /** 53 | * A class can inherit from this object to make it have string like 54 | * traits. This is a compile time thing and does not add any overhead 55 | * to the inherenting class. 56 | */ 57 | struct StringLikeTrait { 58 | typedef StringLike ValueCategory; 59 | virtual ~StringLikeTrait() {} 60 | }; 61 | 62 | /** 63 | * A class can inherit from this object to make it have value like 64 | * traits. This is a compile time thing and does not add any overhead 65 | * to the inherenting class. 66 | */ 67 | struct ValueLikeTrait { 68 | typedef ValueLike ValueCategory; 69 | virtual ~ValueLikeTrait() {} 70 | }; 71 | 72 | /** 73 | * Arg traits are used to get compile type specialization when parsing 74 | * argument values. Using an ArgTraits you can specify the way that 75 | * values gets assigned to any particular type during parsing. The two 76 | * supported types are StringLike and ValueLike. 77 | */ 78 | template 79 | struct ArgTraits { 80 | typedef typename T::ValueCategory ValueCategory; 81 | virtual ~ArgTraits() {} 82 | //typedef ValueLike ValueCategory; 83 | }; 84 | 85 | #endif 86 | 87 | } // namespace 88 | -------------------------------------------------------------------------------- /include/tclap/CmdLineOutput.h: -------------------------------------------------------------------------------- 1 | 2 | 3 | /****************************************************************************** 4 | * 5 | * file: CmdLineOutput.h 6 | * 7 | * Copyright (c) 2004, Michael E. Smoot 8 | * All rights reverved. 9 | * 10 | * See the file COPYING in the top directory of this distribution for 11 | * more information. 12 | * 13 | * THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS 14 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 16 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 18 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 19 | * DEALINGS IN THE SOFTWARE. 20 | * 21 | *****************************************************************************/ 22 | 23 | #ifndef TCLAP_CMDLINEOUTPUT_H 24 | #define TCLAP_CMDLINEOUTPUT_H 25 | 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | 33 | namespace TCLAP { 34 | 35 | class CmdLineInterface; 36 | class ArgException; 37 | 38 | /** 39 | * The interface that any output object must implement. 40 | */ 41 | class CmdLineOutput 42 | { 43 | 44 | public: 45 | 46 | /** 47 | * Virtual destructor. 48 | */ 49 | virtual ~CmdLineOutput() {} 50 | 51 | /** 52 | * Generates some sort of output for the USAGE. 53 | * \param c - The CmdLine object the output is generated for. 54 | */ 55 | virtual void usage(CmdLineInterface& c)=0; 56 | 57 | /** 58 | * Generates some sort of output for the version. 59 | * \param c - The CmdLine object the output is generated for. 60 | */ 61 | virtual void version(CmdLineInterface& c)=0; 62 | 63 | /** 64 | * Generates some sort of output for a failure. 65 | * \param c - The CmdLine object the output is generated for. 66 | * \param e - The ArgException that caused the failure. 67 | */ 68 | virtual void failure( CmdLineInterface& c, 69 | ArgException& e )=0; 70 | 71 | }; 72 | 73 | } //namespace TCLAP 74 | #endif 75 | -------------------------------------------------------------------------------- /include/tclap/Constraint.h: -------------------------------------------------------------------------------- 1 | 2 | /****************************************************************************** 3 | * 4 | * file: Constraint.h 5 | * 6 | * Copyright (c) 2005, Michael E. Smoot 7 | * All rights reverved. 8 | * 9 | * See the file COPYING in the top directory of this distribution for 10 | * more information. 11 | * 12 | * THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS 13 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 14 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 15 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 16 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 17 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 18 | * DEALINGS IN THE SOFTWARE. 19 | * 20 | *****************************************************************************/ 21 | 22 | #ifndef TCLAP_CONSTRAINT_H 23 | #define TCLAP_CONSTRAINT_H 24 | 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | 32 | namespace TCLAP { 33 | 34 | /** 35 | * The interface that defines the interaction between the Arg and Constraint. 36 | */ 37 | template 38 | class Constraint 39 | { 40 | 41 | public: 42 | /** 43 | * Returns a description of the Constraint. 44 | */ 45 | virtual std::string description() const =0; 46 | 47 | /** 48 | * Returns the short ID for the Constraint. 49 | */ 50 | virtual std::string shortID() const =0; 51 | 52 | /** 53 | * The method used to verify that the value parsed from the command 54 | * line meets the constraint. 55 | * \param value - The value that will be checked. 56 | */ 57 | virtual bool check(const T& value) const =0; 58 | 59 | /** 60 | * Destructor. 61 | * Silences warnings about Constraint being a base class with virtual 62 | * functions but without a virtual destructor. 63 | */ 64 | virtual ~Constraint() { ; } 65 | }; 66 | 67 | } //namespace TCLAP 68 | #endif 69 | -------------------------------------------------------------------------------- /include/tclap/HelpVisitor.h: -------------------------------------------------------------------------------- 1 | 2 | /****************************************************************************** 3 | * 4 | * file: HelpVisitor.h 5 | * 6 | * Copyright (c) 2003, Michael E. Smoot . 7 | * All rights reverved. 8 | * 9 | * See the file COPYING in the top directory of this distribution for 10 | * more information. 11 | * 12 | * THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS 13 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 14 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 15 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 16 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 17 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 18 | * DEALINGS IN THE SOFTWARE. 19 | * 20 | *****************************************************************************/ 21 | 22 | #ifndef TCLAP_HELP_VISITOR_H 23 | #define TCLAP_HELP_VISITOR_H 24 | 25 | #include 26 | #include 27 | #include 28 | 29 | namespace TCLAP { 30 | 31 | /** 32 | * A Visitor object that calls the usage method of the given CmdLineOutput 33 | * object for the specified CmdLine object. 34 | */ 35 | class HelpVisitor: public Visitor 36 | { 37 | private: 38 | /** 39 | * Prevent accidental copying. 40 | */ 41 | HelpVisitor(const HelpVisitor& rhs); 42 | HelpVisitor& operator=(const HelpVisitor& rhs); 43 | 44 | protected: 45 | 46 | /** 47 | * The CmdLine the output will be generated for. 48 | */ 49 | CmdLineInterface* _cmd; 50 | 51 | /** 52 | * The output object. 53 | */ 54 | CmdLineOutput** _out; 55 | 56 | public: 57 | 58 | /** 59 | * Constructor. 60 | * \param cmd - The CmdLine the output will be generated for. 61 | * \param out - The type of output. 62 | */ 63 | HelpVisitor(CmdLineInterface* cmd, CmdLineOutput** out) 64 | : Visitor(), _cmd( cmd ), _out( out ) { } 65 | 66 | /** 67 | * Calls the usage method of the CmdLineOutput for the 68 | * specified CmdLine. 69 | */ 70 | void visit() { (*_out)->usage(*_cmd); throw ExitException(0); } 71 | 72 | }; 73 | 74 | } 75 | 76 | #endif 77 | -------------------------------------------------------------------------------- /include/tclap/IgnoreRestVisitor.h: -------------------------------------------------------------------------------- 1 | 2 | /****************************************************************************** 3 | * 4 | * file: IgnoreRestVisitor.h 5 | * 6 | * Copyright (c) 2003, Michael E. Smoot . 7 | * All rights reverved. 8 | * 9 | * See the file COPYING in the top directory of this distribution for 10 | * more information. 11 | * 12 | * THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS 13 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 14 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 15 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 16 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 17 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 18 | * DEALINGS IN THE SOFTWARE. 19 | * 20 | *****************************************************************************/ 21 | 22 | 23 | #ifndef TCLAP_IGNORE_REST_VISITOR_H 24 | #define TCLAP_IGNORE_REST_VISITOR_H 25 | 26 | #include 27 | #include 28 | 29 | namespace TCLAP { 30 | 31 | /** 32 | * A Vistor that tells the CmdLine to begin ignoring arguments after 33 | * this one is parsed. 34 | */ 35 | class IgnoreRestVisitor: public Visitor 36 | { 37 | public: 38 | 39 | /** 40 | * Constructor. 41 | */ 42 | IgnoreRestVisitor() : Visitor() {} 43 | 44 | /** 45 | * Sets Arg::_ignoreRest. 46 | */ 47 | void visit() { Arg::beginIgnoring(); } 48 | }; 49 | 50 | } 51 | 52 | #endif 53 | -------------------------------------------------------------------------------- /include/tclap/Makefile.am: -------------------------------------------------------------------------------- 1 | 2 | libtclapincludedir = $(includedir)/tclap 3 | 4 | libtclapinclude_HEADERS = \ 5 | CmdLineInterface.h \ 6 | ArgException.h \ 7 | CmdLine.h \ 8 | XorHandler.h \ 9 | MultiArg.h \ 10 | UnlabeledMultiArg.h \ 11 | ValueArg.h \ 12 | UnlabeledValueArg.h \ 13 | Visitor.h Arg.h \ 14 | HelpVisitor.h \ 15 | SwitchArg.h \ 16 | MultiSwitchArg.h \ 17 | VersionVisitor.h \ 18 | IgnoreRestVisitor.h \ 19 | CmdLineOutput.h \ 20 | StdOutput.h \ 21 | DocBookOutput.h \ 22 | ZshCompletionOutput.h \ 23 | OptionalUnlabeledTracker.h \ 24 | Constraint.h \ 25 | ValuesConstraint.h \ 26 | ArgTraits.h \ 27 | StandardTraits.h 28 | 29 | -------------------------------------------------------------------------------- /include/tclap/OptionalUnlabeledTracker.h: -------------------------------------------------------------------------------- 1 | 2 | 3 | /****************************************************************************** 4 | * 5 | * file: OptionalUnlabeledTracker.h 6 | * 7 | * Copyright (c) 2005, Michael E. Smoot . 8 | * All rights reverved. 9 | * 10 | * See the file COPYING in the top directory of this distribution for 11 | * more information. 12 | * 13 | * THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS 14 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 16 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 18 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 19 | * DEALINGS IN THE SOFTWARE. 20 | * 21 | *****************************************************************************/ 22 | 23 | 24 | #ifndef TCLAP_OPTIONAL_UNLABELED_TRACKER_H 25 | #define TCLAP_OPTIONAL_UNLABELED_TRACKER_H 26 | 27 | #include 28 | 29 | namespace TCLAP { 30 | 31 | class OptionalUnlabeledTracker 32 | { 33 | 34 | public: 35 | 36 | static void check( bool req, const std::string& argName ); 37 | 38 | static void gotOptional() { alreadyOptionalRef() = true; } 39 | 40 | static bool& alreadyOptional() { return alreadyOptionalRef(); } 41 | 42 | private: 43 | 44 | static bool& alreadyOptionalRef() { static bool ct = false; return ct; } 45 | }; 46 | 47 | 48 | inline void OptionalUnlabeledTracker::check( bool req, const std::string& argName ) 49 | { 50 | if ( OptionalUnlabeledTracker::alreadyOptional() ) 51 | throw( SpecificationException( 52 | "You can't specify ANY Unlabeled Arg following an optional Unlabeled Arg", 53 | argName ) ); 54 | 55 | if ( !req ) 56 | OptionalUnlabeledTracker::gotOptional(); 57 | } 58 | 59 | 60 | } // namespace TCLAP 61 | 62 | #endif 63 | -------------------------------------------------------------------------------- /include/tclap/VersionVisitor.h: -------------------------------------------------------------------------------- 1 | // -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*- 2 | 3 | /****************************************************************************** 4 | * 5 | * file: VersionVisitor.h 6 | * 7 | * Copyright (c) 2003, Michael E. Smoot . 8 | * All rights reverved. 9 | * 10 | * See the file COPYING in the top directory of this distribution for 11 | * more information. 12 | * 13 | * THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS 14 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 16 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 18 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 19 | * DEALINGS IN THE SOFTWARE. 20 | * 21 | *****************************************************************************/ 22 | 23 | 24 | #ifndef TCLAP_VERSION_VISITOR_H 25 | #define TCLAP_VERSION_VISITOR_H 26 | 27 | #include 28 | #include 29 | #include 30 | 31 | namespace TCLAP { 32 | 33 | /** 34 | * A Vistor that will call the version method of the given CmdLineOutput 35 | * for the specified CmdLine object and then exit. 36 | */ 37 | class VersionVisitor: public Visitor 38 | { 39 | private: 40 | /** 41 | * Prevent accidental copying 42 | */ 43 | VersionVisitor(const VersionVisitor& rhs); 44 | VersionVisitor& operator=(const VersionVisitor& rhs); 45 | 46 | protected: 47 | 48 | /** 49 | * The CmdLine of interest. 50 | */ 51 | CmdLineInterface* _cmd; 52 | 53 | /** 54 | * The output object. 55 | */ 56 | CmdLineOutput** _out; 57 | 58 | public: 59 | 60 | /** 61 | * Constructor. 62 | * \param cmd - The CmdLine the output is generated for. 63 | * \param out - The type of output. 64 | */ 65 | VersionVisitor( CmdLineInterface* cmd, CmdLineOutput** out ) 66 | : Visitor(), _cmd( cmd ), _out( out ) { } 67 | 68 | /** 69 | * Calls the version method of the output object using the 70 | * specified CmdLine. 71 | */ 72 | void visit() { 73 | (*_out)->version(*_cmd); 74 | throw ExitException(0); 75 | } 76 | 77 | }; 78 | 79 | } 80 | 81 | #endif 82 | -------------------------------------------------------------------------------- /include/tclap/Visitor.h: -------------------------------------------------------------------------------- 1 | 2 | /****************************************************************************** 3 | * 4 | * file: Visitor.h 5 | * 6 | * Copyright (c) 2003, Michael E. Smoot . 7 | * All rights reverved. 8 | * 9 | * See the file COPYING in the top directory of this distribution for 10 | * more information. 11 | * 12 | * THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS 13 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 14 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 15 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 16 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 17 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 18 | * DEALINGS IN THE SOFTWARE. 19 | * 20 | *****************************************************************************/ 21 | 22 | 23 | #ifndef TCLAP_VISITOR_H 24 | #define TCLAP_VISITOR_H 25 | 26 | namespace TCLAP { 27 | 28 | /** 29 | * A base class that defines the interface for visitors. 30 | */ 31 | class Visitor 32 | { 33 | public: 34 | 35 | /** 36 | * Constructor. Does nothing. 37 | */ 38 | Visitor() { } 39 | 40 | /** 41 | * Destructor. Does nothing. 42 | */ 43 | virtual ~Visitor() { } 44 | 45 | /** 46 | * Does nothing. Should be overridden by child. 47 | */ 48 | virtual void visit() { } 49 | }; 50 | 51 | } 52 | 53 | #endif 54 | -------------------------------------------------------------------------------- /include/utils.hpp: -------------------------------------------------------------------------------- 1 | #ifndef UTILS_H 2 | #define UTILS_H 3 | 4 | #include 5 | #include 6 | 7 | #include 8 | #include 9 | #include 10 | 11 | enum class InferenceType : uint8_t { 12 | BEST_GENOTYPE, ALL_GENOTYPES 13 | }; 14 | 15 | enum class LikelihoodFormat : uint8_t { 16 | RAW, LOG, PHRED 17 | }; 18 | 19 | struct StringItPair { 20 | StringItPair(std::string::iterator b, std::string::iterator e) : 21 | begin(b), end(e) {} 22 | StringItPair(StringItPair&& ) = default; 23 | StringItPair(const StringItPair& ) = default; 24 | std::string::iterator begin; 25 | std::string::iterator end; 26 | }; 27 | 28 | std::vector split(std::string &, char); 29 | std::vector split_it(std::string &, char); 30 | std::vector split_it(StringItPair&, char); 31 | void print_time_elapsed(std::string, struct timeval*, struct timeval*); 32 | 33 | 34 | #endif 35 | -------------------------------------------------------------------------------- /src/split.cpp: -------------------------------------------------------------------------------- 1 | #include "split.h" 2 | 3 | 4 | std::vector &split(const std::string &s, char delim, std::vector &elems) { 5 | std::string delims = std::string(1, delim); 6 | tokenize(s, elems, delims); 7 | return elems; 8 | } 9 | 10 | std::vector split(const std::string &s, char delim) { 11 | std::vector elems; 12 | return split(s, delim, elems); 13 | } 14 | 15 | std::vector &split(const std::string &s, const std::string& delims, std::vector &elems) { 16 | tokenize(s, elems, delims); 17 | return elems; 18 | } 19 | 20 | std::vector split(const std::string &s, const std::string& delims) { 21 | std::vector elems; 22 | return split(s, delims, elems); 23 | } 24 | -------------------------------------------------------------------------------- /src_python/SNPbam2vcf/Readme.md: -------------------------------------------------------------------------------- 1 | Readme for SNPbam2vcf.py 2 | ======================== 3 | 4 | * This python script takes a list of bamfiles and performs variant calling such that the output is in the format required for lcMLkin to calculate pairwise relatedness. 5 | 6 | * Please note it is slow, and is only designed for calling genotypes for specific SNPs in smallish numbers (tens to hundreds) of individuals. I do not recommend using this as a general variant caller. 7 | 8 | * We are working on a better version (this was an experimental one developed to test lcMLkin), but for now, if using 100 samples with 100K loci with 20x mean coverage, this takes about 4 hours on one processor. Lower coverage datasets, which is what lcMLkin is designed for, will be quicker though, maybe just over an hour. 9 | 10 | * [Pysam](http://pysam.readthedocs.org/en/latest/) and [Numpy](http://www.numpy.org/) must be installed in the version of python used. 11 | 12 | * Bam files must be indexed. 13 | 14 | * The SNP file must have the tab separated fields in the following order: chromosome, position (one-based co-ordinates), reference allele, alternate allele. 15 | 16 | * If you want to change things like mapping and base quality threshold, edit the python code under the section "Input arguments". 17 | 18 | * Written (poorly) by Krishna Veeramah 19 | 20 | General usage is: 21 | ``` 22 | ./SNPbam2vcf.py 23 | ``` 24 | 25 | 26 | Using the example files provided (data is in `data/SNPbam2vcf_data/`), it would be run using the following command line: 27 | ``` 28 | ./SNPbam2vcf.py bam.list out_play.vcf SNP.list 29 | ``` 30 | -------------------------------------------------------------------------------- /validationScripts/ValidateCoefficients.py: -------------------------------------------------------------------------------- 1 | import pandas as pd 2 | import argparse 3 | import matplotlib.pyplot as plt 4 | import seaborn as sns 5 | import numpy as np 6 | 7 | def main(args): 8 | trueCoeffs = pd.read_table(args.trueCoeffs, sep=',') 9 | 10 | def joinNames(X, suff=''): 11 | return "{}-{}".format(X['IID1'+suff], X['IID2'+suff]) 12 | 13 | trueCoeffs[['IID1', 'IID2']] = trueCoeffs[['IID1', 'IID2']].astype(str) 14 | trueCoeffs['key'] = trueCoeffs.apply(joinNames, axis=1) 15 | trueCoeffs.set_index('key', inplace=True) 16 | 17 | estCoeffs = pd.read_table(args.estCoeffs, sep='\t', 18 | skiprows=1, 19 | names=['IID1Est', 'IID2Est',\ 20 | 'k0_hat', 'k1_hat', 'k2_hat',\ 21 | 'Estimated Kinship Coefficient',\ 22 | 'nbSNP']) 23 | 24 | estCoeffs[['IID1Est', 'IID2Est']] = estCoeffs[['IID1Est', 'IID2Est']].astype(str) 25 | estCoeffs['IID1Est'] = [ r[1]['IID1Est'].split('_')[1] for r in estCoeffs.iterrows() ] 26 | estCoeffs['IID2Est'] = [ r[1]['IID2Est'].split('_')[1] for r in estCoeffs.iterrows() ] 27 | def joinNamesEst(X): 28 | return joinNames(X, suff='Est') 29 | 30 | estCoeffs['key'] = estCoeffs.apply(joinNamesEst, axis=1) 31 | estCoeffs.set_index('key', inplace=True) 32 | jointCoeffs = trueCoeffs.join(estCoeffs) 33 | 34 | 35 | x = jointCoeffs['Expected Kinship Coefficient'] 36 | y = jointCoeffs['Estimated Kinship Coefficient'] 37 | 38 | print("pearson correlation = {}".format( 39 | jointCoeffs['Expected Kinship Coefficient'].corr( 40 | jointCoeffs['Estimated Kinship Coefficient'], 'pearson'))) 41 | 42 | print("spearman correlation = {}".format( 43 | jointCoeffs['Expected Kinship Coefficient'].corr( 44 | jointCoeffs['Estimated Kinship Coefficient'], 'spearman'))) 45 | 46 | rmse = np.sqrt(np.mean((np.array(x.values) - y.values)**2)) 47 | print("RMSE = {}".format(rmse)) 48 | 49 | sns.set_context('poster') 50 | sns.set_style('whitegrid') 51 | plt.scatter(jointCoeffs['Expected Kinship Coefficient'].values, 52 | jointCoeffs['Estimated Kinship Coefficient'].values) 53 | plt.xlabel("Expected Kinship Coefficients") 54 | plt.ylabel("Estimated Kinship Coefficients") 55 | sns.despine() 56 | plt.show() 57 | pass 58 | 59 | if __name__ == "__main__": 60 | parser = argparse.ArgumentParser(description="Validator") 61 | parser.add_argument('--trueCoeffs', help="file with true coefficients", 62 | type=argparse.FileType('r')) 63 | parser.add_argument('--estCoeffs', help="file with estimated coefficients", 64 | type=argparse.FileType('r')) 65 | 66 | main(parser.parse_args()) 67 | --------------------------------------------------------------------------------