Documentation

Init.Data.FloatArray.Basic

@[extern lean_mk_empty_float_array]
Equations
@[extern lean_float_array_push]
Equations
  • x✝.push x = match x✝, x with | { data := ds }, b => { data := ds.push b }
@[extern lean_float_array_size]
Equations
  • x.size = match x with | { data := ds } => ds.size
@[extern lean_float_array_uget]
def FloatArray.uget (a : FloatArray) (i : USize) :
i.toNat < a.sizeFloat
Equations
  • x✝¹.uget x✝ x = match x✝¹, x✝, x with | { data := ds }, i, h => ds[i]
@[extern lean_float_array_fget]
def FloatArray.get (ds : FloatArray) :
Fin ds.sizeFloat
Equations
  • x✝.get x = match x✝, x with | { data := ds }, i => ds.get i
@[extern lean_float_array_get]
Equations
  • x✝.get! x = match x✝, x with | { data := ds }, i => ds.get! i
Equations
  • ds.get? i = if h : i < ds.size then some (ds.get i, h) else none
Equations
Equations
@[extern lean_float_array_uset]
def FloatArray.uset (a : FloatArray) (i : USize) :
Floati.toNat < a.sizeFloatArray
Equations
  • x✝².uset x✝¹ x✝ x = match x✝², x✝¹, x✝, x with | { data := ds }, i, v, h => { data := ds.uset i v h }
@[extern lean_float_array_fset]
def FloatArray.set (ds : FloatArray) :
Fin ds.sizeFloatFloatArray
Equations
  • x✝¹.set x✝ x = match x✝¹, x✝, x with | { data := ds }, i, d => { data := ds.set i d }
@[extern lean_float_array_set]
Equations
  • x✝¹.set! x✝ x = match x✝¹, x✝, x with | { data := ds }, i, d => { data := ds.set! i d }
Equations
  • s.isEmpty = (s.size == 0)
@[inline]
unsafe def FloatArray.forInUnsafe {β : Type v} {m : Type v → Type w} [Monad m] (as : FloatArray) (b : β) (f : Floatβm (ForInStep β)) :
m β

We claim this unsafe implementation is correct because an array cannot have more than usizeSz elements in our runtime. This is similar to the Array version.

Equations
@[specialize #[]]
unsafe def FloatArray.forInUnsafe.loop {β : Type v} {m : Type v → Type w} [Monad m] (as : FloatArray) (f : Floatβm (ForInStep β)) (sz : USize) (i : USize) (b : β) :
m β
Equations
  • One or more equations did not get rendered due to their size.
@[implemented_by FloatArray.forInUnsafe]
def FloatArray.forIn {β : Type v} {m : Type v → Type w} [Monad m] (as : FloatArray) (b : β) (f : Floatβm (ForInStep β)) :
m β

Reference implementation for forIn

Equations
def FloatArray.forIn.loop {β : Type v} {m : Type v → Type w} [Monad m] (as : FloatArray) (f : Floatβm (ForInStep β)) (i : Nat) (h : i as.size) (b : β) :
m β
Equations
Equations
  • FloatArray.instForInFloat = { forIn := fun {β : Type u_1} [Monad m] => FloatArray.forIn }
@[inline]
unsafe def FloatArray.foldlMUnsafe {β : Type v} {m : Type v → Type w} [Monad m] (f : βFloatm β) (init : β) (as : FloatArray) (start : optParam Nat 0) (stop : optParam Nat as.size) :
m β

See comment at forInUnsafe

Equations
  • One or more equations did not get rendered due to their size.
@[specialize #[]]
unsafe def FloatArray.foldlMUnsafe.fold {β : Type v} {m : Type v → Type w} [Monad m] (f : βFloatm β) (as : FloatArray) (i : USize) (stop : USize) (b : β) :
m β
Equations
@[implemented_by FloatArray.foldlMUnsafe]
def FloatArray.foldlM {β : Type v} {m : Type v → Type w} [Monad m] (f : βFloatm β) (init : β) (as : FloatArray) (start : optParam Nat 0) (stop : optParam Nat as.size) :
m β

Reference implementation for foldlM

Equations
  • One or more equations did not get rendered due to their size.
def FloatArray.foldlM.loop {β : Type v} {m : Type v → Type w} [Monad m] (f : βFloatm β) (as : FloatArray) (stop : Nat) (h : stop as.size) (i : Nat) (j : Nat) (b : β) :
m β
Equations
  • One or more equations did not get rendered due to their size.
@[inline]
def FloatArray.foldl {β : Type v} (f : βFloatβ) (init : β) (as : FloatArray) (start : optParam Nat 0) (stop : optParam Nat as.size) :
β
Equations
Equations