Exemplo n.º 1
0
        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);
            }
        }
Exemplo n.º 2
0
 public MultiIndexEnumerator(MultiIndex mindex)
 {
     currentMIndex = mindex;
 }