slepc4py.SLEPc.SVD#
- class slepc4py.SLEPc.SVD#
Bases:
ObjectSVD.
Enumerations
SVD convergence test.
SVD convergence reasons.
SVD error type to assess accuracy of computed solutions.
SVD problem type.
SVD stopping test.
SVD TRLanczos bidiagonalization choices for the GSVD case.
SVD types.
SVD desired part of spectrum.
Methods Summary
appendOptionsPrefix([prefix])Append to the prefix used for searching for all SVD options in the database.
Clear all monitors for an
SVDobject.computeError(i[, etype])Compute the error associated with the i-th singular triplet.
create([comm])Create the SVD object.
destroy()Destroy the SVD object.
errorView([etype, viewer])Display the errors associated with the computed solution.
getBV()Get the basis vectors objects associated to the SVD object.
Get the number of converged singular triplets.
Get the reason why the
solve()iteration was stopped.Get the method used to compute the error estimate used in the convergence test.
Get the eigensolver object associated to the singular value solver.
Get the flag indicating if
A^T*Ais built explicitly.Get the eigensolver object associated to the singular value solver.
Get the flag indicating if \(H(A)\) is built explicitly.
getDS()Get the direct solver associated to the singular value solver.
Get the number of singular values to compute and the dimension of the subspace.
Get the mode used to handle the transpose of the matrix associated.
Get the current iteration number.
Get if the variant of the Lanczos method to be used is one-sided or two-sided.
Get the list of monitor functions.
Get the matrices associated with the singular value problem.
Get the prefix used for searching for all SVD options in the database.
Get the problem type from the SVD object.
getSignature([omega])Get the signature matrix defining a hyperbolic singular value problem.
getSingularTriplet(i[, U, V])Get the i-th triplet of the singular value decomposition.
Get the stopping function.
Get the flag indicating if \(Z=[A;B]\) is built explicitly.
Get bidiagonalization choice used in the GSVD TRLanczos solver.
Get the linear solver object associated with the SVD solver.
Get the locking flag used in the thick-restart Lanczos method.
Get if the variant of the method to be used is one-sided or two-sided.
Get the restart parameter used in the thick-restart Lanczos method.
Get the threshold used in the threshold stopping test.
Get the tolerance and maximum iteration count.
Get the flag indicating if all residual norms must be computed or not.
getType()Get the SVD type of this object.
getValue(i)Get the i-th singular value as computed by
solve().getVectors(i, U, V)Get the i-th left and right singular vectors as computed by
solve().Get which singular triplets are to be sought.
Tell if the SVD corresponds to a generalized singular value problem.
Tell whether the SVD object corresponds to a hyperbolic singular value problem.
reset()Reset the SVD object.
setBV(V[, U])Set basis vectors objects associated to the SVD solver.
setConvergenceTest(conv)Set how to compute the error estimate used in the convergence test.
setCrossEPS(eps)Set an eigensolver object associated to the singular value solver.
setCrossExplicitMatrix([flag])Set if the eigensolver operator \(A^T A\) must be computed.
setCyclicEPS(eps)Set an eigensolver object associated to the singular value solver.
setCyclicExplicitMatrix([flag])Set if the eigensolver operator
H(A)must be computed explicitly.setDS(ds)Set a direct solver object associated to the singular value solver.
setDimensions([nsv, ncv, mpd])Set the number of singular values to compute and the dimension of the subspace.
Set SVD options from the options database.
setImplicitTranspose(mode)Set how to handle the transpose of the matrix associated.
setInitialSpace([spaceright, spaceleft])Set the initial spaces from which the SVD solver starts to iterate.
setLanczosOneSide([flag])Set if the variant of the Lanczos method to be used is one-sided or two-sided.
setMonitor(monitor[, args, kargs])Append a monitor function to the list of monitors.
setOperators(A[, B])Set the matrices associated with the singular value problem.
setOptionsPrefix([prefix])Set the prefix used for searching for all SVD options in the database.
setProblemType(problem_type)Set the type of the singular value problem.
setSignature([omega])Set the signature matrix defining a hyperbolic singular value problem.
setStoppingTest(stopping[, args, kargs])Set a function to decide when to stop the outer iteration of the eigensolver.
setTRLanczosExplicitMatrix([flag])Set if the matrix \(Z=[A;B]\) must be built explicitly.
setTRLanczosGBidiag(bidiag)Set the bidiagonalization choice to use in the GSVD TRLanczos solver.
setTRLanczosKSP(ksp)Set a linear solver object associated to the SVD solver.
setTRLanczosLocking(lock)Toggle between locking and non-locking variants of the method.
setTRLanczosOneSide([flag])Set if the variant of the method to be used is one-sided or two-sided.
setTRLanczosRestart(keep)Set the restart parameter for the thick-restart Lanczos method.
setThreshold(thres[, rel])Set the threshold used in the threshold stopping test.
setTolerances([tol, max_it])Set the tolerance and maximum iteration count used.
setTrackAll(trackall)Set flag to compute the residual of all singular triplets.
setType(svd_type)Set the particular solver to be used in the SVD object.
setUp()Set up all the necessary internal data structures.
setWhichSingularTriplets(which)Set which singular triplets are to be sought.
solve()Solve the singular value problem.
valuesView([viewer])Display the computed singular values in a viewer.
vectorsView([viewer])Output computed singular vectors to a viewer.
view([viewer])Print the SVD data structure.
Attributes Summary
The direct solver (DS) object associated.
The maximum iteration count.
The type of the eigenvalue problem.
The tolerance.
Compute the residual norm of all approximate eigenpairs.
How to handle the transpose of the matrix.
The portion of the spectrum to be sought.
Methods Documentation
- appendOptionsPrefix(prefix=None)#
Append to the prefix used for searching for all SVD options in the database.
Logically collective.
- Parameters:
prefix (str | None) – The prefix string to prepend to all SVD option requests.
- Return type:
:sources:`Source code at slepc4py/SLEPc/SVD.pyx:284 <slepc4py/SLEPc/SVD.pyx#L284>`
- cancelMonitor()#
Clear all monitors for an
SVDobject.Logically collective.
:sources:`Source code at slepc4py/SLEPc/SVD.pyx:912 <slepc4py/SLEPc/SVD.pyx#L912>`
- Return type:
- computeError(i, etype=None)#
Compute the error associated with the i-th singular triplet.
Collective.
Compute the error (based on the residual norm) associated with the i-th singular triplet.
- Parameters:
- Returns:
The relative error bound, computed in various ways from the residual norm \(\sqrt{n_1^2+n_2^2}\) where \(n_1 = \|A v - \sigma u\|_2\), \(n_2 = \|A^T u - \sigma v\|_2\), \(\sigma\) is the singular value, \(u\) and \(v\) are the left and right singular vectors.
- Return type:
Notes
The index
ishould be a value between0andnconv-1(seegetConverged()).:sources:`Source code at slepc4py/SLEPc/SVD.pyx:1091 <slepc4py/SLEPc/SVD.pyx#L1091>`
- create(comm=None)#
Create the SVD object.
Collective.
- Parameters:
comm (Comm | None) – MPI communicator; if not provided, it defaults to all processes.
- Return type:
:sources:`Source code at slepc4py/SLEPc/SVD.pyx:186 <slepc4py/SLEPc/SVD.pyx#L186>`
- destroy()#
Destroy the SVD object.
Collective.
:sources:`Source code at slepc4py/SLEPc/SVD.pyx:168 <slepc4py/SLEPc/SVD.pyx#L168>`
- Return type:
- errorView(etype=None, viewer=None)#
Display the errors associated with the computed solution.
Collective.
Display the errors and the eigenvalues.
- Parameters:
viewer (petsc4py.PETSc.Viewer | None) – Visualization context; if not provided, the standard output is used.
- Return type:
Notes
By default, this function checks the error of all eigenpairs and prints the eigenvalues if all of them are below the requested tolerance. If the viewer has format
ASCII_INFO_DETAILthen a table with eigenvalues and corresponding errors is printed.:sources:`Source code at slepc4py/SLEPc/SVD.pyx:1128 <slepc4py/SLEPc/SVD.pyx#L1128>`
- getBV()#
Get the basis vectors objects associated to the SVD object.
Not collective.
- Returns:
- Return type:
:sources:`Source code at slepc4py/SLEPc/SVD.pyx:676 <slepc4py/SLEPc/SVD.pyx#L676>`
- getConverged()#
Get the number of converged singular triplets.
Not collective.
- Returns:
Number of converged singular triplets.
- Return type:
Notes
This function should be called after
solve()has finished.:sources:`Source code at slepc4py/SLEPc/SVD.pyx:981 <slepc4py/SLEPc/SVD.pyx#L981>`
- getConvergedReason()#
Get the reason why the
solve()iteration was stopped.Not collective.
- Returns:
Negative value indicates diverged, positive value converged.
- Return type:
:sources:`Source code at slepc4py/SLEPc/SVD.pyx:966 <slepc4py/SLEPc/SVD.pyx#L966>`
- getConvergenceTest()#
Get the method used to compute the error estimate used in the convergence test.
Not collective.
- Returns:
The method used to compute the error estimate used in the convergence test.
- Return type:
:sources:`Source code at slepc4py/SLEPc/SVD.pyx:546 <slepc4py/SLEPc/SVD.pyx#L546>`
- getCrossEPS()#
Get the eigensolver object associated to the singular value solver.
Collective.
- Returns:
The eigensolver object.
- Return type:
:sources:`Source code at slepc4py/SLEPc/SVD.pyx:1202 <slepc4py/SLEPc/SVD.pyx#L1202>`
- getCrossExplicitMatrix()#
Get the flag indicating if
A^T*Ais built explicitly.Not collective.
- Returns:
True if
A^T*Ais built explicitly.- Return type:
:sources:`Source code at slepc4py/SLEPc/SVD.pyx:1232 <slepc4py/SLEPc/SVD.pyx#L1232>`
- getCyclicEPS()#
Get the eigensolver object associated to the singular value solver.
Collective.
- Returns:
The eigensolver object.
- Return type:
:sources:`Source code at slepc4py/SLEPc/SVD.pyx:1260 <slepc4py/SLEPc/SVD.pyx#L1260>`
- getCyclicExplicitMatrix()#
Get the flag indicating if \(H(A)\) is built explicitly.
Not collective.
Get the flag indicating if \(H(A) = [ 0\; A ; A^T\; 0 ]\) is built explicitly.
- Returns:
True if \(H(A)\) is built explicitly.
- Return type:
:sources:`Source code at slepc4py/SLEPc/SVD.pyx:1293 <slepc4py/SLEPc/SVD.pyx#L1293>`
- getDS()#
Get the direct solver associated to the singular value solver.
Not collective.
- Returns:
The direct solver context.
- Return type:
:sources:`Source code at slepc4py/SLEPc/SVD.pyx:713 <slepc4py/SLEPc/SVD.pyx#L713>`
- getDimensions()#
Get the number of singular values to compute and the dimension of the subspace.
Not collective.
- Returns:
- Return type:
:sources:`Source code at slepc4py/SLEPc/SVD.pyx:609 <slepc4py/SLEPc/SVD.pyx#L609>`
- getImplicitTranspose()#
Get the mode used to handle the transpose of the matrix associated.
Not collective.
Get the mode used to handle the transpose of the matrix associated with the singular value problem.
- Returns:
How to handle the transpose (implicitly or not).
- Return type:
:sources:`Source code at slepc4py/SLEPc/SVD.pyx:379 <slepc4py/SLEPc/SVD.pyx#L379>`
- getIterationNumber()#
Get the current iteration number.
Not collective.
If the call to
solve()is complete, then it returns the number of iterations carried out by the solution method.- Returns:
Iteration number.
- Return type:
:sources:`Source code at slepc4py/SLEPc/SVD.pyx:948 <slepc4py/SLEPc/SVD.pyx#L948>`
- getLanczosOneSide()#
Get if the variant of the Lanczos method to be used is one-sided or two-sided.
Not collective.
- Returns:
True if the method is one-sided.
- Return type:
:sources:`Source code at slepc4py/SLEPc/SVD.pyx:1333 <slepc4py/SLEPc/SVD.pyx#L1333>`
- getMonitor()#
Get the list of monitor functions.
:sources:`Source code at slepc4py/SLEPc/SVD.pyx:908 <slepc4py/SLEPc/SVD.pyx#L908>`
- Return type:
- getOperators()#
Get the matrices associated with the singular value problem.
Collective.
- Returns:
A (
petsc4py.PETSc.Mat) – The matrix associated with the singular value problem.B (
petsc4py.PETSc.Mat) – The second matrix in the case of GSVD.
- Return type:
tuple[petsc4py.PETSc.Mat, petsc4py.PETSc.Mat] | tuple[petsc4py.PETSc.Mat, None]
:sources:`Source code at slepc4py/SLEPc/SVD.pyx:742 <slepc4py/SLEPc/SVD.pyx#L742>`
- getOptionsPrefix()#
Get the prefix used for searching for all SVD options in the database.
Not collective.
- Returns:
The prefix string set for this SVD object.
- Return type:
:sources:`Source code at slepc4py/SLEPc/SVD.pyx:242 <slepc4py/SLEPc/SVD.pyx#L242>`
- getProblemType()#
Get the problem type from the SVD object.
Not collective.
- Returns:
The problem type that was previously set.
- Return type:
:sources:`Source code at slepc4py/SLEPc/SVD.pyx:315 <slepc4py/SLEPc/SVD.pyx#L315>`
- getSignature(omega=None)#
Get the signature matrix defining a hyperbolic singular value problem.
Collective.
- Parameters:
omega (petsc4py.PETSc.Vec | None) – Optional vector to store the diagonal elements of the signature matrix.
- Returns:
A vector containing the diagonal elements of the signature matrix.
- Return type:
:sources:`Source code at slepc4py/SLEPc/SVD.pyx:782 <slepc4py/SLEPc/SVD.pyx#L782>`
- getSingularTriplet(i, U=None, V=None)#
Get the i-th triplet of the singular value decomposition.
Collective.
Get the i-th triplet of the singular value decomposition as computed by
solve(). The solution consists of the singular value and its left and right singular vectors.- Parameters:
- Returns:
The computed singular value.
- Return type:
Notes
The index
ishould be a value between0andnconv-1(seegetConverged(). Singular triplets are indexed according to the ordering criterion established withsetWhichSingularTriplets().:sources:`Source code at slepc4py/SLEPc/SVD.pyx:1052 <slepc4py/SLEPc/SVD.pyx#L1052>`
- getStoppingTest()#
Get the stopping function.
Not collective.
:sources:`Source code at slepc4py/SLEPc/SVD.pyx:877 <slepc4py/SLEPc/SVD.pyx#L877>`
- Return type:
- getTRLanczosExplicitMatrix()#
Get the flag indicating if \(Z=[A;B]\) is built explicitly.
Not collective.
- Returns:
True if \(Z=[A;B]\) is built explicitly.
- Return type:
:sources:`Source code at slepc4py/SLEPc/SVD.pyx:1538 <slepc4py/SLEPc/SVD.pyx#L1538>`
- getTRLanczosGBidiag()#
Get bidiagonalization choice used in the GSVD TRLanczos solver.
Not collective.
- Returns:
The bidiagonalization choice.
- Return type:
:sources:`Source code at slepc4py/SLEPc/SVD.pyx:1404 <slepc4py/SLEPc/SVD.pyx#L1404>`
- getTRLanczosKSP()#
Get the linear solver object associated with the SVD solver.
Collective.
- Returns:
The linear solver object.
- Return type:
:sources:`Source code at slepc4py/SLEPc/SVD.pyx:1508 <slepc4py/SLEPc/SVD.pyx#L1508>`
- getTRLanczosLocking()#
Get the locking flag used in the thick-restart Lanczos method.
Not collective.
- Returns:
The locking flag.
- Return type:
:sources:`Source code at slepc4py/SLEPc/SVD.pyx:1480 <slepc4py/SLEPc/SVD.pyx#L1480>`
- getTRLanczosOneSide()#
Get if the variant of the method to be used is one-sided or two-sided.
Not collective.
Get if the variant of the thick-restart Lanczos method to be used is one-sided or two-sided.
- Returns:
True if the method is one-sided.
- Return type:
:sources:`Source code at slepc4py/SLEPc/SVD.pyx:1372 <slepc4py/SLEPc/SVD.pyx#L1372>`
- getTRLanczosRestart()#
Get the restart parameter used in the thick-restart Lanczos method.
Not collective.
- Returns:
The number of vectors to be kept at restart.
- Return type:
:sources:`Source code at slepc4py/SLEPc/SVD.pyx:1441 <slepc4py/SLEPc/SVD.pyx#L1441>`
- getThreshold()#
Get the threshold used in the threshold stopping test.
Not collective.
- Returns:
- Return type:
:sources:`Source code at slepc4py/SLEPc/SVD.pyx:451 <slepc4py/SLEPc/SVD.pyx#L451>`
- getTolerances()#
Get the tolerance and maximum iteration count.
Not collective.
Get the tolerance and maximum iteration count used by the default SVD convergence tests.
- Returns:
- Return type:
:sources:`Source code at slepc4py/SLEPc/SVD.pyx:498 <slepc4py/SLEPc/SVD.pyx#L498>`
- getTrackAll()#
Get the flag indicating if all residual norms must be computed or not.
Not collective.
- Returns:
Whether the solver compute all residuals or not.
- Return type:
:sources:`Source code at slepc4py/SLEPc/SVD.pyx:577 <slepc4py/SLEPc/SVD.pyx#L577>`
- getType()#
Get the SVD type of this object.
Not collective.
- Returns:
The solver currently being used.
- Return type:
:sources:`Source code at slepc4py/SLEPc/SVD.pyx:227 <slepc4py/SLEPc/SVD.pyx#L227>`
- getValue(i)#
Get the i-th singular value as computed by
solve().Collective.
- Parameters:
i (int) – Index of the solution to be obtained.
- Returns:
The computed singular value.
- Return type:
Notes
The index
ishould be a value between0andnconv-1(seegetConverged(). Singular triplets are indexed according to the ordering criterion established withsetWhichSingularTriplets().:sources:`Source code at slepc4py/SLEPc/SVD.pyx:1000 <slepc4py/SLEPc/SVD.pyx#L1000>`
- getVectors(i, U, V)#
Get the i-th left and right singular vectors as computed by
solve().Collective.
- Parameters:
- Return type:
Notes
The index
ishould be a value between0andnconv-1(seegetConverged(). Singular triplets are indexed according to the ordering criterion established withsetWhichSingularTriplets().:sources:`Source code at slepc4py/SLEPc/SVD.pyx:1027 <slepc4py/SLEPc/SVD.pyx#L1027>`
- getWhichSingularTriplets()#
Get which singular triplets are to be sought.
Not collective.
- Returns:
The singular values to be sought (either largest or smallest).
- Return type:
:sources:`Source code at slepc4py/SLEPc/SVD.pyx:422 <slepc4py/SLEPc/SVD.pyx#L422>`
- isGeneralized()#
Tell if the SVD corresponds to a generalized singular value problem.
Not collective.
Tell whether the SVD object corresponds to a generalized singular value problem.
- Returns:
True if two matrices were set with
setOperators().- Return type:
:sources:`Source code at slepc4py/SLEPc/SVD.pyx:344 <slepc4py/SLEPc/SVD.pyx#L344>`
- isHyperbolic()#
Tell whether the SVD object corresponds to a hyperbolic singular value problem.
Not collective.
- Returns:
True if the problem was specified as hyperbolic.
- Return type:
:sources:`Source code at slepc4py/SLEPc/SVD.pyx:362 <slepc4py/SLEPc/SVD.pyx#L362>`
- reset()#
Reset the SVD object.
Collective.
:sources:`Source code at slepc4py/SLEPc/SVD.pyx:178 <slepc4py/SLEPc/SVD.pyx#L178>`
- Return type:
- setBV(V, U=None)#
Set basis vectors objects associated to the SVD solver.
Collective.
- Parameters:
- Return type:
:sources:`Source code at slepc4py/SLEPc/SVD.pyx:696 <slepc4py/SLEPc/SVD.pyx#L696>`
- setConvergenceTest(conv)#
Set how to compute the error estimate used in the convergence test.
Logically collective.
- Parameters:
conv (Conv) – The method used to compute the error estimate used in the convergence test.
- Return type:
:sources:`Source code at slepc4py/SLEPc/SVD.pyx:562 <slepc4py/SLEPc/SVD.pyx#L562>`
- setCrossEPS(eps)#
Set an eigensolver object associated to the singular value solver.
Collective.
:sources:`Source code at slepc4py/SLEPc/SVD.pyx:1189 <slepc4py/SLEPc/SVD.pyx#L1189>`
- setCrossExplicitMatrix(flag=True)#
Set if the eigensolver operator \(A^T A\) must be computed.
Logically collective.
:sources:`Source code at slepc4py/SLEPc/SVD.pyx:1218 <slepc4py/SLEPc/SVD.pyx#L1218>`
- setCyclicEPS(eps)#
Set an eigensolver object associated to the singular value solver.
Collective.
:sources:`Source code at slepc4py/SLEPc/SVD.pyx:1247 <slepc4py/SLEPc/SVD.pyx#L1247>`
- setCyclicExplicitMatrix(flag=True)#
Set if the eigensolver operator
H(A)must be computed explicitly.Logically collective.
Set if the eigensolver operator \(H(A) = [ 0\; A ; A^T\; 0 ]\) must be computed explicitly.
:sources:`Source code at slepc4py/SLEPc/SVD.pyx:1276 <slepc4py/SLEPc/SVD.pyx#L1276>`
- setDS(ds)#
Set a direct solver object associated to the singular value solver.
Collective.
:sources:`Source code at slepc4py/SLEPc/SVD.pyx:729 <slepc4py/SLEPc/SVD.pyx#L729>`
- setDimensions(nsv=None, ncv=None, mpd=None)#
Set the number of singular values to compute and the dimension of the subspace.
Logically collective.
- Parameters:
- Return type:
Notes
Use
DECIDEforncvandmpdto assign a reasonably good value, which is dependent on the solution method.The parameters
ncvandmpdare intimately related, so that the user is advised to set one of them at most. Normal usage is the following:In cases where
nsvis small, the user setsncv(a reasonable default is 2 *nsv).In cases where
nsvis large, the user setsmpd.
The value of
ncvshould always be betweennsvand (nsv+mpd), typicallyncv=nsv+mpd. Ifnsvis not too large,mpd=nsvis a reasonable choice, otherwise a smaller value should be used.:sources:`Source code at slepc4py/SLEPc/SVD.pyx:630 <slepc4py/SLEPc/SVD.pyx#L630>`
- setFromOptions()#
Set SVD options from the options database.
Collective.
This routine must be called before
setUp()if the user is to be allowed to set the solver type.Notes
To see all options, run your program with the
-helpoption.:sources:`Source code at slepc4py/SLEPc/SVD.pyx:299 <slepc4py/SLEPc/SVD.pyx#L299>`
- Return type:
- setImplicitTranspose(mode)#
Set how to handle the transpose of the matrix associated.
Logically collective.
Set how to handle the transpose of the matrix associated with the singular value problem.
Notes
By default, the transpose of the matrix is explicitly built (if the matrix has defined the MatTranspose operation).
If this flag is set to true, the solver does not build the transpose, but handles it implicitly via MatMultTranspose().
:sources:`Source code at slepc4py/SLEPc/SVD.pyx:397 <slepc4py/SLEPc/SVD.pyx#L397>`
- setInitialSpace(spaceright=None, spaceleft=None)#
Set the initial spaces from which the SVD solver starts to iterate.
Collective.
- Parameters:
- Return type:
:sources:`Source code at slepc4py/SLEPc/SVD.pyx:823 <slepc4py/SLEPc/SVD.pyx#L823>`
- setLanczosOneSide(flag=True)#
Set if the variant of the Lanczos method to be used is one-sided or two-sided.
Logically collective.
Notes
By default, a two-sided variant is selected, which is sometimes slightly more robust. However, the one-sided variant is faster because it avoids the orthogonalization associated to left singular vectors. It also saves the memory required for storing such vectors.
:sources:`Source code at slepc4py/SLEPc/SVD.pyx:1311 <slepc4py/SLEPc/SVD.pyx#L1311>`
- setMonitor(monitor, args=None, kargs=None)#
Append a monitor function to the list of monitors.
Logically collective.
:sources:`Source code at slepc4py/SLEPc/SVD.pyx:887 <slepc4py/SLEPc/SVD.pyx#L887>`
- setOperators(A, B=None)#
Set the matrices associated with the singular value problem.
Collective.
- Parameters:
- Return type:
:sources:`Source code at slepc4py/SLEPc/SVD.pyx:765 <slepc4py/SLEPc/SVD.pyx#L765>`
- setOptionsPrefix(prefix=None)#
Set the prefix used for searching for all SVD options in the database.
Logically collective.
- Parameters:
prefix (str | None) – The prefix string to prepend to all SVD 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.
For example, to distinguish between the runtime options for two different SVD contexts, one could call:
S1.setOptionsPrefix("svd1_") S2.setOptionsPrefix("svd2_")
:sources:`Source code at slepc4py/SLEPc/SVD.pyx:257 <slepc4py/SLEPc/SVD.pyx#L257>`
- setProblemType(problem_type)#
Set the type of the singular value problem.
Logically collective.
- Parameters:
problem_type (ProblemType) – The problem type to be set.
- Return type:
:sources:`Source code at slepc4py/SLEPc/SVD.pyx:330 <slepc4py/SLEPc/SVD.pyx#L330>`
- setSignature(omega=None)#
Set the signature matrix defining a hyperbolic singular value problem.
Collective.
- Parameters:
omega (Vec | None) – A vector containing the diagonal elements of the signature matrix.
- Return type:
:sources:`Source code at slepc4py/SLEPc/SVD.pyx:807 <slepc4py/SLEPc/SVD.pyx#L807>`
- setStoppingTest(stopping, args=None, kargs=None)#
Set a function to decide when to stop the outer iteration of the eigensolver.
Logically collective.
:sources:`Source code at slepc4py/SLEPc/SVD.pyx:857 <slepc4py/SLEPc/SVD.pyx#L857>`
- setTRLanczosExplicitMatrix(flag=True)#
Set if the matrix \(Z=[A;B]\) must be built explicitly.
Logically collective.
:sources:`Source code at slepc4py/SLEPc/SVD.pyx:1524 <slepc4py/SLEPc/SVD.pyx#L1524>`
- setTRLanczosGBidiag(bidiag)#
Set the bidiagonalization choice to use in the GSVD TRLanczos solver.
Logically collective.
- Parameters:
bidiag (TRLanczosGBidiag) – The bidiagonalization choice.
- Return type:
:sources:`Source code at slepc4py/SLEPc/SVD.pyx:1390 <slepc4py/SLEPc/SVD.pyx#L1390>`
- setTRLanczosKSP(ksp)#
Set a linear solver object associated to the SVD solver.
Collective.
- Parameters:
ksp (petsc4py.PETSc.KSP) – The linear solver object.
- Return type:
:sources:`Source code at slepc4py/SLEPc/SVD.pyx:1495 <slepc4py/SLEPc/SVD.pyx#L1495>`
- setTRLanczosLocking(lock)#
Toggle between locking and non-locking variants of the method.
Logically collective.
Toggle between locking and non-locking variants of the thick-restart Lanczos method.
Notes
The default is to lock converged singular triplets when the method restarts. This behaviour can be changed so that all directions are kept in the working subspace even if already converged to working accuracy (the non-locking variant).
:sources:`Source code at slepc4py/SLEPc/SVD.pyx:1456 <slepc4py/SLEPc/SVD.pyx#L1456>`
- setTRLanczosOneSide(flag=True)#
Set if the variant of the method to be used is one-sided or two-sided.
Logically collective.
Set if the variant of the thick-restart Lanczos method to be used is one-sided or two-sided.
Notes
By default, a two-sided variant is selected, which is sometimes slightly more robust. However, the one-sided variant is faster because it avoids the orthogonalization associated to left singular vectors.
:sources:`Source code at slepc4py/SLEPc/SVD.pyx:1348 <slepc4py/SLEPc/SVD.pyx#L1348>`
- setTRLanczosRestart(keep)#
Set the restart parameter for the thick-restart Lanczos method.
Logically collective.
Set the restart parameter for the thick-restart Lanczos method, in particular the proportion of basis vectors that must be kept after restart.
Notes
Allowed values are in the range [0.1,0.9]. The default is 0.5.
:sources:`Source code at slepc4py/SLEPc/SVD.pyx:1419 <slepc4py/SLEPc/SVD.pyx#L1419>`
- setThreshold(thres, rel=False)#
Set the threshold used in the threshold stopping test.
Logically collective.
- Parameters:
- Return type:
Notes
This function internally sets a special stopping test based on the threshold, where singular values are computed in sequence until one of the computed singular values is below/above the threshold (depending on whether largest or smallest singular values are computed).
In the case of largest singular values, the threshold can be made relative with respect to the largest singular value (i.e., the matrix norm).
:sources:`Source code at slepc4py/SLEPc/SVD.pyx:469 <slepc4py/SLEPc/SVD.pyx#L469>`
- setTolerances(tol=None, max_it=None)#
Set the tolerance and maximum iteration count used.
Logically collective.
Set the tolerance and maximum iteration count used by the default SVD convergence tests.
- Parameters:
- Return type:
Notes
Use
DECIDEformax_itto assign a reasonably good value, which is dependent on the solution method.:sources:`Source code at slepc4py/SLEPc/SVD.pyx:519 <slepc4py/SLEPc/SVD.pyx#L519>`
- setTrackAll(trackall)#
Set flag to compute the residual of all singular triplets.
Logically collective.
Set if the solver must compute the residual of all approximate singular triplets or not.
:sources:`Source code at slepc4py/SLEPc/SVD.pyx:592 <slepc4py/SLEPc/SVD.pyx#L592>`
- setType(svd_type)#
Set the particular solver to be used in the SVD object.
Logically collective.
Notes
See
SVD.Typefor available methods. The default is CROSS. Normally, it is best to usesetFromOptions()and then set the SVD type from the options database rather than by using this routine. Using the options database provides the user with maximum flexibility in evaluating the different available methods.:sources:`Source code at slepc4py/SLEPc/SVD.pyx:203 <slepc4py/SLEPc/SVD.pyx#L203>`
- setUp()#
Set up all the necessary internal data structures.
Collective.
Set up all the internal data structures necessary for the execution of the singular value solver.
Notes
This function need not be called explicitly in most cases, since
solve()calls it. It can be useful when one wants to measure the set-up time separately from the solve time.:sources:`Source code at slepc4py/SLEPc/SVD.pyx:923 <slepc4py/SLEPc/SVD.pyx#L923>`
- Return type:
- setWhichSingularTriplets(which)#
Set which singular triplets are to be sought.
Logically collective.
- Parameters:
which (Which) – The singular values to be sought (either largest or smallest).
- Return type:
:sources:`Source code at slepc4py/SLEPc/SVD.pyx:437 <slepc4py/SLEPc/SVD.pyx#L437>`
- solve()#
Solve the singular value problem.
Collective.
:sources:`Source code at slepc4py/SLEPc/SVD.pyx:940 <slepc4py/SLEPc/SVD.pyx#L940>`
- Return type:
- valuesView(viewer=None)#
Display the computed singular values in a viewer.
Collective.
- Parameters:
viewer (Viewer | None) – Visualization context; if not provided, the standard output is used.
- Return type:
:sources:`Source code at slepc4py/SLEPc/SVD.pyx:1157 <slepc4py/SLEPc/SVD.pyx#L1157>`
- vectorsView(viewer=None)#
Output computed singular vectors to a viewer.
Collective.
- Parameters:
viewer (Viewer | None) – Visualization context; if not provided, the standard output is used.
- Return type:
:sources:`Source code at slepc4py/SLEPc/SVD.pyx:1172 <slepc4py/SLEPc/SVD.pyx#L1172>`
- view(viewer=None)#
Print the SVD data structure.
Collective.
- Parameters:
viewer (Viewer | None) – Visualization context; if not provided, the standard output is used.
- Return type:
:sources:`Source code at slepc4py/SLEPc/SVD.pyx:153 <slepc4py/SLEPc/SVD.pyx#L153>`
Attributes Documentation
- ds#
The direct solver (DS) object associated.
:sources:`Source code at slepc4py/SLEPc/SVD.pyx:1599 <slepc4py/SLEPc/SVD.pyx#L1599>`
- max_it#
The maximum iteration count.
:sources:`Source code at slepc4py/SLEPc/SVD.pyx:1585 <slepc4py/SLEPc/SVD.pyx#L1585>`
- problem_type#
The type of the eigenvalue problem.
:sources:`Source code at slepc4py/SLEPc/SVD.pyx:1557 <slepc4py/SLEPc/SVD.pyx#L1557>`
- tol#
The tolerance.
:sources:`Source code at slepc4py/SLEPc/SVD.pyx:1578 <slepc4py/SLEPc/SVD.pyx#L1578>`
- track_all#
Compute the residual norm of all approximate eigenpairs.
:sources:`Source code at slepc4py/SLEPc/SVD.pyx:1592 <slepc4py/SLEPc/SVD.pyx#L1592>`
- transpose_mode#
How to handle the transpose of the matrix.
:sources:`Source code at slepc4py/SLEPc/SVD.pyx:1564 <slepc4py/SLEPc/SVD.pyx#L1564>`
- which#
The portion of the spectrum to be sought.
:sources:`Source code at slepc4py/SLEPc/SVD.pyx:1571 <slepc4py/SLEPc/SVD.pyx#L1571>`