Scalars
Supported types
Multik arrays store elements of a single scalar type. All scalars implement Kotlin's Number or the Complex interface.
Type | Size (bytes) | Range / Precision | DataType constant |
|---|---|---|---|
| 1 | -128 to 127 |
|
| 2 | -32 768 to 32 767 |
|
| 4 | -231 to 231-1 |
|
| 8 | -263 to 263-1 |
|
| 4 | ~7 decimal digits |
|
| 8 | ~15 decimal digits |
|
| 8 | Two |
|
| 16 | Two |
|
Numeric types
The first six types map directly to Kotlin primitives. Arithmetic operators (+, -, *, /) and in-place variants (+=, -=, *=, /=) are supported element-wise on arrays of these types.
Complex types
ComplexFloat
Property / Method | Type | Description |
|---|---|---|
|
| Real part. |
|
| Imaginary part. |
|
| Returns |
|
| Magnitude |
|
| Phase angle in radians. |
|
| Destructuring support: |
Constants: ComplexFloat.zero, ComplexFloat.one, ComplexFloat.NaN
ComplexDouble
Same API as ComplexFloat but with Double precision.
Constants: ComplexDouble.zero, ComplexDouble.one, ComplexDouble.NaN
Creating complex values
ComplexFloatArray / ComplexDoubleArray
Backing storage for complex arrays. Each element occupies two primitive slots internally.
Type conversion
Use asType<T>() or toType<T>() to convert between scalar types. Converting a numeric type to a complex type sets the imaginary part to zero. See Type for DataType details and NDArray for conversion methods.