from __future__ import annotations
import sys
from threading import Lock
from typing import (
    Any,
    Union,
    Optional,
    NoReturn,
    overload,
)
if sys.version_info >= (3, 8):
    from typing import (
        final,
        Final,
        Literal,
    )
else:
    from typing_extensions import (
        final,
        Final,
        Literal,
    )
if sys.version_info >= (3, 9):
    from collections.abc import (
        Callable,
        Hashable,
        Iterable,
        Iterator,
        Sequence,
        Mapping,
    )
else:
    from typing import (
        Callable,
        Hashable,
        Iterable,
        Iterator,
        Sequence,
        Mapping,
    )
if sys.version_info >= (3, 11):
    from typing import Self
else:
    from typing_extensions import Self
from os import PathLike

import numpy

from numpy import (
    dtype,
    ndarray,
)

from mpi4py.MPI import (
    Datatype,
    Intracomm,
    Op,
)

from petsc4py.typing import (
    Scalar,
    ArrayBool,
    ArrayComplex,
    ArrayInt,
    ArrayReal,
    ArrayScalar,
    CSRIndicesSpec,
    CSRSpec,
    DMCoarsenHookFunction,
    DMRestrictHookFunction,
    DimsSpec,
    KSPConvergenceTestFunction,
    KSPMonitorFunction,
    KSPOperatorsFunction,
    KSPPostSolveFunction,
    KSPPreSolveFunction,
    KSPRHSFunction,
    LayoutSizeSpec,
    MatAssemblySpec,
    MatBlockSizeSpec,
    MatNullFunction,
    MatSizeSpec,
    NNZSpec,
    NormTypeSpec,
    PetscOptionsHandlerFunction,
    ScatterModeSpec,
    SNESMonitorFunction,
    SNESObjFunction,
    SNESFunction,
    SNESJacobianFunction,
    SNESGuessFunction,
    SNESUpdateFunction,
    SNESLSPreFunction,
    SNESNGSFunction,
    SNESConvergedFunction,
    TAOConstraintsFunction,
    TAOConstraintsJacobianFunction,
    TAOConvergedFunction,
    TAOGradientFunction,
    TAOHessianFunction,
    TAOJacobianFunction,
    TAOJacobianResidualFunction,
    TAOMonitorFunction,
    TAOObjectiveFunction,
    TAOObjectiveGradientFunction,
    TAOResidualFunction,
    TAOUpdateFunction,
    TAOVariableBoundsFunction,
    TAOLSGradientFunction,
    TAOLSObjectiveFunction,
    TAOLSObjectiveGradientFunction,
    TSI2Function,
    TSI2Jacobian,
    TSI2JacobianP,
    TSIFunction,
    TSIJacobian,
    TSIJacobianP,
    TSIndicatorFunction,
    TSMonitorFunction,
    TSPostEventFunction,
    TSPostStepFunction,
    TSPreStepFunction,
    TSRHSFunction,
    TSRHSJacobian,
    TSRHSJacobianP,
    AccessModeSpec,
    InsertModeSpec,
)

from slepc4py.typing import (
    EPSStoppingFunction,
    EPSArbitraryFunction,
    EPSEigenvalueComparison,
    EPSMonitorFunction,
    PEPStoppingFunction,
    PEPEigenvalueComparison,
    PEPMonitorFunction,
    NEPStoppingFunction,
    NEPEigenvalueComparison,
    NEPMonitorFunction,
    NEPFunction,
    NEPJacobian,
    SVDStoppingFunction,
    SVDMonitorFunction,
    MFNMonitorFunction,
    LMEMonitorFunction,
)

IntType: numpy.dtype = ...
RealType: numpy.dtype = ...
ComplexType: numpy.dtype = ...
ScalarType: numpy.dtype = ...

DECIDE: Final[int] = ...
DEFAULT: Final[int] = ...
DETERMINE: Final[int] = ...
CURRENT: Final[int] = ...

class ST(Object):
    class Type:
        SHIFT: Final[str] = ...
        SINVERT: Final[str] = ...
        CAYLEY: Final[str] = ...
        PRECOND: Final[str] = ...
        FILTER: Final[str] = ...
        SHELL: Final[str] = ...
    class MatMode:
        COPY: Final[int] = ...
        INPLACE: Final[int] = ...
        SHELL: Final[int] = ...
    class FilterType:
        FILTLAN: Final[int] = ...
        CHEBYSHEV: Final[int] = ...
    class FilterDamping:
        NONE: Final[int] = ...
        JACKSON: Final[int] = ...
        LANCZOS: Final[int] = ...
        FEJER: Final[int] = ...
    def view(self, viewer: Viewer | None = None) -> None: ...
    def destroy(self) -> Self: ...
    def reset(self) -> None: ...
    def create(self, comm: Comm | None = None) -> Self: ...
    def setType(self, st_type: Type | str) -> None: ...
    def getType(self) -> str: ...
    def setOptionsPrefix(self, prefix: str | None = None) -> None: ...
    def getOptionsPrefix(self) -> str: ...
    def appendOptionsPrefix(self, prefix: str | None = None) -> None: ...
    def setFromOptions(self) -> None: ...
    def setShift(self, shift: Scalar) -> None: ...
    def getShift(self) -> Scalar: ...
    def setTransform(self, flag: bool = True) -> None: ...
    def getTransform(self) -> bool: ...
    def setMatMode(self, mode: MatMode) -> None: ...
    def getMatMode(self) -> MatMode: ...
    def setMatrices(self, operators: list[Mat]) -> None: ...
    def getMatrices(self) -> list[Mat]: ...
    def setMatStructure(self, structure: petsc4py.PETSc.Mat.Structure) -> None: ...
    def getMatStructure(self) -> petsc4py.PETSc.Mat.Structure: ...
    def setKSP(self, ksp: KSP) -> None: ...
    def getKSP(self) -> KSP: ...
    def setPreconditionerMat(self, P: Mat | None = None) -> None: ...
    def getPreconditionerMat(self) -> Mat: ...
    def setSplitPreconditioner(self, operators: list[petsc4py.PETSc.Mat], structure: petsc4py.PETSc.Mat.Structure | None = None) -> None: ...
    def getSplitPreconditioner(self) -> tuple[list[petsc4py.PETSc.Mat], petsc4py.PETSc.Mat.Structure]: ...
    def setUp(self) -> None: ...
    def apply(self, x: Vec, y: Vec) -> None: ...
    def applyTranspose(self, x: Vec, y: Vec) -> None: ...
    def applyHermitianTranspose(self, x: Vec, y: Vec) -> None: ...
    def applyMat(self, X: Mat, Y: Mat) -> None: ...
    def getOperator(self) -> Mat: ...
    def restoreOperator(self, op: Mat) -> None: ...
    def setCayleyAntishift(self, mu: Scalar) -> None: ...
    def getCayleyAntishift(self) -> Scalar: ...
    def setFilterType(self, filter_type: FilterType) -> None: ...
    def getFilterType(self) -> FilterType: ...
    def setFilterInterval(self, inta: float, intb: float) -> None: ...
    def getFilterInterval(self) -> tuple[float, float]: ...
    def setFilterRange(self, left: float, right: float) -> None: ...
    def getFilterRange(self) -> tuple[float, float]: ...
    def setFilterDegree(self, deg: int) -> None: ...
    def getFilterDegree(self) -> int: ...
    def setFilterDamping(self, damping: FilterDamping) -> None: ...
    def getFilterDamping(self) -> FilterDamping: ...
    shift: float
    transform: bool
    mat_mode: STMatMode
    mat_structure: MatStructure
    ksp: KSP

