Exemplo n.º 1
0
        /// <summary>
        /// An N-dimensional iterator object to index arrays.
        /// </summary>
        public ndindex(object oshape)
        {
            shape newshape = NumpyExtensions.ConvertTupleToShape(oshape);

            var x = np.as_strided(np.zeros(1), shape: newshape.iDims, strides: np.zeros_like(newshape.iDims, dtype: np.intp).ToArray <npy_intp>());

            core = new nditer(x);
        }
Exemplo n.º 2
0
        public bool MoveNext()
        {
            if (current == null)
            {
                current = core;
            }

            return(core.MoveNext());
        }
Exemplo n.º 3
0
        /// <summary>
        /// Produce an object that mimics broadcasting.
        /// </summary>
        /// <param name="aobjects">Input parameters.</param>
        /// <returns></returns>
        public static broadcast broadcast(params object[] aobjects)
        {
            ndarray[] arrays = new ndarray[aobjects.Length];

            for (int i = 0; i < aobjects.Length; i++)
            {
                arrays[i] = asanyarray(aobjects[i]);
            }

            var nditer = new nditer(arrays);

            broadcast bcast = new broadcast(nditer);

            return(bcast);
        }
Exemplo n.º 4
0
 public broadcast(nditer iter)
 {
     core = iter;
 }