Example #1
0
        public static ndarray upscale_to(ndarray a, object oshape)
        {
            shape newshape = NumpyExtensions.ConvertTupleToShape(oshape);

            if (newshape == null)
            {
                throw new Exception("Unable to convert shape object");
            }

            if (!broadcastable(a, newshape.iDims, newshape.iDims.Length))
            {
                throw new Exception(string.Format("operands could not be broadcast together with shapes ({0}),({1})", a.shape.ToString(), newshape.ToString()));
            }

            ndarray ret = NpyCoreApi.NpyArray_UpscaleSourceArray(a, newshape);

            return(ret.reshape(newshape));
        }