qilisdk 0.1.8__cp312-cp312-manylinux_2_28_x86_64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- include/eigen3/Eigen/Cholesky +45 -0
- include/eigen3/Eigen/CholmodSupport +48 -0
- include/eigen3/Eigen/Core +384 -0
- include/eigen3/Eigen/Dense +7 -0
- include/eigen3/Eigen/Eigen +2 -0
- include/eigen3/Eigen/Eigenvalues +60 -0
- include/eigen3/Eigen/Geometry +59 -0
- include/eigen3/Eigen/Householder +29 -0
- include/eigen3/Eigen/IterativeLinearSolvers +48 -0
- include/eigen3/Eigen/Jacobi +32 -0
- include/eigen3/Eigen/KLUSupport +41 -0
- include/eigen3/Eigen/LU +47 -0
- include/eigen3/Eigen/MetisSupport +35 -0
- include/eigen3/Eigen/OrderingMethods +70 -0
- include/eigen3/Eigen/PaStiXSupport +49 -0
- include/eigen3/Eigen/PardisoSupport +35 -0
- include/eigen3/Eigen/QR +50 -0
- include/eigen3/Eigen/QtAlignedMalloc +39 -0
- include/eigen3/Eigen/SPQRSupport +34 -0
- include/eigen3/Eigen/SVD +50 -0
- include/eigen3/Eigen/Sparse +34 -0
- include/eigen3/Eigen/SparseCholesky +37 -0
- include/eigen3/Eigen/SparseCore +69 -0
- include/eigen3/Eigen/SparseLU +50 -0
- include/eigen3/Eigen/SparseQR +36 -0
- include/eigen3/Eigen/StdDeque +27 -0
- include/eigen3/Eigen/StdList +26 -0
- include/eigen3/Eigen/StdVector +27 -0
- include/eigen3/Eigen/SuperLUSupport +64 -0
- include/eigen3/Eigen/UmfPackSupport +40 -0
- include/eigen3/Eigen/src/Cholesky/LDLT.h +688 -0
- include/eigen3/Eigen/src/Cholesky/LLT.h +558 -0
- include/eigen3/Eigen/src/Cholesky/LLT_LAPACKE.h +99 -0
- include/eigen3/Eigen/src/CholmodSupport/CholmodSupport.h +682 -0
- include/eigen3/Eigen/src/Core/ArithmeticSequence.h +413 -0
- include/eigen3/Eigen/src/Core/Array.h +417 -0
- include/eigen3/Eigen/src/Core/ArrayBase.h +226 -0
- include/eigen3/Eigen/src/Core/ArrayWrapper.h +209 -0
- include/eigen3/Eigen/src/Core/Assign.h +90 -0
- include/eigen3/Eigen/src/Core/AssignEvaluator.h +1010 -0
- include/eigen3/Eigen/src/Core/Assign_MKL.h +178 -0
- include/eigen3/Eigen/src/Core/BandMatrix.h +353 -0
- include/eigen3/Eigen/src/Core/Block.h +448 -0
- include/eigen3/Eigen/src/Core/BooleanRedux.h +162 -0
- include/eigen3/Eigen/src/Core/CommaInitializer.h +164 -0
- include/eigen3/Eigen/src/Core/ConditionEstimator.h +175 -0
- include/eigen3/Eigen/src/Core/CoreEvaluators.h +1741 -0
- include/eigen3/Eigen/src/Core/CoreIterators.h +132 -0
- include/eigen3/Eigen/src/Core/CwiseBinaryOp.h +183 -0
- include/eigen3/Eigen/src/Core/CwiseNullaryOp.h +1001 -0
- include/eigen3/Eigen/src/Core/CwiseTernaryOp.h +197 -0
- include/eigen3/Eigen/src/Core/CwiseUnaryOp.h +103 -0
- include/eigen3/Eigen/src/Core/CwiseUnaryView.h +132 -0
- include/eigen3/Eigen/src/Core/DenseBase.h +701 -0
- include/eigen3/Eigen/src/Core/DenseCoeffsBase.h +685 -0
- include/eigen3/Eigen/src/Core/DenseStorage.h +652 -0
- include/eigen3/Eigen/src/Core/Diagonal.h +258 -0
- include/eigen3/Eigen/src/Core/DiagonalMatrix.h +391 -0
- include/eigen3/Eigen/src/Core/DiagonalProduct.h +28 -0
- include/eigen3/Eigen/src/Core/Dot.h +318 -0
- include/eigen3/Eigen/src/Core/EigenBase.h +160 -0
- include/eigen3/Eigen/src/Core/ForceAlignedAccess.h +150 -0
- include/eigen3/Eigen/src/Core/Fuzzy.h +155 -0
- include/eigen3/Eigen/src/Core/GeneralProduct.h +465 -0
- include/eigen3/Eigen/src/Core/GenericPacketMath.h +1040 -0
- include/eigen3/Eigen/src/Core/GlobalFunctions.h +194 -0
- include/eigen3/Eigen/src/Core/IO.h +258 -0
- include/eigen3/Eigen/src/Core/IndexedView.h +237 -0
- include/eigen3/Eigen/src/Core/Inverse.h +117 -0
- include/eigen3/Eigen/src/Core/Map.h +171 -0
- include/eigen3/Eigen/src/Core/MapBase.h +310 -0
- include/eigen3/Eigen/src/Core/MathFunctions.h +2057 -0
- include/eigen3/Eigen/src/Core/MathFunctionsImpl.h +200 -0
- include/eigen3/Eigen/src/Core/Matrix.h +565 -0
- include/eigen3/Eigen/src/Core/MatrixBase.h +547 -0
- include/eigen3/Eigen/src/Core/NestByValue.h +85 -0
- include/eigen3/Eigen/src/Core/NoAlias.h +109 -0
- include/eigen3/Eigen/src/Core/NumTraits.h +335 -0
- include/eigen3/Eigen/src/Core/PartialReduxEvaluator.h +232 -0
- include/eigen3/Eigen/src/Core/PermutationMatrix.h +605 -0
- include/eigen3/Eigen/src/Core/PlainObjectBase.h +1128 -0
- include/eigen3/Eigen/src/Core/Product.h +191 -0
- include/eigen3/Eigen/src/Core/ProductEvaluators.h +1179 -0
- include/eigen3/Eigen/src/Core/Random.h +218 -0
- include/eigen3/Eigen/src/Core/Redux.h +515 -0
- include/eigen3/Eigen/src/Core/Ref.h +381 -0
- include/eigen3/Eigen/src/Core/Replicate.h +142 -0
- include/eigen3/Eigen/src/Core/Reshaped.h +454 -0
- include/eigen3/Eigen/src/Core/ReturnByValue.h +119 -0
- include/eigen3/Eigen/src/Core/Reverse.h +217 -0
- include/eigen3/Eigen/src/Core/Select.h +164 -0
- include/eigen3/Eigen/src/Core/SelfAdjointView.h +365 -0
- include/eigen3/Eigen/src/Core/SelfCwiseBinaryOp.h +47 -0
- include/eigen3/Eigen/src/Core/Solve.h +188 -0
- include/eigen3/Eigen/src/Core/SolveTriangular.h +235 -0
- include/eigen3/Eigen/src/Core/SolverBase.h +168 -0
- include/eigen3/Eigen/src/Core/StableNorm.h +251 -0
- include/eigen3/Eigen/src/Core/StlIterators.h +463 -0
- include/eigen3/Eigen/src/Core/Stride.h +116 -0
- include/eigen3/Eigen/src/Core/Swap.h +68 -0
- include/eigen3/Eigen/src/Core/Transpose.h +464 -0
- include/eigen3/Eigen/src/Core/Transpositions.h +386 -0
- include/eigen3/Eigen/src/Core/TriangularMatrix.h +1001 -0
- include/eigen3/Eigen/src/Core/VectorBlock.h +96 -0
- include/eigen3/Eigen/src/Core/VectorwiseOp.h +784 -0
- include/eigen3/Eigen/src/Core/Visitor.h +381 -0
- include/eigen3/Eigen/src/Core/arch/AVX/Complex.h +372 -0
- include/eigen3/Eigen/src/Core/arch/AVX/MathFunctions.h +228 -0
- include/eigen3/Eigen/src/Core/arch/AVX/PacketMath.h +1574 -0
- include/eigen3/Eigen/src/Core/arch/AVX/TypeCasting.h +115 -0
- include/eigen3/Eigen/src/Core/arch/AVX512/Complex.h +422 -0
- include/eigen3/Eigen/src/Core/arch/AVX512/MathFunctions.h +362 -0
- include/eigen3/Eigen/src/Core/arch/AVX512/PacketMath.h +2303 -0
- include/eigen3/Eigen/src/Core/arch/AVX512/TypeCasting.h +89 -0
- include/eigen3/Eigen/src/Core/arch/AltiVec/Complex.h +417 -0
- include/eigen3/Eigen/src/Core/arch/AltiVec/MathFunctions.h +90 -0
- include/eigen3/Eigen/src/Core/arch/AltiVec/MatrixProduct.h +2937 -0
- include/eigen3/Eigen/src/Core/arch/AltiVec/MatrixProductCommon.h +221 -0
- include/eigen3/Eigen/src/Core/arch/AltiVec/MatrixProductMMA.h +629 -0
- include/eigen3/Eigen/src/Core/arch/AltiVec/PacketMath.h +2711 -0
- include/eigen3/Eigen/src/Core/arch/CUDA/Complex.h +258 -0
- include/eigen3/Eigen/src/Core/arch/Default/BFloat16.h +700 -0
- include/eigen3/Eigen/src/Core/arch/Default/ConjHelper.h +117 -0
- include/eigen3/Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h +1649 -0
- include/eigen3/Eigen/src/Core/arch/Default/GenericPacketMathFunctionsFwd.h +110 -0
- include/eigen3/Eigen/src/Core/arch/Default/Half.h +942 -0
- include/eigen3/Eigen/src/Core/arch/Default/Settings.h +49 -0
- include/eigen3/Eigen/src/Core/arch/Default/TypeCasting.h +120 -0
- include/eigen3/Eigen/src/Core/arch/GPU/MathFunctions.h +103 -0
- include/eigen3/Eigen/src/Core/arch/GPU/PacketMath.h +1685 -0
- include/eigen3/Eigen/src/Core/arch/GPU/TypeCasting.h +80 -0
- include/eigen3/Eigen/src/Core/arch/HIP/hcc/math_constants.h +23 -0
- include/eigen3/Eigen/src/Core/arch/MSA/Complex.h +648 -0
- include/eigen3/Eigen/src/Core/arch/MSA/MathFunctions.h +387 -0
- include/eigen3/Eigen/src/Core/arch/MSA/PacketMath.h +1233 -0
- include/eigen3/Eigen/src/Core/arch/NEON/Complex.h +584 -0
- include/eigen3/Eigen/src/Core/arch/NEON/GeneralBlockPanelKernel.h +183 -0
- include/eigen3/Eigen/src/Core/arch/NEON/MathFunctions.h +75 -0
- include/eigen3/Eigen/src/Core/arch/NEON/PacketMath.h +4587 -0
- include/eigen3/Eigen/src/Core/arch/NEON/TypeCasting.h +1419 -0
- include/eigen3/Eigen/src/Core/arch/SSE/Complex.h +351 -0
- include/eigen3/Eigen/src/Core/arch/SSE/MathFunctions.h +199 -0
- include/eigen3/Eigen/src/Core/arch/SSE/PacketMath.h +1505 -0
- include/eigen3/Eigen/src/Core/arch/SSE/TypeCasting.h +142 -0
- include/eigen3/Eigen/src/Core/arch/SVE/MathFunctions.h +44 -0
- include/eigen3/Eigen/src/Core/arch/SVE/PacketMath.h +752 -0
- include/eigen3/Eigen/src/Core/arch/SVE/TypeCasting.h +49 -0
- include/eigen3/Eigen/src/Core/arch/SYCL/InteropHeaders.h +232 -0
- include/eigen3/Eigen/src/Core/arch/SYCL/MathFunctions.h +301 -0
- include/eigen3/Eigen/src/Core/arch/SYCL/PacketMath.h +670 -0
- include/eigen3/Eigen/src/Core/arch/SYCL/SyclMemoryModel.h +694 -0
- include/eigen3/Eigen/src/Core/arch/SYCL/TypeCasting.h +85 -0
- include/eigen3/Eigen/src/Core/arch/ZVector/Complex.h +426 -0
- include/eigen3/Eigen/src/Core/arch/ZVector/MathFunctions.h +233 -0
- include/eigen3/Eigen/src/Core/arch/ZVector/PacketMath.h +1060 -0
- include/eigen3/Eigen/src/Core/functors/AssignmentFunctors.h +177 -0
- include/eigen3/Eigen/src/Core/functors/BinaryFunctors.h +541 -0
- include/eigen3/Eigen/src/Core/functors/NullaryFunctors.h +189 -0
- include/eigen3/Eigen/src/Core/functors/StlFunctors.h +166 -0
- include/eigen3/Eigen/src/Core/functors/TernaryFunctors.h +25 -0
- include/eigen3/Eigen/src/Core/functors/UnaryFunctors.h +1131 -0
- include/eigen3/Eigen/src/Core/products/GeneralBlockPanelKernel.h +2645 -0
- include/eigen3/Eigen/src/Core/products/GeneralMatrixMatrix.h +517 -0
- include/eigen3/Eigen/src/Core/products/GeneralMatrixMatrixTriangular.h +317 -0
- include/eigen3/Eigen/src/Core/products/GeneralMatrixMatrixTriangular_BLAS.h +145 -0
- include/eigen3/Eigen/src/Core/products/GeneralMatrixMatrix_BLAS.h +124 -0
- include/eigen3/Eigen/src/Core/products/GeneralMatrixVector.h +518 -0
- include/eigen3/Eigen/src/Core/products/GeneralMatrixVector_BLAS.h +136 -0
- include/eigen3/Eigen/src/Core/products/Parallelizer.h +180 -0
- include/eigen3/Eigen/src/Core/products/SelfadjointMatrixMatrix.h +544 -0
- include/eigen3/Eigen/src/Core/products/SelfadjointMatrixMatrix_BLAS.h +295 -0
- include/eigen3/Eigen/src/Core/products/SelfadjointMatrixVector.h +262 -0
- include/eigen3/Eigen/src/Core/products/SelfadjointMatrixVector_BLAS.h +118 -0
- include/eigen3/Eigen/src/Core/products/SelfadjointProduct.h +133 -0
- include/eigen3/Eigen/src/Core/products/SelfadjointRank2Update.h +94 -0
- include/eigen3/Eigen/src/Core/products/TriangularMatrixMatrix.h +472 -0
- include/eigen3/Eigen/src/Core/products/TriangularMatrixMatrix_BLAS.h +317 -0
- include/eigen3/Eigen/src/Core/products/TriangularMatrixVector.h +350 -0
- include/eigen3/Eigen/src/Core/products/TriangularMatrixVector_BLAS.h +255 -0
- include/eigen3/Eigen/src/Core/products/TriangularSolverMatrix.h +337 -0
- include/eigen3/Eigen/src/Core/products/TriangularSolverMatrix_BLAS.h +167 -0
- include/eigen3/Eigen/src/Core/products/TriangularSolverVector.h +148 -0
- include/eigen3/Eigen/src/Core/util/BlasUtil.h +583 -0
- include/eigen3/Eigen/src/Core/util/ConfigureVectorization.h +512 -0
- include/eigen3/Eigen/src/Core/util/Constants.h +563 -0
- include/eigen3/Eigen/src/Core/util/DisableStupidWarnings.h +106 -0
- include/eigen3/Eigen/src/Core/util/ForwardDeclarations.h +322 -0
- include/eigen3/Eigen/src/Core/util/IndexedViewHelper.h +186 -0
- include/eigen3/Eigen/src/Core/util/IntegralConstant.h +272 -0
- include/eigen3/Eigen/src/Core/util/MKL_support.h +137 -0
- include/eigen3/Eigen/src/Core/util/Macros.h +1464 -0
- include/eigen3/Eigen/src/Core/util/Memory.h +1163 -0
- include/eigen3/Eigen/src/Core/util/Meta.h +812 -0
- include/eigen3/Eigen/src/Core/util/NonMPL2.h +3 -0
- include/eigen3/Eigen/src/Core/util/ReenableStupidWarnings.h +31 -0
- include/eigen3/Eigen/src/Core/util/ReshapedHelper.h +51 -0
- include/eigen3/Eigen/src/Core/util/StaticAssert.h +221 -0
- include/eigen3/Eigen/src/Core/util/SymbolicIndex.h +293 -0
- include/eigen3/Eigen/src/Core/util/XprHelper.h +856 -0
- include/eigen3/Eigen/src/Eigenvalues/ComplexEigenSolver.h +346 -0
- include/eigen3/Eigen/src/Eigenvalues/ComplexSchur.h +462 -0
- include/eigen3/Eigen/src/Eigenvalues/ComplexSchur_LAPACKE.h +91 -0
- include/eigen3/Eigen/src/Eigenvalues/EigenSolver.h +622 -0
- include/eigen3/Eigen/src/Eigenvalues/GeneralizedEigenSolver.h +418 -0
- include/eigen3/Eigen/src/Eigenvalues/GeneralizedSelfAdjointEigenSolver.h +226 -0
- include/eigen3/Eigen/src/Eigenvalues/HessenbergDecomposition.h +374 -0
- include/eigen3/Eigen/src/Eigenvalues/MatrixBaseEigenvalues.h +158 -0
- include/eigen3/Eigen/src/Eigenvalues/RealQZ.h +657 -0
- include/eigen3/Eigen/src/Eigenvalues/RealSchur.h +558 -0
- include/eigen3/Eigen/src/Eigenvalues/RealSchur_LAPACKE.h +77 -0
- include/eigen3/Eigen/src/Eigenvalues/SelfAdjointEigenSolver.h +904 -0
- include/eigen3/Eigen/src/Eigenvalues/SelfAdjointEigenSolver_LAPACKE.h +87 -0
- include/eigen3/Eigen/src/Eigenvalues/Tridiagonalization.h +561 -0
- include/eigen3/Eigen/src/Geometry/AlignedBox.h +486 -0
- include/eigen3/Eigen/src/Geometry/AngleAxis.h +247 -0
- include/eigen3/Eigen/src/Geometry/EulerAngles.h +114 -0
- include/eigen3/Eigen/src/Geometry/Homogeneous.h +501 -0
- include/eigen3/Eigen/src/Geometry/Hyperplane.h +282 -0
- include/eigen3/Eigen/src/Geometry/OrthoMethods.h +235 -0
- include/eigen3/Eigen/src/Geometry/ParametrizedLine.h +232 -0
- include/eigen3/Eigen/src/Geometry/Quaternion.h +870 -0
- include/eigen3/Eigen/src/Geometry/Rotation2D.h +199 -0
- include/eigen3/Eigen/src/Geometry/RotationBase.h +206 -0
- include/eigen3/Eigen/src/Geometry/Scaling.h +188 -0
- include/eigen3/Eigen/src/Geometry/Transform.h +1563 -0
- include/eigen3/Eigen/src/Geometry/Translation.h +202 -0
- include/eigen3/Eigen/src/Geometry/Umeyama.h +166 -0
- include/eigen3/Eigen/src/Geometry/arch/Geometry_SIMD.h +168 -0
- include/eigen3/Eigen/src/Householder/BlockHouseholder.h +110 -0
- include/eigen3/Eigen/src/Householder/Householder.h +176 -0
- include/eigen3/Eigen/src/Householder/HouseholderSequence.h +545 -0
- include/eigen3/Eigen/src/IterativeLinearSolvers/BasicPreconditioners.h +226 -0
- include/eigen3/Eigen/src/IterativeLinearSolvers/BiCGSTAB.h +212 -0
- include/eigen3/Eigen/src/IterativeLinearSolvers/ConjugateGradient.h +229 -0
- include/eigen3/Eigen/src/IterativeLinearSolvers/IncompleteCholesky.h +394 -0
- include/eigen3/Eigen/src/IterativeLinearSolvers/IncompleteLUT.h +453 -0
- include/eigen3/Eigen/src/IterativeLinearSolvers/IterativeSolverBase.h +444 -0
- include/eigen3/Eigen/src/IterativeLinearSolvers/LeastSquareConjugateGradient.h +198 -0
- include/eigen3/Eigen/src/IterativeLinearSolvers/SolveWithGuess.h +117 -0
- include/eigen3/Eigen/src/Jacobi/Jacobi.h +483 -0
- include/eigen3/Eigen/src/KLUSupport/KLUSupport.h +358 -0
- include/eigen3/Eigen/src/LU/Determinant.h +117 -0
- include/eigen3/Eigen/src/LU/FullPivLU.h +877 -0
- include/eigen3/Eigen/src/LU/InverseImpl.h +432 -0
- include/eigen3/Eigen/src/LU/PartialPivLU.h +624 -0
- include/eigen3/Eigen/src/LU/PartialPivLU_LAPACKE.h +83 -0
- include/eigen3/Eigen/src/LU/arch/InverseSize4.h +351 -0
- include/eigen3/Eigen/src/MetisSupport/MetisSupport.h +137 -0
- include/eigen3/Eigen/src/OrderingMethods/Amd.h +435 -0
- include/eigen3/Eigen/src/OrderingMethods/Eigen_Colamd.h +1863 -0
- include/eigen3/Eigen/src/OrderingMethods/Ordering.h +153 -0
- include/eigen3/Eigen/src/PaStiXSupport/PaStiXSupport.h +678 -0
- include/eigen3/Eigen/src/PardisoSupport/PardisoSupport.h +545 -0
- include/eigen3/Eigen/src/QR/ColPivHouseholderQR.h +674 -0
- include/eigen3/Eigen/src/QR/ColPivHouseholderQR_LAPACKE.h +97 -0
- include/eigen3/Eigen/src/QR/CompleteOrthogonalDecomposition.h +635 -0
- include/eigen3/Eigen/src/QR/FullPivHouseholderQR.h +713 -0
- include/eigen3/Eigen/src/QR/HouseholderQR.h +434 -0
- include/eigen3/Eigen/src/QR/HouseholderQR_LAPACKE.h +68 -0
- include/eigen3/Eigen/src/SPQRSupport/SuiteSparseQRSupport.h +335 -0
- include/eigen3/Eigen/src/SVD/BDCSVD.h +1366 -0
- include/eigen3/Eigen/src/SVD/JacobiSVD.h +812 -0
- include/eigen3/Eigen/src/SVD/JacobiSVD_LAPACKE.h +91 -0
- include/eigen3/Eigen/src/SVD/SVDBase.h +376 -0
- include/eigen3/Eigen/src/SVD/UpperBidiagonalization.h +414 -0
- include/eigen3/Eigen/src/SparseCholesky/SimplicialCholesky.h +697 -0
- include/eigen3/Eigen/src/SparseCholesky/SimplicialCholesky_impl.h +174 -0
- include/eigen3/Eigen/src/SparseCore/AmbiVector.h +378 -0
- include/eigen3/Eigen/src/SparseCore/CompressedStorage.h +274 -0
- include/eigen3/Eigen/src/SparseCore/ConservativeSparseSparseProduct.h +352 -0
- include/eigen3/Eigen/src/SparseCore/MappedSparseMatrix.h +67 -0
- include/eigen3/Eigen/src/SparseCore/SparseAssign.h +270 -0
- include/eigen3/Eigen/src/SparseCore/SparseBlock.h +571 -0
- include/eigen3/Eigen/src/SparseCore/SparseColEtree.h +206 -0
- include/eigen3/Eigen/src/SparseCore/SparseCompressedBase.h +370 -0
- include/eigen3/Eigen/src/SparseCore/SparseCwiseBinaryOp.h +722 -0
- include/eigen3/Eigen/src/SparseCore/SparseCwiseUnaryOp.h +150 -0
- include/eigen3/Eigen/src/SparseCore/SparseDenseProduct.h +342 -0
- include/eigen3/Eigen/src/SparseCore/SparseDiagonalProduct.h +138 -0
- include/eigen3/Eigen/src/SparseCore/SparseDot.h +98 -0
- include/eigen3/Eigen/src/SparseCore/SparseFuzzy.h +29 -0
- include/eigen3/Eigen/src/SparseCore/SparseMap.h +305 -0
- include/eigen3/Eigen/src/SparseCore/SparseMatrix.h +1518 -0
- include/eigen3/Eigen/src/SparseCore/SparseMatrixBase.h +398 -0
- include/eigen3/Eigen/src/SparseCore/SparsePermutation.h +178 -0
- include/eigen3/Eigen/src/SparseCore/SparseProduct.h +181 -0
- include/eigen3/Eigen/src/SparseCore/SparseRedux.h +49 -0
- include/eigen3/Eigen/src/SparseCore/SparseRef.h +397 -0
- include/eigen3/Eigen/src/SparseCore/SparseSelfAdjointView.h +659 -0
- include/eigen3/Eigen/src/SparseCore/SparseSolverBase.h +124 -0
- include/eigen3/Eigen/src/SparseCore/SparseSparseProductWithPruning.h +198 -0
- include/eigen3/Eigen/src/SparseCore/SparseTranspose.h +92 -0
- include/eigen3/Eigen/src/SparseCore/SparseTriangularView.h +189 -0
- include/eigen3/Eigen/src/SparseCore/SparseUtil.h +186 -0
- include/eigen3/Eigen/src/SparseCore/SparseVector.h +478 -0
- include/eigen3/Eigen/src/SparseCore/SparseView.h +254 -0
- include/eigen3/Eigen/src/SparseCore/TriangularSolver.h +315 -0
- include/eigen3/Eigen/src/SparseLU/SparseLU.h +923 -0
- include/eigen3/Eigen/src/SparseLU/SparseLUImpl.h +66 -0
- include/eigen3/Eigen/src/SparseLU/SparseLU_Memory.h +226 -0
- include/eigen3/Eigen/src/SparseLU/SparseLU_Structs.h +110 -0
- include/eigen3/Eigen/src/SparseLU/SparseLU_SupernodalMatrix.h +375 -0
- include/eigen3/Eigen/src/SparseLU/SparseLU_Utils.h +80 -0
- include/eigen3/Eigen/src/SparseLU/SparseLU_column_bmod.h +181 -0
- include/eigen3/Eigen/src/SparseLU/SparseLU_column_dfs.h +179 -0
- include/eigen3/Eigen/src/SparseLU/SparseLU_copy_to_ucol.h +107 -0
- include/eigen3/Eigen/src/SparseLU/SparseLU_gemm_kernel.h +280 -0
- include/eigen3/Eigen/src/SparseLU/SparseLU_heap_relax_snode.h +126 -0
- include/eigen3/Eigen/src/SparseLU/SparseLU_kernel_bmod.h +130 -0
- include/eigen3/Eigen/src/SparseLU/SparseLU_panel_bmod.h +223 -0
- include/eigen3/Eigen/src/SparseLU/SparseLU_panel_dfs.h +258 -0
- include/eigen3/Eigen/src/SparseLU/SparseLU_pivotL.h +137 -0
- include/eigen3/Eigen/src/SparseLU/SparseLU_pruneL.h +136 -0
- include/eigen3/Eigen/src/SparseLU/SparseLU_relax_snode.h +83 -0
- include/eigen3/Eigen/src/SparseQR/SparseQR.h +758 -0
- include/eigen3/Eigen/src/StlSupport/StdDeque.h +116 -0
- include/eigen3/Eigen/src/StlSupport/StdList.h +106 -0
- include/eigen3/Eigen/src/StlSupport/StdVector.h +131 -0
- include/eigen3/Eigen/src/StlSupport/details.h +84 -0
- include/eigen3/Eigen/src/SuperLUSupport/SuperLUSupport.h +1025 -0
- include/eigen3/Eigen/src/UmfPackSupport/UmfPackSupport.h +642 -0
- include/eigen3/Eigen/src/misc/Image.h +82 -0
- include/eigen3/Eigen/src/misc/Kernel.h +79 -0
- include/eigen3/Eigen/src/misc/RealSvd2x2.h +55 -0
- include/eigen3/Eigen/src/misc/blas.h +440 -0
- include/eigen3/Eigen/src/misc/lapack.h +152 -0
- include/eigen3/Eigen/src/misc/lapacke.h +16292 -0
- include/eigen3/Eigen/src/misc/lapacke_mangling.h +17 -0
- include/eigen3/Eigen/src/plugins/ArrayCwiseBinaryOps.h +358 -0
- include/eigen3/Eigen/src/plugins/ArrayCwiseUnaryOps.h +696 -0
- include/eigen3/Eigen/src/plugins/BlockMethods.h +1442 -0
- include/eigen3/Eigen/src/plugins/CommonCwiseBinaryOps.h +115 -0
- include/eigen3/Eigen/src/plugins/CommonCwiseUnaryOps.h +177 -0
- include/eigen3/Eigen/src/plugins/IndexedViewMethods.h +262 -0
- include/eigen3/Eigen/src/plugins/MatrixCwiseBinaryOps.h +152 -0
- include/eigen3/Eigen/src/plugins/MatrixCwiseUnaryOps.h +95 -0
- include/eigen3/Eigen/src/plugins/ReshapedMethods.h +149 -0
- include/eigen3/signature_of_eigen3_matrix_library +1 -0
- include/eigen3/unsupported/Eigen/AdolcForward +159 -0
- include/eigen3/unsupported/Eigen/AlignedVector3 +234 -0
- include/eigen3/unsupported/Eigen/ArpackSupport +30 -0
- include/eigen3/unsupported/Eigen/AutoDiff +46 -0
- include/eigen3/unsupported/Eigen/BVH +95 -0
- include/eigen3/unsupported/Eigen/CXX11/Tensor +137 -0
- include/eigen3/unsupported/Eigen/CXX11/TensorSymmetry +42 -0
- include/eigen3/unsupported/Eigen/CXX11/ThreadPool +74 -0
- include/eigen3/unsupported/Eigen/CXX11/src/Tensor/Tensor.h +554 -0
- include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorArgMax.h +329 -0
- include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorAssign.h +247 -0
- include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorBase.h +1176 -0
- include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorBlock.h +1559 -0
- include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorBroadcasting.h +1093 -0
- include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorChipping.h +518 -0
- include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorConcatenation.h +377 -0
- include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorContraction.h +1023 -0
- include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorContractionBlocking.h +73 -0
- include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorContractionCuda.h +6 -0
- include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorContractionGpu.h +1413 -0
- include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorContractionMapper.h +575 -0
- include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorContractionSycl.h +1650 -0
- include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorContractionThreadPool.h +1679 -0
- include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorConversion.h +456 -0
- include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorConvolution.h +1132 -0
- include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorConvolutionSycl.h +544 -0
- include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorCostModel.h +214 -0
- include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorCustomOp.h +347 -0
- include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorDevice.h +137 -0
- include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorDeviceCuda.h +6 -0
- include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorDeviceDefault.h +104 -0
- include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorDeviceGpu.h +389 -0
- include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorDeviceSycl.h +1048 -0
- include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorDeviceThreadPool.h +409 -0
- include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorDimensionList.h +236 -0
- include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorDimensions.h +490 -0
- include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorEvalTo.h +236 -0
- include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorEvaluator.h +983 -0
- include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorExecutor.h +703 -0
- include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorExpr.h +388 -0
- include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorFFT.h +669 -0
- include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorFixedSize.h +379 -0
- include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorForcedEval.h +237 -0
- include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorForwardDeclarations.h +191 -0
- include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorFunctors.h +488 -0
- include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorGenerator.h +302 -0
- include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorGlobalFunctions.h +33 -0
- include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorGpuHipCudaDefines.h +99 -0
- include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorGpuHipCudaUndefines.h +44 -0
- include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorIO.h +79 -0
- include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorImagePatch.h +603 -0
- include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorIndexList.h +738 -0
- include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorInflation.h +247 -0
- include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorInitializer.h +82 -0
- include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorIntDiv.h +263 -0
- include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorLayoutSwap.h +216 -0
- include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorMacros.h +98 -0
- include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorMap.h +327 -0
- include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorMeta.h +311 -0
- include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorMorphing.h +1102 -0
- include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorPadding.h +708 -0
- include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorPatch.h +291 -0
- include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorRandom.h +322 -0
- include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorReduction.h +998 -0
- include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorReductionCuda.h +6 -0
- include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorReductionGpu.h +966 -0
- include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorReductionSycl.h +582 -0
- include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorRef.h +454 -0
- include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorReverse.h +465 -0
- include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorScan.h +528 -0
- include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorScanSycl.h +513 -0
- include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorShuffling.h +471 -0
- include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorStorage.h +161 -0
- include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorStriding.h +346 -0
- include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorTrace.h +303 -0
- include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorTraits.h +264 -0
- include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorUInt128.h +249 -0
- include/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorVolumePatch.h +629 -0
- include/eigen3/unsupported/Eigen/CXX11/src/TensorSymmetry/DynamicSymmetry.h +293 -0
- include/eigen3/unsupported/Eigen/CXX11/src/TensorSymmetry/StaticSymmetry.h +236 -0
- include/eigen3/unsupported/Eigen/CXX11/src/TensorSymmetry/Symmetry.h +338 -0
- include/eigen3/unsupported/Eigen/CXX11/src/TensorSymmetry/util/TemplateGroupTheory.h +669 -0
- include/eigen3/unsupported/Eigen/CXX11/src/ThreadPool/Barrier.h +67 -0
- include/eigen3/unsupported/Eigen/CXX11/src/ThreadPool/EventCount.h +249 -0
- include/eigen3/unsupported/Eigen/CXX11/src/ThreadPool/NonBlockingThreadPool.h +486 -0
- include/eigen3/unsupported/Eigen/CXX11/src/ThreadPool/RunQueue.h +236 -0
- include/eigen3/unsupported/Eigen/CXX11/src/ThreadPool/ThreadCancel.h +23 -0
- include/eigen3/unsupported/Eigen/CXX11/src/ThreadPool/ThreadEnvironment.h +40 -0
- include/eigen3/unsupported/Eigen/CXX11/src/ThreadPool/ThreadLocal.h +301 -0
- include/eigen3/unsupported/Eigen/CXX11/src/ThreadPool/ThreadPoolInterface.h +48 -0
- include/eigen3/unsupported/Eigen/CXX11/src/ThreadPool/ThreadYield.h +20 -0
- include/eigen3/unsupported/Eigen/CXX11/src/util/CXX11Meta.h +537 -0
- include/eigen3/unsupported/Eigen/CXX11/src/util/CXX11Workarounds.h +88 -0
- include/eigen3/unsupported/Eigen/CXX11/src/util/EmulateArray.h +261 -0
- include/eigen3/unsupported/Eigen/CXX11/src/util/MaxSizeVector.h +158 -0
- include/eigen3/unsupported/Eigen/EulerAngles +43 -0
- include/eigen3/unsupported/Eigen/FFT +419 -0
- include/eigen3/unsupported/Eigen/IterativeSolvers +51 -0
- include/eigen3/unsupported/Eigen/KroneckerProduct +36 -0
- include/eigen3/unsupported/Eigen/LevenbergMarquardt +49 -0
- include/eigen3/unsupported/Eigen/MPRealSupport +213 -0
- include/eigen3/unsupported/Eigen/MatrixFunctions +504 -0
- include/eigen3/unsupported/Eigen/MoreVectorization +24 -0
- include/eigen3/unsupported/Eigen/NonLinearOptimization +140 -0
- include/eigen3/unsupported/Eigen/NumericalDiff +56 -0
- include/eigen3/unsupported/Eigen/OpenGLSupport +322 -0
- include/eigen3/unsupported/Eigen/Polynomials +137 -0
- include/eigen3/unsupported/Eigen/Skyline +39 -0
- include/eigen3/unsupported/Eigen/SparseExtra +54 -0
- include/eigen3/unsupported/Eigen/SpecialFunctions +103 -0
- include/eigen3/unsupported/Eigen/Splines +35 -0
- include/eigen3/unsupported/Eigen/src/AutoDiff/AutoDiffJacobian.h +108 -0
- include/eigen3/unsupported/Eigen/src/AutoDiff/AutoDiffScalar.h +730 -0
- include/eigen3/unsupported/Eigen/src/AutoDiff/AutoDiffVector.h +220 -0
- include/eigen3/unsupported/Eigen/src/BVH/BVAlgorithms.h +293 -0
- include/eigen3/unsupported/Eigen/src/BVH/KdBVH.h +223 -0
- include/eigen3/unsupported/Eigen/src/Eigenvalues/ArpackSelfAdjointEigenSolver.h +790 -0
- include/eigen3/unsupported/Eigen/src/EulerAngles/EulerAngles.h +355 -0
- include/eigen3/unsupported/Eigen/src/EulerAngles/EulerSystem.h +305 -0
- include/eigen3/unsupported/Eigen/src/FFT/ei_fftw_impl.h +261 -0
- include/eigen3/unsupported/Eigen/src/FFT/ei_kissfft_impl.h +449 -0
- include/eigen3/unsupported/Eigen/src/IterativeSolvers/ConstrainedConjGrad.h +187 -0
- include/eigen3/unsupported/Eigen/src/IterativeSolvers/DGMRES.h +511 -0
- include/eigen3/unsupported/Eigen/src/IterativeSolvers/GMRES.h +335 -0
- include/eigen3/unsupported/Eigen/src/IterativeSolvers/IDRS.h +436 -0
- include/eigen3/unsupported/Eigen/src/IterativeSolvers/IncompleteLU.h +90 -0
- include/eigen3/unsupported/Eigen/src/IterativeSolvers/IterationController.h +154 -0
- include/eigen3/unsupported/Eigen/src/IterativeSolvers/MINRES.h +267 -0
- include/eigen3/unsupported/Eigen/src/IterativeSolvers/Scaling.h +193 -0
- include/eigen3/unsupported/Eigen/src/KroneckerProduct/KroneckerTensorProduct.h +305 -0
- include/eigen3/unsupported/Eigen/src/LevenbergMarquardt/LMcovar.h +84 -0
- include/eigen3/unsupported/Eigen/src/LevenbergMarquardt/LMonestep.h +202 -0
- include/eigen3/unsupported/Eigen/src/LevenbergMarquardt/LMpar.h +160 -0
- include/eigen3/unsupported/Eigen/src/LevenbergMarquardt/LMqrsolv.h +188 -0
- include/eigen3/unsupported/Eigen/src/LevenbergMarquardt/LevenbergMarquardt.h +396 -0
- include/eigen3/unsupported/Eigen/src/MatrixFunctions/MatrixExponential.h +441 -0
- include/eigen3/unsupported/Eigen/src/MatrixFunctions/MatrixFunction.h +569 -0
- include/eigen3/unsupported/Eigen/src/MatrixFunctions/MatrixLogarithm.h +373 -0
- include/eigen3/unsupported/Eigen/src/MatrixFunctions/MatrixPower.h +705 -0
- include/eigen3/unsupported/Eigen/src/MatrixFunctions/MatrixSquareRoot.h +368 -0
- include/eigen3/unsupported/Eigen/src/MatrixFunctions/StemFunction.h +117 -0
- include/eigen3/unsupported/Eigen/src/MoreVectorization/MathFunctions.h +95 -0
- include/eigen3/unsupported/Eigen/src/NonLinearOptimization/HybridNonLinearSolver.h +601 -0
- include/eigen3/unsupported/Eigen/src/NonLinearOptimization/LevenbergMarquardt.h +657 -0
- include/eigen3/unsupported/Eigen/src/NonLinearOptimization/chkder.h +66 -0
- include/eigen3/unsupported/Eigen/src/NonLinearOptimization/covar.h +70 -0
- include/eigen3/unsupported/Eigen/src/NonLinearOptimization/dogleg.h +107 -0
- include/eigen3/unsupported/Eigen/src/NonLinearOptimization/fdjac1.h +79 -0
- include/eigen3/unsupported/Eigen/src/NonLinearOptimization/lmpar.h +298 -0
- include/eigen3/unsupported/Eigen/src/NonLinearOptimization/qrsolv.h +91 -0
- include/eigen3/unsupported/Eigen/src/NonLinearOptimization/r1mpyq.h +30 -0
- include/eigen3/unsupported/Eigen/src/NonLinearOptimization/r1updt.h +99 -0
- include/eigen3/unsupported/Eigen/src/NonLinearOptimization/rwupdt.h +49 -0
- include/eigen3/unsupported/Eigen/src/NumericalDiff/NumericalDiff.h +130 -0
- include/eigen3/unsupported/Eigen/src/Polynomials/Companion.h +280 -0
- include/eigen3/unsupported/Eigen/src/Polynomials/PolynomialSolver.h +428 -0
- include/eigen3/unsupported/Eigen/src/Polynomials/PolynomialUtils.h +143 -0
- include/eigen3/unsupported/Eigen/src/Skyline/SkylineInplaceLU.h +352 -0
- include/eigen3/unsupported/Eigen/src/Skyline/SkylineMatrix.h +862 -0
- include/eigen3/unsupported/Eigen/src/Skyline/SkylineMatrixBase.h +212 -0
- include/eigen3/unsupported/Eigen/src/Skyline/SkylineProduct.h +295 -0
- include/eigen3/unsupported/Eigen/src/Skyline/SkylineStorage.h +259 -0
- include/eigen3/unsupported/Eigen/src/Skyline/SkylineUtil.h +89 -0
- include/eigen3/unsupported/Eigen/src/SparseExtra/BlockOfDynamicSparseMatrix.h +122 -0
- include/eigen3/unsupported/Eigen/src/SparseExtra/BlockSparseMatrix.h +1079 -0
- include/eigen3/unsupported/Eigen/src/SparseExtra/DynamicSparseMatrix.h +404 -0
- include/eigen3/unsupported/Eigen/src/SparseExtra/MarketIO.h +282 -0
- include/eigen3/unsupported/Eigen/src/SparseExtra/MatrixMarketIterator.h +247 -0
- include/eigen3/unsupported/Eigen/src/SparseExtra/RandomSetter.h +349 -0
- include/eigen3/unsupported/Eigen/src/SpecialFunctions/BesselFunctionsArrayAPI.h +286 -0
- include/eigen3/unsupported/Eigen/src/SpecialFunctions/BesselFunctionsBFloat16.h +68 -0
- include/eigen3/unsupported/Eigen/src/SpecialFunctions/BesselFunctionsFunctors.h +357 -0
- include/eigen3/unsupported/Eigen/src/SpecialFunctions/BesselFunctionsHalf.h +66 -0
- include/eigen3/unsupported/Eigen/src/SpecialFunctions/BesselFunctionsImpl.h +1959 -0
- include/eigen3/unsupported/Eigen/src/SpecialFunctions/BesselFunctionsPacketMath.h +118 -0
- include/eigen3/unsupported/Eigen/src/SpecialFunctions/HipVectorCompatibility.h +67 -0
- include/eigen3/unsupported/Eigen/src/SpecialFunctions/SpecialFunctionsArrayAPI.h +167 -0
- include/eigen3/unsupported/Eigen/src/SpecialFunctions/SpecialFunctionsBFloat16.h +58 -0
- include/eigen3/unsupported/Eigen/src/SpecialFunctions/SpecialFunctionsFunctors.h +330 -0
- include/eigen3/unsupported/Eigen/src/SpecialFunctions/SpecialFunctionsHalf.h +58 -0
- include/eigen3/unsupported/Eigen/src/SpecialFunctions/SpecialFunctionsImpl.h +2045 -0
- include/eigen3/unsupported/Eigen/src/SpecialFunctions/SpecialFunctionsPacketMath.h +79 -0
- include/eigen3/unsupported/Eigen/src/SpecialFunctions/arch/AVX/BesselFunctions.h +46 -0
- include/eigen3/unsupported/Eigen/src/SpecialFunctions/arch/AVX/SpecialFunctions.h +16 -0
- include/eigen3/unsupported/Eigen/src/SpecialFunctions/arch/AVX512/BesselFunctions.h +46 -0
- include/eigen3/unsupported/Eigen/src/SpecialFunctions/arch/AVX512/SpecialFunctions.h +16 -0
- include/eigen3/unsupported/Eigen/src/SpecialFunctions/arch/GPU/SpecialFunctions.h +369 -0
- include/eigen3/unsupported/Eigen/src/SpecialFunctions/arch/NEON/BesselFunctions.h +54 -0
- include/eigen3/unsupported/Eigen/src/SpecialFunctions/arch/NEON/SpecialFunctions.h +34 -0
- include/eigen3/unsupported/Eigen/src/Splines/Spline.h +507 -0
- include/eigen3/unsupported/Eigen/src/Splines/SplineFitting.h +431 -0
- include/eigen3/unsupported/Eigen/src/Splines/SplineFwd.h +93 -0
- qilisdk/__init__.py +26 -0
- qilisdk/__init__.pyi +16 -0
- qilisdk/_logging.py +135 -0
- qilisdk/_optionals.py +137 -0
- qilisdk/analog/__init__.py +18 -0
- qilisdk/analog/exceptions.py +17 -0
- qilisdk/analog/hamiltonian.py +1068 -0
- qilisdk/analog/schedule.py +483 -0
- qilisdk/backends/__init__.py +46 -0
- qilisdk/backends/__init__.pyi +18 -0
- qilisdk/backends/backend.py +132 -0
- qilisdk/backends/cuda_backend.py +752 -0
- qilisdk/backends/qilisim.py +148 -0
- qilisdk/backends/qutip_backend.py +504 -0
- qilisdk/core/__init__.py +70 -0
- qilisdk/core/exceptions.py +29 -0
- qilisdk/core/interpolator.py +640 -0
- qilisdk/core/model.py +1012 -0
- qilisdk/core/parameterizable.py +133 -0
- qilisdk/core/qtensor.py +684 -0
- qilisdk/core/result.py +18 -0
- qilisdk/core/types.py +49 -0
- qilisdk/core/variables.py +2035 -0
- qilisdk/cost_functions/__init__.py +18 -0
- qilisdk/cost_functions/cost_function.py +77 -0
- qilisdk/cost_functions/model_cost_function.py +152 -0
- qilisdk/cost_functions/observable_cost_function.py +112 -0
- qilisdk/digital/__init__.py +67 -0
- qilisdk/digital/ansatz.py +382 -0
- qilisdk/digital/circuit.py +371 -0
- qilisdk/digital/circuit_transpiler.py +46 -0
- qilisdk/digital/circuit_transpiler_passes/__init__.py +18 -0
- qilisdk/digital/circuit_transpiler_passes/circuit_transpiler_pass.py +36 -0
- qilisdk/digital/circuit_transpiler_passes/decompose_multi_controlled_gates_pass.py +220 -0
- qilisdk/digital/circuit_transpiler_passes/numeric_helpers.py +82 -0
- qilisdk/digital/exceptions.py +37 -0
- qilisdk/digital/gates.py +1308 -0
- qilisdk/experiments/__init__.py +36 -0
- qilisdk/experiments/experiment_functional.py +212 -0
- qilisdk/experiments/experiment_result.py +247 -0
- qilisdk/functionals/__init__.py +29 -0
- qilisdk/functionals/functional.py +39 -0
- qilisdk/functionals/functional_result.py +18 -0
- qilisdk/functionals/sampling.py +89 -0
- qilisdk/functionals/sampling_result.py +92 -0
- qilisdk/functionals/time_evolution.py +111 -0
- qilisdk/functionals/time_evolution_result.py +91 -0
- qilisdk/functionals/variational_program.py +138 -0
- qilisdk/functionals/variational_program_result.py +69 -0
- qilisdk/logging_config.yaml +16 -0
- qilisdk/noise/__init__.py +56 -0
- qilisdk/noise/amplitude_damping.py +71 -0
- qilisdk/noise/bit_flip.py +45 -0
- qilisdk/noise/dephasing.py +69 -0
- qilisdk/noise/depolarizing.py +44 -0
- qilisdk/noise/gaussian_perturbation.py +69 -0
- qilisdk/noise/noise.py +20 -0
- qilisdk/noise/noise_abc.py +31 -0
- qilisdk/noise/noise_config.py +77 -0
- qilisdk/noise/noise_model.py +259 -0
- qilisdk/noise/offset_perturbation.py +39 -0
- qilisdk/noise/parameter_perturbation.py +45 -0
- qilisdk/noise/pauli_channel.py +115 -0
- qilisdk/noise/phase_flip.py +45 -0
- qilisdk/noise/protocols.py +107 -0
- qilisdk/noise/readout_assignment.py +60 -0
- qilisdk/noise/representations.py +149 -0
- qilisdk/noise/utils.py +90 -0
- qilisdk/optimizers/__init__.py +17 -0
- qilisdk/optimizers/optimizer.py +39 -0
- qilisdk/optimizers/optimizer_result.py +101 -0
- qilisdk/optimizers/scipy_optimizer.py +118 -0
- qilisdk/py.typed +0 -0
- qilisdk/settings.py +103 -0
- qilisdk/speqtrum/__init__.py +41 -0
- qilisdk/speqtrum/__init__.pyi +18 -0
- qilisdk/speqtrum/keyring.py +58 -0
- qilisdk/speqtrum/speqtrum.py +817 -0
- qilisdk/speqtrum/speqtrum_models.py +560 -0
- qilisdk/utils/__init__.py +13 -0
- qilisdk/utils/openfermion/__init__.py +38 -0
- qilisdk/utils/openfermion/__init__.pyi +17 -0
- qilisdk/utils/openfermion/openfermion.py +45 -0
- qilisdk/utils/openqasm2.py +215 -0
- qilisdk/utils/serialization.py +128 -0
- qilisdk/utils/trotterization/__init__.py +18 -0
- qilisdk/utils/trotterization/trotterization.py +127 -0
- qilisdk/utils/visualization/PlusJakartaSans-SemiBold.ttf +0 -0
- qilisdk/utils/visualization/__init__.py +24 -0
- qilisdk/utils/visualization/circuit_renderers.py +781 -0
- qilisdk/utils/visualization/schedule_renderers.py +175 -0
- qilisdk/utils/visualization/style.py +154 -0
- qilisdk/utils/visualization/themes.py +76 -0
- qilisdk/yaml.py +260 -0
- qilisdk-0.1.8.dist-info/METADATA +657 -0
- qilisdk-0.1.8.dist-info/RECORD +635 -0
- qilisdk-0.1.8.dist-info/WHEEL +5 -0
- qilisdk-0.1.8.dist-info/licenses/LICENCE +201 -0
- qilisdk.libs/libgomp-24e2ab19.so.1.0.0 +0 -0
- qilisim_module.cpython-312-x86_64-linux-gnu.so +0 -0
- share/eigen3/cmake/Eigen3Config.cmake +37 -0
- share/eigen3/cmake/Eigen3ConfigVersion.cmake +65 -0
- share/eigen3/cmake/Eigen3Targets.cmake +106 -0
- share/eigen3/cmake/UseEigen3.cmake +6 -0
- share/pkgconfig/eigen3.pc +9 -0
|
@@ -0,0 +1,1068 @@
|
|
|
1
|
+
# Copyright 2025 Qilimanjaro Quantum Tech
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
# you may not use this file except in compliance with the License.
|
|
5
|
+
# You may obtain a copy of the License at
|
|
6
|
+
#
|
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
#
|
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
# See the License for the specific language governing permissions and
|
|
13
|
+
# limitations under the License.
|
|
14
|
+
from __future__ import annotations
|
|
15
|
+
|
|
16
|
+
import copy
|
|
17
|
+
import re
|
|
18
|
+
from abc import ABC
|
|
19
|
+
from collections import defaultdict
|
|
20
|
+
from itertools import product
|
|
21
|
+
from typing import TYPE_CHECKING, Callable, ClassVar
|
|
22
|
+
|
|
23
|
+
import numpy as np
|
|
24
|
+
from scipy.sparse import csr_matrix, kron, spmatrix
|
|
25
|
+
|
|
26
|
+
from qilisdk.core.parameterizable import Parameterizable
|
|
27
|
+
from qilisdk.core.qtensor import QTensor
|
|
28
|
+
from qilisdk.core.types import Number
|
|
29
|
+
from qilisdk.core.variables import BaseVariable, Parameter, Term
|
|
30
|
+
from qilisdk.settings import get_settings
|
|
31
|
+
from qilisdk.yaml import yaml
|
|
32
|
+
|
|
33
|
+
from .exceptions import InvalidHamiltonianOperation
|
|
34
|
+
|
|
35
|
+
if TYPE_CHECKING:
|
|
36
|
+
from collections.abc import Iterator
|
|
37
|
+
|
|
38
|
+
_DIVISION_BY_OPERATORS_MESSAGE = "Division by operators is not supported"
|
|
39
|
+
_GENERIC_VARIABLE_IN_TERM_MESSAGE = "Term provided contains generic variables that are not Parameter."
|
|
40
|
+
_GENERIC_VARIABLE_IN_HAMILTONIAN_MESSAGE = (
|
|
41
|
+
"Only Parameters are allowed to be used in hamiltonians. Generic Variables are not supported"
|
|
42
|
+
)
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
def _complex_dtype() -> np.dtype:
|
|
46
|
+
return np.dtype(get_settings().complex_precision.dtype)
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
###############################################################################
|
|
50
|
+
# Flyweight Cache
|
|
51
|
+
###############################################################################
|
|
52
|
+
_OPERATOR_CACHE: dict[tuple[str, int], PauliOperator] = {}
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
def _get_pauli(name: str, qubit: int) -> PauliOperator:
|
|
56
|
+
key = (name, qubit)
|
|
57
|
+
if key in _OPERATOR_CACHE:
|
|
58
|
+
return _OPERATOR_CACHE[key]
|
|
59
|
+
|
|
60
|
+
if name == "Z":
|
|
61
|
+
op = PauliZ(qubit)
|
|
62
|
+
elif name == "X":
|
|
63
|
+
op = PauliX(qubit)
|
|
64
|
+
elif name == "Y":
|
|
65
|
+
op = PauliY(qubit)
|
|
66
|
+
elif name == "I":
|
|
67
|
+
op = PauliI(qubit)
|
|
68
|
+
else:
|
|
69
|
+
raise ValueError(f"Unknown Pauli operator name: {name}")
|
|
70
|
+
|
|
71
|
+
_OPERATOR_CACHE[key] = op
|
|
72
|
+
return op
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
###############################################################################
|
|
76
|
+
# Public Factory Functions
|
|
77
|
+
###############################################################################
|
|
78
|
+
def Z(qubit: int) -> Hamiltonian:
|
|
79
|
+
return _get_pauli("Z", qubit).to_hamiltonian()
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
def X(qubit: int) -> Hamiltonian:
|
|
83
|
+
return _get_pauli("X", qubit).to_hamiltonian()
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
def Y(qubit: int) -> Hamiltonian:
|
|
87
|
+
return _get_pauli("Y", qubit).to_hamiltonian()
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
def I(qubit: int = 0) -> Hamiltonian: # noqa: E743
|
|
91
|
+
return _get_pauli("I", qubit).to_hamiltonian()
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
###############################################################################
|
|
95
|
+
# Abstract Base PauliOperator
|
|
96
|
+
###############################################################################
|
|
97
|
+
class PauliOperator(ABC):
|
|
98
|
+
"""
|
|
99
|
+
A generic abstract Pauli operator that acts on one qubit.
|
|
100
|
+
|
|
101
|
+
Example:
|
|
102
|
+
.. code-block:: python
|
|
103
|
+
|
|
104
|
+
from qilisdk.analog import PauliX
|
|
105
|
+
|
|
106
|
+
op = PauliX(0)
|
|
107
|
+
|
|
108
|
+
Flyweight usage: do NOT instantiate directly—use PauliX(q), PauliY(q), etc.
|
|
109
|
+
|
|
110
|
+
Note: You can also use the factory functions X(q), Y(q), Z(q), I(q) to get a Hamiltonian object.
|
|
111
|
+
"""
|
|
112
|
+
|
|
113
|
+
_NAME: ClassVar[str]
|
|
114
|
+
_MATRIX: ClassVar[np.ndarray]
|
|
115
|
+
_MATRIX_CACHE: ClassVar[dict[np.dtype, np.ndarray]]
|
|
116
|
+
|
|
117
|
+
def __init_subclass__(cls) -> None:
|
|
118
|
+
super().__init_subclass__()
|
|
119
|
+
cls._MATRIX_CACHE = {}
|
|
120
|
+
|
|
121
|
+
def __init__(self, qubit: int) -> None:
|
|
122
|
+
self._qubit = qubit
|
|
123
|
+
|
|
124
|
+
@property
|
|
125
|
+
def qubit(self) -> int:
|
|
126
|
+
return self._qubit
|
|
127
|
+
|
|
128
|
+
@property
|
|
129
|
+
def name(self) -> str:
|
|
130
|
+
return self._NAME
|
|
131
|
+
|
|
132
|
+
@classmethod
|
|
133
|
+
def matrix_for_dtype(cls, dtype: np.dtype) -> np.ndarray:
|
|
134
|
+
cached = cls._MATRIX_CACHE.get(dtype)
|
|
135
|
+
if cached is None:
|
|
136
|
+
cached = cls._MATRIX.astype(dtype, copy=False)
|
|
137
|
+
cls._MATRIX_CACHE[dtype] = cached
|
|
138
|
+
return cached
|
|
139
|
+
|
|
140
|
+
@property
|
|
141
|
+
def matrix(self) -> np.ndarray:
|
|
142
|
+
return self.matrix_for_dtype(_complex_dtype())
|
|
143
|
+
|
|
144
|
+
def to_hamiltonian(self) -> Hamiltonian:
|
|
145
|
+
"""Convert this single operator to a Hamiltonian with one term.
|
|
146
|
+
|
|
147
|
+
Returns:
|
|
148
|
+
Hamiltonian: The converted Hamiltonian.
|
|
149
|
+
"""
|
|
150
|
+
return Hamiltonian({(self,): 1})
|
|
151
|
+
|
|
152
|
+
def __hash__(self) -> int:
|
|
153
|
+
return hash((self._NAME, self._qubit))
|
|
154
|
+
|
|
155
|
+
def __eq__(self, other: object) -> bool:
|
|
156
|
+
if isinstance(other, Hamiltonian):
|
|
157
|
+
return other == self
|
|
158
|
+
if not isinstance(other, PauliOperator):
|
|
159
|
+
return False
|
|
160
|
+
return (self._NAME == other._NAME) and (self._qubit == other._qubit)
|
|
161
|
+
|
|
162
|
+
def __repr__(self) -> str:
|
|
163
|
+
return f"{self.name}({self.qubit})"
|
|
164
|
+
|
|
165
|
+
def __str__(self) -> str:
|
|
166
|
+
return f"{self.name}({self.qubit})"
|
|
167
|
+
|
|
168
|
+
# ----------- Arithmetic Operators ------------
|
|
169
|
+
|
|
170
|
+
def __add__(self, other: Number | PauliOperator | Hamiltonian) -> Hamiltonian:
|
|
171
|
+
return self.to_hamiltonian() + other
|
|
172
|
+
|
|
173
|
+
__radd__ = __add__
|
|
174
|
+
__iadd__ = __add__
|
|
175
|
+
|
|
176
|
+
def __sub__(self, other: Number | PauliOperator | Hamiltonian) -> Hamiltonian:
|
|
177
|
+
return self.to_hamiltonian() - other
|
|
178
|
+
|
|
179
|
+
def __rsub__(self, other: Number | PauliOperator | Hamiltonian) -> Hamiltonian:
|
|
180
|
+
return other - self.to_hamiltonian()
|
|
181
|
+
|
|
182
|
+
__isub__ = __sub__
|
|
183
|
+
|
|
184
|
+
def __mul__(self, other: Number | PauliOperator | Hamiltonian) -> Hamiltonian:
|
|
185
|
+
return self.to_hamiltonian() * other
|
|
186
|
+
|
|
187
|
+
def __rmul__(self, other: Number | PauliOperator | Hamiltonian) -> Hamiltonian:
|
|
188
|
+
return other * self.to_hamiltonian()
|
|
189
|
+
|
|
190
|
+
__imul__ = __mul__
|
|
191
|
+
|
|
192
|
+
def __truediv__(self, other: Number | PauliOperator | Hamiltonian) -> Hamiltonian:
|
|
193
|
+
return self.to_hamiltonian() / other
|
|
194
|
+
|
|
195
|
+
def __rtruediv__(self, _: Number | PauliOperator | Hamiltonian) -> Hamiltonian:
|
|
196
|
+
raise InvalidHamiltonianOperation(_DIVISION_BY_OPERATORS_MESSAGE)
|
|
197
|
+
|
|
198
|
+
__itruediv__ = __truediv__
|
|
199
|
+
|
|
200
|
+
|
|
201
|
+
###############################################################################
|
|
202
|
+
# Concrete Flyweight Operator Classes
|
|
203
|
+
###############################################################################
|
|
204
|
+
@yaml.register_class
|
|
205
|
+
class PauliZ(PauliOperator):
|
|
206
|
+
_NAME: ClassVar[str] = "Z"
|
|
207
|
+
_MATRIX: ClassVar[np.ndarray] = np.array([[1, 0], [0, -1]], dtype=_complex_dtype())
|
|
208
|
+
|
|
209
|
+
|
|
210
|
+
@yaml.register_class
|
|
211
|
+
class PauliX(PauliOperator):
|
|
212
|
+
_NAME: ClassVar[str] = "X"
|
|
213
|
+
_MATRIX: ClassVar[np.ndarray] = np.array([[0, 1], [1, 0]], dtype=_complex_dtype())
|
|
214
|
+
|
|
215
|
+
|
|
216
|
+
@yaml.register_class
|
|
217
|
+
class PauliY(PauliOperator):
|
|
218
|
+
_NAME: ClassVar[str] = "Y"
|
|
219
|
+
_MATRIX: ClassVar[np.ndarray] = np.array([[0, -1j], [1j, 0]], dtype=_complex_dtype())
|
|
220
|
+
|
|
221
|
+
|
|
222
|
+
@yaml.register_class
|
|
223
|
+
class PauliI(PauliOperator):
|
|
224
|
+
_NAME: ClassVar[str] = "I"
|
|
225
|
+
_MATRIX: ClassVar[np.ndarray] = np.array([[1, 0], [0, 1]], dtype=_complex_dtype())
|
|
226
|
+
|
|
227
|
+
|
|
228
|
+
_PAULI_CLASS_BY_NAME: dict[str, type[PauliOperator]] = {cls._NAME: cls for cls in (PauliI, PauliX, PauliY, PauliZ)}
|
|
229
|
+
|
|
230
|
+
# Cache sparse single-qubit matrices once per dtype to avoid rebuilding them for every term.
|
|
231
|
+
_SINGLE_QUBIT_SPARSE: dict[tuple[str, np.dtype], csr_matrix] = {}
|
|
232
|
+
|
|
233
|
+
|
|
234
|
+
def _get_single_qubit_sparse_matrix(name: str) -> csr_matrix:
|
|
235
|
+
dtype = _complex_dtype()
|
|
236
|
+
key = (name, dtype)
|
|
237
|
+
cached = _SINGLE_QUBIT_SPARSE.get(key)
|
|
238
|
+
if cached is None:
|
|
239
|
+
pauli_cls = _PAULI_CLASS_BY_NAME[name]
|
|
240
|
+
cached = csr_matrix(pauli_cls.matrix_for_dtype(dtype), dtype=dtype)
|
|
241
|
+
_SINGLE_QUBIT_SPARSE[key] = cached
|
|
242
|
+
return cached
|
|
243
|
+
|
|
244
|
+
|
|
245
|
+
@yaml.register_class
|
|
246
|
+
class Hamiltonian(Parameterizable):
|
|
247
|
+
"""
|
|
248
|
+
Represent a Hamiltonian expressed as a linear combination of Pauli operators.
|
|
249
|
+
|
|
250
|
+
Example:
|
|
251
|
+
.. code-block:: python
|
|
252
|
+
|
|
253
|
+
from qilisdk.analog.hamiltonian import Hamiltonian, X, Z
|
|
254
|
+
|
|
255
|
+
H = X(0) * X(1) + Z(1)
|
|
256
|
+
"""
|
|
257
|
+
|
|
258
|
+
_EPS: float = 1e-14
|
|
259
|
+
_PAULI_PRODUCT_TABLE: ClassVar[dict[tuple[str, str], tuple[complex, Callable[..., PauliOperator]]]] = {
|
|
260
|
+
("X", "X"): (1, PauliI),
|
|
261
|
+
("X", "Y"): (1j, PauliZ),
|
|
262
|
+
("X", "Z"): (-1j, PauliY),
|
|
263
|
+
("Y", "X"): (-1j, PauliZ),
|
|
264
|
+
("Y", "Y"): (1, PauliI),
|
|
265
|
+
("Y", "Z"): (1j, PauliX),
|
|
266
|
+
("Z", "X"): (1j, PauliY),
|
|
267
|
+
("Z", "Y"): (-1j, PauliX),
|
|
268
|
+
("Z", "Z"): (1, PauliI),
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
ZERO: int = 0
|
|
272
|
+
|
|
273
|
+
def __init__(self, elements: dict[tuple[PauliOperator, ...], complex | Term | Parameter] | None = None) -> None:
|
|
274
|
+
"""
|
|
275
|
+
Build a Hamiltonian from a mapping of Pauli operator products to coefficients.
|
|
276
|
+
|
|
277
|
+
Args:
|
|
278
|
+
elements (dict[tuple[PauliOperator, ...], complex | Term | Parameter], optional):
|
|
279
|
+
Mapping from operator tuples to numerical coefficients or symbolic parameters. For example:
|
|
280
|
+
|
|
281
|
+
.. code-block:: python
|
|
282
|
+
|
|
283
|
+
{
|
|
284
|
+
(Z(0), Y(1)): 1.0,
|
|
285
|
+
(X(1),): 1j,
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
Defaults to None, which creates an empty Hamiltonian.
|
|
289
|
+
|
|
290
|
+
Raises:
|
|
291
|
+
ValueError: If the provided coefficients include generic variables instead of parameters.
|
|
292
|
+
"""
|
|
293
|
+
super(Hamiltonian, self).__init__()
|
|
294
|
+
self._elements: dict[tuple[PauliOperator, ...], complex | Term | Parameter] = defaultdict(complex)
|
|
295
|
+
self._parameters: dict[str, Parameter] = {}
|
|
296
|
+
if elements:
|
|
297
|
+
for key, val in elements.items():
|
|
298
|
+
if isinstance(val, Term):
|
|
299
|
+
for v in val.variables():
|
|
300
|
+
if isinstance(v, Parameter):
|
|
301
|
+
self._parameters[v.label] = v
|
|
302
|
+
else:
|
|
303
|
+
raise ValueError(_GENERIC_VARIABLE_IN_HAMILTONIAN_MESSAGE)
|
|
304
|
+
elif isinstance(val, BaseVariable):
|
|
305
|
+
if isinstance(val, Parameter):
|
|
306
|
+
self._parameters[val.label] = val
|
|
307
|
+
|
|
308
|
+
else:
|
|
309
|
+
raise ValueError(_GENERIC_VARIABLE_IN_HAMILTONIAN_MESSAGE)
|
|
310
|
+
self._elements[key] += val
|
|
311
|
+
self.simplify()
|
|
312
|
+
|
|
313
|
+
@property
|
|
314
|
+
def nqubits(self) -> int:
|
|
315
|
+
"""Number of qubits on which the Hamiltonian acts."""
|
|
316
|
+
qubits = {op.qubit for key in self._elements for op in key}
|
|
317
|
+
|
|
318
|
+
return max(qubits) + 1 if qubits else 0
|
|
319
|
+
|
|
320
|
+
@property
|
|
321
|
+
def elements(self) -> dict[tuple[PauliOperator, ...], complex]:
|
|
322
|
+
"""Return the stored operator-coefficient mapping with symbolic terms evaluated."""
|
|
323
|
+
return {
|
|
324
|
+
k: (
|
|
325
|
+
v if isinstance(v, complex) else (v.evaluate({}) if isinstance(v, Term) else v.evaluate()) # ty:ignore[possibly-missing-attribute]
|
|
326
|
+
)
|
|
327
|
+
for k, v in self._elements.items()
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
@property
|
|
331
|
+
def parameters(self) -> dict[str, Parameter]:
|
|
332
|
+
"""Return a mapping from parameter labels to their corresponding parameter objects."""
|
|
333
|
+
return self._parameters
|
|
334
|
+
|
|
335
|
+
def simplify(self) -> Hamiltonian:
|
|
336
|
+
"""Simplify the Hamiltonian expression by removing near-zero terms and accumulating constant terms.
|
|
337
|
+
|
|
338
|
+
Returns:
|
|
339
|
+
Hamiltonian: Simplified Hamiltonian
|
|
340
|
+
"""
|
|
341
|
+
# 1) Remove near-zero
|
|
342
|
+
keys_to_remove = [
|
|
343
|
+
key for key, value in self._elements.items() if isinstance(value, complex) and abs(value) < Hamiltonian._EPS
|
|
344
|
+
]
|
|
345
|
+
for key in keys_to_remove:
|
|
346
|
+
del self._elements[key]
|
|
347
|
+
|
|
348
|
+
# 2) Accumulate identities that do NOT act on qubit=0 => I(0)
|
|
349
|
+
to_accumulate = [
|
|
350
|
+
(key, value)
|
|
351
|
+
for key, value in self._elements.items()
|
|
352
|
+
if len(key) == 1 and key[0].name == "I" and key[0].qubit != 0
|
|
353
|
+
]
|
|
354
|
+
for key, value in to_accumulate:
|
|
355
|
+
del self._elements[key]
|
|
356
|
+
self._elements[PauliI(0),] += value
|
|
357
|
+
|
|
358
|
+
return self
|
|
359
|
+
|
|
360
|
+
def _apply_operator_on_qubit(self, terms: list[PauliOperator], padding: int = 0) -> spmatrix:
|
|
361
|
+
"""Get the matrix representation of a single term by taking the tensor product
|
|
362
|
+
of operators acting on each qubit. For qubits with no operator in `terms`,
|
|
363
|
+
the identity is used.
|
|
364
|
+
|
|
365
|
+
Args:
|
|
366
|
+
terms (list[PauliOperator]): A list of Pauli operators in the term.
|
|
367
|
+
|
|
368
|
+
Returns:
|
|
369
|
+
spmatrix: The full matrix representation of the term.
|
|
370
|
+
|
|
371
|
+
Raises:
|
|
372
|
+
ValueError: If multiple operators act on the same qubit.
|
|
373
|
+
"""
|
|
374
|
+
|
|
375
|
+
total_qubits = self.nqubits + padding
|
|
376
|
+
if total_qubits == 0:
|
|
377
|
+
return csr_matrix((1, 1), dtype=_complex_dtype())
|
|
378
|
+
|
|
379
|
+
ordered_terms = sorted(terms, key=lambda op: op.qubit)
|
|
380
|
+
|
|
381
|
+
# Check we don't have multiple operators on the same qubit
|
|
382
|
+
qubit_indices = [op.qubit for op in ordered_terms]
|
|
383
|
+
if len(qubit_indices) != len(set(qubit_indices)):
|
|
384
|
+
raise ValueError("The list should not contain multiple operators acting on the same qubit.")
|
|
385
|
+
|
|
386
|
+
identity_single = _get_single_qubit_sparse_matrix("I")
|
|
387
|
+
idx = 0
|
|
388
|
+
next_op = ordered_terms[0] if ordered_terms else None
|
|
389
|
+
result: spmatrix | None = None
|
|
390
|
+
|
|
391
|
+
for qubit in range(total_qubits):
|
|
392
|
+
if next_op is not None and next_op.qubit == qubit:
|
|
393
|
+
single = _get_single_qubit_sparse_matrix(next_op.name)
|
|
394
|
+
idx += 1
|
|
395
|
+
next_op = ordered_terms[idx] if idx < len(ordered_terms) else None
|
|
396
|
+
else:
|
|
397
|
+
single = identity_single
|
|
398
|
+
|
|
399
|
+
result = single if result is None else kron(result, single, format="csr")
|
|
400
|
+
|
|
401
|
+
# Added for type safety, but should never occur
|
|
402
|
+
return result if result is not None else csr_matrix((2**total_qubits, 2**total_qubits), dtype=_complex_dtype())
|
|
403
|
+
|
|
404
|
+
def to_matrix(self) -> spmatrix:
|
|
405
|
+
"""Return the full matrix representation of the Hamiltonian by summing over all terms.
|
|
406
|
+
|
|
407
|
+
Returns:
|
|
408
|
+
spmatrix: The sparse matrix representation of the Hamiltonian.
|
|
409
|
+
"""
|
|
410
|
+
dim = 2**self.nqubits
|
|
411
|
+
# Initialize a zero matrix of the appropriate dimension.
|
|
412
|
+
result = csr_matrix((dim, dim), dtype=_complex_dtype())
|
|
413
|
+
for coeff, term in self:
|
|
414
|
+
result += coeff * self._apply_operator_on_qubit(term)
|
|
415
|
+
return result
|
|
416
|
+
|
|
417
|
+
def to_qtensor(self, total_nqubits: int | None = None) -> QTensor:
|
|
418
|
+
"""Return the Hamiltonian as a ``QTensor`` built from the sparse matrix representation.
|
|
419
|
+
|
|
420
|
+
Args:
|
|
421
|
+
total_nqubits (int, optional): Specify the total number of qubits that this hamiltonian acts on. Defaults to None.
|
|
422
|
+
|
|
423
|
+
Returns:
|
|
424
|
+
QTensor: The QTensor object representation of the Hamiltonian.
|
|
425
|
+
|
|
426
|
+
Raises:
|
|
427
|
+
ValueError: If the total_nqubits provided is lower than the number of qubits effected by the hamiltonian.
|
|
428
|
+
"""
|
|
429
|
+
|
|
430
|
+
nqubits = total_nqubits or self.nqubits
|
|
431
|
+
padding = nqubits - self.nqubits
|
|
432
|
+
if nqubits < self.nqubits:
|
|
433
|
+
raise ValueError(
|
|
434
|
+
f"The total number of qubits can't be less than the number of the qubits effected by this hamiltonian ({self.nqubits})"
|
|
435
|
+
)
|
|
436
|
+
|
|
437
|
+
dim = 2 ** (nqubits)
|
|
438
|
+
|
|
439
|
+
# Initialize a zero matrix of the appropriate dimension.
|
|
440
|
+
result = csr_matrix((dim, dim), dtype=_complex_dtype())
|
|
441
|
+
for coeff, term in self:
|
|
442
|
+
result += coeff * self._apply_operator_on_qubit(term, padding=padding)
|
|
443
|
+
return QTensor(result)
|
|
444
|
+
|
|
445
|
+
def get_static_hamiltonian(self) -> Hamiltonian:
|
|
446
|
+
"""Return a Hamiltonian containing only constant coefficients."""
|
|
447
|
+
out = Hamiltonian()
|
|
448
|
+
for pauli, value in self.elements.items():
|
|
449
|
+
aux: Hamiltonian | PauliOperator = pauli[0]
|
|
450
|
+
for p in list(pauli)[1:]:
|
|
451
|
+
aux *= p
|
|
452
|
+
out += aux * value
|
|
453
|
+
return out
|
|
454
|
+
|
|
455
|
+
def __iter__(self) -> Iterator[tuple[complex, list[PauliOperator]]]:
|
|
456
|
+
for key, value in self.elements.items():
|
|
457
|
+
yield value, list(key)
|
|
458
|
+
|
|
459
|
+
# ------- Equality & hashing --------
|
|
460
|
+
|
|
461
|
+
def __eq__(self, other: object) -> bool:
|
|
462
|
+
if other == Hamiltonian.ZERO:
|
|
463
|
+
return bool(
|
|
464
|
+
len(self._elements) == 0
|
|
465
|
+
or (len(self._elements) == 1 and (PauliI(0),) in self._elements and self._elements[PauliI(0),] == 0)
|
|
466
|
+
)
|
|
467
|
+
if isinstance(other, Number):
|
|
468
|
+
return bool(
|
|
469
|
+
len(self._elements) == 1 and (PauliI(0),) in self._elements and self._elements[PauliI(0),] == other
|
|
470
|
+
)
|
|
471
|
+
if isinstance(other, PauliOperator):
|
|
472
|
+
other = other.to_hamiltonian()
|
|
473
|
+
if isinstance(other, QTensor):
|
|
474
|
+
other = Hamiltonian.from_qtensor(other)
|
|
475
|
+
if not isinstance(other, Hamiltonian):
|
|
476
|
+
return False
|
|
477
|
+
return dict(self._elements) == dict(other._elements)
|
|
478
|
+
|
|
479
|
+
def __ne__(self, other: object) -> bool:
|
|
480
|
+
return not self.__eq__(other)
|
|
481
|
+
|
|
482
|
+
def __hash__(self) -> int:
|
|
483
|
+
items_frozen = frozenset(self._elements.items())
|
|
484
|
+
return hash(items_frozen)
|
|
485
|
+
|
|
486
|
+
def __copy__(self) -> Hamiltonian:
|
|
487
|
+
return Hamiltonian(elements=self._elements.copy())
|
|
488
|
+
|
|
489
|
+
# ------- String representation --------
|
|
490
|
+
|
|
491
|
+
def __repr__(self) -> str:
|
|
492
|
+
return str(self)
|
|
493
|
+
|
|
494
|
+
def __str__(self) -> str:
|
|
495
|
+
# Return "0" if there are no terms
|
|
496
|
+
if not self._elements:
|
|
497
|
+
return "0"
|
|
498
|
+
|
|
499
|
+
def _format_coeff(c: complex) -> str:
|
|
500
|
+
re, im = c.real, c.imag
|
|
501
|
+
|
|
502
|
+
# 1) Purely real?
|
|
503
|
+
if abs(im) < Hamiltonian._EPS:
|
|
504
|
+
re_int = np.round(re)
|
|
505
|
+
if abs(re - re_int) < Hamiltonian._EPS:
|
|
506
|
+
return str(int(re_int)) # e.g. '2' instead of '2.0'
|
|
507
|
+
return str(re) # e.g. '2.5'
|
|
508
|
+
|
|
509
|
+
# 2) Purely imaginary?
|
|
510
|
+
if abs(re) < Hamiltonian._EPS:
|
|
511
|
+
im_int = np.round(im)
|
|
512
|
+
if abs(im - im_int) < Hamiltonian._EPS:
|
|
513
|
+
return f"{int(im_int)}j" # e.g. 2 => '2j', -3 => '-3j'
|
|
514
|
+
return f"{im}j" # e.g. '2.5j'
|
|
515
|
+
|
|
516
|
+
# 3) General complex with nonzero real & imag
|
|
517
|
+
s = str(c) # e.g. '(3+2j)'
|
|
518
|
+
return s
|
|
519
|
+
|
|
520
|
+
# We want to place the single identity term (I(0),) at the front if it exists
|
|
521
|
+
items = list(self.elements.items())
|
|
522
|
+
try:
|
|
523
|
+
i = next(idx for idx, (key, _) in enumerate(items) if len(key) == 1 and key[0] == (PauliI(0)))
|
|
524
|
+
item = items.pop(i)
|
|
525
|
+
items.insert(0, item)
|
|
526
|
+
except StopIteration:
|
|
527
|
+
pass
|
|
528
|
+
|
|
529
|
+
parts = []
|
|
530
|
+
for idx, (operator, coeff) in enumerate(items):
|
|
531
|
+
base_str = _format_coeff(coeff)
|
|
532
|
+
|
|
533
|
+
if idx == 0:
|
|
534
|
+
# first term
|
|
535
|
+
if len(operator) == 1 and operator[0].name == "I":
|
|
536
|
+
coeff_str = base_str
|
|
537
|
+
elif base_str == "1":
|
|
538
|
+
coeff_str = ""
|
|
539
|
+
elif base_str == "-1":
|
|
540
|
+
coeff_str = "-"
|
|
541
|
+
else:
|
|
542
|
+
coeff_str = base_str
|
|
543
|
+
elif base_str == "1":
|
|
544
|
+
coeff_str = "+"
|
|
545
|
+
elif base_str == "-1":
|
|
546
|
+
coeff_str = "-"
|
|
547
|
+
elif base_str.startswith("-"):
|
|
548
|
+
coeff_str = f"- {base_str[1:]}"
|
|
549
|
+
else:
|
|
550
|
+
coeff_str = f"+ {base_str}"
|
|
551
|
+
|
|
552
|
+
# Operators string
|
|
553
|
+
ops_str = " ".join(str(op) for op in operator if op.name != "I")
|
|
554
|
+
if coeff_str and ops_str:
|
|
555
|
+
parts.append(f"{coeff_str} {ops_str}")
|
|
556
|
+
else:
|
|
557
|
+
parts.append(coeff_str + ops_str)
|
|
558
|
+
|
|
559
|
+
return " ".join(parts)
|
|
560
|
+
|
|
561
|
+
def get_commuting_partitions(self) -> list[dict[tuple[PauliOperator, ...], complex | Term | Parameter]]:
|
|
562
|
+
"""
|
|
563
|
+
Split the Hamiltonian into a list of partitions, each containing commuting terms.
|
|
564
|
+
|
|
565
|
+
For now this is a greedy algorithm, but a smarter graph-coloring approach could be used later.
|
|
566
|
+
|
|
567
|
+
Returns:
|
|
568
|
+
list[dict[tuple[PauliOperator, ...], complex | Term | Parameter]]:
|
|
569
|
+
A list of dictionaries, each representing a partition of the Hamiltonian containing commuting terms.
|
|
570
|
+
"""
|
|
571
|
+
partitions: list[dict[tuple[PauliOperator, ...], complex | Term | Parameter]] = []
|
|
572
|
+
|
|
573
|
+
# Check each term with each partition
|
|
574
|
+
for term, coeff in self.elements.items():
|
|
575
|
+
placed = False
|
|
576
|
+
for partition in partitions:
|
|
577
|
+
# Check if the term commutes with all terms in the current partition
|
|
578
|
+
if all(
|
|
579
|
+
Hamiltonian({term: 1}).commutator(Hamiltonian({other_term: 1})) == 0 for other_term in partition
|
|
580
|
+
):
|
|
581
|
+
# If so, add it to this partition
|
|
582
|
+
partition[term] = coeff
|
|
583
|
+
placed = True
|
|
584
|
+
break
|
|
585
|
+
|
|
586
|
+
# Otherwise create a new partition for this term
|
|
587
|
+
if not placed:
|
|
588
|
+
partitions.append({term: coeff})
|
|
589
|
+
|
|
590
|
+
return partitions
|
|
591
|
+
|
|
592
|
+
@classmethod
|
|
593
|
+
def from_qtensor(cls, tensor: QTensor, tol: float | None = None, prune: float | None = None) -> Hamiltonian:
|
|
594
|
+
"""
|
|
595
|
+
Expand a qtensor (dense operator) on n qubits into a sum of Pauli strings,
|
|
596
|
+
returning a qilisdk.analog.Hamiltonian.
|
|
597
|
+
|
|
598
|
+
Args:
|
|
599
|
+
tol (float): Hermiticity check tolerance. Defaults to global zero tolerance setting.
|
|
600
|
+
prune (float): Drop coefficients whose absolute value satisfies ``abs(c) < prune`` to reduce numerical noise. Defaults to global zero tolerance setting.
|
|
601
|
+
|
|
602
|
+
Returns:
|
|
603
|
+
Hamiltonian: Sum_{P in {I,X,Y,Z}^{⊗ n}} c_P * P with c_P = Tr(qt * P) / 2^n
|
|
604
|
+
|
|
605
|
+
Raises
|
|
606
|
+
ValueError: If the input is not square, not a power-of-two dimension, or not Hermitian w.r.t. `tol`.
|
|
607
|
+
"""
|
|
608
|
+
if tol is None:
|
|
609
|
+
tol = get_settings().atol
|
|
610
|
+
if prune is None:
|
|
611
|
+
prune = get_settings().atol
|
|
612
|
+
|
|
613
|
+
A = np.asarray(tensor.dense())
|
|
614
|
+
|
|
615
|
+
dim = tensor.shape[0]
|
|
616
|
+
n = round(np.log2(dim))
|
|
617
|
+
if 2**n != dim:
|
|
618
|
+
raise ValueError(f"Matrix dimension {dim} is not a power of two.")
|
|
619
|
+
if not tensor.is_hermitian():
|
|
620
|
+
raise ValueError("Matrix is not Hermitian within tolerance; cannot form a Hamiltonian.")
|
|
621
|
+
|
|
622
|
+
# QiliSDK Pauli constructors indexed by qubit id
|
|
623
|
+
pauli_for: dict[int, Callable[[int], Hamiltonian]] = {0: I, 1: X, 2: Y, 3: Z}
|
|
624
|
+
|
|
625
|
+
# Normalization from orthonormality: Tr(P_a P_b) = 2^n δ_ab
|
|
626
|
+
norm = 1.0 / (2**n)
|
|
627
|
+
|
|
628
|
+
# Prebuild per-qubit operator “letters” so we can construct full strings quickly
|
|
629
|
+
|
|
630
|
+
H = Hamiltonian() # start additive Hamiltonian expression
|
|
631
|
+
# Full Pauli basis (includes identity on any subset automatically)
|
|
632
|
+
for word in product((0, 1, 2, 3), repeat=n):
|
|
633
|
+
# Compose the word into a QiliSDK operator acting on the proper qubits
|
|
634
|
+
# Example word=(3,1,0) for n=3 -> Z(0)*X(1)*I(2)
|
|
635
|
+
op = Hamiltonian()
|
|
636
|
+
for q, letter in enumerate(word):
|
|
637
|
+
# multiply by the operator on qubit q
|
|
638
|
+
op = op * pauli_for[letter](q) if op != 0 else pauli_for[letter](q)
|
|
639
|
+
|
|
640
|
+
# Convert to dense once; no padding needed because it spans all n qubits
|
|
641
|
+
P_dense = op.to_qtensor(n).dense()
|
|
642
|
+
|
|
643
|
+
# Coefficient c_P = Tr(A P) / 2^n (P is Hermitian)
|
|
644
|
+
c = norm * np.trace(A @ P_dense)
|
|
645
|
+
|
|
646
|
+
# Numerical safety: coefficients should be real for Hermitian A and P
|
|
647
|
+
if abs(c.imag) < tol:
|
|
648
|
+
c = c.real
|
|
649
|
+
|
|
650
|
+
if abs(c) > prune:
|
|
651
|
+
H += c * op
|
|
652
|
+
|
|
653
|
+
# Optional: verify round-trip (use a slightly looser atol to tolerate pruning)
|
|
654
|
+
if not np.allclose(H.to_qtensor(n).dense(), A, atol=max(10 * prune, 1e-9)):
|
|
655
|
+
# If this triggers, consider lowering `prune` or raising `tol`.
|
|
656
|
+
raise ValueError("Pauli expansion failed round-trip check; try adjusting tolerances.")
|
|
657
|
+
|
|
658
|
+
return H
|
|
659
|
+
|
|
660
|
+
@classmethod
|
|
661
|
+
def parse(cls, hamiltonian_str: str) -> Hamiltonian:
|
|
662
|
+
hamiltonian_str = hamiltonian_str.strip()
|
|
663
|
+
|
|
664
|
+
# 1) remove *all* spaces inside any ( … ) group (coefficients or indices)
|
|
665
|
+
hamiltonian_str = re.sub(
|
|
666
|
+
r"\(\s*([0-9A-Za-z.+\-j\s]+?)\s*\)",
|
|
667
|
+
lambda m: "(" + re.sub(r"\s+", "", str(m.group(1))) + ")",
|
|
668
|
+
hamiltonian_str,
|
|
669
|
+
)
|
|
670
|
+
|
|
671
|
+
# 2) collapse multiple spaces down to one (outside the parens now)
|
|
672
|
+
hamiltonian_str = re.sub(r"\s+", " ", hamiltonian_str)
|
|
673
|
+
|
|
674
|
+
# 3) ensure a single space between a closing “)” and the next operator token like X(0)/Y(1)/etc.
|
|
675
|
+
hamiltonian_str = re.sub(r"\)\s*(?=[XYZI]\()", ") ", hamiltonian_str)
|
|
676
|
+
|
|
677
|
+
# Special case: "0" => empty Hamiltonian
|
|
678
|
+
if hamiltonian_str == "0":
|
|
679
|
+
return cls({})
|
|
680
|
+
|
|
681
|
+
elements: dict[tuple[PauliOperator, ...], complex | Term | Parameter] = defaultdict(
|
|
682
|
+
complex
|
|
683
|
+
) # TODO (ameer): the parsing doesn't support Term and Parameters
|
|
684
|
+
|
|
685
|
+
# If there's no initial +/- sign, prepend '+ ' for easier splitting
|
|
686
|
+
if not hamiltonian_str.startswith("+") and not hamiltonian_str.startswith("-"):
|
|
687
|
+
hamiltonian_str = "+ " + hamiltonian_str
|
|
688
|
+
|
|
689
|
+
# Replace " - " with " + - " so each term is split on " + "
|
|
690
|
+
hamiltonian_str = hamiltonian_str.replace(" - ", " + - ")
|
|
691
|
+
|
|
692
|
+
# Split on " + "
|
|
693
|
+
tokens = hamiltonian_str.split(" + ")
|
|
694
|
+
# Remove any empty tokens (can happen if the string started "+ ")
|
|
695
|
+
tokens = [t.strip() for t in tokens if t.strip()]
|
|
696
|
+
|
|
697
|
+
# Regex to match operator tokens like "Z(0)", "X(1)", "I(0)"
|
|
698
|
+
operator_pattern = re.compile(r"([XYZI])\((\d+)\)")
|
|
699
|
+
|
|
700
|
+
def parse_token(token: str) -> tuple[complex, list[PauliOperator]]:
|
|
701
|
+
def looks_like_number(text: str) -> bool:
|
|
702
|
+
# Make sure it's not empty
|
|
703
|
+
if text:
|
|
704
|
+
# If the first char is digit, '(', '.', '+', '-', or '0',
|
|
705
|
+
# or if 'j' is present, assume it's numeric
|
|
706
|
+
first = text[0]
|
|
707
|
+
if first.isdigit() or first in {"(", ".", "+", "-"}:
|
|
708
|
+
return True
|
|
709
|
+
return "j" in text
|
|
710
|
+
|
|
711
|
+
sign = 1
|
|
712
|
+
# Check leading sign
|
|
713
|
+
if token.startswith("-"):
|
|
714
|
+
sign = -1
|
|
715
|
+
token = token[1:].strip()
|
|
716
|
+
elif token.startswith("+"):
|
|
717
|
+
# optional leading '+'
|
|
718
|
+
token = token[1:].strip()
|
|
719
|
+
|
|
720
|
+
words = token.split()
|
|
721
|
+
if not words:
|
|
722
|
+
# e.g. just "-" or "+"
|
|
723
|
+
# means coefficient = ±1, no operators
|
|
724
|
+
return complex(sign), []
|
|
725
|
+
|
|
726
|
+
# Attempt to parse the first word as a numeric coefficient
|
|
727
|
+
maybe_coeff = words[0]
|
|
728
|
+
# Decide if 'maybe_coeff' is numeric or an operator
|
|
729
|
+
if looks_like_number(maybe_coeff):
|
|
730
|
+
# parse as a complex number
|
|
731
|
+
coeff_str = maybe_coeff
|
|
732
|
+
# If it's e.g. '(2.5+3j)', remove parentheses
|
|
733
|
+
if coeff_str.startswith("(") and coeff_str.endswith(")"):
|
|
734
|
+
coeff_str = coeff_str[1:-1]
|
|
735
|
+
coeff_val = complex(coeff_str) * sign
|
|
736
|
+
words = words[1:] # consume this word
|
|
737
|
+
else:
|
|
738
|
+
# No explicit coefficient => ±1
|
|
739
|
+
coeff_val = complex(sign)
|
|
740
|
+
|
|
741
|
+
# Now parse the remaining words as operators
|
|
742
|
+
ops = []
|
|
743
|
+
for w in words:
|
|
744
|
+
match = operator_pattern.fullmatch(w)
|
|
745
|
+
if not match:
|
|
746
|
+
raise ValueError(f"Unrecognized operator format: '{w}'")
|
|
747
|
+
name, qubit_str = match.groups()
|
|
748
|
+
qubit = int(qubit_str)
|
|
749
|
+
op = _get_pauli(name, qubit)
|
|
750
|
+
ops.append(op)
|
|
751
|
+
|
|
752
|
+
return coeff_val, ops
|
|
753
|
+
|
|
754
|
+
for token in tokens:
|
|
755
|
+
coeff, op_list = parse_token(token)
|
|
756
|
+
if not op_list:
|
|
757
|
+
# purely scalar => store as (I(0),)
|
|
758
|
+
elements[PauliI(0),] += coeff
|
|
759
|
+
else:
|
|
760
|
+
# Sort operators by qubit for canonical ordering
|
|
761
|
+
op_list.sort(key=lambda op: op.qubit)
|
|
762
|
+
elements[tuple(op_list)] += coeff
|
|
763
|
+
|
|
764
|
+
hamiltonian = cls(elements)
|
|
765
|
+
hamiltonian.simplify()
|
|
766
|
+
return hamiltonian
|
|
767
|
+
|
|
768
|
+
def commutator(self, h: Hamiltonian) -> Hamiltonian:
|
|
769
|
+
"""compute the commutator of the current hamiltonian with another hamiltonian (h)
|
|
770
|
+
|
|
771
|
+
Args:
|
|
772
|
+
h (Hamiltonian): the second hamiltonian.
|
|
773
|
+
|
|
774
|
+
Returns:
|
|
775
|
+
Hamiltonian: the commutator.
|
|
776
|
+
"""
|
|
777
|
+
return self * h - h * self
|
|
778
|
+
|
|
779
|
+
def anticommutator(self, h: Hamiltonian) -> Hamiltonian:
|
|
780
|
+
"""compute the anticommutator of the current hamiltonian with another hamiltonian (h)
|
|
781
|
+
|
|
782
|
+
Args:
|
|
783
|
+
h (Hamiltonian): the second hamiltonian.
|
|
784
|
+
|
|
785
|
+
Returns:
|
|
786
|
+
Hamiltonian: the anticommutator.
|
|
787
|
+
"""
|
|
788
|
+
return self * h + h * self
|
|
789
|
+
|
|
790
|
+
def vector_norm(self) -> float:
|
|
791
|
+
"""
|
|
792
|
+
Returns:
|
|
793
|
+
float: the vector norm of the hamiltonian.
|
|
794
|
+
"""
|
|
795
|
+
s = 0
|
|
796
|
+
for coeff, _ in self:
|
|
797
|
+
s += np.conj(coeff) * coeff
|
|
798
|
+
return np.real(np.sqrt(s))
|
|
799
|
+
|
|
800
|
+
def frobenius_norm(self) -> float:
|
|
801
|
+
"""
|
|
802
|
+
Returns:
|
|
803
|
+
float: the forbenius norm of the hamiltonian.
|
|
804
|
+
"""
|
|
805
|
+
n = self.nqubits
|
|
806
|
+
s = 0
|
|
807
|
+
for coeff, _ in self:
|
|
808
|
+
s += np.conj(coeff) * coeff
|
|
809
|
+
return np.real(np.sqrt(s) * np.sqrt(2**n))
|
|
810
|
+
|
|
811
|
+
def trace(self) -> Number:
|
|
812
|
+
"""
|
|
813
|
+
Returns:
|
|
814
|
+
float: the trace of the hamiltonian.
|
|
815
|
+
"""
|
|
816
|
+
n = self.nqubits
|
|
817
|
+
d = 2**n
|
|
818
|
+
t = self._elements.get((PauliI(0),), 0)
|
|
819
|
+
if isinstance(t, Parameter):
|
|
820
|
+
return t.evaluate() * d
|
|
821
|
+
if isinstance(t, Term):
|
|
822
|
+
return t.evaluate({}) * d
|
|
823
|
+
return t * d
|
|
824
|
+
|
|
825
|
+
# ------- Internal multiplication helpers --------
|
|
826
|
+
|
|
827
|
+
@staticmethod
|
|
828
|
+
def _multiply_sets(
|
|
829
|
+
set1: tuple[PauliOperator, ...], set2: tuple[PauliOperator, ...]
|
|
830
|
+
) -> tuple[complex, tuple[PauliOperator, ...]]:
|
|
831
|
+
# Combine all operators into a single list
|
|
832
|
+
combined = list(set1) + list(set2)
|
|
833
|
+
|
|
834
|
+
# Group by qubit
|
|
835
|
+
combined.sort(key=lambda op: op.qubit)
|
|
836
|
+
sum_dict: dict[int, list[PauliOperator]] = defaultdict(list)
|
|
837
|
+
for op in combined:
|
|
838
|
+
sum_dict[op.qubit].append(op)
|
|
839
|
+
|
|
840
|
+
accumulated_phase = complex(1)
|
|
841
|
+
final_ops: list[PauliOperator] = []
|
|
842
|
+
|
|
843
|
+
for qubit_ops in sum_dict.values():
|
|
844
|
+
op1 = qubit_ops[0]
|
|
845
|
+
phase = complex(1)
|
|
846
|
+
# Multiply together all operators on the same qubit
|
|
847
|
+
for op2 in qubit_ops[1:]:
|
|
848
|
+
aux_phase, op1 = Hamiltonian._multiply_pauli(op1, op2)
|
|
849
|
+
phase *= aux_phase
|
|
850
|
+
if op1.name != "I":
|
|
851
|
+
final_ops.append(op1)
|
|
852
|
+
accumulated_phase *= phase
|
|
853
|
+
|
|
854
|
+
# If everything simplified to identity, we store I(0)
|
|
855
|
+
if not final_ops:
|
|
856
|
+
final_ops = [PauliI(0)]
|
|
857
|
+
|
|
858
|
+
# Sort again by qubit (to keep canonical form)
|
|
859
|
+
final_ops.sort(key=lambda op: op.qubit)
|
|
860
|
+
return accumulated_phase, tuple(final_ops)
|
|
861
|
+
|
|
862
|
+
@staticmethod
|
|
863
|
+
def _multiply_pauli(op1: PauliOperator, op2: PauliOperator) -> tuple[complex, PauliOperator]:
|
|
864
|
+
if op1.qubit != op2.qubit:
|
|
865
|
+
raise ValueError("Operators must act on the same qubit for multiplication.")
|
|
866
|
+
|
|
867
|
+
# If either is identity, no phase
|
|
868
|
+
if op1.name == "I":
|
|
869
|
+
return (1, op2)
|
|
870
|
+
if op2.name == "I":
|
|
871
|
+
return (1, op1)
|
|
872
|
+
|
|
873
|
+
# Look up the product in the table
|
|
874
|
+
key = (op1.name, op2.name)
|
|
875
|
+
result = Hamiltonian._PAULI_PRODUCT_TABLE.get(key)
|
|
876
|
+
if result is None:
|
|
877
|
+
raise InvalidHamiltonianOperation(f"Multiplying {op1} and {op2} not supported.")
|
|
878
|
+
phase, op_cls = result
|
|
879
|
+
|
|
880
|
+
# By convention, an I operator is always I(0) in this code
|
|
881
|
+
if op_cls is PauliI:
|
|
882
|
+
return phase, PauliI(0)
|
|
883
|
+
# Otherwise, keep the same qubit
|
|
884
|
+
return phase, op_cls(op1.qubit)
|
|
885
|
+
|
|
886
|
+
# ------- Public arithmetic operators --------
|
|
887
|
+
|
|
888
|
+
def __add__(self, other: Number | PauliOperator | Hamiltonian | Term | Parameter) -> Hamiltonian:
|
|
889
|
+
out = copy.copy(self)
|
|
890
|
+
if isinstance(other, Term) and not other.is_parameterized_term():
|
|
891
|
+
raise ValueError(_GENERIC_VARIABLE_IN_TERM_MESSAGE)
|
|
892
|
+
out._add_inplace(other)
|
|
893
|
+
return out.simplify()
|
|
894
|
+
|
|
895
|
+
def __radd__(self, other: Number | PauliOperator | Hamiltonian | Term | Parameter) -> Hamiltonian:
|
|
896
|
+
if isinstance(other, Term) and not other.is_parameterized_term():
|
|
897
|
+
raise ValueError(_GENERIC_VARIABLE_IN_TERM_MESSAGE)
|
|
898
|
+
return self.__add__(other)
|
|
899
|
+
|
|
900
|
+
def __sub__(self, other: Number | PauliOperator | Hamiltonian | Term | Parameter) -> Hamiltonian:
|
|
901
|
+
if isinstance(other, Term) and not other.is_parameterized_term():
|
|
902
|
+
raise ValueError(_GENERIC_VARIABLE_IN_TERM_MESSAGE)
|
|
903
|
+
out = copy.copy(self)
|
|
904
|
+
out._sub_inplace(other)
|
|
905
|
+
return out.simplify()
|
|
906
|
+
|
|
907
|
+
def __rsub__(self, other: Number | PauliOperator | Hamiltonian | Term | Parameter) -> Hamiltonian:
|
|
908
|
+
# (other - self)
|
|
909
|
+
if isinstance(other, Term) and not other.is_parameterized_term():
|
|
910
|
+
raise ValueError(_GENERIC_VARIABLE_IN_TERM_MESSAGE)
|
|
911
|
+
out = copy.copy(other if isinstance(other, Hamiltonian) else Hamiltonian() + other)
|
|
912
|
+
out._sub_inplace(self)
|
|
913
|
+
return out.simplify()
|
|
914
|
+
|
|
915
|
+
def __neg__(self) -> Hamiltonian:
|
|
916
|
+
return -1 * self
|
|
917
|
+
|
|
918
|
+
def __mul__(self, other: Number | PauliOperator | Hamiltonian | Term | Parameter) -> Hamiltonian:
|
|
919
|
+
if isinstance(other, Term) and not other.is_parameterized_term():
|
|
920
|
+
raise ValueError(_GENERIC_VARIABLE_IN_TERM_MESSAGE)
|
|
921
|
+
out = copy.copy(self)
|
|
922
|
+
out._mul_inplace(other)
|
|
923
|
+
return out.simplify()
|
|
924
|
+
|
|
925
|
+
def __rmul__(self, other: Number | PauliOperator | Hamiltonian | Term | Parameter) -> Hamiltonian:
|
|
926
|
+
if isinstance(other, Term) and not other.is_parameterized_term():
|
|
927
|
+
raise ValueError(_GENERIC_VARIABLE_IN_TERM_MESSAGE)
|
|
928
|
+
if isinstance(other, Hamiltonian):
|
|
929
|
+
out = copy.copy(other)
|
|
930
|
+
out._mul_inplace(self)
|
|
931
|
+
return out.simplify()
|
|
932
|
+
return self.__mul__(other)
|
|
933
|
+
|
|
934
|
+
def __truediv__(self, other: Number | PauliOperator | Hamiltonian) -> Hamiltonian:
|
|
935
|
+
out = copy.copy(self)
|
|
936
|
+
out._div_inplace(other)
|
|
937
|
+
return out.simplify()
|
|
938
|
+
|
|
939
|
+
def __rtruediv__(self, other: Number | PauliOperator | Hamiltonian) -> Hamiltonian:
|
|
940
|
+
# (other / self)
|
|
941
|
+
raise InvalidHamiltonianOperation(_DIVISION_BY_OPERATORS_MESSAGE)
|
|
942
|
+
|
|
943
|
+
__iadd__ = __add__
|
|
944
|
+
__isub__ = __sub__
|
|
945
|
+
__imul__ = __mul__
|
|
946
|
+
__itruediv__ = __truediv__
|
|
947
|
+
|
|
948
|
+
def _add_inplace(self, other: Number | PauliOperator | Hamiltonian | Term | Parameter) -> None:
|
|
949
|
+
if isinstance(other, Hamiltonian):
|
|
950
|
+
# If it's empty, do nothing
|
|
951
|
+
if not other.elements:
|
|
952
|
+
return
|
|
953
|
+
# Otherwise, add each term
|
|
954
|
+
for key, val in other._elements.items(): # noqa: SLF001
|
|
955
|
+
self._elements[key] += val
|
|
956
|
+
|
|
957
|
+
self._parameters.update(other.parameters)
|
|
958
|
+
elif isinstance(other, PauliOperator):
|
|
959
|
+
# Just add 1 to that single operator key
|
|
960
|
+
self._elements[other,] += 1
|
|
961
|
+
elif isinstance(other, (int, float, complex)):
|
|
962
|
+
if abs(other) < get_settings().atol:
|
|
963
|
+
return
|
|
964
|
+
# Add the scalar to (I(0),)
|
|
965
|
+
self._elements[PauliI(0),] += other
|
|
966
|
+
elif isinstance(other, (Term, Parameter)):
|
|
967
|
+
if isinstance(other, Term):
|
|
968
|
+
if not other.is_parameterized_term():
|
|
969
|
+
raise ValueError(_GENERIC_VARIABLE_IN_HAMILTONIAN_MESSAGE)
|
|
970
|
+
self._parameters.update({v.label: v for v in other if isinstance(v, Parameter)})
|
|
971
|
+
else:
|
|
972
|
+
self._parameters[other.label] = other
|
|
973
|
+
self._elements[PauliI(0),] += other
|
|
974
|
+
else:
|
|
975
|
+
raise InvalidHamiltonianOperation(f"Invalid addition between Hamiltonian and {other.__class__.__name__}.")
|
|
976
|
+
|
|
977
|
+
def _sub_inplace(self, other: Number | PauliOperator | Hamiltonian | Term | Parameter) -> None:
|
|
978
|
+
if isinstance(other, Hamiltonian):
|
|
979
|
+
for key, val in other._elements.items(): # noqa: SLF001
|
|
980
|
+
self._elements[key] -= val
|
|
981
|
+
self._parameters.update(other._parameters) # noqa: SLF001
|
|
982
|
+
elif isinstance(other, PauliOperator):
|
|
983
|
+
self._elements[other,] -= 1
|
|
984
|
+
elif isinstance(other, (int, float, complex)):
|
|
985
|
+
if abs(other) < get_settings().atol:
|
|
986
|
+
return
|
|
987
|
+
self._elements[PauliI(0),] -= other
|
|
988
|
+
elif isinstance(other, (Term, Parameter)):
|
|
989
|
+
if isinstance(other, Term):
|
|
990
|
+
if not other.is_parameterized_term():
|
|
991
|
+
raise ValueError(_GENERIC_VARIABLE_IN_HAMILTONIAN_MESSAGE)
|
|
992
|
+
self._parameters.update({v.label: v for v in other if isinstance(v, Parameter)})
|
|
993
|
+
else:
|
|
994
|
+
self._parameters[other.label] = other
|
|
995
|
+
self._elements[PauliI(0),] -= other
|
|
996
|
+
else:
|
|
997
|
+
raise InvalidHamiltonianOperation(
|
|
998
|
+
f"Invalid subtraction between Hamiltonian and {other.__class__.__name__}."
|
|
999
|
+
)
|
|
1000
|
+
|
|
1001
|
+
def _mul_inplace(self, other: Number | PauliOperator | Hamiltonian | Term | Parameter) -> None:
|
|
1002
|
+
if isinstance(other, (int, float, complex)):
|
|
1003
|
+
# 0 short-circuit
|
|
1004
|
+
if abs(other) < get_settings().atol:
|
|
1005
|
+
# everything becomes 0
|
|
1006
|
+
self._elements.clear()
|
|
1007
|
+
return None
|
|
1008
|
+
# 1 short-circuit
|
|
1009
|
+
if other == 1:
|
|
1010
|
+
return None
|
|
1011
|
+
# scale all coefficients
|
|
1012
|
+
for k in self._elements:
|
|
1013
|
+
self._elements[k] *= other
|
|
1014
|
+
return None
|
|
1015
|
+
|
|
1016
|
+
if isinstance(other, (Term, Parameter)):
|
|
1017
|
+
if isinstance(other, Term):
|
|
1018
|
+
if not other.is_parameterized_term():
|
|
1019
|
+
raise ValueError(_GENERIC_VARIABLE_IN_HAMILTONIAN_MESSAGE)
|
|
1020
|
+
self._parameters.update({v.label: v for v in other if isinstance(v, Parameter)})
|
|
1021
|
+
else:
|
|
1022
|
+
self._parameters[other.label] = other
|
|
1023
|
+
for k in self._elements:
|
|
1024
|
+
self._elements[k] *= other
|
|
1025
|
+
return None
|
|
1026
|
+
|
|
1027
|
+
if isinstance(other, PauliOperator):
|
|
1028
|
+
# Convert single PauliOperator -> Hamiltonian with 1 key
|
|
1029
|
+
# Then do the single-key Hamiltonian path below
|
|
1030
|
+
other = other.to_hamiltonian()
|
|
1031
|
+
|
|
1032
|
+
if isinstance(other, Hamiltonian):
|
|
1033
|
+
if not other.elements:
|
|
1034
|
+
# Multiply by "0" Hamiltonian => 0
|
|
1035
|
+
self._elements.clear()
|
|
1036
|
+
return None
|
|
1037
|
+
|
|
1038
|
+
# Check if 'other' is purely scalar identity => short-circuit
|
|
1039
|
+
if len(other.elements) == 1:
|
|
1040
|
+
((ops2, c2),) = other._elements.items() # single item # noqa: SLF001
|
|
1041
|
+
if len(ops2) == 1:
|
|
1042
|
+
op2 = ops2[0]
|
|
1043
|
+
if op2.name == "I" and op2.qubit == 0:
|
|
1044
|
+
# effectively scalar c2
|
|
1045
|
+
return self._mul_inplace(c2)
|
|
1046
|
+
|
|
1047
|
+
# Otherwise, we do the general multiply
|
|
1048
|
+
new_dict: dict[tuple[PauliOperator, ...], complex | Term | Parameter] = defaultdict(complex)
|
|
1049
|
+
for ops1, c1 in self._elements.items():
|
|
1050
|
+
for ops2, c2 in other._elements.items(): # noqa: SLF001
|
|
1051
|
+
phase, new_ops = self._multiply_sets(ops1, ops2)
|
|
1052
|
+
new_dict[new_ops] += phase * c1 * c2
|
|
1053
|
+
self._elements = new_dict
|
|
1054
|
+
self._parameters.update(other._parameters) # noqa: SLF001
|
|
1055
|
+
|
|
1056
|
+
else:
|
|
1057
|
+
raise InvalidHamiltonianOperation(
|
|
1058
|
+
f"Invalid multiplication between Hamiltonian and {other.__class__.__name__}."
|
|
1059
|
+
)
|
|
1060
|
+
return None
|
|
1061
|
+
|
|
1062
|
+
def _div_inplace(self, other: Number | PauliOperator | Hamiltonian) -> None:
|
|
1063
|
+
# Only valid for scalars
|
|
1064
|
+
if not isinstance(other, (int, float, complex)):
|
|
1065
|
+
raise InvalidHamiltonianOperation(_DIVISION_BY_OPERATORS_MESSAGE)
|
|
1066
|
+
if abs(other) < get_settings().atol:
|
|
1067
|
+
raise ZeroDivisionError("Cannot divide by zero.")
|
|
1068
|
+
self._mul_inplace(1 / other)
|