slepc4py.SLEPc.BV#

class slepc4py.SLEPc.BV#

Bases: Object

Basis Vectors.

The BV package provides the concept of a block of vectors that represent the basis of a subspace. It is a convenient way of handling a collection of vectors that often operate together, rather than working with an array of petsc4py.PETSc.Vec.

Enumerations

MatMultType

BV mat-mult types.

OrthogBlockType

BV block-orthogonalization types.

OrthogRefineType

BV orthogonalization refinement types.

OrthogType

BV orthogonalization types.

SVDMethod

BV methods for computing the SVD.

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.

getArray([readonly])

Return the array where the data is stored.

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.

matMultTranspose(A[, Y])

Pre-multiplication with the transpose of a matrix.

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

Source code at slepc4py/SLEPc/BV.pyx:478

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.

Source code at slepc4py/SLEPc/BV.pyx:670

copy(result=None)#

Copy a basis vector object into another one.

Logically collective.

Parameters:

result (BV | None) – The copy.

Return type:

BV

Source code at slepc4py/SLEPc/BV.pyx:277

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

Source code at slepc4py/SLEPc/BV.pyx:931

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

Source code at slepc4py/SLEPc/BV.pyx:915

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

Source code at slepc4py/SLEPc/BV.pyx:197

createFromMat(A)#

Create a basis vectors object from a dense Mat object.

Collective.

Parameters:

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

Return type:

Self

Source code at slepc4py/SLEPc/BV.pyx:215

createMat()#

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

Collective.

Returns:

The new matrix.

Return type:

petsc4py.PETSc.Mat

Source code at slepc4py/SLEPc/BV.pyx:231

createVec()#

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

Collective.

Returns:

New vector.

Return type:

petsc4py.PETSc.Vec

Source code at slepc4py/SLEPc/BV.pyx:875

destroy()#

Destroy the BV object.

Collective.

Source code at slepc4py/SLEPc/BV.pyx:187

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:

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\)).

Source code at slepc4py/SLEPc/BV.pyx:1129

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:

ArrayScalar

Source code at slepc4py/SLEPc/BV.pyx:1013

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:

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\).

Source code at slepc4py/SLEPc/BV.pyx:977

duplicate()#

Duplicate the BV object with the same type and dimensions.

Collective.

Source code at slepc4py/SLEPc/BV.pyx:246

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.

Source code at slepc4py/SLEPc/BV.pyx:256

getActiveColumns()#

Get the current active dimensions.

Not collective.

Returns:

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

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

Return type:

tuple[int, int]

Source code at slepc4py/SLEPc/BV.pyx:707

getArray(readonly=False)#

Return the array where the data is stored.

Not collective.

Parameters:

readonly (bool) – Enable to obtain a read only array.

Return type:

ArrayScalar

Source code at slepc4py/SLEPc/BV.pyx:414

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:

petsc4py.PETSc.Vec

Notes

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

Source code at slepc4py/SLEPc/BV.pyx:1040

getDefiniteTolerance()#

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

Not collective.

Returns:

The tolerance.

Return type:

float

Source code at slepc4py/SLEPc/BV.pyx:962

getLeadingDimension()#

Get the leading dimension.

Not collective.

Returns:

The leading dimension.

Return type:

int

Source code at slepc4py/SLEPc/BV.pyx:399

getMat()#

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

Collective.

Returns:

The matrix.

Return type:

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.

Source code at slepc4py/SLEPc/BV.pyx:1087

getMatMultMethod()#

Get the method used for the matMult() operation.

Not collective.

Returns:

The method for the matMult() operation.

Return type:

MatMultType

Source code at slepc4py/SLEPc/BV.pyx:600

getMatrix()#

Get the matrix representation of the inner product.

Not collective.

Returns:

  • mat (petsc4py.PETSc.Mat) – The matrix of the inner product

  • indef (bool) – Whether the matrix is indefinite

Return type:

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

Source code at slepc4py/SLEPc/BV.pyx:631

getNumConstraints()#

Get the number of constraints.

Not collective.

Returns:

The number of constraints.

Return type:

int

Source code at slepc4py/SLEPc/BV.pyx:860

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:

str

Source code at slepc4py/SLEPc/BV.pyx:493

getOrthogonalization()#

Get the orthogonalization settings from the BV object.

Not collective.

Returns:

Return type:

tuple[OrthogType, OrthogRefineType, float, OrthogBlockType]

Source code at slepc4py/SLEPc/BV.pyx:523

getRandomContext()#

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

Collective.

Returns:

The random number generator context.

Return type:

petsc4py.PETSc.Random

Source code at slepc4py/SLEPc/BV.pyx:1662

getSizes()#

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

Not collective.

Returns:

  • (n, N) (tuple of int) – The local and global sizes

  • m (int) – The number of columns.

Return type:

tuple[LayoutSizeSpec, int]

Source code at slepc4py/SLEPc/BV.pyx:368

getType()#

Get the BV type of this object.

Not collective.

Returns:

The basis vectors type currently being used.

Return type:

str

Source code at slepc4py/SLEPc/BV.pyx:310

getVecType()#

Get the vector type used by the basis vectors object.

Not collective.

Source code at slepc4py/SLEPc/BV.pyx:905

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:

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.

