ArrayKernels

Sized Array helpers for ``@llvm`` / ``@gpu`` kernels. Kept out of ``Array.ae`` so ordinary ``open Array`` stays cheap to typecheck. The CPU/CUDA lowerers need an explicit length alongside the buffer pointer. Monomorphic Int/Float variants avoid ``ImplicitRefinementHole`` under LLVM.
Imports
open Array;
Table of Contents

Functions

np

def np : Unit

from_numpy

def from_numpy (arr : Unit) : (Array Float)

to_numpy

def to_numpy (1 arr : (Array Float)) : Unit

map_n_int

def map_n_int (f : (x : Int) → Int) (1 arr : (Array Int)) (n : Int) : {r : (Array Int) | size r = n}

map_n_float

def map_n_float (f : (x : Float) → Float) (1 arr : (Array Float)) (n : Int) : {r : (Array Float) | size r = n}

reduce_n_int

Direct @gpu reductions use a parallel tree. f must be pure and associative; z is applied once, and an empty input returns z.
def reduce_n_int (f : (acc : Int) → (x : Int) → Int) (z : Int) (1 arr : (Array Int)) (n : Int) : Int

reduce_n_float

def reduce_n_float (f : (acc : Float) → (x : Float) → Float) (z : Float) (1 arr : (Array Float)) (n : Int) : Float

filter_n_int

def filter_n_int (f : (x : Int) → Bool) (1 arr : (Array Int)) (n : Int) : (Array Int)

filter_n_float

def filter_n_float (f : (x : Float) → Bool) (1 arr : (Array Float)) (n : Int) : (Array Float)

count_n_int

def count_n_int (f : (x : Int) → Bool) (1 arr : (Array Int)) (n : Int) : Int

zipWith_n_int

def zipWith_n_int (f : (x : Int) → (y : Int) → Int) (1 xs : (Array Int)) (1 ys : (Array Int)) (n : Int) : {r : (Array Int) | size r = n}