Engines of Multik
Overview
Multik exposes a single API, but the actual math, linear algebra, and statistics work is performed by an engine. Engines are interchangeable implementations, so the same ndarray code can run on different platforms and backends.
By default, Multik picks a suitable engine at runtime. You can also select an engine explicitly when you need predictable performance or platform behavior.
Built-in engines
Engine | Artifact | Best for | Notes |
|---|---|---|---|
DEFAULT |
| Most projects | Chooses the best available engine. |
KOTLIN |
| Maximum portability | Pure Kotlin, works everywhere. |
NATIVE |
| CPU-heavy math | Uses OpenBLAS where supported. |
Selecting an engine
Multik exposes a map of available engines and lets you set the default one:
You can also check the current engine:
If you try to select an engine that is not available, mk.setEngine(...) throws an EngineMultikException.
Choosing the right engine
DEFAULT - best for most users; a good balance of convenience and performance.
KOTLIN - safest choice for multiplatform code or environments without native dependencies.
NATIVE - best for CPU-heavy linear algebra when OpenBLAS is available.
For platform-specific details and support, see Multik on different platforms.