hippylibX.algorithms package

Submodules

hippylibX.algorithms.NewtonCG module

hippylibX.algorithms.cgsolverSteihaug module

hippylibX.algorithms.linalg module

class hippylibX.algorithms.linalg.Solver2Operator(S: Any, mpi_comm=mpi4py.MPI.COMM_WORLD, createVecLeft=None, createVecRight=None)[source]

Bases: object

mult(x: petsc4py.PETSc.Vec, y: petsc4py.PETSc.Vec) None[source]
hippylibX.algorithms.linalg.inner(x: dolfinx.la.Vector, y: dolfinx.la.Vector) float[source]

hippylibX.algorithms.lowRankOperator module

hippylibX.algorithms.multivector module

hippylibX.algorithms.multivector.MatMvMult(A: petsc4py.PETSc.Mat, x: MultiVector, y: MultiVector) None[source]
hippylibX.algorithms.multivector.MatMvTranspmult(A: petsc4py.PETSc.Mat, x: MultiVector, y: MultiVector) None[source]
class hippylibX.algorithms.multivector.MultiVector(example_vec: petsc4py.PETSc.Vec, nvec: int)[source]

Bases: object

Multivector object is created as a list of PETSc.petsc4py.Vec objects.

Borthogonalize(B: petsc4py.PETSc.Mat)[source]

Returns \(QR\) decomposition of self. \(Q\) and \(R\) satisfy the following relations in exact arithmetic

\[ \begin{align}\begin{aligned}QR \,= \,Z, && (1),\\Q^*BQ\, = \, I, && (2),\\Q^*BZ \, = \,R, && (3),\\ZR^{-1} \, = \, Q, && (4).\end{aligned}\end{align} \]

Returns:

Bq of type MultiVector -> B\(^{-1}\)-orthogonal vectors r of type ndarray -> The \(r\) of the QR decomposition.

Note

self is overwritten by \(Q\).

_mgs_stable(B: petsc4py.PETSc.Mat) tuple[Type[MultiVector], numpy.array][source]

Returns \(QR\) decomposition of self, which satisfies conditions (1)–(4). Uses Modified Gram-Schmidt with re-orthogonalization (Rutishauser variant) for computing the \(B\)-orthogonal \(QR\) factorization.

References:
  1. A.K. Saibaba, J. Lee and P.K. Kitanidis, Randomized algorithms for Generalized Hermitian Eigenvalue Problems with application to computing Karhunen-Loe’ve expansion http://arxiv.org/abs/1307.6885

  2. W. Gander, Algorithms for the QR decomposition. Res. Rep, 80(02), 1980

https://github.com/arvindks/kle

axpy(alpha: float | numpy.array, Y: Type[MultiVector]) None[source]

Reduction of MultiVector object with a float or values in a numpy array stored in another MultiVector object.

classmethod createFromMultiVec(mv: Type[MultiVector]) Type[MultiVector][source]

Create multivector from another MultiVector whose parallel distribution is to be replicated.

classmethod createFromVec(example_vec: petsc4py.PETSc.Vec, nvec: int) Type[MultiVector][source]

Create multivector from sample petsc4py vector whose parallel distribution is to be replicated.

dot(v: petsc4py.PETSc.Vec | Type[MultiVector]) numpy.array[source]

Perform dot product of a MultiVector object and petsc4py Vec object, store result in numpy array.

norm(norm_type: petsc4py.PETSc.NormType) numpy.array[source]

Return numpy array containing norm of each data element of MultiVector.

reduce(y: petsc4py.PETSc.Vec, alpha: numpy.array) None[source]

Reduction of petsc4py Vec using values in a numpy array stored in each data element of MultiVector object.

scale(alpha: float | numpy.ndarray) None[source]

Scale each value in the Multivector - either by a single float value or a numpy array of float values.

hippylibX.algorithms.multivector.MvDSmatMult(X: MultiVector, A: numpy.array, Y: MultiVector) None[source]

hippylibX.algorithms.randomizedEigensolver module

Module contents