Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/hameerabbasi/arrayish
A library for downstream compatibility of Numpy-compatible arrays.
https://github.com/hameerabbasi/arrayish
Last synced: about 1 month ago
JSON representation
A library for downstream compatibility of Numpy-compatible arrays.
- Host: GitHub
- URL: https://github.com/hameerabbasi/arrayish
- Owner: hameerabbasi
- License: bsd-3-clause
- Created: 2018-04-20T05:13:33.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2019-06-14T16:44:30.000Z (over 5 years ago)
- Last Synced: 2024-10-05T00:52:06.289Z (about 1 month ago)
- Language: Python
- Homepage:
- Size: 24.4 KB
- Stars: 11
- Watchers: 8
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.rst
- License: LICENSE
Awesome Lists containing this project
README
Arrayish
========This repository is being deprecated in favour of ``uarray`` and ``unumpy``.
A library for downstream compatibility of Numpy-compatible arrays.
Usage
-----For an alternative array implementation
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^.. code-block:: python
import numpy as np
import arrayish as aiclass CustomArray(object):
"""Your custom ``ndarray`` compatible implementation."""
passdef dot(a, b, out=None)
""" Your custom implementation of ``np.dot``. """
pass# Between your own arrays
ai.dot.add((CustomArray, CustomArray), dot)# With Numpy Arrays, if you'd like. Can also pass another function
ai.dot.add((np.ndarray, CustomArray), dot)
ai.dot.add((CustomArray, np.ndarray), dot)For a downstream library willing to support alternative arrays
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^.. code-block:: python
import arrayish as ai
import numpy as np# Instead of this:
np.dot(a, b)# Do this:
ai.dot(a, b)