slepc4py.SLEPc.BV#

class slepc4py.SLEPc.BV#

Bases: Object

BV.

Enumerations

MatMultType

BV mat-mult types.

OrthogBlockType

BV block-orthogonalization types.

OrthogRefineType

BV orthogonalization refinement types.

OrthogType

BV orthogonalization types.

Type

BV type.

Methods Summary

appendOptionsPrefix([prefix])

Append to the prefix used for searching for all BV options in the database.

applyMatrix(x, y)

Multiply a vector with the matrix associated to the bilinear form.

copy([result])

Copy a basis vector object into another one.

copyColumn(j, i)

Copy the values from one of the columns to another one.

copyVec(j, v)

Copy one of the columns of a basis vectors object into a Vec.

create([comm])

Create the BV object.

createFromMat(A)

Create a basis vectors object from a dense Mat object.

createMat()

Create a new Mat object of dense type and copy the contents of the BV.

createVec()

Create a Vec with the type and dimensions of the columns of the BV.

destroy()

Destroy the BV object.

dot(Y)

Compute the 'block-dot' product of two basis vectors objects.

dotColumn(j)

Dot products of a column against all the column vectors of a BV.

dotVec(v)

Dot products of a vector against all the column vectors of the BV.

duplicate()

Duplicate the BV object with the same type and dimensions.

duplicateResize(m)

Create a BV object of the same type and dimensions as an existing one.

getActiveColumns()

Get the current active dimensions.

getColumn(j)

Get a Vec object with the entries of the column of the BV object.

getDefiniteTolerance()

Get the tolerance to be used when checking a definite inner product.

getLeadingDimension()

Get the leading dimension.

getMat()

Get a Mat object of dense type that shares the memory of the BV object.

getMatMultMethod()

Get the method used for the matMult() operation.

getMatrix()

Get the matrix representation of the inner product.

getNumConstraints()

Get the number of constraints.

getOptionsPrefix()

Get the prefix used for searching for all BV options in the database.

getOrthogonalization()

Get the orthogonalization settings from the BV object.

getRandomContext()

Get the petsc4py.PETSc.Random object associated with the BV.

getSizes()

Get the local and global sizes, and the number of columns.

getType()

Get the BV type of this object.

getVecType()

Get the vector type used by the basis vectors object.

insertConstraints(C)

Insert a set of vectors as constraints.

insertVec(j, w)

Insert a vector into the specified column.

insertVecs(s, W[, orth])

Insert a set of vectors into specified columns.

matMult(A[, Y])

Compute the matrix-vector product for each column, \(Y = A V\).

matMultColumn(A, j)

Mat-vec product for a column, storing the result in the next column.

matMultHermitianTranspose(A[, Y])

Pre-multiplication with the conjugate transpose of a matrix.

matMultHermitianTransposeColumn(A, j)

Conjugate-transpose matrix-vector product for a specified column.

matMultTransposeColumn(A, j)

Transpose matrix-vector product for a specified column.

matProject(A, Y)

Compute the projection of a matrix onto a subspace.

mult(alpha, beta, X, Q)

Compute \(Y = beta Y + alpha X Q\).

multColumn(alpha, beta, j, q)

Compute \(y = beta y + alpha X q\).

multInPlace(Q, s, e)

Update a set of vectors as \(V(:,s:e-1) = V Q(:,s:e-1)\).

multVec(alpha, beta, y, q)

Compute \(y = beta y + alpha X q\).

norm([norm_type])

Compute the matrix norm of the BV.

normColumn(j[, norm_type])

Compute the vector norm of a selected column.

orthogonalize([R])

Orthogonalize all columns (except leading ones) (QR decomposition).

orthogonalizeColumn(j)

Orthogonalize a column vector with respect to the previous ones.

orthogonalizeVec(v)

Orthogonalize a vector with respect to a set of vectors.

orthonormalizeColumn(j[, replace])

Orthonormalize a column vector with respect to the previous ones.

resize(m[, copy])

Change the number of columns.

restoreColumn(j, v)

Restore a column obtained with getColumn().

restoreMat(A)

Restore the Mat obtained with getMat().

scale(alpha)

Multiply the entries by a scalar value.

scaleColumn(j, alpha)

Scale column j by alpha.

setActiveColumns(l, k)

Set the columns that will be involved in operations.

setDefiniteTolerance(deftol)

Set the tolerance to be used when checking a definite inner product.

setFromOptions()

Set BV options from the options database.

setLeadingDimension(ld)

Set the leading dimension.

setMatMultMethod(method)

Set the method used for the matMult() operation.

setMatrix(mat[, indef])

Set the bilinear form to be used for inner products.

setNumConstraints(nc)

