Class ReduceArrays
- java.lang.Object
-
- edu.rit.pj.reduction.ReduceArrays
-
public class ReduceArrays extends java.lang.ObjectClass ReduceArrays provides static methods for reduction operations on arrays and matrices of primitive types and object types.Note: The operations in class ReduceArrays are not multiple thread safe.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method and Description static voidreduce(boolean[][] src, Range srcRowRange, Range srcColRange, boolean[][] dst, Range dstRowRange, Range dstColRange, BooleanOp op)Combine a range of elements from one Boolean matrix with a range of elements in another Boolean matrix.static voidreduce(boolean[] src, Range srcRange, boolean[] dst, Range dstRange, BooleanOp op)Combine a range of elements from one Boolean array with a range of elements in another Boolean array.static voidreduce(byte[][] src, Range srcRowRange, Range srcColRange, byte[][] dst, Range dstRowRange, Range dstColRange, ByteOp op)Combine a range of elements from one byte matrix with a range of elements in another byte matrix.static voidreduce(byte[] src, Range srcRange, byte[] dst, Range dstRange, ByteOp op)Combine a range of elements from one byte array with a range of elements in another byte array.static voidreduce(char[][] src, Range srcRowRange, Range srcColRange, char[][] dst, Range dstRowRange, Range dstColRange, CharacterOp op)Combine a range of elements from one character matrix with a range of elements in another character matrix.static voidreduce(char[] src, Range srcRange, char[] dst, Range dstRange, CharacterOp op)Combine a range of elements from one character array with a range of elements in another character array.static voidreduce(double[][] src, Range srcRowRange, Range srcColRange, double[][] dst, Range dstRowRange, Range dstColRange, DoubleOp op)Combine a range of elements from one double matrix with a range of elements in another double matrix.static voidreduce(double[] src, Range srcRange, double[] dst, Range dstRange, DoubleOp op)Combine a range of elements from one double array with a range of elements in another double array.static voidreduce(float[][] src, Range srcRowRange, Range srcColRange, float[][] dst, Range dstRowRange, Range dstColRange, FloatOp op)Combine a range of elements from one float matrix with a range of elements in another float matrix.static voidreduce(float[] src, Range srcRange, float[] dst, Range dstRange, FloatOp op)Combine a range of elements from one float array with a range of elements in another float array.static voidreduce(int[][] src, Range srcRowRange, Range srcColRange, int[][] dst, Range dstRowRange, Range dstColRange, IntegerOp op)Combine a range of elements from one integer matrix with a range of elements in another integer matrix.static voidreduce(int[] src, Range srcRange, int[] dst, Range dstRange, IntegerOp op)Combine a range of elements from one integer array with a range of elements in another integer array.static voidreduce(long[][] src, Range srcRowRange, Range srcColRange, long[][] dst, Range dstRowRange, Range dstColRange, LongOp op)Combine a range of elements from one long matrix with a range of elements in another long matrix.static voidreduce(long[] src, Range srcRange, long[] dst, Range dstRange, LongOp op)Combine a range of elements from one long array with a range of elements in another long array.static voidreduce(short[][] src, Range srcRowRange, Range srcColRange, short[][] dst, Range dstRowRange, Range dstColRange, ShortOp op)Combine a range of elements from one short matrix with a range of elements in another short matrix.static voidreduce(short[] src, Range srcRange, short[] dst, Range dstRange, ShortOp op)Combine a range of elements from one short array with a range of elements in another short array.static <DT,ST extends DT>
voidreduce(ST[][] src, Range srcRowRange, Range srcColRange, DT[][] dst, Range dstRowRange, Range dstColRange, ObjectOp<DT> op)Combine a range of elements from one object matrix with a range of elements in another object matrix.static <DT,ST extends DT>
voidreduce(ST[] src, Range srcRange, DT[] dst, Range dstRange, ObjectOp<DT> op)Combine a range of elements from one object array with a range of elements in another object array.
-
-
-
Method Detail
-
reduce
public static void reduce(boolean[] src, Range srcRange, boolean[] dst, Range dstRange, BooleanOp op)Combine a range of elements from one Boolean array with a range of elements in another Boolean array. The number of elements combined is the smaller of srcRange's length and dstRange's length. Either or both of srcRange's and dstRange's strides may be greater than 1.For each destination array element D in the destination range and each corresponding source array element S in the source range, D is set to D op S.
- Parameters:
src- Source array.srcRange- Range of source elements.dst- Destination array.dstRange- Range of destination elements.op- Binary operation.- Throws:
java.lang.NullPointerException- (unchecked exception) Thrown if any argument is null.java.lang.IndexOutOfBoundsException- (unchecked exception) Thrown if any index in srcRange is outside the bounds of the source array. Thrown if any index in dstRange is outside the bounds of the destination array.
-
reduce
public static void reduce(byte[] src, Range srcRange, byte[] dst, Range dstRange, ByteOp op)Combine a range of elements from one byte array with a range of elements in another byte array. The number of elements combined is the smaller of srcRange's length and dstRange's length. Either or both of srcRange's and dstRange's strides may be greater than 1.For each destination array element D in the destination range and each corresponding source array element S in the source range, D is set to D op S.
- Parameters:
src- Source array.srcRange- Range of source elements.dst- Destination array.dstRange- Range of destination elements.op- Binary operation.- Throws:
java.lang.NullPointerException- (unchecked exception) Thrown if any argument is null.java.lang.IndexOutOfBoundsException- (unchecked exception) Thrown if any index in srcRange is outside the bounds of the source array. Thrown if any index in dstRange is outside the bounds of the destination array.
-
reduce
public static void reduce(char[] src, Range srcRange, char[] dst, Range dstRange, CharacterOp op)Combine a range of elements from one character array with a range of elements in another character array. The number of elements combined is the smaller of srcRange's length and dstRange's length. Either or both of srcRange's and dstRange's strides may be greater than 1.For each destination array element D in the destination range and each corresponding source array element S in the source range, D is set to D op S.
- Parameters:
src- Source array.srcRange- Range of source elements.dst- Destination array.dstRange- Range of destination elements.op- Binary operation.- Throws:
java.lang.NullPointerException- (unchecked exception) Thrown if any argument is null.java.lang.IndexOutOfBoundsException- (unchecked exception) Thrown if any index in srcRange is outside the bounds of the source array. Thrown if any index in dstRange is outside the bounds of the destination array.
-
reduce
public static void reduce(double[] src, Range srcRange, double[] dst, Range dstRange, DoubleOp op)Combine a range of elements from one double array with a range of elements in another double array. The number of elements combined is the smaller of srcRange's length and dstRange's length. Either or both of srcRange's and dstRange's strides may be greater than 1.For each destination array element D in the destination range and each corresponding source array element S in the source range, D is set to D op S.
- Parameters:
src- Source array.srcRange- Range of source elements.dst- Destination array.dstRange- Range of destination elements.op- Binary operation.- Throws:
java.lang.NullPointerException- (unchecked exception) Thrown if any argument is null.java.lang.IndexOutOfBoundsException- (unchecked exception) Thrown if any index in srcRange is outside the bounds of the source array. Thrown if any index in dstRange is outside the bounds of the destination array.
-
reduce
public static void reduce(float[] src, Range srcRange, float[] dst, Range dstRange, FloatOp op)Combine a range of elements from one float array with a range of elements in another float array. The number of elements combined is the smaller of srcRange's length and dstRange's length. Either or both of srcRange's and dstRange's strides may be greater than 1.For each destination array element D in the destination range and each corresponding source array element S in the source range, D is set to D op S.
- Parameters:
src- Source array.srcRange- Range of source elements.dst- Destination array.dstRange- Range of destination elements.op- Binary operation.- Throws:
java.lang.NullPointerException- (unchecked exception) Thrown if any argument is null.java.lang.IndexOutOfBoundsException- (unchecked exception) Thrown if any index in srcRange is outside the bounds of the source array. Thrown if any index in dstRange is outside the bounds of the destination array.
-
reduce
public static void reduce(int[] src, Range srcRange, int[] dst, Range dstRange, IntegerOp op)Combine a range of elements from one integer array with a range of elements in another integer array. The number of elements combined is the smaller of srcRange's length and dstRange's length. Either or both of srcRange's and dstRange's strides may be greater than 1.For each destination array element D in the destination range and each corresponding source array element S in the source range, D is set to D op S.
- Parameters:
src- Source array.srcRange- Range of source elements.dst- Destination array.dstRange- Range of destination elements.op- Binary operation.- Throws:
java.lang.NullPointerException- (unchecked exception) Thrown if any argument is null.java.lang.IndexOutOfBoundsException- (unchecked exception) Thrown if any index in srcRange is outside the bounds of the source array. Thrown if any index in dstRange is outside the bounds of the destination array.
-
reduce
public static void reduce(long[] src, Range srcRange, long[] dst, Range dstRange, LongOp op)Combine a range of elements from one long array with a range of elements in another long array. The number of elements combined is the smaller of srcRange's length and dstRange's length. Either or both of srcRange's and dstRange's strides may be greater than 1.For each destination array element D in the destination range and each corresponding source array element S in the source range, D is set to D op S.
- Parameters:
src- Source array.srcRange- Range of source elements.dst- Destination array.dstRange- Range of destination elements.op- Binary operation.- Throws:
java.lang.NullPointerException- (unchecked exception) Thrown if any argument is null.java.lang.IndexOutOfBoundsException- (unchecked exception) Thrown if any index in srcRange is outside the bounds of the source array. Thrown if any index in dstRange is outside the bounds of the destination array.
-
reduce
public static void reduce(short[] src, Range srcRange, short[] dst, Range dstRange, ShortOp op)Combine a range of elements from one short array with a range of elements in another short array. The number of elements combined is the smaller of srcRange's length and dstRange's length. Either or both of srcRange's and dstRange's strides may be greater than 1.For each destination array element D in the destination range and each corresponding source array element S in the source range, D is set to D op S.
- Parameters:
src- Source array.srcRange- Range of source elements.dst- Destination array.dstRange- Range of destination elements.op- Binary operation.- Throws:
java.lang.NullPointerException- (unchecked exception) Thrown if any argument is null.java.lang.IndexOutOfBoundsException- (unchecked exception) Thrown if any index in srcRange is outside the bounds of the source array. Thrown if any index in dstRange is outside the bounds of the destination array.
-
reduce
public static <DT,ST extends DT> void reduce(ST[] src, Range srcRange, DT[] dst, Range dstRange, ObjectOp<DT> op)Combine a range of elements from one object array with a range of elements in another object array. The number of elements combined is the smaller of srcRange's length and dstRange's length. Either or both of srcRange's and dstRange's strides may be greater than 1.For each destination array element D in the destination range and each corresponding source array element S in the source range, D is set to D op S.
- Type Parameters:
ST- Source array element data type.DT- Destination array element data type.- Parameters:
src- Source array.srcRange- Range of source elements.dst- Destination array.dstRange- Range of destination elements.op- Binary operation.- Throws:
java.lang.NullPointerException- (unchecked exception) Thrown if any argument is null.java.lang.IndexOutOfBoundsException- (unchecked exception) Thrown if any index in srcRange is outside the bounds of the source array. Thrown if any index in dstRange is outside the bounds of the destination array.
-
reduce
public static void reduce(boolean[][] src, Range srcRowRange, Range srcColRange, boolean[][] dst, Range dstRowRange, Range dstColRange, BooleanOp op)Combine a range of elements from one Boolean matrix with a range of elements in another Boolean matrix. The number of rows combined is the smaller of srcRowRange's length and dstRowRange's length. Within each row, the number of columns combined is the smaller of srcColRange's length and dstColRange's length. Any of srcRowRange's, srcColRange's, dstRowRange's, and dstColRange's strides may be greater than 1. It is assumed that the source matrix is fully allocated; each row in the source matrix is the same length; the destination matrix is fully allocated; and each row in the destination matrix is the same length.For each destination matrix element D in the destination row and column ranges and each corresponding source matrix element S in the source row and column ranges, D is set to D op S.
- Parameters:
src- Source matrix.srcRowRange- Range of source rows.srcColRange- Range of source columns.dst- Destination matrix.dstRowRange- Range of destination rows.dstColRange- Range of destination columns.op- Binary operation.- Throws:
java.lang.NullPointerException- (unchecked exception) Thrown if any argument is null.java.lang.IndexOutOfBoundsException- (unchecked exception) Thrown if any index in srcRowRange is outside the row bounds of the source matrix. Thrown if any index in srcColRange is outside the column bounds of the source matrix. Thrown if any index in dstRowRange is outside the row bounds of the destination matrix. Thrown if any index in dstColRange is outside the column bounds of the destination matrix.
-
reduce
public static void reduce(byte[][] src, Range srcRowRange, Range srcColRange, byte[][] dst, Range dstRowRange, Range dstColRange, ByteOp op)Combine a range of elements from one byte matrix with a range of elements in another byte matrix. The number of rows combined is the smaller of srcRowRange's length and dstRowRange's length. Within each row, the number of columns combined is the smaller of srcColRange's length and dstColRange's length. Any of srcRowRange's, srcColRange's, dstRowRange's, and dstColRange's strides may be greater than 1. It is assumed that the source matrix is fully allocated; each row in the source matrix is the same length; the destination matrix is fully allocated; and each row in the destination matrix is the same length.For each destination matrix element D in the destination row and column ranges and each corresponding source matrix element S in the source row and column ranges, D is set to D op S.
- Parameters:
src- Source matrix.srcRowRange- Range of source rows.srcColRange- Range of source columns.dst- Destination matrix.dstRowRange- Range of destination rows.dstColRange- Range of destination columns.op- Binary operation.- Throws:
java.lang.NullPointerException- (unchecked exception) Thrown if any argument is null.java.lang.IndexOutOfBoundsException- (unchecked exception) Thrown if any index in srcRowRange is outside the row bounds of the source matrix. Thrown if any index in srcColRange is outside the column bounds of the source matrix. Thrown if any index in dstRowRange is outside the row bounds of the destination matrix. Thrown if any index in dstColRange is outside the column bounds of the destination matrix.
-
reduce
public static void reduce(char[][] src, Range srcRowRange, Range srcColRange, char[][] dst, Range dstRowRange, Range dstColRange, CharacterOp op)Combine a range of elements from one character matrix with a range of elements in another character matrix. The number of rows combined is the smaller of srcRowRange's length and dstRowRange's length. Within each row, the number of columns combined is the smaller of srcColRange's length and dstColRange's length. Any of srcRowRange's, srcColRange's, dstRowRange's, and dstColRange's strides may be greater than 1. It is assumed that the source matrix is fully allocated; each row in the source matrix is the same length; the destination matrix is fully allocated; and each row in the destination matrix is the same length.For each destination matrix element D in the destination row and column ranges and each corresponding source matrix element S in the source row and column ranges, D is set to D op S.
- Parameters:
src- Source matrix.srcRowRange- Range of source rows.srcColRange- Range of source columns.dst- Destination matrix.dstRowRange- Range of destination rows.dstColRange- Range of destination columns.op- Binary operation.- Throws:
java.lang.NullPointerException- (unchecked exception) Thrown if any argument is null.java.lang.IndexOutOfBoundsException- (unchecked exception) Thrown if any index in srcRowRange is outside the row bounds of the source matrix. Thrown if any index in srcColRange is outside the column bounds of the source matrix. Thrown if any index in dstRowRange is outside the row bounds of the destination matrix. Thrown if any index in dstColRange is outside the column bounds of the destination matrix.
-
reduce
public static void reduce(double[][] src, Range srcRowRange, Range srcColRange, double[][] dst, Range dstRowRange, Range dstColRange, DoubleOp op)Combine a range of elements from one double matrix with a range of elements in another double matrix. The number of rows combined is the smaller of srcRowRange's length and dstRowRange's length. Within each row, the number of columns combined is the smaller of srcColRange's length and dstColRange's length. Any of srcRowRange's, srcColRange's, dstRowRange's, and dstColRange's strides may be greater than 1. It is assumed that the source matrix is fully allocated; each row in the source matrix is the same length; the destination matrix is fully allocated; and each row in the destination matrix is the same length.- Parameters:
src- Source matrix.srcRowRange- Range of source rows.srcColRange- Range of source columns.dst- Destination matrix.dstRowRange- Range of destination rows.dstColRange- Range of destination columns.op- Binary operation.- Throws:
java.lang.NullPointerException- (unchecked exception) Thrown if any argument is null.java.lang.IndexOutOfBoundsException- (unchecked exception) Thrown if any index in srcRowRange is outside the row bounds of the source matrix. Thrown if any index in srcColRange is outside the column bounds of the source matrix. Thrown if any index in dstRowRange is outside the row bounds of the destination matrix. Thrown if any index in dstColRange is outside the column bounds of the destination matrix.
-
reduce
public static void reduce(float[][] src, Range srcRowRange, Range srcColRange, float[][] dst, Range dstRowRange, Range dstColRange, FloatOp op)Combine a range of elements from one float matrix with a range of elements in another float matrix. The number of rows combined is the smaller of srcRowRange's length and dstRowRange's length. Within each row, the number of columns combined is the smaller of srcColRange's length and dstColRange's length. Any of srcRowRange's, srcColRange's, dstRowRange's, and dstColRange's strides may be greater than 1. It is assumed that the source matrix is fully allocated; each row in the source matrix is the same length; the destination matrix is fully allocated; and each row in the destination matrix is the same length.For each destination matrix element D in the destination row and column ranges and each corresponding source matrix element S in the source row and column ranges, D is set to D op S.
- Parameters:
src- Source matrix.srcRowRange- Range of source rows.srcColRange- Range of source columns.dst- Destination matrix.dstRowRange- Range of destination rows.dstColRange- Range of destination columns.op- Binary operation.- Throws:
java.lang.NullPointerException- (unchecked exception) Thrown if any argument is null.java.lang.IndexOutOfBoundsException- (unchecked exception) Thrown if any index in srcRowRange is outside the row bounds of the source matrix. Thrown if any index in srcColRange is outside the column bounds of the source matrix. Thrown if any index in dstRowRange is outside the row bounds of the destination matrix. Thrown if any index in dstColRange is outside the column bounds of the destination matrix.
-
reduce
public static void reduce(int[][] src, Range srcRowRange, Range srcColRange, int[][] dst, Range dstRowRange, Range dstColRange, IntegerOp op)Combine a range of elements from one integer matrix with a range of elements in another integer matrix. The number of rows combined is the smaller of srcRowRange's length and dstRowRange's length. Within each row, the number of columns combined is the smaller of srcColRange's length and dstColRange's length. Any of srcRowRange's, srcColRange's, dstRowRange's, and dstColRange's strides may be greater than 1. It is assumed that the source matrix is fully allocated; each row in the source matrix is the same length; the destination matrix is fully allocated; and each row in the destination matrix is the same length.For each destination matrix element D in the destination row and column ranges and each corresponding source matrix element S in the source row and column ranges, D is set to D op S.
- Parameters:
src- Source matrix.srcRowRange- Range of source rows.srcColRange- Range of source columns.dst- Destination matrix.dstRowRange- Range of destination rows.dstColRange- Range of destination columns.op- Binary operation.- Throws:
java.lang.NullPointerException- (unchecked exception) Thrown if any argument is null.java.lang.IndexOutOfBoundsException- (unchecked exception) Thrown if any index in srcRowRange is outside the row bounds of the source matrix. Thrown if any index in srcColRange is outside the column bounds of the source matrix. Thrown if any index in dstRowRange is outside the row bounds of the destination matrix. Thrown if any index in dstColRange is outside the column bounds of the destination matrix.
-
reduce
public static void reduce(long[][] src, Range srcRowRange, Range srcColRange, long[][] dst, Range dstRowRange, Range dstColRange, LongOp op)Combine a range of elements from one long matrix with a range of elements in another long matrix. The number of rows combined is the smaller of srcRowRange's length and dstRowRange's length. Within each row, the number of columns combined is the smaller of srcColRange's length and dstColRange's length. Any of srcRowRange's, srcColRange's, dstRowRange's, and dstColRange's strides may be greater than 1. It is assumed that the source matrix is fully allocated; each row in the source matrix is the same length; the destination matrix is fully allocated; and each row in the destination matrix is the same length.For each destination matrix element D in the destination row and column ranges and each corresponding source matrix element S in the source row and column ranges, D is set to D op S.
- Parameters:
src- Source matrix.srcRowRange- Range of source rows.srcColRange- Range of source columns.dst- Destination matrix.dstRowRange- Range of destination rows.dstColRange- Range of destination columns.op- Binary operation.- Throws:
java.lang.NullPointerException- (unchecked exception) Thrown if any argument is null.java.lang.IndexOutOfBoundsException- (unchecked exception) Thrown if any index in srcRowRange is outside the row bounds of the source matrix. Thrown if any index in srcColRange is outside the column bounds of the source matrix. Thrown if any index in dstRowRange is outside the row bounds of the destination matrix. Thrown if any index in dstColRange is outside the column bounds of the destination matrix.
-
reduce
public static void reduce(short[][] src, Range srcRowRange, Range srcColRange, short[][] dst, Range dstRowRange, Range dstColRange, ShortOp op)Combine a range of elements from one short matrix with a range of elements in another short matrix. The number of rows combined is the smaller of srcRowRange's length and dstRowRange's length. Within each row, the number of columns combined is the smaller of srcColRange's length and dstColRange's length. Any of srcRowRange's, srcColRange's, dstRowRange's, and dstColRange's strides may be greater than 1. It is assumed that the source matrix is fully allocated; each row in the source matrix is the same length; the destination matrix is fully allocated; and each row in the destination matrix is the same length.For each destination matrix element D in the destination row and column ranges and each corresponding source matrix element S in the source row and column ranges, D is set to D op S.
- Parameters:
src- Source matrix.srcRowRange- Range of source rows.srcColRange- Range of source columns.dst- Destination matrix.dstRowRange- Range of destination rows.dstColRange- Range of destination columns.op- Binary operation.- Throws:
java.lang.NullPointerException- (unchecked exception) Thrown if any argument is null.java.lang.IndexOutOfBoundsException- (unchecked exception) Thrown if any index in srcRowRange is outside the row bounds of the source matrix. Thrown if any index in srcColRange is outside the column bounds of the source matrix. Thrown if any index in dstRowRange is outside the row bounds of the destination matrix. Thrown if any index in dstColRange is outside the column bounds of the destination matrix.
-
reduce
public static <DT,ST extends DT> void reduce(ST[][] src, Range srcRowRange, Range srcColRange, DT[][] dst, Range dstRowRange, Range dstColRange, ObjectOp<DT> op)Combine a range of elements from one object matrix with a range of elements in another object matrix. The number of rows combined is the smaller of srcRowRange's length and dstRowRange's length. Within each row, the number of columns combined is the smaller of srcColRange's length and dstColRange's length. Any of srcRowRange's, srcColRange's, dstRowRange's, and dstColRange's strides may be greater than 1. It is assumed that the source matrix is fully allocated; each row in the source matrix is the same length; the destination matrix is fully allocated; and each row in the destination matrix is the same length.For each destination matrix element D in the destination row and column ranges and each corresponding source matrix element S in the source row and column ranges, D is set to D op S.
- Type Parameters:
ST- Source matrix element data type.DT- Destination matrix element data type.- Parameters:
src- Source matrix.srcRowRange- Range of source rows.srcColRange- Range of source columns.dst- Destination matrix.dstRowRange- Range of destination rows.dstColRange- Range of destination columns.op- Binary operation.- Throws:
java.lang.NullPointerException- (unchecked exception) Thrown if any argument is null.java.lang.IndexOutOfBoundsException- (unchecked exception) Thrown if any index in srcRowRange is outside the row bounds of the source matrix. Thrown if any index in srcColRange is outside the column bounds of the source matrix. Thrown if any index in dstRowRange is outside the row bounds of the destination matrix. Thrown if any index in dstColRange is outside the column bounds of the destination matrix.
-
-
DMelt 3.0 © DataMelt by jWork.ORG