Input and output
Overview
Multik provides two groups of I/O tools:
In-memory conversions for lists, sets, and primitive arrays (available on all platforms).
File I/O for CSV/NPY/NPZ on the JVM.
In-memory conversions
Lists and collections
For nested lists (D2-D4):
Primitive arrays
You can extract a flat primitive array from any ndarray:
For 2D-4D arrays, toArray() returns nested primitive arrays:
Similar helpers exist for Long, Float, Double, and complex types.
JVM file I/O
File-based I/O is available on the JVM only. For NPY, you can use mk.read and mk.write. For CSV and NPZ, use the format-specific helpers below.
Format | Read | Write | Dimensions | Notes |
|---|---|---|---|---|
NPY |
|
| Any | Numeric types only. |
NPZ |
|
| Any | Container for multiple NPY arrays; numeric types only. |
CSV |
|
| 1D-2D | Complex values supported with complex dtype. |
NPY
NPZ
CSV
Non-JVM platforms
On JS, WASM, and Native, use in-memory conversions and a platform-specific serialization library. A common approach is to convert to primitive arrays or lists and serialize those.