Set the number of constraints.

setOptionsPrefix([prefix])

Set the prefix used for searching for all BV options in the database.

setOrthogonalization([otype, refine, eta, block])

Set the method used for the (block-)orthogonalization of vectors.

setRandom()

Set the active columns of the BV to random numbers.

setRandomColumn(j)

Set one column of the BV to random numbers.

setRandomCond(condn)

Set the columns of a BV to random numbers.

setRandomContext(rnd)

Set the petsc4py.PETSc.Random object associated with the BV.

setRandomNormal()

Set the active columns of the BV to normal random numbers.

setRandomSign()

Set the entries of a BV to values 1 or -1 with equal probability.

setSizes(sizes, m)

Set the local and global sizes, and the number of columns.

setSizesFromVec(w, m)

Set the local and global sizes, and the number of columns.

setType(bv_type)

Set the type for the BV object.

setVecType(vec_type)

Set the vector type.

view([viewer])

Print the BV data structure.

Attributes Summary

column_size

Basis vectors column size.

local_size

Basis vectors local size.

size

Basis vectors global size.

sizes

Basis vectors local and global sizes, and the number of columns.

Methods Documentation

appendOptionsPrefix(prefix=None)#

Append to the prefix used for searching for all BV options in the database.

Logically collective.

Parameters:

prefix (str | None) – The prefix string to prepend to all BV option requests.

Return type:

None

:sources:`Source code at slepc4py/SLEPc/BV.pyx:413 <slepc4py/SLEPc/BV.pyx#L413>`

applyMatrix(x, y)#

Multiply a vector with the matrix associated to the bilinear form.

Neighbor-wise collective.

Parameters:
  • x (Vec) – The input vector.

  • y (Vec) – The result vector.

Return type:

None

Notes

If the bilinear form has no associated matrix this function copies the vector.

:sources:`Source code at slepc4py/SLEPc/BV.pyx:605 <slepc4py/SLEPc/BV.pyx#L605>`

copy(result=None)#

Copy a basis vector object into another one.

Logically collective.

Parameters:

result (BV | None) – The copy.

Return type:

BV

:sources:`Source code at slepc4py/SLEPc/BV.pyx:255 <slepc4py/SLEPc/BV.pyx#L255>`

copyColumn(j, i)#

Copy the values from one of the columns to another one.

Logically collective.

Parameters:
  • j (int) – The number of the source column.

  • i (int) – The number of the destination column.

Return type:

None

:sources:`Source code at slepc4py/SLEPc/BV.pyx:866 <slepc4py/SLEPc/BV.pyx#L866>`

copyVec(j, v)#

Copy one of the columns of a basis vectors object into a Vec.

Logically collective.

Parameters:
  • j (int) – The column number to be copied.

  • v (Vec) – A vector.

Return type:

None

:sources:`Source code at slepc4py/SLEPc/BV.pyx:850 <slepc4py/SLEPc/BV.pyx#L850>`

create(comm=None)#

Create the BV object.

Collective.

Parameters:

comm (Comm | None) – MPI communicator; if not provided, it defaults to all processes.

Return type:

Self

:sources:`Source code at slepc4py/SLEPc/BV.pyx:175 <slepc4py/SLEPc/BV.pyx#L175>`

createFromMat(A)#

Create a basis vectors object from a dense Mat object.

Collective.

Parameters:

A (Mat) – A dense tall-skinny matrix.

Return type:

Self

:sources:`Source code at slepc4py/SLEPc/BV.pyx:193 <slepc4py/SLEPc/BV.pyx#L193>`

createMat()#

Create a new Mat object of dense type and copy the contents of the BV.

Collective.

Returns:

The new matrix.

Return type:

:py:any:`petsc4py.PETSc.Mat`

:sources:`Source code at slepc4py/SLEPc/BV.pyx:209 <slepc4py/SLEPc/BV.pyx#L209>`

createVec()#

Create a Vec with the type and dimensions of the columns of the BV.

Collective.

Returns:

New vector.

Return type:

:py:any:`petsc4py.PETSc.Vec`

:sources:`Source code at slepc4py/SLEPc/BV.pyx:810 <slepc4py/SLEPc/BV.pyx#L810>`

destroy()#

Destroy the BV object.

Collective.

:sources:`Source code at slepc4py/SLEPc/BV.pyx:165 <slepc4py/SLEPc/BV.pyx#L165>`

Return type:

Self

dot(Y)#

Compute the ‘block-dot’ product of two basis vectors objects.

Collective.

\(M = Y^H X\) \((m_{ij} = y_i^H x_j)\) or \(M = Y^H B X\)

Parameters:

Y (BV) – Left basis vectors, can be the same as self, giving \(M = X^H X\).

