Skip to content

linalg⚓︎

Linear algebra.

mldiv(A, b) ⚓︎

A\b.

mrdiv(b, A) ⚓︎

b/A.

pad0(x, N) ⚓︎

Pad x with zeros so that len(x)==N.

svd0(A) ⚓︎

Similar to Matlab's svd(A,0).

Compute the

  • full svd if nrows > ncols
  • reduced svd otherwise.

As in Matlab: svd(A,0), except that the input and output are transposed, in keeping with DAPPER convention. It contrasts with scipy.linalg.svd(full_matrice=False) and Matlab's svd(A,'econ'), both of which always compute the reduced svd.

See Also

tsvd : rank (and threshold) truncation.

svdi(U, s, VT) ⚓︎

Reconstruct matrix from sla.svd or tsvd.

Examples:

>>> A = np.arange(12).reshape((3,-1))
>>> B = svdi(*tsvd(A, 1.0))
>>> np.allclose(A, B)
True
See Also

sla.diagsvd

tinv(A, *kargs, **kwargs) ⚓︎

Psuedo-inverse using tsvd.

See Also

sla.pinv2.

trank(A, *kargs, **kwargs) ⚓︎

Compute rank via tsvd, i.e. as "seen" by tsvd.

truncate_rank(s, threshold, avoid_pathological) ⚓︎

Find r such that s[:r] contains the threshold proportion of s.

tsvd(A, threshold=0.99999, avoid_pathological=True) ⚓︎

Compute the truncated svd.

Also automates 'full_matrices' flag.

Parameters:

Name Type Description Default
avoid_pathological bool

Avoid truncating (e.g.) the identity matrix. NB: only applies for float threshold.

True
threshold float or int
  • if float, < 1.0 then "rank" = lowest number such that the "energy" retained >= threshold
  • if int, >= 1 then "rank" = threshold
0.99999