Report a bug
If you spot a problem with this page, click here to create a GitHub issue.
Improve this page
Quickly fork, edit online, and submit a pull request for this page.
Requires a signed-in GitHub account. This works well for small changes.
If you'd like to make larger changes you may want to consider using
a local clone.
mir.ndslice.field
This is a submodule of mir.ndslice.
Field is a type with opIndex()(ptrdiff_t index) primitive.
An iterator can be created on top of a field using FieldIterator .
An ndslice can be created on top of a field using slicedField .
| Field Name | Used By |
|---|---|
| BitField | bitwise |
| BitpackField | bitpack |
| CycleField | cycle (2 kinds) |
| LinspaceField | linspace |
| MagicField | magic |
| MapField | map and mapField |
| ndIotaField | ndiota |
| OrthogonalReduceField | orthogonalReduceField |
| RepeatField | repeat |
| SparseField | Used for mutable DOK sparse matrixes |
License:
Authors:
Ilya Yaroshenko
- struct
MapField(Field, alias _fun); MapFieldis used by map .- Field
_field; - const @property auto
lightConst()(); - immutable @property auto
lightImmutable()(); - template
__map(alias fun1) - User defined constructor used by mapField.
- @property auto
assumeFieldsHaveZeroShift(); - Defined if Field has member
assumeFieldsHaveZeroShift.
- struct
VmapField(Field, Fun); VmapFieldis used by map .- Field
_field; - Fun
_fun; - const @property auto
lightConst()(); - immutable @property auto
lightImmutable()(); - @property auto
assumeFieldsHaveZeroShift(); - Defined if Field has member
assumeFieldsHaveZeroShift.
- struct
ZipField(Fields...) if (Fields.length > 1); - Iterates multiple fields in lockstep.
ZipFieldis used by zipFields .- Fields
_fields; - const @property auto
lightConst()(); - immutable @property auto
lightImmutable()(); - @property auto
assumeFieldsHaveZeroShift(); - Defined if at least one of Fields has member
assumeFieldsHaveZeroShift.
- struct
RepeatField(T); RepeatFieldis used by repeat .- UT
_value; - const @property @trusted auto
lightConst()(); - immutable @property @trusted auto
lightImmutable()();
- struct
BitField(Field, I = typeof(cast()Field.init[size_t.init])) if (__traits(isUnsigned, I)); BitFieldis used by bitwise .Examples:import mir.ndslice.iterator: FieldIterator; ushort[10] data; auto f = FieldIterator!(BitField!(ushort*))(0, BitField!(ushort*)(data.ptr)); f[123] = true; f++; assert(f[122]);
- Field
_field; - auto
__vmap(Fun : LeftOp!(op, bool), string op)(Funfun)
if (op == "|" || op == "&" || op == "^");
auto__vmap(Fun : RightOp!(op, bool), string op)(Funfun)
if (op == "|" || op == "&" || op == "^");
auto__vmap(Fun)(Funfun);
template__map(alias fun) - optimization for bitwise operations
- const @property auto
lightConst()(); - immutable @property auto
lightImmutable()(); - @property auto
assumeFieldsHaveZeroShift(); - Defined if Field has member
assumeFieldsHaveZeroShift.
- struct
BitpackField(Field, uint pack, I = typeof(cast()Field.init[size_t.init])) if (__traits(isUnsigned, I)); BitpackFieldis used by bitpack .Examples:import mir.ndslice.iterator: FieldIterator; ushort[10] data; auto f = FieldIterator!(BitpackField!(ushort*, 6))(0, BitpackField!(ushort*, 6)(data.ptr)); f[0] = cast(ushort) 31; f[1] = cast(ushort) 13; f[2] = cast(ushort) 8; f[3] = cast(ushort) 43; f[4] = cast(ushort) 28; f[5] = cast(ushort) 63; f[6] = cast(ushort) 39; f[7] = cast(ushort) 23; f[8] = cast(ushort) 44; assert(f[0] == 31); assert(f[1] == 13); assert(f[2] == 8); assert(f[3] == 43); assert(f[4] == 28); assert(f[5] == 63); assert(f[6] == 39); assert(f[7] == 23); assert(f[8] == 44); assert(f[9] == 0); assert(f[10] == 0); assert(f[11] == 0);
- Field
_field; - const @property auto
lightConst()(); - immutable @property auto
lightImmutable()(); - @property auto
assumeFieldsHaveZeroShift(); - Defined if Field has member
assumeFieldsHaveZeroShift.
- struct
OrthogonalReduceField(FieldsIterator, alias fun, T); -
- Slice!FieldsIterator
_fields; - non empty slice
- T
_initialValue; - const @property auto
lightConst()(); - immutable @property auto
lightImmutable()(); - auto
opIndex()(size_tindex); - r = fun(r, fields[i][
index]); reduction by i
- struct
CycleField(Field); -
- size_t
_length; - Cycle length
- Field
_field; - const @property auto
lightConst()(); - immutable @property auto
lightImmutable()(); - ref auto
opIndex()(size_tindex); - ref auto
opIndexAssign(T)(auto ref Tvalue, size_tindex); - @property auto
assumeFieldsHaveZeroShift(); - Defined if Field has member
assumeFieldsHaveZeroShift.
- struct
CycleField(Field, size_t length); -
- enum auto
_length; - Cycle length
- Field
_field; - const @property auto
lightConst()(); - immutable @property auto
lightImmutable()(); - ref auto
opIndex()(size_tindex); - ref auto
opIndexAssign(T)(auto ref Tvalue, size_tindex); - @property auto
assumeFieldsHaveZeroShift(); - Defined if Field has member
assumeFieldsHaveZeroShift.
- struct
ndIotaField(size_t N) if (N); ndIotaFieldis used by ndiota .- size_t[N - 1]
_lengths; - const @property auto
lightConst()(); - const @property auto
lightImmutable()(); - const size_t[N]
opIndex()(size_tindex);
- struct
LinspaceField(T); LinspaceFieldis used by linspace .- size_t
_length; - T
_start; - T
_stop; - const @property scope auto
lightConst()(); - const @property scope auto
lightImmutable()(); - const scope T
opIndex()(sizediff_tindex); - const @property scope size_t
length(size_t dimension = 0)()
if (dimension == 0); - const @nogc @property scope size_t[1]
shape()();
- struct
MagicField; - Magic square field.
- size_t
_n; - Magic Square size.
- @property MagicField
lightConst()(); - @property MagicField
lightImmutable()(); - @property size_t
length(size_t dimension = 0)()
if (dimension <= 2); - const pure nothrow @nogc @property @safe size_t[1]
shape(); - const pure nothrow @nogc @safe size_t
opIndex(size_tindex);
- struct
SparseField(T); SparseFieldis used to represent Sparse ndarrays in mutable DOK format.- T[size_t]
_table; - const @trusted auto
lightConst()(); - immutable @trusted auto
lightImmutable()(); - T
opIndex()(size_tindex); - T
opIndexAssign()(Tvalue, size_tindex); - T
opIndexUnary(string op)(size_tindex)
if (op == "++" || op == "--"); - T
opIndexOpAssign(string op)(Tvalue, size_tindex)
if (op == "+" || op == "-");
Copyright © 2016-2022 by Ilya Yaroshenko | Page generated by
Ddoc on Tue Jan 11 06:37:10 2022