Returns:

The resulting matrix.

Return type:

:py:any:`petsc4py.PETSc.Mat`

Notes

This is the generalization of VecDot() for a collection of vectors, \(M = Y^H X\). The result is a matrix \(M\) whose entry \(m_{ij}\) is equal to \(y_i^H x_j\) (where \(y_i^H\) denotes the conjugate transpose of \(y_i\)).

\(X\) and \(Y\) can be the same object.

If a non-standard inner product has been specified with setMatrix(), then the result is \(M = Y^H B X\). In this case, both \(X\) and \(Y\) must have the same associated matrix.

Only rows (resp. columns) of \(M\) starting from \(ly\) (resp. \(lx\)) are computed, where \(ly\) (resp. \(lx\)) is the number of leading columns of \(Y\) (resp. \(X\)).

:sources:`Source code at slepc4py/SLEPc/BV.pyx:1064 <slepc4py/SLEPc/BV.pyx#L1064>`

dotColumn(j)#

Dot products of a column against all the column vectors of a BV.

Collective.

Parameters:

j (int) – The index of the column.

Returns:

The computed values.

Return type:

:py:any:`ArrayScalar`

:sources:`Source code at slepc4py/SLEPc/BV.pyx:948 <slepc4py/SLEPc/BV.pyx#L948>`

dotVec(v)#

Dot products of a vector against all the column vectors of the BV.

Collective.

Parameters:

v (Vec) – A vector.

Returns:

The computed values.

Return type:

:py:any:`ArrayScalar`

Notes

This is analogue to VecMDot(), but using BV to represent a collection of vectors. The result is \(m = X^H y\), so \(m_i\) is equal to \(x_j^H y\). Note that here \(X\) is transposed as opposed to BVDot().

If a non-standard inner product has been specified with BVSetMatrix(), then the result is \(m = X^H B y\).

:sources:`Source code at slepc4py/SLEPc/BV.pyx:912 <slepc4py/SLEPc/BV.pyx#L912>`

duplicate()#

Duplicate the BV object with the same type and dimensions.

Collective.

:sources:`Source code at slepc4py/SLEPc/BV.pyx:224 <slepc4py/SLEPc/BV.pyx#L224>`

Return type:

BV

duplicateResize(m)#

Create a BV object of the same type and dimensions as an existing one.

Collective.

Parameters:

m (int) – The number of columns.

Return type:

BV

Notes

With possibly different number of columns.

:sources:`Source code at slepc4py/SLEPc/BV.pyx:234 <slepc4py/SLEPc/BV.pyx#L234>`

getActiveColumns()#

Get the current active dimensions.

Not collective.

Returns:

Return type:

tuple[int, int]

:sources:`Source code at slepc4py/SLEPc/BV.pyx:642 <slepc4py/SLEPc/BV.pyx#L642>`

getColumn(j)#

Get a Vec object with the entries of the column of the BV object.

Logically collective.

Parameters:

j (int) – The index of the requested column.

Returns:

The vector containing the jth column.

Return type:

:py:any:`petsc4py.PETSc.Vec`

Notes

Modifying the returned Vec will change the BV entries as well.

:sources:`Source code at slepc4py/SLEPc/BV.pyx:975 <slepc4py/SLEPc/BV.pyx#L975>`

getDefiniteTolerance()#

Get the tolerance to be used when checking a definite inner product.

Not collective.

Returns:

The tolerance.

Return type:

:py:any:`float`

:sources:`Source code at slepc4py/SLEPc/BV.pyx:897 <slepc4py/SLEPc/BV.pyx#L897>`

getLeadingDimension()#

Get the leading dimension.

Not collective.

Returns:

The leading dimension.

Return type:

:py:any:`int`

:sources:`Source code at slepc4py/SLEPc/BV.pyx:377 <slepc4py/SLEPc/BV.pyx#L377>`

getMat()#

Get a Mat object of dense type that shares the memory of the BV object.

Collective.

Returns:

The matrix.

Return type:

:py:any:`petsc4py.PETSc.Mat`

Notes

The returned matrix contains only the active columns. If the content of the Mat is modified, these changes are also done in the BV object. The user must call restoreMat() when no longer needed.

:sources:`Source code at slepc4py/SLEPc/BV.pyx:1022 <slepc4py/SLEPc/BV.pyx#L1022>`

getMatMultMethod()#

Get the method used for the matMult() operation.

Not collective.

Returns:

The method for the matMult() operation.

Return type:

:py:any:`MatMultType`

:sources:`Source code at slepc4py/SLEPc/BV.pyx:535 <slepc4py/SLEPc/BV.pyx#L535>`

getMatrix()#

Get the matrix representation of the inner product.

