https://github.com/asem000/arraylib
minimal numpy & jax in python and C
https://github.com/asem000/arraylib
Last synced: about 1 year ago
JSON representation
minimal numpy & jax in python and C
- Host: GitHub
- URL: https://github.com/asem000/arraylib
- Owner: ASEM000
- License: apache-2.0
- Created: 2025-01-06T01:01:29.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-01-16T08:10:43.000Z (over 1 year ago)
- Last Synced: 2025-01-16T08:57:48.147Z (over 1 year ago)
- Language: C
- Size: 119 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# `arraylib`: Multi-dimensional array library for `Python` in `C` with `numpy`-like interface
## Installation
use make to build the shared library
```bash
make
```
## Usage
```python
import arraylib as al
import math
# general example
a = (
al.arange(1, 1 + 3 * 4 * 5 * 6)
.reshape((3, 4, 5, 6))
.reduce_sum(dims=(1, 2))
.apply(lambda x: math.sqrt(x))
.reshape((3, 6))
.transpose((1, 0))
)
# broadcasting
b = al.ones([3, 6]) + al.ones([6]) + al.ones([4, 3, 1]) + 1.0
# stride tricks
c = al.arange(1, 11).as_strided(shape=(8, 3), stride=(1, 1)).reduce_sum(dims=[0])
```
NOTE: `omp` is supported if compiled with the appropriate flags (e.g. `-fopenmp`)