Fork me on GitHub

src/arraymancer/tensor/private/p_accessors_macros_read

  Source Edit

Types

FancySelectorKind = enum
  FancyNone, FancyIndex, FancyMaskFull, FancyMaskAxis, FancyUnknownFull,
  FancyUnknownAxis
  Source Edit

Procs

proc getFancySelector(ast: NimNode; axis: var int; selector: var NimNode): FancySelectorKind {.
    ...raises: [], tags: [], forbids: [].}
Detect indexing in the form

or with the index selector being a tensor

  Source Edit
proc sliceDispatchImpl(result: NimNode; args: NimNode; isRead: bool) {.
    ...raises: [], tags: [], forbids: [].}
  Source Edit
proc slicer[T](t: AnyTensor[T]; ellipsis: Ellipsis;
               slices: openArray[SteppedSlice]): AnyTensor[T] {.noinit,
    noSideEffect.}
Take a Tensor, Ellipsis and SteppedSlices Returns: A copy of the original Tensor Offset and strides are changed to achieve the desired effect.   Source Edit
proc slicer[T](t: AnyTensor[T]; slices1: openArray[SteppedSlice];
               ellipsis: Ellipsis; slices2: openArray[SteppedSlice]): AnyTensor[
    T] {.noinit, noSideEffect.}
Take a Tensor, Ellipsis and SteppedSlices Returns: A copy of the original Tensor Offset and strides are changed to achieve the desired effect.   Source Edit
proc slicer[T](t: AnyTensor[T]; slices: openArray[SteppedSlice]): AnyTensor[T] {.
    noinit, noSideEffect.}
Take a Tensor and SteppedSlices Returns: A copy of the original Tensor Offset and strides are changed to achieve the desired effect.   Source Edit
proc slicer[T](t: AnyTensor[T]; slices: openArray[SteppedSlice];
               ellipsis: Ellipsis): AnyTensor[T] {.noinit, noSideEffect.}
Take a Tensor, SteppedSlices and Ellipsis Returns: A copy of the original Tensor Offset and strides are changed to achieve the desired effect.   Source Edit
proc slicer[T](t: Tensor[T]; slices: ArrayOfSlices): Tensor[T] {.noinit,
    noSideEffect.}
Take a Tensor and SteppedSlices Returns: A view of the original Tensor Offset and strides are changed to achieve the desired effect. Warning: mutating the result will mutate the original As such a var Tensor is required   Source Edit

Macros

macro slice_typed_dispatch(t: typed; args: varargs[typed]): untyped
Typed macro so that isAllInt has typed context and we can dispatch. If args are all int, we dispatch to atIndex and return T Else, all ints are converted to SteppedSlices and we return a Tensor. Note, normal slices and _ were already converted in the [] macro TODO in total we do 3 passes over the list of arguments :/. It is done only at compile time though   Source Edit

Templates

template slicerImpl[T](result: AnyTensor[T] | var AnyTensor[T];
                       slices: ArrayOfSlices): untyped
Slicing routine   Source Edit
Arraymancer Technical reference Tutorial Spellbook (How-To's) Under the hood