//public static R[,] Select<T, R>(this T[,] source, Expression<Func<T, R>> kernel) // where T : unmanaged // where R : unmanaged // => Select(source.Wrap(Bounds.Skip), (cell) => kernel(cell[0, 0])); public static R[,] Select <T, R>(this IRelQueryableArray2d <T> source, Expression <Kernel <T, R> > kernel) where T : unmanaged where R : unmanaged { if (source is ArrayWrapper <T> wrapper) { return(FilterParallel(kernel, wrapper._array)); } else { throw new ArgumentOutOfRangeException(nameof(source), $"Sources of type {source.GetType()} aren't yet supported"); } }
public static R[,] Select <T, R>(this IRelQueryableArray2d <T> source, Kernel <T, R> kernel) { var h = source.GetLength(0); var w = source.GetLength(1); var result = new R[h, w]; var km = KernelMeasure.Measure(kernel); var cell = new Cell <T>(source); for (cell._x = -km.xmin; cell._x < h - km.xmax; cell._x++) { for (cell._y = -km.ymin; cell._y < w - km.ymax; cell._y++) { result[cell._x, cell._y] = kernel(cell); } } return(result); }
public static IQueryableArray2d <R> Select <T, R>(this IRelQueryableArray2d <T> source, Kernel <T, R> kernel) => new SingleSelectWrapper <T, R>(source, kernel);
public static IArray2d <R> Select <T, R>(this IRelQueryableArray2d <T> source, Kernel <T, R> kernel) => GenerateFilter(kernel)(source);