public override IEnumerator <T> GetEnumerator <T>(ArraySlice <T> data) { // since the sliced array is a subset of the original we have to copy here int size = UnreducedShape.Size; // the algorithm is split into 1-D and N-D because for 1-D we need not go through shape.GetDimIndexOutShape if (Slices.Length == 1) { for (var i = 0; i < size; i++) { yield return(data.GetValue(i)); } } else { for (var i = 0; i < size; i++) { yield return(data.GetValue(UnreducedShape.GetCoords(i))); } } }
public ArraySlice(ArraySlice <T> data, string slices) : this(data, Slice.ParseSlices(slices)) { }
public virtual IEnumerator <T> GetEnumerator <T>(ArraySlice <T> array) { return(array.GetEnumerator()); }