class BV(Object):
    class Type:
        MAT: Final[str] = ...
        SVEC: Final[str] = ...
        VECS: Final[str] = ...
        CONTIGUOUS: Final[str] = ...
        TENSOR: Final[str] = ...
    class OrthogType:
        CGS: Final[int] = ...
        MGS: Final[int] = ...
    class OrthogRefineType:
        IFNEEDED: Final[int] = ...
        NEVER: Final[int] = ...
        ALWAYS: Final[int] = ...
    
    class OrthogBlockType:
        GS: Final[int] = ...
        CHOL: Final[int] = ...
        TSQR: Final[int] = ...
        TSQRCHOL: Final[int] = ...
        SVQB: Final[int] = ...
    
    class MatMultType:
        VECS: Final[int] = ...
        MAT: Final[int] = ...
    class SVDMethod:
        REFINE: Final[int] = ...
        QR: Final[int] = ...
        QR_CAA: Final[int] = ...
    def view(self, viewer: Viewer | None = None) -> None: ...
    def destroy(self) -> Self: ...
    def create(self, comm: Comm | None = None) -> Self: ...
    def createFromMat(self, A: Mat) -> Self: ...
    def createMat(self) -> Mat: ...
    def duplicate(self) -> BV: ...
    def duplicateResize(self, m: int) -> BV: ...
    def copy(self, result: BV | None = None) -> BV: ...
    def setType(self, bv_type: Type | str) -> None: ...
    def getType(self) -> str: ...
    def setSizes(self, sizes: LayoutSizeSpec, m: int) -> None: ...
    def setSizesFromVec(self, w: Vec, m: int) -> None: ...
    def getSizes(self) -> tuple[LayoutSizeSpec, int]: ...
    def setLeadingDimension(self, ld: int) -> None: ...
    def getLeadingDimension(self) -> int: ...
    def getArray(self, readonly: bool = False) -> ArrayScalar: ...
    def setOptionsPrefix(self, prefix: str | None = None) -> None: ...
    def appendOptionsPrefix(self, prefix: str | None = None) -> None: ...
    def getOptionsPrefix(self) -> str: ...
    def setFromOptions(self) -> None: ...
    def getOrthogonalization(self) -> tuple[OrthogType, OrthogRefineType, float, OrthogBlockType]: ...
    def setOrthogonalization(self, otype: OrthogType | None = None, refine: OrthogRefineType | None = None, eta: float | None = None, block: OrthogBlockType | None = None) -> None: ...
    def getMatMultMethod(self) -> MatMultType: ...
    def setMatMultMethod(self, method: MatMultType) -> None: ...
    def getMatrix(self) -> tuple[Mat, bool] | tuple[None, bool]: ...
    def setMatrix(self, B: Mat | None, indef: bool = False) -> None: ...
    def applyMatrix(self, x: Vec, y: Vec) -> None: ...
    def setActiveColumns(self, l: int, k: int) -> None: ...
    def getActiveColumns(self) -> tuple[int, int]: ...
    def scaleColumn(self, j: int, alpha: Scalar) -> None: ...
    def scale(self, alpha: Scalar) -> None: ...
    def insertVec(self, j: int, w: Vec) -> None: ...
    def insertVecs(self, s: int, W: Vec | list[Vec], orth: bool = False) -> int: ...
    def insertConstraints(self, C: Vec | list[Vec]) -> int: ...
    def setNumConstraints(self, nc: int) -> None: ...
    def getNumConstraints(self) -> int: ...
    def createVec(self) -> Vec: ...
    def setVecType(self, vec_type: petsc4py.PETSc.Vec.Type | str) -> None: ...
    def getVecType(self) -> str: ...
    def copyVec(self, j: int, v: Vec) -> None: ...
    def copyColumn(self, j: int, i: int) -> None: ...
    def setDefiniteTolerance(self, deftol: float) -> None: ...
    def getDefiniteTolerance(self) -> float: ...
    def dotVec(self, v: Vec) -> ArrayScalar: ...
    def dotColumn(self, j: int) -> ArrayScalar: ...
    def getColumn(self, j: int) -> Vec: ...
    def restoreColumn(self, j: int, v: Vec) -> None: ...
    def getMat(self) -> Mat: ...
    def restoreMat(self, A: Mat) -> None: ...
    def dot(self, Y: BV) -> Mat: ...
    def matProject(self, A: Mat | None, Y: BV) -> Mat: ...
    def matMult(self, A: Mat, Y: BV | None = None) -> BV: ...
    def matMultTranspose(self, A: Mat, Y: BV | None = None) -> BV: ...
    def matMultHermitianTranspose(self, A: Mat, Y: BV | None = None) -> BV: ...
    def matMultColumn(self, A: Mat, j: int) -> None: ...
    def matMultTransposeColumn(self, A: Mat, j: int) -> None: ...
    def matMultHermitianTransposeColumn(self, A: Mat, j: int) -> None: ...
    def mult(self, delta: Scalar, gamma: Scalar, X: BV, Q: Mat | None) -> None: ...
    def multInPlace(self, Q: Mat, s: int, e: int) -> None: ...
    def multColumn(self, delta: Scalar, gamma: Scalar, j: int, q: Sequence[Scalar]) -> None: ...
    def multVec(self, delta: Scalar, gamma: Scalar, y: Vec, q: Sequence[Scalar]) -> None: ...
    def normColumn(self, j: int, norm_type: NormType | None = None) -> float: ...
    def norm(self, norm_type: NormType | None = None) -> float: ...
    def resize(self, m: int, copy: bool = True) -> None: ...
    def setRandom(self) -> None: ...
    def setRandomNormal(self) -> None: ...
    def setRandomSign(self) -> None: ...
    def setRandomColumn(self, j: int) -> None: ...
    def setRandomCond(self, condn: float) -> None: ...
    def setRandomContext(self, rnd: Random) -> None: ...
    def getRandomContext(self) -> Random: ...
    def orthogonalizeVec(self, v: Vec) -> tuple[float, bool]: ...
    def orthogonalizeColumn(self, j: int) -> tuple[float, bool]: ...
    def orthonormalizeColumn(self, j: int, replace: bool = False) -> tuple[float, bool]: ...
    def orthogonalize(self, R: Mat | None = None, **kargs: Any) -> None: ...
    sizes: tuple[LayoutSizeSpec, int]
    size: tuple[int, int]
    local_size: int
    column_size: int

class DS(Object):
    class Type:
        HEP: Final[str] = ...
        NHEP: Final[str] = ...
        GHEP: Final[str] = ...
        GHIEP: Final[str] = ...
        GNHEP: Final[str] = ...
        NHEPTS: Final[str] = ...
        SVD: Final[str] = ...
        HSVD: Final[str] = ...
        GSVD: Final[str] = ...
        PEP: Final[str] = ...
        NEP: Final[str] = ...
    class StateType:
        RAW: Final[int] = ...
        INTERMEDIATE: Final[int] = ...
        CONDENSED: Final[int] = ...
        TRUNCATED: Final[int] = ...
    class MatType:
        A: Final[int] = ...
        B: Final[int] = ...
        C: Final[int] = ...
        T: Final[int] = ...
        D: Final[int] = ...
        Q: Final[int] = ...
        Z: Final[int] = ...
        X: Final[int] = ...
        Y: Final[int] = ...
        U: Final[int] = ...
        V: Final[int] = ...
        W: Final[int] = ...
    class ParallelType:
        REDUNDANT: Final[int] = ...
        SYNCHRONIZED: Final[int] = ...
        DISTRIBUTED: Final[int] = ...
    def view(self, viewer: Viewer | None = None) -> None: ...
    def destroy(self) -> Self: ...
    def reset(self) -> None: ...
    def create(self, comm: Comm | None = None) -> Self: ...
    def setType(self, ds_type: Type | str) -> None: ...
    def getType(self) -> str: ...
    def setOptionsPrefix(self, prefix: str | None = None) -> None: ...
    def appendOptionsPrefix(self, prefix: str | None = None) -> None: ...
    def getOptionsPrefix(self) -> str: ...
    def setFromOptions(self) -> None: ...
    def duplicate(self) -> DS: ...
    def allocate(self, ld: int) -> None: ...
    def getLeadingDimension(self) -> int: ...
    def setState(self, state: StateType) -> None: ...
    def getState(self) -> StateType: ...
    def setParallel(self, pmode: ParallelType) -> None: ...
    def getParallel(self) -> ParallelType: ...
    def setDimensions(self, n: int | None = None, l: int | None = None, k: int | None = None) -> None: ...
    def getDimensions(self) -> tuple[int, int, int, int]: ...
    def setBlockSize(self, bs: int) -> None: ...
    def getBlockSize(self) -> int: ...
    def setMethod(self, meth: int) -> None: ...
    def getMethod(self) -> int: ...
    def setCompact(self, comp: bool) -> None: ...
    def getCompact(self) -> bool: ...
    def setExtraRow(self, ext: bool) -> None: ...
    def getExtraRow(self) -> bool: ...
    def setRefined(self, ref: bool) -> None: ...
    def getRefined(self) -> bool: ...
    def truncate(self, n: int, trim: bool = False) -> None: ...
    def updateExtraRow(self) -> None: ...
    def getMat(self, matname: MatType) -> Mat: ...
    def restoreMat(self, matname: MatType, mat: petsc4py.PETSc.Mat) -> None: ...
    def getArray(self, matname: MatType) -> ArrayScalar: ...
    def setIdentity(self, matname: MatType) -> None: ...
    def cond(self) -> float: ...
    def solve(self) -> ArrayScalar: ...
    def vectors(self, matname=MatType.X) -> None: ...
    def setSVDDimensions(self, m: int) -> None: ...
    def getSVDDimensions(self) -> int: ...
    def setHSVDDimensions(self, m: int) -> None: ...
    def getHSVDDimensions(self) -> int: ...
    def setGSVDDimensions(self, m: int, p: int) -> None: ...
    def getGSVDDimensions(self) -> tuple[int, int]: ...
    def setPEPDegree(self, deg: int) -> None: ...
    def getPEPDegree(self) -> int: ...
    def setPEPCoefficients(self, pbc: Sequence[float]) -> None: ...
    def getPEPCoefficients(self) -> ArrayReal: ...
    state: DSStateType
    parallel: DSParallelType
    block_size: int
    method: int
    compact: bool
    extra_row: bool
    refined: bool

