├── .DS_Store ├── .gitignore ├── .travis.yml ├── BinIO ├── Makefile ├── test ├── test.bin └── test.cpp ├── LICENSE ├── README.md ├── fft ├── fft.cc └── fft.hpp ├── figs ├── view_mol_file.png └── view_opt_traj.png ├── grad3 ├── .DS_Store ├── Makefile ├── compile_commands.json ├── include │ ├── base.hpp │ ├── constants.hpp │ ├── element.hpp │ ├── error.hpp │ ├── incar.hpp │ ├── outcar.hpp │ ├── poscar.hpp │ ├── stringops.hpp │ └── textio.hpp ├── main.cc ├── old │ ├── Makefile │ ├── OUTCAR.cpp │ ├── OUTCAR.h │ ├── POSCAR.cpp │ ├── POSCAR.h │ ├── README.md │ ├── arg_parse.cpp │ ├── arg_parse.h │ ├── compile_commands.json │ ├── global.cpp │ ├── global.h │ ├── headers.h │ ├── main.cpp │ └── tests.zip ├── src │ ├── element.cc │ ├── incar.cc │ ├── outcar.cc │ ├── poscar.cc │ ├── stringops.cc │ └── textio.cc ├── test_result.md ├── third_party │ ├── 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 │ ├── catch.hpp │ ├── cxxopts.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 └── unit_test │ ├── error_test.cc │ ├── outcar_test.cc │ ├── stringop_test.cc │ ├── test1 │ ├── OUTCAR │ ├── POSCAR │ ├── POSCAR_cart │ └── POSCAR_direct │ ├── test2 │ ├── OUTCAR │ ├── POSCAR │ ├── POSCAR_cart │ └── POSCAR_direct │ ├── test3 │ ├── OUTCAR │ ├── POSCAR │ ├── POSCAR_cart │ ├── POSCAR_direct │ └── poscar_frames │ │ └── POSCAR_frame_000.vasp │ ├── test4 │ ├── OUTCAR │ ├── POSCAR │ ├── POSCAR_cart │ └── POSCAR_direct │ ├── test5 │ ├── OSZICAR │ ├── OUTCAR │ ├── OUTCAR__ │ ├── POSCAR │ └── animate.molden │ ├── test6 │ ├── OUTCAR │ └── POSCAR │ ├── test7 │ └── OUTCAR │ ├── test_5.cc │ └── test_poscar.cc └── pospot_checker ├── Makefile ├── README.md ├── pospot_checker ├── pospot_sh_ver.sh ├── pospot_tg_ver.sh └── tests ├── 1 ├── POSCAR └── POTCAR └── 2 ├── POSCAR └── POTCAR /.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ionizing/usefultools-for-vasp/5e42c4bce3e646fedceb6560ec7aa6b7b2702a8a/.DS_Store -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # MacOS trash files 2 | .DS_Store 3 | 4 | # Prerequisites 5 | *.d 6 | 7 | # Compiled Object files 8 | *.slo 9 | *.lo 10 | *.o 11 | *.obj 12 | 13 | # Precompiled Headers 14 | *.gch 15 | *.pch 16 | 17 | # Compiled Dynamic libraries 18 | *.so 19 | *.dylib 20 | *.dll 21 | 22 | # Fortran module files 23 | *.mod 24 | *.smod 25 | 26 | # Compiled Static libraries 27 | *.lai 28 | *.la 29 | *.a 30 | *.lib 31 | 32 | # Executables 33 | *.exe 34 | *.out 35 | *.app 36 | 37 | # cquery caches 38 | *.cquery 39 | /\~/ 40 | *.gch 41 | 42 | *.dSYM* 43 | *.swp 44 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: cpp # 指定项目语言类型 2 | dist: trusty 3 | sudo: false # 是否需要 sudo 权限 4 | matrix: 5 | include: 6 | # works on Precise and Trusty 7 | - os: linux 8 | addons: 9 | apt: 10 | sources: 11 | - ubuntu-toolchain-r-test 12 | packages: 13 | - g++-4.9 14 | env: 15 | - MATRIX_EVAL="CC=gcc-4.9 && CXX=g++-4.9" 16 | 17 | branches: 18 | only: 19 | - master 20 | 21 | before_install: 22 | - eval "${MATRIX_EVAL}" 23 | 24 | script: # 构建的命令,默认为 ./configure && make 25 | - cd ./grad3 26 | - make unit_test 27 | - make clean 28 | - make static 29 | -------------------------------------------------------------------------------- /BinIO/Makefile: -------------------------------------------------------------------------------- 1 | CC = g++ 2 | CFLAGS = -std=c++11 -O3 3 | 4 | main: test.cpp BinIO.hpp 5 | $(CC) -o test BinIO.cpp test.cpp $(CFLAGS) 6 | 7 | clean: test 8 | rm test 9 | -------------------------------------------------------------------------------- /BinIO/test: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ionizing/usefultools-for-vasp/5e42c4bce3e646fedceb6560ec7aa6b7b2702a8a/BinIO/test -------------------------------------------------------------------------------- /BinIO/test.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ionizing/usefultools-for-vasp/5e42c4bce3e646fedceb6560ec7aa6b7b2702a8a/BinIO/test.bin -------------------------------------------------------------------------------- /BinIO/test.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include "BinIO.hpp" 5 | 6 | using Eigen::MatrixXd; 7 | using Eigen::Matrix; 8 | using ionizing::BinIO; 9 | 10 | int main(int argc, char* argv[]) { 11 | // BinIO io("test.bin"); 12 | 13 | MatrixXd matrix = MatrixXd::Random(4, 5); 14 | long rows = matrix.rows(), cols = matrix.cols(); 15 | 16 | std::cout << "matrix = \n" << matrix << std::endl; 17 | 18 | std::ofstream ofs("test.bin", std::ios::binary | std::ios::out | std::ios::trunc); 19 | ofs.write((char*) &rows, sizeof(rows)); 20 | ofs.write((char*) &cols, sizeof(cols)); 21 | ofs.write((char*) matrix.data(), rows*cols*sizeof(double)); 22 | ofs.close(); 23 | 24 | BinIO io2("test.bin"); 25 | rows = io2.readElement(); 26 | cols = io2.readElement(); 27 | // MatrixXd matrix2 = io2.readMatrix (rows, cols); 28 | // std::cout << "matrix2 = \n" << matrix2 << std::endl; 29 | std::cout << "matrix2 = \n" << std::endl; 30 | // for (int i=0; i!=rows; ++i) { 31 | // std::cout << io2.readVectorRow(cols) << std::endl; 32 | // } 33 | 34 | matrix = io2.readMatrix(rows, cols); 35 | std::cout << matrix << std::endl; 36 | 37 | return 0; 38 | } 39 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 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 | -------------------------------------------------------------------------------- /fft/fft.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef FFT_H 3 | #define FFT_H 4 | 5 | #include 6 | #include 7 | #include 8 | 9 | namespace ionizing { 10 | 11 | using namespace Eigen; 12 | 13 | using Vecd = VectorXd; 14 | using Veccd = VectorXcd; 15 | using Matd = Matrix; 16 | using Matcd = Matrix, Dynamic, Dynamic, RowMajor>; 17 | using Cubd = Tensor; 18 | using Cubcd = Tensor, 3, RowMajor>; 19 | 20 | Veccd fft_1d(const Veccd& vec); 21 | Veccd fft_1d(const Vecd& vec); 22 | Veccd ifft_1d(const Veccd& vec); 23 | Veccd ifft_1d(const Vecd& vec); 24 | 25 | Matcd fft_2d(const Matcd& mat); 26 | Matcd fft_2d(const Matd& mat); 27 | Matcd ifft_2d(const Matcd& mat); 28 | Matcd ifft_2d(const Matd& mat); 29 | 30 | Cubcd fft_3d(const Cubcd& cub); 31 | Cubcd fft_3d(const Cubd& cub); 32 | Cubcd ifft_3d(const Cubcd& cub); 33 | Cubcd ifft_3d(const Cubd& cub); 34 | 35 | } 36 | #endif // FFT_H 37 | -------------------------------------------------------------------------------- /figs/view_mol_file.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ionizing/usefultools-for-vasp/5e42c4bce3e646fedceb6560ec7aa6b7b2702a8a/figs/view_mol_file.png -------------------------------------------------------------------------------- /figs/view_opt_traj.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ionizing/usefultools-for-vasp/5e42c4bce3e646fedceb6560ec7aa6b7b2702a8a/figs/view_opt_traj.png -------------------------------------------------------------------------------- /grad3/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ionizing/usefultools-for-vasp/5e42c4bce3e646fedceb6560ec7aa6b7b2702a8a/grad3/.DS_Store -------------------------------------------------------------------------------- /grad3/Makefile: -------------------------------------------------------------------------------- 1 | CC := g++ 2 | CFLAGS_DEBUG := -std=c++11 -g -Wall -Wextra -fno-omit-frame-pointer -fsanitize=address 3 | CFLAGS_RELEASE := -std=c++11 -O3 4 | CFLAGS_STATIC := $(CFLAGS_RELEASE) --static 5 | LFLAGS := 6 | INCLUDE := -I./include -I./third_party 7 | 8 | INCS := $(wildcard ./include/*.hpp) 9 | SOURCE := $(wildcard ./src/*.cc) 10 | OBJS := $(patsubst %.cc, %.o, $(SOURCE)) 11 | TEST_SRC := $(wildcard ./unit_test/*.cc) 12 | TEST_EXE := $(patsubst %.cc, %.out, $(TEST_SRC)) 13 | 14 | ifeq ($(firstword $(MAKECMDGOALS)), release) 15 | CFLAGS = $(CFLAGS_RELEASE) 16 | else 17 | CFLAGS = $(CFLAGS_RELEASE) 18 | endif 19 | 20 | ifeq ($(firstword $(MAKECMDGOALS)), static) 21 | CFLAGS = $(CFLAGS_STATIC) 22 | endif 23 | 24 | ifeq ($(firstword $(MAKECMDGOALS)), unit_test) 25 | CFLAGS = $(CFLAGS_DEBUG) 26 | endif 27 | 28 | .PHONY: clean release static unit_test test 29 | 30 | .SECONDARY: $(OBJS) 31 | 32 | release static: cgrad 33 | 34 | test: cgrad 35 | @for i in `ls unit_test | grep -E 'test\d+'` ; do\ 36 | echo perfoming $$i ... ; \ 37 | ./cgrad -o unit_test/$${i}/OUTCAR ; \ 38 | done ; 39 | 40 | unit_test: $(TEST_EXE) 41 | @cd unit_test; \ 42 | for i in `ls | grep -E 'out$$'` ; \ 43 | do \ 44 | echo 'executing ' $$i ' ...'; \ 45 | ./$$i ; \ 46 | done ; 47 | 48 | ./src/%.o: ./src/%.cc $(INCS) 49 | $(CC) -o $@ -c $< $(INCLUDE) $(CFLAGS) 50 | 51 | ./unit_test/%.out: ./unit_test/%.cc $(OBJS) $(INCS) 52 | $(CC) -o $@ $< $(OBJS) $(INCLUDE) $(CFLAGS) $(LFLAGS) 53 | 54 | cgrad: main.cc $(OBJS) $(INCS) 55 | $(CC) -o $@ $< $(OBJS) $(INCLUDE) $(CFLAGS) $(LFLAGS) 56 | 57 | clean: 58 | @rm -rf $(OBJS) $(TEST_EXE) ./unit_test/*.dSYM \ 59 | ./unit_test/POSCAR* ./unit_test/*.mol* \ 60 | ./unit_test/poscar_frames ./cgrad ./cgrad.dSYM \ 61 | ./unit_test/*.xsf 62 | -------------------------------------------------------------------------------- /grad3/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 | -------------------------------------------------------------------------------- /grad3/include/element.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef ELEMENT_H 3 | #define ELEMENT_H 4 | 5 | #include 6 | 7 | namespace ionizing { 8 | 9 | struct Element { 10 | string Name; 11 | int Num; 12 | Mat33d Acell; 13 | Mat33d Bcell; 14 | bool isCart; 15 | bool isInited; 16 | 17 | 18 | MatX3d atomPos; 19 | MatX3d atomPosCart; 20 | MatX3d atomPosDire; 21 | VecStr comments; 22 | 23 | Element(const char* name, const int num, const Mat33d acell); 24 | Element(); 25 | bool init_with_cart(const MatX3d atom_pos_cart, 26 | const VecStr comments); 27 | bool init_with_dire(const MatX3d atom_pos_dire, 28 | const VecStr comments); 29 | }; 30 | 31 | }; 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /grad3/include/error.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef ERROR_H 3 | #define ERROR_H 4 | 5 | #include 6 | 7 | static const char* _MESSAGE_SEP_ = 8 | "--------------------------------------------------------------------------------\n"; 9 | 10 | static const char* _ERROR_SEP_ = 11 | "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\n"; 12 | 13 | static const char* _WARNING_SEP_ = 14 | "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n"; 15 | 16 | 17 | #define PRINT_ERROR( message ) do {\ 18 | std::cerr << _ERROR_SEP_ \ 19 | << "Error occured in File: " << __FILE__ << "\n"\ 20 | << " line: " << __LINE__ << "\n"\ 21 | << " function: " << __FUNCTION__ << "\n"\ 22 | << "Error message: \n" << " " << message << "\n"\ 23 | << _ERROR_SEP_ << std::endl;\ 24 | } while (0) 25 | 26 | 27 | #define PRINT_WARNING( message ) do {\ 28 | std::cerr << _WARNING_SEP_ \ 29 | << "Warning occured in File: " << __FILE__ << "\n"\ 30 | << " line: " << __LINE__ << "\n"\ 31 | << " function: " << __FUNCTION__ << "\n"\ 32 | << "Warning message: \n" << " " << message << "\n"\ 33 | << _WARNING_SEP_ << std::endl;\ 34 | } while (0) 35 | 36 | 37 | #define PRINT_MESSAGE( message ) do {\ 38 | std::cerr << _MESSAGE_SEP_ \ 39 | << " In File: " << __FILE__ << "\n"\ 40 | << " line: " << __LINE__ << "\n"\ 41 | << " function: " << __FUNCTION__ << "\n"\ 42 | << "Note: \n" << " " << message << "\n"\ 43 | << _MESSAGE_SEP_ << std::endl;\ 44 | } while (0) 45 | 46 | 47 | 48 | 49 | #endif // ERROR_H 50 | -------------------------------------------------------------------------------- /grad3/include/incar.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef INCAR_H 3 | #define INCAR_H 4 | 5 | struct INCAR { 6 | 7 | double _EDIFF, 8 | _EDIFFG, 9 | _ENCUT; 10 | int _IBRION, 11 | _ISIF, 12 | _ISPIN, 13 | _LNONCOLLINEAR, 14 | _LORBIT, 15 | _LSORBIT, 16 | _NBANDS, 17 | _NELMIN, 18 | _NIONS, 19 | _NSW, 20 | _NKPTS, 21 | _NWRITE; 22 | }; 23 | #endif 24 | -------------------------------------------------------------------------------- /grad3/include/stringops.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef STRINGOPS_H 3 | #define STRINGOPS_H 4 | 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | namespace ionizing { 11 | void ltrim (string& str); 12 | void rtrim (string& str); 13 | void trim (string& str); 14 | string ltrim_copy(string str); 15 | string rtrim_copy(string str); 16 | string trim_copy (string str); 17 | 18 | VecStr split (string str, const char delim = '\0'); 19 | string join (VecStr str_vec, const char delim = ' '); 20 | 21 | void toupper (string& str); 22 | void tolower (string& str); 23 | string toupper_copy (string str); 24 | string tolower_copy (string str); 25 | 26 | bool is_start_with (const string& src, const string& val); 27 | bool is_end_with (const string& src, const string& val); 28 | 29 | bool is_empty_or_white_space (const string& str); 30 | 31 | string string_printf (const char* format, ...); 32 | void _string_printf (string& dst, const char* fmt, va_list va); 33 | 34 | int count_substr(const string& src, const string& val); 35 | } 36 | 37 | 38 | 39 | #endif //STRINGOPS_H 40 | -------------------------------------------------------------------------------- /grad3/include/textio.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef TEXTIO_H 3 | #define TEXTIO_H 4 | 5 | #include "base.hpp" 6 | 7 | namespace ionizing { 8 | 9 | class TextIO { 10 | public: 11 | TextIO (const char* file_name); 12 | TextIO ( std::istream& is); 13 | /* 14 | * TextIO (const string& str); 15 | */ 16 | ~TextIO (); 17 | TextIO (const TextIO& ) = delete; 18 | TextIO& operator= (const TextIO& ) = delete; 19 | 20 | long getFileSize() const; 21 | 22 | template 23 | T readElement(); 24 | template 25 | VecT readVector(const long size); 26 | template 27 | MatT readMatrix(const long rows, const long cols); 28 | 29 | private: 30 | // ifs is just a temporary filestream. 31 | // I didn't put ifs in construct cause it would be 32 | // destroyed automately when constructor returns. 33 | std::ifstream _ifs; 34 | std::istream _is; 35 | long _fileSize; 36 | }; 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | // template implements 45 | template 46 | T TextIO::readElement() { 47 | T out; 48 | _is >> out; 49 | if (_is.fail()) { 50 | std::string tmp; 51 | _is >> tmp; 52 | std::cerr << "\nERROR: cannot read " << tmp << " into " 53 | << typeid(T).name() << " \n" << std::endl; 54 | std::abort(); 55 | } 56 | return out; 57 | } 58 | 59 | template 60 | MatT TextIO::readMatrix(const long rows, const long cols) { 61 | if (rows <= 0 or cols <= 0) { 62 | std::cerr << "\nERROR: Invalid rows or cols for reading matrix: " << rows << "x" << cols << " !\n" << std::endl; 63 | std::abort(); 64 | } 65 | 66 | MatT out(rows, cols); 67 | for (long i=0; i!=rows; ++i) { 68 | for (long j=0; j!=cols; ++j) { 69 | out(i, j) = readElement(); 70 | } 71 | } 72 | return out; 73 | } 74 | 75 | template 76 | VecT TextIO::readVector(const long size) { 77 | if (size <= 0) { 78 | std::cerr << "\nERROR: Invalid size for reading vector: " << size << " !\n" << std::endl; 79 | std::abort(); 80 | } 81 | return readMatrix(size, 1); 82 | } 83 | 84 | 85 | } 86 | 87 | #endif 88 | -------------------------------------------------------------------------------- /grad3/old/Makefile: -------------------------------------------------------------------------------- 1 | CC = g++ 2 | LFLAGS = --std=c++11 -O3 -Wall -g -Os #-fno-omit-frame-pointer -fsanitize=address 3 | NUMBERS = 1 2 3 4 5 6 4 | 5 | grad3 : main.o OUTCAR.o POSCAR.o global.o arg_parse.o 6 | $(CC) -o cgrad main.o OUTCAR.o POSCAR.o global.o arg_parse.o $(LFLAGS) 7 | 8 | test : grad3 $(TEST_FILES) 9 | unzip -o ./tests.zip 10 | $(foreach var,$(NUMBERS), echo running test$(var); ./cgrad -mvu -o ./test$(var)/OUTCAR -p ./test$(var)/POSCAR;) 11 | 12 | main.o : main.cpp POSCAR.h OUTCAR.h global.h 13 | $(CC) -c main.cpp $(LFLAGS) 14 | 15 | OUTCAR.o : OUTCAR.cpp OUTCAR.h 16 | $(CC) -c OUTCAR.cpp $(LFLAGS) 17 | 18 | POSCAR.o : POSCAR.cpp POSCAR.h 19 | $(CC) -c POSCAR.cpp $(LFLAGS) 20 | 21 | global.o : global.h global.cpp 22 | $(CC) -c global.cpp $(LFLAGS) 23 | 24 | arg_parse.o : arg_parse.h arg_parse.cpp 25 | $(CC) -c arg_parse.cpp $(LFLAGS) 26 | 27 | clean : 28 | -@rm -r *.o *.gch \~ cgrad test1 test2 test3 test4 test5 test6 test7 2> /dev/null || true 29 | -------------------------------------------------------------------------------- /grad3/old/OUTCAR.h: -------------------------------------------------------------------------------- 1 | #include "headers.h" 2 | #include "global.h" 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | class OUTCAR { 9 | public: 10 | OUTCAR(std::ifstream&); 11 | ~OUTCAR(); 12 | size_t shownNumOfAtoms(); 13 | 14 | void GetPosInfo(); // called ONLY when POSCAR doesn't exist. 15 | /* 16 | these three functions below will be called 17 | ONLY when POSCAR exists. 18 | */ 19 | void inputnIons(const size_t); 20 | void inputSelectiveDynamics(const bool); 21 | void inputdarrActive(const std::vector>); 22 | 23 | void GetOtherVals(); // called at last 24 | private: 25 | std::vector strData; 26 | std::vector> darrForces; 27 | std::vector> darrActive; 28 | /* index, force, force_x, force_y, force_z */ 29 | std::vector> darrUnconverged; 30 | size_t nNumOfElems, nNumOfAtoms, nIons; 31 | double dEDiff; 32 | 33 | size_t nIterations, nSteps; 34 | double dEnergy, dLastEnergy, dCPUTime, 35 | dDE, dMagmom, dVolume, dTotalTime, 36 | dAverage, dMaxForce, dFAccuracy; 37 | bool bSpinPolarized, 38 | bSelectiveDynamics; // Defined in POSCAR.h 39 | 40 | void GetNumOfAtoms(); 41 | void GetNumOfElems(); 42 | void GetEDiff(); 43 | void GetEDiffG(); 44 | }; 45 | -------------------------------------------------------------------------------- /grad3/old/POSCAR.h: -------------------------------------------------------------------------------- 1 | #include "headers.h" 2 | 3 | class POSCAR { 4 | public: 5 | POSCAR(std::ifstream&, const size_t); 6 | ~POSCAR(); 7 | size_t shownIons(); 8 | bool showbSelective_Dynamics(); 9 | std::vector> showdarrActive(); 10 | private: 11 | size_t nIons; 12 | size_t nAtoms; 13 | bool bSelective_Dynamics; 14 | std::vector> darrActive; 15 | 16 | void inputAtoms(const size_t); 17 | }; -------------------------------------------------------------------------------- /grad3/old/README.md: -------------------------------------------------------------------------------- 1 | # Supervised by Hao Ren (renh@upc.edu.cn) 2 | 3 | This tiny utility is interpreted from renh's `grad3` which was written with python. 4 | 5 | ## grad3 usage 6 | 7 | ```bash 8 | usage: [[-o OUTCAR] [-p POSCAR] [-v] [-m]] 9 | Detailed usage: 10 | -h --help display help 11 | -o --outcar specify OUTCAR file manually 12 | -p --poscar specipy POSCAR file manually 13 | -m --magnet enable magnet layout 14 | -v --volume enable lattice volume layout 15 | -e --without-entropy layout Energy without entropy 16 | -u --unconverged_atoms layout unconverged atoms info 17 | ``` 18 | 19 | If it runs correctly, you should get [this](https://paste.ubuntu.com/p/QNDKhVYB5S/) . 20 | 21 | ## Make 22 | 23 | `make test` is recommended, if you trust my code, just `make` and skip the test XD; 24 | 25 | Delete the tail after `--std=c++11` in `LFLAGS` line, and `make` . If `clang` compiler is not found, substitute it with `g++`, `icpc`, etc. 26 | 27 | **Your compiler is required to support `C++11` standard.** 28 | -------------------------------------------------------------------------------- /grad3/old/arg_parse.h: -------------------------------------------------------------------------------- 1 | /* 2 | this method was inspired by 3 | https://stackoverflow.com/questions/865668/how-to-parse-command-line-arguments-in-c 4 | https://www.gnu.org/savannah-checkouts/gnu/libc/manual/html_node/Getopt-Long-Option-Example.html#Getopt-Long-Option-Example 5 | */ 6 | 7 | /* 8 | char* getCmdOption(const char** begin,const char** end, char* option); 9 | bool cmdOptionExists(char** begin, char** end, char* option); 10 | 11 | 12 | */ 13 | 14 | #include "global.h" 15 | #include 16 | 17 | void Parse(int argc, char** argv); 18 | void PrintHelp(); 19 | void PrintFileOpenError(const char* fname); 20 | -------------------------------------------------------------------------------- /grad3/old/compile_commands.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "directory": "/Users/ionizing/Documents/github/grad3/grad3/old", 4 | "arguments": [ 5 | "g++", 6 | "-c", 7 | "main.cpp", 8 | "--std=c++11", 9 | "-O3", 10 | "-Wall", 11 | "-g", 12 | "-Os" 13 | ], 14 | "file": "main.cpp" 15 | }, 16 | { 17 | "directory": "/Users/ionizing/Documents/github/grad3/grad3/old", 18 | "arguments": [ 19 | "g++", 20 | "-c", 21 | "arg_parse.cpp", 22 | "--std=c++11", 23 | "-O3", 24 | "-Wall", 25 | "-g", 26 | "-Os" 27 | ], 28 | "file": "arg_parse.cpp" 29 | }, 30 | { 31 | "directory": "/Users/ionizing/Documents/github/grad3/grad3/old", 32 | "arguments": [ 33 | "g++", 34 | "-c", 35 | "global.cpp", 36 | "--std=c++11", 37 | "-O3", 38 | "-Wall", 39 | "-g", 40 | "-Os" 41 | ], 42 | "file": "global.cpp" 43 | }, 44 | { 45 | "directory": "/Users/ionizing/Documents/github/grad3/grad3/old", 46 | "arguments": [ 47 | "g++", 48 | "-c", 49 | "POSCAR.cpp", 50 | "--std=c++11", 51 | "-O3", 52 | "-Wall", 53 | "-g", 54 | "-Os" 55 | ], 56 | "file": "POSCAR.cpp" 57 | }, 58 | { 59 | "directory": "/Users/ionizing/Documents/github/grad3/grad3/old", 60 | "arguments": [ 61 | "g++", 62 | "-c", 63 | "OUTCAR.cpp", 64 | "--std=c++11", 65 | "-O3", 66 | "-Wall", 67 | "-g", 68 | "-Os" 69 | ], 70 | "file": "OUTCAR.cpp" 71 | } 72 | ] 73 | -------------------------------------------------------------------------------- /grad3/old/global.cpp: -------------------------------------------------------------------------------- 1 | #include "global.h" 2 | 3 | const char 4 | g_str_OKGREEN[16] = "\033[92m", 5 | g_str_WARNING[16] = "\033[93m", 6 | g_str_FAIL[16] = "\033[91m", 7 | g_str_ENDC[16] = "\033[0m"; 8 | 9 | char fname_OUTCAR[256] = "./OUTCAR", 10 | fname_POSCAR[256] = "./POSCAR"; 11 | 12 | bool layout_mag = false, layout_vol = false, 13 | without_ent = false, layout_unconverged_atoms = false; 14 | -------------------------------------------------------------------------------- /grad3/old/global.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by chen on 1/26/18. 3 | // 4 | // Modified by ionizing on 4/14/2018 5 | 6 | #include "headers.h" 7 | 8 | extern const char 9 | g_str_OKGREEN[], g_str_WARNING[], 10 | g_str_ENDC[], g_str_FAIL[]; 11 | 12 | extern char fname_OUTCAR[], fname_POSCAR[]; 13 | extern bool layout_mag, layout_vol, 14 | without_ent, layout_unconverged_atoms; 15 | -------------------------------------------------------------------------------- /grad3/old/headers.h: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | // #define _CRT_SECURE_NO_WARNING 9 | -------------------------------------------------------------------------------- /grad3/old/main.cpp: -------------------------------------------------------------------------------- 1 | #include "OUTCAR.h" 2 | #include "POSCAR.h" 3 | #include "global.h" 4 | #include "arg_parse.h" 5 | 6 | //#define DEBUG_MODE 7 | //#define DEBUG_OUTCARONLY 8 | 9 | int main(int argc, char* argv[]) { 10 | 11 | #ifdef DEBUG_MODE 12 | strcpy(fname_OUTCAR, "./test2/OUTCAR"); 13 | strcpy(fname_POSCAR, "./test2/POSCAR"); 14 | #else 15 | Parse(argc, argv); 16 | // printf("layout_vol = %d, layout_mag = %d\n", layout_vol, layout_mag); 17 | #endif // DEBUG_MODE 18 | 19 | std::ifstream ifs_OUTCAR(fname_OUTCAR); 20 | if (false == ifs_OUTCAR.good()) { 21 | PrintFileOpenError(fname_OUTCAR); 22 | } 23 | OUTCAR outcar(ifs_OUTCAR); 24 | ifs_OUTCAR.close(); 25 | 26 | #ifndef DEBUG_OUTCARONLY 27 | std::ifstream ifs_POSCAR(fname_POSCAR); 28 | if (false == ifs_POSCAR.good()) { 29 | PrintFileOpenError(fname_POSCAR); 30 | } 31 | size_t nAtoms = outcar.shownNumOfAtoms(); 32 | // printf("@main 47 nAtoms = %zu\n", nAtoms); 33 | POSCAR poscar(ifs_POSCAR, /*outcar.shownNumOfAtoms()*/ nAtoms); 34 | ifs_POSCAR.close(); 35 | outcar.inputnIons(poscar.shownIons()); 36 | outcar.inputdarrActive(poscar.showdarrActive()); 37 | outcar.inputSelectiveDynamics(poscar.showbSelective_Dynamics()); 38 | #else 39 | outcar.GetPosInfo(); 40 | #endif // !DEBUG_OUTCARONLY 41 | 42 | outcar.GetOtherVals(); 43 | // system("pause"); 44 | return 0; 45 | } 46 | -------------------------------------------------------------------------------- /grad3/old/tests.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ionizing/usefultools-for-vasp/5e42c4bce3e646fedceb6560ec7aa6b7b2702a8a/grad3/old/tests.zip -------------------------------------------------------------------------------- /grad3/src/element.cc: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | namespace ionizing { 4 | Element::Element(const char* name, 5 | const int num, 6 | const Mat33d acell) : 7 | Name(name), Num(num), Acell(acell), isInited(false) { 8 | Bcell = Acell.inverse(); 9 | } 10 | 11 | Element::Element() : 12 | Element("", 0, Mat33d{}) {}; 13 | 14 | bool Element::init_with_cart(const MatX3d atom_pos_cart, 15 | const VecStr comments) { 16 | isCart = true; 17 | atomPos = atom_pos_cart; 18 | atomPosCart = std::move(atom_pos_cart); 19 | this->comments = std::ref(comments); 20 | atomPosCart = atomPosDire * Acell; 21 | isInited = true; 22 | return true; 23 | } 24 | 25 | bool Element::init_with_dire(const MatX3d atom_pos_dire, 26 | const VecStr comments) { 27 | isCart = false; 28 | atomPos = atom_pos_dire; 29 | atomPosCart = std::move(atom_pos_dire); 30 | this->comments = std::ref(comments); 31 | atomPosDire = atomPosCart * Bcell; 32 | isInited = true; 33 | return true; 34 | } 35 | 36 | 37 | 38 | }; 39 | -------------------------------------------------------------------------------- /grad3/src/incar.cc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ionizing/usefultools-for-vasp/5e42c4bce3e646fedceb6560ec7aa6b7b2702a8a/grad3/src/incar.cc -------------------------------------------------------------------------------- /grad3/src/textio.cc: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | namespace ionizing { 4 | 5 | TextIO::TextIO(const char* file_name) : _is{nullptr} { 6 | _ifs.open(file_name, std::ios::ate); 7 | if (! _ifs.good()) { 8 | std::cerr << "\n***** Open text file " << file_name << " failed. *****\n" << std::endl; 9 | std::abort(); 10 | } else { 11 | std::cout << "\nTextIO created successfully!\n" << std::endl; 12 | } 13 | _fileSize = _ifs.tellg(); 14 | _ifs.seekg(0); 15 | _is.rdbuf(_ifs.rdbuf()); 16 | 17 | { 18 | std::cout << "\nDEBUG: " << __FILE__ << __FUNCTION__ <<" filesize of " << file_name << " is " << _fileSize << std::endl; 19 | } 20 | } 21 | 22 | TextIO::TextIO(std::istream& is) : _is{is.rdbuf()} { 23 | std::cout << "\nUsing redirected filestream.\n" << std::endl; 24 | } 25 | 26 | TextIO::~TextIO() { 27 | std::cout << "\nTextIO destructed successfully!\n" << std::endl; 28 | } 29 | 30 | long TextIO::getFileSize() const { 31 | return _fileSize; 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /grad3/third_party/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 | -------------------------------------------------------------------------------- /grad3/third_party/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 | -------------------------------------------------------------------------------- /grad3/third_party/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 | -------------------------------------------------------------------------------- /grad3/third_party/Eigen/Dense: -------------------------------------------------------------------------------- 1 | #include "Core" 2 | #include "LU" 3 | #include "Cholesky" 4 | #include "QR" 5 | #include "SVD" 6 | #include "Geometry" 7 | #include "Eigenvalues" 8 | -------------------------------------------------------------------------------- /grad3/third_party/Eigen/Eigen: -------------------------------------------------------------------------------- 1 | #include "Dense" 2 | #include "Sparse" 3 | -------------------------------------------------------------------------------- /grad3/third_party/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 | -------------------------------------------------------------------------------- /grad3/third_party/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 | -------------------------------------------------------------------------------- /grad3/third_party/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 | -------------------------------------------------------------------------------- /grad3/third_party/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 | -------------------------------------------------------------------------------- /grad3/third_party/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 | -------------------------------------------------------------------------------- /grad3/third_party/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 | -------------------------------------------------------------------------------- /grad3/third_party/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 | -------------------------------------------------------------------------------- /grad3/third_party/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 | -------------------------------------------------------------------------------- /grad3/third_party/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 | -------------------------------------------------------------------------------- /grad3/third_party/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 | -------------------------------------------------------------------------------- /grad3/third_party/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 | -------------------------------------------------------------------------------- /grad3/third_party/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 | -------------------------------------------------------------------------------- /grad3/third_party/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 | -------------------------------------------------------------------------------- /grad3/third_party/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 | -------------------------------------------------------------------------------- /grad3/third_party/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 | -------------------------------------------------------------------------------- /grad3/third_party/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 | -------------------------------------------------------------------------------- /grad3/third_party/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 | -------------------------------------------------------------------------------- /grad3/third_party/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 | -------------------------------------------------------------------------------- /grad3/third_party/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 | -------------------------------------------------------------------------------- /grad3/third_party/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 | -------------------------------------------------------------------------------- /grad3/third_party/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 | -------------------------------------------------------------------------------- /grad3/third_party/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 | -------------------------------------------------------------------------------- /grad3/third_party/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 | -------------------------------------------------------------------------------- /grad3/third_party/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 | -------------------------------------------------------------------------------- /grad3/third_party/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 | -------------------------------------------------------------------------------- /grad3/third_party/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 | -------------------------------------------------------------------------------- /grad3/third_party/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 | -------------------------------------------------------------------------------- /grad3/third_party/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 | -------------------------------------------------------------------------------- /grad3/third_party/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 | -------------------------------------------------------------------------------- /grad3/third_party/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 | -------------------------------------------------------------------------------- /grad3/third_party/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 | -------------------------------------------------------------------------------- /grad3/third_party/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 | -------------------------------------------------------------------------------- /grad3/third_party/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 | -------------------------------------------------------------------------------- /grad3/third_party/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 | -------------------------------------------------------------------------------- /grad3/third_party/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 | -------------------------------------------------------------------------------- /grad3/third_party/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 | -------------------------------------------------------------------------------- /grad3/third_party/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 | -------------------------------------------------------------------------------- /grad3/third_party/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 | -------------------------------------------------------------------------------- /grad3/third_party/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 | -------------------------------------------------------------------------------- /grad3/third_party/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 | -------------------------------------------------------------------------------- /grad3/third_party/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 | -------------------------------------------------------------------------------- /grad3/third_party/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 | -------------------------------------------------------------------------------- /grad3/third_party/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 | -------------------------------------------------------------------------------- /grad3/third_party/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 | -------------------------------------------------------------------------------- /grad3/third_party/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 | -------------------------------------------------------------------------------- /grad3/third_party/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 | -------------------------------------------------------------------------------- /grad3/third_party/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 | -------------------------------------------------------------------------------- /grad3/third_party/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 | -------------------------------------------------------------------------------- /grad3/third_party/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 | -------------------------------------------------------------------------------- /grad3/third_party/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 | -------------------------------------------------------------------------------- /grad3/third_party/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 | -------------------------------------------------------------------------------- /grad3/third_party/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 | -------------------------------------------------------------------------------- /grad3/third_party/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 | -------------------------------------------------------------------------------- /grad3/third_party/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 | -------------------------------------------------------------------------------- /grad3/third_party/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 | -------------------------------------------------------------------------------- /grad3/third_party/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 | -------------------------------------------------------------------------------- /grad3/third_party/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 | -------------------------------------------------------------------------------- /grad3/third_party/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 | -------------------------------------------------------------------------------- /grad3/third_party/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 | -------------------------------------------------------------------------------- /grad3/third_party/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 | -------------------------------------------------------------------------------- /grad3/third_party/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 | -------------------------------------------------------------------------------- /grad3/third_party/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 | -------------------------------------------------------------------------------- /grad3/third_party/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 | -------------------------------------------------------------------------------- /grad3/third_party/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 | -------------------------------------------------------------------------------- /grad3/third_party/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 | -------------------------------------------------------------------------------- /grad3/third_party/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 | -------------------------------------------------------------------------------- /grad3/third_party/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 | -------------------------------------------------------------------------------- /grad3/third_party/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 | -------------------------------------------------------------------------------- /grad3/third_party/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 | -------------------------------------------------------------------------------- /grad3/third_party/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 | -------------------------------------------------------------------------------- /grad3/third_party/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 | -------------------------------------------------------------------------------- /grad3/third_party/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 | -------------------------------------------------------------------------------- /grad3/third_party/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 | -------------------------------------------------------------------------------- /grad3/third_party/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 | -------------------------------------------------------------------------------- /grad3/third_party/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 | -------------------------------------------------------------------------------- /grad3/third_party/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 | -------------------------------------------------------------------------------- /grad3/third_party/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 | -------------------------------------------------------------------------------- /grad3/third_party/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 | -------------------------------------------------------------------------------- /grad3/third_party/unsupported/doc/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set_directory_properties(PROPERTIES EXCLUDE_FROM_ALL TRUE) 2 | 3 | add_subdirectory(examples) 4 | add_subdirectory(snippets) 5 | -------------------------------------------------------------------------------- /grad3/third_party/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 | -------------------------------------------------------------------------------- /grad3/third_party/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 | -------------------------------------------------------------------------------- /grad3/third_party/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 | -------------------------------------------------------------------------------- /grad3/third_party/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 | -------------------------------------------------------------------------------- /grad3/third_party/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 | -------------------------------------------------------------------------------- /grad3/third_party/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 | -------------------------------------------------------------------------------- /grad3/third_party/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 | -------------------------------------------------------------------------------- /grad3/third_party/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 | -------------------------------------------------------------------------------- /grad3/third_party/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 | -------------------------------------------------------------------------------- /grad3/third_party/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 | -------------------------------------------------------------------------------- /grad3/third_party/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 | -------------------------------------------------------------------------------- /grad3/third_party/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 | -------------------------------------------------------------------------------- /grad3/third_party/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 | -------------------------------------------------------------------------------- /grad3/third_party/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 | -------------------------------------------------------------------------------- /grad3/third_party/unsupported/test/FFT.cpp: -------------------------------------------------------------------------------- 1 | #define test_FFTW test_FFT 2 | #include "FFTW.cpp" 3 | -------------------------------------------------------------------------------- /grad3/third_party/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 | #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 | -------------------------------------------------------------------------------- /grad3/third_party/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 | -------------------------------------------------------------------------------- /grad3/third_party/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 | -------------------------------------------------------------------------------- /grad3/third_party/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 | -------------------------------------------------------------------------------- /grad3/third_party/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 | -------------------------------------------------------------------------------- /grad3/third_party/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 | -------------------------------------------------------------------------------- /grad3/third_party/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 | -------------------------------------------------------------------------------- /grad3/third_party/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 | -------------------------------------------------------------------------------- /grad3/third_party/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 | -------------------------------------------------------------------------------- /grad3/third_party/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 | -------------------------------------------------------------------------------- /grad3/third_party/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 | -------------------------------------------------------------------------------- /grad3/third_party/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 | -------------------------------------------------------------------------------- /grad3/third_party/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 | -------------------------------------------------------------------------------- /grad3/third_party/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 | -------------------------------------------------------------------------------- /grad3/third_party/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 | -------------------------------------------------------------------------------- /grad3/third_party/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 | -------------------------------------------------------------------------------- /grad3/third_party/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 | -------------------------------------------------------------------------------- /grad3/third_party/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 | -------------------------------------------------------------------------------- /grad3/unit_test/error_test.cc: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | void foo() { 4 | PRINT_ERROR("test in function 'foo'"); 5 | } 6 | 7 | int main() { 8 | 9 | PRINT_ERROR("test in function 'main'"); 10 | 11 | return 0; 12 | } 13 | -------------------------------------------------------------------------------- /grad3/unit_test/test1/POSCAR: -------------------------------------------------------------------------------- 1 | Te 2 | 1.00000000000000 3 | 16.709769374964747 0.0000000000000000 0.0000000000000000 4 | 0.0000000000000000 12.674393023454058 0.0000000000000000 5 | 0.0000000000000000 0.0000000000000000 30.0000000000000000 6 | 27 7 | Cart 8 | 3.6611970859445004 2.1123988372423428 1.5059033426991442 ! comment test 9 | 3.6611970859445004 6.3371965117270292 1.5059033426991442 10 | 3.6611970859445004 10.5619941862117166 1.5059033426991442 11 | 9.2311202109327493 2.1123988372423428 1.5059033426991442 12 | 9.2311202109327493 6.3371965117270292 1.5059033426991442 13 | 9.2311202109327493 10.5619941862117166 1.5059033426991442 14 | 14.8010433359209976 2.1123988372423428 1.5059033426991442 15 | 14.8010433359209976 6.3371965117270292 1.5059033426991442 16 | 14.8010433359209976 10.5619941862117166 1.5059033426991442 17 | 0.0001693318154969 0.0000000000000000 2.5792868806914351 18 | 0.0001693318154969 4.2247976744846856 2.5792868806914351 19 | 0.0001693318154969 8.4495953489693711 2.5792868806914351 20 | 5.5700924568037458 0.0000000000000000 2.5792868806914351 21 | 5.5700924568037458 4.2247976744846856 2.5792868806914351 22 | 5.5700924568037458 8.4495953489693711 2.5792868806914351 23 | 11.1400155817919959 0.0000000000000000 2.5792868806914351 24 | 11.1400155817919959 4.2247976744846856 2.5792868806914351 25 | 11.1400155817919959 8.4495953489693711 2.5792868806914351 26 | 1.9085567072282539 2.1123988372423428 3.6548097766095013 27 | 1.9085567072282539 6.3371965117270292 3.6548097766095013 28 | 1.9085567072282539 10.5619941862117166 3.6548097766095013 29 | 7.4784798322165029 2.1123988372423428 3.6548097766095013 30 | 7.4784798322165029 6.3371965117270292 3.6548097766095013 31 | 7.4784798322165029 10.5619941862117166 3.6548097766095013 32 | 13.0484029572047540 2.1123988372423428 3.6548097766095013 33 | 13.0484029572047540 6.3371965117270292 3.6548097766095013 34 | 13.0484029572047540 10.5619941862117166 3.6548097766095013 35 | -------------------------------------------------------------------------------- /grad3/unit_test/test1/POSCAR_cart: -------------------------------------------------------------------------------- 1 | Te 2 | 1 3 | 16.7097694 0.0000000 0.0000000 4 | 0.0000000 12.6743930 0.0000000 5 | 0.0000000 0.0000000 30.0000000 6 | 27 7 | Cartesian 8 | 3.6611971 2.1123988 1.5059033 ! ! comment test 9 | 3.6611971 6.3371965 1.5059033 ! 10 | 3.6611971 10.5619942 1.5059033 ! 11 | 9.2311202 2.1123988 1.5059033 ! 12 | 9.2311202 6.3371965 1.5059033 ! 13 | 9.2311202 10.5619942 1.5059033 ! 14 | 14.8010433 2.1123988 1.5059033 ! 15 | 14.8010433 6.3371965 1.5059033 ! 16 | 14.8010433 10.5619942 1.5059033 ! 17 | 0.0001693 0.0000000 2.5792869 ! 18 | 0.0001693 4.2247977 2.5792869 ! 19 | 0.0001693 8.4495953 2.5792869 ! 20 | 5.5700925 0.0000000 2.5792869 ! 21 | 5.5700925 4.2247977 2.5792869 ! 22 | 5.5700925 8.4495953 2.5792869 ! 23 | 11.1400156 0.0000000 2.5792869 ! 24 | 11.1400156 4.2247977 2.5792869 ! 25 | 11.1400156 8.4495953 2.5792869 ! 26 | 1.9085567 2.1123988 3.6548098 ! 27 | 1.9085567 6.3371965 3.6548098 ! 28 | 1.9085567 10.5619942 3.6548098 ! 29 | 7.4784798 2.1123988 3.6548098 ! 30 | 7.4784798 6.3371965 3.6548098 ! 31 | 7.4784798 10.5619942 3.6548098 ! 32 | 13.0484030 2.1123988 3.6548098 ! 33 | 13.0484030 6.3371965 3.6548098 ! 34 | 13.0484030 10.5619942 3.6548098 ! 35 | -------------------------------------------------------------------------------- /grad3/unit_test/test1/POSCAR_direct: -------------------------------------------------------------------------------- 1 | Te 2 | 1 3 | 16.7097694 0.0000000 0.0000000 4 | 0.0000000 12.6743930 0.0000000 5 | 0.0000000 0.0000000 30.0000000 6 | 27 7 | Direct 8 | 0.2191052 0.1666667 0.0501968 ! ! comment test 9 | 0.2191052 0.5000000 0.0501968 ! 10 | 0.2191052 0.8333333 0.0501968 ! 11 | 0.5524385 0.1666667 0.0501968 ! 12 | 0.5524385 0.5000000 0.0501968 ! 13 | 0.5524385 0.8333333 0.0501968 ! 14 | 0.8857719 0.1666667 0.0501968 ! 15 | 0.8857719 0.5000000 0.0501968 ! 16 | 0.8857719 0.8333333 0.0501968 ! 17 | 0.0000101 0.0000000 0.0859762 ! 18 | 0.0000101 0.3333333 0.0859762 ! 19 | 0.0000101 0.6666667 0.0859762 ! 20 | 0.3333435 0.0000000 0.0859762 ! 21 | 0.3333435 0.3333333 0.0859762 ! 22 | 0.3333435 0.6666667 0.0859762 ! 23 | 0.6666768 0.0000000 0.0859762 ! 24 | 0.6666768 0.3333333 0.0859762 ! 25 | 0.6666768 0.6666667 0.0859762 ! 26 | 0.1142180 0.1666667 0.1218270 ! 27 | 0.1142180 0.5000000 0.1218270 ! 28 | 0.1142180 0.8333333 0.1218270 ! 29 | 0.4475513 0.1666667 0.1218270 ! 30 | 0.4475513 0.5000000 0.1218270 ! 31 | 0.4475513 0.8333333 0.1218270 ! 32 | 0.7808847 0.1666667 0.1218270 ! 33 | 0.7808847 0.5000000 0.1218270 ! 34 | 0.7808847 0.8333333 0.1218270 ! 35 | -------------------------------------------------------------------------------- /grad3/unit_test/test2/POSCAR_cart: -------------------------------------------------------------------------------- 1 | 3D\Atomistic 2 | 1 3 | 7.4942656 0.0000000 -0.0000000 4 | 0.0000000 7.4942656 -0.0000000 5 | 0.0000000 0.0000000 7.4942656 6 | C 7 | 32 8 | Cartesian 9 | 0.5293522 0.5293522 0.5293522 10 | 6.9649131 3.2177806 4.2764852 11 | 3.2177806 4.2764852 6.9649131 12 | 4.2764852 6.9649131 3.2177806 13 | 6.1500516 2.4029186 5.0913467 14 | 1.3442142 1.3442142 1.3442142 15 | 2.4029186 5.0913467 6.1500516 16 | 5.0913467 6.1500516 2.4029186 17 | 2.4029186 6.1500516 5.0913467 18 | 6.1500516 5.0913467 2.4029186 19 | 5.0913467 2.4029186 6.1500516 20 | 3.2177806 6.9649131 4.2764852 21 | 6.9649131 4.2764852 3.2177806 22 | 4.2764852 3.2177806 6.9649131 23 | 0.5293522 4.2764852 4.2764852 24 | 6.9649131 6.9649131 0.5293522 25 | 3.2177806 0.5293522 3.2177806 26 | 6.1500516 6.1500516 1.3442142 27 | 1.3442142 5.0913467 5.0913467 28 | 2.4029186 1.3442142 2.4029186 29 | 2.4029186 2.4029186 1.3442142 30 | 6.1500516 1.3442142 6.1500516 31 | 3.2177806 3.2177806 0.5293522 32 | 6.9649131 0.5293522 6.9649131 33 | 4.2764852 0.5293522 4.2764852 34 | 0.5293522 6.9649131 6.9649131 35 | 5.0913467 1.3442142 5.0913467 36 | 1.3442142 6.1500516 6.1500516 37 | 1.3442142 2.4029186 2.4029186 38 | 0.5293522 3.2177806 3.2177806 39 | 4.2764852 4.2764852 0.5293522 40 | 5.0913467 5.0913467 1.3442142 41 | -------------------------------------------------------------------------------- /grad3/unit_test/test2/POSCAR_direct: -------------------------------------------------------------------------------- 1 | 3D\Atomistic 2 | 1 3 | 7.4942656 0.0000000 -0.0000000 4 | 0.0000000 7.4942656 -0.0000000 5 | 0.0000000 0.0000000 7.4942656 6 | C 7 | 32 8 | Direct 9 | 0.0706343 0.0706343 0.0706343 10 | 0.9293657 0.4293657 0.5706343 11 | 0.4293657 0.5706343 0.9293657 12 | 0.5706343 0.9293657 0.4293657 13 | 0.8206343 0.3206343 0.6793657 14 | 0.1793657 0.1793657 0.1793657 15 | 0.3206343 0.6793657 0.8206343 16 | 0.6793657 0.8206343 0.3206343 17 | 0.3206343 0.8206343 0.6793657 18 | 0.8206343 0.6793657 0.3206343 19 | 0.6793657 0.3206343 0.8206343 20 | 0.4293657 0.9293657 0.5706343 21 | 0.9293657 0.5706343 0.4293657 22 | 0.5706343 0.4293657 0.9293657 23 | 0.0706343 0.5706343 0.5706343 24 | 0.9293657 0.9293657 0.0706343 25 | 0.4293657 0.0706343 0.4293657 26 | 0.8206343 0.8206343 0.1793657 27 | 0.1793657 0.6793657 0.6793657 28 | 0.3206343 0.1793657 0.3206343 29 | 0.3206343 0.3206343 0.1793657 30 | 0.8206343 0.1793657 0.8206343 31 | 0.4293657 0.4293657 0.0706343 32 | 0.9293657 0.0706343 0.9293657 33 | 0.5706343 0.0706343 0.5706343 34 | 0.0706343 0.9293657 0.9293657 35 | 0.6793657 0.1793657 0.6793657 36 | 0.1793657 0.8206343 0.8206343 37 | 0.1793657 0.3206343 0.3206343 38 | 0.0706343 0.4293657 0.4293657 39 | 0.5706343 0.5706343 0.0706343 40 | 0.6793657 0.6793657 0.1793657 41 | -------------------------------------------------------------------------------- /grad3/unit_test/test_5.cc: -------------------------------------------------------------------------------- 1 | #define CATCH_CONFIG_MAIN 2 | #define UNIT_TEST 3 | 4 | #include 5 | #include 6 | 7 | using namespace ionizing; 8 | 9 | OUTCAR outcar{"./test1/OUTCAR"}; 10 | 11 | std::ifstream ifs{"./test5/OUTCAR"}; 12 | string content = outcar.file_to_string(ifs); 13 | VecStr contentVector = outcar.string_to_vecstr(content); 14 | 15 | TEST_CASE("Elements") { 16 | VecStr elem_result = { 17 | "Mn", 18 | "O" }; 19 | std::vector ions_per_type{22, 26}; 20 | 21 | REQUIRE(outcar.parseElems(contentVector) == elem_result); 22 | REQUIRE(outcar._atomsPerElem == ions_per_type); 23 | } 24 | 25 | TEST_CASE("KPoints"){ 26 | REQUIRE_NOTHROW(outcar.parseKPoints(contentVector)); 27 | REQUIRE(16 == outcar._kpoints.rows()); 28 | } 29 | 30 | TEST_CASE("INCAR") { 31 | INCAR result = outcar.parseINCAR(contentVector); 32 | 33 | WHEN("EDIFF") 34 | REQUIRE(result._EDIFF == 1E-05); 35 | WHEN("EDIFFG") 36 | REQUIRE(result._EDIFFG == -0.01); 37 | WHEN("ENCUT") 38 | REQUIRE(result._ENCUT == 500.0); 39 | WHEN("IBRION") 40 | REQUIRE(result._IBRION == 2); 41 | WHEN("ISIF") 42 | REQUIRE(result._ISIF == 2); 43 | WHEN("ISPIN") 44 | REQUIRE(result._ISPIN == 2); 45 | WHEN("LNONCOLLINEAR") 46 | REQUIRE(result._LNONCOLLINEAR == false); 47 | WHEN("LSORBIT") 48 | REQUIRE(result._LSORBIT == false); 49 | WHEN("LORBIT") 50 | REQUIRE(result._LORBIT == 0); 51 | WHEN("NBANDS") 52 | REQUIRE(result._NBANDS == 224); 53 | WHEN("NELMIN") 54 | REQUIRE(result._NELMIN == 2); 55 | WHEN("NIONS") 56 | REQUIRE(result._NIONS == 48); 57 | WHEN("NKPTS") 58 | REQUIRE(result._NKPTS == 16); 59 | WHEN("NSW") 60 | REQUIRE(result._NSW == 500); 61 | } 62 | 63 | TEST_CASE("Iteration") { 64 | outcar.parseElems(contentVector); 65 | outcar.parseKPoints(contentVector); 66 | outcar.parseINCAR(contentVector); 67 | 68 | REQUIRE_NOTHROW(outcar.parseIterationVec(contentVector)); 69 | } 70 | -------------------------------------------------------------------------------- /grad3/unit_test/test_poscar.cc: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using ionizing::POSCAR; 4 | 5 | int main() { 6 | POSCAR poscar{"./test6/POSCAR"}; 7 | 8 | /* 9 | * poscar.saveAsDuplicate("POSCAR_cart", true); 10 | * poscar.saveAsDuplicate("POSCAR_direct", false); 11 | */ 12 | return 0; 13 | } 14 | -------------------------------------------------------------------------------- /pospot_checker/Makefile: -------------------------------------------------------------------------------- 1 | CC = g++ # gcc 4.9 or upper 2 | CFLAGS = -std=c++11 -O2 -Wall -g -Os 3 | NUMBERS = 1 2 4 | 5 | pospot_checker: pospot_checker.cpp 6 | $(CC) $(CFLAGS) -o pospot_checker pospot_checker.cpp 7 | 8 | clean: 9 | @rm -rf pospot_checker *.dSYM 2> /dev/null || true 10 | 11 | test: pospot_checker 12 | @$(foreach var,$(NUMBERS), echo running test$(var); cd tests/$(var); ../../pospot_checker; cd ../../;) 13 | -------------------------------------------------------------------------------- /pospot_checker/README.md: -------------------------------------------------------------------------------- 1 | # POSCAR and POTCAR checker 2 | 3 | **Warning, if you choose to use cpp version, your compiler should have 4 | complete support of std::regex, eg: gcc 4.9 or higher** 5 | 6 | ~~The bash version does the same thing.~~ 7 | 8 | Bash version can do more things. 9 | Contributed by Tang Gang. 10 | 11 | 1. Use regex to extract element info; 12 | 2. This program only reads 6th line of POSCAR, without guaranteeing the validity of POSCAR. 13 | -------------------------------------------------------------------------------- /pospot_checker/pospot_checker: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ionizing/usefultools-for-vasp/5e42c4bce3e646fedceb6560ec7aa6b7b2702a8a/pospot_checker/pospot_checker -------------------------------------------------------------------------------- /pospot_checker/pospot_sh_ver.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | FromPOT=$(grep -o "VRHFIN =[a-zA-Z]\+" POTCAR | cut -d '=' -f2 | tr 'a-z' 'A-Z'); 3 | FromPOS=$(head -6 POSCAR | tail -1 | grep -o "[a-zA-Z]\+" | tr 'a-z' 'A-Z'); 4 | 5 | if [[ ${FromPOT} == ${FromPOS} ]]; then 6 | echo "OK" 7 | else 8 | echo "Check failed " "Elements in POTCAR are:" 9 | echo ${FromPOT} 10 | echo "while elements in POSCAR are:" 11 | echo ${FromPOS} 12 | fi 13 | -------------------------------------------------------------------------------- /pospot_checker/pospot_tg_ver.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # A VASP input files checker 4 | # Contributor: Tang Gang, ionizing, and so on 5 | # 23:54 Dec 13, 2018 6 | 7 | RED="\033[31m" 8 | GREEN="\033[32m" 9 | NORMAL="\033[97m" 10 | END="\033[0m" 11 | 12 | function print_warning() { 13 | echo -e "${RED} $1 ${END}" 14 | } 15 | 16 | function print_ok() { 17 | echo -e "${GREEN} $1 ${END}" 18 | } 19 | 20 | function print_normal() { 21 | echo -e "${NORMAL} $1 ${END}" 22 | } 23 | 24 | nAtoms=$(sed 7'q;d' POSCAR | awk '{sum=0; for (i=1; i<=NF; i++) { sum+= $i } print sum}') 25 | varkpo=$(tail -3 KPOINTS) 26 | varinc=$(grep "KSPACING" INCAR) 27 | varpos=$(sed -n '6,8p' POSCAR) 28 | varatom=$(sed -n '6p' POSCAR | tr -d "\r\n") 29 | FromPOT=$(grep -o "VRHFIN =[a-zA-Z]\+" POTCAR | cut -d '=' -f2 | tr 'a-z' 'A-Z'); 30 | FromPOS=$(head -6 POSCAR | tail -1 | grep -o "[a-zA-Z]\+" | tr 'a-z' 'A-Z'); 31 | kspacing=$(grep -o "KSPACING" INCAR | cut -d '=' -f1 | tr -d "\r\n") 32 | 33 | if [ -e INCAR ]&&[ -e POSCAR ]&&[ -e POTCAR ]; then 34 | if [ -e KPOINTS ]; then 35 | print_ok " Input Files are ok." 36 | print_normal " KPOINTS: " 37 | print_normal ${varkpo} 38 | echo "" 39 | else 40 | if [ "$kspacing"x == "KSPACING"x ]; then 41 | print_ok " Input Files are ok. " 42 | print_normal " $varinc " 43 | else 44 | print_warning $(grep "KSPACING" INCAR) 45 | print_warning " KPOINTS or KSPACING do not exist ! " 46 | fi 47 | fi 48 | 49 | if [[ ${FromPOT} == ${FromPOS} ]]; then 50 | print_ok " Elements are the same ($varatom) in POSCAR and POTCAR. " 51 | else 52 | print_warning " ** Check failed ** Note that: Elements in POTCAR are: " 53 | print_normal ${FromPOT} 54 | print_warning " while elements in POSCAR are: " 55 | print_normal ${FromPOS} 56 | fi 57 | 58 | print_normal "\n Number of atoms is : ${nAtoms} \n" 59 | 60 | else 61 | for i in INCAR POTCAR KPOINTS POSCAR ; do 62 | if [ -e $i ] && [ $i = "POSCAR" ]; then 63 | print_normal " POSCAR: \n ${varpos}" 64 | print_normal "\n Number of atoms is : ${nAtoms} \n" 65 | elif [ ! -e $i ]; then 66 | print_warning " ${i} do not exist! " 67 | fi 68 | done 69 | fi 70 | -------------------------------------------------------------------------------- /pospot_checker/tests/1/POSCAR: -------------------------------------------------------------------------------- 1 | Si 2 | 5.403 3 | 0.0000000000000000 0.5000000000000000 0.5000000000000000 4 | 0.5000000000000000 0.0000000000000000 0.5000000000000000 5 | 0.5000000000000000 0.5000000000000000 0.0000000000000000 6 | Si 7 | 2 8 | Direct 9 | 0.0000000000000000 0.0000000000000000 0.0000000000000000 10 | 0.25000000000000000 0.25000000000000000 0.25000000000000000 11 | -------------------------------------------------------------------------------- /pospot_checker/tests/2/POSCAR: -------------------------------------------------------------------------------- 1 | Si 2 | 5.403 3 | 0.0000000000000000 0.5000000000000000 0.5000000000000000 4 | 0.5000000000000000 0.0000000000000000 0.5000000000000000 5 | 0.5000000000000000 0.5000000000000000 0.0000000000000000 6 | Si 7 | 2 8 | Direct 9 | 0.0000000000000000 0.0000000000000000 0.0000000000000000 10 | 0.25000000000000000 0.25000000000000000 0.25000000000000000 11 | --------------------------------------------------------------------------------