├── .github └── workflows │ └── python-publish.yml ├── .gitignore ├── .gitmodules ├── CMakeLists.txt ├── LICENSE ├── MANIFEST.in ├── README.md ├── examples ├── cartpole_example_code_generation.py ├── cartpole_example_mpc.py ├── cartpole_example_mpc_reference_constrained.py ├── cartpole_example_one_solve.py ├── quadrotor_hover_code_generation.py └── test_generated_code.py ├── pyproject.toml ├── src ├── bindings.cpp └── tinympc │ ├── __init__.py │ ├── codegen │ ├── __init__.py │ ├── codegen_src │ │ ├── include │ │ │ ├── Eigen │ │ │ │ ├── Eigen.h │ │ │ │ └── Eigen │ │ │ │ │ ├── AccelerateSupport │ │ │ │ │ ├── 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 │ │ │ │ │ ├── ThreadPool │ │ │ │ │ ├── UmfPackSupport │ │ │ │ │ └── src │ │ │ │ │ ├── AccelerateSupport │ │ │ │ │ ├── AccelerateSupport.h │ │ │ │ │ └── InternalHeaderCheck.h │ │ │ │ │ ├── Cholesky │ │ │ │ │ ├── InternalHeaderCheck.h │ │ │ │ │ ├── LDLT.h │ │ │ │ │ ├── LLT.h │ │ │ │ │ └── LLT_LAPACKE.h │ │ │ │ │ ├── CholmodSupport │ │ │ │ │ ├── CholmodSupport.h │ │ │ │ │ └── InternalHeaderCheck.h │ │ │ │ │ ├── Core │ │ │ │ │ ├── ArithmeticSequence.h │ │ │ │ │ ├── Array.h │ │ │ │ │ ├── ArrayBase.h │ │ │ │ │ ├── ArrayWrapper.h │ │ │ │ │ ├── Assign.h │ │ │ │ │ ├── AssignEvaluator.h │ │ │ │ │ ├── Assign_MKL.h │ │ │ │ │ ├── BandMatrix.h │ │ │ │ │ ├── Block.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 │ │ │ │ │ ├── InternalHeaderCheck.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 │ │ │ │ │ ├── SkewSymmetricMatrix3.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 │ │ │ │ │ │ │ ├── Complex.h │ │ │ │ │ │ │ ├── GemmKernel.h │ │ │ │ │ │ │ ├── MathFunctions.h │ │ │ │ │ │ │ ├── PacketMath.h │ │ │ │ │ │ │ ├── PacketMathFP16.h │ │ │ │ │ │ │ ├── TrsmKernel.h │ │ │ │ │ │ │ ├── TrsmUnrolls.inc │ │ │ │ │ │ │ └── TypeCasting.h │ │ │ │ │ │ ├── AltiVec │ │ │ │ │ │ │ ├── Complex.h │ │ │ │ │ │ │ ├── MathFunctions.h │ │ │ │ │ │ │ ├── MatrixProduct.h │ │ │ │ │ │ │ ├── MatrixProductCommon.h │ │ │ │ │ │ │ ├── MatrixProductMMA.h │ │ │ │ │ │ │ ├── MatrixProductMMAbfloat16.h │ │ │ │ │ │ │ ├── MatrixVectorProduct.h │ │ │ │ │ │ │ ├── PacketMath.h │ │ │ │ │ │ │ └── TypeCasting.h │ │ │ │ │ │ ├── Default │ │ │ │ │ │ │ ├── BFloat16.h │ │ │ │ │ │ │ ├── ConjHelper.h │ │ │ │ │ │ │ ├── GenericPacketMathFunctions.h │ │ │ │ │ │ │ ├── GenericPacketMathFunctionsFwd.h │ │ │ │ │ │ │ ├── Half.h │ │ │ │ │ │ │ └── Settings.h │ │ │ │ │ │ ├── GPU │ │ │ │ │ │ │ ├── Complex.h │ │ │ │ │ │ │ ├── MathFunctions.h │ │ │ │ │ │ │ ├── PacketMath.h │ │ │ │ │ │ │ ├── Tuple.h │ │ │ │ │ │ │ └── TypeCasting.h │ │ │ │ │ │ ├── HIP │ │ │ │ │ │ │ └── hcc │ │ │ │ │ │ │ │ └── math_constants.h │ │ │ │ │ │ ├── HVX │ │ │ │ │ │ │ ├── GeneralBlockPanelKernel.h │ │ │ │ │ │ │ └── PacketMath.h │ │ │ │ │ │ ├── MSA │ │ │ │ │ │ │ ├── Complex.h │ │ │ │ │ │ │ ├── MathFunctions.h │ │ │ │ │ │ │ └── PacketMath.h │ │ │ │ │ │ ├── NEON │ │ │ │ │ │ │ ├── Complex.h │ │ │ │ │ │ │ ├── GeneralBlockPanelKernel.h │ │ │ │ │ │ │ ├── MathFunctions.h │ │ │ │ │ │ │ ├── PacketMath.h │ │ │ │ │ │ │ ├── TypeCasting.h │ │ │ │ │ │ │ └── UnaryFunctors.h │ │ │ │ │ │ ├── SSE │ │ │ │ │ │ │ ├── Complex.h │ │ │ │ │ │ │ ├── MathFunctions.h │ │ │ │ │ │ │ ├── PacketMath.h │ │ │ │ │ │ │ └── TypeCasting.h │ │ │ │ │ │ ├── SVE │ │ │ │ │ │ │ ├── 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 │ │ │ │ │ │ ├── Assert.h │ │ │ │ │ │ ├── BlasUtil.h │ │ │ │ │ │ ├── ConfigureVectorization.h │ │ │ │ │ │ ├── Constants.h │ │ │ │ │ │ ├── DisableStupidWarnings.h │ │ │ │ │ │ ├── EmulateArray.h │ │ │ │ │ │ ├── ForwardDeclarations.h │ │ │ │ │ │ ├── IndexedViewHelper.h │ │ │ │ │ │ ├── IntegralConstant.h │ │ │ │ │ │ ├── MKL_support.h │ │ │ │ │ │ ├── Macros.h │ │ │ │ │ │ ├── MaxSizeVector.h │ │ │ │ │ │ ├── Memory.h │ │ │ │ │ │ ├── Meta.h │ │ │ │ │ │ ├── MoreMeta.h │ │ │ │ │ │ ├── ReenableStupidWarnings.h │ │ │ │ │ │ ├── ReshapedHelper.h │ │ │ │ │ │ ├── Serializer.h │ │ │ │ │ │ ├── StaticAssert.h │ │ │ │ │ │ ├── SymbolicIndex.h │ │ │ │ │ │ └── XprHelper.h │ │ │ │ │ ├── Eigenvalues │ │ │ │ │ ├── ComplexEigenSolver.h │ │ │ │ │ ├── ComplexSchur.h │ │ │ │ │ ├── ComplexSchur_LAPACKE.h │ │ │ │ │ ├── EigenSolver.h │ │ │ │ │ ├── GeneralizedEigenSolver.h │ │ │ │ │ ├── GeneralizedSelfAdjointEigenSolver.h │ │ │ │ │ ├── HessenbergDecomposition.h │ │ │ │ │ ├── InternalHeaderCheck.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 │ │ │ │ │ ├── InternalHeaderCheck.h │ │ │ │ │ ├── OrthoMethods.h │ │ │ │ │ ├── ParametrizedLine.h │ │ │ │ │ ├── Quaternion.h │ │ │ │ │ ├── Rotation2D.h │ │ │ │ │ ├── RotationBase.h │ │ │ │ │ ├── Scaling.h │ │ │ │ │ ├── Transform.h │ │ │ │ │ ├── Translation.h │ │ │ │ │ ├── Umeyama.h │ │ │ │ │ └── arch │ │ │ │ │ │ └── Geometry_SIMD.h │ │ │ │ │ ├── Householder │ │ │ │ │ ├── BlockHouseholder.h │ │ │ │ │ ├── Householder.h │ │ │ │ │ ├── HouseholderSequence.h │ │ │ │ │ └── InternalHeaderCheck.h │ │ │ │ │ ├── IterativeLinearSolvers │ │ │ │ │ ├── BasicPreconditioners.h │ │ │ │ │ ├── BiCGSTAB.h │ │ │ │ │ ├── ConjugateGradient.h │ │ │ │ │ ├── IncompleteCholesky.h │ │ │ │ │ ├── IncompleteLUT.h │ │ │ │ │ ├── InternalHeaderCheck.h │ │ │ │ │ ├── IterativeSolverBase.h │ │ │ │ │ ├── LeastSquareConjugateGradient.h │ │ │ │ │ └── SolveWithGuess.h │ │ │ │ │ ├── Jacobi │ │ │ │ │ ├── InternalHeaderCheck.h │ │ │ │ │ └── Jacobi.h │ │ │ │ │ ├── KLUSupport │ │ │ │ │ ├── InternalHeaderCheck.h │ │ │ │ │ └── KLUSupport.h │ │ │ │ │ ├── LU │ │ │ │ │ ├── Determinant.h │ │ │ │ │ ├── FullPivLU.h │ │ │ │ │ ├── InternalHeaderCheck.h │ │ │ │ │ ├── InverseImpl.h │ │ │ │ │ ├── PartialPivLU.h │ │ │ │ │ ├── PartialPivLU_LAPACKE.h │ │ │ │ │ └── arch │ │ │ │ │ │ └── InverseSize4.h │ │ │ │ │ ├── MetisSupport │ │ │ │ │ ├── InternalHeaderCheck.h │ │ │ │ │ └── MetisSupport.h │ │ │ │ │ ├── OrderingMethods │ │ │ │ │ ├── Amd.h │ │ │ │ │ ├── Eigen_Colamd.h │ │ │ │ │ ├── InternalHeaderCheck.h │ │ │ │ │ └── Ordering.h │ │ │ │ │ ├── PaStiXSupport │ │ │ │ │ ├── InternalHeaderCheck.h │ │ │ │ │ └── PaStiXSupport.h │ │ │ │ │ ├── PardisoSupport │ │ │ │ │ ├── InternalHeaderCheck.h │ │ │ │ │ └── PardisoSupport.h │ │ │ │ │ ├── QR │ │ │ │ │ ├── ColPivHouseholderQR.h │ │ │ │ │ ├── ColPivHouseholderQR_LAPACKE.h │ │ │ │ │ ├── CompleteOrthogonalDecomposition.h │ │ │ │ │ ├── FullPivHouseholderQR.h │ │ │ │ │ ├── HouseholderQR.h │ │ │ │ │ ├── HouseholderQR_LAPACKE.h │ │ │ │ │ └── InternalHeaderCheck.h │ │ │ │ │ ├── SPQRSupport │ │ │ │ │ ├── InternalHeaderCheck.h │ │ │ │ │ └── SuiteSparseQRSupport.h │ │ │ │ │ ├── SVD │ │ │ │ │ ├── BDCSVD.h │ │ │ │ │ ├── BDCSVD_LAPACKE.h │ │ │ │ │ ├── InternalHeaderCheck.h │ │ │ │ │ ├── JacobiSVD.h │ │ │ │ │ ├── JacobiSVD_LAPACKE.h │ │ │ │ │ ├── SVDBase.h │ │ │ │ │ └── UpperBidiagonalization.h │ │ │ │ │ ├── SparseCholesky │ │ │ │ │ ├── InternalHeaderCheck.h │ │ │ │ │ ├── SimplicialCholesky.h │ │ │ │ │ └── SimplicialCholesky_impl.h │ │ │ │ │ ├── SparseCore │ │ │ │ │ ├── AmbiVector.h │ │ │ │ │ ├── CompressedStorage.h │ │ │ │ │ ├── ConservativeSparseSparseProduct.h │ │ │ │ │ ├── InternalHeaderCheck.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 │ │ │ │ │ ├── InternalHeaderCheck.h │ │ │ │ │ ├── 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_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 │ │ │ │ │ ├── InternalHeaderCheck.h │ │ │ │ │ └── SparseQR.h │ │ │ │ │ ├── StlSupport │ │ │ │ │ ├── StdDeque.h │ │ │ │ │ ├── StdList.h │ │ │ │ │ ├── StdVector.h │ │ │ │ │ └── details.h │ │ │ │ │ ├── SuperLUSupport │ │ │ │ │ ├── InternalHeaderCheck.h │ │ │ │ │ └── SuperLUSupport.h │ │ │ │ │ ├── ThreadPool │ │ │ │ │ ├── Barrier.h │ │ │ │ │ ├── EventCount.h │ │ │ │ │ ├── InternalHeaderCheck.h │ │ │ │ │ ├── NonBlockingThreadPool.h │ │ │ │ │ ├── RunQueue.h │ │ │ │ │ ├── ThreadCancel.h │ │ │ │ │ ├── ThreadEnvironment.h │ │ │ │ │ ├── ThreadLocal.h │ │ │ │ │ ├── ThreadPoolInterface.h │ │ │ │ │ └── ThreadYield.h │ │ │ │ │ ├── UmfPackSupport │ │ │ │ │ ├── InternalHeaderCheck.h │ │ │ │ │ └── UmfPackSupport.h │ │ │ │ │ ├── misc │ │ │ │ │ ├── Image.h │ │ │ │ │ ├── InternalHeaderCheck.h │ │ │ │ │ ├── Kernel.h │ │ │ │ │ ├── RealSvd2x2.h │ │ │ │ │ ├── blas.h │ │ │ │ │ ├── lapacke.h │ │ │ │ │ ├── lapacke_helpers.h │ │ │ │ │ └── lapacke_mangling.h │ │ │ │ │ └── plugins │ │ │ │ │ ├── ArrayCwiseBinaryOps.h │ │ │ │ │ ├── ArrayCwiseUnaryOps.h │ │ │ │ │ ├── BlockMethods.h │ │ │ │ │ ├── CommonCwiseBinaryOps.h │ │ │ │ │ ├── CommonCwiseUnaryOps.h │ │ │ │ │ ├── IndexedViewMethods.h │ │ │ │ │ ├── InternalHeaderCheck.h │ │ │ │ │ ├── MatrixCwiseBinaryOps.h │ │ │ │ │ ├── MatrixCwiseUnaryOps.h │ │ │ │ │ └── ReshapedMethods.h │ │ │ └── tinympc │ │ │ │ ├── admm.hpp │ │ │ │ ├── codegen.hpp │ │ │ │ ├── error.hpp │ │ │ │ ├── rho_benchmark.hpp │ │ │ │ ├── tiny_api.hpp │ │ │ │ ├── tiny_api_constants.hpp │ │ │ │ └── types.hpp │ │ └── tinympc │ │ │ ├── admm.cpp │ │ │ ├── admm.hpp │ │ │ ├── codegen.cpp │ │ │ ├── codegen.hpp │ │ │ ├── error.hpp │ │ │ ├── rho_benchmark.cpp │ │ │ ├── rho_benchmark.hpp │ │ │ ├── tiny_api.cpp │ │ │ ├── tiny_api.hpp │ │ │ ├── tiny_api_constants.hpp │ │ │ └── types.hpp │ └── pywrapper │ │ ├── CMakeLists.txt │ │ ├── __init__.py │ │ ├── bindings.cpp │ │ └── setup.py │ └── interface.py └── tests ├── test_cache.py ├── test_cartpole_codegen.py ├── test_quadrotor_codegen.py └── test_settings.py /.github/workflows/python-publish.yml: -------------------------------------------------------------------------------- 1 | # This workflow will upload a Python Package to PyPI when a release is created 2 | # For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-package-registries 3 | 4 | # This workflow uses actions that are not certified by GitHub. 5 | # They are provided by a third-party and are governed by 6 | # separate terms of service, privacy policy, and support 7 | # documentation. 8 | 9 | name: Upload Python Package 10 | 11 | on: 12 | release: 13 | types: [published] 14 | 15 | permissions: 16 | contents: read 17 | 18 | jobs: 19 | release-build: 20 | runs-on: ubuntu-latest 21 | 22 | steps: 23 | - uses: actions/checkout@v4 24 | 25 | - uses: actions/setup-python@v5 26 | with: 27 | python-version: "3.x" 28 | 29 | - name: Build release distributions 30 | run: | 31 | # NOTE: put your own distribution build steps here. 32 | python -m pip install build 33 | python -m build --sdist 34 | 35 | - name: Upload distributions 36 | uses: actions/upload-artifact@v4 37 | with: 38 | name: release-dists 39 | path: dist/ 40 | 41 | pypi-publish: 42 | runs-on: ubuntu-latest 43 | needs: 44 | - release-build 45 | permissions: 46 | # IMPORTANT: this permission is mandatory for trusted publishing 47 | id-token: write 48 | 49 | # Dedicated environments with protections for publishing are strongly recommended. 50 | # For more information, see: https://docs.github.com/en/actions/deployment/targeting-different-environments/using-environments-for-deployment#deployment-protection-rules 51 | environment: 52 | name: pypi 53 | # OPTIONAL: uncomment and update to include your PyPI project URL in the deployment status: 54 | # url: https://pypi.org/p/YOURPROJECT 55 | # 56 | # ALTERNATIVE: if your GitHub Release name is the PyPI project version string 57 | # ALTERNATIVE: exactly, uncomment the following line instead: 58 | # url: https://pypi.org/project/YOURPROJECT/${{ github.event.release.name }} 59 | 60 | steps: 61 | - name: Retrieve release distributions 62 | uses: actions/download-artifact@v4 63 | with: 64 | name: release-dists 65 | path: dist/ 66 | 67 | - name: Publish release distributions to PyPI 68 | uses: pypa/gh-action-pypi-publish@release/v1 69 | with: 70 | packages-dir: dist/ 71 | password: ${{ secrets.PYPI }} 72 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Byte-compiled / optimized / DLL files 2 | __pycache__/ 3 | *.py[cod] 4 | *$py.class 5 | 6 | # C extensions 7 | *.so 8 | 9 | # Distribution / packaging 10 | wheelhouse/ 11 | .Python 12 | build/ 13 | develop-eggs/ 14 | dist/ 15 | downloads/ 16 | eggs/ 17 | .eggs/ 18 | lib/ 19 | lib64/ 20 | parts/ 21 | sdist/ 22 | var/ 23 | wheels/ 24 | share/python-wheels/ 25 | *.egg-info/ 26 | .installed.cfg 27 | *.egg 28 | MANIFEST 29 | 30 | # PyInstaller 31 | # Usually these files are written by a python script from a template 32 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 33 | *.manifest 34 | *.spec 35 | 36 | # Installer logs 37 | pip-log.txt 38 | pip-delete-this-directory.txt 39 | 40 | # Unit test / coverage reports 41 | htmlcov/ 42 | .tox/ 43 | .nox/ 44 | .coverage 45 | .coverage.* 46 | .cache 47 | nosetests.xml 48 | coverage.xml 49 | *.cover 50 | *.py,cover 51 | .hypothesis/ 52 | .pytest_cache/ 53 | cover/ 54 | 55 | # Translations 56 | *.mo 57 | *.pot 58 | 59 | # Django stuff: 60 | *.log 61 | local_settings.py 62 | db.sqlite3 63 | db.sqlite3-journal 64 | 65 | # Flask stuff: 66 | instance/ 67 | .webassets-cache 68 | 69 | # Scrapy stuff: 70 | .scrapy 71 | 72 | # Sphinx documentation 73 | docs/_build/ 74 | 75 | # PyBuilder 76 | .pybuilder/ 77 | target/ 78 | 79 | # Jupyter Notebook 80 | .ipynb_checkpoints 81 | 82 | # IPython 83 | profile_default/ 84 | ipython_config.py 85 | 86 | # pyenv 87 | # For a library or package, you might want to ignore these files since the code is 88 | # intended to run in multiple environments; otherwise, check them in: 89 | # .python-version 90 | 91 | # pipenv 92 | # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. 93 | # However, in case of collaboration, if having platform-specific dependencies or dependencies 94 | # having no cross-platform support, pipenv may install dependencies that don't work, or not 95 | # install all needed dependencies. 96 | #Pipfile.lock 97 | 98 | # poetry 99 | # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control. 100 | # This is especially recommended for binary packages to ensure reproducibility, and is more 101 | # commonly ignored for libraries. 102 | # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control 103 | #poetry.lock 104 | 105 | # pdm 106 | # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control. 107 | #pdm.lock 108 | # pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it 109 | # in version control. 110 | # https://pdm.fming.dev/#use-with-ide 111 | .pdm.toml 112 | 113 | # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm 114 | __pypackages__/ 115 | 116 | # Celery stuff 117 | celerybeat-schedule 118 | celerybeat.pid 119 | 120 | # SageMath parsed files 121 | *.sage.py 122 | 123 | # Environments 124 | .env 125 | .venv 126 | env/ 127 | venv/ 128 | ENV/ 129 | env.bak/ 130 | venv.bak/ 131 | 132 | # Spyder project settings 133 | .spyderproject 134 | .spyproject 135 | 136 | # Rope project settings 137 | .ropeproject 138 | 139 | # mkdocs documentation 140 | /site 141 | 142 | # mypy 143 | .mypy_cache/ 144 | .dmypy.json 145 | dmypy.json 146 | 147 | # Pyre type checker 148 | .pyre/ 149 | 150 | # pytype static type analyzer 151 | .pytype/ 152 | 153 | # Cython debug symbols 154 | cython_debug/ 155 | 156 | # PyCharm 157 | # JetBrains specific template is maintained in a separate JetBrains.gitignore that can 158 | # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore 159 | # and can be added to the global gitignore or merged into this file. For a more nuclear 160 | # option (not recommended) you can uncomment the following to ignore the entire idea folder. 161 | #.idea/ 162 | 163 | .vscode 164 | generated_code*/ 165 | *.mp4 166 | examples/*.h 167 | out/ -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "tinympc/TinyMPC"] 2 | path = tinympc/TinyMPC 3 | url = https://github.com/TinyMPC/TinyMPC.git 4 | branch = main -------------------------------------------------------------------------------- /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.15...3.26) 2 | project(ext) 3 | 4 | set(PYTHON "ON") 5 | set(TINY_CODEGEN_INSTALL_DIR "codegen/codegen_src" CACHE PATH "" FORCE) 6 | 7 | include(FetchContent) 8 | 9 | set(PYBIND11_FINDPYTHON ON) 10 | 11 | find_package(pybind11 CONFIG REQUIRED) 12 | 13 | message(STATUS "Fetching/configuring TinyMPC") 14 | list(APPEND CMAKE_MESSAGE_INDENT " ") 15 | FetchContent_Declare( 16 | tinympc 17 | GIT_REPOSITORY https://github.com/TinyMPC/TinyMPC.git 18 | GIT_TAG main 19 | ) 20 | list(POP_BACK CMAKE_MESSAGE_INDENT) 21 | FetchContent_MakeAvailable(tinympc) 22 | 23 | # configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/bindings.cpp.in 24 | # ${CMAKE_CURRENT_SOURCE_DIR}/src/bindings.cpp) 25 | pybind11_add_module(ext_tinympc src/bindings.cpp) 26 | install(TARGETS ext_tinympc DESTINATION . COMPONENT python) 27 | 28 | install(TARGETS ext_tinympc DESTINATION . COMPONENT python) 29 | target_link_libraries(ext_tinympc PUBLIC pybind11::module tinympcstatic) 30 | 31 | 32 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) [2023] [Khai Nguyen] 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. -------------------------------------------------------------------------------- /MANIFEST.in: -------------------------------------------------------------------------------- 1 | recursive-include src/tinympc/codegen/codegen_src * 2 | recursive-include src/tinympc/codegen/pywrapper * -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Python wrapper for [TinyMPC](https://tinympc.org/). 2 | 3 | ## Installation 4 | 5 | ```bash 6 | pip install tinympc 7 | ``` 8 | 9 | For development installation (optional): 10 | ```bash 11 | git clone https://github.com/TinyMPC/tinympc-python.git 12 | cd tinympc-python 13 | pip install -e . 14 | ``` 15 | 16 | ## Examples 17 | 18 | The `examples/` directory contains several demonstration files: 19 | 20 | ### Basic Examples 21 | - `cartpole_example_one_solve.py` - Single solve for cartpole problem 22 | - `cartpole_example_mpc.py` - MPC implementation for cartpole 23 | - `cartpole_example_mpc_constrained.py` - MPC with constraints 24 | 25 | ### Code Generation Examples 26 | *Note: Quadrotor Code generation examples require autograd: `pip install autograd`* 27 | 28 | - `cartpole_example_code_generation.py` - Code generation for cartpole 29 | - `quadrotor_hover_code_generation.py` - Code generation for quadrotor hover 30 | - For online hyperparameter tuning, set `ENABLE_ADAPTIVE_RHO = True` in the file 31 | 32 | ## Documentation 33 | 34 | Documentation and examples can be found [here](https://tinympc.org/get-started/installation/). 35 | -------------------------------------------------------------------------------- /examples/cartpole_example_code_generation.py: -------------------------------------------------------------------------------- 1 | import tinympc 2 | import numpy as np 3 | 4 | A = np.array([[1.0, 0.01, 0.0, 0.0], 5 | [0.0, 1.0, 0.039, 0.0], 6 | [0.0, 0.0, 1.002, 0.01], 7 | [0.0, 0.0, 0.458, 1.002]]) 8 | B = np.array([[0.0 ], 9 | [0.02 ], 10 | [0.0 ], 11 | [0.067]]) 12 | Q = np.diag([10.0, 1, 10, 1]) 13 | R = np.diag([1.0]) 14 | 15 | N = 20 16 | 17 | prob = tinympc.TinyMPC() 18 | 19 | u_min = np.array([-0.5]) 20 | u_max = np.array([0.5]) 21 | prob.setup(A, B, Q, R, N, rho=1, max_iter=10, u_min=u_min, u_max=u_max) 22 | 23 | prob.codegen("out", verbose=1) -------------------------------------------------------------------------------- /examples/cartpole_example_mpc.py: -------------------------------------------------------------------------------- 1 | import tinympc 2 | import numpy as np 3 | import matplotlib 4 | matplotlib.use('TkAgg') 5 | import matplotlib.pyplot as plt 6 | 7 | A = np.array([[1.0, 0.01, 0.0, 0.0], 8 | [0.0, 1.0, 0.039, 0.0], 9 | [0.0, 0.0, 1.002, 0.01], 10 | [0.0, 0.0, 0.458, 1.002]]) 11 | B = np.array([[0.0 ], 12 | [0.02 ], 13 | [0.0 ], 14 | [0.067]]) 15 | Q = np.diag([10.0, 1, 10, 1]) 16 | R = np.diag([1.0]) 17 | 18 | N = 20 19 | 20 | prob = tinympc.TinyMPC() 21 | 22 | prob.setup(A, B, Q, R, N, rho=1, max_iter=10) 23 | 24 | # Set initial condition 25 | x0 = np.array([0.5, 0, 0, 0]) 26 | 27 | Nsim = 1000 28 | xs = np.zeros((Nsim-N, 4)) 29 | us = np.zeros((Nsim-N, 1)) 30 | for i in range(Nsim-N): 31 | prob.set_x0(x0) # Set first state in horizon 32 | solution = prob.solve() 33 | x0 = A@x0 + B@solution["controls"] # Simulate forward 34 | xs[i] = x0 35 | us[i] = solution["controls"] 36 | 37 | fig, axs = plt.subplots(2, 1, sharex=True) 38 | axs[0].plot(xs, label=["x (meters)", "theta (radians)", "x_dot (m/s)", "theta_dot (rad/s)"]) 39 | axs[1].plot(us, label="control (Newtons)") 40 | axs[0].set_title("quadrotor trajectory over time") 41 | axs[1].set_xlabel("time steps (100Hz)") 42 | axs[0].legend(loc="upper right") 43 | axs[1].legend(loc="upper right") 44 | plt.show() -------------------------------------------------------------------------------- /examples/cartpole_example_mpc_reference_constrained.py: -------------------------------------------------------------------------------- 1 | import tinympc 2 | import numpy as np 3 | import matplotlib 4 | matplotlib.use('TkAgg') 5 | import matplotlib.pyplot as plt 6 | 7 | A = np.array([[1.0, 0.01, 0.0, 0.0], 8 | [0.0, 1.0, 0.039, 0.0], 9 | [0.0, 0.0, 1.002, 0.01], 10 | [0.0, 0.0, 0.458, 1.002]]) 11 | B = np.array([[0.0 ], 12 | [0.02 ], 13 | [0.0 ], 14 | [0.067]]) 15 | Q = np.diag([10.0, 1, 10, 1]) 16 | R = np.diag([1.0]) 17 | 18 | N = 20 19 | 20 | prob = tinympc.TinyMPC() 21 | 22 | # Define input constraints 23 | u_min = np.array([-0.45]) 24 | u_max = np.array([0.45]) 25 | prob.setup(A, B, Q, R, N, u_min=u_min, u_max=u_max) 26 | 27 | # Goal must be another equilibrium position 28 | prob.set_x_ref(np.array([1.0, 0, 0, 0])) 29 | 30 | # Set initial condition 31 | x0 = np.array([0.5, 0, 0, 0]) 32 | 33 | Nsim = 1000 34 | xs = np.zeros((Nsim-N, 4)) 35 | us = np.zeros((Nsim-N, 1)) 36 | for i in range(Nsim-N): 37 | prob.set_x0(x0) # Set first state in horizon 38 | solution = prob.solve() 39 | x0 = A@x0 + B@solution["controls"] # Simulate forward 40 | xs[i] = x0 41 | us[i] = solution["controls"] 42 | 43 | fig, axs = plt.subplots(2, 1, sharex=True) 44 | axs[0].plot(xs, label=["x (meters)", "theta (radians)", "x_dot (m/s)", "theta_dot (rad/s)"]) 45 | axs[1].plot(us, label="control (Newtons)") 46 | axs[0].set_title("quadrotor trajectory over time") 47 | axs[1].set_xlabel("time steps (100Hz)") 48 | axs[0].legend(loc="upper right") 49 | axs[1].legend(loc="upper right") 50 | plt.show() -------------------------------------------------------------------------------- /examples/cartpole_example_one_solve.py: -------------------------------------------------------------------------------- 1 | import tinympc 2 | import numpy as np 3 | 4 | A = np.array([[1.0, 0.01, 0.0, 0.0], 5 | [0.0, 1.0, 0.039, 0.0], 6 | [0.0, 0.0, 1.002, 0.01], 7 | [0.0, 0.0, 0.458, 1.002]]) 8 | B = np.array([[0.0 ], 9 | [0.02 ], 10 | [0.0 ], 11 | [0.067]]) 12 | Q = np.diag([10.0, 1, 10, 1]) 13 | R = np.diag([1.0]) 14 | 15 | N = 20 16 | 17 | prob = tinympc.TinyMPC() 18 | 19 | prob.setup(A, B, Q, R, N, rho=1, max_iter=10) 20 | 21 | x0 = np.array([0.5, 0, 0, 0]) 22 | prob.set_x0(x0) 23 | 24 | solution = prob.solve() 25 | print(solution["controls"]) -------------------------------------------------------------------------------- /examples/test_generated_code.py: -------------------------------------------------------------------------------- 1 | import numpy as np 2 | import tinympcgen 3 | import matplotlib 4 | matplotlib.use('TkAgg') 5 | import matplotlib.pyplot as plt 6 | 7 | # These are only here for simulation purposes 8 | A = np.array([[1.0, 0.01, 0.0, 0.0], 9 | [0.0, 1.0, 0.039, 0.0], 10 | [0.0, 0.0, 1.002, 0.01], 11 | [0.0, 0.0, 0.458, 1.002]]) 12 | B = np.array([[0.0 ], 13 | [0.02 ], 14 | [0.0 ], 15 | [0.067]]) 16 | 17 | x0 = np.array([0.5, 0, 0, 0]) 18 | 19 | tinympcgen.set_x_ref(np.array([np.array([1.0, 0, 0, 0])]*20).T) 20 | 21 | Nsim = 1000 22 | xs = np.zeros((Nsim, 4)) 23 | us = np.zeros((Nsim, 1)) 24 | for i in range(Nsim): 25 | tinympcgen.set_x0(x0) # Set first state in horizon 26 | solution = tinympcgen.solve() 27 | x0 = A@x0 + B@solution["controls"] # Simulate forward 28 | xs[i] = x0 29 | us[i] = solution["controls"] 30 | 31 | fig, axs = plt.subplots(2, 1, sharex=True) 32 | axs[0].plot(xs, label=["x (meters)", "theta (radians)", "x_dot (m/s)", "theta_dot (rad/s)"]) 33 | axs[1].plot(us, label="control (Newtons)") 34 | axs[0].set_title("quadrotor trajectory over time") 35 | axs[1].set_xlabel("time steps (100Hz)") 36 | axs[0].legend(loc="upper right") 37 | axs[1].legend(loc="upper right") 38 | plt.show() -------------------------------------------------------------------------------- /pyproject.toml: -------------------------------------------------------------------------------- 1 | [build-system] 2 | requires = ["scikit-build-core", "pybind11"] 3 | build-backend = "scikit_build_core.build" 4 | 5 | [project] 6 | name = "tinympc" 7 | version = "0.0.4" 8 | authors = [ 9 | { name="Sam Schoedel", email="seschoedel@gmail.com" }, 10 | { name="Khai Nguyen", email="khai.nx1201@gmail.com" }, 11 | { name="Ishaan Mahajan", email="ishaanamahajan@gmail.com" }, 12 | ] 13 | description = "Python wrapper for TinyMPC" 14 | readme = "README.md" 15 | requires-python = ">=3.7" 16 | classifiers = [ 17 | "Programming Language :: Python :: 3", 18 | "License :: OSI Approved :: MIT License", 19 | "Operating System :: OS Independent", 20 | ] 21 | license = {file = "LICENSE"} 22 | dependencies = [ 23 | "numpy>=1.7", 24 | "scipy>=0.13.2,<1.12.0", 25 | "setuptools" 26 | ] 27 | 28 | [project.urls] 29 | Homepage = "https://tinympc.org" 30 | 31 | [tool.scikit-build] 32 | install.components = ["python", "codegen"] 33 | wheel.install-dir = "tinympc" 34 | 35 | [tool.scikit-build.cmake.define] 36 | TINYMPC_EXT_MODULE_NAME = "ext_tinympc" 37 | 38 | [tool.setuptools_scm] 39 | -------------------------------------------------------------------------------- /src/tinympc/__init__.py: -------------------------------------------------------------------------------- 1 | from tinympc.interface import TinyMPC -------------------------------------------------------------------------------- /src/tinympc/codegen/__init__.py: -------------------------------------------------------------------------------- 1 | # This module is populated with codegen src/header files at build time. 2 | -------------------------------------------------------------------------------- /src/tinympc/codegen/codegen_src/include/Eigen/Eigen.h: -------------------------------------------------------------------------------- 1 | /* 2 | Eigen.h 3 | Brian R Taylor 4 | brian.taylor@bolderflight.com 5 | 2017-02-08 6 | 7 | Copyright (c) 2017 Bolder Flight Systems 8 | 9 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software 10 | and associated documentation files (the "Software"), to deal in the Software without restriction, 11 | including without limitation the rights to use, copy, modify, merge, publish, distribute, 12 | sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is 13 | furnished to do so, subject to the following conditions: 14 | 15 | The above copyright notice and this permission notice shall be included in all copies or 16 | substantial portions of the Software. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING 19 | BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 21 | DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | */ 24 | 25 | // Credits: @rpavlik for writing the original header for the Eigen313 library, which this 26 | // was derived from: 27 | // http://forum.arduino.cc/index.php?PHPSESSID=a86gv50nb3e3ireijfmli63260&topic=144446.msg1089371#msg1089371 28 | 29 | // // Disable debug asserts. 30 | // #define EIGEN_NO_DEBUG 1 31 | 32 | // Hint to number of registers 33 | // #define EIGEN_ARCH_DEFAULT_NUMBER_OF_REGISTERS 16 34 | 35 | #ifdef A0 36 | # define NEED_A0_RESTORED A0 37 | # undef A0 38 | #endif 39 | #ifdef A1 40 | # define NEED_A1_RESTORED A1 41 | # undef A1 42 | #endif 43 | #ifdef B0 44 | # define NEED_B0_RESTORED B0 45 | # undef B0 46 | #endif 47 | #ifdef B1 48 | # define NEED_B1_RESTORED B1 49 | # undef B1 50 | #endif 51 | #ifdef round 52 | # define NEED_round_RESTORED round 53 | # undef round 54 | #endif 55 | 56 | namespace std { 57 | struct nothrow_t; 58 | } 59 | 60 | // Include main EIGEN Core header 61 | #include 62 | #include 63 | 64 | #ifdef NEED_A0_RESTORED 65 | # define A0 NEED_A0_RESTORED 66 | # undef NEED_A0_RESTORED 67 | #endif 68 | #ifdef NEED_A1_RESTORED 69 | # define A1 NEED_A1_RESTORED 70 | # undef NEED_A1_RESTORED 71 | #endif 72 | #ifdef NEED_B0_RESTORED 73 | # define B0 NEED_B0_RESTORED 74 | # undef NEED_B0_RESTORED 75 | #endif 76 | #ifdef NEED_B1_RESTORED 77 | # define B1 NEED_B1_RESTORED 78 | # undef NEED_B1_RESTORED 79 | #endif 80 | #ifdef NEED_round_RESTORED 81 | # define round NEED_round_RESTORED 82 | # undef NEED_round_RESTORED 83 | #endif 84 | -------------------------------------------------------------------------------- /src/tinympc/codegen/codegen_src/include/Eigen/Eigen/AccelerateSupport: -------------------------------------------------------------------------------- 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_ACCELERATESUPPORT_MODULE_H 9 | #define EIGEN_ACCELERATESUPPORT_MODULE_H 10 | 11 | #include "SparseCore" 12 | 13 | #include "src/Core/util/DisableStupidWarnings.h" 14 | 15 | /** \ingroup Support_modules 16 | * \defgroup AccelerateSupport_Module AccelerateSupport module 17 | * 18 | * This module provides an interface to the Apple Accelerate library. 19 | * It provides the seven following main factorization classes: 20 | * - class AccelerateLLT: a Cholesky (LL^T) factorization. 21 | * - class AccelerateLDLT: the default LDL^T factorization. 22 | * - class AccelerateLDLTUnpivoted: a Cholesky-like LDL^T factorization with only 1x1 pivots and no pivoting 23 | * - class AccelerateLDLTSBK: an LDL^T factorization with Supernode Bunch-Kaufman and static pivoting 24 | * - class AccelerateLDLTTPP: an LDL^T factorization with full threshold partial pivoting 25 | * - class AccelerateQR: a QR factorization 26 | * - class AccelerateCholeskyAtA: a QR factorization without storing Q (equivalent to A^TA = R^T R) 27 | * 28 | * \code 29 | * #include 30 | * \endcode 31 | * 32 | * In order to use this module, the Accelerate headers must be accessible from 33 | * the include paths, and your binary must be linked to the Accelerate framework. 34 | * The Accelerate library is only available on Apple hardware. 35 | * 36 | * Note that many of the algorithms can be influenced by the UpLo template 37 | * argument. All matrices are assumed to be symmetric. For example, the following 38 | * creates an LDLT factorization where your matrix is symmetric (implicit) and 39 | * uses the lower triangle: 40 | * 41 | * \code 42 | * AccelerateLDLT, Lower> ldlt; 43 | * \endcode 44 | */ 45 | 46 | // IWYU pragma: begin_exports 47 | #include "src/AccelerateSupport/AccelerateSupport.h" 48 | // IWYU pragma: end_exports 49 | 50 | #include "src/Core/util/ReenableStupidWarnings.h" 51 | 52 | #endif // EIGEN_ACCELERATESUPPORT_MODULE_H 53 | -------------------------------------------------------------------------------- /src/tinympc/codegen/codegen_src/include/Eigen/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 | // IWYU pragma: begin_exports 33 | #include "src/Cholesky/LLT.h" 34 | #include "src/Cholesky/LDLT.h" 35 | #ifdef EIGEN_USE_LAPACKE 36 | #include "src/misc/lapacke_helpers.h" 37 | #include "src/Cholesky/LLT_LAPACKE.h" 38 | #endif 39 | // IWYU pragma: end_exports 40 | 41 | #include "src/Core/util/ReenableStupidWarnings.h" 42 | 43 | #endif // EIGEN_CHOLESKY_MODULE_H 44 | -------------------------------------------------------------------------------- /src/tinympc/codegen/codegen_src/include/Eigen/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 CholmodDecomposition: 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 | // IWYU pragma: begin_exports 44 | #include "src/CholmodSupport/CholmodSupport.h" 45 | // IWYU pragma: end_exports 46 | 47 | #include "src/Core/util/ReenableStupidWarnings.h" 48 | 49 | #endif // EIGEN_CHOLMODSUPPORT_MODULE_H 50 | 51 | -------------------------------------------------------------------------------- /src/tinympc/codegen/codegen_src/include/Eigen/Eigen/Dense: -------------------------------------------------------------------------------- 1 | #include "Core" 2 | #include "LU" 3 | #include "Cholesky" 4 | #include "QR" 5 | #include "SVD" 6 | #include "Geometry" 7 | #include "Eigenvalues" 8 | -------------------------------------------------------------------------------- /src/tinympc/codegen/codegen_src/include/Eigen/Eigen/Eigen: -------------------------------------------------------------------------------- 1 | #include "Dense" 2 | #include "Sparse" 3 | -------------------------------------------------------------------------------- /src/tinympc/codegen/codegen_src/include/Eigen/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 | 37 | // IWYU pragma: begin_exports 38 | #include "src/Eigenvalues/Tridiagonalization.h" 39 | #include "src/Eigenvalues/RealSchur.h" 40 | #include "src/Eigenvalues/EigenSolver.h" 41 | #include "src/Eigenvalues/SelfAdjointEigenSolver.h" 42 | #include "src/Eigenvalues/GeneralizedSelfAdjointEigenSolver.h" 43 | #include "src/Eigenvalues/HessenbergDecomposition.h" 44 | #include "src/Eigenvalues/ComplexSchur.h" 45 | #include "src/Eigenvalues/ComplexEigenSolver.h" 46 | #include "src/Eigenvalues/RealQZ.h" 47 | #include "src/Eigenvalues/GeneralizedEigenSolver.h" 48 | #include "src/Eigenvalues/MatrixBaseEigenvalues.h" 49 | #ifdef EIGEN_USE_LAPACKE 50 | #ifdef EIGEN_USE_MKL 51 | #include "mkl_lapacke.h" 52 | #else 53 | #include "src/misc/lapacke.h" 54 | #endif 55 | #include "src/Eigenvalues/RealSchur_LAPACKE.h" 56 | #include "src/Eigenvalues/ComplexSchur_LAPACKE.h" 57 | #include "src/Eigenvalues/SelfAdjointEigenSolver_LAPACKE.h" 58 | #endif 59 | // IWYU pragma: end_exports 60 | 61 | #include "src/Core/util/ReenableStupidWarnings.h" 62 | 63 | #endif // EIGEN_EIGENVALUES_MODULE_H 64 | -------------------------------------------------------------------------------- /src/tinympc/codegen/codegen_src/include/Eigen/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 | // IWYU pragma: begin_exports 37 | #include "src/Geometry/OrthoMethods.h" 38 | #include "src/Geometry/EulerAngles.h" 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. 53 | #if (defined EIGEN_VECTORIZE_SSE) || (defined EIGEN_VECTORIZE_NEON) 54 | #include "src/Geometry/arch/Geometry_SIMD.h" 55 | #endif 56 | // IWYU pragma: end_exports 57 | 58 | #include "src/Core/util/ReenableStupidWarnings.h" 59 | 60 | #endif // EIGEN_GEOMETRY_MODULE_H 61 | -------------------------------------------------------------------------------- /src/tinympc/codegen/codegen_src/include/Eigen/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 | // IWYU pragma: begin_exports 24 | #include "src/Householder/Householder.h" 25 | #include "src/Householder/HouseholderSequence.h" 26 | #include "src/Householder/BlockHouseholder.h" 27 | // IWYU pragma: end_exports 28 | 29 | #include "src/Core/util/ReenableStupidWarnings.h" 30 | 31 | #endif // EIGEN_HOUSEHOLDER_MODULE_H 32 | -------------------------------------------------------------------------------- /src/tinympc/codegen/codegen_src/include/Eigen/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, AccelerateSupport. 31 | * 32 | \code 33 | #include 34 | \endcode 35 | */ 36 | 37 | // IWYU pragma: begin_exports 38 | #include "src/IterativeLinearSolvers/SolveWithGuess.h" 39 | #include "src/IterativeLinearSolvers/IterativeSolverBase.h" 40 | #include "src/IterativeLinearSolvers/BasicPreconditioners.h" 41 | #include "src/IterativeLinearSolvers/ConjugateGradient.h" 42 | #include "src/IterativeLinearSolvers/LeastSquareConjugateGradient.h" 43 | #include "src/IterativeLinearSolvers/BiCGSTAB.h" 44 | #include "src/IterativeLinearSolvers/IncompleteLUT.h" 45 | #include "src/IterativeLinearSolvers/IncompleteCholesky.h" 46 | // IWYU pragma: end_exports 47 | 48 | #include "src/Core/util/ReenableStupidWarnings.h" 49 | 50 | #endif // EIGEN_ITERATIVELINEARSOLVERS_MODULE_H 51 | -------------------------------------------------------------------------------- /src/tinympc/codegen/codegen_src/include/Eigen/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 | // IWYU pragma: begin_exports 28 | #include "src/Jacobi/Jacobi.h" 29 | // IWYU pragma: end_exports 30 | 31 | #include "src/Core/util/ReenableStupidWarnings.h" 32 | 33 | #endif // EIGEN_JACOBI_MODULE_H 34 | 35 | -------------------------------------------------------------------------------- /src/tinympc/codegen/codegen_src/include/Eigen/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 "SparseCore" 12 | 13 | #include "src/Core/util/DisableStupidWarnings.h" 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 | // IWYU pragma: begin_exports 38 | #include "src/KLUSupport/KLUSupport.h" 39 | // IWYU pragma: end_exports 40 | 41 | #include "src/Core/util/ReenableStupidWarnings.h" 42 | 43 | #endif // EIGEN_KLUSUPPORT_MODULE_H 44 | -------------------------------------------------------------------------------- /src/tinympc/codegen/codegen_src/include/Eigen/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 | 29 | // IWYU pragma: begin_exports 30 | #include "src/LU/FullPivLU.h" 31 | #include "src/LU/PartialPivLU.h" 32 | #ifdef EIGEN_USE_LAPACKE 33 | #include "src/misc/lapacke_helpers.h" 34 | #include "src/LU/PartialPivLU_LAPACKE.h" 35 | #endif 36 | #include "src/LU/Determinant.h" 37 | #include "src/LU/InverseImpl.h" 38 | 39 | #if defined EIGEN_VECTORIZE_SSE || defined EIGEN_VECTORIZE_NEON 40 | #include "src/LU/arch/InverseSize4.h" 41 | #endif 42 | // IWYU pragma: end_exports 43 | 44 | #include "src/Core/util/ReenableStupidWarnings.h" 45 | 46 | #endif // EIGEN_LU_MODULE_H 47 | -------------------------------------------------------------------------------- /src/tinympc/codegen/codegen_src/include/Eigen/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 | // IWYU pragma: begin_exports 31 | #include "src/MetisSupport/MetisSupport.h" 32 | // IWYU pragma: end_exports 33 | 34 | #include "src/Core/util/ReenableStupidWarnings.h" 35 | 36 | #endif // EIGEN_METISSUPPORT_MODULE_H 37 | -------------------------------------------------------------------------------- /src/tinympc/codegen/codegen_src/include/Eigen/Eigen/OrderingMethods: -------------------------------------------------------------------------------- 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_ORDERINGMETHODS_MODULE_H 9 | #define EIGEN_ORDERINGMETHODS_MODULE_H 10 | 11 | #include "SparseCore" 12 | 13 | #include "src/Core/util/DisableStupidWarnings.h" 14 | 15 | /** 16 | * \defgroup OrderingMethods_Module OrderingMethods module 17 | * 18 | * This module is currently for internal use only 19 | * 20 | * It defines various built-in and external ordering methods for sparse matrices. 21 | * They are typically used to reduce the number of elements during 22 | * the sparse matrix decomposition (LLT, LU, QR). 23 | * Precisely, in a preprocessing step, a permutation matrix P is computed using 24 | * those ordering methods and applied to the columns of the matrix. 25 | * Using for instance the sparse Cholesky decomposition, it is expected that 26 | * the nonzeros elements in LLT(A*P) will be much smaller than that in LLT(A). 27 | * 28 | * 29 | * Usage : 30 | * \code 31 | * #include 32 | * \endcode 33 | * 34 | * A simple usage is as a template parameter in the sparse decomposition classes : 35 | * 36 | * \code 37 | * SparseLU > solver; 38 | * \endcode 39 | * 40 | * \code 41 | * SparseQR > solver; 42 | * \endcode 43 | * 44 | * It is possible as well to call directly a particular ordering method for your own purpose, 45 | * \code 46 | * AMDOrdering ordering; 47 | * PermutationMatrix perm; 48 | * SparseMatrix A; 49 | * //Fill the matrix ... 50 | * 51 | * ordering(A, perm); // Call AMD 52 | * \endcode 53 | * 54 | * \note Some of these methods (like AMD or METIS), need the sparsity pattern 55 | * of the input matrix to be symmetric. When the matrix is structurally unsymmetric, 56 | * Eigen computes internally the pattern of \f$A^T*A\f$ before calling the method. 57 | * If your matrix is already symmetric (at leat in structure), you can avoid that 58 | * by calling the method with a SelfAdjointView type. 59 | * 60 | * \code 61 | * // Call the ordering on the pattern of the lower triangular matrix A 62 | * ordering(A.selfadjointView(), perm); 63 | * \endcode 64 | */ 65 | 66 | // IWYU pragma: begin_exports 67 | #include "src/OrderingMethods/Amd.h" 68 | #include "src/OrderingMethods/Ordering.h" 69 | // IWYU pragma: end_exports 70 | 71 | #include "src/Core/util/ReenableStupidWarnings.h" 72 | 73 | #endif // EIGEN_ORDERINGMETHODS_MODULE_H 74 | -------------------------------------------------------------------------------- /src/tinympc/codegen/codegen_src/include/Eigen/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 | // IWYU pragma: begin_exports 46 | #include "src/PaStiXSupport/PaStiXSupport.h" 47 | // IWYU pragma: end_exports 48 | 49 | #include "src/Core/util/ReenableStupidWarnings.h" 50 | 51 | #endif // EIGEN_PASTIXSUPPORT_MODULE_H 52 | -------------------------------------------------------------------------------- /src/tinympc/codegen/codegen_src/include/Eigen/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 | // IWYU pragma: begin_exports 32 | #include "src/PardisoSupport/PardisoSupport.h" 33 | // IWYU pragma: end_exports 34 | 35 | #include "src/Core/util/ReenableStupidWarnings.h" 36 | 37 | #endif // EIGEN_PARDISOSUPPORT_MODULE_H 38 | -------------------------------------------------------------------------------- /src/tinympc/codegen/codegen_src/include/Eigen/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 | // IWYU pragma: begin_exports 35 | #include "src/QR/HouseholderQR.h" 36 | #include "src/QR/FullPivHouseholderQR.h" 37 | #include "src/QR/ColPivHouseholderQR.h" 38 | #include "src/QR/CompleteOrthogonalDecomposition.h" 39 | #ifdef EIGEN_USE_LAPACKE 40 | #include "src/misc/lapacke_helpers.h" 41 | #include "src/QR/HouseholderQR_LAPACKE.h" 42 | #include "src/QR/ColPivHouseholderQR_LAPACKE.h" 43 | #endif 44 | // IWYU pragma: end_exports 45 | 46 | #include "src/Core/util/ReenableStupidWarnings.h" 47 | 48 | #endif // EIGEN_QR_MODULE_H 49 | -------------------------------------------------------------------------------- /src/tinympc/codegen/codegen_src/include/Eigen/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 | -------------------------------------------------------------------------------- /src/tinympc/codegen/codegen_src/include/Eigen/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 "CholmodSupport" 32 | 33 | // IWYU pragma: begin_exports 34 | #include "src/SPQRSupport/SuiteSparseQRSupport.h" 35 | // IWYU pragma: end_exports 36 | 37 | #include "src/Core/util/ReenableStupidWarnings.h" 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /src/tinympc/codegen/codegen_src/include/Eigen/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 | // IWYU pragma: begin_exports 35 | #include "src/misc/RealSvd2x2.h" 36 | #include "src/SVD/UpperBidiagonalization.h" 37 | #include "src/SVD/SVDBase.h" 38 | #include "src/SVD/JacobiSVD.h" 39 | #include "src/SVD/BDCSVD.h" 40 | #ifdef EIGEN_USE_LAPACKE 41 | #ifdef EIGEN_USE_MKL 42 | #include "mkl_lapacke.h" 43 | #else 44 | #include "src/misc/lapacke.h" 45 | #endif 46 | #ifndef EIGEN_USE_LAPACKE_STRICT 47 | #include "src/SVD/JacobiSVD_LAPACKE.h" 48 | #endif 49 | #include "src/SVD/BDCSVD_LAPACKE.h" 50 | #endif 51 | // IWYU pragma: end_exports 52 | 53 | #include "src/Core/util/ReenableStupidWarnings.h" 54 | 55 | #endif // EIGEN_SVD_MODULE_H 56 | -------------------------------------------------------------------------------- /src/tinympc/codegen/codegen_src/include/Eigen/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 | #include "SparseCholesky" 29 | #include "SparseLU" 30 | #include "SparseQR" 31 | #include "IterativeLinearSolvers" 32 | 33 | #endif // EIGEN_SPARSE_MODULE_H 34 | 35 | -------------------------------------------------------------------------------- /src/tinympc/codegen/codegen_src/include/Eigen/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 | // IWYU pragma: begin_exports 34 | #include "src/SparseCholesky/SimplicialCholesky.h" 35 | #include "src/SparseCholesky/SimplicialCholesky_impl.h" 36 | // IWYU pragma: end_exports 37 | 38 | #include "src/Core/util/ReenableStupidWarnings.h" 39 | 40 | #endif // EIGEN_SPARSECHOLESKY_MODULE_H 41 | -------------------------------------------------------------------------------- /src/tinympc/codegen/codegen_src/include/Eigen/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 | #include 21 | 22 | /** 23 | * \defgroup SparseCore_Module SparseCore module 24 | * 25 | * This module provides a sparse matrix representation, and basic associated matrix manipulations 26 | * and operations. 27 | * 28 | * See the \ref TutorialSparse "Sparse tutorial" 29 | * 30 | * \code 31 | * #include 32 | * \endcode 33 | * 34 | * This module depends on: Core. 35 | */ 36 | 37 | // IWYU pragma: begin_exports 38 | #include "src/SparseCore/SparseUtil.h" 39 | #include "src/SparseCore/SparseMatrixBase.h" 40 | #include "src/SparseCore/SparseAssign.h" 41 | #include "src/SparseCore/CompressedStorage.h" 42 | #include "src/SparseCore/AmbiVector.h" 43 | #include "src/SparseCore/SparseCompressedBase.h" 44 | #include "src/SparseCore/SparseMatrix.h" 45 | #include "src/SparseCore/SparseMap.h" 46 | #include "src/SparseCore/SparseVector.h" 47 | #include "src/SparseCore/SparseRef.h" 48 | #include "src/SparseCore/SparseCwiseUnaryOp.h" 49 | #include "src/SparseCore/SparseCwiseBinaryOp.h" 50 | #include "src/SparseCore/SparseTranspose.h" 51 | #include "src/SparseCore/SparseBlock.h" 52 | #include "src/SparseCore/SparseDot.h" 53 | #include "src/SparseCore/SparseRedux.h" 54 | #include "src/SparseCore/SparseView.h" 55 | #include "src/SparseCore/SparseDiagonalProduct.h" 56 | #include "src/SparseCore/ConservativeSparseSparseProduct.h" 57 | #include "src/SparseCore/SparseSparseProductWithPruning.h" 58 | #include "src/SparseCore/SparseProduct.h" 59 | #include "src/SparseCore/SparseDenseProduct.h" 60 | #include "src/SparseCore/SparseSelfAdjointView.h" 61 | #include "src/SparseCore/SparseTriangularView.h" 62 | #include "src/SparseCore/TriangularSolver.h" 63 | #include "src/SparseCore/SparsePermutation.h" 64 | #include "src/SparseCore/SparseFuzzy.h" 65 | #include "src/SparseCore/SparseSolverBase.h" 66 | // IWYU pragma: end_exports 67 | 68 | #include "src/Core/util/ReenableStupidWarnings.h" 69 | 70 | #endif // EIGEN_SPARSECORE_MODULE_H 71 | 72 | -------------------------------------------------------------------------------- /src/tinympc/codegen/codegen_src/include/Eigen/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 | // IWYU pragma: begin_exports 29 | #include "src/SparseLU/SparseLU_Structs.h" 30 | #include "src/SparseLU/SparseLU_SupernodalMatrix.h" 31 | #include "src/SparseLU/SparseLUImpl.h" 32 | #include "src/SparseCore/SparseColEtree.h" 33 | #include "src/SparseLU/SparseLU_Memory.h" 34 | #include "src/SparseLU/SparseLU_heap_relax_snode.h" 35 | #include "src/SparseLU/SparseLU_relax_snode.h" 36 | #include "src/SparseLU/SparseLU_pivotL.h" 37 | #include "src/SparseLU/SparseLU_panel_dfs.h" 38 | #include "src/SparseLU/SparseLU_kernel_bmod.h" 39 | #include "src/SparseLU/SparseLU_panel_bmod.h" 40 | #include "src/SparseLU/SparseLU_column_dfs.h" 41 | #include "src/SparseLU/SparseLU_column_bmod.h" 42 | #include "src/SparseLU/SparseLU_copy_to_ucol.h" 43 | #include "src/SparseLU/SparseLU_pruneL.h" 44 | #include "src/SparseLU/SparseLU_Utils.h" 45 | #include "src/SparseLU/SparseLU.h" 46 | // IWYU pragma: end_exports 47 | 48 | #include "src/Core/util/ReenableStupidWarnings.h" 49 | 50 | #endif // EIGEN_SPARSELU_MODULE_H 51 | -------------------------------------------------------------------------------- /src/tinympc/codegen/codegen_src/include/Eigen/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 | // IWYU pragma: begin_exports 32 | #include "src/SparseCore/SparseColEtree.h" 33 | #include "src/SparseQR/SparseQR.h" 34 | // IWYU pragma: end_exports 35 | 36 | #include "src/Core/util/ReenableStupidWarnings.h" 37 | 38 | #endif 39 | -------------------------------------------------------------------------------- /src/tinympc/codegen/codegen_src/include/Eigen/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 | // IWYU pragma: begin_exports 24 | #include "src/StlSupport/StdDeque.h" 25 | // IWYU pragma: end_exports 26 | 27 | #endif 28 | 29 | #endif // EIGEN_STDDEQUE_MODULE_H 30 | -------------------------------------------------------------------------------- /src/tinympc/codegen/codegen_src/include/Eigen/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 | // IWYU pragma: begin_exports 23 | #include "src/StlSupport/StdList.h" 24 | // IWYU pragma: end_exports 25 | 26 | #endif 27 | 28 | #endif // EIGEN_STDLIST_MODULE_H 29 | -------------------------------------------------------------------------------- /src/tinympc/codegen/codegen_src/include/Eigen/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 | // IWYU pragma: begin_exports 24 | #include "src/StlSupport/StdVector.h" 25 | // IWYU pragma: end_exports 26 | 27 | #endif 28 | 29 | #endif // EIGEN_STDVECTOR_MODULE_H 30 | -------------------------------------------------------------------------------- /src/tinympc/codegen/codegen_src/include/Eigen/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 | // IWYU pragma: begin_exports 61 | #include "src/SuperLUSupport/SuperLUSupport.h" 62 | // IWYU pragma: end_exports 63 | 64 | #include "src/Core/util/ReenableStupidWarnings.h" 65 | 66 | #endif // EIGEN_SUPERLUSUPPORT_MODULE_H 67 | -------------------------------------------------------------------------------- /src/tinympc/codegen/codegen_src/include/Eigen/Eigen/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_THREADPOOL_MODULE_H 11 | #define EIGEN_THREADPOOL_MODULE_H 12 | 13 | #include "Core" 14 | 15 | #include "src/Core/util/DisableStupidWarnings.h" 16 | 17 | /** \defgroup ThreadPool_Module ThreadPool Module 18 | * 19 | * This module provides 2 threadpool implementations 20 | * - a simple reference implementation 21 | * - a faster non blocking implementation 22 | * 23 | * \code 24 | * #include 25 | * \endcode 26 | */ 27 | 28 | #include 29 | #include 30 | #include 31 | 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | #include 39 | #include 40 | #include 41 | 42 | // There are non-parenthesized calls to "max" in the header, 43 | // which trigger a check in test/main.h causing compilation to fail. 44 | // We work around the check here by removing the check for max in 45 | // the case where we have to emulate thread_local. 46 | #ifdef max 47 | #undef max 48 | #endif 49 | #include 50 | 51 | #include "src/Core/util/Meta.h" 52 | #include "src/Core/util/MaxSizeVector.h" 53 | 54 | #ifndef EIGEN_MUTEX 55 | #define EIGEN_MUTEX std::mutex 56 | #endif 57 | #ifndef EIGEN_MUTEX_LOCK 58 | #define EIGEN_MUTEX_LOCK std::unique_lock 59 | #endif 60 | #ifndef EIGEN_CONDVAR 61 | #define EIGEN_CONDVAR std::condition_variable 62 | #endif 63 | 64 | // IWYU pragma: begin_exports 65 | #include "src/ThreadPool/ThreadLocal.h" 66 | #include "src/ThreadPool/ThreadYield.h" 67 | #include "src/ThreadPool/ThreadCancel.h" 68 | #include "src/ThreadPool/EventCount.h" 69 | #include "src/ThreadPool/RunQueue.h" 70 | #include "src/ThreadPool/ThreadPoolInterface.h" 71 | #include "src/ThreadPool/ThreadEnvironment.h" 72 | #include "src/ThreadPool/Barrier.h" 73 | #include "src/ThreadPool/NonBlockingThreadPool.h" 74 | // IWYU pragma: end_exports 75 | 76 | #include "src/Core/util/ReenableStupidWarnings.h" 77 | 78 | #endif // EIGEN_CXX11_THREADPOOL_MODULE_H 79 | -------------------------------------------------------------------------------- /src/tinympc/codegen/codegen_src/include/Eigen/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 | // IWYU pragma: begin_exports 37 | #include "src/UmfPackSupport/UmfPackSupport.h" 38 | // IWYU pragma: endexports 39 | 40 | #include "src/Core/util/ReenableStupidWarnings.h" 41 | 42 | #endif // EIGEN_UMFPACKSUPPORT_MODULE_H 43 | -------------------------------------------------------------------------------- /src/tinympc/codegen/codegen_src/include/Eigen/Eigen/src/AccelerateSupport/InternalHeaderCheck.h: -------------------------------------------------------------------------------- 1 | #ifndef EIGEN_ACCELERATESUPPORT_MODULE_H 2 | #error "Please include Eigen/AccelerateSupport instead of including headers inside the src directory directly." 3 | #endif 4 | -------------------------------------------------------------------------------- /src/tinympc/codegen/codegen_src/include/Eigen/Eigen/src/Cholesky/InternalHeaderCheck.h: -------------------------------------------------------------------------------- 1 | #ifndef EIGEN_CHOLESKY_MODULE_H 2 | #error "Please include Eigen/Cholesky instead of including headers inside the src directory directly." 3 | #endif 4 | -------------------------------------------------------------------------------- /src/tinympc/codegen/codegen_src/include/Eigen/Eigen/src/CholmodSupport/InternalHeaderCheck.h: -------------------------------------------------------------------------------- 1 | #ifndef EIGEN_CHOLMODSUPPORT_MODULE_H 2 | #error "Please include Eigen/CholmodSupport instead of including headers inside the src directory directly." 3 | #endif 4 | -------------------------------------------------------------------------------- /src/tinympc/codegen/codegen_src/include/Eigen/Eigen/src/Core/Assign.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2007 Michael Olbrich 5 | // Copyright (C) 2006-2010 Benoit Jacob 6 | // Copyright (C) 2008 Gael Guennebaud 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_ASSIGN_H 13 | #define EIGEN_ASSIGN_H 14 | 15 | #include "./InternalHeaderCheck.h" 16 | 17 | namespace Eigen { 18 | 19 | template 20 | template 21 | EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& DenseBase 22 | ::lazyAssign(const DenseBase& other) 23 | { 24 | enum{ 25 | SameType = internal::is_same::value 26 | }; 27 | 28 | EIGEN_STATIC_ASSERT_LVALUE(Derived) 29 | EIGEN_STATIC_ASSERT_SAME_MATRIX_SIZE(Derived,OtherDerived) 30 | EIGEN_STATIC_ASSERT(SameType,YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY) 31 | 32 | eigen_assert(rows() == other.rows() && cols() == other.cols()); 33 | internal::call_assignment_no_alias(derived(),other.derived()); 34 | 35 | return derived(); 36 | } 37 | 38 | template 39 | template 40 | EIGEN_DEVICE_FUNC 41 | EIGEN_STRONG_INLINE Derived& DenseBase::operator=(const DenseBase& other) 42 | { 43 | internal::call_assignment(derived(), other.derived()); 44 | return derived(); 45 | } 46 | 47 | template 48 | EIGEN_DEVICE_FUNC 49 | EIGEN_STRONG_INLINE Derived& DenseBase::operator=(const DenseBase& other) 50 | { 51 | internal::call_assignment(derived(), other.derived()); 52 | return derived(); 53 | } 54 | 55 | template 56 | EIGEN_DEVICE_FUNC 57 | EIGEN_STRONG_INLINE Derived& MatrixBase::operator=(const MatrixBase& other) 58 | { 59 | internal::call_assignment(derived(), other.derived()); 60 | return derived(); 61 | } 62 | 63 | template 64 | template 65 | EIGEN_DEVICE_FUNC 66 | EIGEN_STRONG_INLINE Derived& MatrixBase::operator=(const DenseBase& other) 67 | { 68 | internal::call_assignment(derived(), other.derived()); 69 | return derived(); 70 | } 71 | 72 | template 73 | template 74 | EIGEN_DEVICE_FUNC 75 | EIGEN_STRONG_INLINE Derived& MatrixBase::operator=(const EigenBase& other) 76 | { 77 | internal::call_assignment(derived(), other.derived()); 78 | return derived(); 79 | } 80 | 81 | template 82 | template 83 | EIGEN_DEVICE_FUNC 84 | EIGEN_STRONG_INLINE Derived& MatrixBase::operator=(const ReturnByValue& other) 85 | { 86 | other.derived().evalTo(derived()); 87 | return derived(); 88 | } 89 | 90 | } // end namespace Eigen 91 | 92 | #endif // EIGEN_ASSIGN_H 93 | -------------------------------------------------------------------------------- /src/tinympc/codegen/codegen_src/include/Eigen/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 | #include "./InternalHeaderCheck.h" 15 | 16 | namespace Eigen { 17 | 18 | /** \returns the diagonal matrix product of \c *this by the diagonal matrix \a diagonal. 19 | */ 20 | template 21 | template 22 | EIGEN_DEVICE_FUNC inline const Product 23 | MatrixBase::operator*(const DiagonalBase &a_diagonal) const 24 | { 25 | return Product(derived(),a_diagonal.derived()); 26 | } 27 | 28 | } // end namespace Eigen 29 | 30 | #endif // EIGEN_DIAGONALPRODUCT_H 31 | -------------------------------------------------------------------------------- /src/tinympc/codegen/codegen_src/include/Eigen/Eigen/src/Core/InternalHeaderCheck.h: -------------------------------------------------------------------------------- 1 | #ifndef EIGEN_CORE_MODULE_H 2 | #error "Please include Eigen/Core instead of including headers inside the src directory directly." 3 | #endif 4 | -------------------------------------------------------------------------------- /src/tinympc/codegen/codegen_src/include/Eigen/Eigen/src/Core/Inverse.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2014-2019 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_INVERSE_H 11 | #define EIGEN_INVERSE_H 12 | 13 | #include "./InternalHeaderCheck.h" 14 | 15 | namespace Eigen { 16 | 17 | template class InverseImpl; 18 | 19 | namespace internal { 20 | 21 | template 22 | struct traits > 23 | : traits 24 | { 25 | typedef typename XprType::PlainObject PlainObject; 26 | typedef traits BaseTraits; 27 | enum { 28 | Flags = BaseTraits::Flags & RowMajorBit 29 | }; 30 | }; 31 | 32 | } // end namespace internal 33 | 34 | /** \class Inverse 35 | * 36 | * \brief Expression of the inverse of another expression 37 | * 38 | * \tparam XprType the type of the expression we are taking the inverse 39 | * 40 | * This class represents an abstract expression of A.inverse() 41 | * and most of the time this is the only way it is used. 42 | * 43 | */ 44 | template 45 | class Inverse : public InverseImpl::StorageKind> 46 | { 47 | public: 48 | typedef typename XprType::StorageIndex StorageIndex; 49 | typedef typename XprType::Scalar Scalar; 50 | typedef typename internal::ref_selector::type XprTypeNested; 51 | typedef internal::remove_all_t XprTypeNestedCleaned; 52 | typedef typename internal::ref_selector::type Nested; 53 | typedef internal::remove_all_t NestedExpression; 54 | 55 | explicit EIGEN_DEVICE_FUNC Inverse(const XprType &xpr) 56 | : m_xpr(xpr) 57 | {} 58 | 59 | EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index rows() const EIGEN_NOEXCEPT { return m_xpr.cols(); } 60 | EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index cols() const EIGEN_NOEXCEPT { return m_xpr.rows(); } 61 | 62 | EIGEN_DEVICE_FUNC const XprTypeNestedCleaned& nestedExpression() const { return m_xpr; } 63 | 64 | protected: 65 | XprTypeNested m_xpr; 66 | }; 67 | 68 | // Generic API dispatcher 69 | template 70 | class InverseImpl 71 | : public internal::generic_xpr_base >::type 72 | { 73 | public: 74 | typedef typename internal::generic_xpr_base >::type Base; 75 | typedef typename XprType::Scalar Scalar; 76 | private: 77 | 78 | Scalar coeff(Index row, Index col) const; 79 | Scalar coeff(Index i) const; 80 | }; 81 | 82 | namespace internal { 83 | 84 | /** \internal 85 | * \brief Default evaluator for Inverse expression. 86 | * 87 | * This default evaluator for Inverse expression simply evaluate the inverse into a temporary 88 | * by a call to internal::call_assignment_no_alias. 89 | * Therefore, inverse implementers only have to specialize Assignment, ...> for 90 | * there own nested expression. 91 | * 92 | * \sa class Inverse 93 | */ 94 | template 95 | struct unary_evaluator > 96 | : public evaluator::PlainObject> 97 | { 98 | typedef Inverse InverseType; 99 | typedef typename InverseType::PlainObject PlainObject; 100 | typedef evaluator Base; 101 | 102 | enum { Flags = Base::Flags | EvalBeforeNestingBit }; 103 | 104 | unary_evaluator(const InverseType& inv_xpr) 105 | : m_result(inv_xpr.rows(), inv_xpr.cols()) 106 | { 107 | internal::construct_at(this, m_result); 108 | internal::call_assignment_no_alias(m_result, inv_xpr); 109 | } 110 | 111 | protected: 112 | PlainObject m_result; 113 | }; 114 | 115 | } // end namespace internal 116 | 117 | } // end namespace Eigen 118 | 119 | #endif // EIGEN_INVERSE_H 120 | -------------------------------------------------------------------------------- /src/tinympc/codegen/codegen_src/include/Eigen/Eigen/src/Core/NestByValue.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2008 Gael Guennebaud 5 | // Copyright (C) 2006-2008 Benoit Jacob 6 | // 7 | // This Source Code Form is subject to the terms of the Mozilla 8 | // Public License v. 2.0. If a copy of the MPL was not distributed 9 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 10 | 11 | #ifndef EIGEN_NESTBYVALUE_H 12 | #define EIGEN_NESTBYVALUE_H 13 | 14 | #include "./InternalHeaderCheck.h" 15 | 16 | namespace Eigen { 17 | 18 | namespace internal { 19 | template 20 | struct traits > : public traits 21 | { 22 | enum { 23 | Flags = traits::Flags & ~NestByRefBit 24 | }; 25 | }; 26 | } 27 | 28 | /** \class NestByValue 29 | * \ingroup Core_Module 30 | * 31 | * \brief Expression which must be nested by value 32 | * 33 | * \tparam ExpressionType the type of the object of which we are requiring nesting-by-value 34 | * 35 | * This class is the return type of MatrixBase::nestByValue() 36 | * and most of the time this is the only way it is used. 37 | * 38 | * \sa MatrixBase::nestByValue() 39 | */ 40 | template class NestByValue 41 | : public internal::dense_xpr_base< NestByValue >::type 42 | { 43 | public: 44 | 45 | typedef typename internal::dense_xpr_base::type Base; 46 | static constexpr bool HasDirectAccess = internal::has_direct_access::ret; 47 | 48 | EIGEN_DENSE_PUBLIC_INTERFACE(NestByValue) 49 | 50 | EIGEN_DEVICE_FUNC explicit inline NestByValue(const ExpressionType& matrix) : m_expression(matrix) {} 51 | 52 | EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR inline Index rows() const EIGEN_NOEXCEPT { return m_expression.rows(); } 53 | EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR inline Index cols() const EIGEN_NOEXCEPT { return m_expression.cols(); } 54 | 55 | EIGEN_DEVICE_FUNC operator const ExpressionType&() const { return m_expression; } 56 | 57 | EIGEN_DEVICE_FUNC const ExpressionType& nestedExpression() const { return m_expression; } 58 | 59 | EIGEN_DEVICE_FUNC typename std::enable_if::type data() const { 60 | return m_expression.data(); 61 | } 62 | 63 | EIGEN_DEVICE_FUNC typename std::enable_if::type innerStride() const { 64 | return m_expression.innerStride(); 65 | } 66 | 67 | EIGEN_DEVICE_FUNC typename std::enable_if::type outerStride() const { 68 | return m_expression.outerStride(); 69 | } 70 | 71 | protected: 72 | const ExpressionType m_expression; 73 | }; 74 | 75 | /** \returns an expression of the temporary version of *this. 76 | */ 77 | template 78 | EIGEN_DEVICE_FUNC inline const NestByValue 79 | DenseBase::nestByValue() const 80 | { 81 | return NestByValue(derived()); 82 | } 83 | 84 | namespace internal { 85 | 86 | // Evaluator of Solve -> eval into a temporary 87 | template 88 | struct evaluator > 89 | : public evaluator 90 | { 91 | typedef evaluator Base; 92 | 93 | EIGEN_DEVICE_FUNC explicit evaluator(const NestByValue& xpr) 94 | : Base(xpr.nestedExpression()) 95 | {} 96 | }; 97 | } 98 | 99 | } // end namespace Eigen 100 | 101 | #endif // EIGEN_NESTBYVALUE_H 102 | -------------------------------------------------------------------------------- /src/tinympc/codegen/codegen_src/include/Eigen/Eigen/src/Core/NoAlias.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2009 Gael Guennebaud 5 | // 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_NOALIAS_H 11 | #define EIGEN_NOALIAS_H 12 | 13 | #include "./InternalHeaderCheck.h" 14 | 15 | namespace Eigen { 16 | 17 | /** \class NoAlias 18 | * \ingroup Core_Module 19 | * 20 | * \brief Pseudo expression providing an operator = assuming no aliasing 21 | * 22 | * \tparam ExpressionType the type of the object on which to do the lazy assignment 23 | * 24 | * This class represents an expression with special assignment operators 25 | * assuming no aliasing between the target expression and the source expression. 26 | * More precisely it alloas to bypass the EvalBeforeAssignBit flag of the source expression. 27 | * It is the return type of MatrixBase::noalias() 28 | * and most of the time this is the only way it is used. 29 | * 30 | * \sa MatrixBase::noalias() 31 | */ 32 | template class StorageBase> 33 | class NoAlias 34 | { 35 | public: 36 | typedef typename ExpressionType::Scalar Scalar; 37 | 38 | EIGEN_DEVICE_FUNC 39 | explicit NoAlias(ExpressionType& expression) : m_expression(expression) {} 40 | 41 | template 42 | EIGEN_DEVICE_FUNC 43 | EIGEN_STRONG_INLINE ExpressionType& operator=(const StorageBase& other) 44 | { 45 | call_assignment_no_alias(m_expression, other.derived(), internal::assign_op()); 46 | return m_expression; 47 | } 48 | 49 | template 50 | EIGEN_DEVICE_FUNC 51 | EIGEN_STRONG_INLINE ExpressionType& operator+=(const StorageBase& other) 52 | { 53 | call_assignment_no_alias(m_expression, other.derived(), internal::add_assign_op()); 54 | return m_expression; 55 | } 56 | 57 | template 58 | EIGEN_DEVICE_FUNC 59 | EIGEN_STRONG_INLINE ExpressionType& operator-=(const StorageBase& other) 60 | { 61 | call_assignment_no_alias(m_expression, other.derived(), internal::sub_assign_op()); 62 | return m_expression; 63 | } 64 | 65 | EIGEN_DEVICE_FUNC 66 | ExpressionType& expression() const 67 | { 68 | return m_expression; 69 | } 70 | 71 | protected: 72 | ExpressionType& m_expression; 73 | }; 74 | 75 | /** \returns a pseudo expression of \c *this with an operator= assuming 76 | * no aliasing between \c *this and the source expression. 77 | * 78 | * More precisely, noalias() allows to bypass the EvalBeforeAssignBit flag. 79 | * Currently, even though several expressions may alias, only product 80 | * expressions have this flag. Therefore, noalias() is only useful when 81 | * the source expression contains a matrix product. 82 | * 83 | * Here are some examples where noalias is useful: 84 | * \code 85 | * D.noalias() = A * B; 86 | * D.noalias() += A.transpose() * B; 87 | * D.noalias() -= 2 * A * B.adjoint(); 88 | * \endcode 89 | * 90 | * On the other hand the following example will lead to a \b wrong result: 91 | * \code 92 | * A.noalias() = A * B; 93 | * \endcode 94 | * because the result matrix A is also an operand of the matrix product. Therefore, 95 | * there is no alternative than evaluating A * B in a temporary, that is the default 96 | * behavior when you write: 97 | * \code 98 | * A = A * B; 99 | * \endcode 100 | * 101 | * \sa class NoAlias 102 | */ 103 | template 104 | NoAlias EIGEN_DEVICE_FUNC MatrixBase::noalias() 105 | { 106 | return NoAlias(derived()); 107 | } 108 | 109 | } // end namespace Eigen 110 | 111 | #endif // EIGEN_NOALIAS_H 112 | -------------------------------------------------------------------------------- /src/tinympc/codegen/codegen_src/include/Eigen/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 | #include "./InternalHeaderCheck.h" 14 | 15 | namespace Eigen { 16 | 17 | // TODO generalize the scalar type of 'other' 18 | 19 | template 20 | EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& DenseBase::operator*=(const Scalar& other) 21 | { 22 | internal::call_assignment(this->derived(), PlainObject::Constant(rows(),cols(),other), internal::mul_assign_op()); 23 | return derived(); 24 | } 25 | 26 | template 27 | EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& ArrayBase::operator+=(const Scalar& other) 28 | { 29 | internal::call_assignment(this->derived(), PlainObject::Constant(rows(),cols(),other), internal::add_assign_op()); 30 | return derived(); 31 | } 32 | 33 | template 34 | EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& ArrayBase::operator-=(const Scalar& other) 35 | { 36 | internal::call_assignment(this->derived(), PlainObject::Constant(rows(),cols(),other), internal::sub_assign_op()); 37 | return derived(); 38 | } 39 | 40 | template 41 | EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& DenseBase::operator/=(const Scalar& other) 42 | { 43 | internal::call_assignment(this->derived(), PlainObject::Constant(rows(),cols(),other), internal::div_assign_op()); 44 | return derived(); 45 | } 46 | 47 | } // end namespace Eigen 48 | 49 | #endif // EIGEN_SELFCWISEBINARYOP_H 50 | -------------------------------------------------------------------------------- /src/tinympc/codegen/codegen_src/include/Eigen/Eigen/src/Core/Swap.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2006-2008 Benoit Jacob 5 | // 6 | // This Source Code Form is subject to the terms of the Mozilla 7 | // Public License v. 2.0. If a copy of the MPL was not distributed 8 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 9 | 10 | #ifndef EIGEN_SWAP_H 11 | #define EIGEN_SWAP_H 12 | 13 | #include "./InternalHeaderCheck.h" 14 | 15 | namespace Eigen { 16 | 17 | namespace internal { 18 | 19 | // Overload default assignPacket behavior for swapping them 20 | template 21 | class generic_dense_assignment_kernel, Specialized> 22 | : public generic_dense_assignment_kernel, BuiltIn> 23 | { 24 | protected: 25 | typedef generic_dense_assignment_kernel, BuiltIn> Base; 26 | using Base::m_dst; 27 | using Base::m_src; 28 | using Base::m_functor; 29 | 30 | public: 31 | typedef typename Base::Scalar Scalar; 32 | typedef typename Base::DstXprType DstXprType; 33 | typedef swap_assign_op Functor; 34 | 35 | EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE 36 | generic_dense_assignment_kernel(DstEvaluatorTypeT &dst, const SrcEvaluatorTypeT &src, const Functor &func, DstXprType& dstExpr) 37 | : Base(dst, src, func, dstExpr) 38 | {} 39 | 40 | template 41 | EIGEN_STRONG_INLINE void assignPacket(Index row, Index col) 42 | { 43 | PacketType tmp = m_src.template packet(row,col); 44 | const_cast(m_src).template writePacket(row,col, m_dst.template packet(row,col)); 45 | m_dst.template writePacket(row,col,tmp); 46 | } 47 | 48 | template 49 | EIGEN_STRONG_INLINE void assignPacket(Index index) 50 | { 51 | PacketType tmp = m_src.template packet(index); 52 | const_cast(m_src).template writePacket(index, m_dst.template packet(index)); 53 | m_dst.template writePacket(index,tmp); 54 | } 55 | 56 | // TODO find a simple way not to have to copy/paste this function from generic_dense_assignment_kernel, by simple I mean no CRTP (Gael) 57 | template 58 | EIGEN_STRONG_INLINE void assignPacketByOuterInner(Index outer, Index inner) 59 | { 60 | Index row = Base::rowIndexByOuterInner(outer, inner); 61 | Index col = Base::colIndexByOuterInner(outer, inner); 62 | assignPacket(row, col); 63 | } 64 | }; 65 | 66 | } // namespace internal 67 | 68 | } // end namespace Eigen 69 | 70 | #endif // EIGEN_SWAP_H 71 | -------------------------------------------------------------------------------- /src/tinympc/codegen/codegen_src/include/Eigen/Eigen/src/Core/VectorBlock.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 | #ifndef EIGEN_VECTORBLOCK_H 12 | #define EIGEN_VECTORBLOCK_H 13 | 14 | #include "./InternalHeaderCheck.h" 15 | 16 | namespace Eigen { 17 | 18 | namespace internal { 19 | template 20 | struct traits > 21 | : public traits::Flags & RowMajorBit ? 1 : Size, 23 | traits::Flags & RowMajorBit ? Size : 1> > 24 | { 25 | }; 26 | } 27 | 28 | /** \class VectorBlock 29 | * \ingroup Core_Module 30 | * 31 | * \brief Expression of a fixed-size or dynamic-size sub-vector 32 | * 33 | * \tparam VectorType the type of the object in which we are taking a sub-vector 34 | * \tparam Size size of the sub-vector we are taking at compile time (optional) 35 | * 36 | * This class represents an expression of either a fixed-size or dynamic-size sub-vector. 37 | * It is the return type of DenseBase::segment(Index,Index) and DenseBase::segment(Index) and 38 | * most of the time this is the only way it is used. 39 | * 40 | * However, if you want to directly manipulate sub-vector expressions, 41 | * for instance if you want to write a function returning such an expression, you 42 | * will need to use this class. 43 | * 44 | * Here is an example illustrating the dynamic case: 45 | * \include class_VectorBlock.cpp 46 | * Output: \verbinclude class_VectorBlock.out 47 | * 48 | * \note Even though this expression has dynamic size, in the case where \a VectorType 49 | * has fixed size, this expression inherits a fixed maximal size which means that evaluating 50 | * it does not cause a dynamic memory allocation. 51 | * 52 | * Here is an example illustrating the fixed-size case: 53 | * \include class_FixedVectorBlock.cpp 54 | * Output: \verbinclude class_FixedVectorBlock.out 55 | * 56 | * \sa class Block, DenseBase::segment(Index,Index,Index,Index), DenseBase::segment(Index,Index) 57 | */ 58 | template class VectorBlock 59 | : public Block::Flags & RowMajorBit ? 1 : Size, 61 | internal::traits::Flags & RowMajorBit ? Size : 1> 62 | { 63 | typedef Block::Flags & RowMajorBit ? 1 : Size, 65 | internal::traits::Flags & RowMajorBit ? Size : 1> Base; 66 | enum { 67 | IsColVector = !(internal::traits::Flags & RowMajorBit) 68 | }; 69 | public: 70 | EIGEN_DENSE_PUBLIC_INTERFACE(VectorBlock) 71 | EIGEN_STATIC_ASSERT_VECTOR_ONLY(VectorBlock) 72 | EIGEN_INHERIT_ASSIGNMENT_OPERATORS(VectorBlock) 73 | 74 | /** Dynamic-size constructor 75 | */ 76 | EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE 77 | VectorBlock(VectorType& vector, Index start, Index size) 78 | : Base(vector, 79 | IsColVector ? start : 0, IsColVector ? 0 : start, 80 | IsColVector ? size : 1, IsColVector ? 1 : size) 81 | { } 82 | 83 | /** Fixed-size constructor 84 | */ 85 | EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE 86 | VectorBlock(VectorType& vector, Index start) 87 | : Base(vector, IsColVector ? start : 0, IsColVector ? 0 : start) 88 | { } 89 | }; 90 | 91 | 92 | } // end namespace Eigen 93 | 94 | #endif // EIGEN_VECTORBLOCK_H 95 | -------------------------------------------------------------------------------- /src/tinympc/codegen/codegen_src/include/Eigen/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 "../../InternalHeaderCheck.h" 16 | 17 | namespace Eigen { 18 | 19 | namespace internal { 20 | 21 | EIGEN_INSTANTIATE_GENERIC_MATH_FUNCS_FLOAT(Packet4f) 22 | #ifdef EIGEN_VECTORIZE_VSX 23 | EIGEN_INSTANTIATE_GENERIC_MATH_FUNCS_DOUBLE(Packet2d) 24 | #endif 25 | 26 | #ifdef EIGEN_VECTORIZE_VSX 27 | template<> EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS 28 | Packet4f psqrt(const Packet4f& x) 29 | { 30 | return vec_sqrt(x); 31 | } 32 | 33 | template<> EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS 34 | Packet2d psqrt(const Packet2d& x) 35 | { 36 | return vec_sqrt(x); 37 | } 38 | 39 | #if !EIGEN_COMP_CLANG 40 | template<> EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS 41 | Packet4f prsqrt(const Packet4f& x) 42 | { 43 | return pset1(1.0f) / psqrt(x); 44 | // vec_rsqrt returns different results from the generic version 45 | // return vec_rsqrt(x); 46 | } 47 | 48 | template<> EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS 49 | Packet2d prsqrt(const Packet2d& x) 50 | { 51 | return pset1(1.0) / psqrt(x); 52 | // vec_rsqrt returns different results from the generic version 53 | // return vec_rsqrt(x); 54 | } 55 | 56 | #endif 57 | 58 | template<> EIGEN_STRONG_INLINE Packet8bf psqrt (const Packet8bf& a){ 59 | BF16_TO_F32_UNARY_OP_WRAPPER(psqrt, a); 60 | } 61 | 62 | #if !EIGEN_COMP_CLANG 63 | template<> EIGEN_STRONG_INLINE Packet8bf prsqrt (const Packet8bf& a){ 64 | BF16_TO_F32_UNARY_OP_WRAPPER(prsqrt, a); 65 | } 66 | #endif 67 | #else 68 | template<> EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS 69 | Packet4f psqrt(const Packet4f& x) 70 | { 71 | Packet4f a; 72 | for (Index i = 0; i < packet_traits::size; i++) { 73 | a[i] = numext::sqrt(x[i]); 74 | } 75 | return a; 76 | } 77 | #endif 78 | 79 | } // end namespace internal 80 | 81 | } // end namespace Eigen 82 | 83 | #endif // EIGEN_MATH_FUNCTIONS_ALTIVEC_H 84 | -------------------------------------------------------------------------------- /src/tinympc/codegen/codegen_src/include/Eigen/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 110 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 | -------------------------------------------------------------------------------- /src/tinympc/codegen/codegen_src/include/Eigen/Eigen/src/Core/arch/GPU/MathFunctions.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_MATH_FUNCTIONS_GPU_H 11 | #define EIGEN_MATH_FUNCTIONS_GPU_H 12 | 13 | #include "../../InternalHeaderCheck.h" 14 | 15 | namespace Eigen { 16 | 17 | namespace internal { 18 | 19 | // Make sure this is only available when targeting a GPU: we don't want to 20 | // introduce conflicts between these packet_traits definitions and the ones 21 | // we'll use on the host side (SSE, AVX, ...) 22 | #if defined(EIGEN_GPUCC) && defined(EIGEN_USE_GPU) 23 | template<> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE 24 | float4 plog(const float4& a) 25 | { 26 | return make_float4(logf(a.x), logf(a.y), logf(a.z), logf(a.w)); 27 | } 28 | 29 | template<> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE 30 | double2 plog(const double2& a) 31 | { 32 | using ::log; 33 | return make_double2(log(a.x), log(a.y)); 34 | } 35 | 36 | template<> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE 37 | float4 plog1p(const float4& a) 38 | { 39 | return make_float4(log1pf(a.x), log1pf(a.y), log1pf(a.z), log1pf(a.w)); 40 | } 41 | 42 | template<> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE 43 | double2 plog1p(const double2& a) 44 | { 45 | return make_double2(log1p(a.x), log1p(a.y)); 46 | } 47 | 48 | template<> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE 49 | float4 pexp(const float4& a) 50 | { 51 | return make_float4(expf(a.x), expf(a.y), expf(a.z), expf(a.w)); 52 | } 53 | 54 | template<> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE 55 | double2 pexp(const double2& a) 56 | { 57 | using ::exp; 58 | return make_double2(exp(a.x), exp(a.y)); 59 | } 60 | 61 | template<> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE 62 | float4 pexpm1(const float4& a) 63 | { 64 | return make_float4(expm1f(a.x), expm1f(a.y), expm1f(a.z), expm1f(a.w)); 65 | } 66 | 67 | template<> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE 68 | double2 pexpm1(const double2& a) 69 | { 70 | return make_double2(expm1(a.x), expm1(a.y)); 71 | } 72 | 73 | template<> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE 74 | float4 psqrt(const float4& a) 75 | { 76 | return make_float4(sqrtf(a.x), sqrtf(a.y), sqrtf(a.z), sqrtf(a.w)); 77 | } 78 | 79 | template<> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE 80 | double2 psqrt(const double2& a) 81 | { 82 | using ::sqrt; 83 | return make_double2(sqrt(a.x), sqrt(a.y)); 84 | } 85 | 86 | template<> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE 87 | float4 prsqrt(const float4& a) 88 | { 89 | return make_float4(rsqrtf(a.x), rsqrtf(a.y), rsqrtf(a.z), rsqrtf(a.w)); 90 | } 91 | 92 | template<> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE 93 | double2 prsqrt(const double2& a) 94 | { 95 | return make_double2(rsqrt(a.x), rsqrt(a.y)); 96 | } 97 | 98 | 99 | #endif 100 | 101 | } // end namespace internal 102 | 103 | } // end namespace Eigen 104 | 105 | #endif // EIGEN_MATH_FUNCTIONS_GPU_H 106 | -------------------------------------------------------------------------------- /src/tinympc/codegen/codegen_src/include/Eigen/Eigen/src/Core/arch/GPU/TypeCasting.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_TYPE_CASTING_GPU_H 11 | #define EIGEN_TYPE_CASTING_GPU_H 12 | 13 | #include "../../InternalHeaderCheck.h" 14 | 15 | namespace Eigen { 16 | 17 | namespace internal { 18 | 19 | #if (defined(EIGEN_HAS_CUDA_FP16) && defined(EIGEN_CUDA_ARCH) && EIGEN_CUDA_ARCH >= 300) || \ 20 | (defined(EIGEN_HAS_HIP_FP16) && defined(EIGEN_HIP_DEVICE_COMPILE)) 21 | 22 | template <> 23 | struct type_casting_traits { 24 | enum { 25 | VectorizedCast = 1, 26 | SrcCoeffRatio = 1, 27 | TgtCoeffRatio = 2 28 | }; 29 | }; 30 | 31 | template<> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE float4 pcast(const half2& a, const half2& b) { 32 | float2 r1 = __half22float2(a); 33 | float2 r2 = __half22float2(b); 34 | return make_float4(r1.x, r1.y, r2.x, r2.y); 35 | } 36 | 37 | 38 | template<> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Packet4h2 pcast(const float4& a, const float4& b) { 39 | Packet4h2 r; 40 | half2* r_alias=reinterpret_cast(&r); 41 | r_alias[0]=__floats2half2_rn(a.x,a.y); 42 | r_alias[1]=__floats2half2_rn(a.z,a.w); 43 | r_alias[2]=__floats2half2_rn(b.x,b.y); 44 | r_alias[3]=__floats2half2_rn(b.z,b.w); 45 | return r; 46 | } 47 | 48 | template <> 49 | struct type_casting_traits { 50 | enum { 51 | VectorizedCast = 1, 52 | SrcCoeffRatio = 2, 53 | TgtCoeffRatio = 1 54 | }; 55 | }; 56 | 57 | template<> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE float4 pcast(const Packet4h2& a) { 58 | // Simply discard the second half of the input 59 | float4 r; 60 | const half2* a_alias=reinterpret_cast(&a); 61 | float2 r1 = __half22float2(a_alias[0]); 62 | float2 r2 = __half22float2(a_alias[1]); 63 | r.x=static_cast(r1.x); 64 | r.y=static_cast(r1.y); 65 | r.z=static_cast(r2.x); 66 | r.w=static_cast(r2.y); 67 | return r; 68 | } 69 | 70 | template<> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE half2 pcast(const float4& a) { 71 | // Simply discard the second half of the input 72 | return __floats2half2_rn(a.x, a.y); 73 | } 74 | 75 | #endif 76 | 77 | } // end namespace internal 78 | 79 | } // end namespace Eigen 80 | 81 | #endif // EIGEN_TYPE_CASTING_GPU_H 82 | -------------------------------------------------------------------------------- /src/tinympc/codegen/codegen_src/include/Eigen/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 | -------------------------------------------------------------------------------- /src/tinympc/codegen/codegen_src/include/Eigen/Eigen/src/Core/arch/HVX/GeneralBlockPanelKernel.h: -------------------------------------------------------------------------------- 1 | #ifndef EIGEN_HVX_GENERAL_BLOCK_KERNEL_H 2 | #define EIGEN_HVX_GENERAL_BLOCK_KERNEL_H 3 | 4 | // Only support 128B HVX now. 5 | // Floating-point operations are only supported since V68. 6 | #if defined __HVX__ && (__HVX_LENGTH__ == 128) && __HVX_ARCH__ >= 68 7 | 8 | namespace Eigen { 9 | namespace internal { 10 | 11 | template 12 | class gebp_traits 14 | : public gebp_traits { 16 | public: 17 | typedef Packet32qf AccPacket; 18 | 19 | EIGEN_STRONG_INLINE void initAcc(Packet32qf& p) { p = pzero(p); } 20 | 21 | template 22 | EIGEN_STRONG_INLINE void madd(const Packet32f& a, const Packet32f& b, 23 | Packet32qf& c, Packet32f& /*tmp*/, 24 | const LaneIdType&) const { 25 | c = pmadd_f32_to_qf32(a, b, c); 26 | } 27 | 28 | template 29 | EIGEN_STRONG_INLINE void madd(const Packet32f& a, 30 | const QuadPacket& b, Packet32qf& c, 31 | Packet32f& tmp, const LaneIdType& lane) const { 32 | madd(a, b.get(lane), c, tmp, lane); 33 | } 34 | 35 | EIGEN_STRONG_INLINE void acc(const Packet32qf& c, const Packet32f& alpha, 36 | Packet32f& r) const { 37 | r = pmadd_qf32_to_f32(c, alpha, r); 38 | } 39 | }; 40 | 41 | } // end namespace internal 42 | } // end namespace Eigen 43 | 44 | #endif // __HVX__ && (__HVX_LENGTH__ == 128) && __HVX_ARCH__ >= 68 45 | 46 | #endif // EIGEN_HVX_GENERAL_BLOCK_KERNEL_H 47 | -------------------------------------------------------------------------------- /src/tinympc/codegen/codegen_src/include/Eigen/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 "../../InternalHeaderCheck.h" 12 | 13 | namespace Eigen { 14 | 15 | namespace internal { 16 | 17 | EIGEN_INSTANTIATE_GENERIC_MATH_FUNCS_FLOAT(Packet2f) 18 | EIGEN_INSTANTIATE_GENERIC_MATH_FUNCS_FLOAT(Packet4f) 19 | 20 | #if EIGEN_HAS_ARM64_FP16_VECTOR_ARITHMETIC 21 | template <> 22 | EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC 23 | Packet4hf ptanh(const Packet4hf& x) { 24 | // Convert to float, call the float ptanh, and then convert back. 25 | return vcvt_f16_f32(ptanh(vcvt_f32_f16(x))); 26 | } 27 | 28 | template <> 29 | EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC 30 | Packet8hf ptanh(const Packet8hf& x) { 31 | // Convert each 4 halfs to float, call the float ptanh, and then convert back. 32 | return vcombine_f16( 33 | vcvt_f16_f32(ptanh(vcvt_f32_f16(vget_low_f16(x)))), 34 | vcvt_f16_f32(ptanh(vcvt_high_f32_f16(x)))); 35 | } 36 | #endif // EIGEN_HAS_ARM64_FP16_VECTOR_ARITHMETIC 37 | 38 | BF16_PACKET_FUNCTION(Packet4f, Packet4bf, psin) 39 | BF16_PACKET_FUNCTION(Packet4f, Packet4bf, pcos) 40 | BF16_PACKET_FUNCTION(Packet4f, Packet4bf, plog) 41 | BF16_PACKET_FUNCTION(Packet4f, Packet4bf, pexp) 42 | BF16_PACKET_FUNCTION(Packet4f, Packet4bf, ptanh) 43 | 44 | template <> 45 | EIGEN_STRONG_INLINE Packet4bf pfrexp(const Packet4bf& a, Packet4bf& exponent) { 46 | Packet4f fexponent; 47 | const Packet4bf out = F32ToBf16(pfrexp(Bf16ToF32(a), fexponent)); 48 | exponent = F32ToBf16(fexponent); 49 | return out; 50 | } 51 | 52 | template <> 53 | EIGEN_STRONG_INLINE Packet4bf pldexp(const Packet4bf& a, const Packet4bf& exponent) { 54 | return F32ToBf16(pldexp(Bf16ToF32(a), Bf16ToF32(exponent))); 55 | } 56 | 57 | //---------- double ---------- 58 | 59 | #if EIGEN_ARCH_ARM64 && !EIGEN_APPLE_DOUBLE_NEON_BUG 60 | 61 | EIGEN_INSTANTIATE_GENERIC_MATH_FUNCS_DOUBLE(Packet2d) 62 | 63 | #endif 64 | 65 | } // end namespace internal 66 | 67 | } // end namespace Eigen 68 | 69 | #endif // EIGEN_MATH_FUNCTIONS_NEON_H 70 | -------------------------------------------------------------------------------- /src/tinympc/codegen/codegen_src/include/Eigen/Eigen/src/Core/arch/NEON/UnaryFunctors.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_NEON_UNARY_FUNCTORS_H 9 | #define EIGEN_NEON_UNARY_FUNCTORS_H 10 | 11 | #include "../../InternalHeaderCheck.h" 12 | 13 | namespace Eigen { 14 | 15 | namespace internal { 16 | 17 | #if EIGEN_HAS_ARM64_FP16_VECTOR_ARITHMETIC 18 | /** \internal 19 | * \brief Template specialization of the logistic function for Eigen::half. 20 | */ 21 | template <> 22 | struct scalar_logistic_op { 23 | EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE 24 | Eigen::half operator()(const Eigen::half& x) const { 25 | // Convert to float and call scalar_logistic_op. 26 | const scalar_logistic_op float_op; 27 | return Eigen::half(float_op(float(x))); 28 | } 29 | 30 | EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE 31 | Eigen::half packetOp(const Eigen::half& x) const { 32 | return this->operator()(x); 33 | } 34 | 35 | EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE 36 | Packet4hf packetOp(const Packet4hf& x) const { 37 | const scalar_logistic_op float_op; 38 | return vcvt_f16_f32(float_op.packetOp(vcvt_f32_f16(x))); 39 | } 40 | 41 | EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE 42 | Packet8hf packetOp(const Packet8hf& x) const { 43 | const scalar_logistic_op float_op; 44 | return vcombine_f16( 45 | vcvt_f16_f32(float_op.packetOp(vcvt_f32_f16(vget_low_f16(x)))), 46 | vcvt_f16_f32(float_op.packetOp(vcvt_high_f32_f16(x)))); 47 | } 48 | }; 49 | 50 | template<> 51 | struct functor_traits> { 52 | enum { 53 | Cost = functor_traits>::Cost, 54 | PacketAccess = functor_traits>::PacketAccess, 55 | }; 56 | }; 57 | #endif // EIGEN_HAS_ARM64_FP16_VECTOR_ARITHMETIC 58 | 59 | } // end namespace internal 60 | 61 | } // end namespace Eigen 62 | 63 | #endif // EIGEN_NEON_UNARY_FUNCTORS_H 64 | -------------------------------------------------------------------------------- /src/tinympc/codegen/codegen_src/include/Eigen/Eigen/src/Core/arch/SSE/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 | // 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 | /* The sin and cos and functions of this file come from 12 | * Julien Pommier's sse math library: http://gruntthepeon.free.fr/ssemath/ 13 | */ 14 | 15 | #ifndef EIGEN_MATH_FUNCTIONS_SSE_H 16 | #define EIGEN_MATH_FUNCTIONS_SSE_H 17 | 18 | #include "../../InternalHeaderCheck.h" 19 | 20 | namespace Eigen { 21 | 22 | namespace internal { 23 | 24 | EIGEN_INSTANTIATE_GENERIC_MATH_FUNCS_FLOAT(Packet4f) 25 | EIGEN_INSTANTIATE_GENERIC_MATH_FUNCS_DOUBLE(Packet2d) 26 | 27 | // Notice that for newer processors, it is counterproductive to use Newton 28 | // iteration for square root. In particular, Skylake and Zen2 processors 29 | // have approximately doubled throughput of the _mm_sqrt_ps instruction 30 | // compared to their predecessors. 31 | template<>EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS 32 | Packet4f psqrt(const Packet4f& x) { return _mm_sqrt_ps(x); } 33 | template<> EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS 34 | Packet2d psqrt(const Packet2d& x) { return _mm_sqrt_pd(x); } 35 | template<> EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS 36 | Packet16b psqrt(const Packet16b& x) { return x; } 37 | 38 | #if EIGEN_FAST_MATH 39 | // Even on Skylake, using Newton iteration is a win for reciprocal square root. 40 | template<> EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS EIGEN_UNUSED 41 | Packet4f prsqrt(const Packet4f& x) { 42 | return generic_rsqrt_newton_step::run(x, _mm_rsqrt_ps(x)); 43 | } 44 | 45 | #ifdef EIGEN_VECTORIZE_FMA 46 | // Trying to speed up reciprocal using Newton-Raphson is counterproductive 47 | // unless FMA is available. Without FMA pdiv(pset1(Scalar(1),a)) is 48 | // 30% faster. 49 | template<> EIGEN_STRONG_INLINE Packet4f preciprocal(const Packet4f& x) { 50 | return generic_reciprocal_newton_step::run(x, _mm_rcp_ps(x)); 51 | } 52 | #endif 53 | 54 | #endif 55 | 56 | } // end namespace internal 57 | 58 | namespace numext { 59 | 60 | template<> 61 | EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE 62 | float sqrt(const float &x) 63 | { 64 | return internal::pfirst(internal::Packet4f(_mm_sqrt_ss(_mm_set_ss(x)))); 65 | } 66 | 67 | template<> 68 | EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE 69 | double sqrt(const double &x) 70 | { 71 | #if EIGEN_COMP_GNUC_STRICT 72 | // This works around a GCC bug generating poor code for _mm_sqrt_pd 73 | // See https://gitlab.com/libeigen/eigen/commit/8dca9f97e38970 74 | return internal::pfirst(internal::Packet2d(__builtin_ia32_sqrtsd(_mm_set_sd(x)))); 75 | #else 76 | return internal::pfirst(internal::Packet2d(_mm_sqrt_pd(_mm_set_sd(x)))); 77 | #endif 78 | } 79 | 80 | } // end namespace numex 81 | 82 | } // end namespace Eigen 83 | 84 | #endif // EIGEN_MATH_FUNCTIONS_SSE_H 85 | -------------------------------------------------------------------------------- /src/tinympc/codegen/codegen_src/include/Eigen/Eigen/src/Core/arch/SVE/MathFunctions.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2020, Arm Limited and Contributors 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_MATH_FUNCTIONS_SVE_H 11 | #define EIGEN_MATH_FUNCTIONS_SVE_H 12 | 13 | #include "../../InternalHeaderCheck.h" 14 | 15 | namespace Eigen { 16 | namespace internal { 17 | 18 | template <> 19 | EIGEN_STRONG_INLINE PacketXf pexp(const PacketXf& x) { 20 | return pexp_float(x); 21 | } 22 | 23 | template <> 24 | EIGEN_STRONG_INLINE PacketXf plog(const PacketXf& x) { 25 | return plog_float(x); 26 | } 27 | 28 | template <> 29 | EIGEN_STRONG_INLINE PacketXf psin(const PacketXf& x) { 30 | return psin_float(x); 31 | } 32 | 33 | template <> 34 | EIGEN_STRONG_INLINE PacketXf pcos(const PacketXf& x) { 35 | return pcos_float(x); 36 | } 37 | 38 | // Hyperbolic Tangent function. 39 | template <> 40 | EIGEN_STRONG_INLINE PacketXf ptanh(const PacketXf& x) { 41 | return internal::generic_fast_tanh_float(x); 42 | } 43 | } // end namespace internal 44 | } // end namespace Eigen 45 | 46 | #endif // EIGEN_MATH_FUNCTIONS_SVE_H 47 | -------------------------------------------------------------------------------- /src/tinympc/codegen/codegen_src/include/Eigen/Eigen/src/Core/arch/SVE/TypeCasting.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2020, Arm Limited and Contributors 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_SVE_H 11 | #define EIGEN_TYPE_CASTING_SVE_H 12 | 13 | #include "../../InternalHeaderCheck.h" 14 | 15 | namespace Eigen { 16 | namespace internal { 17 | 18 | template <> 19 | struct type_casting_traits { 20 | enum { VectorizedCast = 1, SrcCoeffRatio = 1, TgtCoeffRatio = 1 }; 21 | }; 22 | 23 | template <> 24 | struct type_casting_traits { 25 | enum { VectorizedCast = 1, SrcCoeffRatio = 1, TgtCoeffRatio = 1 }; 26 | }; 27 | 28 | template <> 29 | EIGEN_STRONG_INLINE PacketXf pcast(const PacketXi& a) { 30 | return svcvt_f32_s32_z(svptrue_b32(), a); 31 | } 32 | 33 | template <> 34 | EIGEN_STRONG_INLINE PacketXi pcast(const PacketXf& a) { 35 | return svcvt_s32_f32_z(svptrue_b32(), a); 36 | } 37 | 38 | template <> 39 | EIGEN_STRONG_INLINE PacketXf preinterpret(const PacketXi& a) { 40 | return svreinterpret_f32_s32(a); 41 | } 42 | 43 | template <> 44 | EIGEN_STRONG_INLINE PacketXi preinterpret(const PacketXf& a) { 45 | return svreinterpret_s32_f32(a); 46 | } 47 | 48 | } // namespace internal 49 | } // namespace Eigen 50 | 51 | #endif // EIGEN_TYPE_CASTING_SVE_H 52 | -------------------------------------------------------------------------------- /src/tinympc/codegen/codegen_src/include/Eigen/Eigen/src/Core/arch/SYCL/TypeCasting.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Mehdi Goli Codeplay Software Ltd. 5 | // Ralph Potter Codeplay Software Ltd. 6 | // Luke Iwanski Codeplay Software Ltd. 7 | // Contact: 8 | // 9 | // This Source Code Form is subject to the terms of the Mozilla 10 | // Public License v. 2.0. If a copy of the MPL was not distributed 11 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 12 | 13 | /***************************************************************** 14 | * TypeCasting.h 15 | * 16 | * \brief: 17 | * TypeCasting 18 | * 19 | *****************************************************************/ 20 | 21 | #ifndef EIGEN_TYPE_CASTING_SYCL_H 22 | #define EIGEN_TYPE_CASTING_SYCL_H 23 | 24 | #include "../../InternalHeaderCheck.h" 25 | 26 | namespace Eigen { 27 | 28 | namespace internal { 29 | #ifdef SYCL_DEVICE_ONLY 30 | template <> 31 | struct type_casting_traits { 32 | enum { VectorizedCast = 1, SrcCoeffRatio = 1, TgtCoeffRatio = 1 }; 33 | }; 34 | 35 | template <> 36 | EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE cl::sycl::cl_int4 37 | pcast(const cl::sycl::cl_float4& a) { 38 | return a 39 | .template convert(); 40 | } 41 | 42 | template <> 43 | struct type_casting_traits { 44 | enum { VectorizedCast = 1, SrcCoeffRatio = 1, TgtCoeffRatio = 1 }; 45 | }; 46 | 47 | template <> 48 | EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE cl::sycl::cl_float4 49 | pcast(const cl::sycl::cl_int4& a) { 50 | return a.template convert(); 52 | } 53 | 54 | template <> 55 | struct type_casting_traits { 56 | enum { VectorizedCast = 1, SrcCoeffRatio = 2, TgtCoeffRatio = 1 }; 57 | }; 58 | 59 | template <> 60 | EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE cl::sycl::cl_float4 61 | pcast( 62 | const cl::sycl::cl_double2& a, const cl::sycl::cl_double2& b) { 63 | auto a1 = a.template convert(); 65 | auto b1 = b.template convert(); 67 | return cl::sycl::cl_float4(a1.x(), a1.y(), b1.x(), b1.y()); 68 | } 69 | 70 | template <> 71 | struct type_casting_traits { 72 | enum { VectorizedCast = 1, SrcCoeffRatio = 1, TgtCoeffRatio = 2 }; 73 | }; 74 | 75 | template <> 76 | EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE cl::sycl::cl_double2 77 | pcast(const cl::sycl::cl_float4& a) { 78 | // Simply discard the second half of the input 79 | return cl::sycl::cl_double2(a.x(), a.y()); 80 | } 81 | 82 | #endif 83 | } // end namespace internal 84 | 85 | } // end namespace Eigen 86 | 87 | #endif // EIGEN_TYPE_CASTING_SYCL_H 88 | -------------------------------------------------------------------------------- /src/tinympc/codegen/codegen_src/include/Eigen/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 | #include "../InternalHeaderCheck.h" 14 | 15 | namespace Eigen { 16 | 17 | namespace internal { 18 | 19 | //---------- associative ternary functors ---------- 20 | 21 | template 22 | struct scalar_boolean_select_op { 23 | static constexpr bool ThenElseAreSame = is_same::value; 24 | EIGEN_STATIC_ASSERT(ThenElseAreSame, THEN AND ELSE MUST BE SAME TYPE) 25 | using Scalar = ThenScalar; 26 | using result_type = Scalar; 27 | EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar operator()(const ThenScalar& a, const ElseScalar& b, const ConditionScalar& cond) const { 28 | return cond == ConditionScalar(0) ? b : a; 29 | } 30 | template 31 | EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Packet packetOp(const Packet& a, const Packet& b, const Packet& cond) const { 32 | return pselect(pcmp_eq(cond, pzero(cond)), b, a); 33 | } 34 | }; 35 | 36 | template 37 | struct functor_traits> { 38 | using Scalar = ThenScalar; 39 | enum { 40 | Cost = 1, 41 | PacketAccess = is_same::value && is_same::value && packet_traits::HasCmp 42 | }; 43 | }; 44 | 45 | } // end namespace internal 46 | 47 | } // end namespace Eigen 48 | 49 | #endif // EIGEN_TERNARY_FUNCTORS_H 50 | -------------------------------------------------------------------------------- /src/tinympc/codegen/codegen_src/include/Eigen/Eigen/src/Core/util/ReenableStupidWarnings.h: -------------------------------------------------------------------------------- 1 | #ifdef EIGEN_WARNINGS_DISABLED_2 2 | // "DisableStupidWarnings.h" was included twice recursively: Do not re-enable 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__ && !defined(__FUJITSU) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) 16 | #pragma GCC diagnostic pop 17 | #endif 18 | 19 | #if defined __NVCC__ 20 | // Don't re-enable 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 | // #define EIGEN_MAKE_PRAGMA(X) _Pragma(#X) 24 | // #if __NVCC_DIAG_PRAGMA_SUPPORT__ 25 | // #define EIGEN_NV_DIAG_DEFAULT(X) EIGEN_MAKE_PRAGMA(nv_diag_default X) 26 | // #else 27 | // #define EIGEN_NV_DIAG_DEFAULT(X) EIGEN_MAKE_PRAGMA(diag_default X) 28 | // #endif 29 | // EIGEN_NV_DIAG_DEFAULT(code_is_unreachable) 30 | // EIGEN_NV_DIAG_DEFAULT(initialization_not_reachable) 31 | // EIGEN_NV_DIAG_DEFAULT(2651) 32 | // EIGEN_NV_DIAG_DEFAULT(2653) 33 | // #undef EIGEN_NV_DIAG_DEFAULT 34 | // #undef EIGEN_MAKE_PRAGMA 35 | #endif 36 | 37 | #endif 38 | 39 | #endif // EIGEN_WARNINGS_DISABLED 40 | -------------------------------------------------------------------------------- /src/tinympc/codegen/codegen_src/include/Eigen/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 | #include "../InternalHeaderCheck.h" 15 | 16 | namespace Eigen { 17 | 18 | enum AutoSize_t { AutoSize }; 19 | const int AutoOrder = 2; 20 | 21 | namespace internal { 22 | 23 | template 24 | struct get_compiletime_reshape_size { 25 | enum { value = get_fixed_value::value }; 26 | }; 27 | 28 | template 29 | Index get_runtime_reshape_size(SizeType size, Index /*other*/, Index /*total*/) { 30 | return internal::get_runtime_value(size); 31 | } 32 | 33 | template 34 | struct get_compiletime_reshape_size { 35 | enum { 36 | other_size = get_fixed_value::value, 37 | value = (TotalSize==Dynamic || other_size==Dynamic) ? Dynamic : TotalSize / other_size }; 38 | }; 39 | 40 | inline Index get_runtime_reshape_size(AutoSize_t /*size*/, Index other, Index total) { 41 | return total/other; 42 | } 43 | 44 | constexpr inline int get_compiletime_reshape_order(int flags, int order) { 45 | return order == AutoOrder ? flags & RowMajorBit : order; 46 | } 47 | 48 | } 49 | 50 | } // end namespace Eigen 51 | 52 | #endif // EIGEN_RESHAPED_HELPER_H 53 | -------------------------------------------------------------------------------- /src/tinympc/codegen/codegen_src/include/Eigen/Eigen/src/Eigenvalues/InternalHeaderCheck.h: -------------------------------------------------------------------------------- 1 | #ifndef EIGEN_EIGENVALUES_MODULE_H 2 | #error "Please include Eigen/Eigenvalues instead of including headers inside the src directory directly." 3 | #endif 4 | -------------------------------------------------------------------------------- /src/tinympc/codegen/codegen_src/include/Eigen/Eigen/src/Eigenvalues/RealSchur_LAPACKE.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2011, Intel Corporation. All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without modification, 5 | are permitted provided that the following conditions are met: 6 | 7 | * Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright notice, 10 | this list of conditions and the following disclaimer in the documentation 11 | and/or other materials provided with the distribution. 12 | * Neither the name of Intel Corporation nor the names of its contributors may 13 | be used to endorse or promote products derived from this software without 14 | specific prior written permission. 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 17 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 20 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 23 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | 27 | ******************************************************************************** 28 | * Content : Eigen bindings to LAPACKe 29 | * Real Schur needed to real unsymmetrical eigenvalues/eigenvectors. 30 | ******************************************************************************** 31 | */ 32 | 33 | #ifndef EIGEN_REAL_SCHUR_LAPACKE_H 34 | #define EIGEN_REAL_SCHUR_LAPACKE_H 35 | 36 | #include "./InternalHeaderCheck.h" 37 | 38 | namespace Eigen { 39 | 40 | /** \internal Specialization for the data types supported by LAPACKe */ 41 | 42 | #define EIGEN_LAPACKE_SCHUR_REAL(EIGTYPE, LAPACKE_TYPE, LAPACKE_PREFIX, LAPACKE_PREFIX_U, EIGCOLROW, LAPACKE_COLROW) \ 43 | template<> template inline \ 44 | RealSchur >& \ 45 | RealSchur >::compute(const EigenBase& matrix, bool computeU) \ 46 | { \ 47 | eigen_assert(matrix.cols() == matrix.rows()); \ 48 | \ 49 | lapack_int n = internal::convert_index(matrix.cols()), sdim, info; \ 50 | lapack_int matrix_order = LAPACKE_COLROW; \ 51 | char jobvs, sort='N'; \ 52 | LAPACK_##LAPACKE_PREFIX_U##_SELECT2 select = 0; \ 53 | jobvs = (computeU) ? 'V' : 'N'; \ 54 | m_matU.resize(n, n); \ 55 | lapack_int ldvs = internal::convert_index(m_matU.outerStride()); \ 56 | m_matT = matrix; \ 57 | lapack_int lda = internal::convert_index(m_matT.outerStride()); \ 58 | Matrix wr, wi; \ 59 | wr.resize(n, 1); wi.resize(n, 1); \ 60 | info = LAPACKE_##LAPACKE_PREFIX##gees( matrix_order, jobvs, sort, select, n, (LAPACKE_TYPE*)m_matT.data(), lda, &sdim, (LAPACKE_TYPE*)wr.data(), (LAPACKE_TYPE*)wi.data(), (LAPACKE_TYPE*)m_matU.data(), ldvs ); \ 61 | if(info == 0) \ 62 | m_info = Success; \ 63 | else \ 64 | m_info = NoConvergence; \ 65 | \ 66 | m_isInitialized = true; \ 67 | m_matUisUptodate = computeU; \ 68 | return *this; \ 69 | \ 70 | } 71 | 72 | EIGEN_LAPACKE_SCHUR_REAL(double, double, d, D, ColMajor, LAPACK_COL_MAJOR) 73 | EIGEN_LAPACKE_SCHUR_REAL(float, float, s, S, ColMajor, LAPACK_COL_MAJOR) 74 | EIGEN_LAPACKE_SCHUR_REAL(double, double, d, D, RowMajor, LAPACK_ROW_MAJOR) 75 | EIGEN_LAPACKE_SCHUR_REAL(float, float, s, S, RowMajor, LAPACK_ROW_MAJOR) 76 | 77 | } // end namespace Eigen 78 | 79 | #endif // EIGEN_REAL_SCHUR_LAPACKE_H 80 | -------------------------------------------------------------------------------- /src/tinympc/codegen/codegen_src/include/Eigen/Eigen/src/Geometry/InternalHeaderCheck.h: -------------------------------------------------------------------------------- 1 | #ifndef EIGEN_GEOMETRY_MODULE_H 2 | #error "Please include Eigen/Geometry instead of including headers inside the src directory directly." 3 | #endif 4 | -------------------------------------------------------------------------------- /src/tinympc/codegen/codegen_src/include/Eigen/Eigen/src/Householder/InternalHeaderCheck.h: -------------------------------------------------------------------------------- 1 | #ifndef EIGEN_HOUSEHOLDER_MODULE_H 2 | #error "Please include Eigen/Householder instead of including headers inside the src directory directly." 3 | #endif 4 | -------------------------------------------------------------------------------- /src/tinympc/codegen/codegen_src/include/Eigen/Eigen/src/IterativeLinearSolvers/InternalHeaderCheck.h: -------------------------------------------------------------------------------- 1 | #ifndef EIGEN_ITERATIVELINEARSOLVERS_MODULE_H 2 | #error "Please include Eigen/IterativeLinearSolvers instead of including headers inside the src directory directly." 3 | #endif 4 | -------------------------------------------------------------------------------- /src/tinympc/codegen/codegen_src/include/Eigen/Eigen/src/Jacobi/InternalHeaderCheck.h: -------------------------------------------------------------------------------- 1 | #ifndef EIGEN_JACOBI_MODULE_H 2 | #error "Please include Eigen/Jacobi instead of including headers inside the src directory directly." 3 | #endif 4 | -------------------------------------------------------------------------------- /src/tinympc/codegen/codegen_src/include/Eigen/Eigen/src/KLUSupport/InternalHeaderCheck.h: -------------------------------------------------------------------------------- 1 | #ifndef EIGEN_KLUSUPPORT_MODULE_H 2 | #error "Please include Eigen/KLUSupport instead of including headers inside the src directory directly." 3 | #endif 4 | -------------------------------------------------------------------------------- /src/tinympc/codegen/codegen_src/include/Eigen/Eigen/src/LU/Determinant.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2008 Benoit Jacob 5 | // 6 | // This Source Code Form is subject to the terms of the Mozilla 7 | // Public License v. 2.0. If a copy of the MPL was not distributed 8 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 9 | 10 | #ifndef EIGEN_DETERMINANT_H 11 | #define EIGEN_DETERMINANT_H 12 | 13 | #include "./InternalHeaderCheck.h" 14 | 15 | namespace Eigen { 16 | 17 | namespace internal { 18 | 19 | template 20 | EIGEN_DEVICE_FUNC 21 | inline const typename Derived::Scalar bruteforce_det3_helper 22 | (const MatrixBase& matrix, int a, int b, int c) 23 | { 24 | return matrix.coeff(0,a) 25 | * (matrix.coeff(1,b) * matrix.coeff(2,c) - matrix.coeff(1,c) * matrix.coeff(2,b)); 26 | } 27 | 28 | template struct determinant_impl 31 | { 32 | static inline typename traits::Scalar run(const Derived& m) 33 | { 34 | if(Derived::ColsAtCompileTime==Dynamic && m.rows()==0) 35 | return typename traits::Scalar(1); 36 | return m.partialPivLu().determinant(); 37 | } 38 | }; 39 | 40 | template struct determinant_impl 41 | { 42 | static inline EIGEN_DEVICE_FUNC 43 | typename traits::Scalar run(const Derived& m) 44 | { 45 | return m.coeff(0,0); 46 | } 47 | }; 48 | 49 | template struct determinant_impl 50 | { 51 | static inline EIGEN_DEVICE_FUNC 52 | typename traits::Scalar run(const Derived& m) 53 | { 54 | return m.coeff(0,0) * m.coeff(1,1) - m.coeff(1,0) * m.coeff(0,1); 55 | } 56 | }; 57 | 58 | template struct determinant_impl 59 | { 60 | static inline EIGEN_DEVICE_FUNC 61 | typename traits::Scalar run(const Derived& m) 62 | { 63 | return bruteforce_det3_helper(m,0,1,2) 64 | - bruteforce_det3_helper(m,1,0,2) 65 | + bruteforce_det3_helper(m,2,0,1); 66 | } 67 | }; 68 | 69 | template struct determinant_impl 70 | { 71 | typedef typename traits::Scalar Scalar; 72 | static EIGEN_DEVICE_FUNC 73 | Scalar run(const Derived& m) 74 | { 75 | Scalar d2_01 = det2(m, 0, 1); 76 | Scalar d2_02 = det2(m, 0, 2); 77 | Scalar d2_03 = det2(m, 0, 3); 78 | Scalar d2_12 = det2(m, 1, 2); 79 | Scalar d2_13 = det2(m, 1, 3); 80 | Scalar d2_23 = det2(m, 2, 3); 81 | Scalar d3_0 = det3(m, 1,d2_23, 2,d2_13, 3,d2_12); 82 | Scalar d3_1 = det3(m, 0,d2_23, 2,d2_03, 3,d2_02); 83 | Scalar d3_2 = det3(m, 0,d2_13, 1,d2_03, 3,d2_01); 84 | Scalar d3_3 = det3(m, 0,d2_12, 1,d2_02, 2,d2_01); 85 | return internal::pmadd(static_cast(-m(0,3)),d3_0, static_cast(m(1,3)*d3_1)) + 86 | internal::pmadd(static_cast(-m(2,3)),d3_2, static_cast(m(3,3)*d3_3)); 87 | } 88 | protected: 89 | static EIGEN_DEVICE_FUNC 90 | Scalar det2(const Derived& m, Index i0, Index i1) 91 | { 92 | return m(i0,0) * m(i1,1) - m(i1,0) * m(i0,1); 93 | } 94 | 95 | static EIGEN_DEVICE_FUNC 96 | Scalar det3(const Derived& m, Index i0, const Scalar& d0, Index i1, const Scalar& d1, Index i2, const Scalar& d2) 97 | { 98 | return internal::pmadd(m(i0,2), d0, internal::pmadd(static_cast(-m(i1,2)), d1, static_cast(m(i2,2)*d2))); 99 | } 100 | }; 101 | 102 | } // end namespace internal 103 | 104 | /** \lu_module 105 | * 106 | * \returns the determinant of this matrix 107 | */ 108 | template 109 | EIGEN_DEVICE_FUNC 110 | inline typename internal::traits::Scalar MatrixBase::determinant() const 111 | { 112 | eigen_assert(rows() == cols()); 113 | typedef typename internal::nested_eval::type Nested; 114 | return internal::determinant_impl>::run(derived()); 115 | } 116 | 117 | } // end namespace Eigen 118 | 119 | #endif // EIGEN_DETERMINANT_H 120 | -------------------------------------------------------------------------------- /src/tinympc/codegen/codegen_src/include/Eigen/Eigen/src/LU/InternalHeaderCheck.h: -------------------------------------------------------------------------------- 1 | #ifndef EIGEN_LU_MODULE_H 2 | #error "Please include Eigen/LU instead of including headers inside the src directory directly." 3 | #endif 4 | -------------------------------------------------------------------------------- /src/tinympc/codegen/codegen_src/include/Eigen/Eigen/src/MetisSupport/InternalHeaderCheck.h: -------------------------------------------------------------------------------- 1 | #ifndef EIGEN_METISSUPPORT_MODULE_H 2 | #error "Please include Eigen/MetisSupport instead of including headers inside the src directory directly." 3 | #endif 4 | -------------------------------------------------------------------------------- /src/tinympc/codegen/codegen_src/include/Eigen/Eigen/src/OrderingMethods/InternalHeaderCheck.h: -------------------------------------------------------------------------------- 1 | #ifndef EIGEN_ORDERINGMETHODS_MODULE_H 2 | #error "Please include Eigen/OrderingMethods instead of including headers inside the src directory directly." 3 | #endif 4 | -------------------------------------------------------------------------------- /src/tinympc/codegen/codegen_src/include/Eigen/Eigen/src/PaStiXSupport/InternalHeaderCheck.h: -------------------------------------------------------------------------------- 1 | #ifndef EIGEN_PASTIXSUPPORT_MODULE_H 2 | #error "Please include Eigen/PaStiXSupport instead of including headers inside the src directory directly." 3 | #endif 4 | -------------------------------------------------------------------------------- /src/tinympc/codegen/codegen_src/include/Eigen/Eigen/src/PardisoSupport/InternalHeaderCheck.h: -------------------------------------------------------------------------------- 1 | #ifndef EIGEN_PARDISOSUPPORT_MODULE_H 2 | #error "Please include Eigen/PardisoSupport instead of including headers inside the src directory directly." 3 | #endif 4 | -------------------------------------------------------------------------------- /src/tinympc/codegen/codegen_src/include/Eigen/Eigen/src/QR/HouseholderQR_LAPACKE.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2011, Intel Corporation. All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without modification, 5 | are permitted provided that the following conditions are met: 6 | 7 | * Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright notice, 10 | this list of conditions and the following disclaimer in the documentation 11 | and/or other materials provided with the distribution. 12 | * Neither the name of Intel Corporation nor the names of its contributors may 13 | be used to endorse or promote products derived from this software without 14 | specific prior written permission. 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 17 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 20 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 23 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | 27 | ******************************************************************************** 28 | * Content : Eigen bindings to LAPACKe 29 | * Householder QR decomposition of a matrix w/o pivoting based on 30 | * LAPACKE_?geqrf function. 31 | ******************************************************************************** 32 | */ 33 | 34 | #ifndef EIGEN_QR_LAPACKE_H 35 | #define EIGEN_QR_LAPACKE_H 36 | 37 | #include "./InternalHeaderCheck.h" 38 | 39 | namespace Eigen { 40 | 41 | namespace internal { 42 | 43 | namespace lapacke_helpers { 44 | 45 | template 46 | struct lapacke_hqr 47 | { 48 | static void run(MatrixQR& mat, HCoeffs& hCoeffs, Index = 32, typename MatrixQR::Scalar* = 0) 49 | { 50 | lapack_int m = to_lapack(mat.rows()); 51 | lapack_int n = to_lapack(mat.cols()); 52 | lapack_int lda = to_lapack(mat.outerStride()); 53 | lapack_int matrix_order = lapack_storage_of(mat); 54 | geqrf(matrix_order, m, n, to_lapack(mat.data()), lda, to_lapack(hCoeffs.data())); 55 | hCoeffs.adjointInPlace(); 56 | } 57 | }; 58 | 59 | } 60 | 61 | /** \internal Specialization for the data types supported by LAPACKe */ 62 | #define EIGEN_LAPACKE_HH_QR(EIGTYPE) \ 63 | template \ 64 | struct householder_qr_inplace_blocked : public lapacke_helpers::lapacke_hqr {}; 65 | 66 | EIGEN_LAPACKE_HH_QR(double) 67 | EIGEN_LAPACKE_HH_QR(float) 68 | EIGEN_LAPACKE_HH_QR(std::complex) 69 | EIGEN_LAPACKE_HH_QR(std::complex) 70 | 71 | #undef EIGEN_LAPACKE_HH_QR 72 | 73 | } // end namespace internal 74 | 75 | } // end namespace Eigen 76 | 77 | #endif // EIGEN_QR_LAPACKE_H 78 | -------------------------------------------------------------------------------- /src/tinympc/codegen/codegen_src/include/Eigen/Eigen/src/QR/InternalHeaderCheck.h: -------------------------------------------------------------------------------- 1 | #ifndef EIGEN_QR_MODULE_H 2 | #error "Please include Eigen/QR instead of including headers inside the src directory directly." 3 | #endif 4 | -------------------------------------------------------------------------------- /src/tinympc/codegen/codegen_src/include/Eigen/Eigen/src/SPQRSupport/InternalHeaderCheck.h: -------------------------------------------------------------------------------- 1 | #ifndef EIGEN_SPQRSUPPORT_MODULE_H 2 | #error "Please include Eigen/SPQRSupport instead of including headers inside the src directory directly." 3 | #endif 4 | -------------------------------------------------------------------------------- /src/tinympc/codegen/codegen_src/include/Eigen/Eigen/src/SVD/InternalHeaderCheck.h: -------------------------------------------------------------------------------- 1 | #ifndef EIGEN_SVD_MODULE_H 2 | #error "Please include Eigen/SVD instead of including headers inside the src directory directly." 3 | #endif 4 | -------------------------------------------------------------------------------- /src/tinympc/codegen/codegen_src/include/Eigen/Eigen/src/SparseCholesky/InternalHeaderCheck.h: -------------------------------------------------------------------------------- 1 | #ifndef EIGEN_SPARSECHOLESKY_MODULE_H 2 | #error "Please include Eigen/SparseCholesky instead of including headers inside the src directory directly." 3 | #endif 4 | -------------------------------------------------------------------------------- /src/tinympc/codegen/codegen_src/include/Eigen/Eigen/src/SparseCore/InternalHeaderCheck.h: -------------------------------------------------------------------------------- 1 | #ifndef EIGEN_SPARSECORE_MODULE_H 2 | #error "Please include Eigen/SparseCore instead of including headers inside the src directory directly." 3 | #endif 4 | -------------------------------------------------------------------------------- /src/tinympc/codegen/codegen_src/include/Eigen/Eigen/src/SparseCore/SparseDot.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2008 Gael Guennebaud 5 | // 6 | // This Source Code Form is subject to the terms of the Mozilla 7 | // Public License v. 2.0. If a copy of the MPL was not distributed 8 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 9 | 10 | #ifndef EIGEN_SPARSE_DOT_H 11 | #define EIGEN_SPARSE_DOT_H 12 | 13 | #include "./InternalHeaderCheck.h" 14 | 15 | namespace Eigen { 16 | 17 | template 18 | template 19 | typename internal::traits::Scalar 20 | SparseMatrixBase::dot(const MatrixBase& other) const 21 | { 22 | EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) 23 | EIGEN_STATIC_ASSERT_VECTOR_ONLY(OtherDerived) 24 | EIGEN_STATIC_ASSERT_SAME_VECTOR_SIZE(Derived,OtherDerived) 25 | EIGEN_STATIC_ASSERT((internal::is_same::value), 26 | YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY) 27 | 28 | eigen_assert(size() == other.size()); 29 | eigen_assert(other.size()>0 && "you are using a non initialized vector"); 30 | 31 | internal::evaluator thisEval(derived()); 32 | typename internal::evaluator::InnerIterator i(thisEval, 0); 33 | Scalar res(0); 34 | while (i) 35 | { 36 | res += numext::conj(i.value()) * other.coeff(i.index()); 37 | ++i; 38 | } 39 | return res; 40 | } 41 | 42 | template 43 | template 44 | typename internal::traits::Scalar 45 | SparseMatrixBase::dot(const SparseMatrixBase& other) const 46 | { 47 | EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) 48 | EIGEN_STATIC_ASSERT_VECTOR_ONLY(OtherDerived) 49 | EIGEN_STATIC_ASSERT_SAME_VECTOR_SIZE(Derived,OtherDerived) 50 | EIGEN_STATIC_ASSERT((internal::is_same::value), 51 | YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY) 52 | 53 | eigen_assert(size() == other.size()); 54 | 55 | internal::evaluator thisEval(derived()); 56 | typename internal::evaluator::InnerIterator i(thisEval, 0); 57 | 58 | internal::evaluator otherEval(other.derived()); 59 | typename internal::evaluator::InnerIterator j(otherEval, 0); 60 | 61 | Scalar res(0); 62 | while (i && j) 63 | { 64 | if (i.index()==j.index()) 65 | { 66 | res += numext::conj(i.value()) * j.value(); 67 | ++i; ++j; 68 | } 69 | else if (i.index() 78 | inline typename NumTraits::Scalar>::Real 79 | SparseMatrixBase::squaredNorm() const 80 | { 81 | return numext::real((*this).cwiseAbs2().sum()); 82 | } 83 | 84 | template 85 | inline typename NumTraits::Scalar>::Real 86 | SparseMatrixBase::norm() const 87 | { 88 | using std::sqrt; 89 | return sqrt(squaredNorm()); 90 | } 91 | 92 | template 93 | inline typename NumTraits::Scalar>::Real 94 | SparseMatrixBase::blueNorm() const 95 | { 96 | return internal::blueNorm_impl(*this); 97 | } 98 | } // end namespace Eigen 99 | 100 | #endif // EIGEN_SPARSE_DOT_H 101 | -------------------------------------------------------------------------------- /src/tinympc/codegen/codegen_src/include/Eigen/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 | #include "./InternalHeaderCheck.h" 14 | 15 | namespace Eigen { 16 | 17 | template 18 | template 19 | bool SparseMatrixBase::isApprox(const SparseMatrixBase& other, const RealScalar &prec) const 20 | { 21 | const typename internal::nested_eval::type actualA(derived()); 22 | std::conditional_t::type, 24 | const PlainObject> actualB(other.derived()); 25 | 26 | return (actualA - actualB).squaredNorm() <= prec * prec * numext::mini(actualA.squaredNorm(), actualB.squaredNorm()); 27 | } 28 | 29 | } // end namespace Eigen 30 | 31 | #endif // EIGEN_SPARSE_FUZZY_H 32 | -------------------------------------------------------------------------------- /src/tinympc/codegen/codegen_src/include/Eigen/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 | #include "./InternalHeaderCheck.h" 14 | 15 | namespace Eigen { 16 | 17 | template 18 | typename internal::traits::Scalar 19 | SparseMatrixBase::sum() const 20 | { 21 | eigen_assert(rows()>0 && cols()>0 && "you are using a non initialized matrix"); 22 | Scalar res(0); 23 | internal::evaluator thisEval(derived()); 24 | for (Index j=0; j::InnerIterator iter(thisEval,j); iter; ++iter) 26 | res += iter.value(); 27 | return res; 28 | } 29 | 30 | template 31 | typename internal::traits >::Scalar 32 | SparseMatrix::sum() const 33 | { 34 | eigen_assert(rows()>0 && cols()>0 && "you are using a non initialized matrix"); 35 | if(this->isCompressed()) 36 | return Matrix::Map(m_data.valuePtr(), m_data.size()).sum(); 37 | else 38 | return Base::sum(); 39 | } 40 | 41 | template 42 | typename internal::traits >::Scalar 43 | SparseVector::sum() const 44 | { 45 | eigen_assert(rows()>0 && cols()>0 && "you are using a non initialized matrix"); 46 | return Matrix::Map(m_data.valuePtr(), m_data.size()).sum(); 47 | } 48 | 49 | } // end namespace Eigen 50 | 51 | #endif // EIGEN_SPARSEREDUX_H 52 | -------------------------------------------------------------------------------- /src/tinympc/codegen/codegen_src/include/Eigen/Eigen/src/SparseCore/SparseTranspose.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2008-2015 Gael Guennebaud 5 | // 6 | // This Source Code Form is subject to the terms of the Mozilla 7 | // Public License v. 2.0. If a copy of the MPL was not distributed 8 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 9 | 10 | #ifndef EIGEN_SPARSETRANSPOSE_H 11 | #define EIGEN_SPARSETRANSPOSE_H 12 | 13 | #include "./InternalHeaderCheck.h" 14 | 15 | namespace Eigen { 16 | 17 | namespace internal { 18 | template 19 | class SparseTransposeImpl 20 | : public SparseMatrixBase > 21 | {}; 22 | 23 | template 24 | class SparseTransposeImpl 25 | : public SparseCompressedBase > 26 | { 27 | typedef SparseCompressedBase > Base; 28 | public: 29 | using Base::derived; 30 | typedef typename Base::Scalar Scalar; 31 | typedef typename Base::StorageIndex StorageIndex; 32 | 33 | inline Index nonZeros() const { return derived().nestedExpression().nonZeros(); } 34 | 35 | inline const Scalar* valuePtr() const { return derived().nestedExpression().valuePtr(); } 36 | inline const StorageIndex* innerIndexPtr() const { return derived().nestedExpression().innerIndexPtr(); } 37 | inline const StorageIndex* outerIndexPtr() const { return derived().nestedExpression().outerIndexPtr(); } 38 | inline const StorageIndex* innerNonZeroPtr() const { return derived().nestedExpression().innerNonZeroPtr(); } 39 | 40 | inline Scalar* valuePtr() { return derived().nestedExpression().valuePtr(); } 41 | inline StorageIndex* innerIndexPtr() { return derived().nestedExpression().innerIndexPtr(); } 42 | inline StorageIndex* outerIndexPtr() { return derived().nestedExpression().outerIndexPtr(); } 43 | inline StorageIndex* innerNonZeroPtr() { return derived().nestedExpression().innerNonZeroPtr(); } 44 | }; 45 | } 46 | 47 | template class TransposeImpl 48 | : public internal::SparseTransposeImpl 49 | { 50 | protected: 51 | typedef internal::SparseTransposeImpl Base; 52 | }; 53 | 54 | namespace internal { 55 | 56 | template 57 | struct unary_evaluator, IteratorBased> 58 | : public evaluator_base > 59 | { 60 | typedef typename evaluator::InnerIterator EvalIterator; 61 | public: 62 | typedef Transpose XprType; 63 | 64 | inline Index nonZerosEstimate() const { 65 | return m_argImpl.nonZerosEstimate(); 66 | } 67 | 68 | class InnerIterator : public EvalIterator 69 | { 70 | public: 71 | EIGEN_STRONG_INLINE InnerIterator(const unary_evaluator& unaryOp, Index outer) 72 | : EvalIterator(unaryOp.m_argImpl,outer) 73 | {} 74 | 75 | Index row() const { return EvalIterator::col(); } 76 | Index col() const { return EvalIterator::row(); } 77 | }; 78 | 79 | enum { 80 | CoeffReadCost = evaluator::CoeffReadCost, 81 | Flags = XprType::Flags 82 | }; 83 | 84 | explicit unary_evaluator(const XprType& op) :m_argImpl(op.nestedExpression()) {} 85 | 86 | protected: 87 | evaluator m_argImpl; 88 | }; 89 | 90 | } // end namespace internal 91 | 92 | } // end namespace Eigen 93 | 94 | #endif // EIGEN_SPARSETRANSPOSE_H 95 | -------------------------------------------------------------------------------- /src/tinympc/codegen/codegen_src/include/Eigen/Eigen/src/SparseLU/InternalHeaderCheck.h: -------------------------------------------------------------------------------- 1 | #ifndef EIGEN_SPARSELU_MODULE_H 2 | #error "Please include Eigen/SparseLU instead of including headers inside the src directory directly." 3 | #endif 4 | -------------------------------------------------------------------------------- /src/tinympc/codegen/codegen_src/include/Eigen/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 | #include "./InternalHeaderCheck.h" 15 | 16 | namespace Eigen { 17 | namespace internal { 18 | 19 | /** 20 | * \brief Count Nonzero elements in the factors 21 | */ 22 | template 23 | void SparseLUImpl::countnz(const Index n, Index& nnzL, Index& nnzU, GlobalLU_t& glu) 24 | { 25 | nnzL = 0; 26 | nnzU = (glu.xusub)(n); 27 | Index nsuper = (glu.supno)(n); 28 | Index jlen; 29 | Index i, j, fsupc; 30 | if (n <= 0 ) return; 31 | // For each supernode 32 | for (i = 0; i <= nsuper; i++) 33 | { 34 | fsupc = glu.xsup(i); 35 | jlen = glu.xlsub(fsupc+1) - glu.xlsub(fsupc); 36 | 37 | for (j = fsupc; j < glu.xsup(i+1); j++) 38 | { 39 | nnzL += jlen; 40 | nnzU += j - fsupc + 1; 41 | jlen--; 42 | } 43 | } 44 | } 45 | 46 | /** 47 | * \brief Fix up the data storage lsub for L-subscripts. 48 | * 49 | * It removes the subscripts sets for structural pruning, 50 | * and applies permutation to the remaining subscripts 51 | * 52 | */ 53 | template 54 | void SparseLUImpl::fixupL(const Index n, const IndexVector& perm_r, GlobalLU_t& glu) 55 | { 56 | Index fsupc, i, j, k, jstart; 57 | 58 | StorageIndex nextl = 0; 59 | Index nsuper = (glu.supno)(n); 60 | 61 | // For each supernode 62 | for (i = 0; i <= nsuper; i++) 63 | { 64 | fsupc = glu.xsup(i); 65 | jstart = glu.xlsub(fsupc); 66 | glu.xlsub(fsupc) = nextl; 67 | for (j = jstart; j < glu.xlsub(fsupc + 1); j++) 68 | { 69 | glu.lsub(nextl) = perm_r(glu.lsub(j)); // Now indexed into P*A 70 | nextl++; 71 | } 72 | for (k = fsupc+1; k < glu.xsup(i+1); k++) 73 | glu.xlsub(k) = nextl; // other columns in supernode i 74 | } 75 | 76 | glu.xlsub(n) = nextl; 77 | } 78 | 79 | } // end namespace internal 80 | 81 | } // end namespace Eigen 82 | #endif // EIGEN_SPARSELU_UTILS_H 83 | -------------------------------------------------------------------------------- /src/tinympc/codegen/codegen_src/include/Eigen/Eigen/src/SparseLU/SparseLU_relax_snode.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2012 Désiré Nuentsa-Wakam 5 | // 6 | // This Source Code Form is subject to the terms of the Mozilla 7 | // Public License v. 2.0. If a copy of the MPL was not distributed 8 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 9 | 10 | /* This file is a modified version of heap_relax_snode.c file in SuperLU 11 | * -- SuperLU routine (version 3.0) -- 12 | * Univ. of California Berkeley, Xerox Palo Alto Research Center, 13 | * and Lawrence Berkeley National Lab. 14 | * October 15, 2003 15 | * 16 | * Copyright (c) 1994 by Xerox Corporation. All rights reserved. 17 | * 18 | * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY 19 | * EXPRESSED OR IMPLIED. ANY USE IS AT YOUR OWN RISK. 20 | * 21 | * Permission is hereby granted to use or copy this program for any 22 | * purpose, provided the above notices are retained on all copies. 23 | * Permission to modify the code and to distribute modified code is 24 | * granted, provided the above notices are retained, and a notice that 25 | * the code was modified is included with the above copyright notice. 26 | */ 27 | 28 | #ifndef SPARSELU_RELAX_SNODE_H 29 | #define SPARSELU_RELAX_SNODE_H 30 | 31 | #include "./InternalHeaderCheck.h" 32 | 33 | namespace Eigen { 34 | 35 | namespace internal { 36 | 37 | /** 38 | * \brief Identify the initial relaxed supernodes 39 | * 40 | * This routine is applied to a column elimination tree. 41 | * It assumes that the matrix has been reordered according to the postorder of the etree 42 | * \param n the number of columns 43 | * \param et elimination tree 44 | * \param relax_columns Maximum number of columns allowed in a relaxed snode 45 | * \param descendants Number of descendants of each node in the etree 46 | * \param relax_end last column in a supernode 47 | */ 48 | template 49 | void SparseLUImpl::relax_snode (const Index n, IndexVector& et, const Index relax_columns, IndexVector& descendants, IndexVector& relax_end) 50 | { 51 | 52 | // compute the number of descendants of each node in the etree 53 | Index parent; 54 | relax_end.setConstant(emptyIdxLU); 55 | descendants.setZero(); 56 | for (Index j = 0; j < n; j++) 57 | { 58 | parent = et(j); 59 | if (parent != n) // not the dummy root 60 | descendants(parent) += descendants(j) + 1; 61 | } 62 | // Identify the relaxed supernodes by postorder traversal of the etree 63 | Index snode_start; // beginning of a snode 64 | for (Index j = 0; j < n; ) 65 | { 66 | parent = et(j); 67 | snode_start = j; 68 | while ( parent != n && descendants(parent) < relax_columns ) 69 | { 70 | j = parent; 71 | parent = et(j); 72 | } 73 | // Found a supernode in postordered etree, j is the last column 74 | relax_end(snode_start) = StorageIndex(j); // Record last column 75 | j++; 76 | // Search for a new leaf 77 | while (descendants(j) != 0 && j < n) j++; 78 | } // End postorder traversal of the etree 79 | 80 | } 81 | 82 | } // end namespace internal 83 | 84 | } // end namespace Eigen 85 | #endif 86 | -------------------------------------------------------------------------------- /src/tinympc/codegen/codegen_src/include/Eigen/Eigen/src/SparseQR/InternalHeaderCheck.h: -------------------------------------------------------------------------------- 1 | #ifndef EIGEN_SPARSEQR_MODULE_H 2 | #error "Please include Eigen/SparseQR instead of including headers inside the src directory directly." 3 | #endif 4 | -------------------------------------------------------------------------------- /src/tinympc/codegen/codegen_src/include/Eigen/Eigen/src/StlSupport/StdDeque.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2009 Gael Guennebaud 5 | // Copyright (C) 2009 Hauke Heibel 6 | // 7 | // This Source Code Form is subject to the terms of the Mozilla 8 | // Public License v. 2.0. If a copy of the MPL was not distributed 9 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 10 | 11 | #ifndef EIGEN_STDDEQUE_H 12 | #define EIGEN_STDDEQUE_H 13 | 14 | #ifndef EIGEN_STDDEQUE_MODULE_H 15 | #error "Please include Eigen/StdDeque instead of including this file directly." 16 | #endif 17 | 18 | #include "details.h" 19 | 20 | /** 21 | * This section contains a convenience MACRO which allows an easy specialization of 22 | * std::deque such that for data types with alignment issues the correct allocator 23 | * is used automatically. 24 | */ 25 | #define EIGEN_DEFINE_STL_DEQUE_SPECIALIZATION(...) \ 26 | namespace std \ 27 | { \ 28 | template<> \ 29 | class deque<__VA_ARGS__, std::allocator<__VA_ARGS__> > \ 30 | : public deque<__VA_ARGS__, EIGEN_ALIGNED_ALLOCATOR<__VA_ARGS__> > \ 31 | { \ 32 | typedef deque<__VA_ARGS__, EIGEN_ALIGNED_ALLOCATOR<__VA_ARGS__> > deque_base; \ 33 | public: \ 34 | typedef __VA_ARGS__ value_type; \ 35 | typedef deque_base::allocator_type allocator_type; \ 36 | typedef deque_base::size_type size_type; \ 37 | typedef deque_base::iterator iterator; \ 38 | explicit deque(const allocator_type& a = allocator_type()) : deque_base(a) {} \ 39 | template \ 40 | deque(InputIterator first, InputIterator last, const allocator_type& a = allocator_type()) : deque_base(first, last, a) {} \ 41 | deque(const deque& c) : deque_base(c) {} \ 42 | explicit deque(size_type num, const value_type& val = value_type()) : deque_base(num, val) {} \ 43 | deque(iterator start_, iterator end_) : deque_base(start_, end_) {} \ 44 | deque& operator=(const deque& x) { \ 45 | deque_base::operator=(x); \ 46 | return *this; \ 47 | } \ 48 | }; \ 49 | } 50 | 51 | #endif // EIGEN_STDDEQUE_H 52 | -------------------------------------------------------------------------------- /src/tinympc/codegen/codegen_src/include/Eigen/Eigen/src/StlSupport/StdList.h: -------------------------------------------------------------------------------- 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_H 11 | #define EIGEN_STDLIST_H 12 | 13 | #ifndef EIGEN_STDLIST_MODULE_H 14 | #error "Please include Eigen/StdList instead of including this file directly." 15 | #endif 16 | 17 | #include "details.h" 18 | 19 | /** 20 | * This section contains a convenience MACRO which allows an easy specialization of 21 | * std::list such that for data types with alignment issues the correct allocator 22 | * is used automatically. 23 | */ 24 | #define EIGEN_DEFINE_STL_LIST_SPECIALIZATION(...) \ 25 | namespace std \ 26 | { \ 27 | template<> \ 28 | class list<__VA_ARGS__, std::allocator<__VA_ARGS__> > \ 29 | : public list<__VA_ARGS__, EIGEN_ALIGNED_ALLOCATOR<__VA_ARGS__> > \ 30 | { \ 31 | typedef list<__VA_ARGS__, EIGEN_ALIGNED_ALLOCATOR<__VA_ARGS__> > list_base; \ 32 | public: \ 33 | typedef __VA_ARGS__ value_type; \ 34 | typedef list_base::allocator_type allocator_type; \ 35 | typedef list_base::size_type size_type; \ 36 | typedef list_base::iterator iterator; \ 37 | explicit list(const allocator_type& a = allocator_type()) : list_base(a) {} \ 38 | template \ 39 | list(InputIterator first, InputIterator last, const allocator_type& a = allocator_type()) : list_base(first, last, a) {} \ 40 | list(const list& c) : list_base(c) {} \ 41 | explicit list(size_type num, const value_type& val = value_type()) : list_base(num, val) {} \ 42 | list(iterator start_, iterator end_) : list_base(start_, end_) {} \ 43 | list& operator=(const list& x) { \ 44 | list_base::operator=(x); \ 45 | return *this; \ 46 | } \ 47 | }; \ 48 | } 49 | 50 | #endif // EIGEN_STDLIST_H 51 | -------------------------------------------------------------------------------- /src/tinympc/codegen/codegen_src/include/Eigen/Eigen/src/StlSupport/StdVector.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2009 Gael Guennebaud 5 | // Copyright (C) 2009 Hauke Heibel 6 | // 7 | // This Source Code Form is subject to the terms of the Mozilla 8 | // Public License v. 2.0. If a copy of the MPL was not distributed 9 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 10 | 11 | #ifndef EIGEN_STDVECTOR_H 12 | #define EIGEN_STDVECTOR_H 13 | 14 | #ifndef EIGEN_STDVECTOR_MODULE_H 15 | #error "Please include Eigen/StdVector instead of including this file directly." 16 | #endif 17 | 18 | #include "details.h" 19 | 20 | /** 21 | * This section contains a convenience MACRO which allows an easy specialization of 22 | * std::vector such that for data types with alignment issues the correct allocator 23 | * is used automatically. 24 | */ 25 | #define EIGEN_DEFINE_STL_VECTOR_SPECIALIZATION(...) \ 26 | namespace std \ 27 | { \ 28 | template<> \ 29 | class vector<__VA_ARGS__, std::allocator<__VA_ARGS__> > \ 30 | : public vector<__VA_ARGS__, EIGEN_ALIGNED_ALLOCATOR<__VA_ARGS__> > \ 31 | { \ 32 | typedef vector<__VA_ARGS__, EIGEN_ALIGNED_ALLOCATOR<__VA_ARGS__> > vector_base; \ 33 | public: \ 34 | typedef __VA_ARGS__ value_type; \ 35 | typedef vector_base::allocator_type allocator_type; \ 36 | typedef vector_base::size_type size_type; \ 37 | typedef vector_base::iterator iterator; \ 38 | explicit vector(const allocator_type& a = allocator_type()) : vector_base(a) {} \ 39 | template \ 40 | vector(InputIterator first, InputIterator last, const allocator_type& a = allocator_type()) : vector_base(first, last, a) {} \ 41 | vector(const vector& c) : vector_base(c) {} \ 42 | explicit vector(size_type num, const value_type& val = value_type()) : vector_base(num, val) {} \ 43 | vector(iterator start_, iterator end_) : vector_base(start_, end_) {} \ 44 | vector& operator=(const vector& x) { \ 45 | vector_base::operator=(x); \ 46 | return *this; \ 47 | } \ 48 | }; \ 49 | } 50 | 51 | #endif // EIGEN_STDVECTOR_H 52 | -------------------------------------------------------------------------------- /src/tinympc/codegen/codegen_src/include/Eigen/Eigen/src/StlSupport/details.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2009 Gael Guennebaud 5 | // Copyright (C) 2009 Hauke Heibel 6 | // 7 | // This Source Code Form is subject to the terms of the Mozilla 8 | // Public License v. 2.0. If a copy of the MPL was not distributed 9 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 10 | 11 | #ifndef EIGEN_STL_DETAILS_H 12 | #define EIGEN_STL_DETAILS_H 13 | 14 | #ifndef EIGEN_ALIGNED_ALLOCATOR 15 | #define EIGEN_ALIGNED_ALLOCATOR Eigen::aligned_allocator 16 | #endif 17 | 18 | namespace Eigen { 19 | 20 | // This one is needed to prevent reimplementing the whole std::vector. 21 | template 22 | class aligned_allocator_indirection : public EIGEN_ALIGNED_ALLOCATOR 23 | { 24 | public: 25 | typedef std::size_t size_type; 26 | typedef std::ptrdiff_t difference_type; 27 | typedef T* pointer; 28 | typedef const T* const_pointer; 29 | typedef T& reference; 30 | typedef const T& const_reference; 31 | typedef T value_type; 32 | 33 | template 34 | struct rebind 35 | { 36 | typedef aligned_allocator_indirection other; 37 | }; 38 | 39 | aligned_allocator_indirection() {} 40 | aligned_allocator_indirection(const aligned_allocator_indirection& ) : EIGEN_ALIGNED_ALLOCATOR() {} 41 | aligned_allocator_indirection(const EIGEN_ALIGNED_ALLOCATOR& ) {} 42 | template 43 | aligned_allocator_indirection(const aligned_allocator_indirection& ) {} 44 | template 45 | aligned_allocator_indirection(const EIGEN_ALIGNED_ALLOCATOR& ) {} 46 | ~aligned_allocator_indirection() {} 47 | }; 48 | 49 | #if EIGEN_COMP_MSVC 50 | 51 | // sometimes, MSVC detects, at compile time, that the argument x 52 | // in std::vector::resize(size_t s,T x) won't be aligned and generate an error 53 | // even if this function is never called. Whence this little wrapper. 54 | #define EIGEN_WORKAROUND_MSVC_STL_SUPPORT(T) \ 55 | std::conditional_t::value, T, Eigen::internal::workaround_msvc_stl_support > 56 | 57 | namespace internal { 58 | template struct workaround_msvc_stl_support : public T 59 | { 60 | inline workaround_msvc_stl_support() : T() {} 61 | inline workaround_msvc_stl_support(const T& other) : T(other) {} 62 | inline operator T& () { return *static_cast(this); } 63 | inline operator const T& () const { return *static_cast(this); } 64 | template 65 | inline T& operator=(const OtherT& other) 66 | { T::operator=(other); return *this; } 67 | inline workaround_msvc_stl_support& operator=(const workaround_msvc_stl_support& other) 68 | { T::operator=(other); return *this; } 69 | }; 70 | } 71 | 72 | #else 73 | 74 | #define EIGEN_WORKAROUND_MSVC_STL_SUPPORT(T) T 75 | 76 | #endif 77 | 78 | } 79 | 80 | #endif // EIGEN_STL_DETAILS_H 81 | -------------------------------------------------------------------------------- /src/tinympc/codegen/codegen_src/include/Eigen/Eigen/src/SuperLUSupport/InternalHeaderCheck.h: -------------------------------------------------------------------------------- 1 | #ifndef EIGEN_SUPERLUSUPPORT_MODULE_H 2 | #error "Please include Eigen/SuperLUSupport instead of including headers inside the src directory directly." 3 | #endif 4 | -------------------------------------------------------------------------------- /src/tinympc/codegen/codegen_src/include/Eigen/Eigen/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 | #include "./InternalHeaderCheck.h" 17 | 18 | namespace Eigen { 19 | 20 | class Barrier { 21 | public: 22 | Barrier(unsigned int count) : state_(count << 1), notified_(false) { 23 | eigen_plain_assert(((count << 1) >> 1) == count); 24 | } 25 | ~Barrier() { eigen_plain_assert((state_ >> 1) == 0); } 26 | 27 | void Notify() { 28 | unsigned int v = state_.fetch_sub(2, std::memory_order_acq_rel) - 2; 29 | if (v != 1) { 30 | // Clear the lowest bit (waiter flag) and check that the original state 31 | // value was not zero. If it was zero, it means that notify was called 32 | // more times than the original count. 33 | eigen_plain_assert(((v + 2) & ~1) != 0); 34 | return; // either count has not dropped to 0, or waiter is not waiting 35 | } 36 | EIGEN_MUTEX_LOCK l(mu_); 37 | eigen_plain_assert(!notified_); 38 | notified_ = true; 39 | cv_.notify_all(); 40 | } 41 | 42 | void Wait() { 43 | unsigned int v = state_.fetch_or(1, std::memory_order_acq_rel); 44 | if ((v >> 1) == 0) return; 45 | EIGEN_MUTEX_LOCK l(mu_); 46 | while (!notified_) { 47 | cv_.wait(l); 48 | } 49 | } 50 | 51 | private: 52 | EIGEN_MUTEX mu_; 53 | EIGEN_CONDVAR cv_; 54 | std::atomic state_; // low bit is waiter flag 55 | bool notified_; 56 | }; 57 | 58 | // Notification is an object that allows a user to to wait for another 59 | // thread to signal a notification that an event has occurred. 60 | // 61 | // Multiple threads can wait on the same Notification object, 62 | // but only one caller must call Notify() on the object. 63 | struct Notification : Barrier { 64 | Notification() : Barrier(1){}; 65 | }; 66 | 67 | } // namespace Eigen 68 | 69 | #endif // EIGEN_CXX11_THREADPOOL_BARRIER_H 70 | -------------------------------------------------------------------------------- /src/tinympc/codegen/codegen_src/include/Eigen/Eigen/src/ThreadPool/InternalHeaderCheck.h: -------------------------------------------------------------------------------- 1 | #ifndef EIGEN_THREADPOOL_MODULE_H 2 | #error "Please include unsupported/Eigen/CXX11/ThreadPool instead of including headers inside the src directory directly." 3 | #endif 4 | -------------------------------------------------------------------------------- /src/tinympc/codegen/codegen_src/include/Eigen/Eigen/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 | -------------------------------------------------------------------------------- /src/tinympc/codegen/codegen_src/include/Eigen/Eigen/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 | #include "./InternalHeaderCheck.h" 14 | 15 | namespace Eigen { 16 | 17 | struct StlThreadEnvironment { 18 | struct Task { 19 | std::function f; 20 | }; 21 | 22 | // EnvThread constructor must start the thread, 23 | // destructor must join the thread. 24 | class EnvThread { 25 | public: 26 | EnvThread(std::function f) : thr_(std::move(f)) {} 27 | ~EnvThread() { thr_.join(); } 28 | // This function is called when the threadpool is cancelled. 29 | void OnCancel() { } 30 | 31 | private: 32 | std::thread thr_; 33 | }; 34 | 35 | EnvThread* CreateThread(std::function f) { return new EnvThread(std::move(f)); } 36 | Task CreateTask(std::function f) { return Task{std::move(f)}; } 37 | void ExecuteTask(const Task& t) { t.f(); } 38 | }; 39 | 40 | } // namespace Eigen 41 | 42 | #endif // EIGEN_CXX11_THREADPOOL_THREAD_ENVIRONMENT_H 43 | -------------------------------------------------------------------------------- /src/tinympc/codegen/codegen_src/include/Eigen/Eigen/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 | #include "./InternalHeaderCheck.h" 14 | 15 | namespace Eigen { 16 | 17 | // This defines an interface that ThreadPoolDevice can take to use 18 | // custom thread pools underneath. 19 | class ThreadPoolInterface { 20 | public: 21 | // Submits a closure to be run by a thread in the pool. 22 | virtual void Schedule(std::function fn) = 0; 23 | 24 | // Submits a closure to be run by threads in the range [start, end) in the 25 | // pool. 26 | virtual void ScheduleWithHint(std::function fn, int /*start*/, 27 | int /*end*/) { 28 | // Just defer to Schedule in case sub-classes aren't interested in 29 | // overriding this functionality. 30 | Schedule(fn); 31 | } 32 | 33 | // If implemented, stop processing the closures that have been enqueued. 34 | // Currently running closures may still be processed. 35 | // If not implemented, does nothing. 36 | virtual void Cancel() {} 37 | 38 | // Returns the number of threads in the pool. 39 | virtual int NumThreads() const = 0; 40 | 41 | // Returns a logical thread index between 0 and NumThreads() - 1 if called 42 | // from one of the threads in the pool. Returns -1 otherwise. 43 | virtual int CurrentThreadId() const = 0; 44 | 45 | virtual ~ThreadPoolInterface() {} 46 | }; 47 | 48 | } // namespace Eigen 49 | 50 | #endif // EIGEN_CXX11_THREADPOOL_THREAD_POOL_INTERFACE_H 51 | -------------------------------------------------------------------------------- /src/tinympc/codegen/codegen_src/include/Eigen/Eigen/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 | #define EIGEN_THREAD_YIELD() std::this_thread::yield() 15 | 16 | #endif // EIGEN_CXX11_THREADPOOL_THREAD_YIELD_H 17 | -------------------------------------------------------------------------------- /src/tinympc/codegen/codegen_src/include/Eigen/Eigen/src/UmfPackSupport/InternalHeaderCheck.h: -------------------------------------------------------------------------------- 1 | #ifndef EIGEN_UMFPACKSUPPORT_MODULE_H 2 | #error "Please include Eigen/UmfPackSupport instead of including headers inside the src directory directly." 3 | #endif 4 | -------------------------------------------------------------------------------- /src/tinympc/codegen/codegen_src/include/Eigen/Eigen/src/misc/Image.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2009 Benoit Jacob 5 | // 6 | // This Source Code Form is subject to the terms of the Mozilla 7 | // Public License v. 2.0. If a copy of the MPL was not distributed 8 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 9 | 10 | #ifndef EIGEN_MISC_IMAGE_H 11 | #define EIGEN_MISC_IMAGE_H 12 | 13 | #include "./InternalHeaderCheck.h" 14 | 15 | namespace Eigen { 16 | 17 | namespace internal { 18 | 19 | /** \class image_retval_base 20 | * 21 | */ 22 | template 23 | struct traits > 24 | { 25 | typedef typename DecompositionType::MatrixType MatrixType; 26 | typedef Matrix< 27 | typename MatrixType::Scalar, 28 | MatrixType::RowsAtCompileTime, // the image is a subspace of the destination space, whose 29 | // dimension is the number of rows of the original matrix 30 | Dynamic, // we don't know at compile time the dimension of the image (the rank) 31 | MatrixType::Options, 32 | MatrixType::MaxRowsAtCompileTime, // the image matrix will consist of columns from the original matrix, 33 | MatrixType::MaxColsAtCompileTime // so it has the same number of rows and at most as many columns. 34 | > ReturnType; 35 | }; 36 | 37 | template struct image_retval_base 38 | : public ReturnByValue > 39 | { 40 | typedef DecompositionType_ DecompositionType; 41 | typedef typename DecompositionType::MatrixType MatrixType; 42 | typedef ReturnByValue Base; 43 | 44 | image_retval_base(const DecompositionType& dec, const MatrixType& originalMatrix) 45 | : m_dec(dec), m_rank(dec.rank()), 46 | m_cols(m_rank == 0 ? 1 : m_rank), 47 | m_originalMatrix(originalMatrix) 48 | {} 49 | 50 | inline Index rows() const { return m_dec.rows(); } 51 | inline Index cols() const { return m_cols; } 52 | inline Index rank() const { return m_rank; } 53 | inline const DecompositionType& dec() const { return m_dec; } 54 | inline const MatrixType& originalMatrix() const { return m_originalMatrix; } 55 | 56 | template inline void evalTo(Dest& dst) const 57 | { 58 | static_cast*>(this)->evalTo(dst); 59 | } 60 | 61 | protected: 62 | const DecompositionType& m_dec; 63 | Index m_rank, m_cols; 64 | const MatrixType& m_originalMatrix; 65 | }; 66 | 67 | } // end namespace internal 68 | 69 | #define EIGEN_MAKE_IMAGE_HELPERS(DecompositionType) \ 70 | typedef typename DecompositionType::MatrixType MatrixType; \ 71 | typedef typename MatrixType::Scalar Scalar; \ 72 | typedef typename MatrixType::RealScalar RealScalar; \ 73 | typedef Eigen::internal::image_retval_base Base; \ 74 | using Base::dec; \ 75 | using Base::originalMatrix; \ 76 | using Base::rank; \ 77 | using Base::rows; \ 78 | using Base::cols; \ 79 | image_retval(const DecompositionType& dec, const MatrixType& originalMatrix) \ 80 | : Base(dec, originalMatrix) {} 81 | 82 | } // end namespace Eigen 83 | 84 | #endif // EIGEN_MISC_IMAGE_H 85 | -------------------------------------------------------------------------------- /src/tinympc/codegen/codegen_src/include/Eigen/Eigen/src/misc/InternalHeaderCheck.h: -------------------------------------------------------------------------------- 1 | #ifndef EIGEN_CORE_MODULE_H 2 | #error "Please include Eigen/Core instead of including headers inside the src directory directly." 3 | #endif 4 | -------------------------------------------------------------------------------- /src/tinympc/codegen/codegen_src/include/Eigen/Eigen/src/misc/Kernel.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2009 Benoit Jacob 5 | // 6 | // This Source Code Form is subject to the terms of the Mozilla 7 | // Public License v. 2.0. If a copy of the MPL was not distributed 8 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 9 | 10 | #ifndef EIGEN_MISC_KERNEL_H 11 | #define EIGEN_MISC_KERNEL_H 12 | 13 | #include "./InternalHeaderCheck.h" 14 | 15 | namespace Eigen { 16 | 17 | namespace internal { 18 | 19 | /** \class kernel_retval_base 20 | * 21 | */ 22 | template 23 | struct traits > 24 | { 25 | typedef typename DecompositionType::MatrixType MatrixType; 26 | typedef Matrix< 27 | typename MatrixType::Scalar, 28 | MatrixType::ColsAtCompileTime, // the number of rows in the "kernel matrix" 29 | // is the number of cols of the original matrix 30 | // so that the product "matrix * kernel = zero" makes sense 31 | Dynamic, // we don't know at compile-time the dimension of the kernel 32 | MatrixType::Options, 33 | MatrixType::MaxColsAtCompileTime, // see explanation for 2nd template parameter 34 | MatrixType::MaxColsAtCompileTime // the kernel is a subspace of the domain space, 35 | // whose dimension is the number of columns of the original matrix 36 | > ReturnType; 37 | }; 38 | 39 | template struct kernel_retval_base 40 | : public ReturnByValue > 41 | { 42 | typedef DecompositionType_ DecompositionType; 43 | typedef ReturnByValue Base; 44 | 45 | explicit kernel_retval_base(const DecompositionType& dec) 46 | : m_dec(dec), 47 | m_rank(dec.rank()), 48 | m_cols(m_rank==dec.cols() ? 1 : dec.cols() - m_rank) 49 | {} 50 | 51 | inline Index rows() const { return m_dec.cols(); } 52 | inline Index cols() const { return m_cols; } 53 | inline Index rank() const { return m_rank; } 54 | inline const DecompositionType& dec() const { return m_dec; } 55 | 56 | template inline void evalTo(Dest& dst) const 57 | { 58 | static_cast*>(this)->evalTo(dst); 59 | } 60 | 61 | protected: 62 | const DecompositionType& m_dec; 63 | Index m_rank, m_cols; 64 | }; 65 | 66 | } // end namespace internal 67 | 68 | #define EIGEN_MAKE_KERNEL_HELPERS(DecompositionType) \ 69 | typedef typename DecompositionType::MatrixType MatrixType; \ 70 | typedef typename MatrixType::Scalar Scalar; \ 71 | typedef typename MatrixType::RealScalar RealScalar; \ 72 | typedef Eigen::internal::kernel_retval_base Base; \ 73 | using Base::dec; \ 74 | using Base::rank; \ 75 | using Base::rows; \ 76 | using Base::cols; \ 77 | kernel_retval(const DecompositionType& dec) : Base(dec) {} 78 | 79 | } // end namespace Eigen 80 | 81 | #endif // EIGEN_MISC_KERNEL_H 82 | -------------------------------------------------------------------------------- /src/tinympc/codegen/codegen_src/include/Eigen/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 | #include "./InternalHeaderCheck.h" 15 | 16 | namespace Eigen { 17 | 18 | namespace internal { 19 | 20 | template 21 | void real_2x2_jacobi_svd(const MatrixType& matrix, Index p, Index q, 22 | JacobiRotation *j_left, 23 | JacobiRotation *j_right) 24 | { 25 | using std::sqrt; 26 | using std::abs; 27 | Matrix m; 28 | m << numext::real(matrix.coeff(p,p)), numext::real(matrix.coeff(p,q)), 29 | numext::real(matrix.coeff(q,p)), numext::real(matrix.coeff(q,q)); 30 | JacobiRotation rot1; 31 | RealScalar t = m.coeff(0,0) + m.coeff(1,1); 32 | RealScalar d = m.coeff(1,0) - m.coeff(0,1); 33 | 34 | if(abs(d) < (std::numeric_limits::min)()) 35 | { 36 | rot1.s() = RealScalar(0); 37 | rot1.c() = RealScalar(1); 38 | } 39 | else 40 | { 41 | // If d!=0, then t/d cannot overflow because the magnitude of the 42 | // entries forming d are not too small compared to the ones forming t. 43 | RealScalar u = t / d; 44 | RealScalar tmp = sqrt(RealScalar(1) + numext::abs2(u)); 45 | rot1.s() = RealScalar(1) / tmp; 46 | rot1.c() = u / tmp; 47 | } 48 | m.applyOnTheLeft(0,1,rot1); 49 | j_right->makeJacobi(m,0,1); 50 | *j_left = rot1 * j_right->transpose(); 51 | } 52 | 53 | } // end namespace internal 54 | 55 | } // end namespace Eigen 56 | 57 | #endif // EIGEN_REALSVD2X2_H 58 | -------------------------------------------------------------------------------- /src/tinympc/codegen/codegen_src/include/Eigen/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 | -------------------------------------------------------------------------------- /src/tinympc/codegen/codegen_src/include/Eigen/Eigen/src/plugins/InternalHeaderCheck.h: -------------------------------------------------------------------------------- 1 | #ifndef EIGEN_CORE_MODULE_H 2 | #error "Please include Eigen/plugins instead of including headers inside the src directory directly." 3 | #endif 4 | -------------------------------------------------------------------------------- /src/tinympc/codegen/codegen_src/include/tinympc/admm.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "types.hpp" 4 | 5 | #ifdef __cplusplus 6 | extern "C" { 7 | #endif 8 | 9 | int solve(TinySolver *solver); 10 | 11 | void update_primal(TinySolver *solver); 12 | void backward_pass_grad(TinySolver *solver); 13 | void forward_pass(TinySolver *solver); 14 | void update_slack(TinySolver *solver); 15 | void update_dual(TinySolver *solver); 16 | void update_linear_cost(TinySolver *solver); 17 | bool termination_condition(TinySolver *solver); 18 | 19 | #ifdef __cplusplus 20 | } 21 | #endif -------------------------------------------------------------------------------- /src/tinympc/codegen/codegen_src/include/tinympc/codegen.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "types.hpp" 4 | 5 | #ifdef __cplusplus 6 | extern "C" { 7 | #endif 8 | 9 | int tiny_codegen(TinySolver* solver, const char* output_dir, int verbose); 10 | 11 | int codegen_create_directories(const char* output_dir, int verbose); 12 | int codegen_data_header(const char* output_dir, int verbose); 13 | int codegen_data_source(TinySolver* solver, const char* output_dir, int verbose); 14 | int codegen_example(const char* output_dir, int verbose); 15 | 16 | 17 | #ifdef __cplusplus 18 | } 19 | #endif -------------------------------------------------------------------------------- /src/tinympc/codegen/codegen_src/include/tinympc/error.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #ifdef __cplusplus 4 | extern "C" { 5 | #endif 6 | 7 | #include 8 | #include 9 | #include 10 | #include 11 | 12 | // #if defined(__linux__) || defined(__unix__)// Check if Linux 13 | // #include 14 | // #define ERROR_MSG(exit_code, format, ...) error(exit_code, errno, format, ##__VA_ARGS__) 15 | 16 | // #elif defined(__APPLE__) || defined(__MACH__) // Check if macOS 17 | #define ERROR_MSG(exit_code, format, ...) \ 18 | { \ 19 | fprintf(stderr, format ": %s\n", ##__VA_ARGS__, strerror(errno)); \ 20 | exit(exit_code); \ 21 | } 22 | 23 | // #else 24 | // #error "Unsupported operating system" 25 | // #endif 26 | 27 | #ifdef __cplusplus 28 | } 29 | #endif -------------------------------------------------------------------------------- /src/tinympc/codegen/codegen_src/include/tinympc/rho_benchmark.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include "types.hpp" 4 | 5 | struct RhoAdapter { 6 | tinytype rho_min; 7 | tinytype rho_max; 8 | bool clip; 9 | bool matrices_initialized; 10 | 11 | // Pre-allocated matrices for formatting 12 | tinyMatrix A_matrix; 13 | tinyMatrix z_vector; 14 | tinyMatrix y_vector; 15 | tinyMatrix x_decision; 16 | tinyMatrix P_matrix; 17 | tinyMatrix q_vector; 18 | 19 | // Pre-allocated matrices for residual computation 20 | tinyMatrix Ax_vector; 21 | tinyMatrix r_prim_vector; 22 | tinyMatrix r_dual_vector; 23 | tinyMatrix Px_vector; 24 | tinyMatrix ATy_vector; 25 | 26 | // Dimensions 27 | int format_nx; 28 | int format_nu; 29 | int format_N; 30 | }; 31 | 32 | struct RhoBenchmarkResult { 33 | uint32_t time_us; 34 | tinytype initial_rho; 35 | tinytype final_rho; 36 | tinytype pri_res; 37 | tinytype dual_res; 38 | tinytype pri_norm; 39 | tinytype dual_norm; 40 | }; 41 | 42 | // Initialize matrices for formatting 43 | void initialize_format_matrices(RhoAdapter* adapter, int nx, int nu, int N); 44 | 45 | // Format matrices for residual computation 46 | void format_matrices( 47 | RhoAdapter* adapter, 48 | const tinyMatrix& x_prev, 49 | const tinyMatrix& u_prev, 50 | const tinyMatrix& v_prev, 51 | const tinyMatrix& z_prev, 52 | const tinyMatrix& g_prev, 53 | const tinyMatrix& y_prev, 54 | TinyCache* cache, 55 | TinyWorkspace* work, 56 | int N 57 | ); 58 | 59 | // Compute residuals 60 | void compute_residuals( 61 | RhoAdapter* adapter, 62 | tinytype* pri_res, 63 | tinytype* dual_res, 64 | tinytype* pri_norm, 65 | tinytype* dual_norm 66 | ); 67 | 68 | // Predict new rho value 69 | tinytype predict_rho( 70 | RhoAdapter* adapter, 71 | tinytype pri_res, 72 | tinytype dual_res, 73 | tinytype pri_norm, 74 | tinytype dual_norm, 75 | tinytype current_rho 76 | ); 77 | 78 | // Update matrices using derivatives 79 | void update_matrices_with_derivatives(TinyCache* cache, tinytype new_rho); 80 | 81 | 82 | // Main benchmark function 83 | void benchmark_rho_adaptation( 84 | RhoAdapter* adapter, 85 | const tinyMatrix& x_prev, 86 | const tinyMatrix& u_prev, 87 | const tinyMatrix& v_prev, 88 | const tinyMatrix& z_prev, 89 | const tinyMatrix& g_prev, 90 | const tinyMatrix& y_prev, 91 | TinyCache* cache, 92 | TinyWorkspace* work, 93 | int N, 94 | RhoBenchmarkResult* result 95 | ); -------------------------------------------------------------------------------- /src/tinympc/codegen/codegen_src/include/tinympc/tiny_api.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include "admm.hpp" 5 | 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | int tiny_setup(TinySolver** solverp, 11 | tinyMatrix Adyn, tinyMatrix Bdyn, tinyMatrix Q, tinyMatrix R, 12 | tinytype rho, int nx, int nu, int N, 13 | tinyMatrix x_min, tinyMatrix x_max, tinyMatrix u_min, tinyMatrix u_max, 14 | int verbose); 15 | int tiny_precompute_and_set_cache(TinyCache *cache, 16 | tinyMatrix Adyn, tinyMatrix Bdyn, tinyMatrix Q, tinyMatrix R, 17 | int nx, int nu, tinytype rho, int verbose); 18 | 19 | void compute_sensitivity_matrices(TinyCache *cache, 20 | tinyMatrix Adyn, tinyMatrix Bdyn, tinyMatrix Q, tinyMatrix R, 21 | int nx, int nu, tinytype rho, int verbose); 22 | 23 | int tiny_update_matrices_with_derivatives(TinyCache *cache, tinytype delta_rho); 24 | int tiny_solve(TinySolver *solver); 25 | 26 | int tiny_update_settings(TinySettings* settings, 27 | tinytype abs_pri_tol, tinytype abs_dua_tol, 28 | int max_iter, int check_termination, 29 | int en_state_bound, int en_input_bound); 30 | int tiny_set_default_settings(TinySettings* settings); 31 | 32 | int tiny_set_x0(TinySolver* solver, tinyVector x0); 33 | int tiny_set_x_ref(TinySolver* solver, tinyMatrix x_ref); 34 | int tiny_set_u_ref(TinySolver* solver, tinyMatrix u_ref); 35 | 36 | /** 37 | * Initialize sensitivity matrices for adaptive rho 38 | * 39 | * @param solver Pointer to solver 40 | */ 41 | void tiny_initialize_sensitivity_matrices(TinySolver *solver); 42 | 43 | #ifdef __cplusplus 44 | } 45 | #endif -------------------------------------------------------------------------------- /src/tinympc/codegen/codegen_src/include/tinympc/tiny_api_constants.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | 4 | // Default settings 5 | #define TINY_DEFAULT_ABS_PRI_TOL (1e-03) 6 | #define TINY_DEFAULT_ABS_DUA_TOL (1e-03) 7 | #define TINY_DEFAULT_MAX_ITER (1000) 8 | #define TINY_DEFAULT_CHECK_TERMINATION (1) 9 | #define TINY_DEFAULT_EN_STATE_BOUND (1) 10 | #define TINY_DEFAULT_EN_INPUT_BOUND (1) 11 | -------------------------------------------------------------------------------- /src/tinympc/codegen/codegen_src/tinympc/admm.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "types.hpp" 4 | 5 | #ifdef __cplusplus 6 | extern "C" { 7 | #endif 8 | 9 | int solve(TinySolver *solver); 10 | 11 | void update_primal(TinySolver *solver); 12 | void backward_pass_grad(TinySolver *solver); 13 | void forward_pass(TinySolver *solver); 14 | void update_slack(TinySolver *solver); 15 | void update_dual(TinySolver *solver); 16 | void update_linear_cost(TinySolver *solver); 17 | bool termination_condition(TinySolver *solver); 18 | 19 | #ifdef __cplusplus 20 | } 21 | #endif -------------------------------------------------------------------------------- /src/tinympc/codegen/codegen_src/tinympc/codegen.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "types.hpp" 4 | 5 | #ifdef __cplusplus 6 | extern "C" { 7 | #endif 8 | 9 | int tiny_codegen(TinySolver* solver, const char* output_dir, int verbose); 10 | 11 | int codegen_create_directories(const char* output_dir, int verbose); 12 | int codegen_data_header(const char* output_dir, int verbose); 13 | int codegen_data_source(TinySolver* solver, const char* output_dir, int verbose); 14 | int codegen_example(const char* output_dir, int verbose); 15 | 16 | 17 | #ifdef __cplusplus 18 | } 19 | #endif -------------------------------------------------------------------------------- /src/tinympc/codegen/codegen_src/tinympc/error.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #ifdef __cplusplus 4 | extern "C" { 5 | #endif 6 | 7 | #include 8 | #include 9 | #include 10 | #include 11 | 12 | // #if defined(__linux__) || defined(__unix__)// Check if Linux 13 | // #include 14 | // #define ERROR_MSG(exit_code, format, ...) error(exit_code, errno, format, ##__VA_ARGS__) 15 | 16 | // #elif defined(__APPLE__) || defined(__MACH__) // Check if macOS 17 | #define ERROR_MSG(exit_code, format, ...) \ 18 | { \ 19 | fprintf(stderr, format ": %s\n", ##__VA_ARGS__, strerror(errno)); \ 20 | exit(exit_code); \ 21 | } 22 | 23 | // #else 24 | // #error "Unsupported operating system" 25 | // #endif 26 | 27 | #ifdef __cplusplus 28 | } 29 | #endif -------------------------------------------------------------------------------- /src/tinympc/codegen/codegen_src/tinympc/rho_benchmark.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include "types.hpp" 4 | 5 | struct RhoAdapter { 6 | tinytype rho_min; 7 | tinytype rho_max; 8 | bool clip; 9 | bool matrices_initialized; 10 | 11 | // Pre-allocated matrices for formatting 12 | tinyMatrix A_matrix; 13 | tinyMatrix z_vector; 14 | tinyMatrix y_vector; 15 | tinyMatrix x_decision; 16 | tinyMatrix P_matrix; 17 | tinyMatrix q_vector; 18 | 19 | // Pre-allocated matrices for residual computation 20 | tinyMatrix Ax_vector; 21 | tinyMatrix r_prim_vector; 22 | tinyMatrix r_dual_vector; 23 | tinyMatrix Px_vector; 24 | tinyMatrix ATy_vector; 25 | 26 | // Dimensions 27 | int format_nx; 28 | int format_nu; 29 | int format_N; 30 | }; 31 | 32 | struct RhoBenchmarkResult { 33 | uint32_t time_us; 34 | tinytype initial_rho; 35 | tinytype final_rho; 36 | tinytype pri_res; 37 | tinytype dual_res; 38 | tinytype pri_norm; 39 | tinytype dual_norm; 40 | }; 41 | 42 | // Initialize matrices for formatting 43 | void initialize_format_matrices(RhoAdapter* adapter, int nx, int nu, int N); 44 | 45 | // Format matrices for residual computation 46 | void format_matrices( 47 | RhoAdapter* adapter, 48 | const tinyMatrix& x_prev, 49 | const tinyMatrix& u_prev, 50 | const tinyMatrix& v_prev, 51 | const tinyMatrix& z_prev, 52 | const tinyMatrix& g_prev, 53 | const tinyMatrix& y_prev, 54 | TinyCache* cache, 55 | TinyWorkspace* work, 56 | int N 57 | ); 58 | 59 | // Compute residuals 60 | void compute_residuals( 61 | RhoAdapter* adapter, 62 | tinytype* pri_res, 63 | tinytype* dual_res, 64 | tinytype* pri_norm, 65 | tinytype* dual_norm 66 | ); 67 | 68 | // Predict new rho value 69 | tinytype predict_rho( 70 | RhoAdapter* adapter, 71 | tinytype pri_res, 72 | tinytype dual_res, 73 | tinytype pri_norm, 74 | tinytype dual_norm, 75 | tinytype current_rho 76 | ); 77 | 78 | // Update matrices using derivatives 79 | void update_matrices_with_derivatives(TinyCache* cache, tinytype new_rho); 80 | 81 | 82 | // Main benchmark function 83 | void benchmark_rho_adaptation( 84 | RhoAdapter* adapter, 85 | const tinyMatrix& x_prev, 86 | const tinyMatrix& u_prev, 87 | const tinyMatrix& v_prev, 88 | const tinyMatrix& z_prev, 89 | const tinyMatrix& g_prev, 90 | const tinyMatrix& y_prev, 91 | TinyCache* cache, 92 | TinyWorkspace* work, 93 | int N, 94 | RhoBenchmarkResult* result 95 | ); -------------------------------------------------------------------------------- /src/tinympc/codegen/codegen_src/tinympc/tiny_api.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include "admm.hpp" 5 | 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | int tiny_setup(TinySolver** solverp, 11 | tinyMatrix Adyn, tinyMatrix Bdyn, tinyMatrix Q, tinyMatrix R, 12 | tinytype rho, int nx, int nu, int N, 13 | tinyMatrix x_min, tinyMatrix x_max, tinyMatrix u_min, tinyMatrix u_max, 14 | int verbose); 15 | int tiny_precompute_and_set_cache(TinyCache *cache, 16 | tinyMatrix Adyn, tinyMatrix Bdyn, tinyMatrix Q, tinyMatrix R, 17 | int nx, int nu, tinytype rho, int verbose); 18 | 19 | void compute_sensitivity_matrices(TinyCache *cache, 20 | tinyMatrix Adyn, tinyMatrix Bdyn, tinyMatrix Q, tinyMatrix R, 21 | int nx, int nu, tinytype rho, int verbose); 22 | 23 | int tiny_update_matrices_with_derivatives(TinyCache *cache, tinytype delta_rho); 24 | int tiny_solve(TinySolver *solver); 25 | 26 | int tiny_update_settings(TinySettings* settings, 27 | tinytype abs_pri_tol, tinytype abs_dua_tol, 28 | int max_iter, int check_termination, 29 | int en_state_bound, int en_input_bound); 30 | int tiny_set_default_settings(TinySettings* settings); 31 | 32 | int tiny_set_x0(TinySolver* solver, tinyVector x0); 33 | int tiny_set_x_ref(TinySolver* solver, tinyMatrix x_ref); 34 | int tiny_set_u_ref(TinySolver* solver, tinyMatrix u_ref); 35 | 36 | /** 37 | * Initialize sensitivity matrices for adaptive rho 38 | * 39 | * @param solver Pointer to solver 40 | */ 41 | void tiny_initialize_sensitivity_matrices(TinySolver *solver); 42 | 43 | #ifdef __cplusplus 44 | } 45 | #endif -------------------------------------------------------------------------------- /src/tinympc/codegen/codegen_src/tinympc/tiny_api_constants.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | 4 | // Default settings 5 | #define TINY_DEFAULT_ABS_PRI_TOL (1e-03) 6 | #define TINY_DEFAULT_ABS_DUA_TOL (1e-03) 7 | #define TINY_DEFAULT_MAX_ITER (1000) 8 | #define TINY_DEFAULT_CHECK_TERMINATION (1) 9 | #define TINY_DEFAULT_EN_STATE_BOUND (1) 10 | #define TINY_DEFAULT_EN_INPUT_BOUND (1) 11 | -------------------------------------------------------------------------------- /src/tinympc/codegen/pywrapper/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.15) 2 | project(tinympc_codegen_ext) 3 | 4 | set(CMAKE_POSITION_INDEPENDENT_CODE ON) # -fPIC 5 | 6 | # Add Eigen include directories 7 | include_directories( 8 | ${CMAKE_CURRENT_SOURCE_DIR}/include 9 | ${CMAKE_CURRENT_SOURCE_DIR}/include/Eigen 10 | ${CMAKE_CURRENT_SOURCE_DIR}/tinympc 11 | ) 12 | 13 | # Instead of using GLOB which might not find any files, 14 | # explicitly include the source files we know should be there 15 | set(TINY_SOURCES 16 | ${CMAKE_CURRENT_SOURCE_DIR}/src/tiny_data.cpp 17 | ${CMAKE_CURRENT_SOURCE_DIR}/tinympc/admm.cpp 18 | ${CMAKE_CURRENT_SOURCE_DIR}/tinympc/tiny_api.cpp 19 | ${CMAKE_CURRENT_SOURCE_DIR}/tinympc/rho_benchmark.cpp 20 | ) 21 | 22 | # Create tinympc library 23 | add_library(tinympcstatic STATIC ${TINY_SOURCES}) 24 | target_include_directories(tinympcstatic PUBLIC 25 | ${CMAKE_CURRENT_SOURCE_DIR} 26 | ${CMAKE_CURRENT_SOURCE_DIR}/include 27 | ${CMAKE_CURRENT_SOURCE_DIR}/include/Eigen 28 | ${CMAKE_CURRENT_SOURCE_DIR}/tinympc 29 | ) 30 | 31 | # Create example main executable 32 | add_executable(tiny_codegen_example src/tiny_main.cpp src/tiny_data.cpp) 33 | target_include_directories(tiny_codegen_example PUBLIC 34 | ${CMAKE_CURRENT_SOURCE_DIR}/include 35 | ${CMAKE_CURRENT_SOURCE_DIR}/include/Eigen 36 | ${CMAKE_CURRENT_SOURCE_DIR}/tinympc 37 | ) 38 | target_link_libraries(tiny_codegen_example LINK_PUBLIC tinympcstatic) 39 | 40 | # Create python module 41 | include(FetchContent) 42 | FetchContent_Declare( 43 | pybind11 44 | GIT_REPOSITORY https://github.com/pybind/pybind11.git) 45 | FetchContent_MakeAvailable(pybind11) 46 | 47 | # Define extension sources explicitly 48 | set(EXT_SOURCES 49 | ${CMAKE_CURRENT_SOURCE_DIR}/src/tiny_data.cpp 50 | ${CMAKE_CURRENT_SOURCE_DIR}/tinympc/admm.cpp 51 | ${CMAKE_CURRENT_SOURCE_DIR}/tinympc/tiny_api.cpp 52 | ${CMAKE_CURRENT_SOURCE_DIR}/tinympc/rho_benchmark.cpp 53 | ${CMAKE_CURRENT_SOURCE_DIR}/bindings.cpp 54 | ) 55 | 56 | pybind11_add_module(tinympcgen ${EXT_SOURCES}) 57 | target_include_directories(tinympcgen PUBLIC 58 | ${CMAKE_CURRENT_SOURCE_DIR}/include 59 | ${CMAKE_CURRENT_SOURCE_DIR}/include/Eigen 60 | ${CMAKE_CURRENT_SOURCE_DIR}/tinympc 61 | ) 62 | target_link_libraries(tinympcgen PUBLIC pybind11::module tinympcstatic) 63 | -------------------------------------------------------------------------------- /src/tinympc/codegen/pywrapper/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TinyMPC/tinympc-python/32d3861aefcbd7fafaf44e66870fd76fef923c5b/src/tinympc/codegen/pywrapper/__init__.py -------------------------------------------------------------------------------- /src/tinympc/codegen/pywrapper/bindings.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | namespace py = pybind11; 7 | using namespace pybind11::literals; 8 | 9 | #include 10 | #include 11 | 12 | py::dict solve_() { 13 | py::gil_scoped_release release; 14 | int status = tiny_solve(&tiny_solver); 15 | py::gil_scoped_acquire acquire; 16 | 17 | py::dict results("states_all"_a=tiny_solver.solution->x.transpose(), 18 | "controls_all"_a=tiny_solver.solution->u.transpose(), 19 | "controls"_a=tiny_solver.solution->u.col(0)); 20 | return results; 21 | } 22 | 23 | void set_x0(Eigen::Ref x0) { 24 | if (x0.rows() == tiny_solver.work->nx && x0.cols() == 1) { 25 | tiny_set_x0(&tiny_solver, x0.replicate(1, tiny_solver.work->N)); 26 | } else { 27 | throw std::invalid_argument("Check the size of x0. Expected a vector with length equal to the number of states in the system."); 28 | } 29 | } 30 | 31 | void set_x_ref(Eigen::Ref x_ref) { 32 | if (x_ref.rows() == tiny_solver.work->nx && x_ref.cols() == 1) { 33 | tiny_set_x_ref(&tiny_solver, x_ref.replicate(1, tiny_solver.work->N)); 34 | } else if (x_ref.cols() == 1) { 35 | throw std::invalid_argument("Check the size of x_ref. Expected a vector with length equal to the number of states in the system."); 36 | } else if (x_ref.rows() == tiny_solver.work->nx && x_ref.cols() == tiny_solver.work->N) { 37 | tiny_set_x_ref(&tiny_solver, x_ref); 38 | } else { 39 | throw std::invalid_argument("Check the size of x_ref. Expected a matrix with shape num states x horizon length."); 40 | } 41 | } 42 | 43 | void set_u_ref(Eigen::Ref u_ref) { 44 | if (u_ref.rows() == tiny_solver.work->nu && u_ref.cols() == 1) { 45 | tiny_set_u_ref(&tiny_solver, u_ref.replicate(1, tiny_solver.work->N-1)); 46 | } else if (u_ref.cols() == 1) { 47 | throw std::invalid_argument("Check the size of u_ref. Expected a vector with length equal to the number of inputs in the system."); 48 | } else if (u_ref.rows() == tiny_solver.work->nu && u_ref.cols() == tiny_solver.work->N-1) { 49 | tiny_set_u_ref(&tiny_solver, u_ref); 50 | } else { 51 | throw std::invalid_argument("Check the size of u_ref. Expected a matrix with shape num inputs x horizon length - 1."); 52 | } 53 | } 54 | 55 | PYBIND11_MODULE(tinympcgen, m) { 56 | m.def("solve", &solve_); 57 | m.def("set_x0", &set_x0); 58 | m.def("set_x_ref", &set_x_ref); 59 | m.def("set_u_ref", &set_u_ref); 60 | } 61 | -------------------------------------------------------------------------------- /src/tinympc/codegen/pywrapper/setup.py: -------------------------------------------------------------------------------- 1 | import os 2 | import shutil 3 | import sys 4 | from platform import system 5 | from subprocess import check_call 6 | 7 | from setuptools import setup, Extension 8 | from setuptools.command.build_ext import build_ext 9 | 10 | 11 | class CMakeExtension(Extension): 12 | def __init__(self, name, cmake_args=None): 13 | Extension.__init__(self, name, sources=[]) 14 | self.cmake_args = cmake_args 15 | 16 | 17 | class CmdCMakeBuild(build_ext): 18 | def build_extension(self, ext): 19 | extdir = os.path.abspath(os.path.dirname(self.get_ext_fullpath(ext.name))) 20 | this_dir = os.path.abspath(os.path.dirname(__file__)) 21 | cmake_args = [ 22 | f'-DCMAKE_LIBRARY_OUTPUT_DIRECTORY={extdir}', 23 | f'-DPYTHON_EXECUTABLE={sys.executable}', 24 | ] 25 | 26 | build_args = [] 27 | cfg = 'Debug' if self.debug else 'Release' 28 | 29 | if system() != "Darwin": 30 | build_args += [f'--config={cfg}'] 31 | 32 | if system() == "Windows": 33 | cmake_args += ['-G', 'Visual Studio 17 2022'] 34 | cmake_args += ['-DCMAKE_LIBRARY_OUTPUT_DIRECTORY_{}={}'.format(cfg.upper(), extdir)] 35 | if sys.maxsize > 2 ** 32: 36 | cmake_args += ['-A', 'x64'] 37 | build_args += ['--', '/m'] 38 | else: 39 | cmake_args += ['-DCMAKE_BUILD_TYPE=' + cfg] 40 | build_args += ['--', '-j2'] 41 | 42 | if os.path.exists(self.build_temp): 43 | shutil.rmtree(self.build_temp) 44 | os.makedirs(self.build_temp) 45 | 46 | if ext.cmake_args is not None: 47 | cmake_args.extend(ext.cmake_args) 48 | 49 | check_call(['cmake', this_dir] + cmake_args, cwd=self.build_temp) 50 | check_call(['cmake', '--build', '.'] + build_args, cwd=self.build_temp) 51 | 52 | 53 | setup( 54 | name='tiny_codegen_ext', 55 | author='Sam Schoedel, Khai Nguyen', 56 | author_email='seschoedel@gmail.com', 57 | description='TinyMPC python module for generated code', 58 | license='MIT', 59 | url="https://tinympc.org/", 60 | 61 | python_requires='>=3.7', 62 | setup_requires=["numpy >= 1.7"], 63 | install_requires=["numpy >= 1.7"], 64 | 65 | ext_modules=[CMakeExtension('tinympcgen')], 66 | cmdclass={'build_ext': CmdCMakeBuild}, 67 | zip_safe=False 68 | ) 69 | -------------------------------------------------------------------------------- /tests/test_cache.py: -------------------------------------------------------------------------------- 1 | import tinympc 2 | import numpy as np 3 | 4 | A = np.array([[1.0, 0.01, 0.0, 0.0], 5 | [0.0, 1.0, 0.039, 0.0], 6 | [0.0, 0.0, 1.002, 0.01], 7 | [0.0, 0.0, 0.458, 1.002]]) 8 | B = np.array([[0.0 ], 9 | [0.02 ], 10 | [0.0 ], 11 | [0.067]]) 12 | Q = np.diag([10.0, 1, 10, 1]) 13 | R = np.diag([1.0]) 14 | 15 | N = 2 16 | 17 | intf = tinympc.TinyMPC() 18 | 19 | intf.setup(A, B, Q, R, N) -------------------------------------------------------------------------------- /tests/test_cartpole_codegen.py: -------------------------------------------------------------------------------- 1 | import os 2 | import sys 3 | import shutil 4 | import tempfile 5 | import unittest 6 | import numpy as np 7 | import tinympc 8 | 9 | # Import the example code setup 10 | sys.path.append(os.path.join(os.path.dirname(__file__), '..', 'examples')) 11 | from cartpole_example_code_generation import A, B, Q, R, N, u_min, u_max 12 | 13 | class TestCodeGeneration(unittest.TestCase): 14 | def setUp(self): 15 | """Set up test cases""" 16 | self.test_dir = tempfile.mkdtemp() 17 | 18 | # Initialize MPC using the example setup 19 | self.prob = tinympc.TinyMPC() 20 | self.prob.setup(A, B, Q, R, N, rho=1, max_iter=10, u_min=u_min, u_max=u_max) 21 | 22 | def tearDown(self): 23 | """Clean up after tests""" 24 | if os.path.exists(self.test_dir): 25 | shutil.rmtree(self.test_dir) 26 | 27 | def test_codegen_files_created(self): 28 | """Test if code generation creates all necessary files""" 29 | self.prob.codegen(self.test_dir, verbose=1) 30 | 31 | # Check essential files 32 | expected_files = [ 33 | "CMakeLists.txt", 34 | "setup.py", 35 | "bindings.cpp", 36 | "src/tiny_main.cpp", 37 | "src/tiny_data.cpp", 38 | "tinympc/tiny_data.hpp" 39 | ] 40 | 41 | for file in expected_files: 42 | path = os.path.join(self.test_dir, file) 43 | self.assertTrue(os.path.exists(path), f"Missing file: {file}") 44 | 45 | def test_codegen_build(self): 46 | """Test if generated code can be built""" 47 | self.prob.codegen(self.test_dir, verbose=1) 48 | 49 | try: 50 | cwd = os.getcwd() 51 | os.chdir(self.test_dir) 52 | 53 | # Attempt to build using python3 explicitly 54 | result = os.system("python3 setup.py build_ext --inplace") 55 | self.assertEqual(result, 0, "Build failed") 56 | 57 | # Check for built module 58 | built_files = os.listdir(".") 59 | module_exists = any(f.startswith("tinympcgen") and 60 | (f.endswith(".so") or f.endswith(".pyd")) 61 | for f in built_files) 62 | self.assertTrue(module_exists, "Built module not found") 63 | 64 | finally: 65 | os.chdir(cwd) 66 | 67 | def test_codegen_import(self): 68 | """Test if generated code can be imported and used""" 69 | self.prob.codegen(self.test_dir, verbose=1) 70 | 71 | try: 72 | cwd = os.getcwd() 73 | os.chdir(self.test_dir) 74 | 75 | # Build using python3 explicitly 76 | os.system("python3 setup.py build_ext --inplace") 77 | 78 | # Try importing 79 | sys.path.insert(0, self.test_dir) 80 | import tinympcgen 81 | 82 | # Test basic functionality using same initial state as other examples 83 | x0 = np.array([0.5, 0, 0, 0]) 84 | tinympcgen.set_x0(x0) 85 | solution = tinympcgen.solve() 86 | 87 | self.assertIsInstance(solution, dict) 88 | self.assertIn("controls", solution) 89 | self.assertIn("states_all", solution) 90 | 91 | finally: 92 | os.chdir(cwd) 93 | if "tinympcgen" in sys.modules: 94 | del sys.modules["tinympcgen"] 95 | if self.test_dir in sys.path: 96 | sys.path.remove(self.test_dir) 97 | 98 | if __name__ == '__main__': 99 | unittest.main() -------------------------------------------------------------------------------- /tests/test_settings.py: -------------------------------------------------------------------------------- 1 | import tinympc 2 | import numpy as np 3 | 4 | A = np.array([[1.0, 0.01, 0.0, 0.0], 5 | [0.0, 1.0, 0.039, 0.0], 6 | [0.0, 0.0, 1.002, 0.01], 7 | [0.0, 0.0, 0.458, 1.002]]) 8 | B = np.array([[0.0 ], 9 | [0.02 ], 10 | [0.0 ], 11 | [0.067]]) 12 | Q = np.diag([10.0, 1, 10, 1]) 13 | R = np.diag([1.0]) 14 | 15 | N = 2 16 | 17 | intf = tinympc.TinyMPC() 18 | 19 | intf.setup(A, B, Q, R, N, abs_pri_tol=5) --------------------------------------------------------------------------------