class FN(Object):
    class Type:
        COMBINE: Final[str] = ...
        RATIONAL: Final[str] = ...
        EXP: Final[str] = ...
        LOG: Final[str] = ...
        PHI: Final[str] = ...
        SQRT: Final[str] = ...
        INVSQRT: Final[str] = ...
    class CombineType:
        ADD: Final[int] = ...
        MULTIPLY: Final[int] = ...
        DIVIDE: Final[int] = ...
        COMPOSE: Final[int] = ...
    class ParallelType:
        REDUNDANT: Final[int] = ...
        SYNCHRONIZED: Final[int] = ...
    def view(self, viewer: Viewer | None = None) -> None: ...
    def destroy(self) -> Self: ...
    def create(self, comm: Comm | None = None) -> Self: ...
    def setType(self, fn_type: Type | str) -> None: ...
    def getType(self) -> str: ...
    def setOptionsPrefix(self, prefix: str | None = None) -> None: ...
    def appendOptionsPrefix(self, prefix: str | None = None) -> None: ...
    def getOptionsPrefix(self) -> str: ...
    def setFromOptions(self) -> None: ...
    def duplicate(self, comm: Comm | None = None) -> FN: ...
    def evaluateFunction(self, x: Scalar) -> Scalar: ...
    def evaluateDerivative(self, x: Scalar) -> Scalar: ...
    def evaluateFunctionMat(self, A: Mat, B: Mat | None = None) -> Mat: ...
    def evaluateFunctionMatVec(self, A: Mat, v: Vec | None = None) -> Vec: ...
    def setScale(self, alpha: Scalar | None = None, beta: Scalar | None = None) -> None: ...
    def getScale(self) -> tuple[Scalar, Scalar]: ...
    def setMethod(self, meth: int) -> None: ...
    def getMethod(self) -> int: ...
    def setParallel(self, pmode: ParallelType) -> None: ...
    def getParallel(self) -> ParallelType: ...
    def setRationalNumerator(self, alpha: Sequence[Scalar]) -> None: ...
    def getRationalNumerator(self) -> ArrayScalar: ...
    def setRationalDenominator(self, alpha: Sequence[Scalar]) -> None: ...
    def getRationalDenominator(self) -> ArrayScalar: ...
    def setCombineChildren(self, comb: CombineType, f1: FN, f2: FN) -> None: ...
    def getCombineChildren(self) -> tuple[CombineType, FN, FN]: ...
    def setPhiIndex(self, k: int) -> None: ...
    def getPhiIndex(self) -> int: ...
    method: int
    parallel: FNParallelType

class RG(Object):
    class Type:
        INTERVAL: Final[str] = ...
        POLYGON: Final[str] = ...
        ELLIPSE: Final[str] = ...
        RING: Final[str] = ...
    class QuadRule:
        TRAPEZOIDAL: Final[int] = ...
        CHEBYSHEV: Final[int] = ...
    def view(self, viewer: Viewer | None = None) -> None: ...
    def destroy(self) -> Self: ...
    def create(self, comm: Comm | None = None) -> Self: ...
    def setType(self, rg_type: Type | str) -> None: ...
    def getType(self) -> str: ...
    def setOptionsPrefix(self, prefix: str | None = None) -> None: ...
    def getOptionsPrefix(self) -> str: ...
    def appendOptionsPrefix(self, prefix: str | None = None) -> None: ...
    def setFromOptions(self) -> None: ...
    def isTrivial(self) -> bool: ...
    def isAxisymmetric(self, vertical: bool = False) -> bool: ...
    def getComplement(self) -> bool: ...
    def setComplement(self, comp: bool = True) -> None: ...
    def setScale(self, sfactor: float = None) -> None: ...
    def getScale(self) -> float: ...
    def checkInside(self, a: Sequence[complex]) -> ArrayInt: ...
    def computeContour(self, n: int) -> list[complex]: ...
    def computeBoundingBox(self) -> tuple[float, float, float, float]: ...
    def canUseConjugates(self, realmats: bool = True) -> bool: ...
    def computeQuadrature(self, quad: QuadRule, n: int) -> tuple[ArrayScalar, ArrayScalar, ArrayScalar]: ...
    def setEllipseParameters(self, center: Scalar, radius: float, vscale: float | None = None) -> None: ...
    def getEllipseParameters(self) -> tuple[Scalar, float, float]: ...
    def setIntervalEndpoints(self, a: float, b: float, c: float, d: float) -> None: ...
    def getIntervalEndpoints(self) -> tuple[float, float, float, float]: ...
    def setPolygonVertices(self, v: Sequence[float] | Sequence[Scalar]) -> None: ...
    def getPolygonVertices(self) -> ArrayComplex: ...
    def setRingParameters(self, center: Scalar, radius: float, vscale: float, start_ang: float, end_ang: float, width: float) -> None: ...
    def getRingParameters(self) -> tuple[Scalar, float, float, float, float, float]: ...
    complement: bool
    scale: float