Source code at slepc4py/SLEPc/BV.pyx:814

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

Source code at slepc4py/SLEPc/BV.pyx:759

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:

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.

Source code at slepc4py/SLEPc/BV.pyx:775

matMult(A, Y=None)#

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

Neighbor-wise collective.

Parameters:
Returns:

The result.

Return type:

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.

Source code at slepc4py/SLEPc/BV.pyx:1204

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

Source code at slepc4py/SLEPc/BV.pyx:1342

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:

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().

Source code at slepc4py/SLEPc/BV.pyx:1296

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

Source code at slepc4py/SLEPc/BV.pyx:1378

matMultTranspose(A, Y=None)#

Pre-multiplication with the transpose of a matrix.

Neighbor-wise collective.

\(Y = A^T V\).

Parameters:
Returns:

The result.

Return type:

BV

Notes

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

Source code at slepc4py/SLEPc/BV.pyx:1253

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

Source code at slepc4py/SLEPc/BV.pyx:1360

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:

petsc4py.PETSc.Mat

Source code at slepc4py/SLEPc/BV.pyx:1174

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

Source code at slepc4py/SLEPc/BV.pyx:1396

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[Scalar]) – Input coefficients.

Return type:

None

Source code at slepc4py/SLEPc/BV.pyx:1437

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

Source code at slepc4py/SLEPc/BV.pyx:1418

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[Scalar]) – Input coefficients.

Return type:

None

Source code at slepc4py/SLEPc/BV.pyx:1468

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:

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().

Source code at slepc4py/SLEPc/BV.pyx:1528

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:

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).

Source code at slepc4py/SLEPc/BV.pyx:1495

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\).

Source code at slepc4py/SLEPc/BV.pyx:1776

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 (float) – The norm of the resulting vector.

  • lindep (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.

Source code at slepc4py/SLEPc/BV.pyx:1710

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 (float) – The norm of the resulting vector.

  • lindep (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.

Source code at slepc4py/SLEPc/BV.pyx:1678

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 (float) – The norm of the resulting vector.

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

Return type:

tuple[float, bool]

Source code at slepc4py/SLEPc/BV.pyx:1744

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.

Source code at slepc4py/SLEPc/BV.pyx:1559

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().

Source code at slepc4py/SLEPc/BV.pyx:1066

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.

Source code at slepc4py/SLEPc/BV.pyx:1109

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.

Source code at slepc4py/SLEPc/BV.pyx:741

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

Source code at slepc4py/SLEPc/BV.pyx:724

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

Source code at slepc4py/SLEPc/BV.pyx:690

setDefiniteTolerance(deftol)#

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

Logically collective.

Parameters:

deftol (float) – The tolerance.

Return type:

None

Source code at slepc4py/SLEPc/BV.pyx:948

setFromOptions()#

Set BV options from the options database.

Collective.

Notes

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

Source code at slepc4py/SLEPc/BV.pyx:508

Return type:

None

setLeadingDimension(ld)#

Set the leading dimension.

Not collective.

Parameters:

ld (int) – The leading dimension.

Return type:

None

Source code at slepc4py/SLEPc/BV.pyx:385

setMatMultMethod(method)#

Set the method used for the matMult() operation.

Logically collective.

Parameters:

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

Return type:

None

Source code at slepc4py/SLEPc/BV.pyx:615

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

Source code at slepc4py/SLEPc/BV.pyx:653

setNumConstraints(nc)#

Set the number of constraints.

Logically collective.

Parameters:

nc (int) – The number of constraints.

Return type:

None

Source code at slepc4py/SLEPc/BV.pyx:846

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.

Source code at slepc4py/SLEPc/BV.pyx:457

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.

Source code at slepc4py/SLEPc/BV.pyx:548

setRandom()#

Set the active columns of the BV to random numbers.

Logically collective.

Notes

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

Source code at slepc4py/SLEPc/BV.pyx:1581

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

Source code at slepc4py/SLEPc/BV.pyx:1617

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

Source code at slepc4py/SLEPc/BV.pyx:1631

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

Source code at slepc4py/SLEPc/BV.pyx:1647

setRandomNormal()#

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

Logically collective.

Notes

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

Source code at slepc4py/SLEPc/BV.pyx:1593

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.

Source code at slepc4py/SLEPc/BV.pyx:1605

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.

Source code at slepc4py/SLEPc/BV.pyx:325

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

Source code at slepc4py/SLEPc/BV.pyx:349

setType(bv_type)#

Set the type for the BV object.

Logically collective.

Parameters:

bv_type (Type | str) – The basis vectors type to be used.

Return type:

None

Source code at slepc4py/SLEPc/BV.pyx:295

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

Source code at slepc4py/SLEPc/BV.pyx:890

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

Source code at slepc4py/SLEPc/BV.pyx:172

Attributes Documentation

column_size#

Basis vectors column size.

Source code at slepc4py/SLEPc/BV.pyx:1813

local_size#

Basis vectors local size.

Source code at slepc4py/SLEPc/BV.pyx:1808

size#

Basis vectors global size.

Source code at slepc4py/SLEPc/BV.pyx:1803

sizes#

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

Source code at slepc4py/SLEPc/BV.pyx:1798