@[extern lean_float_array_push]
Instances For
@[extern lean_float_array_uget]
Instances For
@[extern lean_float_array_fget]
Instances For
instance
FloatArray.instGetElemFloatArrayNatFloatLtInstLTNatSize :
GetElem FloatArray Nat Float fun xs i => i < FloatArray.size xs
instance
FloatArray.instGetElemFloatArrayUSizeFloatLtNatInstLTNatValSizeValSize :
GetElem FloatArray USize Float fun xs i => i.val.val < FloatArray.size xs
@[extern lean_float_array_uset]
def
FloatArray.uset
(a : FloatArray)
(i : USize)
:
Float → USize.toNat i < FloatArray.size a → FloatArray
Instances For
@[extern lean_float_array_fset]
Instances For
@[extern lean_float_array_set]
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.
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
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
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 β
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
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))
:
β
Instances For
Equations
- List.toFloatArray.loop [] x = x
- List.toFloatArray.loop (b :: ds) x = List.toFloatArray.loop ds (FloatArray.push x b)