Singular value expansion

sparse_ir.compute(kernel, eps=np.float64(2.220446049250313e-16), n_sv=-1)

Perform truncated singular value expansion of a kernel.

Perform a truncated singular value expansion (SVE) of an integral kernel K : [xmin, xmax] x [ymin, ymax] -> R:

K(x, y) == sum(s[l] * u[l](x) * v[l](y) for l in (0, 1, 2, ...)),

where s[l] are the singular values, which are ordered in non-increasing fashion, u[l](x) are the left singular functions, which form an orthonormal system on [xmin, xmax], and v[l](y) are the right singular functions, which form an orthonormal system on [ymin, ymax].

The SVE is mapped onto the singular value decomposition (SVD) of a matrix by expanding the kernel in piecewise Legendre polynomials (by default by using a collocation).

Parameters:
  • K (kernel.AbstractKernel) – Integral kernel to take SVE from

  • eps (float) – Relative truncation threshold for the singular values, defaulting to the machine epsilon (2.2e-16)

  • n_sv (int) – Maximum basis size. If given, only at most the n_sv most significant singular values and associated singular functions are returned. Defaulting to -1, which means all singular values are returned.

Returns:

An SVEResult containing the truncated singular value expansion.

Expansion module

SVE (Singular Value Expansion) functionality for SparseIR.

This module provides Python wrappers for SVE computation and results.

class sparse_ir.sve.SVEResult(kernel: AbstractKernel, eps: float, cutoff: float = -1, n_sv: int = -1)

Result of a singular value expansion (SVE).

Contains the singular values and basis functions resulting from the SVE of an integral kernel.

sparse_ir.sve.compute(kernel, eps=np.float64(2.220446049250313e-16), n_sv=-1)

Perform truncated singular value expansion of a kernel.

Perform a truncated singular value expansion (SVE) of an integral kernel K : [xmin, xmax] x [ymin, ymax] -> R:

K(x, y) == sum(s[l] * u[l](x) * v[l](y) for l in (0, 1, 2, ...)),

where s[l] are the singular values, which are ordered in non-increasing fashion, u[l](x) are the left singular functions, which form an orthonormal system on [xmin, xmax], and v[l](y) are the right singular functions, which form an orthonormal system on [ymin, ymax].

The SVE is mapped onto the singular value decomposition (SVD) of a matrix by expanding the kernel in piecewise Legendre polynomials (by default by using a collocation).

Parameters:
  • K (kernel.AbstractKernel) – Integral kernel to take SVE from

  • eps (float) – Relative truncation threshold for the singular values, defaulting to the machine epsilon (2.2e-16)

  • n_sv (int) – Maximum basis size. If given, only at most the n_sv most significant singular values and associated singular functions are returned. Defaulting to -1, which means all singular values are returned.

Returns:

An SVEResult containing the truncated singular value expansion.

sparse_ir.sve.compute_sve(kernel, eps=np.float64(2.220446049250313e-16), n_sv=-1)

Perform truncated singular value expansion of a kernel.

Perform a truncated singular value expansion (SVE) of an integral kernel K : [xmin, xmax] x [ymin, ymax] -> R:

K(x, y) == sum(s[l] * u[l](x) * v[l](y) for l in (0, 1, 2, ...)),

where s[l] are the singular values, which are ordered in non-increasing fashion, u[l](x) are the left singular functions, which form an orthonormal system on [xmin, xmax], and v[l](y) are the right singular functions, which form an orthonormal system on [ymin, ymax].

The SVE is mapped onto the singular value decomposition (SVD) of a matrix by expanding the kernel in piecewise Legendre polynomials (by default by using a collocation).

Parameters:
  • K (kernel.AbstractKernel) – Integral kernel to take SVE from

  • eps (float) – Relative truncation threshold for the singular values, defaulting to the machine epsilon (2.2e-16)

  • n_sv (int) – Maximum basis size. If given, only at most the n_sv most significant singular values and associated singular functions are returned. Defaulting to -1, which means all singular values are returned.

Returns:

An SVEResult containing the truncated singular value expansion.

Singular value decomposition

Note

The SVD module is currently being refactored. Please refer to the SVE classes above for the current API.