Documentation

Hesper.Float32

Float32 Array Support #

Direct Float32 (single precision) support using raw byte arrays. No automatic conversions - all conversions must be explicit.

Performance Benefits:

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

    Get number of Float32 elements

    Equations
    Instances For

      Create empty Float32Array

      Equations
      Instances For

        Create Float32Array from raw ByteArray (must be 4-byte aligned)

        Equations
        Instances For
          Equations
          • One or more equations did not get rendered due to their size.
          Instances For
            @[extern lean_f32_from_f64_array]

            ONLY for explicit conversion when needed - converts Float64 to Float32

            @[extern lean_f32_to_f64_array]

            ONLY for explicit conversion when needed - converts Float32 to Float64

            @[extern lean_f32_get]

            Get single element (converts to Float64 only for access)

            @[extern lean_f32_set]

            Set single element (converts from Float64)

            Equations
            • One or more equations did not get rendered due to their size.