class EPS(Object):
    class Type:
        POWER: Final[str] = ...
        SUBSPACE: Final[str] = ...
        ARNOLDI: Final[str] = ...
        LANCZOS: Final[str] = ...
        KRYLOVSCHUR: Final[str] = ...
        GD: Final[str] = ...
        JD: Final[str] = ...
        RQCG: Final[str] = ...
        LOBPCG: Final[str] = ...
        CISS: Final[str] = ...
        LYAPII: Final[str] = ...
        LAPACK: Final[str] = ...
        ARPACK: Final[str] = ...
        BLOPEX: Final[str] = ...
        PRIMME: Final[str] = ...
        FEAST: Final[str] = ...
        SCALAPACK: Final[str] = ...
        ELPA: Final[str] = ...
        ELEMENTAL: Final[str] = ...
        EVSL: Final[str] = ...
        CHASE: Final[str] = ...
    class ProblemType:
        HEP: Final[int] = ...
        NHEP: Final[int] = ...
        GHEP: Final[int] = ...
        GNHEP: Final[int] = ...
        PGNHEP: Final[int] = ...
        GHIEP: Final[int] = ...
        BSE: Final[int] = ...
        HAMILT: Final[int] = ...
        LREP: Final[int] = ...
    class Extraction:
        RITZ: Final[int] = ...
        HARMONIC: Final[int] = ...
        HARMONIC_RELATIVE: Final[int] = ...
        HARMONIC_RIGHT: Final[int] = ...
        HARMONIC_LARGEST: Final[int] = ...
        REFINED: Final[int] = ...
        REFINED_HARMONIC: Final[int] = ...
    class Balance:
        NONE: Final[int] = ...
        ONESIDE: Final[int] = ...
        TWOSIDE: Final[int] = ...
        USER: Final[int] = ...
    class ErrorType:
        ABSOLUTE: Final[int] = ...
        RELATIVE: Final[int] = ...
        BACKWARD: Final[int] = ...
    class Which:
        LARGEST_MAGNITUDE: Final[int] = ...
        SMALLEST_MAGNITUDE: Final[int] = ...
        LARGEST_REAL: Final[int] = ...
        SMALLEST_REAL: Final[int] = ...
        LARGEST_IMAGINARY: Final[int] = ...
        SMALLEST_IMAGINARY: Final[int] = ...
        TARGET_MAGNITUDE: Final[int] = ...
        TARGET_REAL: Final[int] = ...
        TARGET_IMAGINARY: Final[int] = ...
        ALL: Final[int] = ...
        USER: Final[int] = ...
    class Conv:
        ABS: Final[int] = ...
        REL: Final[int] = ...
        NORM: Final[int] = ...
        USER: Final[int] = ...
    class Stop:
        BASIC: Final[int] = ...
        USER: Final[int] = ...
        THRESHOLD: Final[int] = ...
    class ConvergedReason:
        CONVERGED_TOL: Final[int] = ...
        CONVERGED_USER: Final[int] = ...
        DIVERGED_ITS: Final[int] = ...
        DIVERGED_BREAKDOWN: Final[int] = ...
        DIVERGED_SYMMETRY_LOST: Final[int] = ...
        CONVERGED_ITERATING: Final[int] = ...
        ITERATING: Final[int] = ...
    class PowerShiftType:
        CONSTANT: Final[int] = ...
        RAYLEIGH: Final[int] = ...
        WILKINSON: Final[int] = ...
    class KrylovSchurBSEType:
        SHAO: Final[int] = ...
        GRUNING: Final[int] = ...
        PROJECTEDBSE: Final[int] = ...
    class LanczosReorthogType:
        LOCAL: Final[int] = ...
        FULL: Final[int] = ...
        SELECTIVE: Final[int] = ...
        PERIODIC: Final[int] = ...
        PARTIAL: Final[int] = ...
        DELAYED: Final[int] = ...
    class CISSQuadRule:
        TRAPEZOIDAL: Final[int] = ...
        CHEBYSHEV: Final[int] = ...
    class CISSExtraction:
        RITZ: Final[int] = ...
        HANKEL: Final[int] = ...
    def view(self, viewer: Viewer | None = None) -> None: ...
    def destroy(self) -> Self: ...
    def reset(self) -> None: ...
    def create(self, comm: Comm | None = None) -> Self: ...
    def setType(self, eps_type: Type | str) -> None: ...
    def getType(self) -> str: ...
    def getOptionsPrefix(self) -> str: ...
    def setOptionsPrefix(self, prefix: str | None = None) -> None: ...
    def appendOptionsPrefix(self, prefix: str | None = None) -> None: ...
    def setFromOptions(self) -> None: ...
    def getProblemType(self) -> ProblemType: ...
    def setProblemType(self, problem_type: ProblemType) -> None: ...
    def isGeneralized(self) -> bool: ...
    def isHermitian(self) -> bool: ...
    def isPositive(self) -> bool: ...
    def isStructured(self) -> bool: ...
    def getBalance(self) -> tuple[Balance, int, float]: ...
    def setBalance(self, balance: Balance | None = None, iterations: int | None = None, cutoff: float | None = None) -> None: ...
    def getExtraction(self) -> Extraction: ...
    def setExtraction(self, extraction: Extraction) -> None: ...
    def getWhichEigenpairs(self) -> Which: ...
    def setWhichEigenpairs(self, which: Which) -> None: ...
    def getThreshold(self) -> tuple[float, bool]: ...
    def setThreshold(self, thres: float, rel: bool = False) -> None: ...
    def getTarget(self) -> Scalar: ...
    def setTarget(self, target: Scalar) -> None: ...
    def getInterval(self) -> tuple[float, float]: ...
    def setInterval(self, inta: float, intb: float) -> None: ...
    def getTolerances(self) -> tuple[float, int]: ...
    def setTolerances(self, tol: float | None = None, max_it: int | None = None) -> None: ...
    def getTwoSided(self) -> bool: ...
    def setTwoSided(self, twosided: bool) -> None: ...
    def getPurify(self) -> bool: ...
    def setPurify(self, purify: bool = True) -> None: ...
    def getConvergenceTest(self) -> Conv: ...
    def setConvergenceTest(self, conv: Conv) -> None: ...
    def getTrueResidual(self) -> bool: ...
    def setTrueResidual(self, trueres: bool) -> None: ...
    def getTrackAll(self) -> bool: ...
    def setTrackAll(self, trackall: bool) -> None: ...
    def getDimensions(self) -> tuple[int, int, int]: ...
    def setDimensions(self, nev: int | None = None, ncv: int | None = None, mpd: int | None = None) -> None: ...
    def getST(self) -> ST: ...
    def setST(self, st: ST) -> None: ...
    def getBV(self) -> BV: ...
    def setBV(self, bv: BV) -> None: ...
    def getDS(self) -> DS: ...
    def setDS(self, ds: DS) -> None: ...
    def getRG(self) -> RG: ...
    def setRG(self, rg: RG) -> None: ...
    def getOperators(self) -> tuple[Mat, Mat] | tuple[Mat, None]: ...
    def setOperators(self, A: Mat, B: Mat | None = None) -> None: ...
    def setDeflationSpace(self, space: Vec | list[Vec]) -> None: ...
    def setInitialSpace(self, space: Vec | list[Vec]) -> None: ...
    def setLeftInitialSpace(self, space: Vec | list[Vec]) -> None: ...
    def setStoppingTest(self, stopping: EPSStoppingFunction | None, args: tuple[Any, ...] | None = None, kargs: dict[str, Any] | None = None) -> None: ...
    def getStoppingTest(self) -> EPSStoppingFunction: ...
    def setArbitrarySelection(self, arbitrary: EPSArbitraryFunction | None, args: tuple[Any, ...] | None = None, kargs: dict[str, Any] | None = None) -> None: ...
    def getArbitrarySelection(self) -> EPSArbitraryFunction: ...
    def setEigenvalueComparison(self, comparison: EPSEigenvalueComparison | None, args: tuple[Any, ...] | None = None, kargs: dict[str, Any] | None = None) -> None: ...
    def getEigenvalueComparison(self) -> EPSEigenvalueComparison: ...
    def setMonitor(self, monitor: EPSMonitorFunction | None, args: tuple[Any, ...] | None = None, kargs: dict[str, Any] | None = None) -> None: ...
    def getMonitor(self) -> EPSMonitorFunction: ...
    def cancelMonitor(self) -> None: ...
    def setUp(self) -> None: ...
    def solve(self) -> None: ...
    def getIterationNumber(self) -> int: ...
    def getConvergedReason(self) -> ConvergedReason: ...
    def getConverged(self) -> int: ...
    def getEigenvalue(self, i: int) -> Scalar: ...
    def getEigenvector(self, i: int, Vr: Vec | None = None, Vi: Vec | None = None) -> None: ...
    def getLeftEigenvector(self, i: int, Wr: Vec | None = None, Wi: Vec | None = None) -> None: ...
    def getEigenpair(self, i: int, Vr: Vec | None = None, Vi: Vec | None = None) -> Scalar: ...
    def getInvariantSubspace(self) -> list[Vec]: ...
    def getErrorEstimate(self, i: int) -> float: ...
    def computeError(self, i: int, etype: ErrorType | None = None) -> float: ...
    def errorView(self, etype: ErrorType | None = None, viewer: petsc4py.PETSc.Viewer | None = None) -> None: ...
    def valuesView(self, viewer: Viewer | None = None) -> None: ...
    def vectorsView(self, viewer: Viewer | None = None) -> None: ...
    def setPowerShiftType(self, shift: PowerShiftType) -> None: ...
    def getPowerShiftType(self) -> PowerShiftType: ...
    def setArnoldiDelayed(self, delayed: bool) -> None: ...
    def getArnoldiDelayed(self) -> bool: ...
    def setLanczosReorthogType(self, reorthog: LanczosReorthogType) -> None: ...
    def getLanczosReorthogType(self) -> LanczosReorthogType: ...
    def setKrylovSchurBSEType(self, bse: KrylovSchurBSEType) -> None: ...
    def getKrylovSchurBSEType(self) -> KrylovSchurBSEType: ...
    def setKrylovSchurRestart(self, keep: float) -> None: ...
    def getKrylovSchurRestart(self) -> float: ...
    def setKrylovSchurLocking(self, lock: bool) -> None: ...
    def getKrylovSchurLocking(self) -> bool: ...
    def setKrylovSchurPartitions(self, npart: int) -> None: ...
    def getKrylovSchurPartitions(self) -> int: ...
    def setKrylovSchurDetectZeros(self, detect: bool) -> None: ...
    def getKrylovSchurDetectZeros(self) -> bool: ...
    def setKrylovSchurDimensions(self, nev: int | None = None, ncv: int | None = None, mpd: int | None = None) -> None: ...
    def getKrylovSchurDimensions(self) -> tuple[int, int, int]: ...
    def getKrylovSchurSubcommInfo(self) -> tuple[int, int, Vec]: ...
    def getKrylovSchurSubcommPairs(self, i: int, v: Vec | None = None) -> Scalar: ...
    def getKrylovSchurSubcommMats(self) -> tuple[Mat, Mat] | tuple[Mat, None]: ...
    def updateKrylovSchurSubcommMats(self, s: Scalar = 1.0, a: Scalar = 1.0, Au: petsc4py.PETSc.Mat | None = None, t: Scalar = 1.0, b: Scalar = 1.0, Bu: petsc4py.PETSc.Mat | None = None, structure: petsc4py.PETSc.Mat.Structure | None = None, globalup: bool = False) -> None: ...
    def setKrylovSchurSubintervals(self, subint: Sequence[float]) -> None: ...
    def getKrylovSchurSubintervals(self) -> ArrayReal: ...
    def getKrylovSchurInertias(self) -> tuple[ArrayReal, ArrayInt]: ...
    def getKrylovSchurKSP(self) -> KSP: ...
    def setGDKrylovStart(self, krylovstart: bool = True) -> None: ...
    def getGDKrylovStart(self) -> bool: ...
    def setGDBlockSize(self, bs: int) -> None: ...
    def getGDBlockSize(self) -> int: ...
    def setGDRestart(self, minv: int = None, plusk: int = None) -> None: ...
    def getGDRestart(self) -> tuple[int, int]: ...
    def setGDInitialSize(self, initialsize: int) -> None: ...
    def getGDInitialSize(self) -> int: ...
    def setGDBOrth(self, borth: bool) -> None: ...
    def getGDBOrth(self) -> bool: ...
    def setGDDoubleExpansion(self, doubleexp: bool) -> None: ...
    def getGDDoubleExpansion(self) -> bool: ...
    def setJDKrylovStart(self, krylovstart: bool = True) -> None: ...
    def getJDKrylovStart(self) -> bool: ...
    def setJDBlockSize(self, bs: int) -> None: ...
    def getJDBlockSize(self) -> int: ...
    def setJDRestart(self, minv: int | None = None, plusk: int | None = None) -> None: ...
    def getJDRestart(self) -> tuple[int, int]: ...
    def setJDInitialSize(self, initialsize: int) -> None: ...
    def getJDInitialSize(self) -> int: ...
    def setJDFix(self, fix: float) -> None: ...
    def getJDFix(self) -> float: ...
    def setJDConstCorrectionTol(self, constant: bool) -> None: ...
    def getJDConstCorrectionTol(self) -> bool: ...
    def setJDBOrth(self, borth: bool) -> None: ...
    def getJDBOrth(self) -> bool: ...
    def setRQCGReset(self, nrest: int) -> None: ...
    def getRQCGReset(self) -> int: ...
    def setLOBPCGBlockSize(self, bs: int) -> None: ...
    def getLOBPCGBlockSize(self) -> int: ...
    def setLOBPCGRestart(self, restart: float) -> None: ...
    def getLOBPCGRestart(self) -> float: ...
    def setLOBPCGLocking(self, lock: bool) -> None: ...
    def getLOBPCGLocking(self) -> bool: ...
    def setLyapIIRanks(self, rkc: int | None = None, rkl: int | None = None) -> None: ...
    def getLyapIIRanks(self) -> tuple[int, int]: ...
    def setCISSExtraction(self, extraction: CISSExtraction) -> None: ...
    def getCISSExtraction(self) -> CISSExtraction: ...
    def setCISSQuadRule(self, quad: CISSQuadRule) -> None: ...
    def getCISSQuadRule(self) -> CISSQuadRule: ...
    def setCISSSizes(self, ip: int | None = None, bs: int | None = None, ms: int | None = None, npart: int | None = None, bsmax: int | None = None, realmats: bool = False) -> None: ...
    def getCISSSizes(self) -> tuple[int, int, int, int, int, bool]: ...
    def setCISSThreshold(self, delta: float | None = None, spur: float | None = None) -> None: ...
    def getCISSThreshold(self) -> tuple[float, float]: ...
    def setCISSRefinement(self, inner: int | None = None, blsize: int | None = None) -> None: ...
    def getCISSRefinement(self) -> tuple[int, int]: ...
    def setCISSUseST(self, usest: bool) -> None: ...
    def getCISSUseST(self) -> bool: ...
    def getCISSKSPs(self) -> list[KSP]: ...
    problem_type: EPSProblemType
    extraction: EPSExtraction
    which: EPSWhich
    target: float
    tol: float
    max_it: int
    two_sided: bool
    true_residual: bool
    purify: bool
    track_all: bool
    st: ST
    bv: BV
    rg: RG
    ds: DS