Not collective.

Returns:

Return type:

tuple[petsc4py.PETSc.Mat, bool] | tuple[None, bool]

:sources:`Source code at slepc4py/SLEPc/BV.pyx:566 <slepc4py/SLEPc/BV.pyx#L566>`

getNumConstraints()#

Get the number of constraints.

Not collective.

Returns:

The number of constraints.

Return type:

:py:any:`int`

:sources:`Source code at slepc4py/SLEPc/BV.pyx:795 <slepc4py/SLEPc/BV.pyx#L795>`

getOptionsPrefix()#

Get the prefix used for searching for all BV options in the database.

Not collective.

Returns:

The prefix string set for this BV object.

Return type:

:py:any:`str`

:sources:`Source code at slepc4py/SLEPc/BV.pyx:428 <slepc4py/SLEPc/BV.pyx#L428>`

getOrthogonalization()#

Get the orthogonalization settings from the BV object.

Not collective.

Returns:

Return type:

tuple[OrthogType, OrthogRefineType, float, OrthogBlockType]

:sources:`Source code at slepc4py/SLEPc/BV.pyx:458 <slepc4py/SLEPc/BV.pyx#L458>`

getRandomContext()#

Get the petsc4py.PETSc.Random object associated with the BV.

Collective.

Returns:

The random number generator context.

Return type:

:py:any:`petsc4py.PETSc.Random`

:sources:`Source code at slepc4py/SLEPc/BV.pyx:1554 <slepc4py/SLEPc/BV.pyx#L1554>`

getSizes()#

Get the local and global sizes, and the number of columns.

Not collective.

Returns:

Return type:

tuple[TypeAliasForwardRef(‘~slepc4py.typing.LayoutSizeSpec’), int]

:sources:`Source code at slepc4py/SLEPc/BV.pyx:346 <slepc4py/SLEPc/BV.pyx#L346>`

getType()#

Get the BV type of this object.

Not collective.

Returns:

The inner product type currently being used.

Return type:

:py:any:`str`

:sources:`Source code at slepc4py/SLEPc/BV.pyx:288 <slepc4py/SLEPc/BV.pyx#L288>`

getVecType()#

Get the vector type used by the basis vectors object.

Not collective.

:sources:`Source code at slepc4py/SLEPc/BV.pyx:840 <slepc4py/SLEPc/BV.pyx#L840>`

Return type:

str

insertConstraints(C)#

Insert a set of vectors as constraints.

Collective.

Parameters:

C (Vec | list[Vec]) – Set of vectors to be inserted as constraints.

Returns:

Number of constraints.

Return type:

:py:any:`int`

Notes

The constraints are relevant only during orthogonalization. Constraint vectors span a subspace that is deflated in every orthogonalization operation, so they are intended for removing those directions from the orthogonal basis computed in regular BV columns.

:sources:`Source code at slepc4py/SLEPc/BV.pyx:749 <slepc4py/SLEPc/BV.pyx#L749>`

insertVec(j, w)#

Insert a vector into the specified column.

Logically collective.

Parameters:
  • j (int) – The column to be overwritten.

  • w (Vec) – The vector to be copied.

Return type:

None

:sources:`Source code at slepc4py/SLEPc/BV.pyx:694 <slepc4py/SLEPc/BV.pyx#L694>`

insertVecs(s, W, orth=False)#

Insert a set of vectors into specified columns.

Collective.

Parameters:
  • s (int) – The first column to be overwritten.

  • W (Vec | list[Vec]) – Set of vectors to be copied.

  • orth (bool) – Flag indicating if the vectors must be orthogonalized.

Returns:

Number of linearly independent vectors.

Return type:

:py:any:`int`

Notes

Copies the contents of vectors W into self(:,s:s+n), where n is the length of W. If orthogonalization flag is set then the vectors are copied one by one then orthogonalized against the previous one. If any are linearly dependent then it is discared and the value of m is decreased.

:sources:`Source code at slepc4py/SLEPc/BV.pyx:710 <slepc4py/SLEPc/BV.pyx#L710>`

matMult(A, Y=None)#

Compute the matrix-vector product for each column, \(Y = A V\).

Neighbor-wise collective.

Parameters:
Returns:

The result.

Return type:

:py:any:`BV`

Notes

Only active columns (excluding the leading ones) are processed.

It is possible to choose whether the computation is done column by column or using dense matrices using the options database keys:

-bv_matmult_vecs -bv_matmult_mat

The default is bv_matmult_mat.

:sources:`Source code at slepc4py/SLEPc/BV.pyx:1139 <slepc4py/SLEPc/BV.pyx#L1139>`

matMultColumn(A, j)#

Mat-vec product for a column, storing the result in the next column.

