Documentation

ScalarArray.Float64.Slice

Slices of Float64Array #

Slices of Float64Array: the type, reads, slice notation, iterators, folds and searches, membership and equality, and collecting iterators into arrays.

The slice type #

Internal representation of Float64Array.Slice.

  • array : Float64Array

    The underlying array.

  • start : Nat

    The starting index of the slice (inclusive).

  • stop : Nat

    The ending index of the slice (exclusive).

  • start_le_stop : self.start ≤ self.stop

    The starting index is no later than the ending index.

  • stop_le_array_size : self.stop ≤ self.array.size

    The ending index is no later than the end of the array.

Instances For
    @[reducible, inline]

    A region of a Float64Array: the elements from index start up to, but not including, stop. Taking a slice doesn't copy the array. Slices are written with core's slice notation, such as a[i...j], a[i...*] or a[*...j].

    Instances For
      @[inline]

      The underlying array.

      Instances For
        @[inline]

        The starting index of the slice (inclusive).

        Instances For
          @[inline]

          The ending index of the slice (exclusive).

          Instances For

            The starting index is no later than the ending index.

            The ending index is no later than the end of the array.

            @[inline]

            The size of the slice as a USize, s.size.toUSize, which bounds loops over the slice.

            Instances For

              Reads #

              @[inline]
              def ScalarArray.Float64Array.Slice.get (s : Float64Array.Slice) (i : Nat) (h : i < Std.Slice.size s := by get_elem_tactic) :

              The element at index i of the slice, counted from the start of the slice.

              Instances For
                @[inline]

                The element at index i of the slice, or v₀ if i is out of bounds.

                Instances For
                  @[reducible, inline]

                  The element at index i of the slice, or default if i is out of bounds.

                  Instances For
                    @[inline]

                    Removes the first element of the slice, if any.

                    Instances For

                      The empty slice, copies and printing #

                      The empty slice, backed by an empty array.

                      Instances For

                        The elements of the slice, copied into a new array with a single memmove.

                        Instances For
                          @[instance_reducible]

                          Prints the array and the bounds in slice notation, (ScalarArray.Float64Array.mk #[...])[i...j], which evaluates to an equal slice: slices are equal when their arrays and bounds are.

                          Slice notation #

                          @[inline]

                          The slice of a from index start up to, but not including, stop. If start or stop are not valid bounds, they are clamped to the size of a, and start is clamped to stop.

                          Instances For
                            @[instance_reducible]

                            Arrays coerce to slices, which is free. Slices don't coerce back, since that copies.

                            @[inline]

                            The slice of s from index start up to, but not including, stop, clamped like toSlice.

                            Instances For

                              Iterators #

                              The iterator over the elements of a slice, used for for loops and the generic slice API.

                              Instances For
                                @[inline]

                                One step of the iterator: the first element of the rest of the slice, if there is one.

                                Instances For
                                  @[implemented_by _private.ScalarArray.Float64.Slice.0.ScalarArray.Float64Array.SliceIterator.forInImpl]
                                  def ScalarArray.Float64Array.SliceIterator.forIn {n : Type x → Type x'} [Monad n] (lift : (γ : Type) → (δ : Type x) → (γ → n δ) → Id γ → n δ) (γ : Type x) (Pl : Float → γ → ForInStep γ → Prop) (it : Std.IterM Id Float) (init : γ) (f : (b : Float) → it.IsPlausibleIndirectOutput b → (c : γ) → n (Subtype (Pl b c))) :
                                  n γ

                                  The loop behind for loops and the Std.Iterators consumers on slices. Logically it is Std.IteratorLoop.defaultImplementation, which steps the iterator one element at a time; it is implemented by a loop over the USize indices of the underlying array.

                                  Instances For
                                    @[inline]

                                    The elements that the slice iterator it has yet to yield, as a slice of the same array, without copying. The start of the slice is the index of the next element in the array.

                                    Instances For
                                      @[inline]

                                      An iterator over the elements of a, for use with the Std.Iterators API.

                                      Instances For

                                        Folds and searches #

                                        def ScalarArray.Float64Array.Slice.foldrM {β : Type v} {m : Type v → Type w} [Monad m] (f : Float → β → m β) (init : β) (s : Float64Array.Slice) :
                                        m β

                                        Folds a monadic function over the elements of s, from last to first.

                                        Instances For
                                          @[specialize #[]]
                                          def ScalarArray.Float64Array.Slice.foldrM.loop {β : Type v} {m : Type v → Type w} [Monad m] (f : Float → β → m β) (s : Float64Array.Slice) (i : Nat) :
                                          i ≤ Std.Slice.size s → β → m β

                                          The loop of foldrM: folds f over the first i elements of s, from last to first.

                                          Instances For
                                            @[inline]
                                            def ScalarArray.Float64Array.Slice.foldrMImpl {β : Type v} {m : Type v → Type w} [Monad m] (f : Float → β → m β) (init : β) (s : Float64Array.Slice) :
                                            m β

                                            For internal use only.

                                            Instances For
                                              @[inline]
                                              def ScalarArray.Float64Array.Slice.foldr {β : Type v} (f : Float → β → β) (init : β) (s : Float64Array.Slice) :
                                              β

                                              Folds a function over the elements of s, from last to first.

                                              Instances For
                                                @[inline]

                                                Runs a monadic action on each element of s, from last to first.

                                                Instances For
                                                  def ScalarArray.Float64Array.Slice.findSomeRevM? {β : Type v} {m : Type v → Type w} [Monad m] (s : Float64Array.Slice) (f : Float → m (Option β)) :
                                                  m (Option β)

                                                  The result of the last element of s for which f returns some, searching from the end.

                                                  Instances For
                                                    @[specialize #[]]
                                                    def ScalarArray.Float64Array.Slice.findSomeRevM?.loop {β : Type v} {m : Type v → Type w} [Monad m] (s : Float64Array.Slice) (f : Float → m (Option β)) (i : Nat) :
                                                    i ≤ Std.Slice.size s → m (Option β)

                                                    The loop of findSomeRevM?: searches the first i elements of s, from the end.

                                                    Instances For
                                                      @[inline]
                                                      def ScalarArray.Float64Array.Slice.findSomeRevMImpl {β : Type v} {m : Type v → Type w} [Monad m] (s : Float64Array.Slice) (f : Float → m (Option β)) :
                                                      m (Option β)

                                                      For internal use only.

                                                      Instances For
                                                        @[inline]

                                                        The last element of s that satisfies the monadic predicate p.

                                                        Instances For
                                                          @[inline]

                                                          The last element of s that satisfies p.

                                                          Instances For
                                                            @[inline]

                                                            The first element of s that satisfies p.

                                                            Instances For
                                                              @[inline]

                                                              Whether some element of s satisfies p.

                                                              Instances For
                                                                @[inline]

                                                                Whether every element of s satisfies p.

                                                                Instances For
                                                                  @[inline]

                                                                  Whether some element of s is == to v.

                                                                  Instances For
                                                                    @[inline]

                                                                    The number of elements of s that satisfy p.

                                                                    Instances For

                                                                      Membership and equality #

                                                                      @[instance_reducible]

                                                                      x ∈ s when x is an element of s.

                                                                      Compares the elements of two slices with ==: slices of different arrays, or at different offsets, are equal when their elements are. Logically it compares the copies.

                                                                      Instances For

                                                                        For internal use only.

                                                                        Instances For

                                                                          Collecting iterators into arrays #

                                                                          @[inline]

                                                                          Collects the values emitted by an iterator into a new array. Together with the Std.Iterators combinators, this gives functions such as map, filter, take and zipWith, for example (a.iter.map (· + 1)).toFloat64Array.

                                                                          Instances For
                                                                            @[inline]

                                                                            Like Std.Iter.toFloat64Array, but the new array starts with room for capacity elements.

                                                                            Instances For