Skip to main content
`Ctrl`+`K`

# SVDSetDimensions

Sets the number of singular values to compute and the dimension of the subspace.

## Synopsis

    #include "slepcsvd.h"
    PetscErrorCode SVDSetDimensions(SVD svd,PetscInt nsv,PetscInt ncv,PetscInt mpd)

Logically Collective

## Input Parameters

- svd - the singular value solver context

- nsv - number of singular values to compute

- ncv - the maximum dimension of the subspace to be used by the solver

- mpd - the maximum dimension allowed for the projected problem

## Options Database Keys

- -svd_nsv <nsv> - sets the number of singular values

- -svd_ncv <ncv> - sets the dimension of the subspace

- -svd_mpd <mpd> - sets the maximum projected dimension

## Notes

Use `PETSC_DETERMINE` for `ncv` and `mpd` to assign a reasonably good value, which is dependent on the solution method and the number of singular values required. For any of the arguments, use `PETSC_CURRENT` to preserve the current value.

The parameters `ncv` and `mpd` are intimately related, so that the user is advised to set one of them at most. Normal usage is:

1. In cases where `nsv` is small, the user sets `ncv` (a reasonable default is `2*nsv`).

2. In cases where `nsv` is large, the user sets `mpd`.

The value of `ncv` should always be between `nsv` and `(nsv+mpd)`, typically `ncv=nsv+mpd`. If `nsv` is not too large, `mpd=nsv` is a reasonable choice, otherwise a smaller value should be used.

## See Also

SVD: Singular Value Decomposition, `SVDGetDimensions()`

## Level

intermediate

## Location

src/svd/interface/svdopts.c

## Examples

src/svd/tutorials/ex51.c
src/svd/tutorials/ex8.c

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