class SVD(Object):
    class Type:
        CROSS: Final[str] = ...
        CYCLIC: Final[str] = ...
        LAPACK: Final[str] = ...
        LANCZOS: Final[str] = ...
        TRLANCZOS: Final[str] = ...
        RANDOMIZED: Final[str] = ...
        SCALAPACK: Final[str] = ...
        KSVD: Final[str] = ...
        ELEMENTAL: Final[str] = ...
        PRIMME: Final[str] = ...
    class ProblemType:
        STANDARD: Final[int] = ...
        GENERALIZED: Final[int] = ...
        HYPERBOLIC: Final[int] = ...
    class ErrorType:
        ABSOLUTE: Final[int] = ...
        RELATIVE: Final[int] = ...
        NORM: Final[int] = ...
    class Which:
        LARGEST: Final[int] = ...
        SMALLEST: Final[int] = ...
    class Conv:
        ABS: Final[int] = ...
        REL: Final[int] = ...
        NORM: Final[int] = ...
        MAXIT: Final[int] = ...
        USER: Final[int] = ...
    class Stop:
        BASIC: Final[int] = ...
        USER: Final[int] = ...
        THRESHOLD: Final[int] = ...
    class ConvergedReason:
        CONVERGED_TOL: Final[int] = ...
        CONVERGED_USER: Final[int] = ...
        CONVERGED_MAXIT: Final[int] = ...
        DIVERGED_ITS: Final[int] = ...
        DIVERGED_BREAKDOWN: Final[int] = ...
        DIVERGED_SYMMETRY_LOST: Final[int] = ...
        CONVERGED_ITERATING: Final[int] = ...
        ITERATING: Final[int] = ...
    class TRLanczosGBidiag:
        SINGLE: Final[int] = ...
        UPPER: Final[int] = ...
        LOWER: Final[int] = ...
    def view(self, viewer: Viewer | None = None) -> None: ...
    def destroy(self) -> Self: ...
    def reset(self) -> None: ...
    def create(self, comm: Comm | None = None) -> Self: ...
    def setType(self, svd_type: Type | str) -> None: ...
    def getType(self) -> str: ...
    def getOptionsPrefix(self) -> str: ...
    def setOptionsPrefix(self, prefix: str | None = None) -> None: ...
    def appendOptionsPrefix(self, prefix: str | None = None) -> None: ...
    def setFromOptions(self) -> None: ...
    def getProblemType(self) -> ProblemType: ...
    def setProblemType(self, problem_type: ProblemType) -> None: ...
    def isGeneralized(self) -> bool: ...
    def isHyperbolic(self) -> bool: ...
    def getImplicitTranspose(self) -> bool: ...
    def setImplicitTranspose(self, mode: bool) -> None: ...
    def getWhichSingularTriplets(self) -> Which: ...
    def setWhichSingularTriplets(self, which: Which) -> None: ...
    def getThreshold(self) -> tuple[float, bool]: ...
    def setThreshold(self, thres: float, rel: bool = False) -> None: ...
    def getTolerances(self) -> tuple[float, int]: ...
    def setTolerances(self, tol: float | None = None, max_it: int | None = None) -> None: ...
    def getConvergenceTest(self) -> Conv: ...
    def setConvergenceTest(self, conv: Conv) -> None: ...
    def getTrackAll(self) -> bool: ...
    def setTrackAll(self, trackall: bool) -> None: ...
    def getDimensions(self) -> tuple[int, int, int]: ...
    def setDimensions(self, nsv: int | None = None, ncv: int | None = None, mpd: int | None = None) -> None: ...
    def getBV(self) -> tuple[BV, BV]: ...
    def setBV(self, V: BV, U: BV | None = None) -> None: ...
    def getDS(self) -> DS: ...
    def setDS(self, ds: DS) -> None: ...
    def getOperators(self) -> tuple[Mat, Mat] | tuple[Mat, None]: ...
    def setOperators(self, A: Mat, B: Mat | None = None) -> None: ...
    def getSignature(self, omega: Vec | None = None) -> Vec: ...
    def setSignature(self, omega: Vec | None = None) -> None: ...
    def setInitialSpace(self, spaceright: list[Vec] | None = None, spaceleft: list[Vec] | None = None) -> None: ...
    def setStoppingTest(self, stopping: SVDStoppingFunction | None, args: tuple[Any, ...] | None = None, kargs: dict[str, Any] | None = None) -> None: ...
    def getStoppingTest(self) -> SVDStoppingFunction: ...
    def setMonitor(self, monitor: SVDMonitorFunction | None, args: tuple[Any, ...] | None = None, kargs: dict[str, Any] | None = None) -> None: ...
    def getMonitor(self) -> SVDMonitorFunction: ...
    def cancelMonitor(self) -> None: ...
    def setUp(self) -> None: ...
    def solve(self) -> None: ...
    def getIterationNumber(self) -> int: ...
    def getConvergedReason(self) -> ConvergedReason: ...
    def getConverged(self) -> int: ...
    def getValue(self, i: int) -> float: ...
    def getVectors(self, i: int, U: Vec, V: Vec) -> None: ...
    def getSingularTriplet(self, i: int, U: Vec | None = None, V: Vec | None = None) -> float: ...
    def computeError(self, i: int, etype: ErrorType | None = None) -> float: ...
    def errorView(self, etype: ErrorType | None = None, viewer: petsc4py.PETSc.Viewer | None = None) -> None: ...
    def valuesView(self, viewer: Viewer | None = None) -> None: ...
    def vectorsView(self, viewer: Viewer | None = None) -> None: ...
    def setCrossEPS(self, eps: EPS) -> None: ...
    def getCrossEPS(self) -> EPS: ...
    def setCrossExplicitMatrix(self, flag: bool = True) -> None: ...
    def getCrossExplicitMatrix(self) -> bool: ...
    def setCyclicEPS(self, eps: EPS) -> None: ...
    def getCyclicEPS(self) -> EPS: ...
    def setCyclicExplicitMatrix(self, flag: bool = True) -> None: ...
    def getCyclicExplicitMatrix(self) -> bool: ...
    def setLanczosOneSide(self, flag: bool = True) -> None: ...
    def getLanczosOneSide(self) -> bool: ...
    def setTRLanczosOneSide(self, flag: bool = True) -> None: ...
    def getTRLanczosOneSide(self) -> bool: ...
    def setTRLanczosGBidiag(self, bidiag: TRLanczosGBidiag) -> None: ...
    def getTRLanczosGBidiag(self) -> TRLanczosGBidiag: ...
    def setTRLanczosRestart(self, keep: float) -> None: ...
    def getTRLanczosRestart(self) -> float: ...
    def setTRLanczosLocking(self, lock: bool) -> None: ...
    def getTRLanczosLocking(self) -> bool: ...
    def setTRLanczosKSP(self, ksp: KSP) -> None: ...
    def getTRLanczosKSP(self) -> KSP: ...
    def setTRLanczosExplicitMatrix(self, flag: bool = True) -> None: ...
    def getTRLanczosExplicitMatrix(self) -> bool: ...
    problem_type: SVDProblemType
    transpose_mode: bool
    which: SVDWhich
    tol: float
    max_it: int
    track_all: bool
    ds: DS
    setOperator = setOperators

