diff options
author | Tom Smeding <tom@tomsmeding.com> | 2025-05-27 23:34:42 +0200 |
---|---|---|
committer | Tom Smeding <tom@tomsmeding.com> | 2025-05-27 23:34:42 +0200 |
commit | 5abd6638f2b6df77c70842569ade9c13f8ea907c (patch) | |
tree | 3f67af2684496ec68559e637985206f4269441ab | |
parent | 616795147cd6ff20b9cfd878d0cc8beda2ab85ee (diff) |
-rw-r--r-- | README.md | 19 |
1 files changed, 14 insertions, 5 deletions
@@ -1,8 +1,13 @@ ## ox-arrays -ox-arrays is a wrapper library around `orthotope` that defines nested arrays, -including tuples, of (eventually) unboxed values. The arrays are represented in -struct-of-arrays form via the `Data.Vector.Unboxed` data family trick. +ox-arrays is an array library that defines nested arrays, including tuples, of +(eventually) unboxed values. The arrays are represented in struct-of-arrays +form via the `Data.Vector.Unboxed` data family trick; the component arrays are +`orthotope` arrays +([RankedS](https://hackage.haskell.org/package/orthotope-0.1.7.0/docs/Data-Array-RankedS.html)) +which describe elements using a _stride vector_ or +[LMAD](https://dl.acm.org/doi/pdf/10.1145/509705.509708) so that `transpose` +and `replicate` need only modify array metadata, not actually move around data. Because of the struct-of-arrays representation, nested arrays are not fully general: indeed, arrays are not actually nested under the hood, so if one has an @@ -130,8 +135,12 @@ instance Elt a => Elt (Mixed xsh a) -- Essentially all functions that ox-arrays offers on arrays are first-order: -- add two arrays elementwise, transpose an array, append arrays, compute -- minima/maxima, zip/unzip, nest/unnest, etc. The first-order approach allows --- operations to be vectorised (using hand-written C code) without needing any --- sort of JIT compilation. +-- operations, especially arithmetic ones, to be vectorised using hand-written +-- C code, without needing any sort of JIT compilation. +rappend :: Elt a => Ranked (n + 1) a -> Ranked (n + 1) a -> Ranked (n + 1) a +sappend :: Elt a => Shaped (n : sh) a -> Shaped (m : sh) a -> Shaped (n + m : sh) a +mappend :: Elt a => Mixed (n : sh) a -> Mixed (m : sh) a -> Mixed (AddMaybe n m : sh) a + -- Exceptionally, also one higher-order function is provided per array type: -- 'generate'. These functions have the caveat that regularity of arrays must be -- preserved: all returned 'a's must have equal shape. See the documentation of |