{ } Raw JSON

bundles / scipy latest / scipy / linalg / _decomp_svd / diagsvd

function

scipy.linalg._decomp_svd:diagsvd

source: /scipy/linalg/_decomp_svd.py :259

Signature

def   diagsvd ( s M N )

Summary

Construct the sigma matrix in SVD from singular values and size M, N.

Extended Summary

The documentation is written assuming array arguments are of specified "core" shapes. However, array argument(s) of this function may have additional "batch" dimensions prepended to the core shape. In this case, the array is treated as a batch of lower-dimensional slices; see linalg_batch for details. Note that calls with zero-size batches are unsupported and will raise a ValueError.

Parameters

s : (M,) or (N,) array_like

Singular values

M : int

Size of the matrix whose singular values are s.

N : int

Size of the matrix whose singular values are s.

Returns

S : (M, N) ndarray

The S-matrix in the singular value decomposition

Examples

import numpy as np
from scipy.linalg import diagsvd
vals = np.array([1, 2, 3])  # The array representing the computed svd
diagsvd(vals, 3, 4)
diagsvd(vals, 4, 3)

See also

svd

Singular value decomposition of a matrix

svdvals

Compute singular values of a matrix.

Aliases

  • scipy.linalg.diagsvd