class PEP(Object):
    class Type:
        TOAR: Final[str] = ...
        STOAR: Final[str] = ...
        QARNOLDI: Final[str] = ...
        LINEAR: Final[str] = ...
        JD: Final[str] = ...
        CISS: Final[str] = ...
    class ProblemType:
        GENERAL: Final[int] = ...
        HERMITIAN: Final[int] = ...
        HYPERBOLIC: Final[int] = ...
        GYROSCOPIC: Final[int] = ...
    class Which:
        LARGEST_MAGNITUDE: Final[int] = ...
        SMALLEST_MAGNITUDE: Final[int] = ...
        LARGEST_REAL: Final[int] = ...
        SMALLEST_REAL: Final[int] = ...
        LARGEST_IMAGINARY: Final[int] = ...
        SMALLEST_IMAGINARY: Final[int] = ...
        TARGET_MAGNITUDE: Final[int] = ...
        TARGET_REAL: Final[int] = ...
        TARGET_IMAGINARY: Final[int] = ...
        ALL: Final[int] = ...
        USER: Final[int] = ...
    class Basis:
        MONOMIAL: Final[int] = ...
        CHEBYSHEV1: Final[int] = ...
        CHEBYSHEV2: Final[int] = ...
        LEGENDRE: Final[int] = ...
        LAGUERRE: Final[int] = ...
        HERMITE: Final[int] = ...
    class Scale:
        NONE: Final[int] = ...
        SCALAR: Final[int] = ...
        DIAGONAL: Final[int] = ...
        BOTH: Final[int] = ...
    class Refine:
        NONE: Final[int] = ...
        SIMPLE: Final[int] = ...
        MULTIPLE: Final[int] = ...
    class RefineScheme:
        SCHUR: Final[int] = ...
        MBE: Final[int] = ...
        EXPLICIT: Final[int] = ...
    class Extract:
        NONE: Final[int] = ...
        NORM: Final[int] = ...
        RESIDUAL: Final[int] = ...
        STRUCTURED: Final[int] = ...
    class ErrorType:
        ABSOLUTE: Final[int] = ...
        RELATIVE: Final[int] = ...
        BACKWARD: Final[int] = ...
    class Conv:
        ABS: Final[int] = ...
        REL: Final[int] = ...
        NORM: Final[int] = ...
        USER: Final[int] = ...
    class Stop:
        BASIC: Final[int] = ...
        USER: Final[int] = ...
    class ConvergedReason:
        CONVERGED_TOL: Final[int] = ...
        CONVERGED_USER: Final[int] = ...
        DIVERGED_ITS: Final[int] = ...
        DIVERGED_BREAKDOWN: Final[int] = ...
        DIVERGED_SYMMETRY_LOST: Final[int] = ...
        CONVERGED_ITERATING: Final[int] = ...
        ITERATING: Final[int] = ...
    class JDProjection:
        HARMONIC: Final[int] = ...
        ORTHOGONAL: Final[int] = ...
    class CISSExtraction:
        RITZ: Final[int] = ...
        HANKEL: Final[int] = ...
        CAA: Final[int] = ...
    def view(self, viewer: Viewer | None = None) -> None: ...
    def destroy(self) -> Self: ...
    def reset(self) -> None: ...
    def create(self, comm: Comm | None = None) -> Self: ...
    def setType(self, pep_type: Type | str) -> None: ...
    def getType(self) -> str: ...
    def getOptionsPrefix(self) -> str: ...
    def setOptionsPrefix(self, prefix: str | None = None) -> None: ...
    def appendOptionsPrefix(self, prefix: str | None = None) -> None: ...
    def setFromOptions(self) -> None: ...
    def getBasis(self) -> Basis: ...
    def setBasis(self, basis: Basis) -> None: ...
    def getProblemType(self) -> ProblemType: ...
    def setProblemType(self, problem_type: ProblemType) -> None: ...
    def getWhichEigenpairs(self) -> Which: ...
    def setWhichEigenpairs(self, which: Which) -> None: ...
    def getTarget(self) -> Scalar: ...
    def setTarget(self, target: Scalar) -> None: ...
    def getTolerances(self) -> tuple[float, int]: ...
    def setTolerances(self, tol: float | None = None, max_it: int | None = None) -> None: ...
    def getInterval(self) -> tuple[float, float]: ...
    def setInterval(self, inta: float, intb: float) -> None: ...
    def getConvergenceTest(self) -> Conv: ...
    def setConvergenceTest(self, conv: Conv) -> None: ...
    def getRefine(self) -> tuple[Refine, int, float, int, RefineScheme]: ...
    def setRefine(self, ref: Refine, npart: int | None = None, tol: float | None = None, its: int | None = None, scheme: RefineScheme | None = None) -> None: ...
    def getRefineKSP(self) -> KSP: ...
    def setExtract(self, extract: Extract) -> None: ...
    def getExtract(self) -> Extract: ...
    def getTrackAll(self) -> bool: ...
    def setTrackAll(self, trackall: bool) -> None: ...
    def getDimensions(self) -> tuple[int, int, int]: ...
    def setDimensions(self, nev: int | None = None, ncv: int | None = None, mpd: int | None = None) -> None: ...
    def getST(self) -> ST: ...
    def setST(self, st: ST) -> None: ...
    def getScale(self, Dl: petsc4py.PETSc.Vec | None = None, Dr: petsc4py.PETSc.Vec | None = None) -> tuple[Scale, float, int, float]: ...
    def setScale(self, scale: Scale, alpha: float | None = None, Dl: petsc4py.PETSc.Vec | None = None, Dr: petsc4py.PETSc.Vec | None = None, its: int | None = None, lbda: float | None = None) -> None: ...
    def getBV(self) -> BV: ...
    def setBV(self, bv: BV) -> None: ...
    def getRG(self) -> RG: ...
    def setRG(self, rg: RG) -> None: ...
    def getDS(self) -> DS: ...
    def setDS(self, ds: DS) -> None: ...
    def getOperators(self) -> list[Mat]: ...
    def setOperators(self, operators: list[Mat]) -> None: ...
    def setInitialSpace(self, space: Vec | list[Vec]) -> None: ...
    def setStoppingTest(self, stopping: PEPStoppingFunction | None, args: tuple[Any, ...] | None = None, kargs: dict[str, Any] | None = None) -> None: ...
    def getStoppingTest(self) -> PEPStoppingFunction: ...
    def setEigenvalueComparison(self, comparison: PEPEigenvalueComparison | None, args: tuple[Any, ...] | None = None, kargs: dict[str, Any] | None = None) -> None: ...
    def getEigenvalueComparison(self) -> PEPEigenvalueComparison: ...
    def setMonitor(self, monitor: PEPMonitorFunction | None, args: tuple[Any, ...] | None = None, kargs: dict[str, Any] | None = None) -> None: ...
    def getMonitor(self) -> PEPMonitorFunction: ...
    def cancelMonitor(self) -> None: ...
    def setUp(self) -> None: ...
    def solve(self) -> None: ...
    def getIterationNumber(self) -> int: ...
    def getConvergedReason(self) -> ConvergedReason: ...
    def getConverged(self) -> int: ...
    def getEigenpair(self, i: int, Vr: Vec | None = None, Vi: Vec | None = None) -> complex: ...
    def getErrorEstimate(self, i: int) -> float: ...
    def computeError(self, i: int, etype: ErrorType | None = None) -> float: ...
    def errorView(self, etype: ErrorType | None = None, viewer: petsc4py.PETSc.Viewer | None = None) -> None: ...
    def valuesView(self, viewer: Viewer | None = None) -> None: ...
    def vectorsView(self, viewer: Viewer | None = None) -> None: ...
    def setLinearEPS(self, eps: EPS) -> None: ...
    def getLinearEPS(self) -> EPS: ...
    def setLinearLinearization(self, alpha: float = 1.0, beta: float = 0.0) -> None: ...
    def getLinearLinearization(self) -> tuple[float, float]: ...
    def setLinearExplicitMatrix(self, flag: bool) -> None: ...
    def getLinearExplicitMatrix(self) -> bool: ...
    def setQArnoldiRestart(self, keep: float) -> None: ...
    def getQArnoldiRestart(self) -> float: ...
    def setQArnoldiLocking(self, lock: bool) -> None: ...
    def getQArnoldiLocking(self) -> bool: ...
    def setTOARRestart(self, keep: float) -> None: ...
    def getTOARRestart(self) -> float: ...
    def setTOARLocking(self, lock: bool) -> None: ...
    def getTOARLocking(self) -> bool: ...
    def setSTOARLinearization(self, alpha: float = 1.0, beta: float = 0.0) -> None: ...
    def getSTOARLinearization(self) -> tuple[float, float]: ...
    def setSTOARLocking(self, lock: bool) -> None: ...
    def getSTOARLocking(self) -> bool: ...
    def setSTOARDetectZeros(self, detect: bool) -> None: ...
    def getSTOARDetectZeros(self) -> bool: ...
    def setSTOARDimensions(self, nev: int | None = None, ncv: int | None = None, mpd: int | None = None) -> None: ...
    def getSTOARDimensions(self) -> tuple[int, int, int]: ...
    def getSTOARInertias(self) -> tuple[ArrayReal, ArrayInt]: ...
    def setSTOARCheckEigenvalueType(self, flag: bool) -> None: ...
    def getSTOARCheckEigenvalueType(self) -> bool: ...
    def setJDRestart(self, keep: float) -> None: ...
    def getJDRestart(self) -> float: ...
    def setJDFix(self, fix: float) -> None: ...
    def getJDFix(self) -> float: ...
    def setJDReusePreconditioner(self, flag: bool) -> None: ...
    def getJDReusePreconditioner(self) -> bool: ...
    def setJDMinimalityIndex(self, flag: int) -> None: ...
    def getJDMinimalityIndex(self) -> int: ...
    def setJDProjection(self, proj: JDProjection) -> None: ...
    def getJDProjection(self) -> JDProjection: ...
    def setCISSExtraction(self, extraction: CISSExtraction) -> None: ...
    def getCISSExtraction(self) -> CISSExtraction: ...
    def setCISSSizes(self, ip: int | None = None, bs: int | None = None, ms: int | None = None, npart: int | None = None, bsmax: int | None = None, realmats: bool = False) -> None: ...
    def getCISSSizes(self) -> tuple[int, int, int, int, int, bool]: ...
    def setCISSThreshold(self, delta: float | None = None, spur: float | None = None) -> None: ...
    def getCISSThreshold(self) -> tuple[float, float]: ...
    def setCISSRefinement(self, inner: int | None = None, blsize: int | None = None) -> None: ...
    def getCISSRefinement(self) -> tuple[int, int]: ...
    def getCISSKSPs(self) -> list[KSP]: ...
    problem_type: PEPProblemType
    which: PEPWhich
    target: float
    extract: PEPExtract
    tol: float
    max_it: int
    track_all: bool
    st: ST
    bv: BV
    rg: RG
    ds: DS

