Skip to main content

A sparse vector is a 1D numerical list where most (say, more than 95% of) values will be 0 (or some other default) and for reasons of memory efficiency you don’t wish to store these. (cf. Sparse array)

This implementation has a similar interface to Python’s 1D numpy.ndarray but stores the values and indices in linked lists to preserve memory.

sparse_vector is for numerical data only, if you want any type of data, have a look at sparse_list, the parent library, a dictionary-of-keys implementation of a sparse list in python.

If you need 2D matrices, have a look at scipy.sparse, they also have a linked lists implementation, lil_matrix.

Installation

Available on the cheeseshop.

Installation is simply:

$ pip install sparse_vector

Usage

See the unit-tests!

Contributing

  1. Fork it

  2. Create your feature branch (git checkout -b my-new-feature)

  3. Commit your changes (git commit -am 'Add some feature')

  4. Ensure the tests pass for all Pythons in .travis.yml <https://github.com/johnsyweb/python_sparse_vector/blob/master/.travis.yml>__

  5. Push to the branch (git push origin my-new-feature)

  6. Create new Pull Request

Thanks

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sparse_vector-0.4.tar.gz (4.6 kB view details)

Uploaded Source

File details

Details for the file sparse_vector-0.4.tar.gz.

File metadata

  • Download URL: sparse_vector-0.4.tar.gz
  • Upload date:
  • Size: 4.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for sparse_vector-0.4.tar.gz
Algorithm Hash digest
SHA256 a9f2667f0ab3347c13acc5e51f91426b42a729107863a5923f4e9ac6fba088a2
MD5 dbb76f5a235ae6c9ad98b35ee005fa0c
BLAKE2b-256 6751944657e79f36bd4bf7e259f4649e695e6d867ae14192f939bab5519760e2

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.4 This release

1 file

0.3

1 file

0.2

1 file

0.1

1 file

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page