├── .gitignore ├── .travis.yml ├── LICENSE ├── Makefile ├── MoS2_00_00_00_i.vasp ├── MoS2_00_00_00_r.vasp ├── README.md ├── Si_00_00_00_i.vasp ├── Si_00_00_00_r.vasp ├── compile_commands.json ├── include ├── Eigen │ ├── CMakeLists.txt │ ├── Cholesky │ ├── CholmodSupport │ ├── Core │ ├── Dense │ ├── Eigen │ ├── Eigenvalues │ ├── Geometry │ ├── Householder │ ├── IterativeLinearSolvers │ ├── Jacobi │ ├── KLUSupport │ ├── LU │ ├── MetisSupport │ ├── OrderingMethods │ ├── PaStiXSupport │ ├── PardisoSupport │ ├── QR │ ├── QtAlignedMalloc │ ├── SPQRSupport │ ├── SVD │ ├── Sparse │ ├── SparseCholesky │ ├── SparseCore │ ├── SparseLU │ ├── SparseQR │ ├── StdDeque │ ├── StdList │ ├── StdVector │ ├── SuperLUSupport │ ├── UmfPackSupport │ └── src │ │ ├── Cholesky │ │ ├── LDLT.h │ │ ├── LLT.h │ │ └── LLT_LAPACKE.h │ │ ├── CholmodSupport │ │ └── CholmodSupport.h │ │ ├── Core │ │ ├── ArithmeticSequence.h │ │ ├── Array.h │ │ ├── ArrayBase.h │ │ ├── ArrayWrapper.h │ │ ├── Assign.h │ │ ├── AssignEvaluator.h │ │ ├── Assign_MKL.h │ │ ├── BandMatrix.h │ │ ├── Block.h │ │ ├── BooleanRedux.h │ │ ├── CommaInitializer.h │ │ ├── ConditionEstimator.h │ │ ├── CoreEvaluators.h │ │ ├── CoreIterators.h │ │ ├── CwiseBinaryOp.h │ │ ├── CwiseNullaryOp.h │ │ ├── CwiseTernaryOp.h │ │ ├── CwiseUnaryOp.h │ │ ├── CwiseUnaryView.h │ │ ├── DenseBase.h │ │ ├── DenseCoeffsBase.h │ │ ├── DenseStorage.h │ │ ├── Diagonal.h │ │ ├── DiagonalMatrix.h │ │ ├── DiagonalProduct.h │ │ ├── Dot.h │ │ ├── EigenBase.h │ │ ├── ForceAlignedAccess.h │ │ ├── Fuzzy.h │ │ ├── GeneralProduct.h │ │ ├── GenericPacketMath.h │ │ ├── GlobalFunctions.h │ │ ├── IO.h │ │ ├── IndexedView.h │ │ ├── Inverse.h │ │ ├── Map.h │ │ ├── MapBase.h │ │ ├── MathFunctions.h │ │ ├── MathFunctionsImpl.h │ │ ├── Matrix.h │ │ ├── MatrixBase.h │ │ ├── NestByValue.h │ │ ├── NoAlias.h │ │ ├── NumTraits.h │ │ ├── PartialReduxEvaluator.h │ │ ├── PermutationMatrix.h │ │ ├── PlainObjectBase.h │ │ ├── Product.h │ │ ├── ProductEvaluators.h │ │ ├── Random.h │ │ ├── Redux.h │ │ ├── Ref.h │ │ ├── Replicate.h │ │ ├── Reshaped.h │ │ ├── ReturnByValue.h │ │ ├── Reverse.h │ │ ├── Select.h │ │ ├── SelfAdjointView.h │ │ ├── SelfCwiseBinaryOp.h │ │ ├── Solve.h │ │ ├── SolveTriangular.h │ │ ├── SolverBase.h │ │ ├── StableNorm.h │ │ ├── StlIterators.h │ │ ├── Stride.h │ │ ├── Swap.h │ │ ├── Transpose.h │ │ ├── Transpositions.h │ │ ├── TriangularMatrix.h │ │ ├── VectorBlock.h │ │ ├── VectorwiseOp.h │ │ ├── Visitor.h │ │ ├── arch │ │ │ ├── AVX │ │ │ │ ├── Complex.h │ │ │ │ ├── MathFunctions.h │ │ │ │ ├── PacketMath.h │ │ │ │ └── TypeCasting.h │ │ │ ├── AVX512 │ │ │ │ ├── MathFunctions.h │ │ │ │ └── PacketMath.h │ │ │ ├── AltiVec │ │ │ │ ├── Complex.h │ │ │ │ ├── MathFunctions.h │ │ │ │ └── PacketMath.h │ │ │ ├── CUDA │ │ │ │ └── Complex.h │ │ │ ├── Default │ │ │ │ ├── ConjHelper.h │ │ │ │ ├── GenericPacketMathFunctions.h │ │ │ │ └── Settings.h │ │ │ ├── GPU │ │ │ │ ├── Half.h │ │ │ │ ├── MathFunctions.h │ │ │ │ ├── PacketMath.h │ │ │ │ ├── PacketMathHalf.h │ │ │ │ └── TypeCasting.h │ │ │ ├── HIP │ │ │ │ └── hcc │ │ │ │ │ └── math_constants.h │ │ │ ├── MSA │ │ │ │ ├── Complex.h │ │ │ │ ├── MathFunctions.h │ │ │ │ └── PacketMath.h │ │ │ ├── NEON │ │ │ │ ├── Complex.h │ │ │ │ ├── MathFunctions.h │ │ │ │ ├── PacketMath.h │ │ │ │ └── TypeCasting.h │ │ │ ├── SSE │ │ │ │ ├── Complex.h │ │ │ │ ├── MathFunctions.h │ │ │ │ ├── PacketMath.h │ │ │ │ └── TypeCasting.h │ │ │ ├── SYCL │ │ │ │ ├── InteropHeaders.h │ │ │ │ ├── MathFunctions.h │ │ │ │ ├── PacketMath.h │ │ │ │ └── TypeCasting.h │ │ │ └── ZVector │ │ │ │ ├── Complex.h │ │ │ │ ├── MathFunctions.h │ │ │ │ └── PacketMath.h │ │ ├── functors │ │ │ ├── AssignmentFunctors.h │ │ │ ├── BinaryFunctors.h │ │ │ ├── NullaryFunctors.h │ │ │ ├── StlFunctors.h │ │ │ ├── TernaryFunctors.h │ │ │ └── UnaryFunctors.h │ │ ├── products │ │ │ ├── GeneralBlockPanelKernel.h │ │ │ ├── GeneralMatrixMatrix.h │ │ │ ├── GeneralMatrixMatrixTriangular.h │ │ │ ├── GeneralMatrixMatrixTriangular_BLAS.h │ │ │ ├── GeneralMatrixMatrix_BLAS.h │ │ │ ├── GeneralMatrixVector.h │ │ │ ├── GeneralMatrixVector_BLAS.h │ │ │ ├── Parallelizer.h │ │ │ ├── SelfadjointMatrixMatrix.h │ │ │ ├── SelfadjointMatrixMatrix_BLAS.h │ │ │ ├── SelfadjointMatrixVector.h │ │ │ ├── SelfadjointMatrixVector_BLAS.h │ │ │ ├── SelfadjointProduct.h │ │ │ ├── SelfadjointRank2Update.h │ │ │ ├── TriangularMatrixMatrix.h │ │ │ ├── TriangularMatrixMatrix_BLAS.h │ │ │ ├── TriangularMatrixVector.h │ │ │ ├── TriangularMatrixVector_BLAS.h │ │ │ ├── TriangularSolverMatrix.h │ │ │ ├── TriangularSolverMatrix_BLAS.h │ │ │ └── TriangularSolverVector.h │ │ └── util │ │ │ ├── BlasUtil.h │ │ │ ├── ConfigureVectorization.h │ │ │ ├── Constants.h │ │ │ ├── DisableStupidWarnings.h │ │ │ ├── ForwardDeclarations.h │ │ │ ├── IndexedViewHelper.h │ │ │ ├── IntegralConstant.h │ │ │ ├── MKL_support.h │ │ │ ├── Macros.h │ │ │ ├── Memory.h │ │ │ ├── Meta.h │ │ │ ├── NonMPL2.h │ │ │ ├── ReenableStupidWarnings.h │ │ │ ├── ReshapedHelper.h │ │ │ ├── StaticAssert.h │ │ │ ├── SymbolicIndex.h │ │ │ └── XprHelper.h │ │ ├── Eigenvalues │ │ ├── ComplexEigenSolver.h │ │ ├── ComplexSchur.h │ │ ├── ComplexSchur_LAPACKE.h │ │ ├── EigenSolver.h │ │ ├── GeneralizedEigenSolver.h │ │ ├── GeneralizedSelfAdjointEigenSolver.h │ │ ├── HessenbergDecomposition.h │ │ ├── MatrixBaseEigenvalues.h │ │ ├── RealQZ.h │ │ ├── RealSchur.h │ │ ├── RealSchur_LAPACKE.h │ │ ├── SelfAdjointEigenSolver.h │ │ ├── SelfAdjointEigenSolver_LAPACKE.h │ │ └── Tridiagonalization.h │ │ ├── Geometry │ │ ├── AlignedBox.h │ │ ├── AngleAxis.h │ │ ├── EulerAngles.h │ │ ├── Homogeneous.h │ │ ├── Hyperplane.h │ │ ├── OrthoMethods.h │ │ ├── ParametrizedLine.h │ │ ├── Quaternion.h │ │ ├── Rotation2D.h │ │ ├── RotationBase.h │ │ ├── Scaling.h │ │ ├── Transform.h │ │ ├── Translation.h │ │ ├── Umeyama.h │ │ └── arch │ │ │ └── Geometry_SSE.h │ │ ├── Householder │ │ ├── BlockHouseholder.h │ │ ├── Householder.h │ │ └── HouseholderSequence.h │ │ ├── IterativeLinearSolvers │ │ ├── BasicPreconditioners.h │ │ ├── BiCGSTAB.h │ │ ├── ConjugateGradient.h │ │ ├── IncompleteCholesky.h │ │ ├── IncompleteLUT.h │ │ ├── IterativeSolverBase.h │ │ ├── LeastSquareConjugateGradient.h │ │ └── SolveWithGuess.h │ │ ├── Jacobi │ │ └── Jacobi.h │ │ ├── KLUSupport │ │ └── KLUSupport.h │ │ ├── LU │ │ ├── Determinant.h │ │ ├── FullPivLU.h │ │ ├── InverseImpl.h │ │ ├── PartialPivLU.h │ │ ├── PartialPivLU_LAPACKE.h │ │ └── arch │ │ │ └── Inverse_SSE.h │ │ ├── MetisSupport │ │ └── MetisSupport.h │ │ ├── OrderingMethods │ │ ├── Amd.h │ │ ├── Eigen_Colamd.h │ │ └── Ordering.h │ │ ├── PaStiXSupport │ │ └── PaStiXSupport.h │ │ ├── PardisoSupport │ │ └── PardisoSupport.h │ │ ├── QR │ │ ├── ColPivHouseholderQR.h │ │ ├── ColPivHouseholderQR_LAPACKE.h │ │ ├── CompleteOrthogonalDecomposition.h │ │ ├── FullPivHouseholderQR.h │ │ ├── HouseholderQR.h │ │ └── HouseholderQR_LAPACKE.h │ │ ├── SPQRSupport │ │ └── SuiteSparseQRSupport.h │ │ ├── SVD │ │ ├── BDCSVD.h │ │ ├── JacobiSVD.h │ │ ├── JacobiSVD_LAPACKE.h │ │ ├── SVDBase.h │ │ └── UpperBidiagonalization.h │ │ ├── SparseCholesky │ │ ├── SimplicialCholesky.h │ │ └── SimplicialCholesky_impl.h │ │ ├── SparseCore │ │ ├── AmbiVector.h │ │ ├── CompressedStorage.h │ │ ├── ConservativeSparseSparseProduct.h │ │ ├── MappedSparseMatrix.h │ │ ├── SparseAssign.h │ │ ├── SparseBlock.h │ │ ├── SparseColEtree.h │ │ ├── SparseCompressedBase.h │ │ ├── SparseCwiseBinaryOp.h │ │ ├── SparseCwiseUnaryOp.h │ │ ├── SparseDenseProduct.h │ │ ├── SparseDiagonalProduct.h │ │ ├── SparseDot.h │ │ ├── SparseFuzzy.h │ │ ├── SparseMap.h │ │ ├── SparseMatrix.h │ │ ├── SparseMatrixBase.h │ │ ├── SparsePermutation.h │ │ ├── SparseProduct.h │ │ ├── SparseRedux.h │ │ ├── SparseRef.h │ │ ├── SparseSelfAdjointView.h │ │ ├── SparseSolverBase.h │ │ ├── SparseSparseProductWithPruning.h │ │ ├── SparseTranspose.h │ │ ├── SparseTriangularView.h │ │ ├── SparseUtil.h │ │ ├── SparseVector.h │ │ ├── SparseView.h │ │ └── TriangularSolver.h │ │ ├── SparseLU │ │ ├── SparseLU.h │ │ ├── SparseLUImpl.h │ │ ├── SparseLU_Memory.h │ │ ├── SparseLU_Structs.h │ │ ├── SparseLU_SupernodalMatrix.h │ │ ├── SparseLU_Utils.h │ │ ├── SparseLU_column_bmod.h │ │ ├── SparseLU_column_dfs.h │ │ ├── SparseLU_copy_to_ucol.h │ │ ├── SparseLU_gemm_kernel.h │ │ ├── SparseLU_heap_relax_snode.h │ │ ├── SparseLU_kernel_bmod.h │ │ ├── SparseLU_panel_bmod.h │ │ ├── SparseLU_panel_dfs.h │ │ ├── SparseLU_pivotL.h │ │ ├── SparseLU_pruneL.h │ │ └── SparseLU_relax_snode.h │ │ ├── SparseQR │ │ └── SparseQR.h │ │ ├── StlSupport │ │ ├── StdDeque.h │ │ ├── StdList.h │ │ ├── StdVector.h │ │ └── details.h │ │ ├── SuperLUSupport │ │ └── SuperLUSupport.h │ │ ├── UmfPackSupport │ │ └── UmfPackSupport.h │ │ ├── misc │ │ ├── Image.h │ │ ├── Kernel.h │ │ ├── RealSvd2x2.h │ │ ├── blas.h │ │ ├── lapack.h │ │ ├── lapacke.h │ │ └── lapacke_mangling.h │ │ └── plugins │ │ ├── ArrayCwiseBinaryOps.h │ │ ├── ArrayCwiseUnaryOps.h │ │ ├── BlockMethods.h │ │ ├── CommonCwiseBinaryOps.h │ │ ├── CommonCwiseUnaryOps.h │ │ ├── IndexedViewMethods.h │ │ ├── MatrixCwiseBinaryOps.h │ │ ├── MatrixCwiseUnaryOps.h │ │ └── ReshapedMethods.h ├── base.hpp ├── binio.hpp ├── constants.hpp ├── cxxopts.hpp ├── fft.hpp ├── stringops.hpp ├── unsupported │ ├── CMakeLists.txt │ ├── Eigen │ │ ├── AdolcForward │ │ ├── AlignedVector3 │ │ ├── ArpackSupport │ │ ├── AutoDiff │ │ ├── BVH │ │ ├── CMakeLists.txt │ │ ├── CXX11 │ │ │ ├── CMakeLists.txt │ │ │ ├── Tensor │ │ │ ├── TensorSymmetry │ │ │ ├── ThreadPool │ │ │ └── src │ │ │ │ ├── Tensor │ │ │ │ ├── README.md │ │ │ │ ├── Tensor.h │ │ │ │ ├── TensorArgMax.h │ │ │ │ ├── TensorArgMaxSycl.h │ │ │ │ ├── TensorAssign.h │ │ │ │ ├── TensorBase.h │ │ │ │ ├── TensorBlock.h │ │ │ │ ├── TensorBroadcasting.h │ │ │ │ ├── TensorChipping.h │ │ │ │ ├── TensorConcatenation.h │ │ │ │ ├── TensorContraction.h │ │ │ │ ├── TensorContractionBlocking.h │ │ │ │ ├── TensorContractionCuda.h │ │ │ │ ├── TensorContractionGpu.h │ │ │ │ ├── TensorContractionMapper.h │ │ │ │ ├── TensorContractionSycl.h │ │ │ │ ├── TensorContractionThreadPool.h │ │ │ │ ├── TensorConversion.h │ │ │ │ ├── TensorConvolution.h │ │ │ │ ├── TensorConvolutionSycl.h │ │ │ │ ├── TensorCostModel.h │ │ │ │ ├── TensorCustomOp.h │ │ │ │ ├── TensorDevice.h │ │ │ │ ├── TensorDeviceCuda.h │ │ │ │ ├── TensorDeviceDefault.h │ │ │ │ ├── TensorDeviceGpu.h │ │ │ │ ├── TensorDeviceSycl.h │ │ │ │ ├── TensorDeviceThreadPool.h │ │ │ │ ├── TensorDimensionList.h │ │ │ │ ├── TensorDimensions.h │ │ │ │ ├── TensorEvalTo.h │ │ │ │ ├── TensorEvaluator.h │ │ │ │ ├── TensorExecutor.h │ │ │ │ ├── TensorExpr.h │ │ │ │ ├── TensorFFT.h │ │ │ │ ├── TensorFixedSize.h │ │ │ │ ├── TensorForcedEval.h │ │ │ │ ├── TensorForwardDeclarations.h │ │ │ │ ├── TensorFunctors.h │ │ │ │ ├── TensorGenerator.h │ │ │ │ ├── TensorGlobalFunctions.h │ │ │ │ ├── TensorGpuHipCudaDefines.h │ │ │ │ ├── TensorGpuHipCudaUndefines.h │ │ │ │ ├── TensorIO.h │ │ │ │ ├── TensorImagePatch.h │ │ │ │ ├── TensorIndexList.h │ │ │ │ ├── TensorInflation.h │ │ │ │ ├── TensorInitializer.h │ │ │ │ ├── TensorIntDiv.h │ │ │ │ ├── TensorLayoutSwap.h │ │ │ │ ├── TensorMacros.h │ │ │ │ ├── TensorMap.h │ │ │ │ ├── TensorMeta.h │ │ │ │ ├── TensorMorphing.h │ │ │ │ ├── TensorPadding.h │ │ │ │ ├── TensorPatch.h │ │ │ │ ├── TensorRandom.h │ │ │ │ ├── TensorReduction.h │ │ │ │ ├── TensorReductionCuda.h │ │ │ │ ├── TensorReductionGpu.h │ │ │ │ ├── TensorReductionSycl.h │ │ │ │ ├── TensorRef.h │ │ │ │ ├── TensorReverse.h │ │ │ │ ├── TensorScan.h │ │ │ │ ├── TensorShuffling.h │ │ │ │ ├── TensorStorage.h │ │ │ │ ├── TensorStriding.h │ │ │ │ ├── TensorSycl.h │ │ │ │ ├── TensorSyclConvertToDeviceExpression.h │ │ │ │ ├── TensorSyclExprConstructor.h │ │ │ │ ├── TensorSyclExtractAccessor.h │ │ │ │ ├── TensorSyclExtractFunctors.h │ │ │ │ ├── TensorSyclFunctors.h │ │ │ │ ├── TensorSyclLeafCount.h │ │ │ │ ├── TensorSyclPlaceHolderExpr.h │ │ │ │ ├── TensorSyclRun.h │ │ │ │ ├── TensorSyclTuple.h │ │ │ │ ├── TensorTrace.h │ │ │ │ ├── TensorTraits.h │ │ │ │ ├── TensorUInt128.h │ │ │ │ └── TensorVolumePatch.h │ │ │ │ ├── TensorSymmetry │ │ │ │ ├── DynamicSymmetry.h │ │ │ │ ├── StaticSymmetry.h │ │ │ │ ├── Symmetry.h │ │ │ │ └── util │ │ │ │ │ └── TemplateGroupTheory.h │ │ │ │ ├── ThreadPool │ │ │ │ ├── Barrier.h │ │ │ │ ├── EventCount.h │ │ │ │ ├── NonBlockingThreadPool.h │ │ │ │ ├── RunQueue.h │ │ │ │ ├── ThreadCancel.h │ │ │ │ ├── ThreadEnvironment.h │ │ │ │ ├── ThreadLocal.h │ │ │ │ ├── ThreadPoolInterface.h │ │ │ │ └── ThreadYield.h │ │ │ │ └── util │ │ │ │ ├── CXX11Meta.h │ │ │ │ ├── CXX11Workarounds.h │ │ │ │ ├── EmulateArray.h │ │ │ │ ├── EmulateCXX11Meta.h │ │ │ │ └── MaxSizeVector.h │ │ ├── EulerAngles │ │ ├── FFT │ │ ├── IterativeSolvers │ │ ├── KroneckerProduct │ │ ├── LevenbergMarquardt │ │ ├── MPRealSupport │ │ ├── MatrixFunctions │ │ ├── MoreVectorization │ │ ├── NonLinearOptimization │ │ ├── NumericalDiff │ │ ├── OpenGLSupport │ │ ├── Polynomials │ │ ├── Skyline │ │ ├── SparseExtra │ │ ├── SpecialFunctions │ │ ├── Splines │ │ └── src │ │ │ ├── AutoDiff │ │ │ ├── AutoDiffJacobian.h │ │ │ ├── AutoDiffScalar.h │ │ │ └── AutoDiffVector.h │ │ │ ├── BVH │ │ │ ├── BVAlgorithms.h │ │ │ └── KdBVH.h │ │ │ ├── Eigenvalues │ │ │ └── ArpackSelfAdjointEigenSolver.h │ │ │ ├── EulerAngles │ │ │ ├── CMakeLists.txt │ │ │ ├── EulerAngles.h │ │ │ └── EulerSystem.h │ │ │ ├── FFT │ │ │ ├── ei_fftw_impl.h │ │ │ └── ei_kissfft_impl.h │ │ │ ├── IterativeSolvers │ │ │ ├── ConstrainedConjGrad.h │ │ │ ├── DGMRES.h │ │ │ ├── GMRES.h │ │ │ ├── IncompleteLU.h │ │ │ ├── IterationController.h │ │ │ ├── MINRES.h │ │ │ └── Scaling.h │ │ │ ├── KroneckerProduct │ │ │ └── KroneckerTensorProduct.h │ │ │ ├── LevenbergMarquardt │ │ │ ├── CopyrightMINPACK.txt │ │ │ ├── LMcovar.h │ │ │ ├── LMonestep.h │ │ │ ├── LMpar.h │ │ │ ├── LMqrsolv.h │ │ │ └── LevenbergMarquardt.h │ │ │ ├── MatrixFunctions │ │ │ ├── MatrixExponential.h │ │ │ ├── MatrixFunction.h │ │ │ ├── MatrixLogarithm.h │ │ │ ├── MatrixPower.h │ │ │ ├── MatrixSquareRoot.h │ │ │ └── StemFunction.h │ │ │ ├── MoreVectorization │ │ │ └── MathFunctions.h │ │ │ ├── NonLinearOptimization │ │ │ ├── HybridNonLinearSolver.h │ │ │ ├── LevenbergMarquardt.h │ │ │ ├── chkder.h │ │ │ ├── covar.h │ │ │ ├── dogleg.h │ │ │ ├── fdjac1.h │ │ │ ├── lmpar.h │ │ │ ├── qrsolv.h │ │ │ ├── r1mpyq.h │ │ │ ├── r1updt.h │ │ │ └── rwupdt.h │ │ │ ├── NumericalDiff │ │ │ └── NumericalDiff.h │ │ │ ├── Polynomials │ │ │ ├── Companion.h │ │ │ ├── PolynomialSolver.h │ │ │ └── PolynomialUtils.h │ │ │ ├── Skyline │ │ │ ├── SkylineInplaceLU.h │ │ │ ├── SkylineMatrix.h │ │ │ ├── SkylineMatrixBase.h │ │ │ ├── SkylineProduct.h │ │ │ ├── SkylineStorage.h │ │ │ └── SkylineUtil.h │ │ │ ├── SparseExtra │ │ │ ├── BlockOfDynamicSparseMatrix.h │ │ │ ├── BlockSparseMatrix.h │ │ │ ├── DynamicSparseMatrix.h │ │ │ ├── MarketIO.h │ │ │ ├── MatrixMarketIterator.h │ │ │ └── RandomSetter.h │ │ │ ├── SpecialFunctions │ │ │ ├── SpecialFunctionsArrayAPI.h │ │ │ ├── SpecialFunctionsFunctors.h │ │ │ ├── SpecialFunctionsHalf.h │ │ │ ├── SpecialFunctionsImpl.h │ │ │ ├── SpecialFunctionsPacketMath.h │ │ │ └── arch │ │ │ │ └── GPU │ │ │ │ └── GpuSpecialFunctions.h │ │ │ └── Splines │ │ │ ├── Spline.h │ │ │ ├── SplineFitting.h │ │ │ └── SplineFwd.h │ ├── README.txt │ ├── bench │ │ └── bench_svd.cpp │ ├── doc │ │ ├── CMakeLists.txt │ │ ├── Overview.dox │ │ ├── eigendoxy_layout.xml.in │ │ ├── examples │ │ │ ├── BVH_Example.cpp │ │ │ ├── CMakeLists.txt │ │ │ ├── EulerAngles.cpp │ │ │ ├── FFT.cpp │ │ │ ├── MatrixExponential.cpp │ │ │ ├── MatrixFunction.cpp │ │ │ ├── MatrixLogarithm.cpp │ │ │ ├── MatrixPower.cpp │ │ │ ├── MatrixPower_optimal.cpp │ │ │ ├── MatrixSine.cpp │ │ │ ├── MatrixSinh.cpp │ │ │ ├── MatrixSquareRoot.cpp │ │ │ ├── PolynomialSolver1.cpp │ │ │ └── PolynomialUtils1.cpp │ │ └── snippets │ │ │ └── CMakeLists.txt │ └── test │ │ ├── BVH.cpp │ │ ├── CMakeLists.txt │ │ ├── EulerAngles.cpp │ │ ├── FFT.cpp │ │ ├── FFTW.cpp │ │ ├── NonLinearOptimization.cpp │ │ ├── NumericalDiff.cpp │ │ ├── alignedvector3.cpp │ │ ├── autodiff.cpp │ │ ├── autodiff_scalar.cpp │ │ ├── cxx11_eventcount.cpp │ │ ├── cxx11_maxsizevector.cpp │ │ ├── cxx11_meta.cpp │ │ ├── cxx11_non_blocking_thread_pool.cpp │ │ ├── cxx11_runqueue.cpp │ │ ├── cxx11_tensor_argmax.cpp │ │ ├── cxx11_tensor_argmax_gpu.cu │ │ ├── cxx11_tensor_argmax_sycl.cpp │ │ ├── cxx11_tensor_assign.cpp │ │ ├── cxx11_tensor_block_access.cpp │ │ ├── cxx11_tensor_broadcast_sycl.cpp │ │ ├── cxx11_tensor_broadcasting.cpp │ │ ├── cxx11_tensor_builtins_sycl.cpp │ │ ├── cxx11_tensor_cast_float16_gpu.cu │ │ ├── cxx11_tensor_casts.cpp │ │ ├── cxx11_tensor_chipping.cpp │ │ ├── cxx11_tensor_chipping_sycl.cpp │ │ ├── cxx11_tensor_comparisons.cpp │ │ ├── cxx11_tensor_complex_cwise_ops_gpu.cu │ │ ├── cxx11_tensor_complex_gpu.cu │ │ ├── cxx11_tensor_concatenation.cpp │ │ ├── cxx11_tensor_concatenation_sycl.cpp │ │ ├── cxx11_tensor_const.cpp │ │ ├── cxx11_tensor_contract_gpu.cu │ │ ├── cxx11_tensor_contract_sycl.cpp │ │ ├── cxx11_tensor_contraction.cpp │ │ ├── cxx11_tensor_convolution.cpp │ │ ├── cxx11_tensor_convolution_sycl.cpp │ │ ├── cxx11_tensor_custom_index.cpp │ │ ├── cxx11_tensor_custom_op.cpp │ │ ├── cxx11_tensor_custom_op_sycl.cpp │ │ ├── cxx11_tensor_device.cu │ │ ├── cxx11_tensor_device_sycl.cpp │ │ ├── cxx11_tensor_dimension.cpp │ │ ├── cxx11_tensor_empty.cpp │ │ ├── cxx11_tensor_executor.cpp │ │ ├── cxx11_tensor_expr.cpp │ │ ├── cxx11_tensor_fft.cpp │ │ ├── cxx11_tensor_fixed_size.cpp │ │ ├── cxx11_tensor_forced_eval.cpp │ │ ├── cxx11_tensor_forced_eval_sycl.cpp │ │ ├── cxx11_tensor_generator.cpp │ │ ├── cxx11_tensor_generator_sycl.cpp │ │ ├── cxx11_tensor_gpu.cu │ │ ├── cxx11_tensor_ifft.cpp │ │ ├── cxx11_tensor_image_patch.cpp │ │ ├── cxx11_tensor_image_patch_sycl.cpp │ │ ├── cxx11_tensor_index_list.cpp │ │ ├── cxx11_tensor_inflation.cpp │ │ ├── cxx11_tensor_inflation_sycl.cpp │ │ ├── cxx11_tensor_intdiv.cpp │ │ ├── cxx11_tensor_io.cpp │ │ ├── cxx11_tensor_layout_swap.cpp │ │ ├── cxx11_tensor_layout_swap_sycl.cpp │ │ ├── cxx11_tensor_lvalue.cpp │ │ ├── cxx11_tensor_map.cpp │ │ ├── cxx11_tensor_math.cpp │ │ ├── cxx11_tensor_mixed_indices.cpp │ │ ├── cxx11_tensor_morphing.cpp │ │ ├── cxx11_tensor_morphing_sycl.cpp │ │ ├── cxx11_tensor_move.cpp │ │ ├── cxx11_tensor_notification.cpp │ │ ├── cxx11_tensor_of_complex.cpp │ │ ├── cxx11_tensor_of_const_values.cpp │ │ ├── cxx11_tensor_of_float16_gpu.cu │ │ ├── cxx11_tensor_of_strings.cpp │ │ ├── cxx11_tensor_padding.cpp │ │ ├── cxx11_tensor_padding_sycl.cpp │ │ ├── cxx11_tensor_patch.cpp │ │ ├── cxx11_tensor_patch_sycl.cpp │ │ ├── cxx11_tensor_random.cpp │ │ ├── cxx11_tensor_random_gpu.cu │ │ ├── cxx11_tensor_reduction.cpp │ │ ├── cxx11_tensor_reduction_gpu.cu │ │ ├── cxx11_tensor_reduction_sycl.cpp │ │ ├── cxx11_tensor_ref.cpp │ │ ├── cxx11_tensor_reverse.cpp │ │ ├── cxx11_tensor_reverse_sycl.cpp │ │ ├── cxx11_tensor_roundings.cpp │ │ ├── cxx11_tensor_scan.cpp │ │ ├── cxx11_tensor_scan_gpu.cu │ │ ├── cxx11_tensor_shuffling.cpp │ │ ├── cxx11_tensor_shuffling_sycl.cpp │ │ ├── cxx11_tensor_simple.cpp │ │ ├── cxx11_tensor_striding.cpp │ │ ├── cxx11_tensor_striding_sycl.cpp │ │ ├── cxx11_tensor_sugar.cpp │ │ ├── cxx11_tensor_sycl.cpp │ │ ├── cxx11_tensor_symmetry.cpp │ │ ├── cxx11_tensor_thread_pool.cpp │ │ ├── cxx11_tensor_trace.cpp │ │ ├── cxx11_tensor_uint128.cpp │ │ ├── cxx11_tensor_volume_patch.cpp │ │ ├── cxx11_tensor_volume_patch_sycl.cpp │ │ ├── dgmres.cpp │ │ ├── forward_adolc.cpp │ │ ├── gmres.cpp │ │ ├── kronecker_product.cpp │ │ ├── levenberg_marquardt.cpp │ │ ├── matrix_exponential.cpp │ │ ├── matrix_function.cpp │ │ ├── matrix_functions.h │ │ ├── matrix_power.cpp │ │ ├── matrix_square_root.cpp │ │ ├── minres.cpp │ │ ├── mpreal │ │ └── mpreal.h │ │ ├── mpreal_support.cpp │ │ ├── openglsupport.cpp │ │ ├── polynomialsolver.cpp │ │ ├── polynomialutils.cpp │ │ ├── sparse_extra.cpp │ │ ├── special_functions.cpp │ │ └── splines.cpp ├── wavecar.hpp └── wavehigh.hpp ├── src ├── binio.cc ├── fft.cc ├── plotWave.cc ├── stringops.cc ├── wavecar.cc └── wavehigh.cc └── tests ├── .DS_Store ├── MoS2 ├── POSCAR └── WAVECAR └── fccSidos ├── .DOSCAR.swp ├── CHG ├── CHGCAR ├── CONTCAR ├── DOSCAR ├── EIGENVAL ├── IBZKPT ├── INCAR ├── KPOINTS ├── OSZICAR ├── OUTCAR ├── PCDAT ├── POSCAR ├── POTCAR ├── PROCAR ├── REPORT ├── WAVECAR ├── XDATCAR ├── cleanup.sh ├── job.sh ├── plotdos.sh └── vasprun.xml /.gitignore: -------------------------------------------------------------------------------- 1 | # Prerequisites 2 | *.d 3 | 4 | # Compiled Object files 5 | *.slo 6 | *.lo 7 | *.o 8 | *.obj 9 | 10 | # Precompiled Headers 11 | *.gch 12 | *.pch 13 | 14 | # Compiled Dynamic libraries 15 | *.so 16 | *.dylib 17 | *.dll 18 | 19 | # Fortran module files 20 | *.mod 21 | *.smod 22 | 23 | # Compiled Static libraries 24 | *.lai 25 | *.la 26 | *.a 27 | *.lib 28 | 29 | # Executables 30 | *.exe 31 | *.out 32 | *.app 33 | 34 | *.DS_Store 35 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: cpp 2 | dist: trusty 3 | sudo: false 4 | matrix: 5 | include: 6 | - os: linux 7 | - compiler: gcc 8 | 9 | addons: 10 | apt: 11 | packages: 12 | - libfftw* 13 | 14 | script: 15 | - make 16 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 Ionizing 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | INC := -I./include/ 2 | CC := c++ 3 | FLAGS := -Wextra -Wall -std=c++11 -O2 #-g -fno-omit-frame-pointer -fsanitize=address 4 | LFLAGS := -lfftw3 5 | 6 | SOURCE := $(wildcard ./src/*.cc) 7 | OBJS := $(patsubst %.cc, %.o, $(SOURCE)) 8 | 9 | .PHONY: help clean test all veryclean 10 | .SECONDARY: $(OBJS) 11 | 12 | all: plotWave.out 13 | 14 | test: plotWave.out 15 | ./plotWave.out --poscar=./tests/MoS2/POSCAR --wavecar=./tests/MoS2/WAVECAR --prefix=MoS2 16 | ./plotWave.out --poscar=./tests/fccSidos/POSCAR --wavecar=./tests/fccSidos/WAVECAR --prefix=Si 17 | 18 | plotWave.out: $(OBJS) 19 | $(CC) -o $@ $(OBJS) $(FLAGS) $(LFLAGS) 20 | 21 | ./src/%.o: ./src/%.cc ./include/*.hpp 22 | $(CC) -o $@ -c $< \ 23 | $(INC) $(FLAGS) 24 | 25 | clean: 26 | @rm -rf $(OBJS) *.out 27 | 28 | veryclean: clean 29 | @rm *.vasp 30 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # plotWave 2 | 3 | [![Build Status](https://travis-ci.org/Ionizing/wavecar_parser.svg?branch=master)](https://travis-ci.org/Ionizing/wavecar_parser) 4 | 5 | Acknowledgement: 6 | - [Qijing Zheng](https://github.com/QijingZheng/VaspBandUnfolding) 7 | - [Hao Ren](renh@upc.edu.cn) 8 | - [Eigen3](http://eigen.tuxfamily.org/index.php?title=Main_Page) 9 | - [FFTW3](http://www.fftw.org) 10 | 11 | # Requirements 12 | 13 | - A compiler supports C++11 (gcc4.9 or upper, clang3.3 or upper, intel compiler not tested) 14 | - FFTW3 15 | - Eigen3 (already included) 16 | 17 | ## Input file 18 | 19 | - WAVECAR 20 | - POSCAR 21 | 22 | ## Input arguments 23 | 24 | - `-b --band integer` band index, starting from **0** 25 | - `-s --spin integer` spin index, starting from **0** 26 | - `-k --kpoint integer` kpoint index, starting from **0** 27 | - `--prefix PREFIX` file name prefix for `.vasp` file 28 | - `-r --real` only real part of wavefunction would be plotted if opened 29 | - `-w --wavecar WAVECAR` WAVECAR file name 30 | - `--poscar POSCAR` POSCAR file name 31 | 32 | **This program DOES NOT check if POSCAR matches WAVECAR** 33 | 34 | ## Output file 35 | 36 | Pseudo wavefunction at some kpoint, band given by user. 37 | 38 | ## Help 39 | 40 | ``` 41 | A wavefunction plotter using WAVECAR. 42 | Usage: 43 | ../plotWave.out [OPTION...] 44 | 45 | -b, --band arg Specify which band to plot, default: 0 46 | -e, --example Give example usage of plotWave 47 | -h, --help Print help 48 | -k, --kpoint arg Specify which kpoint to plot, default: 0 49 | -l, --list List brief info of current wavecar 50 | --prefix arg File name prefix of output .vasp file, default: "wfc" 51 | --poscar arg Specify which POSCAR to read, default: "POSCAR" 52 | -r, --real Only output real part of wavefunction 53 | -s, --spin arg Specify which spin to plot, default: 0 54 | -w, --wavecar arg Specify which WAVECAR to parse, default: "WAVECAR" 55 | ``` 56 | 57 | # Use VESTA to view the `.vasp` file generated by `plotWave` 58 | -------------------------------------------------------------------------------- /compile_commands.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "directory": "/Users/ionizing/Documents/github/wavecar_parser", 4 | "arguments": [ 5 | "c++", 6 | "-o", 7 | "src/fft.o", 8 | "-c", 9 | "src/fft.cc", 10 | "-I./include/", 11 | "-Wextra", 12 | "-Wall", 13 | "-std=c++11", 14 | "-O2" 15 | ], 16 | "file": "src/fft.cc" 17 | }, 18 | { 19 | "directory": "/Users/ionizing/Documents/github/wavecar_parser", 20 | "arguments": [ 21 | "c++", 22 | "-o", 23 | "src/wavecar.o", 24 | "-c", 25 | "src/wavecar.cc", 26 | "-I./include/", 27 | "-Wextra", 28 | "-Wall", 29 | "-std=c++11", 30 | "-O2" 31 | ], 32 | "file": "src/wavecar.cc" 33 | }, 34 | { 35 | "directory": "/Users/ionizing/Documents/github/wavecar_parser", 36 | "arguments": [ 37 | "c++", 38 | "-o", 39 | "src/stringops.o", 40 | "-c", 41 | "src/stringops.cc", 42 | "-I./include/", 43 | "-Wextra", 44 | "-Wall", 45 | "-std=c++11", 46 | "-O2" 47 | ], 48 | "file": "src/stringops.cc" 49 | }, 50 | { 51 | "directory": "/Users/ionizing/Documents/github/wavecar_parser", 52 | "arguments": [ 53 | "c++", 54 | "-o", 55 | "src/wavehigh.o", 56 | "-c", 57 | "src/wavehigh.cc", 58 | "-I./include/", 59 | "-Wextra", 60 | "-Wall", 61 | "-std=c++11", 62 | "-O2" 63 | ], 64 | "file": "src/wavehigh.cc" 65 | }, 66 | { 67 | "directory": "/Users/ionizing/Documents/github/wavecar_parser", 68 | "arguments": [ 69 | "c++", 70 | "-o", 71 | "src/binio.o", 72 | "-c", 73 | "src/binio.cc", 74 | "-I./include/", 75 | "-Wextra", 76 | "-Wall", 77 | "-std=c++11", 78 | "-O2" 79 | ], 80 | "file": "src/binio.cc" 81 | }, 82 | { 83 | "directory": "/Users/ionizing/Documents/github/wavecar_parser", 84 | "arguments": [ 85 | "c++", 86 | "-o", 87 | "src/plotWave.o", 88 | "-c", 89 | "src/plotWave.cc", 90 | "-I./include/", 91 | "-Wextra", 92 | "-Wall", 93 | "-std=c++11", 94 | "-O2" 95 | ], 96 | "file": "src/plotWave.cc" 97 | } 98 | ] 99 | -------------------------------------------------------------------------------- /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 | install(DIRECTORY src DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen COMPONENT Devel FILES_MATCHING PATTERN "*.h") 20 | -------------------------------------------------------------------------------- /include/Eigen/Cholesky: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // This Source Code Form is subject to the terms of the Mozilla 5 | // Public License v. 2.0. If a copy of the MPL was not distributed 6 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 7 | 8 | #ifndef EIGEN_CHOLESKY_MODULE_H 9 | #define EIGEN_CHOLESKY_MODULE_H 10 | 11 | #include "Core" 12 | #include "Jacobi" 13 | 14 | #include "src/Core/util/DisableStupidWarnings.h" 15 | 16 | /** \defgroup Cholesky_Module Cholesky module 17 | * 18 | * 19 | * 20 | * This module provides two variants of the Cholesky decomposition for selfadjoint (hermitian) matrices. 21 | * Those decompositions are also accessible via the following methods: 22 | * - MatrixBase::llt() 23 | * - MatrixBase::ldlt() 24 | * - SelfAdjointView::llt() 25 | * - SelfAdjointView::ldlt() 26 | * 27 | * \code 28 | * #include 29 | * \endcode 30 | */ 31 | 32 | #include "src/Cholesky/LLT.h" 33 | #include "src/Cholesky/LDLT.h" 34 | #ifdef EIGEN_USE_LAPACKE 35 | #ifdef EIGEN_USE_MKL 36 | #include "mkl_lapacke.h" 37 | #else 38 | #include "src/misc/lapacke.h" 39 | #endif 40 | #include "src/Cholesky/LLT_LAPACKE.h" 41 | #endif 42 | 43 | #include "src/Core/util/ReenableStupidWarnings.h" 44 | 45 | #endif // EIGEN_CHOLESKY_MODULE_H 46 | /* vim: set filetype=cpp et sw=2 ts=2 ai: */ 47 | -------------------------------------------------------------------------------- /include/Eigen/CholmodSupport: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // This Source Code Form is subject to the terms of the Mozilla 5 | // Public License v. 2.0. If a copy of the MPL was not distributed 6 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 7 | 8 | #ifndef EIGEN_CHOLMODSUPPORT_MODULE_H 9 | #define EIGEN_CHOLMODSUPPORT_MODULE_H 10 | 11 | #include "SparseCore" 12 | 13 | #include "src/Core/util/DisableStupidWarnings.h" 14 | 15 | extern "C" { 16 | #include 17 | } 18 | 19 | /** \ingroup Support_modules 20 | * \defgroup CholmodSupport_Module CholmodSupport module 21 | * 22 | * This module provides an interface to the Cholmod library which is part of the suitesparse package. 23 | * It provides the two following main factorization classes: 24 | * - class CholmodSupernodalLLT: a supernodal LLT Cholesky factorization. 25 | * - class CholmodDecomposiiton: a general L(D)LT Cholesky factorization with automatic or explicit runtime selection of the underlying factorization method (supernodal or simplicial). 26 | * 27 | * For the sake of completeness, this module also propose the two following classes: 28 | * - class CholmodSimplicialLLT 29 | * - class CholmodSimplicialLDLT 30 | * Note that these classes does not bring any particular advantage compared to the built-in 31 | * SimplicialLLT and SimplicialLDLT factorization classes. 32 | * 33 | * \code 34 | * #include 35 | * \endcode 36 | * 37 | * 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. 38 | * The dependencies depend on how cholmod has been compiled. 39 | * For a cmake based project, you can use our FindCholmod.cmake module to help you in this task. 40 | * 41 | */ 42 | 43 | #include "src/CholmodSupport/CholmodSupport.h" 44 | 45 | #include "src/Core/util/ReenableStupidWarnings.h" 46 | 47 | #endif // EIGEN_CHOLMODSUPPORT_MODULE_H 48 | 49 | -------------------------------------------------------------------------------- /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/Eigenvalues: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // This Source Code Form is subject to the terms of the Mozilla 5 | // Public License v. 2.0. If a copy of the MPL was not distributed 6 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 7 | 8 | #ifndef EIGEN_EIGENVALUES_MODULE_H 9 | #define EIGEN_EIGENVALUES_MODULE_H 10 | 11 | #include "Core" 12 | 13 | #include "Cholesky" 14 | #include "Jacobi" 15 | #include "Householder" 16 | #include "LU" 17 | #include "Geometry" 18 | 19 | #include "src/Core/util/DisableStupidWarnings.h" 20 | 21 | /** \defgroup Eigenvalues_Module Eigenvalues module 22 | * 23 | * 24 | * 25 | * This module mainly provides various eigenvalue solvers. 26 | * This module also provides some MatrixBase methods, including: 27 | * - MatrixBase::eigenvalues(), 28 | * - MatrixBase::operatorNorm() 29 | * 30 | * \code 31 | * #include 32 | * \endcode 33 | */ 34 | 35 | #include "src/misc/RealSvd2x2.h" 36 | #include "src/Eigenvalues/Tridiagonalization.h" 37 | #include "src/Eigenvalues/RealSchur.h" 38 | #include "src/Eigenvalues/EigenSolver.h" 39 | #include "src/Eigenvalues/SelfAdjointEigenSolver.h" 40 | #include "src/Eigenvalues/GeneralizedSelfAdjointEigenSolver.h" 41 | #include "src/Eigenvalues/HessenbergDecomposition.h" 42 | #include "src/Eigenvalues/ComplexSchur.h" 43 | #include "src/Eigenvalues/ComplexEigenSolver.h" 44 | #include "src/Eigenvalues/RealQZ.h" 45 | #include "src/Eigenvalues/GeneralizedEigenSolver.h" 46 | #include "src/Eigenvalues/MatrixBaseEigenvalues.h" 47 | #ifdef EIGEN_USE_LAPACKE 48 | #ifdef EIGEN_USE_MKL 49 | #include "mkl_lapacke.h" 50 | #else 51 | #include "src/misc/lapacke.h" 52 | #endif 53 | #include "src/Eigenvalues/RealSchur_LAPACKE.h" 54 | #include "src/Eigenvalues/ComplexSchur_LAPACKE.h" 55 | #include "src/Eigenvalues/SelfAdjointEigenSolver_LAPACKE.h" 56 | #endif 57 | 58 | #include "src/Core/util/ReenableStupidWarnings.h" 59 | 60 | #endif // EIGEN_EIGENVALUES_MODULE_H 61 | /* vim: set filetype=cpp et sw=2 ts=2 ai: */ 62 | -------------------------------------------------------------------------------- /include/Eigen/Geometry: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // This Source Code Form is subject to the terms of the Mozilla 5 | // Public License v. 2.0. If a copy of the MPL was not distributed 6 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 7 | 8 | #ifndef EIGEN_GEOMETRY_MODULE_H 9 | #define EIGEN_GEOMETRY_MODULE_H 10 | 11 | #include "Core" 12 | 13 | #include "SVD" 14 | #include "LU" 15 | #include 16 | 17 | #include "src/Core/util/DisableStupidWarnings.h" 18 | 19 | /** \defgroup Geometry_Module Geometry module 20 | * 21 | * This module provides support for: 22 | * - fixed-size homogeneous transformations 23 | * - translation, scaling, 2D and 3D rotations 24 | * - \link Quaternion quaternions \endlink 25 | * - cross products (\ref MatrixBase::cross, \ref MatrixBase::cross3) 26 | * - orthognal vector generation (\ref MatrixBase::unitOrthogonal) 27 | * - some linear components: \link ParametrizedLine parametrized-lines \endlink and \link Hyperplane hyperplanes \endlink 28 | * - \link AlignedBox axis aligned bounding boxes \endlink 29 | * - \link umeyama least-square transformation fitting \endlink 30 | * 31 | * \code 32 | * #include 33 | * \endcode 34 | */ 35 | 36 | #include "src/Geometry/OrthoMethods.h" 37 | #include "src/Geometry/EulerAngles.h" 38 | 39 | #include "src/Geometry/Homogeneous.h" 40 | #include "src/Geometry/RotationBase.h" 41 | #include "src/Geometry/Rotation2D.h" 42 | #include "src/Geometry/Quaternion.h" 43 | #include "src/Geometry/AngleAxis.h" 44 | #include "src/Geometry/Transform.h" 45 | #include "src/Geometry/Translation.h" 46 | #include "src/Geometry/Scaling.h" 47 | #include "src/Geometry/Hyperplane.h" 48 | #include "src/Geometry/ParametrizedLine.h" 49 | #include "src/Geometry/AlignedBox.h" 50 | #include "src/Geometry/Umeyama.h" 51 | 52 | // Use the SSE optimized version whenever possible. At the moment the 53 | // SSE version doesn't compile when AVX is enabled 54 | #if defined EIGEN_VECTORIZE_SSE && !defined EIGEN_VECTORIZE_AVX 55 | #include "src/Geometry/arch/Geometry_SSE.h" 56 | #endif 57 | 58 | #include "src/Core/util/ReenableStupidWarnings.h" 59 | 60 | #endif // EIGEN_GEOMETRY_MODULE_H 61 | /* vim: set filetype=cpp et sw=2 ts=2 ai: */ 62 | -------------------------------------------------------------------------------- /include/Eigen/Householder: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // This Source Code Form is subject to the terms of the Mozilla 5 | // Public License v. 2.0. If a copy of the MPL was not distributed 6 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 7 | 8 | #ifndef EIGEN_HOUSEHOLDER_MODULE_H 9 | #define EIGEN_HOUSEHOLDER_MODULE_H 10 | 11 | #include "Core" 12 | 13 | #include "src/Core/util/DisableStupidWarnings.h" 14 | 15 | /** \defgroup Householder_Module Householder module 16 | * This module provides Householder transformations. 17 | * 18 | * \code 19 | * #include 20 | * \endcode 21 | */ 22 | 23 | #include "src/Householder/Householder.h" 24 | #include "src/Householder/HouseholderSequence.h" 25 | #include "src/Householder/BlockHouseholder.h" 26 | 27 | #include "src/Core/util/ReenableStupidWarnings.h" 28 | 29 | #endif // EIGEN_HOUSEHOLDER_MODULE_H 30 | /* vim: set filetype=cpp et sw=2 ts=2 ai: */ 31 | -------------------------------------------------------------------------------- /include/Eigen/IterativeLinearSolvers: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // This Source Code Form is subject to the terms of the Mozilla 5 | // Public License v. 2.0. If a copy of the MPL was not distributed 6 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 7 | 8 | #ifndef EIGEN_ITERATIVELINEARSOLVERS_MODULE_H 9 | #define EIGEN_ITERATIVELINEARSOLVERS_MODULE_H 10 | 11 | #include "SparseCore" 12 | #include "OrderingMethods" 13 | 14 | #include "src/Core/util/DisableStupidWarnings.h" 15 | 16 | /** 17 | * \defgroup IterativeLinearSolvers_Module IterativeLinearSolvers module 18 | * 19 | * 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. 20 | * Those solvers are accessible via the following classes: 21 | * - ConjugateGradient for selfadjoint (hermitian) matrices, 22 | * - LeastSquaresConjugateGradient for rectangular least-square problems, 23 | * - BiCGSTAB for general square matrices. 24 | * 25 | * These iterative solvers are associated with some preconditioners: 26 | * - IdentityPreconditioner - not really useful 27 | * - DiagonalPreconditioner - also called Jacobi preconditioner, work very well on diagonal dominant matrices. 28 | * - IncompleteLUT - incomplete LU factorization with dual thresholding 29 | * 30 | * Such problems can also be solved using the direct sparse decomposition modules: SparseCholesky, CholmodSupport, UmfPackSupport, SuperLUSupport. 31 | * 32 | \code 33 | #include 34 | \endcode 35 | */ 36 | 37 | #include "src/IterativeLinearSolvers/SolveWithGuess.h" 38 | #include "src/IterativeLinearSolvers/IterativeSolverBase.h" 39 | #include "src/IterativeLinearSolvers/BasicPreconditioners.h" 40 | #include "src/IterativeLinearSolvers/ConjugateGradient.h" 41 | #include "src/IterativeLinearSolvers/LeastSquareConjugateGradient.h" 42 | #include "src/IterativeLinearSolvers/BiCGSTAB.h" 43 | #include "src/IterativeLinearSolvers/IncompleteLUT.h" 44 | #include "src/IterativeLinearSolvers/IncompleteCholesky.h" 45 | 46 | #include "src/Core/util/ReenableStupidWarnings.h" 47 | 48 | #endif // EIGEN_ITERATIVELINEARSOLVERS_MODULE_H 49 | -------------------------------------------------------------------------------- /include/Eigen/Jacobi: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // This Source Code Form is subject to the terms of the Mozilla 5 | // Public License v. 2.0. If a copy of the MPL was not distributed 6 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 7 | 8 | #ifndef EIGEN_JACOBI_MODULE_H 9 | #define EIGEN_JACOBI_MODULE_H 10 | 11 | #include "Core" 12 | 13 | #include "src/Core/util/DisableStupidWarnings.h" 14 | 15 | /** \defgroup Jacobi_Module Jacobi module 16 | * This module provides Jacobi and Givens rotations. 17 | * 18 | * \code 19 | * #include 20 | * \endcode 21 | * 22 | * In addition to listed classes, it defines the two following MatrixBase methods to apply a Jacobi or Givens rotation: 23 | * - MatrixBase::applyOnTheLeft() 24 | * - MatrixBase::applyOnTheRight(). 25 | */ 26 | 27 | #include "src/Jacobi/Jacobi.h" 28 | 29 | #include "src/Core/util/ReenableStupidWarnings.h" 30 | 31 | #endif // EIGEN_JACOBI_MODULE_H 32 | /* vim: set filetype=cpp et sw=2 ts=2 ai: */ 33 | 34 | -------------------------------------------------------------------------------- /include/Eigen/KLUSupport: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // This Source Code Form is subject to the terms of the Mozilla 5 | // Public License v. 2.0. If a copy of the MPL was not distributed 6 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 7 | 8 | #ifndef EIGEN_KLUSUPPORT_MODULE_H 9 | #define EIGEN_KLUSUPPORT_MODULE_H 10 | 11 | #include 12 | 13 | #include 14 | 15 | extern "C" { 16 | #include 17 | #include 18 | } 19 | 20 | /** \ingroup Support_modules 21 | * \defgroup KLUSupport_Module KLUSupport module 22 | * 23 | * This module provides an interface to the KLU library which is part of the suitesparse package. 24 | * It provides the following factorization class: 25 | * - class KLU: a sparse LU factorization, well-suited for circuit simulation. 26 | * 27 | * \code 28 | * #include 29 | * \endcode 30 | * 31 | * In order to use this module, the klu and btf headers must be accessible from the include paths, and your binary must be linked to the klu library and its dependencies. 32 | * The dependencies depend on how umfpack has been compiled. 33 | * For a cmake based project, you can use our FindKLU.cmake module to help you in this task. 34 | * 35 | */ 36 | 37 | #include "src/KLUSupport/KLUSupport.h" 38 | 39 | #include 40 | 41 | #endif // EIGEN_KLUSUPPORT_MODULE_H 42 | -------------------------------------------------------------------------------- /include/Eigen/LU: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // This Source Code Form is subject to the terms of the Mozilla 5 | // Public License v. 2.0. If a copy of the MPL was not distributed 6 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 7 | 8 | #ifndef EIGEN_LU_MODULE_H 9 | #define EIGEN_LU_MODULE_H 10 | 11 | #include "Core" 12 | 13 | #include "src/Core/util/DisableStupidWarnings.h" 14 | 15 | /** \defgroup LU_Module LU module 16 | * This module includes %LU decomposition and related notions such as matrix inversion and determinant. 17 | * This module defines the following MatrixBase methods: 18 | * - MatrixBase::inverse() 19 | * - MatrixBase::determinant() 20 | * 21 | * \code 22 | * #include 23 | * \endcode 24 | */ 25 | 26 | #include "src/misc/Kernel.h" 27 | #include "src/misc/Image.h" 28 | #include "src/LU/FullPivLU.h" 29 | #include "src/LU/PartialPivLU.h" 30 | #ifdef EIGEN_USE_LAPACKE 31 | #ifdef EIGEN_USE_MKL 32 | #include "mkl_lapacke.h" 33 | #else 34 | #include "src/misc/lapacke.h" 35 | #endif 36 | #include "src/LU/PartialPivLU_LAPACKE.h" 37 | #endif 38 | #include "src/LU/Determinant.h" 39 | #include "src/LU/InverseImpl.h" 40 | 41 | // Use the SSE optimized version whenever possible. At the moment the 42 | // SSE version doesn't compile when AVX is enabled 43 | #if defined EIGEN_VECTORIZE_SSE && !defined EIGEN_VECTORIZE_AVX 44 | #include "src/LU/arch/Inverse_SSE.h" 45 | #endif 46 | 47 | #include "src/Core/util/ReenableStupidWarnings.h" 48 | 49 | #endif // EIGEN_LU_MODULE_H 50 | /* vim: set filetype=cpp et sw=2 ts=2 ai: */ 51 | -------------------------------------------------------------------------------- /include/Eigen/MetisSupport: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // This Source Code Form is subject to the terms of the Mozilla 5 | // Public License v. 2.0. If a copy of the MPL was not distributed 6 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 7 | 8 | #ifndef EIGEN_METISSUPPORT_MODULE_H 9 | #define EIGEN_METISSUPPORT_MODULE_H 10 | 11 | #include "SparseCore" 12 | 13 | #include "src/Core/util/DisableStupidWarnings.h" 14 | 15 | extern "C" { 16 | #include 17 | } 18 | 19 | 20 | /** \ingroup Support_modules 21 | * \defgroup MetisSupport_Module MetisSupport module 22 | * 23 | * \code 24 | * #include 25 | * \endcode 26 | * This module defines an interface to the METIS reordering package (http://glaros.dtc.umn.edu/gkhome/views/metis). 27 | * It can be used just as any other built-in method as explained in \link OrderingMethods_Module here. \endlink 28 | */ 29 | 30 | 31 | #include "src/MetisSupport/MetisSupport.h" 32 | 33 | #include "src/Core/util/ReenableStupidWarnings.h" 34 | 35 | #endif // EIGEN_METISSUPPORT_MODULE_H 36 | -------------------------------------------------------------------------------- /include/Eigen/PaStiXSupport: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // This Source Code Form is subject to the terms of the Mozilla 5 | // Public License v. 2.0. If a copy of the MPL was not distributed 6 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 7 | 8 | #ifndef EIGEN_PASTIXSUPPORT_MODULE_H 9 | #define EIGEN_PASTIXSUPPORT_MODULE_H 10 | 11 | #include "SparseCore" 12 | 13 | #include "src/Core/util/DisableStupidWarnings.h" 14 | 15 | extern "C" { 16 | #include 17 | #include 18 | } 19 | 20 | #ifdef complex 21 | #undef complex 22 | #endif 23 | 24 | /** \ingroup Support_modules 25 | * \defgroup PaStiXSupport_Module PaStiXSupport module 26 | * 27 | * This module provides an interface to the PaSTiX library. 28 | * PaSTiX is a general \b supernodal, \b parallel and \b opensource sparse solver. 29 | * It provides the two following main factorization classes: 30 | * - class PastixLLT : a supernodal, parallel LLt Cholesky factorization. 31 | * - class PastixLDLT: a supernodal, parallel LDLt Cholesky factorization. 32 | * - class PastixLU : a supernodal, parallel LU factorization (optimized for a symmetric pattern). 33 | * 34 | * \code 35 | * #include 36 | * \endcode 37 | * 38 | * 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. 39 | * This wrapper resuires PaStiX version 5.x compiled without MPI support. 40 | * The dependencies depend on how PaSTiX has been compiled. 41 | * For a cmake based project, you can use our FindPaSTiX.cmake module to help you in this task. 42 | * 43 | */ 44 | 45 | #include "src/PaStiXSupport/PaStiXSupport.h" 46 | 47 | #include "src/Core/util/ReenableStupidWarnings.h" 48 | 49 | #endif // EIGEN_PASTIXSUPPORT_MODULE_H 50 | -------------------------------------------------------------------------------- /include/Eigen/PardisoSupport: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // This Source Code Form is subject to the terms of the Mozilla 5 | // Public License v. 2.0. If a copy of the MPL was not distributed 6 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 7 | 8 | #ifndef EIGEN_PARDISOSUPPORT_MODULE_H 9 | #define EIGEN_PARDISOSUPPORT_MODULE_H 10 | 11 | #include "SparseCore" 12 | 13 | #include "src/Core/util/DisableStupidWarnings.h" 14 | 15 | #include 16 | 17 | /** \ingroup Support_modules 18 | * \defgroup PardisoSupport_Module PardisoSupport module 19 | * 20 | * This module brings support for the Intel(R) MKL PARDISO direct sparse solvers. 21 | * 22 | * \code 23 | * #include 24 | * \endcode 25 | * 26 | * 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. 27 | * See this \ref TopicUsingIntelMKL "page" for more information on MKL-Eigen integration. 28 | * 29 | */ 30 | 31 | #include "src/PardisoSupport/PardisoSupport.h" 32 | 33 | #include "src/Core/util/ReenableStupidWarnings.h" 34 | 35 | #endif // EIGEN_PARDISOSUPPORT_MODULE_H 36 | -------------------------------------------------------------------------------- /include/Eigen/QR: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // This Source Code Form is subject to the terms of the Mozilla 5 | // Public License v. 2.0. If a copy of the MPL was not distributed 6 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 7 | 8 | #ifndef EIGEN_QR_MODULE_H 9 | #define EIGEN_QR_MODULE_H 10 | 11 | #include "Core" 12 | 13 | #include "Cholesky" 14 | #include "Jacobi" 15 | #include "Householder" 16 | 17 | #include "src/Core/util/DisableStupidWarnings.h" 18 | 19 | /** \defgroup QR_Module QR module 20 | * 21 | * 22 | * 23 | * This module provides various QR decompositions 24 | * This module also provides some MatrixBase methods, including: 25 | * - MatrixBase::householderQr() 26 | * - MatrixBase::colPivHouseholderQr() 27 | * - MatrixBase::fullPivHouseholderQr() 28 | * 29 | * \code 30 | * #include 31 | * \endcode 32 | */ 33 | 34 | #include "src/QR/HouseholderQR.h" 35 | #include "src/QR/FullPivHouseholderQR.h" 36 | #include "src/QR/ColPivHouseholderQR.h" 37 | #include "src/QR/CompleteOrthogonalDecomposition.h" 38 | #ifdef EIGEN_USE_LAPACKE 39 | #ifdef EIGEN_USE_MKL 40 | #include "mkl_lapacke.h" 41 | #else 42 | #include "src/misc/lapacke.h" 43 | #endif 44 | #include "src/QR/HouseholderQR_LAPACKE.h" 45 | #include "src/QR/ColPivHouseholderQR_LAPACKE.h" 46 | #endif 47 | 48 | #include "src/Core/util/ReenableStupidWarnings.h" 49 | 50 | #endif // EIGEN_QR_MODULE_H 51 | /* vim: set filetype=cpp et sw=2 ts=2 ai: */ 52 | -------------------------------------------------------------------------------- /include/Eigen/QtAlignedMalloc: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // This Source Code Form is subject to the terms of the Mozilla 5 | // Public License v. 2.0. If a copy of the MPL was not distributed 6 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 7 | 8 | #ifndef EIGEN_QTMALLOC_MODULE_H 9 | #define EIGEN_QTMALLOC_MODULE_H 10 | 11 | #include "Core" 12 | 13 | #if (!EIGEN_MALLOC_ALREADY_ALIGNED) 14 | 15 | #include "src/Core/util/DisableStupidWarnings.h" 16 | 17 | void *qMalloc(std::size_t size) 18 | { 19 | return Eigen::internal::aligned_malloc(size); 20 | } 21 | 22 | void qFree(void *ptr) 23 | { 24 | Eigen::internal::aligned_free(ptr); 25 | } 26 | 27 | void *qRealloc(void *ptr, std::size_t size) 28 | { 29 | void* newPtr = Eigen::internal::aligned_malloc(size); 30 | std::memcpy(newPtr, ptr, size); 31 | Eigen::internal::aligned_free(ptr); 32 | return newPtr; 33 | } 34 | 35 | #include "src/Core/util/ReenableStupidWarnings.h" 36 | 37 | #endif 38 | 39 | #endif // EIGEN_QTMALLOC_MODULE_H 40 | /* vim: set filetype=cpp et sw=2 ts=2 ai: */ 41 | -------------------------------------------------------------------------------- /include/Eigen/SPQRSupport: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // This Source Code Form is subject to the terms of the Mozilla 5 | // Public License v. 2.0. If a copy of the MPL was not distributed 6 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 7 | 8 | #ifndef EIGEN_SPQRSUPPORT_MODULE_H 9 | #define EIGEN_SPQRSUPPORT_MODULE_H 10 | 11 | #include "SparseCore" 12 | 13 | #include "src/Core/util/DisableStupidWarnings.h" 14 | 15 | #include "SuiteSparseQR.hpp" 16 | 17 | /** \ingroup Support_modules 18 | * \defgroup SPQRSupport_Module SuiteSparseQR module 19 | * 20 | * This module provides an interface to the SPQR library, which is part of the suitesparse package. 21 | * 22 | * \code 23 | * #include 24 | * \endcode 25 | * 26 | * 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,...). 27 | * For a cmake based project, you can use our FindSPQR.cmake and FindCholmod.Cmake modules 28 | * 29 | */ 30 | 31 | #include "src/CholmodSupport/CholmodSupport.h" 32 | #include "src/SPQRSupport/SuiteSparseQRSupport.h" 33 | 34 | #endif 35 | -------------------------------------------------------------------------------- /include/Eigen/SVD: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // This Source Code Form is subject to the terms of the Mozilla 5 | // Public License v. 2.0. If a copy of the MPL was not distributed 6 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 7 | 8 | #ifndef EIGEN_SVD_MODULE_H 9 | #define EIGEN_SVD_MODULE_H 10 | 11 | #include "QR" 12 | #include "Householder" 13 | #include "Jacobi" 14 | 15 | #include "src/Core/util/DisableStupidWarnings.h" 16 | 17 | /** \defgroup SVD_Module SVD module 18 | * 19 | * 20 | * 21 | * This module provides SVD decomposition for matrices (both real and complex). 22 | * Two decomposition algorithms are provided: 23 | * - JacobiSVD implementing two-sided Jacobi iterations is numerically very accurate, fast for small matrices, but very slow for larger ones. 24 | * - BDCSVD implementing a recursive divide & conquer strategy on top of an upper-bidiagonalization which remains fast for large problems. 25 | * These decompositions are accessible via the respective classes and following MatrixBase methods: 26 | * - MatrixBase::jacobiSvd() 27 | * - MatrixBase::bdcSvd() 28 | * 29 | * \code 30 | * #include 31 | * \endcode 32 | */ 33 | 34 | #include "src/misc/RealSvd2x2.h" 35 | #include "src/SVD/UpperBidiagonalization.h" 36 | #include "src/SVD/SVDBase.h" 37 | #include "src/SVD/JacobiSVD.h" 38 | #include "src/SVD/BDCSVD.h" 39 | #if defined(EIGEN_USE_LAPACKE) && !defined(EIGEN_USE_LAPACKE_STRICT) 40 | #ifdef EIGEN_USE_MKL 41 | #include "mkl_lapacke.h" 42 | #else 43 | #include "src/misc/lapacke.h" 44 | #endif 45 | #include "src/SVD/JacobiSVD_LAPACKE.h" 46 | #endif 47 | 48 | #include "src/Core/util/ReenableStupidWarnings.h" 49 | 50 | #endif // EIGEN_SVD_MODULE_H 51 | /* vim: set filetype=cpp et sw=2 ts=2 ai: */ 52 | -------------------------------------------------------------------------------- /include/Eigen/Sparse: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // This Source Code Form is subject to the terms of the Mozilla 5 | // Public License v. 2.0. If a copy of the MPL was not distributed 6 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 7 | 8 | #ifndef EIGEN_SPARSE_MODULE_H 9 | #define EIGEN_SPARSE_MODULE_H 10 | 11 | /** \defgroup Sparse_Module Sparse meta-module 12 | * 13 | * Meta-module including all related modules: 14 | * - \ref SparseCore_Module 15 | * - \ref OrderingMethods_Module 16 | * - \ref SparseCholesky_Module 17 | * - \ref SparseLU_Module 18 | * - \ref SparseQR_Module 19 | * - \ref IterativeLinearSolvers_Module 20 | * 21 | \code 22 | #include 23 | \endcode 24 | */ 25 | 26 | #include "SparseCore" 27 | #include "OrderingMethods" 28 | #ifndef EIGEN_MPL2_ONLY 29 | #include "SparseCholesky" 30 | #endif 31 | #include "SparseLU" 32 | #include "SparseQR" 33 | #include "IterativeLinearSolvers" 34 | 35 | #endif // EIGEN_SPARSE_MODULE_H 36 | 37 | -------------------------------------------------------------------------------- /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/SparseCholesky/SimplicialCholesky.h" 38 | 39 | #ifndef EIGEN_MPL2_ONLY 40 | #include "src/SparseCholesky/SimplicialCholesky_impl.h" 41 | #endif 42 | 43 | #include "src/Core/util/ReenableStupidWarnings.h" 44 | 45 | #endif // EIGEN_SPARSECHOLESKY_MODULE_H 46 | -------------------------------------------------------------------------------- /include/Eigen/SparseCore: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // This Source Code Form is subject to the terms of the Mozilla 5 | // Public License v. 2.0. If a copy of the MPL was not distributed 6 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 7 | 8 | #ifndef EIGEN_SPARSECORE_MODULE_H 9 | #define EIGEN_SPARSECORE_MODULE_H 10 | 11 | #include "Core" 12 | 13 | #include "src/Core/util/DisableStupidWarnings.h" 14 | 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | 21 | /** 22 | * \defgroup SparseCore_Module SparseCore module 23 | * 24 | * This module provides a sparse matrix representation, and basic associated matrix manipulations 25 | * and operations. 26 | * 27 | * See the \ref TutorialSparse "Sparse tutorial" 28 | * 29 | * \code 30 | * #include 31 | * \endcode 32 | * 33 | * This module depends on: Core. 34 | */ 35 | 36 | #include "src/SparseCore/SparseUtil.h" 37 | #include "src/SparseCore/SparseMatrixBase.h" 38 | #include "src/SparseCore/SparseAssign.h" 39 | #include "src/SparseCore/CompressedStorage.h" 40 | #include "src/SparseCore/AmbiVector.h" 41 | #include "src/SparseCore/SparseCompressedBase.h" 42 | #include "src/SparseCore/SparseMatrix.h" 43 | #include "src/SparseCore/SparseMap.h" 44 | #include "src/SparseCore/MappedSparseMatrix.h" 45 | #include "src/SparseCore/SparseVector.h" 46 | #include "src/SparseCore/SparseRef.h" 47 | #include "src/SparseCore/SparseCwiseUnaryOp.h" 48 | #include "src/SparseCore/SparseCwiseBinaryOp.h" 49 | #include "src/SparseCore/SparseTranspose.h" 50 | #include "src/SparseCore/SparseBlock.h" 51 | #include "src/SparseCore/SparseDot.h" 52 | #include "src/SparseCore/SparseRedux.h" 53 | #include "src/SparseCore/SparseView.h" 54 | #include "src/SparseCore/SparseDiagonalProduct.h" 55 | #include "src/SparseCore/ConservativeSparseSparseProduct.h" 56 | #include "src/SparseCore/SparseSparseProductWithPruning.h" 57 | #include "src/SparseCore/SparseProduct.h" 58 | #include "src/SparseCore/SparseDenseProduct.h" 59 | #include "src/SparseCore/SparseSelfAdjointView.h" 60 | #include "src/SparseCore/SparseTriangularView.h" 61 | #include "src/SparseCore/TriangularSolver.h" 62 | #include "src/SparseCore/SparsePermutation.h" 63 | #include "src/SparseCore/SparseFuzzy.h" 64 | #include "src/SparseCore/SparseSolverBase.h" 65 | 66 | #include "src/Core/util/ReenableStupidWarnings.h" 67 | 68 | #endif // EIGEN_SPARSECORE_MODULE_H 69 | 70 | -------------------------------------------------------------------------------- /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 | // Ordering interface 24 | #include "OrderingMethods" 25 | 26 | #include "src/Core/util/DisableStupidWarnings.h" 27 | 28 | #include "src/SparseLU/SparseLU_gemm_kernel.h" 29 | 30 | #include "src/SparseLU/SparseLU_Structs.h" 31 | #include "src/SparseLU/SparseLU_SupernodalMatrix.h" 32 | #include "src/SparseLU/SparseLUImpl.h" 33 | #include "src/SparseCore/SparseColEtree.h" 34 | #include "src/SparseLU/SparseLU_Memory.h" 35 | #include "src/SparseLU/SparseLU_heap_relax_snode.h" 36 | #include "src/SparseLU/SparseLU_relax_snode.h" 37 | #include "src/SparseLU/SparseLU_pivotL.h" 38 | #include "src/SparseLU/SparseLU_panel_dfs.h" 39 | #include "src/SparseLU/SparseLU_kernel_bmod.h" 40 | #include "src/SparseLU/SparseLU_panel_bmod.h" 41 | #include "src/SparseLU/SparseLU_column_dfs.h" 42 | #include "src/SparseLU/SparseLU_column_bmod.h" 43 | #include "src/SparseLU/SparseLU_copy_to_ucol.h" 44 | #include "src/SparseLU/SparseLU_pruneL.h" 45 | #include "src/SparseLU/SparseLU_Utils.h" 46 | #include "src/SparseLU/SparseLU.h" 47 | 48 | #include "src/Core/util/ReenableStupidWarnings.h" 49 | 50 | #endif // EIGEN_SPARSELU_MODULE_H 51 | -------------------------------------------------------------------------------- /include/Eigen/SparseQR: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // This Source Code Form is subject to the terms of the Mozilla 5 | // Public License v. 2.0. If a copy of the MPL was not distributed 6 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 7 | 8 | #ifndef EIGEN_SPARSEQR_MODULE_H 9 | #define EIGEN_SPARSEQR_MODULE_H 10 | 11 | #include "SparseCore" 12 | #include "OrderingMethods" 13 | #include "src/Core/util/DisableStupidWarnings.h" 14 | 15 | /** \defgroup SparseQR_Module SparseQR module 16 | * \brief Provides QR decomposition for sparse matrices 17 | * 18 | * This module provides a simplicial version of the left-looking Sparse QR decomposition. 19 | * The columns of the input matrix should be reordered to limit the fill-in during the 20 | * decomposition. Built-in methods (COLAMD, AMD) or external methods (METIS) can be used to this end. 21 | * See the \link OrderingMethods_Module OrderingMethods\endlink module for the list 22 | * of built-in and external ordering methods. 23 | * 24 | * \code 25 | * #include 26 | * \endcode 27 | * 28 | * 29 | */ 30 | 31 | #include "src/SparseCore/SparseColEtree.h" 32 | #include "src/SparseQR/SparseQR.h" 33 | 34 | #include "src/Core/util/ReenableStupidWarnings.h" 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /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 EIGEN_COMP_MSVC && EIGEN_OS_WIN64 && (EIGEN_MAX_STATIC_ALIGN_BYTES<=16) /* MSVC auto aligns up to 16 bytes 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 EIGEN_COMP_MSVC && EIGEN_OS_WIN64 && (EIGEN_MAX_STATIC_ALIGN_BYTES<=16) /* MSVC auto aligns up to 16 bytes 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 EIGEN_COMP_MSVC && EIGEN_OS_WIN64 && (EIGEN_MAX_STATIC_ALIGN_BYTES<=16) /* MSVC auto aligns up to 16 bytes 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 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // This Source Code Form is subject to the terms of the Mozilla 5 | // Public License v. 2.0. If a copy of the MPL was not distributed 6 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 7 | 8 | #ifndef EIGEN_SUPERLUSUPPORT_MODULE_H 9 | #define EIGEN_SUPERLUSUPPORT_MODULE_H 10 | 11 | #include "SparseCore" 12 | 13 | #include "src/Core/util/DisableStupidWarnings.h" 14 | 15 | #ifdef EMPTY 16 | #define EIGEN_EMPTY_WAS_ALREADY_DEFINED 17 | #endif 18 | 19 | typedef int int_t; 20 | #include 21 | #include 22 | #include 23 | 24 | // slu_util.h defines a preprocessor token named EMPTY which is really polluting, 25 | // so we remove it in favor of a SUPERLU_EMPTY token. 26 | // If EMPTY was already defined then we don't undef it. 27 | 28 | #if defined(EIGEN_EMPTY_WAS_ALREADY_DEFINED) 29 | # undef EIGEN_EMPTY_WAS_ALREADY_DEFINED 30 | #elif defined(EMPTY) 31 | # undef EMPTY 32 | #endif 33 | 34 | #define SUPERLU_EMPTY (-1) 35 | 36 | namespace Eigen { struct SluMatrix; } 37 | 38 | /** \ingroup Support_modules 39 | * \defgroup SuperLUSupport_Module SuperLUSupport module 40 | * 41 | * This module provides an interface to the SuperLU library. 42 | * It provides the following factorization class: 43 | * - class SuperLU: a supernodal sequential LU factorization. 44 | * - class SuperILU: a supernodal sequential incomplete LU factorization (to be used as a preconditioner for iterative methods). 45 | * 46 | * \warning This wrapper requires at least versions 4.0 of SuperLU. The 3.x versions are not supported. 47 | * 48 | * \warning When including this module, you have to use SUPERLU_EMPTY instead of EMPTY which is no longer defined because it is too polluting. 49 | * 50 | * \code 51 | * #include 52 | * \endcode 53 | * 54 | * 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. 55 | * The dependencies depend on how superlu has been compiled. 56 | * For a cmake based project, you can use our FindSuperLU.cmake module to help you in this task. 57 | * 58 | */ 59 | 60 | #include "src/SuperLUSupport/SuperLUSupport.h" 61 | 62 | #include "src/Core/util/ReenableStupidWarnings.h" 63 | 64 | #endif // EIGEN_SUPERLUSUPPORT_MODULE_H 65 | -------------------------------------------------------------------------------- /include/Eigen/UmfPackSupport: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // This Source Code Form is subject to the terms of the Mozilla 5 | // Public License v. 2.0. If a copy of the MPL was not distributed 6 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 7 | 8 | #ifndef EIGEN_UMFPACKSUPPORT_MODULE_H 9 | #define EIGEN_UMFPACKSUPPORT_MODULE_H 10 | 11 | #include "SparseCore" 12 | 13 | #include "src/Core/util/DisableStupidWarnings.h" 14 | 15 | extern "C" { 16 | #include 17 | } 18 | 19 | /** \ingroup Support_modules 20 | * \defgroup UmfPackSupport_Module UmfPackSupport module 21 | * 22 | * This module provides an interface to the UmfPack library which is part of the suitesparse package. 23 | * It provides the following factorization class: 24 | * - class UmfPackLU: a multifrontal sequential LU factorization. 25 | * 26 | * \code 27 | * #include 28 | * \endcode 29 | * 30 | * 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. 31 | * The dependencies depend on how umfpack has been compiled. 32 | * For a cmake based project, you can use our FindUmfPack.cmake module to help you in this task. 33 | * 34 | */ 35 | 36 | #include "src/UmfPackSupport/UmfPackSupport.h" 37 | 38 | #include "src/Core/util/ReenableStupidWarnings.h" 39 | 40 | #endif // EIGEN_UMFPACKSUPPORT_MODULE_H 41 | -------------------------------------------------------------------------------- /include/Eigen/src/Core/DiagonalProduct.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) 2007-2009 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_DIAGONALPRODUCT_H 12 | #define EIGEN_DIAGONALPRODUCT_H 13 | 14 | namespace Eigen { 15 | 16 | /** \returns the diagonal matrix product of \c *this by the diagonal matrix \a diagonal. 17 | */ 18 | template 19 | template 20 | EIGEN_DEVICE_FUNC inline const Product 21 | MatrixBase::operator*(const DiagonalBase &a_diagonal) const 22 | { 23 | return Product(derived(),a_diagonal.derived()); 24 | } 25 | 26 | } // end namespace Eigen 27 | 28 | #endif // EIGEN_DIAGONALPRODUCT_H 29 | -------------------------------------------------------------------------------- /include/Eigen/src/Core/SelfCwiseBinaryOp.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 | // 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_SELFCWISEBINARYOP_H 11 | #define EIGEN_SELFCWISEBINARYOP_H 12 | 13 | namespace Eigen { 14 | 15 | // TODO generalize the scalar type of 'other' 16 | 17 | template 18 | EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& DenseBase::operator*=(const Scalar& other) 19 | { 20 | internal::call_assignment(this->derived(), PlainObject::Constant(rows(),cols(),other), internal::mul_assign_op()); 21 | return derived(); 22 | } 23 | 24 | template 25 | EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& ArrayBase::operator+=(const Scalar& other) 26 | { 27 | internal::call_assignment(this->derived(), PlainObject::Constant(rows(),cols(),other), internal::add_assign_op()); 28 | return derived(); 29 | } 30 | 31 | template 32 | EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& ArrayBase::operator-=(const Scalar& other) 33 | { 34 | internal::call_assignment(this->derived(), PlainObject::Constant(rows(),cols(),other), internal::sub_assign_op()); 35 | return derived(); 36 | } 37 | 38 | template 39 | EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& DenseBase::operator/=(const Scalar& other) 40 | { 41 | internal::call_assignment(this->derived(), PlainObject::Constant(rows(),cols(),other), internal::div_assign_op()); 42 | return derived(); 43 | } 44 | 45 | } // end namespace Eigen 46 | 47 | #endif // EIGEN_SELFCWISEBINARYOP_H 48 | -------------------------------------------------------------------------------- /include/Eigen/src/Core/arch/AVX/TypeCasting.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2015 Benoit Steiner 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_TYPE_CASTING_AVX_H 11 | #define EIGEN_TYPE_CASTING_AVX_H 12 | 13 | namespace Eigen { 14 | 15 | namespace internal { 16 | 17 | // For now we use SSE to handle integers, so we can't use AVX instructions to cast 18 | // from int to float 19 | template <> 20 | struct type_casting_traits { 21 | enum { 22 | VectorizedCast = 0, 23 | SrcCoeffRatio = 1, 24 | TgtCoeffRatio = 1 25 | }; 26 | }; 27 | 28 | template <> 29 | struct type_casting_traits { 30 | enum { 31 | VectorizedCast = 0, 32 | SrcCoeffRatio = 1, 33 | TgtCoeffRatio = 1 34 | }; 35 | }; 36 | 37 | 38 | 39 | template<> EIGEN_STRONG_INLINE Packet8i pcast(const Packet8f& a) { 40 | return _mm256_cvttps_epi32(a); 41 | } 42 | 43 | template<> EIGEN_STRONG_INLINE Packet8f pcast(const Packet8i& a) { 44 | return _mm256_cvtepi32_ps(a); 45 | } 46 | 47 | template<> EIGEN_STRONG_INLINE Packet8i preinterpret(const Packet8f& a) { 48 | return _mm256_castps_si256(a); 49 | } 50 | 51 | template<> EIGEN_STRONG_INLINE Packet8f preinterpret(const Packet8i& a) { 52 | return _mm256_castsi256_ps(a); 53 | } 54 | 55 | } // end namespace internal 56 | 57 | } // end namespace Eigen 58 | 59 | #endif // EIGEN_TYPE_CASTING_AVX_H 60 | -------------------------------------------------------------------------------- /include/Eigen/src/Core/arch/AltiVec/MathFunctions.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2007 Julien Pommier 5 | // Copyright (C) 2009 Gael Guennebaud 6 | // Copyright (C) 2016 Konstantinos Margaritis 7 | // 8 | // This Source Code Form is subject to the terms of the Mozilla 9 | // Public License v. 2.0. If a copy of the MPL was not distributed 10 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 11 | 12 | #ifndef EIGEN_MATH_FUNCTIONS_ALTIVEC_H 13 | #define EIGEN_MATH_FUNCTIONS_ALTIVEC_H 14 | 15 | #include "../Default/GenericPacketMathFunctions.h" 16 | 17 | namespace Eigen { 18 | 19 | namespace internal { 20 | 21 | template<> EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS EIGEN_UNUSED 22 | Packet4f plog(const Packet4f& _x) 23 | { 24 | return plog_float(_x); 25 | } 26 | 27 | template<> EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS EIGEN_UNUSED 28 | Packet4f pexp(const Packet4f& _x) 29 | { 30 | return pexp_float(_x); 31 | } 32 | 33 | #ifndef EIGEN_COMP_CLANG 34 | template<> EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS EIGEN_UNUSED 35 | Packet4f prsqrt(const Packet4f& x) 36 | { 37 | return vec_rsqrt(x); 38 | } 39 | #endif 40 | 41 | #ifdef __VSX__ 42 | #ifndef EIGEN_COMP_CLANG 43 | template<> EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS EIGEN_UNUSED 44 | Packet2d prsqrt(const Packet2d& x) 45 | { 46 | return vec_rsqrt(x); 47 | } 48 | #endif 49 | 50 | template<> EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS EIGEN_UNUSED 51 | Packet4f psqrt(const Packet4f& x) 52 | { 53 | return vec_sqrt(x); 54 | } 55 | 56 | template<> EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS EIGEN_UNUSED 57 | Packet2d psqrt(const Packet2d& x) 58 | { 59 | return vec_sqrt(x); 60 | } 61 | 62 | template<> EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS EIGEN_UNUSED 63 | Packet2d pexp(const Packet2d& _x) 64 | { 65 | return pexp_double(_x); 66 | } 67 | #endif 68 | 69 | } // end namespace internal 70 | 71 | } // end namespace Eigen 72 | 73 | #endif // EIGEN_MATH_FUNCTIONS_ALTIVEC_H 74 | -------------------------------------------------------------------------------- /include/Eigen/src/Core/arch/Default/ConjHelper.h: -------------------------------------------------------------------------------- 1 | 2 | // This file is part of Eigen, a lightweight C++ template library 3 | // for linear algebra. 4 | // 5 | // Copyright (C) 2017 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_ARCH_CONJ_HELPER_H 12 | #define EIGEN_ARCH_CONJ_HELPER_H 13 | 14 | #define EIGEN_MAKE_CONJ_HELPER_CPLX_REAL(PACKET_CPLX, PACKET_REAL) \ 15 | template<> struct conj_helper { \ 16 | EIGEN_STRONG_INLINE PACKET_CPLX pmadd(const PACKET_REAL& x, const PACKET_CPLX& y, const PACKET_CPLX& c) const \ 17 | { return padd(c, pmul(x,y)); } \ 18 | EIGEN_STRONG_INLINE PACKET_CPLX pmul(const PACKET_REAL& x, const PACKET_CPLX& y) const \ 19 | { return PACKET_CPLX(Eigen::internal::pmul(x, y.v)); } \ 20 | }; \ 21 | \ 22 | template<> struct conj_helper { \ 23 | EIGEN_STRONG_INLINE PACKET_CPLX pmadd(const PACKET_CPLX& x, const PACKET_REAL& y, const PACKET_CPLX& c) const \ 24 | { return padd(c, pmul(x,y)); } \ 25 | EIGEN_STRONG_INLINE PACKET_CPLX pmul(const PACKET_CPLX& x, const PACKET_REAL& y) const \ 26 | { return PACKET_CPLX(Eigen::internal::pmul(x.v, y)); } \ 27 | }; 28 | 29 | #endif // EIGEN_ARCH_CONJ_HELPER_H 30 | -------------------------------------------------------------------------------- /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/HIP/hcc/math_constants.h: -------------------------------------------------------------------------------- 1 | /* 2 | * math_constants.h - 3 | * HIP equivalent of the CUDA header of the same name 4 | */ 5 | 6 | #ifndef __MATH_CONSTANTS_H__ 7 | #define __MATH_CONSTANTS_H__ 8 | 9 | /* single precision constants */ 10 | 11 | #define HIPRT_INF_F __int_as_float(0x7f800000) 12 | #define HIPRT_NAN_F __int_as_float(0x7fffffff) 13 | #define HIPRT_MIN_DENORM_F __int_as_float(0x00000001) 14 | #define HIPRT_MAX_NORMAL_F __int_as_float(0x7f7fffff) 15 | #define HIPRT_NEG_ZERO_F __int_as_float(0x80000000) 16 | #define HIPRT_ZERO_F 0.0f 17 | #define HIPRT_ONE_F 1.0f 18 | 19 | /* double precision constants */ 20 | #define HIPRT_INF __hiloint2double(0x7ff00000, 0x00000000) 21 | #define HIPRT_NAN __hiloint2double(0xfff80000, 0x00000000) 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /include/Eigen/src/Core/arch/NEON/MathFunctions.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // This Source Code Form is subject to the terms of the Mozilla 5 | // Public License v. 2.0. If a copy of the MPL was not distributed 6 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 7 | 8 | #ifndef EIGEN_MATH_FUNCTIONS_NEON_H 9 | #define EIGEN_MATH_FUNCTIONS_NEON_H 10 | 11 | #include "../Default/GenericPacketMathFunctions.h" 12 | 13 | namespace Eigen { 14 | 15 | namespace internal { 16 | 17 | template<> EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS EIGEN_UNUSED 18 | Packet4f pexp(const Packet4f& _x) 19 | { 20 | return pexp_float(_x); 21 | } 22 | 23 | template<> EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS EIGEN_UNUSED 24 | Packet4f plog(const Packet4f& _x) 25 | { 26 | return plog_float(_x); 27 | } 28 | 29 | } // end namespace internal 30 | 31 | } // end namespace Eigen 32 | 33 | #endif // EIGEN_MATH_FUNCTIONS_NEON_H 34 | -------------------------------------------------------------------------------- /include/Eigen/src/Core/arch/NEON/TypeCasting.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2018 Rasmus Munk Larsen 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_TYPE_CASTING_NEON_H 11 | #define EIGEN_TYPE_CASTING_NEON_H 12 | 13 | namespace Eigen { 14 | 15 | namespace internal { 16 | 17 | template <> 18 | struct type_casting_traits { 19 | enum { 20 | VectorizedCast = 1, 21 | SrcCoeffRatio = 1, 22 | TgtCoeffRatio = 1 23 | }; 24 | }; 25 | 26 | template <> 27 | struct type_casting_traits { 28 | enum { 29 | VectorizedCast = 1, 30 | SrcCoeffRatio = 1, 31 | TgtCoeffRatio = 1 32 | }; 33 | }; 34 | 35 | 36 | template<> EIGEN_STRONG_INLINE Packet4i pcast(const Packet4f& a) { 37 | return vcvtq_s32_f32(a); 38 | } 39 | 40 | template<> EIGEN_STRONG_INLINE Packet4f pcast(const Packet4i& a) { 41 | return vcvtq_f32_s32(a); 42 | } 43 | 44 | template<> EIGEN_STRONG_INLINE Packet4i preinterpret(const Packet4f& a) { 45 | return vreinterpretq_s32_f32(a); 46 | } 47 | 48 | template<> EIGEN_STRONG_INLINE Packet4f preinterpret(const Packet4i& a) { 49 | return vreinterpretq_f32_s32(a); 50 | } 51 | 52 | } // end namespace internal 53 | 54 | } // end namespace Eigen 55 | 56 | #endif // EIGEN_TYPE_CASTING_NEON_H 57 | -------------------------------------------------------------------------------- /include/Eigen/src/Core/arch/SSE/TypeCasting.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2015 Benoit Steiner 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_TYPE_CASTING_SSE_H 11 | #define EIGEN_TYPE_CASTING_SSE_H 12 | 13 | namespace Eigen { 14 | 15 | namespace internal { 16 | 17 | #ifndef EIGEN_VECTORIZE_AVX 18 | template <> 19 | struct type_casting_traits { 20 | enum { 21 | VectorizedCast = 1, 22 | SrcCoeffRatio = 1, 23 | TgtCoeffRatio = 1 24 | }; 25 | }; 26 | 27 | template <> 28 | struct type_casting_traits { 29 | enum { 30 | VectorizedCast = 1, 31 | SrcCoeffRatio = 1, 32 | TgtCoeffRatio = 1 33 | }; 34 | }; 35 | 36 | template <> 37 | struct type_casting_traits { 38 | enum { 39 | VectorizedCast = 1, 40 | SrcCoeffRatio = 2, 41 | TgtCoeffRatio = 1 42 | }; 43 | }; 44 | 45 | template <> 46 | struct type_casting_traits { 47 | enum { 48 | VectorizedCast = 1, 49 | SrcCoeffRatio = 1, 50 | TgtCoeffRatio = 2 51 | }; 52 | }; 53 | #endif 54 | 55 | template<> EIGEN_STRONG_INLINE Packet4i pcast(const Packet4f& a) { 56 | return _mm_cvttps_epi32(a); 57 | } 58 | 59 | template<> EIGEN_STRONG_INLINE Packet4f pcast(const Packet4i& a) { 60 | return _mm_cvtepi32_ps(a); 61 | } 62 | 63 | template<> EIGEN_STRONG_INLINE Packet4f pcast(const Packet2d& a, const Packet2d& b) { 64 | return _mm_shuffle_ps(_mm_cvtpd_ps(a), _mm_cvtpd_ps(b), (1 << 2) | (1 << 6)); 65 | } 66 | 67 | template<> EIGEN_STRONG_INLINE Packet2d pcast(const Packet4f& a) { 68 | // Simply discard the second half of the input 69 | return _mm_cvtps_pd(a); 70 | } 71 | 72 | template<> EIGEN_STRONG_INLINE Packet4i preinterpret(const Packet4f& a) { 73 | return _mm_castps_si128(a); 74 | } 75 | 76 | template<> EIGEN_STRONG_INLINE Packet4f preinterpret(const Packet4i& a) { 77 | return _mm_castsi128_ps(a); 78 | } 79 | 80 | } // end namespace internal 81 | 82 | } // end namespace Eigen 83 | 84 | #endif // EIGEN_TYPE_CASTING_SSE_H 85 | -------------------------------------------------------------------------------- /include/Eigen/src/Core/functors/TernaryFunctors.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2016 Eugene Brevdo 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_TERNARY_FUNCTORS_H 11 | #define EIGEN_TERNARY_FUNCTORS_H 12 | 13 | namespace Eigen { 14 | 15 | namespace internal { 16 | 17 | //---------- associative ternary functors ---------- 18 | 19 | 20 | 21 | } // end namespace internal 22 | 23 | } // end namespace Eigen 24 | 25 | #endif // EIGEN_TERNARY_FUNCTORS_H 26 | -------------------------------------------------------------------------------- /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 2 | // "DisableStupidWarnings.h" was included twice recursively: Do not reenable warnings yet! 3 | # undef EIGEN_WARNINGS_DISABLED_2 4 | 5 | #elif defined(EIGEN_WARNINGS_DISABLED) 6 | #undef EIGEN_WARNINGS_DISABLED 7 | 8 | #ifndef EIGEN_PERMANENTLY_DISABLE_STUPID_WARNINGS 9 | #ifdef _MSC_VER 10 | #pragma warning( pop ) 11 | #elif defined __INTEL_COMPILER 12 | #pragma warning pop 13 | #elif defined __clang__ 14 | #pragma clang diagnostic pop 15 | #elif defined __GNUC__ && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) 16 | #pragma GCC diagnostic pop 17 | #endif 18 | 19 | #if defined __NVCC__ 20 | // Don't reenable the diagnostic messages, as it turns out these messages need 21 | // to be disabled at the point of the template instantiation (i.e the user code) 22 | // otherwise they'll be triggered by nvcc. 23 | // #pragma diag_default code_is_unreachable 24 | // #pragma diag_default initialization_not_reachable 25 | // #pragma diag_default 2651 26 | // #pragma diag_default 2653 27 | #endif 28 | 29 | #endif 30 | 31 | #endif // EIGEN_WARNINGS_DISABLED 32 | -------------------------------------------------------------------------------- /include/Eigen/src/Core/util/ReshapedHelper.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2017 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 | 11 | #ifndef EIGEN_RESHAPED_HELPER_H 12 | #define EIGEN_RESHAPED_HELPER_H 13 | 14 | namespace Eigen { 15 | 16 | enum AutoSize_t { AutoSize }; 17 | const int AutoOrder = 2; 18 | 19 | namespace internal { 20 | 21 | template 22 | struct get_compiletime_reshape_size { 23 | enum { value = get_fixed_value::value }; 24 | }; 25 | 26 | template 27 | Index get_runtime_reshape_size(SizeType size, Index /*other*/, Index /*total*/) { 28 | return internal::get_runtime_value(size); 29 | } 30 | 31 | template 32 | struct get_compiletime_reshape_size { 33 | enum { 34 | other_size = get_fixed_value::value, 35 | value = (TotalSize==Dynamic || other_size==Dynamic) ? Dynamic : TotalSize / other_size }; 36 | }; 37 | 38 | inline Index get_runtime_reshape_size(AutoSize_t /*size*/, Index other, Index total) { 39 | return total/other; 40 | } 41 | 42 | template 43 | struct get_compiletime_reshape_order { 44 | enum { value = Order == AutoOrder ? Flags & RowMajorBit : Order }; 45 | }; 46 | 47 | } 48 | 49 | } // end namespace Eigen 50 | 51 | #endif // EIGEN_RESHAPED_HELPER_H 52 | -------------------------------------------------------------------------------- /include/Eigen/src/SparseCore/MappedSparseMatrix.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2008-2014 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_MAPPED_SPARSEMATRIX_H 11 | #define EIGEN_MAPPED_SPARSEMATRIX_H 12 | 13 | namespace Eigen { 14 | 15 | /** \deprecated Use Map > 16 | * \class MappedSparseMatrix 17 | * 18 | * \brief Sparse matrix 19 | * 20 | * \param _Scalar the scalar type, i.e. the type of the coefficients 21 | * 22 | * See http://www.netlib.org/linalg/html_templates/node91.html for details on the storage scheme. 23 | * 24 | */ 25 | namespace internal { 26 | template 27 | struct traits > : traits > 28 | {}; 29 | } // end namespace internal 30 | 31 | template 32 | class MappedSparseMatrix 33 | : public Map > 34 | { 35 | typedef Map > Base; 36 | 37 | public: 38 | 39 | typedef typename Base::StorageIndex StorageIndex; 40 | typedef typename Base::Scalar Scalar; 41 | 42 | inline MappedSparseMatrix(Index rows, Index cols, Index nnz, StorageIndex* outerIndexPtr, StorageIndex* innerIndexPtr, Scalar* valuePtr, StorageIndex* innerNonZeroPtr = 0) 43 | : Base(rows, cols, nnz, outerIndexPtr, innerIndexPtr, valuePtr, innerNonZeroPtr) 44 | {} 45 | 46 | /** Empty destructor */ 47 | inline ~MappedSparseMatrix() {} 48 | }; 49 | 50 | namespace internal { 51 | 52 | template 53 | struct evaluator > 54 | : evaluator > > 55 | { 56 | typedef MappedSparseMatrix<_Scalar,_Options,_StorageIndex> XprType; 57 | typedef evaluator > Base; 58 | 59 | evaluator() : Base() {} 60 | explicit evaluator(const XprType &mat) : Base(mat) {} 61 | }; 62 | 63 | } 64 | 65 | } // end namespace Eigen 66 | 67 | #endif // EIGEN_MAPPED_SPARSEMATRIX_H 68 | -------------------------------------------------------------------------------- /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-2014 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 | namespace Eigen { 14 | 15 | template 16 | template 17 | bool SparseMatrixBase::isApprox(const SparseMatrixBase& other, const RealScalar &prec) const 18 | { 19 | const typename internal::nested_eval::type actualA(derived()); 20 | typename internal::conditional::type, 22 | const PlainObject>::type actualB(other.derived()); 23 | 24 | return (actualA - actualB).squaredNorm() <= prec * prec * numext::mini(actualA.squaredNorm(), actualB.squaredNorm()); 25 | } 26 | 27 | } // end namespace Eigen 28 | 29 | #endif // EIGEN_SPARSE_FUZZY_H 30 | -------------------------------------------------------------------------------- /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-2014 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 | internal::evaluator thisEval(derived()); 22 | for (Index j=0; j::InnerIterator iter(thisEval,j); iter; ++iter) 24 | res += iter.value(); 25 | return res; 26 | } 27 | 28 | template 29 | typename internal::traits >::Scalar 30 | SparseMatrix<_Scalar,_Options,_Index>::sum() const 31 | { 32 | eigen_assert(rows()>0 && cols()>0 && "you are using a non initialized matrix"); 33 | if(this->isCompressed()) 34 | return Matrix::Map(m_data.valuePtr(), m_data.size()).sum(); 35 | else 36 | return Base::sum(); 37 | } 38 | 39 | template 40 | typename internal::traits >::Scalar 41 | SparseVector<_Scalar,_Options,_Index>::sum() const 42 | { 43 | eigen_assert(rows()>0 && cols()>0 && "you are using a non initialized matrix"); 44 | return Matrix::Map(m_data.valuePtr(), m_data.size()).sum(); 45 | } 46 | 47 | } // end namespace Eigen 48 | 49 | #endif // EIGEN_SPARSEREDUX_H 50 | -------------------------------------------------------------------------------- /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 | StorageIndex 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/misc/RealSvd2x2.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2009-2010 Benoit Jacob 5 | // Copyright (C) 2013-2016 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_REALSVD2X2_H 12 | #define EIGEN_REALSVD2X2_H 13 | 14 | namespace Eigen { 15 | 16 | namespace internal { 17 | 18 | template 19 | void real_2x2_jacobi_svd(const MatrixType& matrix, Index p, Index q, 20 | JacobiRotation *j_left, 21 | JacobiRotation *j_right) 22 | { 23 | using std::sqrt; 24 | using std::abs; 25 | Matrix m; 26 | m << numext::real(matrix.coeff(p,p)), numext::real(matrix.coeff(p,q)), 27 | numext::real(matrix.coeff(q,p)), numext::real(matrix.coeff(q,q)); 28 | JacobiRotation rot1; 29 | RealScalar t = m.coeff(0,0) + m.coeff(1,1); 30 | RealScalar d = m.coeff(1,0) - m.coeff(0,1); 31 | 32 | if(abs(d) < (std::numeric_limits::min)()) 33 | { 34 | rot1.s() = RealScalar(0); 35 | rot1.c() = RealScalar(1); 36 | } 37 | else 38 | { 39 | // If d!=0, then t/d cannot overflow because the magnitude of the 40 | // entries forming d are not too small compared to the ones forming t. 41 | RealScalar u = t / d; 42 | RealScalar tmp = sqrt(RealScalar(1) + numext::abs2(u)); 43 | rot1.s() = RealScalar(1) / tmp; 44 | rot1.c() = u / tmp; 45 | } 46 | m.applyOnTheLeft(0,1,rot1); 47 | j_right->makeJacobi(m,0,1); 48 | *j_left = rot1 * j_right->transpose(); 49 | } 50 | 51 | } // end namespace internal 52 | 53 | } // end namespace Eigen 54 | 55 | #endif // EIGEN_REALSVD2X2_H 56 | -------------------------------------------------------------------------------- /include/Eigen/src/misc/lapacke_mangling.h: -------------------------------------------------------------------------------- 1 | #ifndef LAPACK_HEADER_INCLUDED 2 | #define LAPACK_HEADER_INCLUDED 3 | 4 | #ifndef LAPACK_GLOBAL 5 | #if defined(LAPACK_GLOBAL_PATTERN_LC) || defined(ADD_) 6 | #define LAPACK_GLOBAL(lcname,UCNAME) lcname##_ 7 | #elif defined(LAPACK_GLOBAL_PATTERN_UC) || defined(UPPER) 8 | #define LAPACK_GLOBAL(lcname,UCNAME) UCNAME 9 | #elif defined(LAPACK_GLOBAL_PATTERN_MC) || defined(NOCHANGE) 10 | #define LAPACK_GLOBAL(lcname,UCNAME) lcname 11 | #else 12 | #define LAPACK_GLOBAL(lcname,UCNAME) lcname##_ 13 | #endif 14 | #endif 15 | 16 | #endif 17 | 18 | -------------------------------------------------------------------------------- /include/binio.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #ifndef BINIO_H 4 | #define BINIO_H 5 | 6 | // #define EIGEN_USE_BLAS 7 | // #define EIGEN_USE_LAPACK 8 | 9 | #include 10 | 11 | 12 | // all the matrices or vectors are RowMajor 13 | namespace ionizing { 14 | class BinIO { 15 | public: 16 | BinIO(const char* FileName); 17 | ~BinIO(); 18 | // Prevent 'copying' operations. 19 | BinIO(const BinIO&) = delete; 20 | BinIO& operator=(const BinIO&) = delete; 21 | // change pointer focus 22 | void seek(const long n); 23 | int getFileSize() const; 24 | 25 | template 26 | T readElement(); 27 | 28 | template 29 | ColVecT readVectorCol(const long size); 30 | 31 | template 32 | RowVecT readVectorRow(const long size); 33 | 34 | template 35 | MatT readMatrix(const long nRow, const long nCol); 36 | 37 | private: 38 | std::ifstream ifs; 39 | std::ofstream ofs; 40 | int _fileSize; 41 | 42 | private: 43 | void _openFile(const char* FileName); 44 | 45 | }; // end of class BinIO 46 | }; 47 | 48 | 49 | namespace ionizing { 50 | 51 | template 52 | T BinIO::readElement() { 53 | long len = sizeof(T); 54 | T x; 55 | ifs.read((char*) &x, len); 56 | return x; 57 | } 58 | 59 | template 60 | MatT BinIO::readMatrix(const long nRow, const long nCol) { 61 | Matrix matrix(nRow, nCol); 62 | ifs.read((char*) matrix.data(), nRow * nCol * sizeof(T)); 63 | return matrix; 64 | } 65 | 66 | template 67 | ColVecT BinIO::readVectorCol(const long size) { 68 | return readMatrix(size, 1); 69 | } 70 | 71 | template 72 | RowVecT BinIO::readVectorRow(const long size) { 73 | return readMatrix(1, size); 74 | } 75 | 76 | 77 | } 78 | #endif // BINIO_H 79 | -------------------------------------------------------------------------------- /include/constants.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef CONSTANTS_H 3 | #define CONSTANTS_H 4 | 5 | #include 6 | #include 7 | 8 | namespace ionizing { 9 | static constexpr double AVOGADRO = 6.0221367E23; // Avogadro constant 10 | static constexpr double AU_TO_A = 0.529177249; // a.u. to angstrom 11 | static constexpr double BOHR_TO_ANG = 0.529177249; // Bohr radius to angstrom 12 | static constexpr double C_LIGHT = 137.037; // Light speed in a.u. 13 | static constexpr double CAL_TO_J = 4.1840; // Calorie in joule 14 | static constexpr double DEBYE = 3.336E-30; // Coulomb m 15 | static constexpr double EV_TO_J = 1.60217733E-19; // eV to J 16 | static constexpr double H_PLANCK = 6.6260755E-34; // Planck constant J s 17 | static constexpr double HATREE_TO_J = 4.3597482E18; // Hatree to joule 18 | static constexpr double K_B_EV = 8.6173857E-5; // Boltzmann constant in eV/K 19 | static constexpr double M_ELECT = 9.10938356E-31; // Mass of electron 20 | static constexpr double M_PROTON = 1.672621898E-27; // Mass of proton 21 | static constexpr double M_AU = 1.660539040E-27; // Unit mass in a.u. 22 | static constexpr double PI = 3.14159265358979323846; // Pi 23 | static constexpr double RY_TO_EV = 13.605693009; // Rydberg to eV 24 | 25 | static constexpr double EV_TO_KCAL = EV_TO_J * AVOGADRO / 1000 / CAL_TO_J; 26 | static constexpr double HBAR = H_PLANCK / PI / 2; 27 | static constexpr double HATREE_TO_KCAL = HATREE_TO_J * AVOGADRO / 100 / CAL_TO_J; 28 | static constexpr double K_B = K_B_EV * EV_TO_J; // Boltzmann constant in J/K 29 | static constexpr double PIx2 = 2 * PI; // Pi * 2 30 | static constexpr double HBAR2D2ME = RY_TO_EV * AU_TO_A * AU_TO_A; 31 | 32 | static constexpr std::complex IMAGE_UNIT{0, 1}; 33 | static constexpr std::complex PIx2_COMPLEX(0, PIx2); 34 | } 35 | #endif // CONSTANTS_H 36 | -------------------------------------------------------------------------------- /include/stringops.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef STRINGOPS_H 3 | #define STRINGOPS_H 4 | 5 | #include 6 | 7 | namespace ionizing { 8 | void ltrim(std::string &s); 9 | void rtrim(std::string &s); 10 | void trim(std::string &s); 11 | std::string ltrim_copy(std::string s); 12 | std::string rtrim_copy(std::string s); 13 | std::string trim_copy(std::string s); 14 | } 15 | 16 | 17 | 18 | #endif //STRINGOPS_H 19 | -------------------------------------------------------------------------------- /include/unsupported/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_subdirectory(Eigen) 2 | add_subdirectory(doc EXCLUDE_FROM_ALL) 3 | if(BUILD_TESTING) 4 | if(EIGEN_LEAVE_TEST_IN_ALL_TARGET) 5 | add_subdirectory(test) # can't do EXCLUDE_FROM_ALL here, breaks CTest 6 | else() 7 | add_subdirectory(test EXCLUDE_FROM_ALL) 8 | endif() 9 | endif() 10 | -------------------------------------------------------------------------------- /include/unsupported/Eigen/ArpackSupport: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // 5 | // This Source Code Form is subject to the terms of the Mozilla 6 | // Public License v. 2.0. If a copy of the MPL was not distributed 7 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 8 | 9 | #ifndef EIGEN_ARPACKSUPPORT_MODULE_H 10 | #define EIGEN_ARPACKSUPPORT_MODULE_H 11 | 12 | #include "../../Eigen/Core" 13 | 14 | /** \defgroup ArpackSupport_Module Arpack support module 15 | * 16 | * This module provides a wrapper to Arpack, a library for sparse eigenvalue decomposition. 17 | * 18 | * \code 19 | * #include 20 | * \endcode 21 | */ 22 | 23 | #include "../../Eigen/SparseCholesky" 24 | 25 | #include "../../Eigen/src/Core/util/DisableStupidWarnings.h" 26 | #include "src/Eigenvalues/ArpackSelfAdjointEigenSolver.h" 27 | 28 | #include "../../Eigen/src/Core/util/ReenableStupidWarnings.h" 29 | 30 | #endif // EIGEN_ARPACKSUPPORT_MODULE_H 31 | /* vim: set filetype=cpp et sw=2 ts=2 ai: */ 32 | -------------------------------------------------------------------------------- /include/unsupported/Eigen/AutoDiff: -------------------------------------------------------------------------------- 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_AUTODIFF_MODULE 11 | #define EIGEN_AUTODIFF_MODULE 12 | 13 | namespace Eigen { 14 | 15 | /** 16 | * \defgroup AutoDiff_Module Auto Diff module 17 | * 18 | * This module features forward automatic differentation via a simple 19 | * templated scalar type wrapper AutoDiffScalar. 20 | * 21 | * Warning : this should NOT be confused with numerical differentiation, which 22 | * is a different method and has its own module in Eigen : \ref NumericalDiff_Module. 23 | * 24 | * \code 25 | * #include 26 | * \endcode 27 | */ 28 | //@{ 29 | 30 | } 31 | #include "../../Eigen/src/Core/util/DisableStupidWarnings.h" 32 | 33 | 34 | #include "src/AutoDiff/AutoDiffScalar.h" 35 | // #include "src/AutoDiff/AutoDiffVector.h" 36 | #include "src/AutoDiff/AutoDiffJacobian.h" 37 | 38 | #include "../../Eigen/src/Core/util/ReenableStupidWarnings.h" 39 | 40 | 41 | 42 | namespace Eigen { 43 | //@} 44 | } 45 | 46 | #endif // EIGEN_AUTODIFF_MODULE 47 | -------------------------------------------------------------------------------- /include/unsupported/Eigen/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(Eigen_HEADERS 2 | AdolcForward 3 | AlignedVector3 4 | ArpackSupport 5 | AutoDiff 6 | BVH 7 | EulerAngles 8 | FFT 9 | IterativeSolvers 10 | KroneckerProduct 11 | LevenbergMarquardt 12 | MatrixFunctions 13 | MoreVectorization 14 | MPRealSupport 15 | NonLinearOptimization 16 | NumericalDiff 17 | OpenGLSupport 18 | Polynomials 19 | Skyline 20 | SparseExtra 21 | SpecialFunctions 22 | Splines 23 | ) 24 | 25 | install(FILES 26 | ${Eigen_HEADERS} 27 | DESTINATION ${INCLUDE_INSTALL_DIR}/unsupported/Eigen COMPONENT Devel 28 | ) 29 | 30 | install(DIRECTORY src DESTINATION ${INCLUDE_INSTALL_DIR}/unsupported/Eigen COMPONENT Devel FILES_MATCHING PATTERN "*.h") 31 | 32 | add_subdirectory(CXX11) 33 | -------------------------------------------------------------------------------- /include/unsupported/Eigen/CXX11/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(Eigen_CXX11_HEADERS Tensor TensorSymmetry ThreadPool) 2 | 3 | install(FILES 4 | ${Eigen_CXX11_HEADERS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/unsupported/Eigen/CXX11 COMPONENT Devel 6 | ) 7 | 8 | install(DIRECTORY src DESTINATION ${INCLUDE_INSTALL_DIR}/unsupported/Eigen/CXX11 COMPONENT Devel FILES_MATCHING PATTERN "*.h") 9 | -------------------------------------------------------------------------------- /include/unsupported/Eigen/CXX11/TensorSymmetry: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2013 Christian Seiler 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_CXX11_TENSORSYMMETRY_MODULE 11 | #define EIGEN_CXX11_TENSORSYMMETRY_MODULE 12 | 13 | #include "Tensor" 14 | 15 | #include "../../../Eigen/src/Core/util/DisableStupidWarnings.h" 16 | 17 | #include "src/util/CXX11Meta.h" 18 | 19 | /** \defgroup CXX11_TensorSymmetry_Module Tensor Symmetry Module 20 | * 21 | * This module provides a classes that allow for the definition of 22 | * symmetries w.r.t. tensor indices. 23 | * 24 | * Including this module will implicitly include the Tensor module. 25 | * 26 | * \code 27 | * #include 28 | * \endcode 29 | */ 30 | 31 | #include "src/TensorSymmetry/util/TemplateGroupTheory.h" 32 | #include "src/TensorSymmetry/Symmetry.h" 33 | #include "src/TensorSymmetry/StaticSymmetry.h" 34 | #include "src/TensorSymmetry/DynamicSymmetry.h" 35 | 36 | #include "../../../Eigen/src/Core/util/ReenableStupidWarnings.h" 37 | 38 | #endif // EIGEN_CXX11_TENSORSYMMETRY_MODULE 39 | 40 | /* 41 | * kate: space-indent on; indent-width 2; mixedindent off; indent-mode cstyle; 42 | */ 43 | -------------------------------------------------------------------------------- /include/unsupported/Eigen/CXX11/ThreadPool: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2016 Benoit Steiner 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_CXX11_THREADPOOL_MODULE 11 | #define EIGEN_CXX11_THREADPOOL_MODULE 12 | 13 | #include "../../../Eigen/Core" 14 | 15 | #include "../../../Eigen/src/Core/util/DisableStupidWarnings.h" 16 | 17 | /** \defgroup CXX11_ThreadPool_Module C++11 ThreadPool Module 18 | * 19 | * This module provides 2 threadpool implementations 20 | * - a simple reference implementation 21 | * - a faster non blocking implementation 22 | * 23 | * This module requires C++11. 24 | * 25 | * \code 26 | * #include 27 | * \endcode 28 | */ 29 | 30 | 31 | // The code depends on CXX11, so only include the module if the 32 | // compiler supports it. 33 | #if __cplusplus > 199711L || EIGEN_COMP_MSVC >= 1900 34 | #include 35 | #include 36 | #include 37 | #include 38 | 39 | #include 40 | #include 41 | #include 42 | #include 43 | #include 44 | #include 45 | #include 46 | #include 47 | #include "src/util/CXX11Meta.h" 48 | #include "src/util/MaxSizeVector.h" 49 | 50 | #include "src/ThreadPool/ThreadLocal.h" 51 | #ifndef EIGEN_THREAD_LOCAL 52 | // There are non-parenthesized calls to "max" in the header, 53 | // which trigger a check in test/main.h causing compilation to fail. 54 | // We work around the check here by removing the check for max in 55 | // the case where we have to emulate thread_local. 56 | #ifdef max 57 | #undef max 58 | #endif 59 | #include 60 | #endif 61 | #include "src/ThreadPool/ThreadYield.h" 62 | #include "src/ThreadPool/ThreadCancel.h" 63 | #include "src/ThreadPool/EventCount.h" 64 | #include "src/ThreadPool/RunQueue.h" 65 | #include "src/ThreadPool/ThreadPoolInterface.h" 66 | #include "src/ThreadPool/ThreadEnvironment.h" 67 | #include "src/ThreadPool/Barrier.h" 68 | #include "src/ThreadPool/NonBlockingThreadPool.h" 69 | 70 | #endif 71 | 72 | #include "../../../Eigen/src/Core/util/ReenableStupidWarnings.h" 73 | 74 | #endif // EIGEN_CXX11_THREADPOOL_MODULE 75 | -------------------------------------------------------------------------------- /include/unsupported/Eigen/CXX11/src/Tensor/TensorContractionCuda.h: -------------------------------------------------------------------------------- 1 | 2 | #if defined(__clang__) || defined(__GNUC__) 3 | #warning "Deprecated header file, please either include the main Eigen/CXX11/Tensor header or the respective TensorContractionGpu.h file" 4 | #endif 5 | 6 | #include "TensorContractionGpu.h" 7 | -------------------------------------------------------------------------------- /include/unsupported/Eigen/CXX11/src/Tensor/TensorDeviceCuda.h: -------------------------------------------------------------------------------- 1 | 2 | #if defined(__clang__) || defined(__GNUC__) 3 | #warning "Deprecated header file, please either include the main Eigen/CXX11/Tensor header or the respective TensorDeviceGpu.h file" 4 | #endif 5 | 6 | #include "TensorDeviceGpu.h" 7 | -------------------------------------------------------------------------------- /include/unsupported/Eigen/CXX11/src/Tensor/TensorGlobalFunctions.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2016 Eugene Brevdo 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_CXX11_TENSOR_TENSOR_GLOBAL_FUNCTIONS_H 11 | #define EIGEN_CXX11_TENSOR_TENSOR_GLOBAL_FUNCTIONS_H 12 | 13 | namespace Eigen { 14 | 15 | /** \cpp11 \returns an expression of the coefficient-wise betainc(\a x, \a a, \a b) to the given tensors. 16 | * 17 | * This function computes the regularized incomplete beta function (integral). 18 | * 19 | */ 20 | template 21 | EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const 22 | TensorCwiseTernaryOp, 23 | const ADerived, const BDerived, const XDerived> 24 | betainc(const ADerived& a, const BDerived& b, const XDerived& x) { 25 | return TensorCwiseTernaryOp< 26 | internal::scalar_betainc_op, const ADerived, 27 | const BDerived, const XDerived>( 28 | a, b, x, internal::scalar_betainc_op()); 29 | } 30 | 31 | } // end namespace Eigen 32 | 33 | #endif // EIGEN_CXX11_TENSOR_TENSOR_GLOBAL_FUNCTIONS_H 34 | -------------------------------------------------------------------------------- /include/unsupported/Eigen/CXX11/src/Tensor/TensorGpuHipCudaUndefines.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2014 Benoit Steiner 5 | // Copyright (C) 2018 Deven Desai 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 | #if defined(EIGEN_CXX11_TENSOR_GPU_HIP_CUDA_DEFINES_H) 12 | 13 | #undef gpuStream_t 14 | #undef gpuDeviceProp_t 15 | #undef gpuError_t 16 | #undef gpuSuccess 17 | #undef gpuErrorNotReady 18 | #undef gpuGetDeviceCount 19 | #undef gpuGetErrorString 20 | #undef gpuGetDeviceProperties 21 | #undef gpuStreamDefault 22 | #undef gpuGetDevice 23 | #undef gpuSetDevice 24 | #undef gpuMalloc 25 | #undef gpuFree 26 | #undef gpuMemsetAsync 27 | #undef gpuMemcpyAsync 28 | #undef gpuMemcpyDeviceToDevice 29 | #undef gpuMemcpyDeviceToHost 30 | #undef gpuMemcpyHostToDevice 31 | #undef gpuStreamQuery 32 | #undef gpuSharedMemConfig 33 | #undef gpuDeviceSetSharedMemConfig 34 | #undef gpuStreamSynchronize 35 | #undef gpuDeviceSynchronize 36 | #undef gpuMemcpy 37 | 38 | #undef EIGEN_CXX11_TENSOR_GPU_HIP_CUDA_DEFINES_H 39 | 40 | #endif // EIGEN_CXX11_TENSOR_GPU_HIP_CUDA_DEFINES_H 41 | -------------------------------------------------------------------------------- /include/unsupported/Eigen/CXX11/src/Tensor/TensorMacros.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2015 Benoit Steiner 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_CXX11_TENSOR_TENSOR_META_MACROS_H 11 | #define EIGEN_CXX11_TENSOR_TENSOR_META_MACROS_H 12 | 13 | 14 | /** use this macro in sfinae selection in templated functions 15 | * 16 | * template::value , int >::type = 0 18 | * > 19 | * void foo(){} 20 | * 21 | * becomes => 22 | * 23 | * template::value ) 25 | * > 26 | * void foo(){} 27 | */ 28 | 29 | // SFINAE requires variadic templates 30 | #if !defined(EIGEN_GPUCC) 31 | #if EIGEN_HAS_VARIADIC_TEMPLATES 32 | // SFINAE doesn't work for gcc <= 4.7 33 | #ifdef EIGEN_COMP_GNUC 34 | #if EIGEN_GNUC_AT_LEAST(4,8) 35 | #define EIGEN_HAS_SFINAE 36 | #endif 37 | #else 38 | #define EIGEN_HAS_SFINAE 39 | #endif 40 | #endif 41 | #endif 42 | 43 | #define EIGEN_SFINAE_ENABLE_IF( __condition__ ) \ 44 | typename internal::enable_if< ( __condition__ ) , int >::type = 0 45 | 46 | 47 | #if EIGEN_HAS_CONSTEXPR 48 | #define EIGEN_CONSTEXPR constexpr 49 | #else 50 | #define EIGEN_CONSTEXPR 51 | #endif 52 | 53 | 54 | #if EIGEN_OS_WIN || EIGEN_OS_WIN64 55 | #define EIGEN_SLEEP(n) Sleep(n) 56 | #elif EIGEN_OS_GNULINUX 57 | #define EIGEN_SLEEP(n) usleep(n * 1000); 58 | #else 59 | #define EIGEN_SLEEP(n) sleep(std::max(1, n/1000)) 60 | #endif 61 | 62 | #endif 63 | -------------------------------------------------------------------------------- /include/unsupported/Eigen/CXX11/src/Tensor/TensorReductionCuda.h: -------------------------------------------------------------------------------- 1 | 2 | #if defined(__clang__) || defined(__GNUC__) 3 | #warning "Deprecated header file, please either include the main Eigen/CXX11/Tensor header or the respective TensorReductionGpu.h file" 4 | #endif 5 | 6 | #include "TensorReductionGpu.h" 7 | -------------------------------------------------------------------------------- /include/unsupported/Eigen/CXX11/src/ThreadPool/Barrier.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2018 Rasmus Munk Larsen 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 | // Barrier is an object that allows one or more threads to wait until 11 | // Notify has been called a specified number of times. 12 | 13 | #ifndef EIGEN_CXX11_THREADPOOL_BARRIER_H 14 | #define EIGEN_CXX11_THREADPOOL_BARRIER_H 15 | 16 | namespace Eigen { 17 | 18 | class Barrier { 19 | public: 20 | Barrier(unsigned int count) : state_(count << 1), notified_(false) { 21 | eigen_plain_assert(((count << 1) >> 1) == count); 22 | } 23 | ~Barrier() { eigen_plain_assert((state_ >> 1) == 0); } 24 | 25 | void Notify() { 26 | unsigned int v = state_.fetch_sub(2, std::memory_order_acq_rel) - 2; 27 | if (v != 1) { 28 | eigen_plain_assert(((v + 2) & ~1) != 0); 29 | return; // either count has not dropped to 0, or waiter is not waiting 30 | } 31 | std::unique_lock l(mu_); 32 | eigen_plain_assert(!notified_); 33 | notified_ = true; 34 | cv_.notify_all(); 35 | } 36 | 37 | void Wait() { 38 | unsigned int v = state_.fetch_or(1, std::memory_order_acq_rel); 39 | if ((v >> 1) == 0) return; 40 | std::unique_lock l(mu_); 41 | while (!notified_) { 42 | cv_.wait(l); 43 | } 44 | } 45 | 46 | private: 47 | std::mutex mu_; 48 | std::condition_variable cv_; 49 | std::atomic state_; // low bit is waiter flag 50 | bool notified_; 51 | }; 52 | 53 | // Notification is an object that allows a user to to wait for another 54 | // thread to signal a notification that an event has occurred. 55 | // 56 | // Multiple threads can wait on the same Notification object, 57 | // but only one caller must call Notify() on the object. 58 | struct Notification : Barrier { 59 | Notification() : Barrier(1){}; 60 | }; 61 | 62 | } // namespace Eigen 63 | 64 | #endif // EIGEN_CXX11_THREADPOOL_BARRIER_H 65 | -------------------------------------------------------------------------------- /include/unsupported/Eigen/CXX11/src/ThreadPool/ThreadCancel.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2016 Benoit Steiner 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_CXX11_THREADPOOL_THREAD_CANCEL_H 11 | #define EIGEN_CXX11_THREADPOOL_THREAD_CANCEL_H 12 | 13 | // Try to come up with a portable way to cancel a thread 14 | #if EIGEN_OS_GNULINUX 15 | #define EIGEN_THREAD_CANCEL(t) \ 16 | pthread_cancel(t.native_handle()); 17 | #define EIGEN_SUPPORTS_THREAD_CANCELLATION 1 18 | #else 19 | #define EIGEN_THREAD_CANCEL(t) 20 | #endif 21 | 22 | 23 | #endif // EIGEN_CXX11_THREADPOOL_THREAD_CANCEL_H 24 | -------------------------------------------------------------------------------- /include/unsupported/Eigen/CXX11/src/ThreadPool/ThreadEnvironment.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2014 Benoit Steiner 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_CXX11_THREADPOOL_THREAD_ENVIRONMENT_H 11 | #define EIGEN_CXX11_THREADPOOL_THREAD_ENVIRONMENT_H 12 | 13 | namespace Eigen { 14 | 15 | struct StlThreadEnvironment { 16 | struct Task { 17 | std::function f; 18 | }; 19 | 20 | // EnvThread constructor must start the thread, 21 | // destructor must join the thread. 22 | class EnvThread { 23 | public: 24 | EnvThread(std::function f) : thr_(std::move(f)) {} 25 | ~EnvThread() { thr_.join(); } 26 | // This function is called when the threadpool is cancelled. 27 | void OnCancel() { } 28 | 29 | private: 30 | std::thread thr_; 31 | }; 32 | 33 | EnvThread* CreateThread(std::function f) { return new EnvThread(std::move(f)); } 34 | Task CreateTask(std::function f) { return Task{std::move(f)}; } 35 | void ExecuteTask(const Task& t) { t.f(); } 36 | }; 37 | 38 | } // namespace Eigen 39 | 40 | #endif // EIGEN_CXX11_THREADPOOL_THREAD_ENVIRONMENT_H 41 | -------------------------------------------------------------------------------- /include/unsupported/Eigen/CXX11/src/ThreadPool/ThreadLocal.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2016 Benoit Steiner 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_CXX11_THREADPOOL_THREAD_LOCAL_H 11 | #define EIGEN_CXX11_THREADPOOL_THREAD_LOCAL_H 12 | 13 | #if EIGEN_MAX_CPP_VER >= 11 && \ 14 | ((EIGEN_COMP_GNUC && EIGEN_GNUC_AT_LEAST(4, 8)) || \ 15 | __has_feature(cxx_thread_local) || \ 16 | (EIGEN_COMP_MSVC >= 1900) ) 17 | #define EIGEN_THREAD_LOCAL static thread_local 18 | #endif 19 | 20 | // Disable TLS for Apple and Android builds with older toolchains. 21 | #if defined(__APPLE__) 22 | // Included for TARGET_OS_IPHONE, __IPHONE_OS_VERSION_MIN_REQUIRED, 23 | // __IPHONE_8_0. 24 | #include 25 | #include 26 | #endif 27 | // Checks whether C++11's `thread_local` storage duration specifier is 28 | // supported. 29 | #if defined(__apple_build_version__) && \ 30 | ((__apple_build_version__ < 8000042) || \ 31 | (TARGET_OS_IPHONE && __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_9_0)) 32 | // Notes: Xcode's clang did not support `thread_local` until version 33 | // 8, and even then not for all iOS < 9.0. 34 | #undef EIGEN_THREAD_LOCAL 35 | 36 | #elif defined(__ANDROID__) && EIGEN_COMP_CLANG 37 | // There are platforms for which TLS should not be used even though the compiler 38 | // makes it seem like it's supported (Android NDK < r12b for example). 39 | // This is primarily because of linker problems and toolchain misconfiguration: 40 | // TLS isn't supported until NDK r12b per 41 | // https://developer.android.com/ndk/downloads/revision_history.html 42 | // Since NDK r16, `__NDK_MAJOR__` and `__NDK_MINOR__` are defined in 43 | // . For NDK < r16, users should define these macros, 44 | // e.g. `-D__NDK_MAJOR__=11 -D__NKD_MINOR__=0` for NDK r11. 45 | #if __has_include() 46 | #include 47 | #endif // __has_include() 48 | #if defined(__ANDROID__) && defined(__clang__) && defined(__NDK_MAJOR__) && \ 49 | defined(__NDK_MINOR__) && \ 50 | ((__NDK_MAJOR__ < 12) || ((__NDK_MAJOR__ == 12) && (__NDK_MINOR__ < 1))) 51 | #undef EIGEN_THREAD_LOCAL 52 | #endif 53 | #endif // defined(__ANDROID__) && defined(__clang__) 54 | 55 | #endif // EIGEN_CXX11_THREADPOOL_THREAD_LOCAL_H 56 | -------------------------------------------------------------------------------- /include/unsupported/Eigen/CXX11/src/ThreadPool/ThreadPoolInterface.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2014 Benoit Steiner 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_CXX11_THREADPOOL_THREAD_POOL_INTERFACE_H 11 | #define EIGEN_CXX11_THREADPOOL_THREAD_POOL_INTERFACE_H 12 | 13 | namespace Eigen { 14 | 15 | // This defines an interface that ThreadPoolDevice can take to use 16 | // custom thread pools underneath. 17 | class ThreadPoolInterface { 18 | public: 19 | // Submits a closure to be run by a thread in the pool. 20 | virtual void Schedule(std::function fn) = 0; 21 | 22 | // Submits a closure to be run by threads in the range [start, end) in the 23 | // pool. 24 | virtual void ScheduleWithHint(std::function fn, int /*start*/, 25 | int /*end*/) { 26 | // Just defer to Schedule in case sub-classes aren't interested in 27 | // overriding this functionality. 28 | Schedule(fn); 29 | } 30 | 31 | // If implemented, stop processing the closures that have been enqueued. 32 | // Currently running closures may still be processed. 33 | // If not implemented, does nothing. 34 | virtual void Cancel() {} 35 | 36 | // Returns the number of threads in the pool. 37 | virtual int NumThreads() const = 0; 38 | 39 | // Returns a logical thread index between 0 and NumThreads() - 1 if called 40 | // from one of the threads in the pool. Returns -1 otherwise. 41 | virtual int CurrentThreadId() const = 0; 42 | 43 | virtual ~ThreadPoolInterface() {} 44 | }; 45 | 46 | } // namespace Eigen 47 | 48 | #endif // EIGEN_CXX11_THREADPOOL_THREAD_POOL_INTERFACE_H 49 | -------------------------------------------------------------------------------- /include/unsupported/Eigen/CXX11/src/ThreadPool/ThreadYield.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2016 Benoit Steiner 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_CXX11_THREADPOOL_THREAD_YIELD_H 11 | #define EIGEN_CXX11_THREADPOOL_THREAD_YIELD_H 12 | 13 | // Try to come up with a portable way to yield 14 | #if EIGEN_COMP_GNUC && EIGEN_GNUC_AT_MOST(4, 7) 15 | #define EIGEN_THREAD_YIELD() sched_yield() 16 | #else 17 | #define EIGEN_THREAD_YIELD() std::this_thread::yield() 18 | #endif 19 | 20 | #endif // EIGEN_CXX11_THREADPOOL_THREAD_YIELD_H 21 | -------------------------------------------------------------------------------- /include/unsupported/Eigen/EulerAngles: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2015 Tal Hadad 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_EULERANGLES_MODULE_H 11 | #define EIGEN_EULERANGLES_MODULE_H 12 | 13 | 14 | #include "../../Eigen/Core" 15 | #include "../../Eigen/Geometry" 16 | 17 | #include "../../Eigen/src/Core/util/DisableStupidWarnings.h" 18 | 19 | namespace Eigen { 20 | 21 | /** 22 | * \defgroup EulerAngles_Module EulerAngles module 23 | * \brief This module provides generic euler angles rotation. 24 | * 25 | * Euler angles are a way to represent 3D rotation. 26 | * 27 | * In order to use this module in your code, include this header: 28 | * \code 29 | * #include 30 | * \endcode 31 | * 32 | * See \ref EulerAngles for more information. 33 | * 34 | */ 35 | 36 | } 37 | 38 | #include "src/EulerAngles/EulerSystem.h" 39 | #include "src/EulerAngles/EulerAngles.h" 40 | 41 | #include "../../Eigen/src/Core/util/ReenableStupidWarnings.h" 42 | 43 | #endif // EIGEN_EULERANGLES_MODULE_H 44 | -------------------------------------------------------------------------------- /include/unsupported/Eigen/IterativeSolvers: -------------------------------------------------------------------------------- 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_ITERATIVE_SOLVERS_MODULE_H 11 | #define EIGEN_ITERATIVE_SOLVERS_MODULE_H 12 | 13 | #include "../../Eigen/Sparse" 14 | #include "../../Eigen/Jacobi" 15 | #include "../../Eigen/Householder" 16 | 17 | /** 18 | * \defgroup IterativeSolvers_Module Iterative solvers module 19 | * This module aims to provide various iterative linear and non linear solver algorithms. 20 | * It currently provides: 21 | * - a constrained conjugate gradient 22 | * - a Householder GMRES implementation 23 | * \code 24 | * #include 25 | * \endcode 26 | */ 27 | //@{ 28 | 29 | #include "../../Eigen/src/Core/util/DisableStupidWarnings.h" 30 | 31 | #ifndef EIGEN_MPL2_ONLY 32 | #include "src/IterativeSolvers/IterationController.h" 33 | #include "src/IterativeSolvers/ConstrainedConjGrad.h" 34 | #endif 35 | 36 | #include "src/IterativeSolvers/IncompleteLU.h" 37 | #include "src/IterativeSolvers/GMRES.h" 38 | #include "src/IterativeSolvers/DGMRES.h" 39 | //#include "src/IterativeSolvers/SSORPreconditioner.h" 40 | #include "src/IterativeSolvers/MINRES.h" 41 | 42 | #include "../../Eigen/src/Core/util/ReenableStupidWarnings.h" 43 | 44 | //@} 45 | 46 | #endif // EIGEN_ITERATIVE_SOLVERS_MODULE_H 47 | -------------------------------------------------------------------------------- /include/unsupported/Eigen/KroneckerProduct: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // 5 | // This Source Code Form is subject to the terms of the Mozilla 6 | // Public License v. 2.0. If a copy of the MPL was not distributed 7 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 8 | 9 | #ifndef EIGEN_KRONECKER_PRODUCT_MODULE_H 10 | #define EIGEN_KRONECKER_PRODUCT_MODULE_H 11 | 12 | #include "../../Eigen/Core" 13 | 14 | #include "../../Eigen/src/Core/util/DisableStupidWarnings.h" 15 | 16 | #include "../../Eigen/src/SparseCore/SparseUtil.h" 17 | 18 | namespace Eigen { 19 | 20 | /** 21 | * \defgroup KroneckerProduct_Module KroneckerProduct module 22 | * 23 | * This module contains an experimental Kronecker product implementation. 24 | * 25 | * \code 26 | * #include 27 | * \endcode 28 | */ 29 | 30 | } // namespace Eigen 31 | 32 | #include "src/KroneckerProduct/KroneckerTensorProduct.h" 33 | 34 | #include "../../Eigen/src/Core/util/ReenableStupidWarnings.h" 35 | 36 | #endif // EIGEN_KRONECKER_PRODUCT_MODULE_H 37 | -------------------------------------------------------------------------------- /include/unsupported/Eigen/LevenbergMarquardt: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2009 Thomas Capricelli 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_LEVENBERGMARQUARDT_MODULE 11 | #define EIGEN_LEVENBERGMARQUARDT_MODULE 12 | 13 | // #include 14 | 15 | #include "../../Eigen/Core" 16 | #include "../../Eigen/Jacobi" 17 | #include "../../Eigen/QR" 18 | #include "NumericalDiff" 19 | 20 | #include "../../Eigen/SparseQR" 21 | 22 | /** 23 | * \defgroup LevenbergMarquardt_Module Levenberg-Marquardt module 24 | * 25 | * \code 26 | * #include 27 | * \endcode 28 | * 29 | * 30 | */ 31 | 32 | #include "../../Eigen/SparseCore" 33 | 34 | #include "../../Eigen/src/Core/util/DisableStupidWarnings.h" 35 | 36 | #ifndef EIGEN_PARSED_BY_DOXYGEN 37 | 38 | #include "src/LevenbergMarquardt/LMqrsolv.h" 39 | #include "src/LevenbergMarquardt/LMcovar.h" 40 | #include "src/LevenbergMarquardt/LMpar.h" 41 | 42 | #endif 43 | 44 | #include "src/LevenbergMarquardt/LevenbergMarquardt.h" 45 | #include "src/LevenbergMarquardt/LMonestep.h" 46 | 47 | #include "../../Eigen/src/Core/util/ReenableStupidWarnings.h" 48 | 49 | #endif // EIGEN_LEVENBERGMARQUARDT_MODULE 50 | -------------------------------------------------------------------------------- /include/unsupported/Eigen/MoreVectorization: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // 5 | // This Source Code Form is subject to the terms of the Mozilla 6 | // Public License v. 2.0. If a copy of the MPL was not distributed 7 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 8 | 9 | #ifndef EIGEN_MOREVECTORIZATION_MODULE_H 10 | #define EIGEN_MOREVECTORIZATION_MODULE_H 11 | 12 | #include "../../Eigen/Core" 13 | 14 | namespace Eigen { 15 | 16 | /** 17 | * \defgroup MoreVectorization More vectorization module 18 | */ 19 | 20 | } 21 | 22 | #include "src/MoreVectorization/MathFunctions.h" 23 | 24 | #endif // EIGEN_MOREVECTORIZATION_MODULE_H 25 | -------------------------------------------------------------------------------- /include/unsupported/Eigen/NumericalDiff: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2009 Thomas Capricelli 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_NUMERICALDIFF_MODULE 11 | #define EIGEN_NUMERICALDIFF_MODULE 12 | 13 | #include "../../Eigen/Core" 14 | 15 | namespace Eigen { 16 | 17 | /** 18 | * \defgroup NumericalDiff_Module Numerical differentiation module 19 | * 20 | * \code 21 | * #include 22 | * \endcode 23 | * 24 | * See http://en.wikipedia.org/wiki/Numerical_differentiation 25 | * 26 | * Warning : this should NOT be confused with automatic differentiation, which 27 | * is a different method and has its own module in Eigen : \ref 28 | * AutoDiff_Module. 29 | * 30 | * Currently only "Forward" and "Central" schemes are implemented. Those 31 | * are basic methods, and there exist some more elaborated way of 32 | * computing such approximates. They are implemented using both 33 | * proprietary and free software, and usually requires linking to an 34 | * external library. It is very easy for you to write a functor 35 | * using such software, and the purpose is quite orthogonal to what we 36 | * want to achieve with Eigen. 37 | * 38 | * This is why we will not provide wrappers for every great numerical 39 | * differentiation software that exist, but should rather stick with those 40 | * basic ones, that still are useful for testing. 41 | * 42 | * Also, the \ref NonLinearOptimization_Module needs this in order to 43 | * provide full features compatibility with the original (c)minpack 44 | * package. 45 | * 46 | */ 47 | } 48 | 49 | //@{ 50 | 51 | #include "src/NumericalDiff/NumericalDiff.h" 52 | 53 | //@} 54 | 55 | 56 | #endif // EIGEN_NUMERICALDIFF_MODULE 57 | -------------------------------------------------------------------------------- /include/unsupported/Eigen/Skyline: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // 5 | // This Source Code Form is subject to the terms of the Mozilla 6 | // Public License v. 2.0. If a copy of the MPL was not distributed 7 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 8 | 9 | #ifndef EIGEN_SKYLINE_MODULE_H 10 | #define EIGEN_SKYLINE_MODULE_H 11 | 12 | 13 | #include "../../Eigen/Core" 14 | 15 | #include "../../Eigen/src/Core/util/DisableStupidWarnings.h" 16 | 17 | #include 18 | #include 19 | #include 20 | #include 21 | 22 | /** 23 | * \defgroup Skyline_Module Skyline module 24 | * 25 | * 26 | * 27 | * 28 | */ 29 | 30 | #include "src/Skyline/SkylineUtil.h" 31 | #include "src/Skyline/SkylineMatrixBase.h" 32 | #include "src/Skyline/SkylineStorage.h" 33 | #include "src/Skyline/SkylineMatrix.h" 34 | #include "src/Skyline/SkylineInplaceLU.h" 35 | #include "src/Skyline/SkylineProduct.h" 36 | 37 | #include "../../Eigen/src/Core/util/ReenableStupidWarnings.h" 38 | 39 | #endif // EIGEN_SKYLINE_MODULE_H 40 | -------------------------------------------------------------------------------- /include/unsupported/Eigen/SparseExtra: -------------------------------------------------------------------------------- 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_SPARSE_EXTRA_MODULE_H 11 | #define EIGEN_SPARSE_EXTRA_MODULE_H 12 | 13 | #include "../../Eigen/Sparse" 14 | 15 | #include "../../Eigen/src/Core/util/DisableStupidWarnings.h" 16 | 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | 25 | #ifdef EIGEN_GOOGLEHASH_SUPPORT 26 | #include 27 | #endif 28 | 29 | /** 30 | * \defgroup SparseExtra_Module SparseExtra module 31 | * 32 | * This module contains some experimental features extending the sparse module. 33 | * 34 | * \code 35 | * #include 36 | * \endcode 37 | */ 38 | 39 | 40 | #include "src/SparseExtra/DynamicSparseMatrix.h" 41 | #include "src/SparseExtra/BlockOfDynamicSparseMatrix.h" 42 | #include "src/SparseExtra/RandomSetter.h" 43 | 44 | #include "src/SparseExtra/MarketIO.h" 45 | 46 | #if !defined(_WIN32) 47 | #include 48 | #include "src/SparseExtra/MatrixMarketIterator.h" 49 | #endif 50 | 51 | #include "../../Eigen/src/Core/util/ReenableStupidWarnings.h" 52 | 53 | #endif // EIGEN_SPARSE_EXTRA_MODULE_H 54 | -------------------------------------------------------------------------------- /include/unsupported/Eigen/SpecialFunctions: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2016 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_SPECIALFUNCTIONS_MODULE 11 | #define EIGEN_SPECIALFUNCTIONS_MODULE 12 | 13 | #include 14 | 15 | #include "../../Eigen/Core" 16 | 17 | #include "../../Eigen/src/Core/util/DisableStupidWarnings.h" 18 | 19 | namespace Eigen { 20 | 21 | /** 22 | * \defgroup SpecialFunctions_Module Special math functions module 23 | * 24 | * This module features additional coefficient-wise math functions available 25 | * within the numext:: namespace for the scalar version, and as method and/or free 26 | * functions of Array. Those include: 27 | * 28 | * - erf 29 | * - erfc 30 | * - lgamma 31 | * - igamma 32 | * - igamma_der_a 33 | * - gamma_sample_der_alpha 34 | * - igammac 35 | * - digamma 36 | * - polygamma 37 | * - zeta 38 | * - betainc 39 | * - i0e 40 | * - i1e 41 | * 42 | * \code 43 | * #include 44 | * \endcode 45 | */ 46 | //@{ 47 | 48 | } 49 | 50 | #include "src/SpecialFunctions/SpecialFunctionsImpl.h" 51 | #include "src/SpecialFunctions/SpecialFunctionsPacketMath.h" 52 | #include "src/SpecialFunctions/SpecialFunctionsHalf.h" 53 | #include "src/SpecialFunctions/SpecialFunctionsFunctors.h" 54 | #include "src/SpecialFunctions/SpecialFunctionsArrayAPI.h" 55 | 56 | #if defined EIGEN_VECTORIZE_GPU 57 | #include "src/SpecialFunctions/arch/GPU/GpuSpecialFunctions.h" 58 | #endif 59 | 60 | namespace Eigen { 61 | //@} 62 | } 63 | 64 | 65 | #include "../../Eigen/src/Core/util/ReenableStupidWarnings.h" 66 | 67 | #endif // EIGEN_SPECIALFUNCTIONS_MODULE 68 | -------------------------------------------------------------------------------- /include/unsupported/Eigen/Splines: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 20010-2011 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_SPLINES_MODULE_H 11 | #define EIGEN_SPLINES_MODULE_H 12 | 13 | namespace Eigen 14 | { 15 | /** 16 | * \defgroup Splines_Module Spline and spline fitting module 17 | * 18 | * This module provides a simple multi-dimensional spline class while 19 | * offering most basic functionality to fit a spline to point sets. 20 | * 21 | * \code 22 | * #include 23 | * \endcode 24 | */ 25 | } 26 | 27 | #include "../../Eigen/src/Core/util/DisableStupidWarnings.h" 28 | 29 | #include "src/Splines/SplineFwd.h" 30 | #include "src/Splines/Spline.h" 31 | #include "src/Splines/SplineFitting.h" 32 | 33 | #include "../../Eigen/src/Core/util/ReenableStupidWarnings.h" 34 | 35 | #endif // EIGEN_SPLINES_MODULE_H 36 | -------------------------------------------------------------------------------- /include/unsupported/Eigen/src/EulerAngles/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_EulerAngles_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_EulerAngles_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/unsupported/Eigen/src/EulerAngles COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /include/unsupported/Eigen/src/LevenbergMarquardt/CopyrightMINPACK.txt: -------------------------------------------------------------------------------- 1 | Minpack Copyright Notice (1999) University of Chicago. All rights reserved 2 | 3 | Redistribution and use in source and binary forms, with or 4 | without modification, are permitted provided that the 5 | following conditions are met: 6 | 7 | 1. Redistributions of source code must retain the above 8 | copyright notice, this list of conditions and the following 9 | disclaimer. 10 | 11 | 2. Redistributions in binary form must reproduce the above 12 | copyright notice, this list of conditions and the following 13 | disclaimer in the documentation and/or other materials 14 | provided with the distribution. 15 | 16 | 3. The end-user documentation included with the 17 | redistribution, if any, must include the following 18 | acknowledgment: 19 | 20 | "This product includes software developed by the 21 | University of Chicago, as Operator of Argonne National 22 | Laboratory. 23 | 24 | Alternately, this acknowledgment may appear in the software 25 | itself, if and wherever such third-party acknowledgments 26 | normally appear. 27 | 28 | 4. WARRANTY DISCLAIMER. THE SOFTWARE IS SUPPLIED "AS IS" 29 | WITHOUT WARRANTY OF ANY KIND. THE COPYRIGHT HOLDER, THE 30 | UNITED STATES, THE UNITED STATES DEPARTMENT OF ENERGY, AND 31 | THEIR EMPLOYEES: (1) DISCLAIM ANY WARRANTIES, EXPRESS OR 32 | IMPLIED, INCLUDING BUT NOT LIMITED TO ANY IMPLIED WARRANTIES 33 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE 34 | OR NON-INFRINGEMENT, (2) DO NOT ASSUME ANY LEGAL LIABILITY 35 | OR RESPONSIBILITY FOR THE ACCURACY, COMPLETENESS, OR 36 | USEFULNESS OF THE SOFTWARE, (3) DO NOT REPRESENT THAT USE OF 37 | THE SOFTWARE WOULD NOT INFRINGE PRIVATELY OWNED RIGHTS, (4) 38 | DO NOT WARRANT THAT THE SOFTWARE WILL FUNCTION 39 | UNINTERRUPTED, THAT IT IS ERROR-FREE OR THAT ANY ERRORS WILL 40 | BE CORRECTED. 41 | 42 | 5. LIMITATION OF LIABILITY. IN NO EVENT WILL THE COPYRIGHT 43 | HOLDER, THE UNITED STATES, THE UNITED STATES DEPARTMENT OF 44 | ENERGY, OR THEIR EMPLOYEES: BE LIABLE FOR ANY INDIRECT, 45 | INCIDENTAL, CONSEQUENTIAL, SPECIAL OR PUNITIVE DAMAGES OF 46 | ANY KIND OR NATURE, INCLUDING BUT NOT LIMITED TO LOSS OF 47 | PROFITS OR LOSS OF DATA, FOR ANY REASON WHATSOEVER, WHETHER 48 | SUCH LIABILITY IS ASSERTED ON THE BASIS OF CONTRACT, TORT 49 | (INCLUDING NEGLIGENCE OR STRICT LIABILITY), OR OTHERWISE, 50 | EVEN IF ANY OF SAID PARTIES HAS BEEN WARNED OF THE 51 | POSSIBILITY OF SUCH LOSS OR DAMAGES. 52 | 53 | -------------------------------------------------------------------------------- /include/unsupported/Eigen/src/MatrixFunctions/StemFunction.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2010, 2013 Jitse Niesen 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_STEM_FUNCTION 11 | #define EIGEN_STEM_FUNCTION 12 | 13 | namespace Eigen { 14 | 15 | namespace internal { 16 | 17 | /** \brief The exponential function (and its derivatives). */ 18 | template 19 | Scalar stem_function_exp(Scalar x, int) 20 | { 21 | using std::exp; 22 | return exp(x); 23 | } 24 | 25 | /** \brief Cosine (and its derivatives). */ 26 | template 27 | Scalar stem_function_cos(Scalar x, int n) 28 | { 29 | using std::cos; 30 | using std::sin; 31 | Scalar res; 32 | 33 | switch (n % 4) { 34 | case 0: 35 | res = std::cos(x); 36 | break; 37 | case 1: 38 | res = -std::sin(x); 39 | break; 40 | case 2: 41 | res = -std::cos(x); 42 | break; 43 | case 3: 44 | res = std::sin(x); 45 | break; 46 | } 47 | return res; 48 | } 49 | 50 | /** \brief Sine (and its derivatives). */ 51 | template 52 | Scalar stem_function_sin(Scalar x, int n) 53 | { 54 | using std::cos; 55 | using std::sin; 56 | Scalar res; 57 | 58 | switch (n % 4) { 59 | case 0: 60 | res = std::sin(x); 61 | break; 62 | case 1: 63 | res = std::cos(x); 64 | break; 65 | case 2: 66 | res = -std::sin(x); 67 | break; 68 | case 3: 69 | res = -std::cos(x); 70 | break; 71 | } 72 | return res; 73 | } 74 | 75 | /** \brief Hyperbolic cosine (and its derivatives). */ 76 | template 77 | Scalar stem_function_cosh(Scalar x, int n) 78 | { 79 | using std::cosh; 80 | using std::sinh; 81 | Scalar res; 82 | 83 | switch (n % 2) { 84 | case 0: 85 | res = std::cosh(x); 86 | break; 87 | case 1: 88 | res = std::sinh(x); 89 | break; 90 | } 91 | return res; 92 | } 93 | 94 | /** \brief Hyperbolic sine (and its derivatives). */ 95 | template 96 | Scalar stem_function_sinh(Scalar x, int n) 97 | { 98 | using std::cosh; 99 | using std::sinh; 100 | Scalar res; 101 | 102 | switch (n % 2) { 103 | case 0: 104 | res = std::sinh(x); 105 | break; 106 | case 1: 107 | res = std::cosh(x); 108 | break; 109 | } 110 | return res; 111 | } 112 | 113 | } // end namespace internal 114 | 115 | } // end namespace Eigen 116 | 117 | #endif // EIGEN_STEM_FUNCTION 118 | -------------------------------------------------------------------------------- /include/unsupported/Eigen/src/NonLinearOptimization/chkder.h: -------------------------------------------------------------------------------- 1 | #define chkder_log10e 0.43429448190325182765 2 | #define chkder_factor 100. 3 | 4 | namespace Eigen { 5 | 6 | namespace internal { 7 | 8 | template 9 | void chkder( 10 | const Matrix< Scalar, Dynamic, 1 > &x, 11 | const Matrix< Scalar, Dynamic, 1 > &fvec, 12 | const Matrix< Scalar, Dynamic, Dynamic > &fjac, 13 | Matrix< Scalar, Dynamic, 1 > &xp, 14 | const Matrix< Scalar, Dynamic, 1 > &fvecp, 15 | int mode, 16 | Matrix< Scalar, Dynamic, 1 > &err 17 | ) 18 | { 19 | using std::sqrt; 20 | using std::abs; 21 | using std::log; 22 | 23 | typedef DenseIndex Index; 24 | 25 | const Scalar eps = sqrt(NumTraits::epsilon()); 26 | const Scalar epsf = chkder_factor * NumTraits::epsilon(); 27 | const Scalar epslog = chkder_log10e * log(eps); 28 | Scalar temp; 29 | 30 | const Index m = fvec.size(), n = x.size(); 31 | 32 | if (mode != 2) { 33 | /* mode = 1. */ 34 | xp.resize(n); 35 | for (Index j = 0; j < n; ++j) { 36 | temp = eps * abs(x[j]); 37 | if (temp == 0.) 38 | temp = eps; 39 | xp[j] = x[j] + temp; 40 | } 41 | } 42 | else { 43 | /* mode = 2. */ 44 | err.setZero(m); 45 | for (Index j = 0; j < n; ++j) { 46 | temp = abs(x[j]); 47 | if (temp == 0.) 48 | temp = 1.; 49 | err += temp * fjac.col(j); 50 | } 51 | for (Index i = 0; i < m; ++i) { 52 | temp = 1.; 53 | if (fvec[i] != 0. && fvecp[i] != 0. && abs(fvecp[i] - fvec[i]) >= epsf * abs(fvec[i])) 54 | temp = eps * abs((fvecp[i] - fvec[i]) / eps - err[i]) / (abs(fvec[i]) + abs(fvecp[i])); 55 | err[i] = 1.; 56 | if (temp > NumTraits::epsilon() && temp < eps) 57 | err[i] = (chkder_log10e * log(temp) - epslog) / epslog; 58 | if (temp >= eps) 59 | err[i] = 0.; 60 | } 61 | } 62 | } 63 | 64 | } // end namespace internal 65 | 66 | } // end namespace Eigen 67 | -------------------------------------------------------------------------------- /include/unsupported/Eigen/src/NonLinearOptimization/covar.h: -------------------------------------------------------------------------------- 1 | namespace Eigen { 2 | 3 | namespace internal { 4 | 5 | template 6 | void covar( 7 | Matrix< Scalar, Dynamic, Dynamic > &r, 8 | const VectorXi &ipvt, 9 | Scalar tol = std::sqrt(NumTraits::epsilon()) ) 10 | { 11 | using std::abs; 12 | typedef DenseIndex Index; 13 | 14 | /* Local variables */ 15 | Index i, j, k, l, ii, jj; 16 | bool sing; 17 | Scalar temp; 18 | 19 | /* Function Body */ 20 | const Index n = r.cols(); 21 | const Scalar tolr = tol * abs(r(0,0)); 22 | Matrix< Scalar, Dynamic, 1 > wa(n); 23 | eigen_assert(ipvt.size()==n); 24 | 25 | /* form the inverse of r in the full upper triangle of r. */ 26 | l = -1; 27 | for (k = 0; k < n; ++k) 28 | if (abs(r(k,k)) > tolr) { 29 | r(k,k) = 1. / r(k,k); 30 | for (j = 0; j <= k-1; ++j) { 31 | temp = r(k,k) * r(j,k); 32 | r(j,k) = 0.; 33 | r.col(k).head(j+1) -= r.col(j).head(j+1) * temp; 34 | } 35 | l = k; 36 | } 37 | 38 | /* form the full upper triangle of the inverse of (r transpose)*r */ 39 | /* in the full upper triangle of r. */ 40 | for (k = 0; k <= l; ++k) { 41 | for (j = 0; j <= k-1; ++j) 42 | r.col(j).head(j+1) += r.col(k).head(j+1) * r(j,k); 43 | r.col(k).head(k+1) *= r(k,k); 44 | } 45 | 46 | /* form the full lower triangle of the covariance matrix */ 47 | /* in the strict lower triangle of r and in wa. */ 48 | for (j = 0; j < n; ++j) { 49 | jj = ipvt[j]; 50 | sing = j > l; 51 | for (i = 0; i <= j; ++i) { 52 | if (sing) 53 | r(i,j) = 0.; 54 | ii = ipvt[i]; 55 | if (ii > jj) 56 | r(ii,jj) = r(i,j); 57 | if (ii < jj) 58 | r(jj,ii) = r(i,j); 59 | } 60 | wa[jj] = r(j,j); 61 | } 62 | 63 | /* symmetrize the covariance matrix in r. */ 64 | r.topLeftCorner(n,n).template triangularView() = r.topLeftCorner(n,n).transpose(); 65 | r.diagonal() = wa; 66 | } 67 | 68 | } // end namespace internal 69 | 70 | } // end namespace Eigen 71 | -------------------------------------------------------------------------------- /include/unsupported/Eigen/src/NonLinearOptimization/fdjac1.h: -------------------------------------------------------------------------------- 1 | namespace Eigen { 2 | 3 | namespace internal { 4 | 5 | template 6 | DenseIndex fdjac1( 7 | const FunctorType &Functor, 8 | Matrix< Scalar, Dynamic, 1 > &x, 9 | Matrix< Scalar, Dynamic, 1 > &fvec, 10 | Matrix< Scalar, Dynamic, Dynamic > &fjac, 11 | DenseIndex ml, DenseIndex mu, 12 | Scalar epsfcn) 13 | { 14 | using std::sqrt; 15 | using std::abs; 16 | 17 | typedef DenseIndex Index; 18 | 19 | /* Local variables */ 20 | Scalar h; 21 | Index j, k; 22 | Scalar eps, temp; 23 | Index msum; 24 | int iflag; 25 | Index start, length; 26 | 27 | /* Function Body */ 28 | const Scalar epsmch = NumTraits::epsilon(); 29 | const Index n = x.size(); 30 | eigen_assert(fvec.size()==n); 31 | Matrix< Scalar, Dynamic, 1 > wa1(n); 32 | Matrix< Scalar, Dynamic, 1 > wa2(n); 33 | 34 | eps = sqrt((std::max)(epsfcn,epsmch)); 35 | msum = ml + mu + 1; 36 | if (msum >= n) { 37 | /* computation of dense approximate jacobian. */ 38 | for (j = 0; j < n; ++j) { 39 | temp = x[j]; 40 | h = eps * abs(temp); 41 | if (h == 0.) 42 | h = eps; 43 | x[j] = temp + h; 44 | iflag = Functor(x, wa1); 45 | if (iflag < 0) 46 | return iflag; 47 | x[j] = temp; 48 | fjac.col(j) = (wa1-fvec)/h; 49 | } 50 | 51 | }else { 52 | /* computation of banded approximate jacobian. */ 53 | for (k = 0; k < msum; ++k) { 54 | for (j = k; (msum<0) ? (j>n): (jn): (j(0,j-mu); 69 | length = (std::min)(n-1, j+ml) - start + 1; 70 | fjac.col(j).segment(start, length) = ( wa1.segment(start, length)-fvec.segment(start, length))/h; 71 | } 72 | } 73 | } 74 | return 0; 75 | } 76 | 77 | } // end namespace internal 78 | 79 | } // end namespace Eigen 80 | -------------------------------------------------------------------------------- /include/unsupported/Eigen/src/NonLinearOptimization/r1mpyq.h: -------------------------------------------------------------------------------- 1 | namespace Eigen { 2 | 3 | namespace internal { 4 | 5 | // TODO : move this to GivensQR once there's such a thing in Eigen 6 | 7 | template 8 | void r1mpyq(DenseIndex m, DenseIndex n, Scalar *a, const std::vector > &v_givens, const std::vector > &w_givens) 9 | { 10 | typedef DenseIndex Index; 11 | 12 | /* apply the first set of givens rotations to a. */ 13 | for (Index j = n-2; j>=0; --j) 14 | for (Index i = 0; i 6 | void rwupdt( 7 | Matrix< Scalar, Dynamic, Dynamic > &r, 8 | const Matrix< Scalar, Dynamic, 1> &w, 9 | Matrix< Scalar, Dynamic, 1> &b, 10 | Scalar alpha) 11 | { 12 | typedef DenseIndex Index; 13 | 14 | const Index n = r.cols(); 15 | eigen_assert(r.rows()>=n); 16 | std::vector > givens(n); 17 | 18 | /* Local variables */ 19 | Scalar temp, rowj; 20 | 21 | /* Function Body */ 22 | for (Index j = 0; j < n; ++j) { 23 | rowj = w[j]; 24 | 25 | /* apply the previous transformations to */ 26 | /* r(i,j), i=0,1,...,j-1, and to w(j). */ 27 | for (Index i = 0; i < j; ++i) { 28 | temp = givens[i].c() * r(i,j) + givens[i].s() * rowj; 29 | rowj = -givens[i].s() * r(i,j) + givens[i].c() * rowj; 30 | r(i,j) = temp; 31 | } 32 | 33 | /* determine a givens rotation which eliminates w(j). */ 34 | givens[j].makeGivens(-r(j,j), rowj); 35 | 36 | if (rowj == 0.) 37 | continue; // givens[j] is identity 38 | 39 | /* apply the current transformation to r(j,j), b(j), and alpha. */ 40 | r(j,j) = givens[j].c() * r(j,j) + givens[j].s() * rowj; 41 | temp = givens[j].c() * b[j] + givens[j].s() * alpha; 42 | alpha = -givens[j].s() * b[j] + givens[j].c() * alpha; 43 | b[j] = temp; 44 | } 45 | } 46 | 47 | } // end namespace internal 48 | 49 | } // end namespace Eigen 50 | -------------------------------------------------------------------------------- /include/unsupported/README.txt: -------------------------------------------------------------------------------- 1 | This directory contains contributions from various users. 2 | They are provided "as is", without any support. Nevertheless, 3 | most of them are subject to be included in Eigen in the future. 4 | 5 | In order to use an unsupported module you have to do either: 6 | 7 | - add the path_to_eigen/unsupported directory to your include path and do: 8 | #include 9 | 10 | - or directly do: 11 | #include 12 | 13 | 14 | If you are interested in contributing to one of them, or have other stuff 15 | you would like to share, feel free to contact us: 16 | http://eigen.tuxfamily.org/index.php?title=Main_Page#Mailing_list 17 | 18 | Any kind of contributions are much appreciated, even very preliminary ones. 19 | However, it: 20 | - must rely on Eigen, 21 | - must be highly related to math, 22 | - should have some general purpose in the sense that it could 23 | potentially become an official Eigen module (or be merged into another one). 24 | 25 | In doubt feel free to contact us. For instance, if your addons is very too specific 26 | but it shows an interesting way of using Eigen, then it could be a nice demo. 27 | 28 | 29 | This directory is organized as follow: 30 | 31 | unsupported/Eigen/ModuleHeader1 32 | unsupported/Eigen/ModuleHeader2 33 | unsupported/Eigen/... 34 | unsupported/Eigen/src/Module1/SourceFile1.h 35 | unsupported/Eigen/src/Module1/SourceFile2.h 36 | unsupported/Eigen/src/Module1/... 37 | unsupported/Eigen/src/Module2/SourceFile1.h 38 | unsupported/Eigen/src/Module2/SourceFile2.h 39 | unsupported/Eigen/src/Module2/... 40 | unsupported/Eigen/src/... 41 | unsupported/doc/snippets/.cpp <- code snippets for the doc 42 | unsupported/doc/examples/.cpp <- examples for the doc 43 | unsupported/doc/TutorialModule1.dox 44 | unsupported/doc/TutorialModule2.dox 45 | unsupported/doc/... 46 | unsupported/test/.cpp <- unit test files 47 | 48 | The documentation is generated at the same time than the main Eigen documentation. 49 | The .html files are generated in: build_dir/doc/html/unsupported/ 50 | 51 | -------------------------------------------------------------------------------- /include/unsupported/doc/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set_directory_properties(PROPERTIES EXCLUDE_FROM_ALL TRUE) 2 | 3 | add_subdirectory(examples) 4 | add_subdirectory(snippets) 5 | -------------------------------------------------------------------------------- /include/unsupported/doc/Overview.dox: -------------------------------------------------------------------------------- 1 | /// \brief Namespace containing all symbols from the %Eigen library. 2 | namespace Eigen { 3 | 4 | /** \mainpage %Eigen's unsupported modules 5 | 6 | This is the API documentation for %Eigen's unsupported modules. 7 | 8 | These modules are contributions from various users. They are provided "as is", without any support. 9 | 10 | Click on the \e Modules tab at the top of this page to get a list of all unsupported modules. 11 | 12 | Don't miss the official Eigen documentation. 13 | 14 | */ 15 | 16 | /* 17 | 18 | \defgroup Unsupported_modules Unsupported modules 19 | 20 | The unsupported modules are contributions from various users. They are 21 | provided "as is", without any support. Nevertheless, some of them are 22 | subject to be included in %Eigen in the future. 23 | 24 | */ 25 | 26 | /// \internal \brief Namespace containing low-level routines from the %Eigen library. 27 | namespace internal {} 28 | } 29 | -------------------------------------------------------------------------------- /include/unsupported/doc/examples/BVH_Example.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | using namespace Eigen; 6 | typedef AlignedBox Box2d; 7 | 8 | namespace Eigen { 9 | Box2d bounding_box(const Vector2d &v) { return Box2d(v, v); } //compute the bounding box of a single point 10 | } 11 | 12 | struct PointPointMinimizer //how to compute squared distances between points and rectangles 13 | { 14 | PointPointMinimizer() : calls(0) {} 15 | typedef double Scalar; 16 | 17 | double minimumOnVolumeVolume(const Box2d &r1, const Box2d &r2) { ++calls; return r1.squaredExteriorDistance(r2); } 18 | double minimumOnVolumeObject(const Box2d &r, const Vector2d &v) { ++calls; return r.squaredExteriorDistance(v); } 19 | double minimumOnObjectVolume(const Vector2d &v, const Box2d &r) { ++calls; return r.squaredExteriorDistance(v); } 20 | double minimumOnObjectObject(const Vector2d &v1, const Vector2d &v2) { ++calls; return (v1 - v2).squaredNorm(); } 21 | 22 | int calls; 23 | }; 24 | 25 | int main() 26 | { 27 | typedef std::vector > StdVectorOfVector2d; 28 | StdVectorOfVector2d redPoints, bluePoints; 29 | for(int i = 0; i < 100; ++i) { //initialize random set of red points and blue points 30 | redPoints.push_back(Vector2d::Random()); 31 | bluePoints.push_back(Vector2d::Random()); 32 | } 33 | 34 | PointPointMinimizer minimizer; 35 | double minDistSq = std::numeric_limits::max(); 36 | 37 | //brute force to find closest red-blue pair 38 | for(int i = 0; i < (int)redPoints.size(); ++i) 39 | for(int j = 0; j < (int)bluePoints.size(); ++j) 40 | minDistSq = std::min(minDistSq, minimizer.minimumOnObjectObject(redPoints[i], bluePoints[j])); 41 | std::cout << "Brute force distance = " << sqrt(minDistSq) << ", calls = " << minimizer.calls << std::endl; 42 | 43 | //using BVH to find closest red-blue pair 44 | minimizer.calls = 0; 45 | KdBVH redTree(redPoints.begin(), redPoints.end()), blueTree(bluePoints.begin(), bluePoints.end()); //construct the trees 46 | minDistSq = BVMinimize(redTree, blueTree, minimizer); //actual BVH minimization call 47 | std::cout << "BVH distance = " << sqrt(minDistSq) << ", calls = " << minimizer.calls << std::endl; 48 | 49 | return 0; 50 | } 51 | -------------------------------------------------------------------------------- /include/unsupported/doc/examples/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB examples_SRCS "*.cpp") 2 | 3 | ADD_CUSTOM_TARGET(unsupported_examples) 4 | 5 | INCLUDE_DIRECTORIES(../../../unsupported ../../../unsupported/test) 6 | 7 | FOREACH(example_src ${examples_SRCS}) 8 | GET_FILENAME_COMPONENT(example ${example_src} NAME_WE) 9 | ADD_EXECUTABLE(example_${example} ${example_src}) 10 | if(EIGEN_STANDARD_LIBRARIES_TO_LINK_TO) 11 | target_link_libraries(example_${example} ${EIGEN_STANDARD_LIBRARIES_TO_LINK_TO}) 12 | endif() 13 | ADD_CUSTOM_COMMAND( 14 | TARGET example_${example} 15 | POST_BUILD 16 | COMMAND example_${example} 17 | ARGS >${CMAKE_CURRENT_BINARY_DIR}/${example}.out 18 | ) 19 | ADD_DEPENDENCIES(unsupported_examples example_${example}) 20 | ENDFOREACH(example_src) 21 | -------------------------------------------------------------------------------- /include/unsupported/doc/examples/EulerAngles.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | using namespace Eigen; 5 | 6 | int main() 7 | { 8 | // A common Euler system by many armies around the world, 9 | // where the first one is the azimuth(the angle from the north - 10 | // the same angle that is show in compass) 11 | // and the second one is elevation(the angle from the horizon) 12 | // and the third one is roll(the angle between the horizontal body 13 | // direction and the plane ground surface) 14 | // Keep remembering we're using radian angles here! 15 | typedef EulerSystem<-EULER_Z, EULER_Y, EULER_X> MyArmySystem; 16 | typedef EulerAngles MyArmyAngles; 17 | 18 | MyArmyAngles vehicleAngles( 19 | 3.14/*PI*/ / 2, /* heading to east, notice that this angle is counter-clockwise */ 20 | -0.3, /* going down from a mountain */ 21 | 0.1); /* slightly rolled to the right */ 22 | 23 | // Some Euler angles representation that our plane use. 24 | EulerAnglesZYZd planeAngles(0.78474, 0.5271, -0.513794); 25 | 26 | MyArmyAngles planeAnglesInMyArmyAngles(planeAngles); 27 | 28 | std::cout << "vehicle angles(MyArmy): " << vehicleAngles << std::endl; 29 | std::cout << "plane angles(ZYZ): " << planeAngles << std::endl; 30 | std::cout << "plane angles(MyArmy): " << planeAnglesInMyArmyAngles << std::endl; 31 | 32 | // Now lets rotate the plane a little bit 33 | std::cout << "==========================================================\n"; 34 | std::cout << "rotating plane now!\n"; 35 | std::cout << "==========================================================\n"; 36 | 37 | Quaterniond planeRotated = AngleAxisd(-0.342, Vector3d::UnitY()) * planeAngles; 38 | 39 | planeAngles = planeRotated; 40 | planeAnglesInMyArmyAngles = planeRotated; 41 | 42 | std::cout << "new plane angles(ZYZ): " << planeAngles << std::endl; 43 | std::cout << "new plane angles(MyArmy): " << planeAnglesInMyArmyAngles << std::endl; 44 | 45 | return 0; 46 | } 47 | -------------------------------------------------------------------------------- /include/unsupported/doc/examples/MatrixExponential.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | using namespace Eigen; 5 | 6 | int main() 7 | { 8 | const double pi = std::acos(-1.0); 9 | 10 | MatrixXd A(3,3); 11 | A << 0, -pi/4, 0, 12 | pi/4, 0, 0, 13 | 0, 0, 0; 14 | std::cout << "The matrix A is:\n" << A << "\n\n"; 15 | std::cout << "The matrix exponential of A is:\n" << A.exp() << "\n\n"; 16 | } 17 | -------------------------------------------------------------------------------- /include/unsupported/doc/examples/MatrixFunction.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | using namespace Eigen; 5 | 6 | std::complex expfn(std::complex x, int) 7 | { 8 | return std::exp(x); 9 | } 10 | 11 | int main() 12 | { 13 | const double pi = std::acos(-1.0); 14 | 15 | MatrixXd A(3,3); 16 | A << 0, -pi/4, 0, 17 | pi/4, 0, 0, 18 | 0, 0, 0; 19 | 20 | std::cout << "The matrix A is:\n" << A << "\n\n"; 21 | std::cout << "The matrix exponential of A is:\n" 22 | << A.matrixFunction(expfn) << "\n\n"; 23 | } 24 | -------------------------------------------------------------------------------- /include/unsupported/doc/examples/MatrixLogarithm.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | using namespace Eigen; 5 | 6 | int main() 7 | { 8 | using std::sqrt; 9 | MatrixXd A(3,3); 10 | A << 0.5*sqrt(2), -0.5*sqrt(2), 0, 11 | 0.5*sqrt(2), 0.5*sqrt(2), 0, 12 | 0, 0, 1; 13 | std::cout << "The matrix A is:\n" << A << "\n\n"; 14 | std::cout << "The matrix logarithm of A is:\n" << A.log() << "\n"; 15 | } 16 | -------------------------------------------------------------------------------- /include/unsupported/doc/examples/MatrixPower.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | using namespace Eigen; 5 | 6 | int main() 7 | { 8 | const double pi = std::acos(-1.0); 9 | Matrix3d A; 10 | A << cos(1), -sin(1), 0, 11 | sin(1), cos(1), 0, 12 | 0 , 0 , 1; 13 | std::cout << "The matrix A is:\n" << A << "\n\n" 14 | "The matrix power A^(pi/4) is:\n" << A.pow(pi/4) << std::endl; 15 | return 0; 16 | } 17 | -------------------------------------------------------------------------------- /include/unsupported/doc/examples/MatrixPower_optimal.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | using namespace Eigen; 5 | 6 | int main() 7 | { 8 | Matrix4cd A = Matrix4cd::Random(); 9 | MatrixPower Apow(A); 10 | 11 | std::cout << "The matrix A is:\n" << A << "\n\n" 12 | "A^3.1 is:\n" << Apow(3.1) << "\n\n" 13 | "A^3.3 is:\n" << Apow(3.3) << "\n\n" 14 | "A^3.7 is:\n" << Apow(3.7) << "\n\n" 15 | "A^3.9 is:\n" << Apow(3.9) << std::endl; 16 | return 0; 17 | } 18 | -------------------------------------------------------------------------------- /include/unsupported/doc/examples/MatrixSine.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | using namespace Eigen; 5 | 6 | int main() 7 | { 8 | MatrixXd A = MatrixXd::Random(3,3); 9 | std::cout << "A = \n" << A << "\n\n"; 10 | 11 | MatrixXd sinA = A.sin(); 12 | std::cout << "sin(A) = \n" << sinA << "\n\n"; 13 | 14 | MatrixXd cosA = A.cos(); 15 | std::cout << "cos(A) = \n" << cosA << "\n\n"; 16 | 17 | // The matrix functions satisfy sin^2(A) + cos^2(A) = I, 18 | // like the scalar functions. 19 | std::cout << "sin^2(A) + cos^2(A) = \n" << sinA*sinA + cosA*cosA << "\n\n"; 20 | } 21 | -------------------------------------------------------------------------------- /include/unsupported/doc/examples/MatrixSinh.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | using namespace Eigen; 5 | 6 | int main() 7 | { 8 | MatrixXf A = MatrixXf::Random(3,3); 9 | std::cout << "A = \n" << A << "\n\n"; 10 | 11 | MatrixXf sinhA = A.sinh(); 12 | std::cout << "sinh(A) = \n" << sinhA << "\n\n"; 13 | 14 | MatrixXf coshA = A.cosh(); 15 | std::cout << "cosh(A) = \n" << coshA << "\n\n"; 16 | 17 | // The matrix functions satisfy cosh^2(A) - sinh^2(A) = I, 18 | // like the scalar functions. 19 | std::cout << "cosh^2(A) - sinh^2(A) = \n" << coshA*coshA - sinhA*sinhA << "\n\n"; 20 | } 21 | -------------------------------------------------------------------------------- /include/unsupported/doc/examples/MatrixSquareRoot.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | using namespace Eigen; 5 | 6 | int main() 7 | { 8 | const double pi = std::acos(-1.0); 9 | 10 | MatrixXd A(2,2); 11 | A << cos(pi/3), -sin(pi/3), 12 | sin(pi/3), cos(pi/3); 13 | std::cout << "The matrix A is:\n" << A << "\n\n"; 14 | std::cout << "The matrix square root of A is:\n" << A.sqrt() << "\n\n"; 15 | std::cout << "The square of the last matrix is:\n" << A.sqrt() * A.sqrt() << "\n"; 16 | } 17 | -------------------------------------------------------------------------------- /include/unsupported/doc/examples/PolynomialSolver1.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | using namespace Eigen; 6 | using namespace std; 7 | 8 | int main() 9 | { 10 | typedef Matrix Vector5d; 11 | 12 | Vector5d roots = Vector5d::Random(); 13 | cout << "Roots: " << roots.transpose() << endl; 14 | Eigen::Matrix polynomial; 15 | roots_to_monicPolynomial( roots, polynomial ); 16 | 17 | PolynomialSolver psolve( polynomial ); 18 | cout << "Complex roots: " << psolve.roots().transpose() << endl; 19 | 20 | std::vector realRoots; 21 | psolve.realRoots( realRoots ); 22 | Map mapRR( &realRoots[0] ); 23 | cout << "Real roots: " << mapRR.transpose() << endl; 24 | 25 | cout << endl; 26 | cout << "Illustration of the convergence problem with the QR algorithm: " << endl; 27 | cout << "---------------------------------------------------------------" << endl; 28 | Eigen::Matrix hardCase_polynomial; 29 | hardCase_polynomial << 30 | -0.957, 0.9219, 0.3516, 0.9453, -0.4023, -0.5508, -0.03125; 31 | cout << "Hard case polynomial defined by floats: " << hardCase_polynomial.transpose() << endl; 32 | PolynomialSolver psolvef( hardCase_polynomial ); 33 | cout << "Complex roots: " << psolvef.roots().transpose() << endl; 34 | Eigen::Matrix evals; 35 | for( int i=0; i<6; ++i ){ evals[i] = std::abs( poly_eval( hardCase_polynomial, psolvef.roots()[i] ) ); } 36 | cout << "Norms of the evaluations of the polynomial at the roots: " << evals.transpose() << endl << endl; 37 | 38 | cout << "Using double's almost always solves the problem for small degrees: " << endl; 39 | cout << "-------------------------------------------------------------------" << endl; 40 | PolynomialSolver psolve6d( hardCase_polynomial.cast() ); 41 | cout << "Complex roots: " << psolve6d.roots().transpose() << endl; 42 | for( int i=0; i<6; ++i ) 43 | { 44 | std::complex castedRoot( psolve6d.roots()[i].real(), psolve6d.roots()[i].imag() ); 45 | evals[i] = std::abs( poly_eval( hardCase_polynomial, castedRoot ) ); 46 | } 47 | cout << "Norms of the evaluations of the polynomial at the roots: " << evals.transpose() << endl << endl; 48 | 49 | cout.precision(10); 50 | cout << "The last root in float then in double: " << psolvef.roots()[5] << "\t" << psolve6d.roots()[5] << endl; 51 | std::complex castedRoot( psolve6d.roots()[5].real(), psolve6d.roots()[5].imag() ); 52 | cout << "Norm of the difference: " << std::abs( psolvef.roots()[5] - castedRoot ) << endl; 53 | } 54 | -------------------------------------------------------------------------------- /include/unsupported/doc/examples/PolynomialUtils1.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | using namespace Eigen; 5 | using namespace std; 6 | 7 | int main() 8 | { 9 | Vector4d roots = Vector4d::Random(); 10 | cout << "Roots: " << roots.transpose() << endl; 11 | Eigen::Matrix polynomial; 12 | roots_to_monicPolynomial( roots, polynomial ); 13 | cout << "Polynomial: "; 14 | for( int i=0; i<4; ++i ){ cout << polynomial[i] << ".x^" << i << "+ "; } 15 | cout << polynomial[4] << ".x^4" << endl; 16 | Vector4d evaluation; 17 | for( int i=0; i<4; ++i ){ 18 | evaluation[i] = poly_eval( polynomial, roots[i] ); } 19 | cout << "Evaluation of the polynomial at the roots: " << evaluation.transpose(); 20 | } 21 | -------------------------------------------------------------------------------- /include/unsupported/doc/snippets/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB snippets_SRCS "*.cpp") 2 | 3 | ADD_CUSTOM_TARGET(unsupported_snippets) 4 | 5 | FOREACH(snippet_src ${snippets_SRCS}) 6 | GET_FILENAME_COMPONENT(snippet ${snippet_src} NAME_WE) 7 | SET(compile_snippet_target compile_${snippet}) 8 | SET(compile_snippet_src ${compile_snippet_target}.cpp) 9 | FILE(READ ${snippet_src} snippet_source_code) 10 | CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/doc/snippets/compile_snippet.cpp.in 11 | ${CMAKE_CURRENT_BINARY_DIR}/${compile_snippet_src}) 12 | ADD_EXECUTABLE(${compile_snippet_target} 13 | ${CMAKE_CURRENT_BINARY_DIR}/${compile_snippet_src}) 14 | if(EIGEN_STANDARD_LIBRARIES_TO_LINK_TO) 15 | target_link_libraries(${compile_snippet_target} ${EIGEN_STANDARD_LIBRARIES_TO_LINK_TO}) 16 | endif() 17 | ADD_CUSTOM_COMMAND( 18 | TARGET ${compile_snippet_target} 19 | POST_BUILD 20 | COMMAND ${compile_snippet_target} 21 | ARGS >${CMAKE_CURRENT_BINARY_DIR}/${snippet}.out 22 | ) 23 | ADD_DEPENDENCIES(unsupported_snippets ${compile_snippet_target}) 24 | set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/${compile_snippet_src} 25 | PROPERTIES OBJECT_DEPENDS ${snippet_src}) 26 | ENDFOREACH(snippet_src) 27 | -------------------------------------------------------------------------------- /include/unsupported/test/FFT.cpp: -------------------------------------------------------------------------------- 1 | #define test_FFTW test_FFT 2 | #include "FFTW.cpp" 3 | -------------------------------------------------------------------------------- /include/unsupported/test/alignedvector3.cpp: -------------------------------------------------------------------------------- 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 | #include "main.h" 11 | #include 12 | 13 | namespace Eigen { 14 | 15 | template 16 | T test_relative_error(const AlignedVector3 &a, const MatrixBase &b) 17 | { 18 | return test_relative_error(a.coeffs().template head<3>(), b); 19 | } 20 | 21 | } 22 | 23 | template 24 | void alignedvector3() 25 | { 26 | Scalar s1 = internal::random(); 27 | Scalar s2 = internal::random(); 28 | typedef Matrix RefType; 29 | typedef Matrix Mat33; 30 | typedef AlignedVector3 FastType; 31 | RefType r1(RefType::Random()), r2(RefType::Random()), r3(RefType::Random()), 32 | r4(RefType::Random()), r5(RefType::Random()); 33 | FastType f1(r1), f2(r2), f3(r3), f4(r4), f5(r5); 34 | Mat33 m1(Mat33::Random()); 35 | 36 | VERIFY_IS_APPROX(f1,r1); 37 | VERIFY_IS_APPROX(f4,r4); 38 | 39 | VERIFY_IS_APPROX(f4+f1,r4+r1); 40 | VERIFY_IS_APPROX(f4-f1,r4-r1); 41 | VERIFY_IS_APPROX(f4+f1-f2,r4+r1-r2); 42 | VERIFY_IS_APPROX(f4+=f3,r4+=r3); 43 | VERIFY_IS_APPROX(f4-=f5,r4-=r5); 44 | VERIFY_IS_APPROX(f4-=f5+f1,r4-=r5+r1); 45 | VERIFY_IS_APPROX(f5+f1-s1*f2,r5+r1-s1*r2); 46 | VERIFY_IS_APPROX(f5+f1/s2-s1*f2,r5+r1/s2-s1*r2); 47 | 48 | VERIFY_IS_APPROX(m1*f4,m1*r4); 49 | VERIFY_IS_APPROX(f4.transpose()*m1,r4.transpose()*m1); 50 | 51 | VERIFY_IS_APPROX(f2.dot(f3),r2.dot(r3)); 52 | VERIFY_IS_APPROX(f2.cross(f3),r2.cross(r3)); 53 | VERIFY_IS_APPROX(f2.norm(),r2.norm()); 54 | 55 | VERIFY_IS_APPROX(f2.normalized(),r2.normalized()); 56 | 57 | VERIFY_IS_APPROX((f2+f1).normalized(),(r2+r1).normalized()); 58 | 59 | f2.normalize(); 60 | r2.normalize(); 61 | VERIFY_IS_APPROX(f2,r2); 62 | 63 | { 64 | FastType f6 = RefType::Zero(); 65 | FastType f7 = FastType::Zero(); 66 | VERIFY_IS_APPROX(f6,f7); 67 | f6 = r4+r1; 68 | VERIFY_IS_APPROX(f6,r4+r1); 69 | f6 -= Scalar(2)*r4; 70 | VERIFY_IS_APPROX(f6,r1-r4); 71 | } 72 | 73 | std::stringstream ss1, ss2; 74 | ss1 << f1; 75 | ss2 << r1; 76 | VERIFY(ss1.str()==ss2.str()); 77 | } 78 | 79 | EIGEN_DECLARE_TEST(alignedvector3) 80 | { 81 | for(int i = 0; i < g_repeat; i++) { 82 | CALL_SUBTEST( alignedvector3() ); 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /include/unsupported/test/cxx11_maxsizevector.cpp: -------------------------------------------------------------------------------- 1 | #include "main.h" 2 | 3 | #include // std::exception 4 | 5 | #include 6 | 7 | struct Foo 8 | { 9 | static Index object_count; 10 | static Index object_limit; 11 | EIGEN_ALIGN_TO_BOUNDARY(128) int dummy; 12 | 13 | Foo(int x=0) : dummy(x) 14 | { 15 | #ifdef EIGEN_EXCEPTIONS 16 | // TODO: Is this the correct way to handle this? 17 | if (Foo::object_count > Foo::object_limit) { std::cout << "\nThrow!\n"; throw Foo::Fail(); } 18 | #endif 19 | std::cout << '+'; 20 | ++Foo::object_count; 21 | eigen_assert((internal::UIntPtr(this) & (127)) == 0); 22 | } 23 | Foo(const Foo&) 24 | { 25 | std::cout << 'c'; 26 | ++Foo::object_count; 27 | eigen_assert((internal::UIntPtr(this) & (127)) == 0); 28 | } 29 | 30 | ~Foo() 31 | { 32 | std::cout << '~'; 33 | --Foo::object_count; 34 | } 35 | 36 | class Fail : public std::exception {}; 37 | }; 38 | 39 | Index Foo::object_count = 0; 40 | Index Foo::object_limit = 0; 41 | 42 | 43 | 44 | EIGEN_DECLARE_TEST(cxx11_maxsizevector) 45 | { 46 | typedef MaxSizeVector VectorX; 47 | Foo::object_count = 0; 48 | for(int r = 0; r < g_repeat; r++) { 49 | Index rows = internal::random(3,30); 50 | Foo::object_limit = internal::random(0, rows - 2); 51 | std::cout << "object_limit = " << Foo::object_limit << std::endl; 52 | bool exception_raised = false; 53 | #ifdef EIGEN_EXCEPTIONS 54 | try 55 | { 56 | #endif 57 | std::cout << "\nVectorX m(" << rows << ");\n"; 58 | VectorX vect(rows); 59 | for(int i=0; i 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 | #define EIGEN_TEST_NO_LONGDOUBLE 11 | #define EIGEN_TEST_NO_COMPLEX 12 | 13 | #define EIGEN_DEFAULT_DENSE_INDEX_TYPE int 14 | #define EIGEN_USE_GPU 15 | 16 | #include "main.h" 17 | #include 18 | 19 | using Eigen::Tensor; 20 | 21 | void test_gpu_conversion() { 22 | Eigen::GpuStreamDevice stream; 23 | Eigen::GpuDevice gpu_device(&stream); 24 | int num_elem = 101; 25 | 26 | Tensor floats(num_elem); 27 | floats.setRandom(); 28 | 29 | float* d_float = (float*)gpu_device.allocate(num_elem * sizeof(float)); 30 | Eigen::half* d_half = (Eigen::half*)gpu_device.allocate(num_elem * sizeof(Eigen::half)); 31 | float* d_conv = (float*)gpu_device.allocate(num_elem * sizeof(float)); 32 | 33 | Eigen::TensorMap, Eigen::Aligned> gpu_float( 34 | d_float, num_elem); 35 | Eigen::TensorMap, Eigen::Aligned> gpu_half( 36 | d_half, num_elem); 37 | Eigen::TensorMap, Eigen::Aligned> gpu_conv( 38 | d_conv, num_elem); 39 | 40 | gpu_device.memcpyHostToDevice(d_float, floats.data(), num_elem*sizeof(float)); 41 | 42 | gpu_half.device(gpu_device) = gpu_float.cast(); 43 | gpu_conv.device(gpu_device) = gpu_half.cast(); 44 | 45 | Tensor initial(num_elem); 46 | Tensor final(num_elem); 47 | gpu_device.memcpyDeviceToHost(initial.data(), d_float, num_elem*sizeof(float)); 48 | gpu_device.memcpyDeviceToHost(final.data(), d_conv, num_elem*sizeof(float)); 49 | gpu_device.synchronize(); 50 | 51 | for (int i = 0; i < num_elem; ++i) { 52 | VERIFY_IS_APPROX(initial(i), final(i)); 53 | } 54 | 55 | gpu_device.deallocate(d_float); 56 | gpu_device.deallocate(d_half); 57 | gpu_device.deallocate(d_conv); 58 | } 59 | 60 | 61 | void test_fallback_conversion() { 62 | int num_elem = 101; 63 | Tensor floats(num_elem); 64 | floats.setRandom(); 65 | 66 | Eigen::Tensor halfs = floats.cast(); 67 | Eigen::Tensor conv = halfs.cast(); 68 | 69 | for (int i = 0; i < num_elem; ++i) { 70 | VERIFY_IS_APPROX(floats(i), conv(i)); 71 | } 72 | } 73 | 74 | 75 | EIGEN_DECLARE_TEST(cxx11_tensor_cast_float16_gpu) 76 | { 77 | CALL_SUBTEST(test_gpu_conversion()); 78 | CALL_SUBTEST(test_fallback_conversion()); 79 | } 80 | -------------------------------------------------------------------------------- /include/unsupported/test/cxx11_tensor_comparisons.cpp: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2014 Benoit Steiner 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 | #include "main.h" 11 | 12 | #include 13 | 14 | using Eigen::Tensor; 15 | using Eigen::RowMajor; 16 | 17 | static void test_orderings() 18 | { 19 | Tensor mat1(2,3,7); 20 | Tensor mat2(2,3,7); 21 | Tensor lt(2,3,7); 22 | Tensor le(2,3,7); 23 | Tensor gt(2,3,7); 24 | Tensor ge(2,3,7); 25 | 26 | mat1.setRandom(); 27 | mat2.setRandom(); 28 | 29 | lt = mat1 < mat2; 30 | le = mat1 <= mat2; 31 | gt = mat1 > mat2; 32 | ge = mat1 >= mat2; 33 | 34 | for (int i = 0; i < 2; ++i) { 35 | for (int j = 0; j < 3; ++j) { 36 | for (int k = 0; k < 7; ++k) { 37 | VERIFY_IS_EQUAL(lt(i,j,k), mat1(i,j,k) < mat2(i,j,k)); 38 | VERIFY_IS_EQUAL(le(i,j,k), mat1(i,j,k) <= mat2(i,j,k)); 39 | VERIFY_IS_EQUAL(gt(i,j,k), mat1(i,j,k) > mat2(i,j,k)); 40 | VERIFY_IS_EQUAL(ge(i,j,k), mat1(i,j,k) >= mat2(i,j,k)); 41 | } 42 | } 43 | } 44 | } 45 | 46 | 47 | static void test_equality() 48 | { 49 | Tensor mat1(2,3,7); 50 | Tensor mat2(2,3,7); 51 | 52 | mat1.setRandom(); 53 | mat2.setRandom(); 54 | for (int i = 0; i < 2; ++i) { 55 | for (int j = 0; j < 3; ++j) { 56 | for (int k = 0; k < 7; ++k) { 57 | if (internal::random()) { 58 | mat2(i,j,k) = mat1(i,j,k); 59 | } 60 | } 61 | } 62 | } 63 | 64 | Tensor eq(2,3,7); 65 | Tensor ne(2,3,7); 66 | eq = (mat1 == mat2); 67 | ne = (mat1 != mat2); 68 | 69 | for (int i = 0; i < 2; ++i) { 70 | for (int j = 0; j < 3; ++j) { 71 | for (int k = 0; k < 7; ++k) { 72 | VERIFY_IS_EQUAL(eq(i,j,k), mat1(i,j,k) == mat2(i,j,k)); 73 | VERIFY_IS_EQUAL(ne(i,j,k), mat1(i,j,k) != mat2(i,j,k)); 74 | } 75 | } 76 | } 77 | } 78 | 79 | 80 | EIGEN_DECLARE_TEST(cxx11_tensor_comparisons) 81 | { 82 | CALL_SUBTEST(test_orderings()); 83 | CALL_SUBTEST(test_equality()); 84 | } 85 | -------------------------------------------------------------------------------- /include/unsupported/test/cxx11_tensor_const.cpp: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2014 Benoit Steiner 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 | #include "main.h" 11 | 12 | #include 13 | using Eigen::Tensor; 14 | 15 | 16 | static void test_simple_assign() 17 | { 18 | Tensor random(2,3,7); 19 | random.setRandom(); 20 | 21 | TensorMap > constant(random.data(), 2, 3, 7); 22 | Tensor result(2,3,7); 23 | result = constant; 24 | 25 | for (int i = 0; i < 2; ++i) { 26 | for (int j = 0; j < 3; ++j) { 27 | for (int k = 0; k < 7; ++k) { 28 | VERIFY_IS_EQUAL((result(i,j,k)), random(i,j,k)); 29 | } 30 | } 31 | } 32 | } 33 | 34 | 35 | static void test_assign_of_const_tensor() 36 | { 37 | Tensor random(2,3,7); 38 | random.setRandom(); 39 | 40 | TensorMap > constant1(random.data(), 2, 3, 7); 41 | TensorMap > constant2(random.data(), 2, 3, 7); 42 | const TensorMap > constant3(random.data(), 2, 3, 7); 43 | 44 | Tensor result1 = constant1.chip(0, 2); 45 | Tensor result2 = constant2.chip(0, 2); 46 | Tensor result3 = constant3.chip(0, 2); 47 | 48 | for (int i = 0; i < 2; ++i) { 49 | for (int j = 0; j < 3; ++j) { 50 | VERIFY_IS_EQUAL((result1(i,j)), random(i,j,0)); 51 | VERIFY_IS_EQUAL((result2(i,j)), random(i,j,0)); 52 | VERIFY_IS_EQUAL((result3(i,j)), random(i,j,0)); 53 | } 54 | } 55 | } 56 | 57 | 58 | EIGEN_DECLARE_TEST(cxx11_tensor_const) 59 | { 60 | CALL_SUBTEST(test_simple_assign()); 61 | CALL_SUBTEST(test_assign_of_const_tensor()); 62 | } 63 | -------------------------------------------------------------------------------- /include/unsupported/test/cxx11_tensor_empty.cpp: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2015 Benoit Steiner 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 | #include "main.h" 11 | 12 | #include 13 | 14 | 15 | static void test_empty_tensor() 16 | { 17 | Tensor source; 18 | Tensor tgt1 = source; 19 | Tensor tgt2(source); 20 | Tensor tgt3; 21 | tgt3 = tgt1; 22 | tgt3 = tgt2; 23 | } 24 | 25 | static void test_empty_fixed_size_tensor() 26 | { 27 | TensorFixedSize > source; 28 | TensorFixedSize > tgt1 = source; 29 | TensorFixedSize > tgt2(source); 30 | TensorFixedSize > tgt3; 31 | tgt3 = tgt1; 32 | tgt3 = tgt2; 33 | } 34 | 35 | 36 | EIGEN_DECLARE_TEST(cxx11_tensor_empty) 37 | { 38 | CALL_SUBTEST(test_empty_tensor()); 39 | CALL_SUBTEST(test_empty_fixed_size_tensor()); 40 | } 41 | -------------------------------------------------------------------------------- /include/unsupported/test/cxx11_tensor_forced_eval.cpp: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2014 Benoit Steiner 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 | #include "main.h" 11 | 12 | #include 13 | #include 14 | 15 | using Eigen::MatrixXf; 16 | using Eigen::Tensor; 17 | 18 | static void test_simple() 19 | { 20 | MatrixXf m1(3,3); 21 | MatrixXf m2(3,3); 22 | m1.setRandom(); 23 | m2.setRandom(); 24 | 25 | TensorMap > mat1(m1.data(), 3,3); 26 | TensorMap > mat2(m2.data(), 3,3); 27 | 28 | Tensor mat3(3,3); 29 | mat3 = mat1; 30 | 31 | typedef Tensor::DimensionPair DimPair; 32 | Eigen::array dims; 33 | dims[0] = DimPair(1, 0); 34 | 35 | mat3 = mat3.contract(mat2, dims).eval(); 36 | 37 | VERIFY_IS_APPROX(mat3(0, 0), (m1*m2).eval()(0,0)); 38 | VERIFY_IS_APPROX(mat3(0, 1), (m1*m2).eval()(0,1)); 39 | VERIFY_IS_APPROX(mat3(0, 2), (m1*m2).eval()(0,2)); 40 | VERIFY_IS_APPROX(mat3(1, 0), (m1*m2).eval()(1,0)); 41 | VERIFY_IS_APPROX(mat3(1, 1), (m1*m2).eval()(1,1)); 42 | VERIFY_IS_APPROX(mat3(1, 2), (m1*m2).eval()(1,2)); 43 | VERIFY_IS_APPROX(mat3(2, 0), (m1*m2).eval()(2,0)); 44 | VERIFY_IS_APPROX(mat3(2, 1), (m1*m2).eval()(2,1)); 45 | VERIFY_IS_APPROX(mat3(2, 2), (m1*m2).eval()(2,2)); 46 | } 47 | 48 | 49 | static void test_const() 50 | { 51 | MatrixXf input(3,3); 52 | input.setRandom(); 53 | MatrixXf output = input; 54 | output.rowwise() -= input.colwise().maxCoeff(); 55 | 56 | Eigen::array depth_dim; 57 | depth_dim[0] = 0; 58 | Tensor::Dimensions dims2d; 59 | dims2d[0] = 1; 60 | dims2d[1] = 3; 61 | Eigen::array bcast; 62 | bcast[0] = 3; 63 | bcast[1] = 1; 64 | const TensorMap > input_tensor(input.data(), 3, 3); 65 | Tensor output_tensor= (input_tensor - input_tensor.maximum(depth_dim).eval().reshape(dims2d).broadcast(bcast)); 66 | 67 | for (int i = 0; i < 3; ++i) { 68 | for (int j = 0; j < 3; ++j) { 69 | VERIFY_IS_APPROX(output(i, j), output_tensor(i, j)); 70 | } 71 | } 72 | } 73 | 74 | 75 | EIGEN_DECLARE_TEST(cxx11_tensor_forced_eval) 76 | { 77 | CALL_SUBTEST(test_simple()); 78 | CALL_SUBTEST(test_const()); 79 | } 80 | -------------------------------------------------------------------------------- /include/unsupported/test/cxx11_tensor_generator.cpp: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2015 Benoit Steiner 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 | #include "main.h" 11 | 12 | #include 13 | 14 | struct Generator1D { 15 | Generator1D() { } 16 | 17 | float operator()(const array& coordinates) const { 18 | return coordinates[0]; 19 | } 20 | }; 21 | 22 | template 23 | static void test_1D() 24 | { 25 | Tensor vec(6); 26 | Tensor result = vec.generate(Generator1D()); 27 | 28 | for (int i = 0; i < 6; ++i) { 29 | VERIFY_IS_EQUAL(result(i), i); 30 | } 31 | } 32 | 33 | 34 | struct Generator2D { 35 | Generator2D() { } 36 | 37 | float operator()(const array& coordinates) const { 38 | return 3 * coordinates[0] + 11 * coordinates[1]; 39 | } 40 | }; 41 | 42 | template 43 | static void test_2D() 44 | { 45 | Tensor matrix(5, 7); 46 | Tensor result = matrix.generate(Generator2D()); 47 | 48 | for (int i = 0; i < 5; ++i) { 49 | for (int j = 0; j < 5; ++j) { 50 | VERIFY_IS_EQUAL(result(i, j), 3*i + 11*j); 51 | } 52 | } 53 | } 54 | 55 | 56 | template 57 | static void test_gaussian() 58 | { 59 | int rows = 32; 60 | int cols = 48; 61 | array means; 62 | means[0] = rows / 2.0f; 63 | means[1] = cols / 2.0f; 64 | array std_devs; 65 | std_devs[0] = 3.14f; 66 | std_devs[1] = 2.7f; 67 | internal::GaussianGenerator gaussian_gen(means, std_devs); 68 | 69 | Tensor matrix(rows, cols); 70 | Tensor result = matrix.generate(gaussian_gen); 71 | 72 | for (int i = 0; i < rows; ++i) { 73 | for (int j = 0; j < cols; ++j) { 74 | float g_rows = powf(rows/2.0f - i, 2) / (3.14f * 3.14f) * 0.5f; 75 | float g_cols = powf(cols/2.0f - j, 2) / (2.7f * 2.7f) * 0.5f; 76 | float gaussian = expf(-g_rows - g_cols); 77 | VERIFY_IS_EQUAL(result(i, j), gaussian); 78 | } 79 | } 80 | } 81 | 82 | 83 | EIGEN_DECLARE_TEST(cxx11_tensor_generator) 84 | { 85 | CALL_SUBTEST(test_1D()); 86 | CALL_SUBTEST(test_1D()); 87 | CALL_SUBTEST(test_2D()); 88 | CALL_SUBTEST(test_2D()); 89 | CALL_SUBTEST(test_gaussian()); 90 | CALL_SUBTEST(test_gaussian()); 91 | } 92 | -------------------------------------------------------------------------------- /include/unsupported/test/cxx11_tensor_inflation.cpp: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2015 Ke Yang 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 | #include "main.h" 11 | 12 | #include 13 | 14 | using Eigen::Tensor; 15 | 16 | template 17 | static void test_simple_inflation() 18 | { 19 | Tensor tensor(2,3,5,7); 20 | tensor.setRandom(); 21 | array strides; 22 | 23 | strides[0] = 1; 24 | strides[1] = 1; 25 | strides[2] = 1; 26 | strides[3] = 1; 27 | 28 | Tensor no_stride; 29 | no_stride = tensor.inflate(strides); 30 | 31 | VERIFY_IS_EQUAL(no_stride.dimension(0), 2); 32 | VERIFY_IS_EQUAL(no_stride.dimension(1), 3); 33 | VERIFY_IS_EQUAL(no_stride.dimension(2), 5); 34 | VERIFY_IS_EQUAL(no_stride.dimension(3), 7); 35 | 36 | for (int i = 0; i < 2; ++i) { 37 | for (int j = 0; j < 3; ++j) { 38 | for (int k = 0; k < 5; ++k) { 39 | for (int l = 0; l < 7; ++l) { 40 | VERIFY_IS_EQUAL(tensor(i,j,k,l), no_stride(i,j,k,l)); 41 | } 42 | } 43 | } 44 | } 45 | 46 | strides[0] = 2; 47 | strides[1] = 4; 48 | strides[2] = 2; 49 | strides[3] = 3; 50 | Tensor inflated; 51 | inflated = tensor.inflate(strides); 52 | 53 | VERIFY_IS_EQUAL(inflated.dimension(0), 3); 54 | VERIFY_IS_EQUAL(inflated.dimension(1), 9); 55 | VERIFY_IS_EQUAL(inflated.dimension(2), 9); 56 | VERIFY_IS_EQUAL(inflated.dimension(3), 19); 57 | 58 | for (int i = 0; i < 3; ++i) { 59 | for (int j = 0; j < 9; ++j) { 60 | for (int k = 0; k < 9; ++k) { 61 | for (int l = 0; l < 19; ++l) { 62 | if (i % 2 == 0 && 63 | j % 4 == 0 && 64 | k % 2 == 0 && 65 | l % 3 == 0) { 66 | VERIFY_IS_EQUAL(inflated(i,j,k,l), 67 | tensor(i/2, j/4, k/2, l/3)); 68 | } else { 69 | VERIFY_IS_EQUAL(0, inflated(i,j,k,l)); 70 | } 71 | } 72 | } 73 | } 74 | } 75 | } 76 | 77 | EIGEN_DECLARE_TEST(cxx11_tensor_inflation) 78 | { 79 | CALL_SUBTEST(test_simple_inflation()); 80 | CALL_SUBTEST(test_simple_inflation()); 81 | } 82 | -------------------------------------------------------------------------------- /include/unsupported/test/cxx11_tensor_layout_swap.cpp: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2014 Benoit Steiner 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 | #include "main.h" 11 | 12 | #include 13 | 14 | using Eigen::Tensor; 15 | 16 | static void test_simple_swap() 17 | { 18 | Tensor tensor(2,3,7); 19 | tensor.setRandom(); 20 | 21 | Tensor tensor2 = tensor.swap_layout(); 22 | VERIFY_IS_EQUAL(tensor.dimension(0), tensor2.dimension(2)); 23 | VERIFY_IS_EQUAL(tensor.dimension(1), tensor2.dimension(1)); 24 | VERIFY_IS_EQUAL(tensor.dimension(2), tensor2.dimension(0)); 25 | 26 | for (int i = 0; i < 2; ++i) { 27 | for (int j = 0; j < 3; ++j) { 28 | for (int k = 0; k < 7; ++k) { 29 | VERIFY_IS_EQUAL(tensor(i,j,k), tensor2(k,j,i)); 30 | } 31 | } 32 | } 33 | } 34 | 35 | 36 | static void test_swap_as_lvalue() 37 | { 38 | Tensor tensor(2,3,7); 39 | tensor.setRandom(); 40 | 41 | Tensor tensor2(7,3,2); 42 | tensor2.swap_layout() = tensor; 43 | VERIFY_IS_EQUAL(tensor.dimension(0), tensor2.dimension(2)); 44 | VERIFY_IS_EQUAL(tensor.dimension(1), tensor2.dimension(1)); 45 | VERIFY_IS_EQUAL(tensor.dimension(2), tensor2.dimension(0)); 46 | 47 | for (int i = 0; i < 2; ++i) { 48 | for (int j = 0; j < 3; ++j) { 49 | for (int k = 0; k < 7; ++k) { 50 | VERIFY_IS_EQUAL(tensor(i,j,k), tensor2(k,j,i)); 51 | } 52 | } 53 | } 54 | } 55 | 56 | 57 | EIGEN_DECLARE_TEST(cxx11_tensor_layout_swap) 58 | { 59 | CALL_SUBTEST(test_simple_swap()); 60 | CALL_SUBTEST(test_swap_as_lvalue()); 61 | } 62 | -------------------------------------------------------------------------------- /include/unsupported/test/cxx11_tensor_lvalue.cpp: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2014 Benoit Steiner 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 | #include "main.h" 11 | 12 | #include 13 | 14 | using Eigen::Tensor; 15 | using Eigen::RowMajor; 16 | 17 | 18 | static void test_compound_assignment() 19 | { 20 | Tensor mat1(2,3,7); 21 | Tensor mat2(2,3,7); 22 | Tensor mat3(2,3,7); 23 | 24 | mat1.setRandom(); 25 | mat2.setRandom(); 26 | mat3 = mat1; 27 | mat3 += mat2; 28 | 29 | for (int i = 0; i < 2; ++i) { 30 | for (int j = 0; j < 3; ++j) { 31 | for (int k = 0; k < 7; ++k) { 32 | VERIFY_IS_APPROX(mat3(i,j,k), mat1(i,j,k) + mat2(i,j,k)); 33 | } 34 | } 35 | } 36 | } 37 | 38 | 39 | EIGEN_DECLARE_TEST(cxx11_tensor_lvalue) 40 | { 41 | CALL_SUBTEST(test_compound_assignment()); 42 | } 43 | -------------------------------------------------------------------------------- /include/unsupported/test/cxx11_tensor_math.cpp: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2015 Benoit Steiner 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 | #include "main.h" 11 | 12 | #include 13 | 14 | using Eigen::Tensor; 15 | using Eigen::RowMajor; 16 | 17 | static void test_tanh() 18 | { 19 | Tensor vec1(6); 20 | vec1.setRandom(); 21 | 22 | Tensor vec2 = vec1.tanh(); 23 | 24 | for (int i = 0; i < 6; ++i) { 25 | VERIFY_IS_APPROX(vec2(i), tanhf(vec1(i))); 26 | } 27 | } 28 | 29 | static void test_sigmoid() 30 | { 31 | Tensor vec1(6); 32 | vec1.setRandom(); 33 | 34 | Tensor vec2 = vec1.sigmoid(); 35 | 36 | for (int i = 0; i < 6; ++i) { 37 | VERIFY_IS_APPROX(vec2(i), 1.0f / (1.0f + std::exp(-vec1(i)))); 38 | } 39 | } 40 | 41 | 42 | EIGEN_DECLARE_TEST(cxx11_tensor_math) 43 | { 44 | CALL_SUBTEST(test_tanh()); 45 | CALL_SUBTEST(test_sigmoid()); 46 | } 47 | -------------------------------------------------------------------------------- /include/unsupported/test/cxx11_tensor_mixed_indices.cpp: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2014 Benoit Steiner 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 | #include "main.h" 11 | 12 | #include 13 | 14 | 15 | static void test_simple() 16 | { 17 | Tensor vec1(6); 18 | Tensor vec2(6); 19 | 20 | vec1(0) = 4.0; vec2(0) = 0.0; 21 | vec1(1) = 8.0; vec2(1) = 1.0; 22 | vec1(2) = 15.0; vec2(2) = 2.0; 23 | vec1(3) = 16.0; vec2(3) = 3.0; 24 | vec1(4) = 23.0; vec2(4) = 4.0; 25 | vec1(5) = 42.0; vec2(5) = 5.0; 26 | 27 | float data3[6]; 28 | TensorMap> vec3(data3, 6); 29 | vec3 = vec1.sqrt(); 30 | float data4[6]; 31 | TensorMap> vec4(data4, 6); 32 | vec4 = vec2.square(); 33 | 34 | VERIFY_IS_APPROX(vec3(0), sqrtf(4.0)); 35 | VERIFY_IS_APPROX(vec3(1), sqrtf(8.0)); 36 | VERIFY_IS_APPROX(vec3(2), sqrtf(15.0)); 37 | VERIFY_IS_APPROX(vec3(3), sqrtf(16.0)); 38 | VERIFY_IS_APPROX(vec3(4), sqrtf(23.0)); 39 | VERIFY_IS_APPROX(vec3(5), sqrtf(42.0)); 40 | 41 | VERIFY_IS_APPROX(vec4(0), 0.0f); 42 | VERIFY_IS_APPROX(vec4(1), 1.0f); 43 | VERIFY_IS_APPROX(vec4(2), 2.0f * 2.0f); 44 | VERIFY_IS_APPROX(vec4(3), 3.0f * 3.0f); 45 | VERIFY_IS_APPROX(vec4(4), 4.0f * 4.0f); 46 | VERIFY_IS_APPROX(vec4(5), 5.0f * 5.0f); 47 | } 48 | 49 | 50 | EIGEN_DECLARE_TEST(cxx11_tensor_mixed_indices) 51 | { 52 | CALL_SUBTEST(test_simple()); 53 | } 54 | -------------------------------------------------------------------------------- /include/unsupported/test/cxx11_tensor_move.cpp: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2017 Viktor Csomor 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 | #include "main.h" 11 | 12 | #include 13 | #include 14 | 15 | using Eigen::Tensor; 16 | using Eigen::RowMajor; 17 | 18 | static void calc_indices(int i, int& x, int& y, int& z) 19 | { 20 | x = i / 4; 21 | y = (i % 4) / 2; 22 | z = i % 2; 23 | } 24 | 25 | static void test_move() 26 | { 27 | int x; 28 | int y; 29 | int z; 30 | 31 | Tensor tensor1(2, 2, 2); 32 | Tensor tensor2(2, 2, 2); 33 | 34 | for (int i = 0; i < 8; i++) 35 | { 36 | calc_indices(i, x, y, z); 37 | tensor1(x,y,z) = i; 38 | tensor2(x,y,z) = 2 * i; 39 | } 40 | 41 | // Invokes the move constructor. 42 | Tensor moved_tensor1 = std::move(tensor1); 43 | Tensor moved_tensor2 = std::move(tensor2); 44 | 45 | VERIFY_IS_EQUAL(tensor1.size(), 0); 46 | VERIFY_IS_EQUAL(tensor2.size(), 0); 47 | 48 | for (int i = 0; i < 8; i++) 49 | { 50 | calc_indices(i, x, y, z); 51 | VERIFY_IS_EQUAL(moved_tensor1(x,y,z), i); 52 | VERIFY_IS_EQUAL(moved_tensor2(x,y,z), 2 * i); 53 | } 54 | 55 | Tensor moved_tensor3(2,2,2); 56 | Tensor moved_tensor4(2,2,2); 57 | 58 | moved_tensor3.setZero(); 59 | moved_tensor4.setZero(); 60 | 61 | // Invokes the move assignment operator. 62 | moved_tensor3 = std::move(moved_tensor1); 63 | moved_tensor4 = std::move(moved_tensor2); 64 | 65 | VERIFY_IS_EQUAL(moved_tensor1.size(), 8); 66 | VERIFY_IS_EQUAL(moved_tensor2.size(), 8); 67 | 68 | for (int i = 0; i < 8; i++) 69 | { 70 | calc_indices(i, x, y, z); 71 | VERIFY_IS_EQUAL(moved_tensor1(x,y,z), 0); 72 | VERIFY_IS_EQUAL(moved_tensor2(x,y,z), 0); 73 | VERIFY_IS_EQUAL(moved_tensor3(x,y,z), i); 74 | VERIFY_IS_EQUAL(moved_tensor4(x,y,z), 2 * i); 75 | } 76 | } 77 | 78 | EIGEN_DECLARE_TEST(cxx11_tensor_move) 79 | { 80 | CALL_SUBTEST(test_move()); 81 | } 82 | -------------------------------------------------------------------------------- /include/unsupported/test/cxx11_tensor_notification.cpp: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2015 Vijay Vasudevan 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 | #define EIGEN_USE_THREADS 11 | 12 | #include 13 | #include "main.h" 14 | #include 15 | 16 | 17 | namespace { 18 | 19 | void WaitAndAdd(Eigen::Notification* n, int* counter) { 20 | n->Wait(); 21 | *counter = *counter + 1; 22 | } 23 | 24 | } // namespace 25 | 26 | static void test_notification_single() 27 | { 28 | ThreadPool thread_pool(1); 29 | 30 | int counter = 0; 31 | Eigen::Notification n; 32 | std::function func = std::bind(&WaitAndAdd, &n, &counter); 33 | thread_pool.Schedule(func); 34 | EIGEN_SLEEP(1000); 35 | 36 | // The thread should be waiting for the notification. 37 | VERIFY_IS_EQUAL(counter, 0); 38 | 39 | // Unblock the thread 40 | n.Notify(); 41 | 42 | EIGEN_SLEEP(1000); 43 | 44 | // Verify the counter has been incremented 45 | VERIFY_IS_EQUAL(counter, 1); 46 | } 47 | 48 | // Like test_notification_single() but enqueues multiple threads to 49 | // validate that all threads get notified by Notify(). 50 | static void test_notification_multiple() 51 | { 52 | ThreadPool thread_pool(1); 53 | 54 | int counter = 0; 55 | Eigen::Notification n; 56 | std::function func = std::bind(&WaitAndAdd, &n, &counter); 57 | thread_pool.Schedule(func); 58 | thread_pool.Schedule(func); 59 | thread_pool.Schedule(func); 60 | thread_pool.Schedule(func); 61 | EIGEN_SLEEP(1000); 62 | VERIFY_IS_EQUAL(counter, 0); 63 | n.Notify(); 64 | EIGEN_SLEEP(1000); 65 | VERIFY_IS_EQUAL(counter, 4); 66 | } 67 | 68 | EIGEN_DECLARE_TEST(cxx11_tensor_notification) 69 | { 70 | CALL_SUBTEST(test_notification_single()); 71 | CALL_SUBTEST(test_notification_multiple()); 72 | } 73 | -------------------------------------------------------------------------------- /include/unsupported/test/cxx11_tensor_random.cpp: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2014 Benoit Steiner 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 | #include "main.h" 11 | 12 | #include 13 | 14 | static void test_default() 15 | { 16 | Tensor vec(6); 17 | vec.setRandom(); 18 | 19 | // Fixme: we should check that the generated numbers follow a uniform 20 | // distribution instead. 21 | for (int i = 1; i < 6; ++i) { 22 | VERIFY_IS_NOT_EQUAL(vec(i), vec(i-1)); 23 | } 24 | } 25 | 26 | static void test_normal() 27 | { 28 | Tensor vec(6); 29 | vec.setRandom>(); 30 | 31 | // Fixme: we should check that the generated numbers follow a gaussian 32 | // distribution instead. 33 | for (int i = 1; i < 6; ++i) { 34 | VERIFY_IS_NOT_EQUAL(vec(i), vec(i-1)); 35 | } 36 | } 37 | 38 | 39 | struct MyGenerator { 40 | MyGenerator() { } 41 | MyGenerator(const MyGenerator&) { } 42 | 43 | // Return a random value to be used. "element_location" is the 44 | // location of the entry to set in the tensor, it can typically 45 | // be ignored. 46 | int operator()(Eigen::DenseIndex element_location, Eigen::DenseIndex /*unused*/ = 0) const { 47 | return static_cast(3 * element_location); 48 | } 49 | 50 | // Same as above but generates several numbers at a time. 51 | internal::packet_traits::type packetOp( 52 | Eigen::DenseIndex packet_location, Eigen::DenseIndex /*unused*/ = 0) const { 53 | const int packetSize = internal::packet_traits::size; 54 | EIGEN_ALIGN_MAX int values[packetSize]; 55 | for (int i = 0; i < packetSize; ++i) { 56 | values[i] = static_cast(3 * (packet_location + i)); 57 | } 58 | return internal::pload::type>(values); 59 | } 60 | }; 61 | 62 | 63 | static void test_custom() 64 | { 65 | Tensor vec(6); 66 | vec.setRandom(); 67 | 68 | for (int i = 0; i < 6; ++i) { 69 | VERIFY_IS_EQUAL(vec(i), 3*i); 70 | } 71 | } 72 | 73 | EIGEN_DECLARE_TEST(cxx11_tensor_random) 74 | { 75 | CALL_SUBTEST(test_default()); 76 | CALL_SUBTEST(test_normal()); 77 | CALL_SUBTEST(test_custom()); 78 | } 79 | -------------------------------------------------------------------------------- /include/unsupported/test/cxx11_tensor_random_gpu.cu: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2014 Benoit Steiner 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 | #define EIGEN_TEST_NO_LONGDOUBLE 11 | #define EIGEN_TEST_NO_COMPLEX 12 | 13 | #define EIGEN_DEFAULT_DENSE_INDEX_TYPE int 14 | #define EIGEN_USE_GPU 15 | 16 | #include "main.h" 17 | #include 18 | 19 | #include 20 | 21 | void test_gpu_random_uniform() 22 | { 23 | Tensor out(72,97); 24 | out.setZero(); 25 | 26 | std::size_t out_bytes = out.size() * sizeof(float); 27 | 28 | float* d_out; 29 | gpuMalloc((void**)(&d_out), out_bytes); 30 | 31 | Eigen::GpuStreamDevice stream; 32 | Eigen::GpuDevice gpu_device(&stream); 33 | 34 | Eigen::TensorMap > gpu_out(d_out, 72,97); 35 | 36 | gpu_out.device(gpu_device) = gpu_out.random(); 37 | 38 | assert(gpuMemcpyAsync(out.data(), d_out, out_bytes, gpuMemcpyDeviceToHost, gpu_device.stream()) == gpuSuccess); 39 | assert(gpuStreamSynchronize(gpu_device.stream()) == gpuSuccess); 40 | 41 | // For now we just check this code doesn't crash. 42 | // TODO: come up with a valid test of randomness 43 | } 44 | 45 | 46 | void test_gpu_random_normal() 47 | { 48 | Tensor out(72,97); 49 | out.setZero(); 50 | 51 | std::size_t out_bytes = out.size() * sizeof(float); 52 | 53 | float* d_out; 54 | gpuMalloc((void**)(&d_out), out_bytes); 55 | 56 | Eigen::GpuStreamDevice stream; 57 | Eigen::GpuDevice gpu_device(&stream); 58 | 59 | Eigen::TensorMap > gpu_out(d_out, 72,97); 60 | 61 | Eigen::internal::NormalRandomGenerator gen(true); 62 | gpu_out.device(gpu_device) = gpu_out.random(gen); 63 | 64 | assert(gpuMemcpyAsync(out.data(), d_out, out_bytes, gpuMemcpyDeviceToHost, gpu_device.stream()) == gpuSuccess); 65 | assert(gpuStreamSynchronize(gpu_device.stream()) == gpuSuccess); 66 | } 67 | 68 | static void test_complex() 69 | { 70 | Tensor, 1> vec(6); 71 | vec.setRandom(); 72 | 73 | // Fixme: we should check that the generated numbers follow a uniform 74 | // distribution instead. 75 | for (int i = 1; i < 6; ++i) { 76 | VERIFY_IS_NOT_EQUAL(vec(i), vec(i-1)); 77 | } 78 | } 79 | 80 | 81 | EIGEN_DECLARE_TEST(cxx11_tensor_random_gpu) 82 | { 83 | CALL_SUBTEST(test_gpu_random_uniform()); 84 | CALL_SUBTEST(test_gpu_random_normal()); 85 | CALL_SUBTEST(test_complex()); 86 | } 87 | -------------------------------------------------------------------------------- /include/unsupported/test/cxx11_tensor_roundings.cpp: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2016 Benoit Steiner 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 | #include "main.h" 11 | 12 | #include 13 | 14 | 15 | static void test_float_rounding() 16 | { 17 | Tensor ftensor(20,30); 18 | ftensor = ftensor.random() * 100.f; 19 | 20 | Tensor result = ftensor.round(); 21 | 22 | for (int i = 0; i < 20; ++i) { 23 | for (int j = 0; j < 30; ++j) { 24 | VERIFY_IS_EQUAL(result(i,j), numext::round(ftensor(i,j))); 25 | } 26 | } 27 | } 28 | 29 | static void test_float_flooring() 30 | { 31 | Tensor ftensor(20,30); 32 | ftensor = ftensor.random() * 100.f; 33 | 34 | Tensor result = ftensor.floor(); 35 | 36 | for (int i = 0; i < 20; ++i) { 37 | for (int j = 0; j < 30; ++j) { 38 | VERIFY_IS_EQUAL(result(i,j), numext::floor(ftensor(i,j))); 39 | } 40 | } 41 | } 42 | 43 | static void test_float_ceiling() 44 | { 45 | Tensor ftensor(20,30); 46 | ftensor = ftensor.random() * 100.f; 47 | 48 | Tensor result = ftensor.ceil(); 49 | 50 | for (int i = 0; i < 20; ++i) { 51 | for (int j = 0; j < 30; ++j) { 52 | VERIFY_IS_EQUAL(result(i,j), numext::ceil(ftensor(i,j))); 53 | } 54 | } 55 | } 56 | 57 | EIGEN_DECLARE_TEST(cxx11_tensor_roundings) 58 | { 59 | CALL_SUBTEST(test_float_rounding()); 60 | CALL_SUBTEST(test_float_ceiling()); 61 | CALL_SUBTEST(test_float_flooring()); 62 | } 63 | -------------------------------------------------------------------------------- /include/unsupported/test/cxx11_tensor_sugar.cpp: -------------------------------------------------------------------------------- 1 | #include "main.h" 2 | 3 | #include 4 | 5 | using Eigen::Tensor; 6 | using Eigen::RowMajor; 7 | 8 | static void test_comparison_sugar() { 9 | // we already trust comparisons between tensors, we're simply checking that 10 | // the sugared versions are doing the same thing 11 | Tensor t(6, 7, 5); 12 | 13 | t.setRandom(); 14 | // make sure we have at least one value == 0 15 | t(0,0,0) = 0; 16 | 17 | Tensor b; 18 | 19 | #define TEST_TENSOR_EQUAL(e1, e2) \ 20 | b = ((e1) == (e2)).all(); \ 21 | VERIFY(b()) 22 | 23 | #define TEST_OP(op) TEST_TENSOR_EQUAL(t op 0, t op t.constant(0)) 24 | 25 | TEST_OP(==); 26 | TEST_OP(!=); 27 | TEST_OP(<=); 28 | TEST_OP(>=); 29 | TEST_OP(<); 30 | TEST_OP(>); 31 | #undef TEST_OP 32 | #undef TEST_TENSOR_EQUAL 33 | } 34 | 35 | 36 | static void test_scalar_sugar_add_mul() { 37 | Tensor A(6, 7, 5); 38 | Tensor B(6, 7, 5); 39 | A.setRandom(); 40 | B.setRandom(); 41 | 42 | const float alpha = 0.43f; 43 | const float beta = 0.21f; 44 | const float gamma = 0.14f; 45 | 46 | Tensor R = A.constant(gamma) + A * A.constant(alpha) + B * B.constant(beta); 47 | Tensor S = A * alpha + B * beta + gamma; 48 | Tensor T = gamma + alpha * A + beta * B; 49 | 50 | for (int i = 0; i < 6*7*5; ++i) { 51 | VERIFY_IS_APPROX(R(i), S(i)); 52 | VERIFY_IS_APPROX(R(i), T(i)); 53 | } 54 | } 55 | 56 | static void test_scalar_sugar_sub_div() { 57 | Tensor A(6, 7, 5); 58 | Tensor B(6, 7, 5); 59 | A.setRandom(); 60 | B.setRandom(); 61 | 62 | const float alpha = 0.43f; 63 | const float beta = 0.21f; 64 | const float gamma = 0.14f; 65 | const float delta = 0.32f; 66 | 67 | Tensor R = A.constant(gamma) - A / A.constant(alpha) 68 | - B.constant(beta) / B - A.constant(delta); 69 | Tensor S = gamma - A / alpha - beta / B - delta; 70 | 71 | for (int i = 0; i < 6*7*5; ++i) { 72 | VERIFY_IS_APPROX(R(i), S(i)); 73 | } 74 | } 75 | 76 | EIGEN_DECLARE_TEST(cxx11_tensor_sugar) 77 | { 78 | CALL_SUBTEST(test_comparison_sugar()); 79 | CALL_SUBTEST(test_scalar_sugar_add_mul()); 80 | CALL_SUBTEST(test_scalar_sugar_sub_div()); 81 | } 82 | -------------------------------------------------------------------------------- /include/unsupported/test/dgmres.cpp: -------------------------------------------------------------------------------- 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) 2012 desire Nuentsa 13 | 14 | template void test_dgmres_T() 15 | { 16 | DGMRES, DiagonalPreconditioner > dgmres_colmajor_diag; 17 | DGMRES, IdentityPreconditioner > dgmres_colmajor_I; 18 | DGMRES, IncompleteLUT > dgmres_colmajor_ilut; 19 | //GMRES, SSORPreconditioner > dgmres_colmajor_ssor; 20 | 21 | CALL_SUBTEST( check_sparse_square_solving(dgmres_colmajor_diag) ); 22 | // CALL_SUBTEST( check_sparse_square_solving(dgmres_colmajor_I) ); 23 | CALL_SUBTEST( check_sparse_square_solving(dgmres_colmajor_ilut) ); 24 | //CALL_SUBTEST( check_sparse_square_solving(dgmres_colmajor_ssor) ); 25 | } 26 | 27 | EIGEN_DECLARE_TEST(dgmres) 28 | { 29 | CALL_SUBTEST_1(test_dgmres_T()); 30 | CALL_SUBTEST_2(test_dgmres_T >()); 31 | } 32 | -------------------------------------------------------------------------------- /include/unsupported/test/gmres.cpp: -------------------------------------------------------------------------------- 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) 2012 Kolja Brix 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 | #include "../../test/sparse_solver.h" 12 | #include 13 | 14 | template void test_gmres_T() 15 | { 16 | GMRES, DiagonalPreconditioner > gmres_colmajor_diag; 17 | GMRES, IdentityPreconditioner > gmres_colmajor_I; 18 | GMRES, IncompleteLUT > gmres_colmajor_ilut; 19 | //GMRES, SSORPreconditioner > gmres_colmajor_ssor; 20 | 21 | CALL_SUBTEST( check_sparse_square_solving(gmres_colmajor_diag) ); 22 | // CALL_SUBTEST( check_sparse_square_solving(gmres_colmajor_I) ); 23 | CALL_SUBTEST( check_sparse_square_solving(gmres_colmajor_ilut) ); 24 | //CALL_SUBTEST( check_sparse_square_solving(gmres_colmajor_ssor) ); 25 | } 26 | 27 | EIGEN_DECLARE_TEST(gmres) 28 | { 29 | CALL_SUBTEST_1(test_gmres_T()); 30 | CALL_SUBTEST_2(test_gmres_T >()); 31 | } 32 | -------------------------------------------------------------------------------- /include/unsupported/test/matrix_functions.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2009-2011 Jitse Niesen 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 | #include "main.h" 11 | #include 12 | 13 | // For complex matrices, any matrix is fine. 14 | template::Scalar>::IsComplex> 15 | struct processTriangularMatrix 16 | { 17 | static void run(MatrixType&, MatrixType&, const MatrixType&) 18 | { } 19 | }; 20 | 21 | // For real matrices, make sure none of the eigenvalues are negative. 22 | template 23 | struct processTriangularMatrix 24 | { 25 | static void run(MatrixType& m, MatrixType& T, const MatrixType& U) 26 | { 27 | const Index size = m.cols(); 28 | 29 | for (Index i=0; i < size; ++i) { 30 | if (i == size - 1 || T.coeff(i+1,i) == 0) 31 | T.coeffRef(i,i) = std::abs(T.coeff(i,i)); 32 | else 33 | ++i; 34 | } 35 | m = U * T * U.transpose(); 36 | } 37 | }; 38 | 39 | template ::Scalar>::IsComplex> 40 | struct generateTestMatrix; 41 | 42 | template 43 | struct generateTestMatrix 44 | { 45 | static void run(MatrixType& result, typename MatrixType::Index size) 46 | { 47 | result = MatrixType::Random(size, size); 48 | RealSchur schur(result); 49 | MatrixType T = schur.matrixT(); 50 | processTriangularMatrix::run(result, T, schur.matrixU()); 51 | } 52 | }; 53 | 54 | template 55 | struct generateTestMatrix 56 | { 57 | static void run(MatrixType& result, typename MatrixType::Index size) 58 | { 59 | result = MatrixType::Random(size, size); 60 | } 61 | }; 62 | 63 | template 64 | typename Derived::RealScalar relerr(const MatrixBase& A, const MatrixBase& B) 65 | { 66 | return std::sqrt((A - B).cwiseAbs2().sum() / (std::min)(A.cwiseAbs2().sum(), B.cwiseAbs2().sum())); 67 | } 68 | -------------------------------------------------------------------------------- /include/unsupported/test/matrix_square_root.cpp: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2011 Jitse Niesen 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 | #include "matrix_functions.h" 11 | 12 | template 13 | void testMatrixSqrt(const MatrixType& m) 14 | { 15 | MatrixType A; 16 | generateTestMatrix::run(A, m.rows()); 17 | MatrixType sqrtA = A.sqrt(); 18 | VERIFY_IS_APPROX(sqrtA * sqrtA, A); 19 | } 20 | 21 | EIGEN_DECLARE_TEST(matrix_square_root) 22 | { 23 | for (int i = 0; i < g_repeat; i++) { 24 | CALL_SUBTEST_1(testMatrixSqrt(Matrix3cf())); 25 | CALL_SUBTEST_2(testMatrixSqrt(MatrixXcd(12,12))); 26 | CALL_SUBTEST_3(testMatrixSqrt(Matrix4f())); 27 | CALL_SUBTEST_4(testMatrixSqrt(Matrix(9, 9))); 28 | CALL_SUBTEST_5(testMatrixSqrt(Matrix())); 29 | CALL_SUBTEST_5(testMatrixSqrt(Matrix,1,1>())); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /include/unsupported/test/minres.cpp: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2012 Giacomo Po 5 | // Copyright (C) 2011 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 | #include 11 | 12 | #include "../../test/sparse_solver.h" 13 | #include 14 | 15 | template void test_minres_T() 16 | { 17 | // Identity preconditioner 18 | MINRES, Lower, IdentityPreconditioner > minres_colmajor_lower_I; 19 | MINRES, Upper, IdentityPreconditioner > minres_colmajor_upper_I; 20 | 21 | // Diagonal preconditioner 22 | MINRES, Lower, DiagonalPreconditioner > minres_colmajor_lower_diag; 23 | MINRES, Upper, DiagonalPreconditioner > minres_colmajor_upper_diag; 24 | MINRES, Lower|Upper, DiagonalPreconditioner > minres_colmajor_uplo_diag; 25 | 26 | // call tests for SPD matrix 27 | CALL_SUBTEST( check_sparse_spd_solving(minres_colmajor_lower_I) ); 28 | CALL_SUBTEST( check_sparse_spd_solving(minres_colmajor_upper_I) ); 29 | 30 | CALL_SUBTEST( check_sparse_spd_solving(minres_colmajor_lower_diag) ); 31 | CALL_SUBTEST( check_sparse_spd_solving(minres_colmajor_upper_diag) ); 32 | CALL_SUBTEST( check_sparse_spd_solving(minres_colmajor_uplo_diag) ); 33 | 34 | // TO DO: symmetric semi-definite matrix 35 | // TO DO: symmetric indefinite matrix 36 | 37 | } 38 | 39 | EIGEN_DECLARE_TEST(minres) 40 | { 41 | CALL_SUBTEST_1(test_minres_T()); 42 | // CALL_SUBTEST_2(test_minres_T >()); 43 | 44 | } 45 | -------------------------------------------------------------------------------- /include/unsupported/test/mpreal_support.cpp: -------------------------------------------------------------------------------- 1 | #include "main.h" 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | using namespace mpfr; 8 | using namespace Eigen; 9 | 10 | EIGEN_DECLARE_TEST(mpreal_support) 11 | { 12 | // set precision to 256 bits (double has only 53 bits) 13 | mpreal::set_default_prec(256); 14 | typedef Matrix MatrixXmp; 15 | typedef Matrix,Eigen::Dynamic,Eigen::Dynamic> MatrixXcmp; 16 | 17 | std::cerr << "epsilon = " << NumTraits::epsilon() << "\n"; 18 | std::cerr << "dummy_precision = " << NumTraits::dummy_precision() << "\n"; 19 | std::cerr << "highest = " << NumTraits::highest() << "\n"; 20 | std::cerr << "lowest = " << NumTraits::lowest() << "\n"; 21 | std::cerr << "digits10 = " << NumTraits::digits10() << "\n"; 22 | 23 | for(int i = 0; i < g_repeat; i++) { 24 | int s = Eigen::internal::random(1,100); 25 | MatrixXmp A = MatrixXmp::Random(s,s); 26 | MatrixXmp B = MatrixXmp::Random(s,s); 27 | MatrixXmp S = A.adjoint() * A; 28 | MatrixXmp X; 29 | MatrixXcmp Ac = MatrixXcmp::Random(s,s); 30 | MatrixXcmp Bc = MatrixXcmp::Random(s,s); 31 | MatrixXcmp Sc = Ac.adjoint() * Ac; 32 | MatrixXcmp Xc; 33 | 34 | // Basic stuffs 35 | VERIFY_IS_APPROX(A.real(), A); 36 | VERIFY(Eigen::internal::isApprox(A.array().abs2().sum(), A.squaredNorm())); 37 | VERIFY_IS_APPROX(A.array().exp(), exp(A.array())); 38 | VERIFY_IS_APPROX(A.array().abs2().sqrt(), A.array().abs()); 39 | VERIFY_IS_APPROX(A.array().sin(), sin(A.array())); 40 | VERIFY_IS_APPROX(A.array().cos(), cos(A.array())); 41 | 42 | // Cholesky 43 | X = S.selfadjointView().llt().solve(B); 44 | VERIFY_IS_APPROX((S.selfadjointView()*X).eval(),B); 45 | 46 | Xc = Sc.selfadjointView().llt().solve(Bc); 47 | VERIFY_IS_APPROX((Sc.selfadjointView()*Xc).eval(),Bc); 48 | 49 | // partial LU 50 | X = A.lu().solve(B); 51 | VERIFY_IS_APPROX((A*X).eval(),B); 52 | 53 | // symmetric eigenvalues 54 | SelfAdjointEigenSolver eig(S); 55 | VERIFY_IS_EQUAL(eig.info(), Success); 56 | VERIFY( (S.selfadjointView() * eig.eigenvectors()).isApprox(eig.eigenvectors() * eig.eigenvalues().asDiagonal(), NumTraits::dummy_precision()*1e3) ); 57 | } 58 | 59 | { 60 | MatrixXmp A(8,3); A.setRandom(); 61 | // test output (interesting things happen in this code) 62 | std::stringstream stream; 63 | stream << A; 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /src/binio.cc: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | namespace ionizing { 4 | BinIO::BinIO(const char* FileName) { 5 | _openFile(FileName); 6 | /* 7 | * std::cout << "BinIO created successful" << std::endl; 8 | */ 9 | } 10 | 11 | BinIO::~BinIO() { 12 | ifs.close(); 13 | /* 14 | * std::cout << "BinIO destructed" << std::endl; 15 | */ 16 | } 17 | 18 | void BinIO::_openFile(const char* FileName) { 19 | ifs.open(FileName, std::ios::ate | std::ios::binary | std::ios::in); 20 | std::string str_stars(10, '*'); 21 | if (ifs.fail()) { 22 | std::cerr << str_stars << " Binary File \"" << FileName << "\" open failed " << str_stars << std::endl; 23 | std::abort(); 24 | } 25 | _fileSize = ifs.tellg(); 26 | ifs.seekg(0, std::ios::beg); 27 | } 28 | 29 | void BinIO::seek(const long n) { 30 | if (n < 0 or n >= _fileSize) { 31 | std::cout << "****ERROR!**** seeking an invalid file position: " << n << " !\n"; 32 | std::abort(); 33 | } 34 | ifs.seekg(n); 35 | } 36 | 37 | int BinIO::getFileSize() const { 38 | return _fileSize; 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /src/stringops.cc: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | namespace ionizing { 4 | void ltrim(std::string &s) { 5 | s.erase(s.begin(), std::find_if(s.begin(), s.end(), [](int ch) { 6 | return !std::isspace(ch); 7 | })); 8 | } 9 | 10 | void rtrim(std::string &s) { 11 | s.erase(std::find_if(s.rbegin(), s.rend(), [](int ch) { 12 | return !std::isspace(ch); 13 | }).base(), s.end()); 14 | } 15 | 16 | void trim(std::string &s) { 17 | ltrim(s); 18 | rtrim(s); 19 | } 20 | 21 | std::string ltrim_copy(std::string s) { 22 | ltrim(s); 23 | return s; 24 | } 25 | 26 | std::string rtrim_copy(std::string s) { 27 | rtrim(s); 28 | return s; 29 | } 30 | 31 | std::string trim_copy(std::string s) { 32 | trim(s); 33 | return s; 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /tests/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ionizing/wavecar_parser/9045bbccf64486cf6f872b50966b33f909c453ca/tests/.DS_Store -------------------------------------------------------------------------------- /tests/MoS2/POSCAR: -------------------------------------------------------------------------------- 1 | Mo S Se W 2 | 1.00000000000000 3 | 3.1850000000000001 0.0000000000000000 0.0000000000000000 4 | -1.5925000000000000 2.7582909110534373 0.0000000000000000 5 | 0.0000000000000000 0.0000000000000000 35.0000000000000000 6 | Mo S Se W 7 | 2 4 2 1 8 | Direct 9 | 0.6666666666670835 0.3333333333329165 0.3219742094736446 10 | 0.6666666666671972 0.3333333333328028 0.6798264159624736 11 | 0.9999999999997868 0.0000000000002132 0.2773806069088707 12 | 0.9999999999998508 0.0000000000001492 0.3665237115874831 13 | 0.6666666666668348 0.3333333333331652 0.4535789486065980 14 | 0.6666666666668775 0.3333333333331225 0.5428281176811325 15 | 0.9999999999997655 0.0000000000002345 0.6308731772390956 16 | 0.9999999999997513 0.0000000000002487 0.7288097188843636 17 | 0.9999999999995524 0.0000000000004547 0.4982050936563382 18 | 19 | 0.00000000E+00 0.00000000E+00 0.00000000E+00 20 | 0.00000000E+00 0.00000000E+00 0.00000000E+00 21 | 0.00000000E+00 0.00000000E+00 0.00000000E+00 22 | 0.00000000E+00 0.00000000E+00 0.00000000E+00 23 | 0.00000000E+00 0.00000000E+00 0.00000000E+00 24 | 0.00000000E+00 0.00000000E+00 0.00000000E+00 25 | 0.00000000E+00 0.00000000E+00 0.00000000E+00 26 | 0.00000000E+00 0.00000000E+00 0.00000000E+00 27 | 0.00000000E+00 0.00000000E+00 0.00000000E+00 28 | -------------------------------------------------------------------------------- /tests/MoS2/WAVECAR: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ionizing/wavecar_parser/9045bbccf64486cf6f872b50966b33f909c453ca/tests/MoS2/WAVECAR -------------------------------------------------------------------------------- /tests/fccSidos/.DOSCAR.swp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ionizing/wavecar_parser/9045bbccf64486cf6f872b50966b33f909c453ca/tests/fccSidos/.DOSCAR.swp -------------------------------------------------------------------------------- /tests/fccSidos/CONTCAR: -------------------------------------------------------------------------------- 1 | fcc Si: 2 | 3.8999999999999999 3 | 0.5000000000000000 0.5000000000000000 0.0000000000000000 4 | 0.0000000000000000 0.5000000000000000 0.5000000000000000 5 | 0.5000000000000000 0.0000000000000000 0.5000000000000000 6 | Si 7 | 1 8 | Direct 9 | 0.0000000000000000 0.0000000000000000 0.0000000000000000 10 | 11 | 0.00000000E+00 0.00000000E+00 0.00000000E+00 12 | -------------------------------------------------------------------------------- /tests/fccSidos/INCAR: -------------------------------------------------------------------------------- 1 | general: 2 | System = fcc Si 3 | # ICHARG=11 #charge read file 4 | ENCUT = 240 5 | ISMEAR = -5 #tetrahedron 6 | LORBIT=11 7 | -------------------------------------------------------------------------------- /tests/fccSidos/KPOINTS: -------------------------------------------------------------------------------- 1 | K-Points 2 | 0 3 | Monkhorst Pack 4 | 21 21 21 5 | 0 0 0 6 | -------------------------------------------------------------------------------- /tests/fccSidos/OSZICAR: -------------------------------------------------------------------------------- 1 | N E dE d eps ncg rms rms(c) 2 | DAV: 1 -0.402681405549E+01 -0.40268E+01 -0.12070E+03 5176 0.213E+02 3 | DAV: 2 -0.488352624352E+01 -0.85671E+00 -0.82925E+00 6880 0.168E+01 4 | DAV: 3 -0.488652717405E+01 -0.30009E-02 -0.29692E-02 5160 0.920E-01 5 | DAV: 4 -0.488652873662E+01 -0.15626E-05 -0.15449E-05 7432 0.193E-02 6 | DAV: 5 -0.488652873656E+01 0.55493E-10 -0.36504E-09 4800 0.145E-04 0.770E-01 7 | DAV: 6 -0.487372929290E+01 0.12799E-01 -0.40415E-03 5120 0.275E-01 0.460E-01 8 | DAV: 7 -0.486637557427E+01 0.73537E-02 -0.89362E-03 5312 0.408E-01 0.254E-02 9 | DAV: 8 -0.486636540481E+01 0.10169E-04 -0.29838E-05 5392 0.356E-02 10 | 1 F= -.48663654E+01 E0= -.48663654E+01 d E =0.000000E+00 11 | -------------------------------------------------------------------------------- /tests/fccSidos/PCDAT: -------------------------------------------------------------------------------- 1 | 1 1 1 0 0.1482975E+02 0.1000000E-03 2 | CAR 3 | fcc Si 4 | 0 0 0 5 | 1 1 6 | 256 256 256 7 | 256 8 | 0.1000000E-09 9 | 0.6250000E-11 10 | 0 11 | 0.5000000E-15 0.2757716E-09 0.2757716E-09 0.2757716E-09 12 | -------------------------------------------------------------------------------- /tests/fccSidos/POSCAR: -------------------------------------------------------------------------------- 1 | fcc Si: 2 | 3.9 3 | 0.5 0.5 0.0 4 | 0.0 0.5 0.5 5 | 0.5 0.0 0.5 6 | Si 7 | 1 8 | cartesian 9 | 0 0 0 10 | -------------------------------------------------------------------------------- /tests/fccSidos/REPORT: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ionizing/wavecar_parser/9045bbccf64486cf6f872b50966b33f909c453ca/tests/fccSidos/REPORT -------------------------------------------------------------------------------- /tests/fccSidos/WAVECAR: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ionizing/wavecar_parser/9045bbccf64486cf6f872b50966b33f909c453ca/tests/fccSidos/WAVECAR -------------------------------------------------------------------------------- /tests/fccSidos/XDATCAR: -------------------------------------------------------------------------------- 1 | fcc Si 2 | 1 3 | 1.950000 1.950000 0.000000 4 | 0.000000 1.950000 1.950000 5 | 1.950000 0.000000 1.950000 6 | Si 7 | 1 8 | Direct configuration= 1 9 | 0.00000000 0.00000000 0.00000000 10 | -------------------------------------------------------------------------------- /tests/fccSidos/cleanup.sh: -------------------------------------------------------------------------------- 1 | rm -f CHG* CONTCAR* DOSCAR* DYNMAT EIGENVAL IBZKPT OPTIC OSZICAR* OUTCAR* PROCAR* \ 2 | PCDAT W* XDATCAR* PARCHG* vasprun.xml SUMMARY.* REPORT \ 3 | wannier90.win wannier90_band.gnu wannier90_band.kpt wannier90.chk wannier90.wout \ 4 | *.dat plotfile p4vasp.log \ 5 | *.e[0-9]* *.o[0-9]* *.pe[0-9]* *.po[0-9]* *.err *.out 6 | -------------------------------------------------------------------------------- /tests/fccSidos/job.sh: -------------------------------------------------------------------------------- 1 | # 2 | # To run VASP this script calls $vasp_std 3 | # (or posibly $vasp_gam and/or $vasp_ncl). 4 | # These variables can be defined by sourcing vaspcmd 5 | . vaspcmd 2> /dev/null 6 | 7 | # 8 | # When vaspcmd is not available and $vasp_std, 9 | # $vasp_gam, and/or $vasp_ncl are not set as environment 10 | # variables, you can specify them here 11 | [ -z "`echo $vasp_std`" ] && vasp_std="mpirun -np 8 /path-to-your-vasp/vasp_std" 12 | [ -z "`echo $vasp_gam`" ] && vasp_gam="mpirun -np 8 /path-to-your-vasp/vasp_gam" 13 | [ -z "`echo $vasp_ncl`" ] && vasp_ncl="mpirun -np 8 /path-to-your-vasp/vasp_ncl" 14 | 15 | # 16 | # The real work starts here 17 | # 18 | 19 | $vasp_std 20 | -------------------------------------------------------------------------------- /tests/fccSidos/plotdos.sh: -------------------------------------------------------------------------------- 1 | awk 'BEGIN{i=1} /total>/,\ 2 | /\/total>/ \ 3 | {a[i]=$2 ; b[i]=$3 ; i=i+1} \ 4 | END{for (j=10;j dos.dat 5 | 6 | ef=`awk '/efermi/ {print $3}' vasprun.xml` 7 | 8 | cat > plotfile << ! 9 | set term postscript enhanced eps colour lw 2 "Helvetica" 20 10 | set output "optics.eps" 11 | plot "dos.dat" using (\$1-$ef):(\$2) w lp, "" using (\$1-$ef):(\$2) title "cspline" smooth csplines 12 | ! 13 | 14 | gnuplot -persist plotfile 15 | 16 | rm dos.dat plotfile 17 | --------------------------------------------------------------------------------