Neighbor-wise collective.

\(v_{j+1} = A v_j\).

Parameters:
  • A (Mat) – The matrix.

  • j (int) – Index of column.

Return type:

None

:sources:`Source code at slepc4py/SLEPc/BV.pyx:1234 <slepc4py/SLEPc/BV.pyx#L1234>`

matMultHermitianTranspose(A, Y=None)#

Pre-multiplication with the conjugate transpose of a matrix.

Neighbor-wise collective.

\(Y = A^H V\).

Parameters:
Returns:

The result.

Return type:

:py:any:`BV`

Notes

Only active columns (excluding the leading ones) are processed.

As opoosed to matMult(), this operation is always done by column by column, with a sequence of calls to MatMultHermitianTranspose().

:sources:`Source code at slepc4py/SLEPc/BV.pyx:1188 <slepc4py/SLEPc/BV.pyx#L1188>`

matMultHermitianTransposeColumn(A, j)#

Conjugate-transpose matrix-vector product for a specified column.

Neighbor-wise collective.

Store the result in the next column: \(v_{j+1} = A^H v_j\).

Parameters:
  • A (Mat) – The matrix.

  • j (int) – Index of column.

Return type:

None

:sources:`Source code at slepc4py/SLEPc/BV.pyx:1270 <slepc4py/SLEPc/BV.pyx#L1270>`

matMultTransposeColumn(A, j)#

Transpose matrix-vector product for a specified column.

Neighbor-wise collective.

Store the result in the next column: \(v_{j+1} = A^T v_j\).

Parameters:
  • A (Mat) – The matrix.

  • j (int) – Index of column.

Return type:

None

:sources:`Source code at slepc4py/SLEPc/BV.pyx:1252 <slepc4py/SLEPc/BV.pyx#L1252>`

matProject(A, Y)#

Compute the projection of a matrix onto a subspace.

Collective.

\(M = Y^H A X\)

Parameters:
  • A (petsc4py.PETSc.Mat | None) – Matrix to be projected.

  • Y (BV) – Left basis vectors, can be the same as self, giving \(M = X^H A X\).

Returns:

Projection of the matrix A onto the subspace.

Return type:

:py:any:`petsc4py.PETSc.Mat`

:sources:`Source code at slepc4py/SLEPc/BV.pyx:1109 <slepc4py/SLEPc/BV.pyx#L1109>`

mult(alpha, beta, X, Q)#

Compute \(Y = beta Y + alpha X Q\).

Logically collective.

Parameters:
  • alpha (Scalar) – Coefficient that multiplies X.

  • beta (Scalar) – Coefficient that multiplies Y.

  • X (BV) – Input basis vectors.

  • Q (Mat) – Input matrix, if not given the identity matrix is assumed.

Return type:

None

:sources:`Source code at slepc4py/SLEPc/BV.pyx:1288 <slepc4py/SLEPc/BV.pyx#L1288>`

multColumn(alpha, beta, j, q)#

Compute \(y = beta y + alpha X q\).

Logically collective.

Compute \(y = beta y + alpha X q\), where \(y\) is the \(j^{th}\) column.

Parameters:
  • alpha (Scalar) – Coefficient that multiplies X.

  • beta (Scalar) – Coefficient that multiplies y.

  • j (int) – The column index.

  • q (Sequence[TypeAliasForwardRef('~slepc4py.typing.Scalar')]) – Input coefficients.

Return type:

None

:sources:`Source code at slepc4py/SLEPc/BV.pyx:1329 <slepc4py/SLEPc/BV.pyx#L1329>`

multInPlace(Q, s, e)#

Update a set of vectors as \(V(:,s:e-1) = V Q(:,s:e-1)\).

Logically collective.

Parameters:
  • Q (Mat) – A sequential dense matrix.

  • s (int) – First column to be overwritten.

  • e (int) – Last column to be overwritten.

Return type:

None

:sources:`Source code at slepc4py/SLEPc/BV.pyx:1310 <slepc4py/SLEPc/BV.pyx#L1310>`

multVec(alpha, beta, y, q)#

Compute \(y = beta y + alpha X q\).

Logically collective.

Parameters:
  • alpha (Scalar) – Coefficient that multiplies X.

  • beta (Scalar) – Coefficient that multiplies y.

  • y (Vec) – Input/output vector.

  • q (Sequence[TypeAliasForwardRef('~slepc4py.typing.Scalar')]) – Input coefficients.

Return type:

None

:sources:`Source code at slepc4py/SLEPc/BV.pyx:1360 <slepc4py/SLEPc/BV.pyx#L1360>`

norm(norm_type=None)#

Compute the matrix norm of the BV.

Collective.

Parameters:

