Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

fastdotrs-0.1.2-cp311-cp311-manylinux_2_34_x86_64.whl (220.4 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.34+ x86-64

File details

Details for the file fastdotrs-0.1.2-cp311-cp311-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for fastdotrs-0.1.2-cp311-cp311-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 9d3b7d93dbc932a6e32ddc89d8fddff68e811749f72afb9b736036274936f3fb
MD5 53e939f76544ec0775eb32019ce5a566
BLAKE2b-256 e9ba6006ae3df9a982edfd8bf5fb0852aa8ed1562778d2ccb72b52b49a21b86e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page