Metadata-Version: 2.2
Name: gdsvd
Version: 0.1.2
Summary: A package for computing SVD via gradient descent
Home-page: https://github.com/matrix-completion/gdsvd
Author: Emily Gan
Author-email: Emily Gan <emilygan@mit.edu>
License: MIT
Project-URL: Homepage, https://github.com/matrix-completion/gdsvd
Project-URL: Issues, https://github.com/matrix-completion/gdsvd/issues
Classifier: Programming Language :: Python :: 3
Classifier: Operating System :: OS Independent
Requires-Python: >=3.6
Description-Content-Type: text/markdown
Requires-Dist: numpy
Requires-Dist: scipy
Requires-Dist: pandas
Dynamic: author
Dynamic: home-page
Dynamic: requires-python

GDSVD is a package for computing SVD via gradient descent.
--

Example usage:

1. Import:
    ```
    from gdsvd import gd_svd
    ```

2. Memmap input data, recommended for large datasets
    ```
    U_true = np.memmap("datasets/ranklogn-exp-500_U.bin", dtype=np.float64, mode='r', shape=(500, 6))
    S_true = np.memmap("datasets/ranklogn-exp-500_S.bin", dtype=np.float64, mode='r', shape=(6,))
    Vt_true = np.memmap("datasets/ranklogn-exp-500_Vt.bin", dtype=np.float64, mode='r', shape=(6, 500))
    M = np.memmap("datasets/ranklogn-exp-500_M.bin", dtype=np.float64, mode='r', shape=(500, 500))
    ```
3.  Ensure that the arrays are contiguous
    ```
    U_true = np.ascontiguousarray(U_true)
    S_true = np.ascontiguousarray(S_true)
    Vt_true = np.ascontiguousarray(Vt_true)
    M = np.ascontiguousarray(M)
    ```
4. To run the method normally:
    ```
    U,S,Vt = gd_svd(M)
    ```
5. To run the method with convergence tracking written to conv_out.txt:
   ```
    U,S,Vt = gd_svd(M, record_conv = 'conv_out.txt', U_true = U_true, S_true = S_true, Vt_true = Vt_true)
    ```

---
`gdsvd` is implemented as Algorithm 4 in the reference paper. 

Included in the package are `gdsvd3` (Algorithm 3) and `power-method` (Algorithm 5), which is the GD method with alternate stopping and the power method, respectively.


Reference:
[k-SVD via gradient descent](https://arxiv.org/abs/2502.00320)