norm_type (NormType | None) – The norm type.

Returns:

The norm.

Return type:

:py:any:`float`

Notes

All active columns (except the leading ones) are considered as a matrix. The allowed norms are NORM_1, NORM_FROBENIUS, and NORM_INFINITY.

This operation fails if a non-standard inner product has been specified with BVSetMatrix().

:sources:`Source code at slepc4py/SLEPc/BV.pyx:1420 <slepc4py/SLEPc/BV.pyx#L1420>`

normColumn(j, norm_type=None)#

Compute the vector norm of a selected column.

Collective.

Parameters:
  • j (int) – Index of column.

  • norm_type (NormType | None) – The norm type.

Returns:

The norm.

Return type:

:py:any:`float`

Notes

The norm of \(V_j\) is computed (NORM_1, NORM_2, or NORM_INFINITY).

If a non-standard inner product has been specified with BVSetMatrix(), then the returned value is \(\sqrt{V_j^H B V_j}\), where \(B\) is the inner product matrix (argument ‘type’ is ignored).

:sources:`Source code at slepc4py/SLEPc/BV.pyx:1387 <slepc4py/SLEPc/BV.pyx#L1387>`

orthogonalize(R=None, **kargs)#

Orthogonalize all columns (except leading ones) (QR decomposition).

Collective.

Parameters:
  • R (Mat | None) – A sequential dense matrix.

  • kargs (Any)

Return type:

None

Notes

The output satisfies \(V_0 = V R\) (where \(V_0\) represent the input \(V\)) and \(V' V = I\).

:sources:`Source code at slepc4py/SLEPc/BV.pyx:1668 <slepc4py/SLEPc/BV.pyx#L1668>`

orthogonalizeColumn(j)#

Orthogonalize a column vector with respect to the previous ones.

Collective.

Parameters:

j (int) – Index of the column to be orthogonalized.

Returns:

  • norm (:py:any:`float`) – The norm of the resulting vector.

  • lindep (:py:any:`bool`) – Flag indicating that refinement did not improve the quality of orthogonalization.

Return type:

tuple[float, bool]

Notes

This function applies an orthogonal projector to project vector \(V_j\) onto the orthogonal complement of the span of the columns \(V[0..j-1]\), where \(V[.]\) are the vectors of the BV. The columns \(V[0..j-1]\) are assumed to be mutually orthonormal.

This routine does not normalize the resulting vector.

:sources:`Source code at slepc4py/SLEPc/BV.pyx:1602 <slepc4py/SLEPc/BV.pyx#L1602>`

orthogonalizeVec(v)#

Orthogonalize a vector with respect to a set of vectors.

Collective.

Parameters:

v (Vec) – Vector to be orthogonalized, modified on return.

Returns:

  • norm (:py:any:`float`) – The norm of the resulting vector.

  • lindep (:py:any:`bool`) – Flag indicating that refinement did not improve the quality of orthogonalization.

Return type:

tuple[float, bool]

Notes

This function applies an orthogonal projector to project vector \(v\) onto the orthogonal complement of the span of the columns of the BV.

This routine does not normalize the resulting vector.

:sources:`Source code at slepc4py/SLEPc/BV.pyx:1570 <slepc4py/SLEPc/BV.pyx#L1570>`

orthonormalizeColumn(j, replace=False)#

Orthonormalize a column vector with respect to the previous ones.

Collective.

This is equivalent to a call to orthogonalizeColumn() followed by a call to scaleColumn() with the reciprocal of the norm.

Parameters:
  • j (int) – Index of the column to be orthonormalized.

  • replace (bool) – Whether it is allowed to set the vector randomly.

Returns:

  • norm (:py:any:`float`) – The norm of the resulting vector.

  • lindep (:py:any:`bool`) – Flag indicating that refinement did not improve the quality of orthogonalization.

Return type:

tuple[float, bool]

:sources:`Source code at slepc4py/SLEPc/BV.pyx:1636 <slepc4py/SLEPc/BV.pyx#L1636>`

resize(m, copy=True)#

Change the number of columns.

Collective.

Parameters:
  • m (int) – The new number of columns.

  • copy (bool) – A flag indicating whether current values should be kept.

Return type:

None

Notes

Internal storage is reallocated. If copy is True, then the contents are copied to the leading part of the new space.

:sources:`Source code at slepc4py/SLEPc/BV.pyx:1451 <slepc4py/SLEPc/BV.pyx#L1451>`

restoreColumn(j, v)#

Restore a column obtained with getColumn().

Logically collective.

Parameters:
  • j (int) – The index of the requested column.

  • v (Vec) – The vector obtained with getColumn().

Return type:

None

Notes

The arguments must match the corresponding call to getColumn().

:sources:`Source code at slepc4py/SLEPc/BV.pyx:1001 <slepc4py/SLEPc/BV.pyx#L1001>`

restoreMat(A)#

Restore the Mat obtained with getMat().

Logically collective.

Parameters:

A (Mat) – The matrix obtained with getMat().

Return type:

None

Notes

A call to this function must match a previous call of getMat(). The effect is that the contents of the Mat are copied back to the BV internal data structures.

:sources:`Source code at slepc4py/SLEPc/BV.pyx:1044 <slepc4py/SLEPc/BV.pyx#L1044>`

scale(alpha)#

Multiply the entries by a scalar value.

Logically collective.

Parameters:

alpha (Scalar) – scaling factor.

Return type:

None

Notes

All active columns (except the leading ones) are scaled.

:sources:`Source code at slepc4py/SLEPc/BV.pyx:676 <slepc4py/SLEPc/BV.pyx#L676>`

scaleColumn(j, alpha)#

Scale column j by alpha.

Logically collective.

Parameters:
  • j (int) – column number to be scaled.

  • alpha (Scalar) – scaling factor.

Return type:

None

:sources:`Source code at slepc4py/SLEPc/BV.pyx:659 <slepc4py/SLEPc/BV.pyx#L659>`

setActiveColumns(l, k)#

Set the columns that will be involved in operations.

Logically collective.

Parameters:
  • l (int) – The leading number of columns.

  • k (int) – The active number of columns.

Return type:

None

:sources:`Source code at slepc4py/SLEPc/BV.pyx:625 <slepc4py/SLEPc/BV.pyx#L625>`

setDefiniteTolerance(deftol)#

Set the tolerance to be used when checking a definite inner product.

Logically collective.

Parameters:

deftol (float) – The tolerance.

Return type:

None

:sources:`Source code at slepc4py/SLEPc/BV.pyx:883 <slepc4py/SLEPc/BV.pyx#L883>`

setFromOptions()#

Set BV options from the options database.

Collective.

Notes

To see all options, run your program with the -help option.

:sources:`Source code at slepc4py/SLEPc/BV.pyx:443 <slepc4py/SLEPc/BV.pyx#L443>`

Return type:

None

setLeadingDimension(ld)#

Set the leading dimension.

Not collective.

Parameters:

ld (int) – The leading dimension.

Return type:

None

:sources:`Source code at slepc4py/SLEPc/BV.pyx:363 <slepc4py/SLEPc/BV.pyx#L363>`

setMatMultMethod(method)#

Set the method used for the matMult() operation.

Logically collective.

Parameters:

method (MatMultType) – The method for the matMult() operation.

Return type:

None

:sources:`Source code at slepc4py/SLEPc/BV.pyx:550 <slepc4py/SLEPc/BV.pyx#L550>`

setMatrix(mat, indef=False)#

Set the bilinear form to be used for inner products.

Collective.

Parameters:
  • mat (Mat) – The matrix of the inner product.

  • indef (bool) – Whether the matrix is indefinite

Return type:

None

:sources:`Source code at slepc4py/SLEPc/BV.pyx:588 <slepc4py/SLEPc/BV.pyx#L588>`

setNumConstraints(nc)#

Set the number of constraints.

Logically collective.

Parameters:

nc (int) – The number of constraints.

Return type:

None

:sources:`Source code at slepc4py/SLEPc/BV.pyx:781 <slepc4py/SLEPc/BV.pyx#L781>`

setOptionsPrefix(prefix=None)#

Set the prefix used for searching for all BV options in the database.

Logically collective.

Parameters:

prefix (str | None) – The prefix string to prepend to all BV option requests.

Return type:

None

Notes

A hyphen (-) must NOT be given at the beginning of the prefix name. The first character of all runtime options is AUTOMATICALLY the hyphen.

:sources:`Source code at slepc4py/SLEPc/BV.pyx:392 <slepc4py/SLEPc/BV.pyx#L392>`

setOrthogonalization(otype=None, refine=None, eta=None, block=None)#

Set the method used for the (block-)orthogonalization of vectors.

Logically collective.

Ortogonalization of vectors (classical or modified Gram-Schmidt with or without refinement), and for the block-orthogonalization (simultaneous orthogonalization of a set of vectors).

Parameters:
Return type:

None

Notes

The default settings work well for most problems.

The parameter eta should be a real value between 0 and 1 (or DETERMINE). The value of eta is used only when the refinement type is BV.OrthogRefineType.IFNEEDED.

When using several processors, BV.OrthogType.MGS is likely to result in bad scalability.

If the method set for block orthogonalization is GS, then the computation is done column by column with the vector orthogonalization.

:sources:`Source code at slepc4py/SLEPc/BV.pyx:483 <slepc4py/SLEPc/BV.pyx#L483>`

setRandom()#

Set the active columns of the BV to random numbers.

Logically collective.

Notes

All active columns (except the leading ones) are modified.

:sources:`Source code at slepc4py/SLEPc/BV.pyx:1473 <slepc4py/SLEPc/BV.pyx#L1473>`

Return type:

None

setRandomColumn(j)#

Set one column of the BV to random numbers.

Logically collective.

Parameters:

j (int) – Column number to be set.

Return type:

None

:sources:`Source code at slepc4py/SLEPc/BV.pyx:1509 <slepc4py/SLEPc/BV.pyx#L1509>`

setRandomCond(condn)#

Set the columns of a BV to random numbers.

Logically collective.

The generated matrix has a prescribed condition number.

Parameters:

condn (float) – Condition number.

Return type:

None

:sources:`Source code at slepc4py/SLEPc/BV.pyx:1523 <slepc4py/SLEPc/BV.pyx#L1523>`

setRandomContext(rnd)#

Set the petsc4py.PETSc.Random object associated with the BV.

Collective.

To be used in operations that need random numbers.

Parameters:

rnd (Random) – The random number generator context.

Return type:

None

:sources:`Source code at slepc4py/SLEPc/BV.pyx:1539 <slepc4py/SLEPc/BV.pyx#L1539>`

setRandomNormal()#

Set the active columns of the BV to normal random numbers.

Logically collective.

Notes

All active columns (except the leading ones) are modified.

:sources:`Source code at slepc4py/SLEPc/BV.pyx:1485 <slepc4py/SLEPc/BV.pyx#L1485>`

Return type:

None

setRandomSign()#

Set the entries of a BV to values 1 or -1 with equal probability.

Logically collective.

Notes

All active columns (except the leading ones) are modified.

:sources:`Source code at slepc4py/SLEPc/BV.pyx:1497 <slepc4py/SLEPc/BV.pyx#L1497>`

Return type:

None

setSizes(sizes, m)#

Set the local and global sizes, and the number of columns.

Collective.

Parameters:
  • sizes (LayoutSizeSpec) – The global size N or a two-tuple (n, N) with the local and global sizes.

  • m (int) – The number of columns.

Return type:

None

Notes

Either n or N (but not both) can be PETSc.DECIDE or None to have it automatically set.

:sources:`Source code at slepc4py/SLEPc/BV.pyx:303 <slepc4py/SLEPc/BV.pyx#L303>`

setSizesFromVec(w, m)#

Set the local and global sizes, and the number of columns.

Collective.

Local and global sizes are specified indirectly by passing a template vector.

Parameters:
  • w (Vec) – The template vector.

  • m (int) – The number of columns.

Return type:

None

:sources:`Source code at slepc4py/SLEPc/BV.pyx:327 <slepc4py/SLEPc/BV.pyx#L327>`

setType(bv_type)#

Set the type for the BV object.

Logically collective.

Parameters:

bv_type (Type | str) – The inner product type to be used.

Return type:

None

:sources:`Source code at slepc4py/SLEPc/BV.pyx:273 <slepc4py/SLEPc/BV.pyx#L273>`

setVecType(vec_type)#

Set the vector type.

Collective.

Parameters:

vec_type (petsc4py.PETSc.Vec.Type | str) – Vector type used when creating vectors with createVec.

Return type:

None

:sources:`Source code at slepc4py/SLEPc/BV.pyx:825 <slepc4py/SLEPc/BV.pyx#L825>`

view(viewer=None)#

Print the BV data structure.

Collective.

Parameters:

viewer (Viewer | None) – Visualization context; if not provided, the standard output is used.

Return type:

None

:sources:`Source code at slepc4py/SLEPc/BV.pyx:150 <slepc4py/SLEPc/BV.pyx#L150>`

Attributes Documentation

column_size#

Basis vectors column size.

:sources:`Source code at slepc4py/SLEPc/BV.pyx:1705 <slepc4py/SLEPc/BV.pyx#L1705>`

local_size#

Basis vectors local size.

:sources:`Source code at slepc4py/SLEPc/BV.pyx:1700 <slepc4py/SLEPc/BV.pyx#L1700>`

size#

Basis vectors global size.

:sources:`Source code at slepc4py/SLEPc/BV.pyx:1695 <slepc4py/SLEPc/BV.pyx#L1695>`

sizes#

Basis vectors local and global sizes, and the number of columns.

:sources:`Source code at slepc4py/SLEPc/BV.pyx:1690 <slepc4py/SLEPc/BV.pyx#L1690>`

__init__()#
classmethod __new__(*args, **kwargs)#