Python module that wraps SVDLIBC, a library for sparse Singular Value Decomposition.
Project description
sparsesvd is a Python wrapper around SVDLIBC library by Doug Rohde, which is itself based on SVDPACKC by Michael Berry.
sparsesvd uses SciPy’s sparse CSC (Compressed Sparse Column) matrix format as input to SVD. This is the same format used internally by SVDLIBC, so that no extra data copies need to be made by the Python wrapper.
Installation
You’ll need NumPy and Scipy, two Python packages for scientific computing. You need to have them installed prior to installing sparsesvd; if you don’t have them yet, you can get them from <http://www.scipy.org/Download>.
The simple way to install sparsesvd is:
sudo easy_install sparsesvd
Or, if you have instead downloaded and unzipped the source tar.gz package, you’ll need to run:
python setup.py test sudo python setup.py install
This version has been tested under Python 2.5, but should run on any 2.5 <= Python < 3.0.
Documentation
The sparsesvd module offers a single function, sparsesvd, which accepts two parameters. One is a sparse matrix in the scipy.sparse.csc_matrix format, the other is the number of requested factors (an integer).
>>> import numpy, scipy.sparse >>> from sparsesvd import sparsesvd >>> mat = numpy.random.rand(200, 100) >>> ut, s, vt = sparsesvd(scipy.sparse.csc_matrix(mat), 100) >>> assert numpy.allclose(mat, numpy.dot(ut.T, numpy.dot(numpy.diag(s), vt)))
Original wrapper by Lubos Kardos, package maintained by Radim Rehurek.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for sparsesvd-0.1.0-py2.5-macosx-10.5-i386.egg
Algorithm | Hash digest | |
---|---|---|
SHA256 | 533f9c6e7612e180d43efdec90daee7459ab221d5f852c566598537d3d1f3a9a |
|
MD5 | 851446caf0a218e14a868f6931162072 |
|
BLAKE2b-256 | c539bc8f63487c53f80612dfa966e55dec9c69e4cfcc4e757aa6b8c93eee1095 |