orthogonalReduceField

Functional deep-element wise reduce of a slice composed of fields or iterators.

  1. OrthogonalReduceField!(Iterator, fun, I) orthogonalReduceField(I initialValue, Slice!Iterator slice)
    template orthogonalReduceField(alias fun)
    @optmath
    static if(__traits(isSame, naryFun!fun, fun))
    @optmath
    OrthogonalReduceField!(Iterator, fun, I)
    orthogonalReduceField
    (
    I
    Iterator
    )
    (,
    Slice!Iterator slice
    )
  2. OrthogonalReduceField!(T*, fun, I) orthogonalReduceField(I initialValue, T[] array)
  3. auto orthogonalReduceField(I initialValue, T withAsSlice)
  4. alias orthogonalReduceField = .orthogonalReduceField!(naryFun!fun)

Members

Aliases

orthogonalReduceField
alias orthogonalReduceField = .orthogonalReduceField!(naryFun!fun)
Undocumented in source.

Functions

orthogonalReduceField
OrthogonalReduceField!(T*, fun, I) orthogonalReduceField(I initialValue, T[] array)
orthogonalReduceField
OrthogonalReduceField!(Iterator, fun, I) orthogonalReduceField(I initialValue, Slice!Iterator slice)
auto orthogonalReduceField(I initialValue, T withAsSlice)

Examples

bit array operations

import mir.ndslice.slice: slicedField;
import mir.ndslice.allocation: bitSlice;
import mir.ndslice.dynamic: strided;
import mir.ndslice.topology: iota, orthogonalReduceField;
auto len = 100;
auto a = len.bitSlice;
auto b = len.bitSlice;
auto c = len.bitSlice;
a[len.iota.strided!0(7)][] = true;
b[len.iota.strided!0(11)][] = true;
c[len.iota.strided!0(13)][] = true;

// this is valid since bitslices above are oroginal slices of allocated memory.
auto and =
    orthogonalReduceField!"a & b"(size_t.max, [
        a.iterator._field._field, // get raw data pointers
        b.iterator._field._field,
        c.iterator._field._field,
    ]) // operation on size_t
    .bitwiseField
    .slicedField(len);

assert(and == (a & b & c));

Meta