Skip to content

whistlebee/bksvd-py

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 

Repository files navigation

Block Krylov Singular Value Decomposition (NumPy)

Python implementation of https://github.com/cpmusco/bksvd.

Example

import numpy as np

# Generate some low rank matrix
v = np.random.random(500)
a = v.reshape(-1, 1) @ v.reshape(1, -1)

# Note unlike MATLAB this returns V transpose
# to be more consistent with np.linalg.svd
u, s, vt = bksvd(a, 20)

# Check quality
assert np.allclose(a, u @ np.diag(s) @ vt)
print(np.linalg.norm(a - u @ np.diag(s) @ vt) / np.linalg.norm(a))

About

Block Krylov SVD implementation for NumPy

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages