Fast SIMD-optimized dot products (f32·f32, f16·f32)
Project description
fast_dot
Fast SIMD-optimized dot products exposed to Python via PyO3 + maturin.
Features
- dot_f32(a: np.ndarray[float32], b: np.ndarray[float32]) -> float
- dot_f16_f32(a: np.ndarray[float16], b: np.ndarray[float32]) -> float (uses F16C when available)
Both functions accept any Python object that implements the buffer protocol (NumPy arrays, PyTorch tensors via .numpy() if on CPU and contiguous) through the NumPy bridge. For non-NumPy objects, convert to NumPy first.
Build and install
- Build wheel: maturin build --release
- Develop install: maturin develop --release
Usage
import numpy as np import fast_dot as fd
x = np.random.rand(1024).astype(np.float32) y = np.random.rand(1024).astype(np.float32) print(fd.dot_f32(x, y))
x16 = x.astype(np.float16) print(fd.dot_f16_f32(x16, y))
Notes
- Requires x86_64. F16C and AVX2 paths are used when available; otherwise falls back to scalar.
- Arrays must be 1-D and contiguous with matching shapes.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file fastdotrs-0.1.2-cp311-cp311-manylinux_2_34_x86_64.whl.
File metadata
- Download URL: fastdotrs-0.1.2-cp311-cp311-manylinux_2_34_x86_64.whl
- Upload date:
- Size: 220.4 kB
- Tags: CPython 3.11, manylinux: glibc 2.34+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.10.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9d3b7d93dbc932a6e32ddc89d8fddff68e811749f72afb9b736036274936f3fb
|
|
| MD5 |
53e939f76544ec0775eb32019ce5a566
|
|
| BLAKE2b-256 |
e9ba6006ae3df9a982edfd8bf5fb0852aa8ed1562778d2ccb72b52b49a21b86e
|