Array API Negative Index
Documentation: https://array-api-negative-index.readthedocs.io
Source Code: https://github.com/34j/array-api-negative-index
Utils for indexing arrays with {-n, -(n-1), ..., -1, 0, 1, ..., n-1, n} using array API.
Installation
Install this via pip (or your favourite package manager):
pip install array-api-negative-index
Usage
- This package provides a utility for packing array elements in the order
[0, 1, 2, ..., n, -n, ..., -2, -1]. - This allows one to access the
i-th element byarray[i], regardless of whetheriis positive, 0 or negative, thanks to "Negative Indexing" in array API. - This is useful for representing the order
min spherical harmonics for example.
from array_api_negative_index import to_symmetric, flip_symmetric, arange_asymmetric
arange_asymmetric()
import numpy as np
a = arange_asymmetric(3, xp=np)
print(a)
[ 0 1 2 -2 -1]
Not to confuse with np.arange(-stop + 1, stop)!
This caused me to create bugs many times.
a = np.arange(-2, 3)
print(a)
[-2, -1, 0, 1, 2]
flip_symmetric()
b = flip_symmetric(a)
print(f"{a} -> (flip) -> {b}")
[ 0 1 2 -2 -1] -> (flip) -> [ 0 -1 -2 2 1]
to_symmetric()
c = np.asarray([0, 3, 5])
d = to_symmetric(c, asymmetric=True, conjugate=False)
print(f"{c} -> (to_symmetric) -> {d}")
[0 3 5] -> (to_symmetric) -> [ 0 3 5 -5 -3]
Metadata
Release files for array-api-negative-index 1.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| array_api_negative_index-1.1.0.tar.gz | 5.0 kB | With provenance | Details for array_api_negative_index-1.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| array_api_negative_index-1.1.0-py3-none-any.whl | Python 3 | none | any | Details for array_api_negative_index-1.1.0-py3-none-any.whl |
Total release size: 10.1 kB
Release files / array_api_negative_index-1.1.0.tar.gz
| Download URL | array_api_negative_index-1.1.0.tar.gz |
|---|---|
| Size | 5.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
94f4d8bb5e7d49dbf87220d785ded5ca8dbe95e51b798c2bbeef1357496f6558
|
|
BLAKE2b-256 checksum How to use checksums |
de01fabb071c9c7a09b232fc21c752dcbe6f43a2590e138eb3dc8b24f932c643
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.13
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 8, 2026.
Transparency logRelease files / array_api_negative_index-1.1.0-py3-none-any.whl
| Download URL | array_api_negative_index-1.1.0-py3-none-any.whl |
|---|---|
| Size | 5.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e9ca34a541a6cf037809f70e11852b11507bca3c57f7e4309e04ad4787cff38b
|
|
BLAKE2b-256 checksum How to use checksums |
d71266a0bd852d48c7d3d40453b0c1e3440f6789381b1a85747aaf0559e8332d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.13
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 8, 2026.
Transparency logSecurity for array-api-negative-index 1.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for array_api_negative_index-1.1.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 8, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.