slepc4py.SLEPc.BV#
- class slepc4py.SLEPc.BV#
Bases:
ObjectBasis Vectors.
The
BVpackage 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 ofpetsc4py.PETSc.Vec.Enumerations
BV mat-mult types.
BV block-orthogonalization types.
BV orthogonalization refinement types.
BV orthogonalization types.
BV methods for computing the SVD.
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 vector.
create([comm])Create the BV object.
Create a basis vectors object from a dense matrix.
Create a new dense matrix and copy the contents of the BV.
Create a vector 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 the BV object with the same type and dimensions.
Create a BV object of the same type and dimensions as an existing one.
Get the current active dimensions.
getArray([readonly])Return the array where the data is stored.
getColumn(j)Get a vector with the entries of the column of the BV object.
Get the tolerance to be used when checking a definite inner product.
Get the leading dimension.
getMat()Get a matrix of dense type that shares the memory of the BV object.
Get the method used for the
matMult()operation.Get the matrix representation of the inner product.
Get the number of constraints.
Get the prefix used for searching for all BV options in the database.
Get the orthogonalization settings from the BV object.
Get the
petsc4py.PETSc.Randomobject associated with the BV.getSizes()Get the local and global sizes, and the number of columns.
getType()Get the BV type of this object.
Get the vector type used when creating vectors via
createVec().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 the 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.
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(delta, gamma, X, Q)Compute \(Y = \gamma Y + \delta X Q\).
multColumn(delta, gamma, j, q)Compute \(y = \gamma y + \delta X q\).
multInPlace(Q, s, e)Update a set of vectors as \(V(:,s:e-1) = V Q(:,s:e-1)\).
multVec(delta, gamma, y, q)Compute \(y = \gamma y + \delta 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).
Orthogonalize a column vector with respect to the previous ones.
Orthogonalize a vector with respect to all active columns.
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 matrix obtained with
getMat().scale(alpha)Multiply the entries by a scalar value.
scaleColumn(j, alpha)Scale a column of a BV.
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.
Set BV options from the options database.
Set the leading dimension.
setMatMultMethod(method)Set the method used for the
matMult()operation.setMatrix(B[, indef])Set the bilinear form to be used for inner products.
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.
Set the active columns of the BV to random numbers.
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.Randomobject associated with the BV.Set the active columns of the BV to normal random numbers.
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 to be used when creating vectors via
createVec().view([viewer])Print the BV data structure.
Attributes Summary
Basis vectors column size.
Basis vectors local size.
Basis vectors global size.
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.
- applyMatrix(x, y)#
Multiply a vector with the matrix associated to the bilinear form.
Neighbor-wise collective.
Notes
If the bilinear form has no associated matrix this function copies the vector.
See also
- copy(result=None)#
Copy a basis vector object into another one.
Logically collective.
Notes
Both objects must be distributed in the same manner; local copies are done. Only active columns (excluding the leading ones) are copied. In the destination BV, columns are overwritten starting from the leading ones. Constraints are not copied.
See also
- copyColumn(j, i)#
Copy the values from one of the columns to another one.
Logically collective.
- Parameters:
- Return type:
See also
- copyVec(j, v)#
Copy one of the columns of a basis vectors object into a vector.
Logically collective.
Notes
The BV and
vmust be distributed in the same manner; local copies are done.See also
- create(comm=None)#
Create the BV object.
Collective.
- Parameters:
comm (Comm | None) – MPI communicator; if not provided, it defaults to all processes.
- Return type:
See also
- createFromMat(A)#
Create a basis vectors object from a dense matrix.
Collective.
Notes
The matrix values are copied to the
BVdata storage, memory is not shared.The communicator of the
BVobject will be the same asA, and so will be the dimensions.See also
- createMat()#
Create a new dense matrix and copy the contents of the BV.
Collective.
- Returns:
The new matrix.
- Return type:
Notes
The matrix contains all columns of the
BV, not just the active columns.See also
- createVec()#
Create a vector with the type and dimensions of the columns of the BV.
Collective.
- Returns:
New vector.
- Return type:
See also
- destroy()#
Destroy the BV object.
Collective.
See also
Source code at slepc4py/SLEPc/BV.pyx:211
- Return type:
- dot(Y)#
Compute the ‘block-dot’ product of two basis vectors objects.
Collective.
\(M = Y^* X\) \((m_{ij} = y_i^* x_j)\) or \(M = Y^* B X\)
- Parameters:
Y (BV) – Left basis vectors, can be the same as self, giving \(M = X^* X\).
- Returns:
The resulting matrix.
- Return type:
Notes
This is the generalization of
Vec.dot()for a collection of vectors, \(M = Y^* X\). The result is a matrix \(M\) whose entry \(m_{ij}\) is equal to \(y_i^* x_j\) (where \(y_i^*\) 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^* B X\). In this case, both \(X\) and \(Y\) must have the same associated matrix.Only rows (resp. columns) of \(M\) starting from \(l_y\) (resp. \(l_x\)) are computed, where \(l_y\) (resp. \(l_x\)) is the number of leading columns of \(Y\) (resp. \(X\)).
See also
- 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:
Notes
This operation is equivalent to
dotVec()but it uses columnjof the BV rather than taking a vector as an argument. The number of active columns of the BV is set tojbefore the computation, and restored afterwards. If the BV has leading columns specified, then these columns do not participate in the computation. Therefore, the length of the returned array will bejminus the number of leading columns.See also
- 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:
Notes
This is analogue to
Vec.mDot(), but usingBVto represent a collection of vectorsX. The result is \(m = X^* v\), so \(m_i\) is equal to \(x_j^* v\). Note that here \(X\) is transposed as opposed todot().If a non-standard inner product has been specified with
setMatrix(), then the result is \(m = X^* B v\).
- duplicate()#
Duplicate the BV object with the same type and dimensions.
Collective.
- Returns:
The new object.
- Return type:
Notes
This function does not copy the entries, it just allocates the storage for the new
BV. Usecopy()to copy the content.See also
- duplicateResize(m)#
Create a BV object of the same type and dimensions as an existing one.
Collective.
Notes
This is equivalent to a call to
duplicate()followed byresize()with possibly different number of columns. The contents of thisBVare not copied to the new one.See also
- getActiveColumns()#
Get the current active dimensions.
Not collective.
- Returns:
- Return type:
See also
- getArray(readonly=False)#
Return the array where the data is stored.
Not collective.
- Parameters:
readonly (bool) – Enable to obtain a read only array.
- Returns:
The array.
- Return type:
See also
- getColumn(j)#
Get a vector 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
j-th column.- Return type:
Notes
Modifying the returned vector will change the BV entries as well.
The returned vector must not be destroyed,
restoreColumn()must be called when it is no longer needed. At most, two columns can be fetched, that is, this function can only be called twice before the correspondingrestoreColumn()is invoked.A negative index
jselects thei-th constraint, wherei=-j. Constraints should not be modified.See also
- getDefiniteTolerance()#
Get the tolerance to be used when checking a definite inner product.
Not collective.
- Returns:
The tolerance.
- Return type:
See also
- getLeadingDimension()#
Get the leading dimension.
Not collective.
- Returns:
The leading dimension.
- Return type:
Notes
The returned value may be different in different processes.
The leading dimension must be used when accessing the internal array via
getArray().See also
- getMat()#
Get a matrix of dense type that shares the memory of the BV object.
Collective.
- Returns:
The matrix.
- Return type:
Notes
The returned matrix contains only the active columns. If the content of the matrix is modified, these changes are also done in the BV object. The user must call
restoreMat()when no longer needed.This operation implies a call to
getArray(), which may result in data copies.See also
- getMatMultMethod()#
Get the method used for the
matMult()operation.Not collective.
- Returns:
The method for the
matMult()operation.- Return type:
See also
- getMatrix()#
Get the matrix representation of the inner product.
Not collective.
- Returns:
B (
petsc4py.PETSc.Mat) – The matrix of the inner product.indef (
bool) – Whether the matrix is indefinite.
- Return type:
See also
- getNumConstraints()#
Get the number of constraints.
Not collective.
- Returns:
The number of constraints.
- Return type:
- 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:
- getOrthogonalization()#
Get the orthogonalization settings from the BV object.
Not collective.
- Returns:
type (
OrthogType) – The type of orthogonalization technique.refine (
OrthogRefineType) – The type of refinement.eta (
float) – Parameter for selective refinement (used when the refinement type isIFNEEDED).block (
OrthogBlockType) – The type of block orthogonalization.
- Return type:
See also
- getRandomContext()#
Get the
petsc4py.PETSc.Randomobject associated with the BV.Collective.
- Returns:
The random number generator context.
- Return type:
See also
- getSizes()#
Get the local and global sizes, and the number of columns.
Not collective.
- Returns:
- Return type:
See also
- getType()#
Get the BV type of this object.
Not collective.
- Returns:
The basis vectors type currently being used.
- Return type:
- getVecType()#
Get the vector type used when creating vectors via
createVec().Not collective.
- Returns:
The vector type.
- Return type:
See also
- 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 linearly independent constraints.
- Return type:
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.
Constraints are not stored in regular columns, but in a special part of the storage. They can be accessed with negative indices in
getColumn().This operation is DESTRUCTIVE, meaning that all data contained in the columns of the BV is lost. This is typically invoked just after creating the BV. Once a set of constraints has been set, it is not allowed to call this function again.
The vectors are copied one by one and then orthogonalized against the previous ones. If any of them is linearly dependent then it is discarded and not counted in the return value. The behavior is similar to
insertVecs().See also
- insertVec(j, w)#
Insert a vector into the specified column.
Logically collective.
- Parameters:
- Return type:
See also
- insertVecs(s, W, orth=False)#
Insert a set of vectors into the specified columns.
Collective.
- Parameters:
- Returns:
Number of linearly independent vectors.
- Return type:
Notes
Copies the contents of vectors
Winto the BV columnss:s+n, wherenis the length ofW. Iforthis set, then the vectors are copied one by one and then orthogonalized against the previous one. If any of them is linearly dependent then it is discarded and the not counted in the return value.See also
- matMult(A, Y=None)#
Compute the matrix-vector product for each column, \(Y = A V\).
Neighbor-wise collective.
Notes
Only active columns (excluding the leading ones) are processed. If
YisNonea new BV is created.It is possible to choose whether the computation is done column by column or as a dense matrix-matrix product with
setMatMultMethod().See also
copy,matMultColumn,matMultTranspose,setMatMultMethod,BVMatMult
- 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\).
See also
- matMultHermitianTranspose(A, Y=None)#
Pre-multiplication with the conjugate transpose of a matrix.
Neighbor-wise collective.
\(Y = A^* V\).
Notes
Only active columns (excluding the leading ones) are processed. If
YisNonea new BV is created.
- 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^* v_j\).
- matMultTranspose(A, Y=None)#
Pre-multiplication with the transpose of a matrix.
Neighbor-wise collective.
\(Y = A^T V\).
Notes
Only active columns (excluding the leading ones) are processed. If
YisNonea new BV is created.See also
- 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\).
See also
- matProject(A, Y)#
Compute the projection of a matrix onto a subspace.
Collective.
\(M = Y^* A X\)
- Parameters:
- Returns:
Projection of the matrix
Aonto the subspace.- Return type:
Notes
If
AisNone, then it is assumed that the BV already contains \(AX\).This operation is similar to
dot(), with important differences. The goal is to compute the matrix resulting from the orthogonal projection ofAonto the subspace spanned by the columns of the BV, \(M = X^*AX\), or the oblique projection onto the BV along the second oneY, \(M = Y^*AX\).A difference with respect to
dot()is that the standard inner product is always used, regardless of a non-standard inner product being specified withsetMatrix().See also
- mult(delta, gamma, X, Q)#
Compute \(Y = \gamma Y + \delta X Q\).
Logically collective.
- Parameters:
- Return type:
Notes
Xmust be different from self (Y). The caseX=Ycan be addressed withmultInPlace().See also
- multColumn(delta, gamma, j, q)#
Compute \(y = \gamma y + \delta X q\).
Logically collective.
Compute \(y = \gamma y + \delta X q\), where \(y\) is the
j-th column.- Parameters:
- Return type:
See also
- multInPlace(Q, s, e)#
Update a set of vectors as \(V(:,s:e-1) = V Q(:,s:e-1)\).
Logically collective.
- Parameters:
- Return type:
See also
- multVec(delta, gamma, y, q)#
Compute \(y = \gamma y + \delta X q\).
Logically collective.
- Parameters:
- Return type:
See also
- norm(norm_type=None)#
Compute the matrix norm of the BV.
Collective.
Notes
All active columns (except the leading ones) are considered as a matrix. The allowed norms are
NORM_1,NORM_FROBENIUS, andNORM_INFINITY.This operation fails if a non-standard inner product has been specified with
setMatrix().See also
- normColumn(j, norm_type=None)#
Compute the vector norm of a selected column.
Collective.
- Parameters:
- Returns:
The norm.
- Return type:
Notes
The norm of \(v_j\) is computed (
NORM_1,NORM_2, orNORM_INFINITY).If a non-standard inner product has been specified with
setMatrix(), then the returned value is \(\sqrt{v_j^* B v_j}\), where \(B\) is the inner product matrix (argument ‘norm_type’ is ignored).See also
- orthogonalize(R=None, **kargs)#
Orthogonalize all columns (except leading ones) (QR decomposition).
Collective.
Notes
The output satisfies \(V_0 = V R\) (where \(V_0\) represent the input \(V\)) and \(V^* V = I\) (or \(V^*BV=I\) if an inner product matrix \(B\) has been specified with
setMatrix()).
- orthogonalizeColumn(j)#
Orthogonalize a column vector with respect to the previous ones.
Collective.
- Parameters:
j (int) – Index of the column to be orthogonalized.
- Returns:
- Return type:
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.
See also
- orthogonalizeVec(v)#
Orthogonalize a vector with respect to all active columns.
Collective.
- Parameters:
v (Vec) – Vector to be orthogonalized, modified on return.
- Returns:
- Return type:
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.
See also
- 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 toscaleColumn()with the reciprocal of the norm.- Parameters:
- Returns:
- Return type:
See also
- resize(m, copy=True)#
Change the number of columns.
Collective.
- Parameters:
- Return type:
Notes
Internal storage is reallocated. If
copyisTrue, then the contents are copied to the leading part of the new space.See also
- 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:
Notes
The arguments must match the corresponding call to
getColumn().See also
- restoreMat(A)#
Restore the matrix obtained with
getMat().Logically collective.
Notes
A call to this function must match a previous call of
getMat(). The effect is that the contents of the matrix are copied back to the BV internal data structures.See also
- scale(alpha)#
Multiply the entries by a scalar value.
Logically collective.
Notes
All active columns (except the leading ones) are scaled.
See also
- scaleColumn(j, alpha)#
Scale a column of a BV.
Logically collective.
See also
- setActiveColumns(l, k)#
Set the columns that will be involved in operations.
Logically collective.
- Parameters:
- Return type:
Notes
In operations such as
mult()ordot(), only the firstkcolumns are considered. This is useful when the BV is filled from left to right, so the lastm-kcolumns do not have relevant information.Also in operations such as
mult()ordot(), the firstlcolumns are normally not included in the computation.In orthogonalization operations, the first
lcolumns are treated differently, they participate in the orthogonalization but the computed coefficients are not stored.Use
CURRENTto leave any of the values unchanged. UseDETERMINEto setlto the minimum value (0) andkto the maximum (m).See also
- setDefiniteTolerance(deftol)#
Set the tolerance to be used when checking a definite inner product.
Logically collective.
Notes
When using a non-standard inner product, see
setMatrix(), the solver needs to compute \(\sqrt{z^*B z}\) for various vectors \(z\). If the inner product has not been declared indefinite, the value \(z^*B z\) must be positive, but due to rounding error a tiny value may become negative. A tolerance is used to detect this situation. Likewise, in complex arithmetic \(z^*B z\) should be real, and we use the same tolerance to check whether a nonzero imaginary part can be considered negligible.See also
- setFromOptions()#
Set BV options from the options database.
Collective.
Notes
To see all options, run your program with the
-helpoption.See also
Source code at slepc4py/SLEPc/BV.pyx:656
- Return type:
- setLeadingDimension(ld)#
Set the leading dimension.
Not collective.
Notes
This parameter is relevant for a BV of
BV.Type.MAT.See also
- setMatMultMethod(method)#
Set the method used for the
matMult()operation.Logically collective.
- Parameters:
method (MatMultType) – The method for the
matMult()operation.- Return type:
See also
- setMatrix(B, indef=False)#
Set the bilinear form to be used for inner products.
Collective.
- Parameters:
- Return type:
Notes
This is used to specify a non-standard inner product, whose matrix representation is given by
B. Then, all inner products required during orthogonalization are computed as \((x,y)_B=y^*Bx\) rather than the standard form \((x,y)=y^*x\).Matrix
Bmust be real symmetric (or complex Hermitian). A genuine inner product requires thatBis also positive (semi-)definite. However, we also allow for an indefiniteB(settingindef=True), in which case the orthogonalization uses an indefinite inner product.This affects operations
dot(),norm(),orthogonalize(), and variants.Omitting
Bhas the same effect as if the identity matrix was passed.See also
- setNumConstraints(nc)#
Set the number of constraints.
Logically collective.
Notes
This function sets the number of constraints to
ncand marks all remaining columns as regular. Normal usage would be to callinsertConstraints()instead.If
ncis smaller than the previously set value, then some of the constraints are discarded. In particular, usingnc=0removes all constraints preserving the content of regular columns.
- 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:
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.
- 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:
otype (OrthogType | None) – The type of orthogonalization technique.
refine (OrthogRefineType | None) – The type of refinement.
block (OrthogBlockType | None) – The type of block orthogonalization.
- Return type:
Notes
The default settings work well for most problems.
The parameter
etashould be a real value between0and1(orDETERMINE). The value ofetais used only when the refinement type isIFNEEDED.When using several processes,
MGSis 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.See also
- setRandom()#
Set the active columns of the BV to random numbers.
Logically collective.
Notes
All active columns (except the leading ones) are modified.
See also
setRandomContext,setRandomColumn,setRandomNormal,BVSetRandomSource code at slepc4py/SLEPc/BV.pyx:2028
- Return type:
- setRandomColumn(j)#
Set one column of the BV to random numbers.
Logically collective.
See also
setRandomContext,setRandom,setRandomNormal,BVSetRandomColumn
- setRandomCond(condn)#
Set the columns of a BV to random numbers.
Logically collective.
The generated matrix has a prescribed condition number.
See also
setRandomContext,setRandomSign,setRandomNormal,BVSetRandomCond
- setRandomContext(rnd)#
Set the
petsc4py.PETSc.Randomobject associated with the BV.Collective.
To be used in operations that need random numbers.
See also
getRandomContext,setRandom,setRandomColumn,BVSetRandomContext
- setRandomNormal()#
Set the active columns of the BV to normal random numbers.
Logically collective.
Notes
All active columns (except the leading ones) are modified.
See also
setRandomContext,setRandom,setRandomSign,BVSetRandomNormalSource code at slepc4py/SLEPc/BV.pyx:2044
- Return type:
- 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.
See also
setRandomContext,setRandom,setRandomNormal,BVSetRandomSignSource code at slepc4py/SLEPc/BV.pyx:2060
- Return type:
- setSizes(sizes, m)#
Set the local and global sizes, and the number of columns.
Collective.
- Parameters:
sizes (LayoutSizeSpec) – The global size
Nor a two-tuple(n, N)with the local and global sizes.m (int) – The number of columns.
- Return type:
Notes
Either
norN(but not both) can beDETERMINEorNoneto have it automatically set.See also
- 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.
See also
- setType(bv_type)#
Set the type for the BV object.
Logically collective.
- setVecType(vec_type)#
Set the vector type to be used when creating vectors via
createVec().Collective.
- Parameters:
vec_type (petsc4py.PETSc.Vec.Type | str) – Vector type used when creating vectors with
createVec.- Return type:
Notes
This is not needed if the BV object is set up with
setSizesFromVec(), but may be required in the case ofsetSizes()if one wants to work with non-standard vectors.See also
createVec,getVecType,setSizes,setSizesFromVec,BVSetVecType
- 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:
See also
Attributes Documentation
- 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.