Equations
- FloatArray.instInhabitedFloatArray = { default := FloatArray.empty }
Equations
- FloatArray.instEmptyCollectionFloatArray = { emptyCollection := FloatArray.empty }
@[extern lean_float_array_push]
Equations
- FloatArray.push x x = match x, x with | { data := ds }, b => { data := Array.push ds b }
Instances For
@[extern lean_float_array_size]
Equations
- FloatArray.size x = match x with | { data := ds } => Array.size ds
Instances For
@[extern lean_float_array_uget]
Equations
- FloatArray.uget x x x = match x, x, x with | { data := ds }, i, h => ds[i]
Instances For
@[extern lean_float_array_fget]
Equations
- FloatArray.get x x = match x, x with | { data := ds }, i => Array.get ds i
Instances For
@[extern lean_float_array_get]
Equations
- FloatArray.get! x x = match x, x with | { data := ds }, i => Array.get! ds i
Instances For
Equations
- FloatArray.get? ds i = if h : i < FloatArray.size ds then some (FloatArray.get ds { val := i, isLt := h }) else none
Instances For
instance
FloatArray.instGetElemFloatArrayNatFloatLtInstLTNatSize :
GetElem FloatArray Nat Float fun xs i => i < FloatArray.size xs
Equations
- FloatArray.instGetElemFloatArrayNatFloatLtInstLTNatSize = { getElem := fun xs i h => FloatArray.get xs { val := i, isLt := h } }
instance
FloatArray.instGetElemFloatArrayUSizeFloatLtNatInstLTNatValSizeValSize :
GetElem FloatArray USize Float fun xs i => i.val.val < FloatArray.size xs
Equations
- FloatArray.instGetElemFloatArrayUSizeFloatLtNatInstLTNatValSizeValSize = { getElem := fun xs i h => FloatArray.uget xs i h }
@[extern lean_float_array_uset]
def
FloatArray.uset
(a : FloatArray)
(i : USize)
:
Float → USize.toNat i < FloatArray.size a → FloatArray
Equations
- FloatArray.uset x x x x = match x, x, x, x with | { data := ds }, i, v, h => { data := Array.uset ds i v h }
Instances For
@[extern lean_float_array_fset]
Equations
- FloatArray.set x x x = match x, x, x with | { data := ds }, i, d => { data := Array.set ds i d }
Instances For
@[extern lean_float_array_set]
Equations
- FloatArray.set! x x x = match x, x, x with | { data := ds }, i, d => { data := Array.set! ds i d }
Instances For
Equations
- FloatArray.isEmpty s = (FloatArray.size s == 0)
Instances For
Equations
- FloatArray.toList ds = FloatArray.toList.loop ds 0 []
Instances For
@[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
- FloatArray.forInUnsafe as b f = let sz := USize.ofNat (FloatArray.size as); FloatArray.forInUnsafe.loop as f sz 0 b
Instances For
@[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
- FloatArray.forIn as b f = FloatArray.forIn.loop as f (FloatArray.size as) (_ : FloatArray.size as ≤ FloatArray.size as) b
Instances For
def
FloatArray.forIn.loop
{β : Type v}
{m : Type v → Type w}
[Monad m]
(as : FloatArray)
(f : Float → β → m (ForInStep β))
(i : Nat)
(h : i ≤ FloatArray.size as)
(b : β)
:
m β
Equations
- One or more equations did not get rendered due to their size.
- FloatArray.forIn.loop as f 0 x b = pure b
Instances For
@[inline]
unsafe def
FloatArray.foldlMUnsafe
{β : Type v}
{m : Type v → Type w}
[Monad m]
(f : β → Float → m β)
(init : β)
(as : FloatArray)
(start : optParam Nat 0)
(stop : optParam Nat (FloatArray.size as))
:
m β
See comment at forInUnsafe
Equations
- One or more equations did not get rendered due to their size.
Instances For
@[specialize #[]]
unsafe def
FloatArray.foldlMUnsafe.fold
{β : Type v}
{m : Type v → Type w}
[Monad m]
(f : β → Float → m β)
(as : FloatArray)
(i : USize)
(stop : USize)
(b : β)
:
m β
Equations
- One or more equations did not get rendered due to their size.
Instances For
@[implemented_by FloatArray.foldlMUnsafe]
def
FloatArray.foldlM
{β : Type v}
{m : Type v → Type w}
[Monad m]
(f : β → Float → m β)
(init : β)
(as : FloatArray)
(start : optParam Nat 0)
(stop : optParam Nat (FloatArray.size as))
:
m β
Reference implementation for foldlM
Equations
- One or more equations did not get rendered due to their size.
Instances For
def
FloatArray.foldlM.loop
{β : Type v}
{m : Type v → Type w}
[Monad m]
(f : β → Float → m β)
(as : FloatArray)
(stop : Nat)
(h : stop ≤ FloatArray.size as)
(i : Nat)
(j : Nat)
(b : β)
:
m β
Equations
- One or more equations did not get rendered due to their size.
Instances For
@[inline]
def
FloatArray.foldl
{β : Type v}
(f : β → Float → β)
(init : β)
(as : FloatArray)
(start : optParam Nat 0)
(stop : optParam Nat (FloatArray.size as))
:
β
Equations
- FloatArray.foldl f init as start stop = Id.run (FloatArray.foldlM f init as start stop)
Instances For
Equations
Instances For
Equations
- List.toFloatArray.loop [] x = x
- List.toFloatArray.loop (b :: ds) x = List.toFloatArray.loop ds (FloatArray.push x b)
Instances For
Equations
- instToStringFloatArray = { toString := fun ds => List.toString (FloatArray.toList ds) }