class NEP(Object):
    class Type:
        RII: Final[str] = ...
        SLP: Final[str] = ...
        NARNOLDI: Final[str] = ...
        NLEIGS: Final[str] = ...
        CISS: Final[str] = ...
        INTERPOL: Final[str] = ...
    class ProblemType:
        GENERAL: Final[int] = ...
        RATIONAL: Final[int] = ...
    class ErrorType:
        ABSOLUTE: Final[int] = ...
        RELATIVE: Final[int] = ...
        BACKWARD: Final[int] = ...
    class Which:
        LARGEST_MAGNITUDE: Final[int] = ...
        SMALLEST_MAGNITUDE: Final[int] = ...
        LARGEST_REAL: Final[int] = ...
        SMALLEST_REAL: Final[int] = ...
        LARGEST_IMAGINARY: Final[int] = ...
        SMALLEST_IMAGINARY: Final[int] = ...
        TARGET_MAGNITUDE: Final[int] = ...
        TARGET_REAL: Final[int] = ...
        TARGET_IMAGINARY: Final[int] = ...
        ALL: Final[int] = ...
        USER: Final[int] = ...
    class ConvergedReason:
        CONVERGED_TOL: Final[int] = ...
        CONVERGED_USER: Final[int] = ...
        DIVERGED_ITS: Final[int] = ...
        DIVERGED_BREAKDOWN: Final[int] = ...
        DIVERGED_LINEAR_SOLVE: Final[int] = ...
        DIVERGED_SUBSPACE_EXHAUSTED: Final[int] = ...
        CONVERGED_ITERATING: Final[int] = ...
        ITERATING: Final[int] = ...
    class Refine:
        NONE: Final[int] = ...
        SIMPLE: Final[int] = ...
        MULTIPLE: Final[int] = ...
    class RefineScheme:
        SCHUR: Final[int] = ...
        MBE: Final[int] = ...
        EXPLICIT: Final[int] = ...
    class Conv:
        ABS: Final[int] = ...
        REL: Final[int] = ...
        NORM: Final[int] = ...
        USER: Final[int] = ...
    class Stop:
        BASIC: Final[int] = ...
        USER: Final[int] = ...
    class CISSExtraction:
        RITZ: Final[int] = ...
        HANKEL: Final[int] = ...
        CAA: Final[int] = ...
    def view(self, viewer: Viewer | None = None) -> None: ...
    def destroy(self) -> Self: ...
    def reset(self) -> None: ...
    def create(self, comm: Comm | None = None) -> Self: ...
    def setType(self, nep_type: Type | str) -> None: ...
    def getType(self) -> str: ...
    def getOptionsPrefix(self) -> str: ...
    def setOptionsPrefix(self, prefix: str | None = None) -> None: ...
    def appendOptionsPrefix(self, prefix: str | None = None) -> None: ...
    def setFromOptions(self) -> None: ...
    def getProblemType(self) -> ProblemType: ...
    def setProblemType(self, problem_type: ProblemType) -> None: ...
    def getWhichEigenpairs(self) -> Which: ...
    def setWhichEigenpairs(self, which: Which) -> None: ...
    def getTarget(self) -> Scalar: ...
    def setTarget(self, target: Scalar) -> None: ...
    def getTolerances(self) -> tuple[float, int]: ...
    def setTolerances(self, tol: float | None = None, maxit: int | None = None) -> None: ...
    def getConvergenceTest(self) -> Conv: ...
    def setConvergenceTest(self, conv: Conv) -> None: ...
    def getRefine(self) -> tuple[Refine, int, float, int, RefineScheme]: ...
    def setRefine(self, ref: Refine, npart: int | None = None, tol: float | None = None, its: int | None = None, scheme: RefineScheme | None = None) -> None: ...
    def getRefineKSP(self) -> KSP: ...
    def getTrackAll(self) -> bool: ...
    def setTrackAll(self, trackall: bool) -> None: ...
    def getDimensions(self) -> tuple[int, int, int]: ...
    def setDimensions(self, nev: int | None = None, ncv: int | None = None, mpd: int | None = None) -> None: ...
    def getBV(self) -> BV: ...
    def setBV(self, bv: BV) -> None: ...
    def getRG(self) -> RG: ...
    def setRG(self, rg: RG) -> None: ...
    def getDS(self) -> DS: ...
    def setDS(self, ds: DS) -> None: ...
    def setInitialSpace(self, space: Vec or list[Vec]) -> None: ...
    def setStoppingTest(self, stopping: NEPStoppingFunction | None, args: tuple[Any, ...] | None = None, kargs: dict[str, Any] | None = None) -> None: ...
    def getStoppingTest(self) -> NEPStoppingFunction: ...
    def setEigenvalueComparison(self, comparison: NEPEigenvalueComparison | None, args: tuple[Any, ...] | None = None, kargs: dict[str, Any] | None = None) -> None: ...
    def getEigenvalueComparison(self) -> NEPEigenvalueComparison: ...
    def setMonitor(self, monitor: NEPMonitorFunction | None, args: tuple[Any, ...] | None = None, kargs: dict[str, Any] | None = None) -> None: ...
    def getMonitor(self) -> NEPMonitorFunction: ...
    def cancelMonitor(self) -> None: ...
    def setUp(self) -> None: ...
    def solve(self) -> None: ...
    def getIterationNumber(self) -> int: ...
    def getConvergedReason(self) -> ConvergedReason: ...
    def getConverged(self) -> int: ...
    def getEigenpair(self, i: int, Vr: Vec | None = None, Vi: Vec | None = None) -> None: ...
    def getLeftEigenvector(self, i: int, Wr: Vec, Wi: Vec | None = None) -> None: ...
    def getErrorEstimate(self, i: int) -> float: ...
    def computeError(self, i: int, etype: ErrorType | None = None) -> float: ...
    def errorView(self, etype: ErrorType | None = None, viewer: petsc4py.PETSc.Viewer | None = None) -> None: ...
    def valuesView(self, viewer: Viewer | None = None) -> None: ...
    def vectorsView(self, viewer: Viewer | None = None) -> None: ...
    def setFunction(self, function: NEPFunction, F: petsc4py.PETSc.Mat | None = None, P: petsc4py.PETSc.Mat | None = None, args: tuple[Any, ...] | None = None, kargs: dict[str, Any] | None = None) -> None: ...
    def getFunction(self) -> tuple[petsc4py.PETSc.Mat, petsc4py.PETSc.Mat, NEPFunction]: ...
    def setJacobian(self, jacobian: NEPJacobian, J: petsc4py.PETSc.Mat | None = None, args: tuple[Any, ...] | None = None, kargs: dict[str, Any] | None = None) -> None: ...
    def getJacobian(self) -> tuple[petsc4py.PETSc.Mat, NEPJacobian]: ...
    def setSplitOperator(self, A: petsc4py.PETSc.Mat | list[petsc4py.PETSc.Mat], f: FN | list[FN], structure: petsc4py.PETSc.Mat.Structure | None = None) -> None: ...
    def getSplitOperator(self) -> tuple[list[petsc4py.PETSc.Mat], list[FN], petsc4py.PETSc.Mat.Structure]: ...
    def setSplitPreconditioner(self, P: petsc4py.PETSc.Mat | list[petsc4py.PETSc.Mat], structure: petsc4py.PETSc.Mat.Structure | None = None) -> None: ...
    def getSplitPreconditioner(self) -> tuple[list[petsc4py.PETSc.Mat], petsc4py.PETSc.Mat.Structure]: ...
    def getTwoSided(self) -> bool: ...
    def setTwoSided(self, twosided: bool) -> None: ...
    def applyResolvent(self, omega: Scalar, v: Vec, r: Vec, rg: RG | None = None) -> None: ...
    def setRIILagPreconditioner(self, lag: int) -> None: ...
    def getRIILagPreconditioner(self) -> int: ...
    def setRIIConstCorrectionTol(self, cct: bool) -> None: ...
    def getRIIConstCorrectionTol(self) -> bool: ...
    def setRIIMaximumIterations(self, its: int) -> None: ...
    def getRIIMaximumIterations(self) -> int: ...
    def setRIIHermitian(self, herm: bool) -> None: ...
    def getRIIHermitian(self) -> bool: ...
    def setRIIDeflationThreshold(self, deftol: float) -> None: ...
    def getRIIDeflationThreshold(self) -> float: ...
    def setRIIKSP(self, ksp: KSP) -> None: ...
    def getRIIKSP(self) -> KSP: ...
    def setSLPDeflationThreshold(self, deftol: float) -> None: ...
    def getSLPDeflationThreshold(self) -> float: ...
    def setSLPEPS(self, eps: EPS) -> None: ...
    def getSLPEPS(self) -> EPS: ...
    def setSLPEPSLeft(self, eps: EPS) -> None: ...
    def getSLPEPSLeft(self) -> EPS: ...
    def setSLPKSP(self, ksp: KSP) -> None: ...
    def getSLPKSP(self) -> KSP: ...
    def setNArnoldiKSP(self, ksp: KSP) -> None: ...
    def getNArnoldiKSP(self) -> KSP: ...
    def setNArnoldiLagPreconditioner(self, lag: int) -> None: ...
    def getNArnoldiLagPreconditioner(self) -> int: ...
    def setInterpolPEP(self, pep: PEP) -> None: ...
    def getInterpolPEP(self) -> PEP: ...
    def setInterpolInterpolation(self, tol: float | None = None, deg: int | None = None) -> None: ...
    def getInterpolInterpolation(self) -> tuple[float, int]: ...
    def setNLEIGSRestart(self, keep: float) -> None: ...
    def getNLEIGSRestart(self) -> float: ...
    def setNLEIGSLocking(self, lock: bool) -> None: ...
    def getNLEIGSLocking(self) -> bool: ...
    def setNLEIGSInterpolation(self, tol: float | None = None, deg: int | None = None) -> None: ...
    def getNLEIGSInterpolation(self) -> tuple[float, int]: ...
    def setNLEIGSFullBasis(self, fullbasis: bool = True) -> None: ...
    def getNLEIGSFullBasis(self) -> bool: ...
    def setNLEIGSEPS(self, eps: EPS) -> None: ...
    def getNLEIGSEPS(self) -> EPS: ...
    def setNLEIGSRKShifts(self, shifts: Sequence[Scalar]) -> None: ...
    def getNLEIGSRKShifts(self) -> ArrayScalar: ...
    def getNLEIGSKSPs(self) -> list[KSP]: ...
    def setCISSExtraction(self, extraction: CISSExtraction) -> None: ...
    def getCISSExtraction(self) -> CISSExtraction: ...
    def setCISSSizes(self, ip: int | None = None, bs: int | None = None, ms: int | None = None, npart: int | None = None, bsmax: int | None = None, realmats: bool = False) -> None: ...
    def getCISSSizes(self) -> tuple[int, int, int, int, int, bool]: ...
    def setCISSThreshold(self, delta: float | None = None, spur: float | None = None) -> None: ...
    def getCISSThreshold(self) -> tuple[float, float]: ...
    def setCISSRefinement(self, inner: int | None = None, blsize: int | None = None) -> None: ...
    def getCISSRefinement(self) -> tuple[int, int]: ...
    def getCISSKSPs(self) -> list[KSP]: ...
    problem_type: NEPProblemType
    which: NEPWhich
    target: float
    tol: float
    max_it: int
    track_all: bool
    bv: BV
    rg: RG
    ds: DS

