Awkward Array C++ Kernels

52 · active · verified Sun Apr 12

awkward-cpp provides the highly optimized C++ and CUDA kernels and compiled extensions that power the Awkward Array library (version 2.x). It serves as a performance backend, enabling NumPy-like idioms for nested, variable-sized data structures to run at compiled speeds. The library itself is not intended for direct end-user interaction but is a core dependency of the main `awkward` package. It is currently at version 52 and maintains an active release cadence aligned with `awkward` releases.

Warnings

Install

Imports

Quickstart

Demonstrates basic usage of the Awkward Array library, which internally utilizes `awkward-cpp` for efficient computation. Users typically interact with the `awkward` API, not `awkward-cpp` directly.

import awkward as ak
import numpy as np

# Create a nested, variable-sized Awkward Array
array = ak.Array([[1, 2, 3], [], [4, 5]])
print(f"Original Array: {array}, type: {array.type}")

# Perform a vectorized operation (e.g., multiply by 2)
result = array * 2
print(f"Result of array * 2: {result}, type: {result.type}")

# Use a NumPy ufunc directly (works because of Awkward's NumPy-like behavior)
sum_per_list = ak.sum(array, axis=1)
print(f"Sum per list: {sum_per_list}, type: {sum_per_list.type}")

view raw JSON →