{ "info": { "author": "Jared Lumpe", "author_email": "", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", "Intended Audience :: Science/Research", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Topic :: Scientific/Engineering", "Topic :: Scientific/Engineering :: Mathematics", "Topic :: Utilities" ], "description": "# triarray\n\nPython package for working with symmetric matrices in non-redundant format.\n\n\n## Overview\n\nThe `triarray` package contains tools for working with large symmetric matrices while only storing the elements in the upper or lower triangle, thus halving memory requirements.\n\nWhen storing symmetric matrices stored in standard array format about half of the elements are redundant, meaning you are using twice as much memory or disk space as you need to. This is especially common in scientific applications when working with large distance or similarity matrices.\n\nSpace can be saved by storing only the lower or upper triangle of the array, but standard operations like getting an element by row and column become awkward. ``triarray`` provides tools for working with data in this format.\n\n``triarray`` uses [Numba](http://numba.pydata.org/)'s just-in-time compilation to generate high-performance C code that works with any data type and is easily extendable (including within a Jupyter notebook).\n\n\n### Example\n\nThe `scipy.spatial.distance.pdist` function calculates pairwise distances between all rows of a matrix and returns only the upper triangle of the full distance matrix:\n\n```python\n\nimport numpy as np\nfrom scipy.spatial.distance import pdist\n\nvectors = np.random.rand(1000, 10)\n\ndists = pdist(vectors) # Shape is (499500,) instead of (1000, 1000)\n\n```\n\nThe `triarray.TriMatrix` class wraps a 1D Numpy array storing the condensed data and exposes an interface that lets you treat it as if it was still in matrix format:\n\n```python\n\nfrom triarray import TriMatrix\n\nmatrix = TriMatrix(dists, upper=True, diag_val=0)\n\nmatrix.size # Number of rows/columns in matrix\n>>> 1000\n\nmatrix[0, 1] # Distance between 0th and 1st vector\n>>> 1.1610289956390953\n\nmatrix[0, 0] # Diagonals are zero\n>>> 0.0\n\nmatrix[0] # 0th row of matrix\n>>> array([ 0. , 1.161029 , 1.03467554, 1.32559121, 1.26185034,\n ...\n\n```\n\nIt even supports Numpy's advanced indexing with integer arrays of arbitrary shape:\n\n```python\n\nrows, cols = np.ix_([0, 1, 2], [3, 4, 5])\nrows, cols\n>>> (array([[0],\n [1],\n [3]]), array([[4, 5, 6]]))\n \nmatrix[rows, cols]\n>>> array([[ 1.26185034, 1.08800206, 1.30490993],\n [ 0.99262394, 1.33044029, 1.20373382],\n [ 1.42524039, 1.36195143, 1.70404005]])\n\n```\n\n\n## Requirements\n\n* Numpy 1.11 or above\n* Numba 0.30 or above\n\n\n## Installation\n\nThe easiest way is to use pip:\n\n pip install triarray\n \nor you can clone the repository and run the setup script:\n\n cd path/to/triarray\n python setup.py install\n\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n", "description_content_type": null, "docs_url": null, "download_url": "https://github.com/jlumpe/triarray/archive/0.2.0.tar.gz", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/jlumpe/triarray", "keywords": "numpy array matrix symmetric pairwise distance similarity", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "triarray", "package_url": "https://pypi.org/project/triarray/", "platform": "", "project_url": "https://pypi.org/project/triarray/", "project_urls": { "Download": "https://github.com/jlumpe/triarray/archive/0.2.0.tar.gz", "Homepage": "https://github.com/jlumpe/triarray" }, "release_url": "https://pypi.org/project/triarray/0.2.0/", "requires_dist": null, "requires_python": "", "summary": "Tools for working with symmetric matrices in non-redundant format.", "version": "0.2.0" }, "last_serial": 2714951, "releases": { "0.2.0": [ { "comment_text": "", "digests": { "md5": "6a1f56d03f71fea7688079df003a55c2", "sha256": "d5220992be1419b73eea11d862c89925783b519057e5299352d401173551f9e7" }, "downloads": -1, "filename": "triarray-0.2.0.tar.gz", "has_sig": false, "md5_digest": "6a1f56d03f71fea7688079df003a55c2", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11412, "upload_time": "2017-03-18T20:44:35", "url": "https://files.pythonhosted.org/packages/70/38/853930b20dd904c30225a0d8594158df178096d64a3553b98dbcc1f90e90/triarray-0.2.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "6a1f56d03f71fea7688079df003a55c2", "sha256": "d5220992be1419b73eea11d862c89925783b519057e5299352d401173551f9e7" }, "downloads": -1, "filename": "triarray-0.2.0.tar.gz", "has_sig": false, "md5_digest": "6a1f56d03f71fea7688079df003a55c2", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11412, "upload_time": "2017-03-18T20:44:35", "url": "https://files.pythonhosted.org/packages/70/38/853930b20dd904c30225a0d8594158df178096d64a3553b98dbcc1f90e90/triarray-0.2.0.tar.gz" } ] }