class MFN(Object):
    class Type:
        KRYLOV: Final[str] = ...
        EXPOKIT: Final[str] = ...
    class ConvergedReason:
        CONVERGED_TOL: Final[int] = ...
        CONVERGED_ITS: Final[int] = ...
        DIVERGED_ITS: Final[int] = ...
        DIVERGED_BREAKDOWN: Final[int] = ...
        CONVERGED_ITERATING: Final[int] = ...
        ITERATING: Final[int] = ...
    def view(self, viewer: Viewer | None = None) -> None: ...
    def destroy(self) -> Self: ...
    def reset(self) -> None: ...
    def create(self, comm: Comm | None = None) -> Self: ...
    def setType(self, mfn_type: Type | str) -> None: ...
    def getType(self) -> str: ...
    def getOptionsPrefix(self) -> str: ...
    def setOptionsPrefix(self, prefix: str | None = None) -> None: ...
    def appendOptionsPrefix(self, prefix: str | None = None) -> None: ...
    def setFromOptions(self) -> None: ...
    def getTolerances(self) -> tuple[float, int]: ...
    def setTolerances(self, tol: float | None = None, max_it: int | None = None) -> None: ...
    def getDimensions(self) -> int: ...
    def setDimensions(self, ncv: int) -> None: ...
    def getFN(self) -> FN: ...
    def setFN(self, fn: FN) -> None: ...
    def getBV(self) -> BV: ...
    def setBV(self, bv: BV) -> None: ...
    def getOperator(self) -> Mat: ...
    def setOperator(self, A: Mat) -> None: ...
    def setMonitor(self, monitor: MFNMonitorFunction | None, args: tuple[Any, ...] | None = None, kargs: dict[str, Any] | None = None) -> None: ...
    def getMonitor(self) -> MFNMonitorFunction: ...
    def cancelMonitor(self) -> None: ...
    def setUp(self) -> None: ...
    def solve(self, b: Vec, x: Vec) -> None: ...
    def solveTranspose(self, b: Vec, x: Vec) -> None: ...
    def getIterationNumber(self) -> int: ...
    def getConvergedReason(self) -> ConvergedReason: ...
    def setErrorIfNotConverged(self, flg: bool = True) -> None: ...
    def getErrorIfNotConverged(self) -> bool: ...
    tol: float
    max_it: int
    fn: FN
    bv: BV

class LME(Object):
    class Type:
        KRYLOV: Final[str] = ...
    class ConvergedReason:
        CONVERGED_TOL: Final[int] = ...
        DIVERGED_ITS: Final[int] = ...
        DIVERGED_BREAKDOWN: Final[int] = ...
        CONVERGED_ITERATING: Final[int] = ...
        ITERATING: Final[int] = ...
    class ProblemType:
        LYAPUNOV: Final[int] = ...
        SYLVESTER: Final[int] = ...
        GEN_LYAPUNOV: Final[int] = ...
        GEN_SYLVESTER: Final[int] = ...
        DT_LYAPUNOV: Final[int] = ...
        STEIN: Final[int] = ...
    def view(self, viewer: Viewer | None = None) -> None: ...
    def destroy(self) -> Self: ...
    def reset(self) -> None: ...
    def create(self, comm: Comm | None = None) -> Self: ...
    def setType(self, lme_type: Type | str) -> None: ...
    def getType(self) -> str: ...
    def setProblemType(self, lme_problem_type: ProblemType | str) -> None: ...
    def getProblemType(self) -> ProblemType: ...
    def setCoefficients(self, A: Mat, B: Mat | None = None, D: Mat | None = None, E: Mat | None = None) -> None: ...
    def getCoefficients(self) -> tuple[Mat, Mat | None, Mat | None, Mat | None]: ...
    def setRHS(self, C: Mat) -> None: ...
    def getRHS(self) -> Mat: ...
    def setSolution(self, X: Mat | None = None) -> None: ...
    def getSolution(self) -> Mat: ...
    def getErrorEstimate(self) -> float: ...
    def computeError(self) -> float: ...
    def getOptionsPrefix(self) -> str: ...
    def setOptionsPrefix(self, prefix: str | None = None) -> None: ...
    def appendOptionsPrefix(self, prefix: str | None = None) -> None: ...
    def setFromOptions(self) -> None: ...
    def getTolerances(self) -> tuple[float, int]: ...
    def setTolerances(self, tol: float | None = None, max_it: int | None = None) -> None: ...
    def getDimensions(self) -> int: ...
    def setDimensions(self, ncv: int) -> None: ...
    def getBV(self) -> BV: ...
    def setBV(self, bv: BV) -> None: ...
    def setMonitor(self, monitor: LMEMonitorFunction | None, args: tuple[Any, ...] | None = None, kargs: dict[str, Any] | None = None) -> None: ...
    def getMonitor(self) -> LMEMonitorFunction: ...
    def cancelMonitor(self) -> None: ...
    def setUp(self) -> None: ...
    def solve(self) -> None: ...
    def getIterationNumber(self) -> int: ...
    def getConvergedReason(self) -> ConvergedReason: ...
    def setErrorIfNotConverged(self, flg: bool = True) -> None: ...
    def getErrorIfNotConverged(self) -> bool: ...
    tol: float
    max_it: int
    fn: FN
    bv: BV

class Sys:
    @classmethod
    def getVersion(cls, devel: bool = False, date: bool = False, author: bool = False) -> tuple[int, int, int]: ...
    @classmethod
    def getVersionInfo(cls) -> dict[str, bool | int | str]: ...
    @classmethod
    def isInitialized(cls) -> bool: ...
    @classmethod
    def isFinalized(cls) -> bool: ...
    @classmethod
    def hasExternalPackage(cls, package: str) -> bool: ...

class Util:
    @classmethod
    def createMatBSE(cls, R: petsc4py.PETSc.Mat, C: petsc4py.PETSc.Mat) -> petsc4py.PETSc.Mat: ...
    @classmethod
    def createMatHamiltonian(cls, A: petsc4py.PETSc.Mat, B: petsc4py.PETSc.Mat, C: petsc4py.PETSc.Mat) -> petsc4py.PETSc.Mat: ...
    @classmethod
    def createMatLREP(cls, AK: petsc4py.PETSc.Mat, BM: petsc4py.PETSc.Mat, red: bool = False) -> petsc4py.PETSc.Mat: ...

class _p_mem:
    ...

def _initialize(args=None): ...
def _finalize(): ...

COMM_NULL: Final[Comm] = ...
COMM_SELF: Final[Comm] = ...
COMM_WORLD: Final[Comm] = ...
__pyx_capi__: Final[dict[str, Any]] = ...
__arch__: Final[str] = ...

