public static void Assign <T>(this Array arr, Func <int[], T> initFunc, MultiIndex mindex) { if (arr.GetType().GetElementType() != typeof(T)) { throw new ArgumentException("The type of the array must be the same as the type that " + nameof(initFunc) + " returns."); } while (mindex.Increment()) { int[] indices = mindex.Indices.ToArray(); arr.SetValue(initFunc(indices), indices); } }
public MultiIndexEnumerator(MultiIndex mindex) { currentMIndex = mindex; }