Skip to main content
`Ctrl`+`K`

# SVDSolve

Solves the singular value problem.

## Synopsis

    #include "slepcsvd.h"
    PetscErrorCode SVDSolve(SVD svd)

Collective

## Input Parameter

- svd - the singular value solver context

## Options Database Keys

- -svd_view - print information about the solver used

- -svd_view_mat0 - view the first matrix (\(A\))

- -svd_view_mat1 - view the second matrix (\(B\))

- -svd_view_signature - view the signature matrix (\(\Omega\))

- -svd_view_vectors - view the computed singular vectors

- -svd_view_values - view the computed singular values

- -svd_converged_reason - print reason for convergence/divergence, and number of iterations

- -svd_error_absolute - print absolute errors of each singular triplet

- -svd_error_relative - print relative errors of each singular triplet

- -svd_error_norm - print errors relative to the matrix norms of each singular triplet

## Notes

The problem matrices are specified with `SVDSetOperators()`.

`SVDSolve()` will return without generating an error regardless of whether all requested solutions were computed or not. Call `SVDGetConverged()` to get the actual number of computed solutions, and `SVDGetConvergedReason()` to determine if the solver converged or failed and why.

All the command-line options listed above admit an optional argument specifying the viewer type and options. For instance, use `-svd_view_mat0 binary:amatrix.bin` to save the \(A\) matrix to a binary file, `-svd_view_values draw` to draw the computed singular values graphically, or `-svd_error_relative :myerr.m:ascii_matlab` to save the errors in a file that can be executed in Matlab.

## See Also

SVD: Singular Value Decomposition, `SVDCreate()`, `SVDSetUp()`, `SVDDestroy()`, `SVDSetOperators()`, `SVDGetConverged()`, `SVDGetConvergedReason()`

## Level

beginner

## Location

src/svd/interface/svdsolve.c

## Examples

src/svd/tutorials/ex14.c
src/svd/tutorials/ex15.c
src/svd/tutorials/ex15f.F90
src/svd/tutorials/ex48.c
src/svd/tutorials/ex52.c
src/svd/tutorials/ex53.c
src/svd/tutorials/ex45.c
src/svd/tutorials/ex8.c
src/svd/tutorials/ex51.c

## Implementations

SVDSolve_Cross() in src/svd/impls/cross/cross.c
SVDSolve_Cyclic() in src/svd/impls/cyclic/cyclic.c
SVDSolve_Elemental() in src/svd/impls/external/elemental/svdelemen.cxx
SVDSolve_KSVD() in src/svd/impls/external/ksvd/svdksvd.c
SVDSolve_PRIMME() in src/svd/impls/external/primme/svdprimme.c
SVDSolve_ScaLAPACK() in src/svd/impls/external/scalapack/svdscalap.c
SVDSolve_Lanczos() in src/svd/impls/lanczos/gklanczos.c
SVDSolve_LAPACK() in src/svd/impls/lapack/svdlapack.c
SVDSolve_Randomized() in src/svd/impls/randomized/rsvd.c
SVDSolve_TRLanczos() in src/svd/impls/trlanczos/trlanczos.c
SVDSolve_TRLanczosGSingle() in src/svd/impls/trlanczos/trlanczos.c
SVDSolve_TRLanczosGUpper() in src/svd/impls/trlanczos/trlanczos.c
SVDSolve_TRLanczosGLower() in src/svd/impls/trlanczos/trlanczos.c

Index of all SVD routines Table of Contents for all manual pages Index of all manual pages