SVDMethod#

class cuquantum.tensornet.tensor.SVDMethod(
max_extent: int | None = None,
abs_cutoff: float | None = 0.0,
rel_cutoff: float | None = 0.0,
discarded_weight_cutoff: float | None = 0.0,
partition: str | None = None,
normalization: str | None = None,
algorithm: str | None = 'gesvd',
gesvdj_tol: float | None = 0,
gesvdj_max_sweeps: int | None = 0,
gesvdr_oversampling: int | None = 0,
gesvdr_niters: int | None = 0,
)[source]#

A data class for providing SVD options to the cuquantum.cutensornet.tensor.decompose() function.

max_extent#

Keep no more than the largest max_extent singular values in the output operands (the rest will be truncated).

Type:

int | None

abs_cutoff#

Singular values below this value will be trimmed in the output operands.

Type:

float | None

rel_cutoff#

Singular values below the product of this value and the largest singular value will be trimmed in the output operands.

Type:

float | None

discarded_weight_cutoff#

Singular values with discarded weight (square sum dividied by total square sum) below this value will be trimmed.

Type:

float | None

partition#

Singular values S will be explictly returned by default (partition=None). Alternatively, singular values may be factorized onto output tensor U (partition="U"), output tensor V (partition="V") or equally onto output tensor U and output tensor V (partition="UV"). When any of these three partition schemes is selected, the returned S operand from cuquantum.cutensornet.tensor.decompose() and cuquantum.cutensornet.experimental.contract_decompose() will be None.

Type:

str | None

normalization#

The specified norm of the singular values (after truncation) will be normalized to 1. Currently supports None, "L1", "L2" and "LInf".

Type:

str | None

algorithm#

The SVD algorithm to use. Currently supports "gesvd" (default), "gesvdj", "gesvdp" and "gesvdr".

Type:

str | None

gesvdj_tol#

The tolerance to use when algorithm is set to "gesvdj". Default 0 denotes machine precision.

Type:

float | None

gesvdj_max_sweeps#

The maximal number of sweeps when algorithm is set to "gesvdj". Default 0 denotes 100.

Type:

int | None

gesvdr_oversampling#

The size of oversampling when algorithm is set to "gesvdr". Default 0 denotes the lower of 4 times max_extent and the difference between full rank and max_extent.

Type:

int | None

gesvdr_niters#

The number of iteration of power method when algorithm is set to "gesvdr" and the default (0) is 10.

Type:

int | None

Note

If multiple truncation paramters are set, e.g, max_extent and discarded_weight_cutoff, the truncated extent will be determined as the lowest among all.

Note

For detailed explanation on the different SVD algorithms and the corresponding parameters, please refer to cuSolver documentation page

Note

For truncated SVD, currently at least one singular value will be retained in the output even if the truncation parameters are set to trim out all singular values. This behavior may be subject to change in a future release.