{ "info": { "author": "Aric Coady", "author_email": "aric.coady@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", "Intended Audience :: Science/Research", "License :: OSI Approved :: Apache Software License", "Operating System :: OS Independent", "Programming Language :: Cython", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "[![image](https://img.shields.io/pypi/v/spector.svg)](https://pypi.org/project/spector/)\n[![image](https://img.shields.io/pypi/pyversions/spector.svg)](https://python3statement.org)\n[![image](https://pepy.tech/badge/spector)](https://pepy.tech/project/spector)\n![image](https://img.shields.io/pypi/status/spector.svg)\n[![image](https://img.shields.io/travis/coady/spector.svg)](https://travis-ci.org/coady/spector)\n[![image](https://img.shields.io/codecov/c/github/coady/spector.svg)](https://codecov.io/github/coady/spector)\n[![image](https://readthedocs.org/projects/spector/badge)](https://spector.readthedocs.io)\n[![image](https://requires.io/github/coady/spector/requirements.svg)](https://requires.io/github/coady/spector/requirements/)\n[![image](https://api.codeclimate.com/v1/badges/6ffbd68facb9ef4acfef/maintainability)](https://codeclimate.com/github/coady/spector/maintainability)\n[![image](https://img.shields.io/badge/code%20style-black-000000.svg)](https://pypi.org/project/black/)\n\nSparse vectors optimized for memory and [NumPy](http://www.numpy.org) integrations.\n\n`numpy` handles densely populated n-dimemsional arrays.\n`scipy.sparse` handles sparsely populated 2-dimensional arrays, i.e., matrices.\nWhat's missing from the ecosystem is sparsely populated 1-dimensional arrays, i.e., vectors.\n\nNumPy | Python | Spector\n----- | ------ | -------\n1-dim bool `numpy.array` | `set` | `spector.indices`\n1-dim float `numpy.array` | `dict` | `spector.vector`\n`scipy.sparse.dok_matrix` | `dict` | `spector.matrix`\n\nIndices and vectors are implemented in [Cython](https://cython.org) as hash sets and maps.\nAll native operations are optimized and release the [GIL](https://docs.python.org/3/glossary.html#term-global-interpreter-lock).\n* conversion between sparse `numpy` arrays\n* conversion between dense `numpy` arrays\n* binary set operations\n* binary math operations\n* `map`, `filter`, and `reduce` operations with `numpy` universal functions\n\n# Usage\n## indices\nA sparse boolean array with a set interface.\n\n```python\n>>> from spector import indices\n>>> ind = indices([0, 2])\n>>> ind\nindices([2 0])\n>>> 1 in ind\nFalse\n>>> ind.add(1)\nTrue\n>>> ind.todense()\narray([ True, True, True])\n>>> ind.fromdense(_)\nindices([2 1 0])\n```\n\n## vector\nA sparse float array with a mapping interface.\n\n```python\n>>> from spector import vector\n>>> vec = vector({0: 1.0, 2: 2.0, 4: 1.0})\n>>> vec\nvector([4 2 0], [1. 2. 1.])\n>>> vec[2] += 1.0\n>>> vec[2]\n3.0\n>>> vec.todense()\narray([1., 0., 3., 0., 1.])\n>>> vector.fromdense(_)\nvector([4 2 0], [1. 3. 1.])\n>>> vec.sum()\n5.0\n>>> vec + vec\nvector([0 2 4], [2. 6. 2.])\n```\n\nVectors support math operations with scalars, and with vectors if the set method is unambiguous.\n\nvector operation | set method | ufunc\n---------------- | ---------- | -----\n`+` | union | add\n`*` | intersection | multiply\n`-` | | subtract\n`/` | | true_divide\n`**` | | power\n`__or__` | union | max\n`&` | intersection | min\n`^` | symmetric_difference |\n`difference` | difference |\n\n## matrix\nA mapping of keys to vectors.\n\n```python\n>>> from spector import matrix\n>>> mat = matrix({0: {1: 2.0}})\n>>> mat\nmatrix(, {0: vector([1], [2.])})\n>>> mat.row, mat.col, mat.data\n(array([0]), array([1]), array([2.]))\n```\n\n# Installation\n\n $ pip install spector\n\n# Tests\n100% branch coverage.\n\n $ pytest [--cov]\n\n# Changes\n0.2\n* Numerous optimizations\n* Intersection count\n* Increased parallelism", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/coady/spector", "keywords": "sparse array vector matrix numpy scipy", "license": "Apache Software License", "maintainer": "", "maintainer_email": "", "name": "spector", "package_url": "https://pypi.org/project/spector/", "platform": "", "project_url": "https://pypi.org/project/spector/", "project_urls": { "Documentation": "https://spector.readthedocs.io", "Homepage": "https://github.com/coady/spector" }, "release_url": "https://pypi.org/project/spector/0.2/", "requires_dist": null, "requires_python": ">=2.7", "summary": "Sparse vectors.", "version": "0.2" }, "last_serial": 5559467, "releases": { "0.0": [ { "comment_text": "", "digests": { "md5": "b0aec70a91646d4ff6c6d48fc14ff032", "sha256": "54a52c14100f5b47e32a9ffb231afe42ccd963afbee865707502ca32adf5c4cc" }, "downloads": -1, "filename": "spector-0.0.tar.gz", "has_sig": false, "md5_digest": "b0aec70a91646d4ff6c6d48fc14ff032", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 870, "upload_time": "2018-07-04T23:03:35", "url": "https://files.pythonhosted.org/packages/f8/c5/b94b5953bddb17d623d989fccd7b1fcb6f8a1f2f5ae16011f92ea716538e/spector-0.0.tar.gz" } ], "0.1": [ { "comment_text": "", "digests": { "md5": "fdb8460fcba53f731e69d0330c97c450", "sha256": "43e06f5ec7a6b295d3936d005be356eceea345e7561c8454be5851efe014fa2a" }, "downloads": -1, "filename": "spector-0.1-cp35-cp35m-manylinux1_x86_64.whl", "has_sig": false, "md5_digest": "fdb8460fcba53f731e69d0330c97c450", "packagetype": "bdist_wheel", "python_version": "cp35", "requires_python": ">=2.7", "size": 692480, "upload_time": "2018-12-11T01:57:50", "url": "https://files.pythonhosted.org/packages/42/b2/933480a55b7a68d7ef588cc9b0d71514f537fb608411d5b4584142acfdf0/spector-0.1-cp35-cp35m-manylinux1_x86_64.whl" }, { "comment_text": "", "digests": { "md5": "3b8613bf001863bf11bdf3e06a7cb7d0", "sha256": "202dc2d730f85df99fc1aa014748d24ac7d3420304ae1aca510f7290f1a6c206" }, "downloads": -1, "filename": "spector-0.1-cp36-cp36m-manylinux1_x86_64.whl", "has_sig": false, "md5_digest": "3b8613bf001863bf11bdf3e06a7cb7d0", "packagetype": "bdist_wheel", "python_version": "cp36", "requires_python": ">=2.7", "size": 718320, "upload_time": "2018-12-11T01:57:52", "url": "https://files.pythonhosted.org/packages/5f/c0/3af5c2fae72d25b6b787fe4bfd745ca99941fb5f309a52ed7e32e13a48f3/spector-0.1-cp36-cp36m-manylinux1_x86_64.whl" }, { "comment_text": "", "digests": { "md5": "c8c1b2c9d1889ec847b8b91f74ad8f89", "sha256": "68f96a671e9094ffcc08029f3d171dfaec8de19b71688108f6c9ab6084c806ee" }, "downloads": -1, "filename": "spector-0.1-cp37-cp37m-macosx_10_14_x86_64.whl", "has_sig": false, "md5_digest": "c8c1b2c9d1889ec847b8b91f74ad8f89", "packagetype": "bdist_wheel", "python_version": "cp37", "requires_python": ">=2.7", "size": 173456, "upload_time": "2018-12-10T21:46:28", "url": "https://files.pythonhosted.org/packages/f1/19/834693e34408a516022b0365b6820f78f44566b98444ad782faa3e114f0c/spector-0.1-cp37-cp37m-macosx_10_14_x86_64.whl" }, { "comment_text": "", "digests": { "md5": "c566e1f5e9e8934cc4f1a14db8ae6e5a", "sha256": "4f9588d481eea046e60ab4aa13e358279db891e3c185e5906d62814bbcbee95c" }, "downloads": -1, "filename": "spector-0.1-cp37-cp37m-manylinux1_x86_64.whl", "has_sig": false, "md5_digest": "c566e1f5e9e8934cc4f1a14db8ae6e5a", "packagetype": "bdist_wheel", "python_version": "cp37", "requires_python": ">=2.7", "size": 713624, "upload_time": "2018-12-11T01:57:53", "url": "https://files.pythonhosted.org/packages/a5/a8/ad9eedb592c292dc71aed930fc4cb674ac6dd5f5900988eefe4a2a12d96c/spector-0.1-cp37-cp37m-manylinux1_x86_64.whl" }, { "comment_text": "", "digests": { "md5": "f069c1812635cf6d666801c65de031da", "sha256": "2ad0d9fa777781b6bbb795f9565b19e437872f99f18f1524ca92b4a9b708a220" }, "downloads": -1, "filename": "spector-0.1.tar.gz", "has_sig": false, "md5_digest": "f069c1812635cf6d666801c65de031da", "packagetype": "sdist", "python_version": "source", "requires_python": ">=2.7", "size": 181839, "upload_time": "2018-12-10T21:46:30", "url": "https://files.pythonhosted.org/packages/5e/92/85ccdfdd13d95c3eaaeca41b192add355f5c4924c6afeccb4555003ba39a/spector-0.1.tar.gz" } ], "0.2": [ { "comment_text": "", "digests": { "md5": "e3c59d84837f770c62d08333184d3ede", "sha256": "8da4fa1b6b74b1e8533d0f30ae6b1a8f323c92cab7c936ba9c72eb50fea2dcf8" }, "downloads": -1, "filename": "spector-0.2-cp35-cp35m-manylinux1_x86_64.whl", "has_sig": false, "md5_digest": "e3c59d84837f770c62d08333184d3ede", "packagetype": "bdist_wheel", "python_version": "cp35", "requires_python": ">=2.7", "size": 734405, "upload_time": "2019-07-20T01:31:27", "url": "https://files.pythonhosted.org/packages/b2/2a/640e5b1022fa03bd9c4e0e0a55aa01a0187e4e51da2417b12ccc5ddfecdf/spector-0.2-cp35-cp35m-manylinux1_x86_64.whl" }, { "comment_text": "", "digests": { "md5": "ca4605486b442bb2586bfb5a5ca6de47", "sha256": "3aae17186af6f812b6647bff0fa091fd713cca143aad4a667a4d1f1ec719c26e" }, "downloads": -1, "filename": "spector-0.2-cp36-cp36m-manylinux1_x86_64.whl", "has_sig": false, "md5_digest": "ca4605486b442bb2586bfb5a5ca6de47", "packagetype": "bdist_wheel", "python_version": "cp36", "requires_python": ">=2.7", "size": 759551, "upload_time": "2019-07-20T01:31:30", "url": "https://files.pythonhosted.org/packages/9a/57/c3abe2ce1ee09b068085d94d60fbc4a8767b049eacc8cc4025a22d7a89b5/spector-0.2-cp36-cp36m-manylinux1_x86_64.whl" }, { "comment_text": "", "digests": { "md5": "fca2c0f22e2a20c8bd2bfe950f74c9b1", "sha256": "20733432bd63dbf9cafad1209396e7ffe059c8f64e2f6fbd54b7d1d438325ad5" }, "downloads": -1, "filename": "spector-0.2-cp37-cp37m-macosx_10_14_x86_64.whl", "has_sig": false, "md5_digest": "fca2c0f22e2a20c8bd2bfe950f74c9b1", "packagetype": "bdist_wheel", "python_version": "cp37", "requires_python": ">=2.7", "size": 181623, "upload_time": "2019-07-20T01:31:31", "url": "https://files.pythonhosted.org/packages/b3/a9/a038e118fdffa06ce98ff4a7f0c5b10bdd321d3655c158ecf7811ba615f8/spector-0.2-cp37-cp37m-macosx_10_14_x86_64.whl" }, { "comment_text": "", "digests": { "md5": "add34d303641fee600aa5d57a34e0453", "sha256": "3ff2d6efdbdd306906bdf1f81e35beaa04b494cc3859faf190c3945aa3ad346e" }, "downloads": -1, "filename": "spector-0.2-cp37-cp37m-manylinux1_x86_64.whl", "has_sig": false, "md5_digest": "add34d303641fee600aa5d57a34e0453", "packagetype": "bdist_wheel", "python_version": "cp37", "requires_python": ">=2.7", "size": 750510, "upload_time": "2019-07-20T01:31:34", "url": "https://files.pythonhosted.org/packages/6d/fd/3d4098956f47ce1e1ced3fc268ccc766c84fd92d14d9a9078d24ef4b5237/spector-0.2-cp37-cp37m-manylinux1_x86_64.whl" }, { "comment_text": "", "digests": { "md5": "9783bd63674532f577ee3c9b6098dc49", "sha256": "60071fcd789bb0413a27b4ff3e13dceac3f418ad6d5cc371b5e479d425a5a567" }, "downloads": -1, "filename": "spector-0.2.tar.gz", "has_sig": false, "md5_digest": "9783bd63674532f577ee3c9b6098dc49", "packagetype": "sdist", "python_version": "source", "requires_python": ">=2.7", "size": 191104, "upload_time": "2019-07-20T01:28:54", "url": "https://files.pythonhosted.org/packages/7e/3b/602ef2c45117399932b19a497df68473743dca611bbeca3d1d403b2eeef5/spector-0.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "e3c59d84837f770c62d08333184d3ede", "sha256": "8da4fa1b6b74b1e8533d0f30ae6b1a8f323c92cab7c936ba9c72eb50fea2dcf8" }, "downloads": -1, "filename": "spector-0.2-cp35-cp35m-manylinux1_x86_64.whl", "has_sig": false, "md5_digest": "e3c59d84837f770c62d08333184d3ede", "packagetype": "bdist_wheel", "python_version": "cp35", "requires_python": ">=2.7", "size": 734405, "upload_time": "2019-07-20T01:31:27", "url": "https://files.pythonhosted.org/packages/b2/2a/640e5b1022fa03bd9c4e0e0a55aa01a0187e4e51da2417b12ccc5ddfecdf/spector-0.2-cp35-cp35m-manylinux1_x86_64.whl" }, { "comment_text": "", "digests": { "md5": "ca4605486b442bb2586bfb5a5ca6de47", "sha256": "3aae17186af6f812b6647bff0fa091fd713cca143aad4a667a4d1f1ec719c26e" }, "downloads": -1, "filename": "spector-0.2-cp36-cp36m-manylinux1_x86_64.whl", "has_sig": false, "md5_digest": "ca4605486b442bb2586bfb5a5ca6de47", "packagetype": "bdist_wheel", "python_version": "cp36", "requires_python": ">=2.7", "size": 759551, "upload_time": "2019-07-20T01:31:30", "url": "https://files.pythonhosted.org/packages/9a/57/c3abe2ce1ee09b068085d94d60fbc4a8767b049eacc8cc4025a22d7a89b5/spector-0.2-cp36-cp36m-manylinux1_x86_64.whl" }, { "comment_text": "", "digests": { "md5": "fca2c0f22e2a20c8bd2bfe950f74c9b1", "sha256": "20733432bd63dbf9cafad1209396e7ffe059c8f64e2f6fbd54b7d1d438325ad5" }, "downloads": -1, "filename": "spector-0.2-cp37-cp37m-macosx_10_14_x86_64.whl", "has_sig": false, "md5_digest": "fca2c0f22e2a20c8bd2bfe950f74c9b1", "packagetype": "bdist_wheel", "python_version": "cp37", "requires_python": ">=2.7", "size": 181623, "upload_time": "2019-07-20T01:31:31", "url": "https://files.pythonhosted.org/packages/b3/a9/a038e118fdffa06ce98ff4a7f0c5b10bdd321d3655c158ecf7811ba615f8/spector-0.2-cp37-cp37m-macosx_10_14_x86_64.whl" }, { "comment_text": "", "digests": { "md5": "add34d303641fee600aa5d57a34e0453", "sha256": "3ff2d6efdbdd306906bdf1f81e35beaa04b494cc3859faf190c3945aa3ad346e" }, "downloads": -1, "filename": "spector-0.2-cp37-cp37m-manylinux1_x86_64.whl", "has_sig": false, "md5_digest": "add34d303641fee600aa5d57a34e0453", "packagetype": "bdist_wheel", "python_version": "cp37", "requires_python": ">=2.7", "size": 750510, "upload_time": "2019-07-20T01:31:34", "url": "https://files.pythonhosted.org/packages/6d/fd/3d4098956f47ce1e1ced3fc268ccc766c84fd92d14d9a9078d24ef4b5237/spector-0.2-cp37-cp37m-manylinux1_x86_64.whl" }, { "comment_text": "", "digests": { "md5": "9783bd63674532f577ee3c9b6098dc49", "sha256": "60071fcd789bb0413a27b4ff3e13dceac3f418ad6d5cc371b5e479d425a5a567" }, "downloads": -1, "filename": "spector-0.2.tar.gz", "has_sig": false, "md5_digest": "9783bd63674532f577ee3c9b6098dc49", "packagetype": "sdist", "python_version": "source", "requires_python": ">=2.7", "size": 191104, "upload_time": "2019-07-20T01:28:54", "url": "https://files.pythonhosted.org/packages/7e/3b/602ef2c45117399932b19a497df68473743dca611bbeca3d1d403b2eeef5/spector-0.2.tar.gz" } ] }