Float32 Array Support #
Direct Float32 (single precision) support using raw byte arrays. No automatic conversions - all conversions must be explicit.
Performance Benefits:
- 2x memory savings vs Float64
- SIMD width: AVX2 8 vs 4, NEON 4 vs 2
- Direct GPU/FFI interop without conversion overhead
Float32 array stored as raw bytes (4 bytes per element). Works directly with C FFI without type conversion overhead.
IMPORTANT: We store numElements explicitly because Lean cannot properly
access ByteArray.size when the ByteArray is wrapped in a struct from C++.
- data : ByteArray
Raw byte representation (4 bytes per float32)
- numElements : Nat
Number of Float32 elements (NOT bytes)
Instances For
Equations
Instances For
Create empty Float32Array
Equations
- Hesper.Float32.empty = { data := ByteArray.empty, numElements := 0 }
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
ONLY for explicit conversion when needed - converts Float64 to Float32
ONLY for explicit conversion when needed - converts Float32 to Float64
Get single element (converts to Float64 only for access)
Set single element (converts from Float64)
Equations
- One or more equations did not get rendered due to their size.