Package edu.rit.util
Class Arrays
java.lang.Object
edu.rit.util.Arrays
Class Arrays provides static methods for various operations on arrays and
matrices of primitive types and object types.
Note: The operations in class Arrays are not multiple thread safe.
- Version:
- 19-Nov-2007
- Author:
- Alan Kaminsky
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
allocate
(boolean[][] matrix, int ncols) Allocate the elements in the given Boolean matrix.static void
Allocate the elements within the given row index range in the given Boolean matrix.static void
allocate
(byte[][] matrix, int ncols) Allocate the elements in the given byte matrix.static void
Allocate the elements within the given row index range in the given byte matrix.static void
allocate
(char[][] matrix, int ncols) Allocate the elements in the given character matrix.static void
Allocate the elements within the given row index range in the given character matrix.static void
allocate
(double[][] matrix, int ncols) Allocate the elements in the given double matrix.static void
Allocate the elements within the given row index range in the given double matrix.static void
allocate
(float[][] matrix, int ncols) Allocate the elements in the given float matrix.static void
Allocate the elements within the given row index range in the given float matrix.static void
allocate
(int[][] matrix, int ncols) Allocate the elements in the given integer matrix.static void
Allocate the elements within the given row index range in the given integer matrix.static void
allocate
(long[][] matrix, int ncols) Allocate the elements in the given long matrix.static void
Allocate the elements within the given row index range in the given long matrix.static void
allocate
(short[][] matrix, int ncols) Allocate the elements in the given short matrix.static void
Allocate the elements within the given row index range in the given short matrix.static <T,
ST extends T>
voidAllocate the elements in the given object matrix.static <T,
ST extends T>
voidAllocate the elements within the given row and column index ranges in the given object matrix.static <T,
ST extends T>
voidAllocate the elements within the given row index range in the given object matrix.static <T,
ST extends T>
voidAllocate the elements within the given index range in the given object array.static <T,
ST extends T>
voidAllocate all elements in the given object array.static int
colLength
(boolean[][] matrix, int i) Determine the number of columns in the given row of the given Boolean matrix.static int
colLength
(byte[][] matrix, int i) Determine the number of columns in the given row of the given byte matrix.static int
colLength
(char[][] matrix, int i) Determine the number of columns in the given row of the given character matrix.static int
colLength
(double[][] matrix, int i) Determine the number of columns in the given row of the given double matrix.static int
colLength
(float[][] matrix, int i) Determine the number of columns in the given row of the given float matrix.static int
colLength
(int[][] matrix, int i) Determine the number of columns in the given row of the given integer matrix.static int
colLength
(long[][] matrix, int i) Determine the number of columns in the given row of the given long matrix.static int
colLength
(short[][] matrix, int i) Determine the number of columns in the given row of the given short matrix.static <T> int
colLength
(T[][] matrix, int i) Determine the number of columns in the given row of the given object matrix.static void
copy
(boolean[][] src, Range srcRowRange, Range srcColRange, boolean[][] dst, Range dstRowRange, Range dstColRange) Copy a range of elements from one Boolean matrix to a range of elements in another Boolean matrix.static void
Copy a range of elements from one Boolean array to a range of elements in another Boolean array.static void
copy
(byte[][] src, Range srcRowRange, Range srcColRange, byte[][] dst, Range dstRowRange, Range dstColRange) Copy a range of elements from one byte matrix to a range of elements in another byte matrix.static void
Copy a range of elements from one byte array to a range of elements in another byte array.static void
copy
(char[][] src, Range srcRowRange, Range srcColRange, char[][] dst, Range dstRowRange, Range dstColRange) Copy a range of elements from one character matrix to a range of elements in another character matrix.static void
Copy a range of elements from one character array to a range of elements in another character array.static void
copy
(double[][] src, Range srcRowRange, Range srcColRange, double[][] dst, Range dstRowRange, Range dstColRange) Copy a range of elements from one double matrix to a range of elements in another double matrix.static void
Copy a range of elements from one double array to a range of elements in another double array.static void
copy
(float[][] src, Range srcRowRange, Range srcColRange, float[][] dst, Range dstRowRange, Range dstColRange) Copy a range of elements from one float matrix to a range of elements in another float matrix.static void
Copy a range of elements from one float array to a range of elements in another float array.static void
copy
(int[][] src, Range srcRowRange, Range srcColRange, int[][] dst, Range dstRowRange, Range dstColRange) Copy a range of elements from one integer matrix to a range of elements in another integer matrix.static void
Copy a range of elements from one integer array to a range of elements in another integer array.static void
copy
(long[][] src, Range srcRowRange, Range srcColRange, long[][] dst, Range dstRowRange, Range dstColRange) Copy a range of elements from one long matrix to a range of elements in another long matrix.static void
Copy a range of elements from one long array to a range of elements in another long array.static void
copy
(short[][] src, Range srcRowRange, Range srcColRange, short[][] dst, Range dstRowRange, Range dstColRange) Copy a range of elements from one short matrix to a range of elements in another short matrix.static void
Copy a range of elements from one short array to a range of elements in another short array.static <DT,
ST extends DT>
voidcopy
(ST[][] src, Range srcRowRange, Range srcColRange, DT[][] dst, Range dstRowRange, Range dstColRange) Copy a range of elements from one object matrix to a range of elements in another object matrix.static <DT,
ST extends DT>
voidCopy a range of elements from one object array to a range of elements in another object array.static void
deallocate
(boolean[][] matrix) Deallocate the elements in the given Boolean matrix.static void
deallocate
(boolean[][] matrix, Range rowRange) Deallocate the elements within the given row index range in the given Boolean matrix.static void
deallocate
(byte[][] matrix) Deallocate the elements in the given byte matrix.static void
deallocate
(byte[][] matrix, Range rowRange) Deallocate the elements within the given row index range in the given byte matrix.static void
deallocate
(char[][] matrix) Deallocate the elements in the given character matrix.static void
deallocate
(char[][] matrix, Range rowRange) Deallocate the elements within the given row index range in the given character matrix.static void
deallocate
(double[][] matrix) Deallocate the elements in the given double matrix.static void
deallocate
(double[][] matrix, Range rowRange) Deallocate the elements within the given row index range in the given double matrix.static void
deallocate
(float[][] matrix) Deallocate the elements in the given float matrix.static void
deallocate
(float[][] matrix, Range rowRange) Deallocate the elements within the given row index range in the given float matrix.static void
deallocate
(int[][] matrix) Deallocate the elements in the given integer matrix.static void
deallocate
(int[][] matrix, Range rowRange) Deallocate the elements within the given row index range in the given integer matrix.static void
deallocate
(long[][] matrix) Deallocate the elements in the given long matrix.static void
deallocate
(long[][] matrix, Range rowRange) Deallocate the elements within the given row index range in the given long matrix.static void
deallocate
(short[][] matrix) Deallocate the elements in the given short matrix.static void
deallocate
(short[][] matrix, Range rowRange) Deallocate the elements within the given row index range in the given short matrix.static <T> void
deallocate
(T[] array) Deallocate all elements in the given object array.static <T> void
deallocate
(T[][] matrix) Deallocate the elements in the given object matrix.static <T> void
deallocate
(T[][] matrix, Range rowRange) Deallocate the elements within the given row index range in the given object matrix.static <T> void
deallocate
(T[][] matrix, Range rowRange, Range colRange) Deallocate the elements within the given row and column index ranges in the given object matrix.static <T> void
deallocate
(T[] array, Range range) Deallocate the elements within the given index range in the given object array.static int
length
(boolean[] array) Determine the number of elements in the given Boolean array.static int
length
(byte[] array) Determine the number of elements in the given byte array.static int
length
(char[] array) Determine the number of elements in the given character array.static int
length
(double[] array) Determine the number of elements in the given double array.static int
length
(float[] array) Determine the number of elements in the given float array.static int
length
(int[] array) Determine the number of elements in the given integer array.static int
length
(long[] array) Determine the number of elements in the given long array.static int
length
(short[] array) Determine the number of elements in the given short array.static <T> int
length
(T[] array) Determine the number of elements in the given object array.static int
rowLength
(boolean[][] matrix) Determine the number of rows in the given Boolean matrix.static int
rowLength
(byte[][] matrix) Determine the number of rows in the given byte matrix.static int
rowLength
(char[][] matrix) Determine the number of rows in the given character matrix.static int
rowLength
(double[][] matrix) Determine the number of rows in the given double matrix.static int
rowLength
(float[][] matrix) Determine the number of rows in the given float matrix.static int
rowLength
(int[][] matrix) Determine the number of rows in the given integer matrix.static int
rowLength
(long[][] matrix) Determine the number of rows in the given long matrix.static int
rowLength
(short[][] matrix) Determine the number of rows in the given short matrix.static <T> int
rowLength
(T[][] matrix) Determine the number of rows in the given object matrix.
-
Method Details
-
allocate
public static <T,ST extends T> void allocate(T[] array, Class<ST> type) throws InstantiationException, IllegalAccessException Allocate all elements in the given object array. Each array element (object) is created using the given class's no-argument constructor.- Type Parameters:
T
- Array element data type.ST
- Array element data type that extends T.- Parameters:
array
- Array.type
- Class for the objects to be created.- Throws:
NullPointerException
- (unchecked exception) Thrown if any argument is null.InstantiationException
- Thrown if an instance of the given class cannot be instantiated.IllegalAccessException
- Thrown if the given class or its no-argument constructor is not accessible.InstantiationException
- if any.IllegalAccessException
- if any.
-
allocate
public static <T,ST extends T> void allocate(T[] array, Range range, Class<ST> type) throws InstantiationException, IllegalAccessException Allocate the elements within the given index range in the given object array. Each array element (object) is created using the given class's no-argument constructor.- Type Parameters:
T
- Array element data type.ST
- Array element data type that extends T.- Parameters:
array
- Array.range
- Range of indexes to allocate.type
- Class for the objects to be created.- Throws:
NullPointerException
- (unchecked exception) Thrown if any argument is null.IndexOutOfBoundsException
- (unchecked exception) Thrown if any index in therange
is outside the bounds of thearray
.InstantiationException
- Thrown if an instance of the given class cannot be instantiated.IllegalAccessException
- Thrown if the given class or its no-argument constructor is not accessible.InstantiationException
- if any.IllegalAccessException
- if any.
-
allocate
public static void allocate(boolean[][] matrix, int ncols) Allocate the elements in the given Boolean matrix. Each matrix row in the full row index range (0..matrix.length
-1) is allocated with the given number of columns.- Parameters:
matrix
- Matrix.ncols
- Number of columns in each row.- Throws:
NullPointerException
- (unchecked exception) Thrown if any argument is null.NegativeArraySizeException
- (unchecked exception) Thrown ifncols
< 0.
-
allocate
Allocate the elements within the given row index range in the given Boolean matrix. Each matrix row in the given row index range is allocated with the given number of columns.- Parameters:
matrix
- Matrix.rowRange
- Range of row indexes to allocate.ncols
- Number of columns in each row.- Throws:
NullPointerException
- (unchecked exception) Thrown if any argument is null.IndexOutOfBoundsException
- (unchecked exception) Thrown if any index in therowRange
is outside the row bounds of thematrix
.NegativeArraySizeException
- (unchecked exception) Thrown ifncols
< 0.
-
allocate
public static void allocate(byte[][] matrix, int ncols) Allocate the elements in the given byte matrix. Each matrix row in the full row index range (0..matrix.length
-1) is allocated with the given number of columns.- Parameters:
matrix
- Matrix.ncols
- Number of columns in each row.- Throws:
NullPointerException
- (unchecked exception) Thrown if any argument is null.NegativeArraySizeException
- (unchecked exception) Thrown ifncols
< 0.
-
allocate
Allocate the elements within the given row index range in the given byte matrix. Each matrix row in the given row index range is allocated with the given number of columns.- Parameters:
matrix
- Matrix.rowRange
- Range of row indexes to allocate.ncols
- Number of columns in each row.- Throws:
NullPointerException
- (unchecked exception) Thrown if any argument is null.IndexOutOfBoundsException
- (unchecked exception) Thrown if any index in therowRange
is outside the row bounds of thematrix
.NegativeArraySizeException
- (unchecked exception) Thrown ifncols
< 0.
-
allocate
public static void allocate(char[][] matrix, int ncols) Allocate the elements in the given character matrix. Each matrix row in the full row index range (0..matrix.length
-1) is allocated with the given number of columns.- Parameters:
matrix
- Matrix.ncols
- Number of columns in each row.- Throws:
NullPointerException
- (unchecked exception) Thrown if any argument is null.NegativeArraySizeException
- (unchecked exception) Thrown ifncols
< 0.
-
allocate
Allocate the elements within the given row index range in the given character matrix. Each matrix row in the given row index range is allocated with the given number of columns.- Parameters:
matrix
- Matrix.rowRange
- Range of row indexes to allocate.ncols
- Number of columns in each row.- Throws:
NullPointerException
- (unchecked exception) Thrown if any argument is null.IndexOutOfBoundsException
- (unchecked exception) Thrown if any index in therowRange
is outside the row bounds of thematrix
.NegativeArraySizeException
- (unchecked exception) Thrown ifncols
< 0.
-
allocate
public static void allocate(double[][] matrix, int ncols) Allocate the elements in the given double matrix. Each matrix row in the full row index range (0..matrix.length
-1) is allocated with the given number of columns.- Parameters:
matrix
- Matrix.ncols
- Number of columns in each row.- Throws:
NullPointerException
- (unchecked exception) Thrown if any argument is null.NegativeArraySizeException
- (unchecked exception) Thrown ifncols
< 0.
-
allocate
Allocate the elements within the given row index range in the given double matrix. Each matrix row in the given row index range is allocated with the given number of columns.- Parameters:
matrix
- Matrix.rowRange
- Range of row indexes to allocate.ncols
- Number of columns in each row.- Throws:
NullPointerException
- (unchecked exception) Thrown if any argument is null.IndexOutOfBoundsException
- (unchecked exception) Thrown if any index in therowRange
is outside the row bounds of thematrix
.NegativeArraySizeException
- (unchecked exception) Thrown ifncols
< 0.
-
allocate
public static void allocate(float[][] matrix, int ncols) Allocate the elements in the given float matrix. Each matrix row in the full row index range (0..matrix.length
-1) is allocated with the given number of columns.- Parameters:
matrix
- Matrix.ncols
- Number of columns in each row.- Throws:
NullPointerException
- (unchecked exception) Thrown if any argument is null.NegativeArraySizeException
- (unchecked exception) Thrown ifncols
< 0.
-
allocate
Allocate the elements within the given row index range in the given float matrix. Each matrix row in the given row index range is allocated with the given number of columns.- Parameters:
matrix
- Matrix.rowRange
- Range of row indexes to allocate.ncols
- Number of columns in each row.- Throws:
NullPointerException
- (unchecked exception) Thrown if any argument is null.IndexOutOfBoundsException
- (unchecked exception) Thrown if any index in therowRange
is outside the row bounds of thematrix
.NegativeArraySizeException
- (unchecked exception) Thrown ifncols
< 0.
-
allocate
public static void allocate(int[][] matrix, int ncols) Allocate the elements in the given integer matrix. Each matrix row in the full row index range (0..matrix.length
-1) is allocated with the given number of columns.- Parameters:
matrix
- Matrix.ncols
- Number of columns in each row.- Throws:
NullPointerException
- (unchecked exception) Thrown if any argument is null.NegativeArraySizeException
- (unchecked exception) Thrown ifncols
< 0.
-
allocate
Allocate the elements within the given row index range in the given integer matrix. Each matrix row in the given row index range is allocated with the given number of columns.- Parameters:
matrix
- Matrix.rowRange
- Range of row indexes to allocate.ncols
- Number of columns in each row.- Throws:
NullPointerException
- (unchecked exception) Thrown if any argument is null.IndexOutOfBoundsException
- (unchecked exception) Thrown if any index in therowRange
is outside the row bounds of thematrix
.NegativeArraySizeException
- (unchecked exception) Thrown ifncols
< 0.
-
allocate
public static void allocate(long[][] matrix, int ncols) Allocate the elements in the given long matrix. Each matrix row in the full row index range (0..matrix.length
-1) is allocated with the given number of columns.- Parameters:
matrix
- Matrix.ncols
- Number of columns in each row.- Throws:
NullPointerException
- (unchecked exception) Thrown if any argument is null.NegativeArraySizeException
- (unchecked exception) Thrown ifncols
< 0.
-
allocate
Allocate the elements within the given row index range in the given long matrix. Each matrix row in the given row index range is allocated with the given number of columns.- Parameters:
matrix
- Matrix.rowRange
- Range of row indexes to allocate.ncols
- Number of columns in each row.- Throws:
NullPointerException
- (unchecked exception) Thrown if any argument is null.IndexOutOfBoundsException
- (unchecked exception) Thrown if any index in therowRange
is outside the row bounds of thematrix
.NegativeArraySizeException
- (unchecked exception) Thrown ifncols
< 0.
-
allocate
public static void allocate(short[][] matrix, int ncols) Allocate the elements in the given short matrix. Each matrix row in the full row index range (0..matrix.length
-1) is allocated with the given number of columns.- Parameters:
matrix
- Matrix.ncols
- Number of columns in each row.- Throws:
NullPointerException
- (unchecked exception) Thrown if any argument is null.NegativeArraySizeException
- (unchecked exception) Thrown ifncols
< 0.
-
allocate
Allocate the elements within the given row index range in the given short matrix. Each matrix row in the given row index range is allocated with the given number of columns.- Parameters:
matrix
- Matrix.rowRange
- Range of row indexes to allocate.ncols
- Number of columns in each row.- Throws:
NullPointerException
- (unchecked exception) Thrown if any argument is null.IndexOutOfBoundsException
- (unchecked exception) Thrown if any index in therowRange
is outside the row bounds of thematrix
.NegativeArraySizeException
- (unchecked exception) Thrown ifncols
< 0.
-
allocate
public static <T,ST extends T> void allocate(T[][] matrix, int ncols, Class<ST> type) throws InstantiationException, IllegalAccessException Allocate the elements in the given object matrix. Each matrix row in the full row range (0..matrix.length
-1) is allocated with the given number of columns. Within each row, the full column range (0..ncols
-1) of elements is allocated. Each matrix element (object) is created using the given class's no-argument constructor.- Type Parameters:
T
- Matrix element data type.ST
- Array element data type that extends T.- Parameters:
matrix
- Matrix.ncols
- Number of columns in each row.type
- Class for the objects to be created.- Throws:
NullPointerException
- (unchecked exception) Thrown if any argument is null.NegativeArraySizeException
- (unchecked exception) Thrown ifncols
< 0.InstantiationException
- Thrown if an instance of the given class cannot be instantiated.IllegalAccessException
- Thrown if the given class or its no-argument constructor is not accessible.InstantiationException
- if any.IllegalAccessException
- if any.
-
allocate
public static <T,ST extends T> void allocate(T[][] matrix, Range rowRange, int ncols, Class<ST> type) throws InstantiationException, IllegalAccessException Allocate the elements within the given row index range in the given object matrix. Each matrix row in the given row index range is allocated with the given number of columns. Within each row, the full column range (0..ncols
-1) of elements is allocated. Each matrix element (object) is created using the given class's no-argument constructor.- Type Parameters:
T
- Matrix element data type.ST
- Array element data type that extends T.- Parameters:
matrix
- Matrix.rowRange
- Range of row indexes to allocate.ncols
- Number of columns in each row.type
- Class for the objects to be created.- Throws:
NullPointerException
- (unchecked exception) Thrown if any argument is null.IndexOutOfBoundsException
- (unchecked exception) Thrown if any index in therowRange
is outside the row bounds of thematrix
.NegativeArraySizeException
- (unchecked exception) Thrown ifncols
< 0.InstantiationException
- Thrown if an instance of the given class cannot be instantiated.IllegalAccessException
- Thrown if the given class or its no-argument constructor is not accessible.InstantiationException
- if any.IllegalAccessException
- if any.
-
allocate
public static <T,ST extends T> void allocate(T[][] matrix, Range rowRange, int ncols, Range colRange, Class<ST> type) throws InstantiationException, IllegalAccessException Allocate the elements within the given row and column index ranges in the given object matrix. Each matrix row is allocated with the given number of columns. Each matrix element (object) is created using the given class's no-argument constructor.- Type Parameters:
T
- Matrix element data type.ST
- Array element data type that extends T.- Parameters:
matrix
- Matrix.rowRange
- Range of row indexes to allocate.ncols
- Number of columns in each row.colRange
- Range of column indexes to allocate.type
- Class for the objects to be created.- Throws:
NullPointerException
- (unchecked exception) Thrown if any argument is null.IndexOutOfBoundsException
- (unchecked exception) Thrown if any index in therowRange
is outside the row bounds of thematrix
. Thrown if any index in thecolRange
is outside the bounds 0 ..ncols
-1.NegativeArraySizeException
- (unchecked exception) Thrown ifncols
< 0.InstantiationException
- Thrown if an instance of the given class cannot be instantiated.IllegalAccessException
- Thrown if the given class or its no-argument constructor is not accessible.InstantiationException
- if any.IllegalAccessException
- if any.
-
deallocate
public static <T> void deallocate(T[] array) Deallocate all elements in the given object array. Each array element is set to null.- Type Parameters:
T
- Array element data type.- Parameters:
array
- Array.- Throws:
NullPointerException
- (unchecked exception) Thrown if any argument is null.
-
deallocate
Deallocate the elements within the given index range in the given object array. Each array element is set to null.- Type Parameters:
T
- Array element data type.- Parameters:
array
- Array.range
- Range of indexes to deallocate.- Throws:
NullPointerException
- (unchecked exception) Thrown if any argument is null.IndexOutOfBoundsException
- (unchecked exception) Thrown if any index in therange
is outside the bounds of thearray
.
-
deallocate
public static void deallocate(boolean[][] matrix) Deallocate the elements in the given Boolean matrix. Each matrix row in the full row index range (0..matrix.length
-1) is set to null.- Parameters:
matrix
- Matrix.- Throws:
NullPointerException
- (unchecked exception) Thrown if any argument is null.
-
deallocate
Deallocate the elements within the given row index range in the given Boolean matrix. Each matrix row in the given row index range is set to null.- Parameters:
matrix
- Matrix.rowRange
- Range of row indexes to deallocate.- Throws:
NullPointerException
- (unchecked exception) Thrown if any argument is null.IndexOutOfBoundsException
- (unchecked exception) Thrown if any index in therowRange
is outside the row bounds of thematrix
.
-
deallocate
public static void deallocate(byte[][] matrix) Deallocate the elements in the given byte matrix. Each matrix row in the full row index range (0..matrix.length
-1) is set to null.- Parameters:
matrix
- Matrix.- Throws:
NullPointerException
- (unchecked exception) Thrown if any argument is null.
-
deallocate
Deallocate the elements within the given row index range in the given byte matrix. Each matrix row in the given row index range is set to null.- Parameters:
matrix
- Matrix.rowRange
- Range of row indexes to deallocate.- Throws:
NullPointerException
- (unchecked exception) Thrown if any argument is null.IndexOutOfBoundsException
- (unchecked exception) Thrown if any index in therowRange
is outside the row bounds of thematrix
.
-
deallocate
public static void deallocate(char[][] matrix) Deallocate the elements in the given character matrix. Each matrix row in the full row index range (0..matrix.length
-1) is set to null.- Parameters:
matrix
- Matrix.- Throws:
NullPointerException
- (unchecked exception) Thrown if any argument is null.
-
deallocate
Deallocate the elements within the given row index range in the given character matrix. Each matrix row in the given row index range is set to null.- Parameters:
matrix
- Matrix.rowRange
- Range of row indexes to deallocate.- Throws:
NullPointerException
- (unchecked exception) Thrown if any argument is null.IndexOutOfBoundsException
- (unchecked exception) Thrown if any index in therowRange
is outside the row bounds of thematrix
.
-
deallocate
public static void deallocate(double[][] matrix) Deallocate the elements in the given double matrix. Each matrix row in the full row index range (0..matrix.length
-1) is set to null.- Parameters:
matrix
- Matrix.- Throws:
NullPointerException
- (unchecked exception) Thrown if any argument is null.
-
deallocate
Deallocate the elements within the given row index range in the given double matrix. Each matrix row in the given row index range is set to null.- Parameters:
matrix
- Matrix.rowRange
- Range of row indexes to deallocate.- Throws:
NullPointerException
- (unchecked exception) Thrown if any argument is null.IndexOutOfBoundsException
- (unchecked exception) Thrown if any index in therowRange
is outside the row bounds of thematrix
.
-
deallocate
public static void deallocate(float[][] matrix) Deallocate the elements in the given float matrix. Each matrix row in the full row index range (0..matrix.length
-1) is set to null.- Parameters:
matrix
- Matrix.- Throws:
NullPointerException
- (unchecked exception) Thrown if any argument is null.
-
deallocate
Deallocate the elements within the given row index range in the given float matrix. Each matrix row in the given row index range is set to null.- Parameters:
matrix
- Matrix.rowRange
- Range of row indexes to deallocate.- Throws:
NullPointerException
- (unchecked exception) Thrown if any argument is null.IndexOutOfBoundsException
- (unchecked exception) Thrown if any index in therowRange
is outside the row bounds of thematrix
.
-
deallocate
public static void deallocate(int[][] matrix) Deallocate the elements in the given integer matrix. Each matrix row in the full row index range (0..matrix.length
-1) is set to null.- Parameters:
matrix
- Matrix.- Throws:
NullPointerException
- (unchecked exception) Thrown if any argument is null.
-
deallocate
Deallocate the elements within the given row index range in the given integer matrix. Each matrix row in the given row index range is set to null.- Parameters:
matrix
- Matrix.rowRange
- Range of row indexes to deallocate.- Throws:
NullPointerException
- (unchecked exception) Thrown if any argument is null.IndexOutOfBoundsException
- (unchecked exception) Thrown if any index in therowRange
is outside the row bounds of thematrix
.
-
deallocate
public static void deallocate(long[][] matrix) Deallocate the elements in the given long matrix. Each matrix row in the full row index range (0..matrix.length
-1) is set to null.- Parameters:
matrix
- Matrix.- Throws:
NullPointerException
- (unchecked exception) Thrown if any argument is null.
-
deallocate
Deallocate the elements within the given row index range in the given long matrix. Each matrix row in the given row index range is set to null.- Parameters:
matrix
- Matrix.rowRange
- Range of row indexes to deallocate.- Throws:
NullPointerException
- (unchecked exception) Thrown if any argument is null.IndexOutOfBoundsException
- (unchecked exception) Thrown if any index in therowRange
is outside the row bounds of thematrix
.
-
deallocate
public static void deallocate(short[][] matrix) Deallocate the elements in the given short matrix. Each matrix row in the full row index range (0..matrix.length
-1) is set to null.- Parameters:
matrix
- Matrix.- Throws:
NullPointerException
- (unchecked exception) Thrown if any argument is null.
-
deallocate
Deallocate the elements within the given row index range in the given short matrix. Each matrix row in the given row index range is set to null.- Parameters:
matrix
- Matrix.rowRange
- Range of row indexes to deallocate.- Throws:
NullPointerException
- (unchecked exception) Thrown if any argument is null.IndexOutOfBoundsException
- (unchecked exception) Thrown if any index in therowRange
is outside the row bounds of thematrix
.
-
deallocate
public static <T> void deallocate(T[][] matrix) Deallocate the elements in the given object matrix. Each matrix row in the full row index range (0..matrix.length
-1) is set to null.- Type Parameters:
T
- Matrix element data type.- Parameters:
matrix
- Matrix.- Throws:
NullPointerException
- (unchecked exception) Thrown if any argument is null.
-
deallocate
Deallocate the elements within the given row index range in the given object matrix. Each matrix row in the given row index range is set to null.- Type Parameters:
T
- Matrix element data type.- Parameters:
matrix
- Matrix.rowRange
- Range of row indexes to deallocate.- Throws:
NullPointerException
- (unchecked exception) Thrown if any argument is null.IndexOutOfBoundsException
- (unchecked exception) Thrown if any index in therowRange
is outside the row bounds of thematrix
.
-
deallocate
Deallocate the elements within the given row and column index ranges in the given object matrix. Each matrix element within the given row and column index ranges is set to null.- Type Parameters:
T
- Matrix element data type.- Parameters:
matrix
- Matrix.rowRange
- Range of row indexes to deallocate.colRange
- Range of column indexes to deallocate.- Throws:
NullPointerException
- (unchecked exception) Thrown if any argument is null.IndexOutOfBoundsException
- (unchecked exception) Thrown if any index in therowRange
is outside the row bounds of thematrix
. Thrown if any index in thecolRange
is outside the bounds 0 ..ncols
-1.
-
copy
Copy a range of elements from one Boolean array to a range of elements in another Boolean array. The number of elements copied is the smaller ofsrcRange
's length anddstRange
's length. Either or both ofsrcRange
's anddstRange
's strides may be greater than 1.- Parameters:
src
- Source array.srcRange
- Range of source elements.dst
- Destination array.dstRange
- Range of destination elements.- Throws:
NullPointerException
- (unchecked exception) Thrown if any argument is null.IndexOutOfBoundsException
- (unchecked exception) Thrown if any index insrcRange
is outside the bounds of the source array. Thrown if any index indstRange
is outside the bounds of the destination array.
-
copy
Copy a range of elements from one byte array to a range of elements in another byte array. The number of elements copied is the smaller ofsrcRange
's length anddstRange
's length. Either or both ofsrcRange
's anddstRange
's strides may be greater than 1.- Parameters:
src
- Source array.srcRange
- Range of source elements.dst
- Destination array.dstRange
- Range of destination elements.- Throws:
NullPointerException
- (unchecked exception) Thrown if any argument is null.IndexOutOfBoundsException
- (unchecked exception) Thrown if any index insrcRange
is outside the bounds of the source array. Thrown if any index indstRange
is outside the bounds of the destination array.
-
copy
Copy a range of elements from one character array to a range of elements in another character array. The number of elements copied is the smaller ofsrcRange
's length anddstRange
's length. Either or both ofsrcRange
's anddstRange
's strides may be greater than 1.- Parameters:
src
- Source array.srcRange
- Range of source elements.dst
- Destination array.dstRange
- Range of destination elements.- Throws:
NullPointerException
- (unchecked exception) Thrown if any argument is null.IndexOutOfBoundsException
- (unchecked exception) Thrown if any index insrcRange
is outside the bounds of the source array. Thrown if any index indstRange
is outside the bounds of the destination array.
-
copy
Copy a range of elements from one double array to a range of elements in another double array. The number of elements copied is the smaller ofsrcRange
's length anddstRange
's length. Either or both ofsrcRange
's anddstRange
's strides may be greater than 1.- Parameters:
src
- Source array.srcRange
- Range of source elements.dst
- Destination array.dstRange
- Range of destination elements.- Throws:
NullPointerException
- (unchecked exception) Thrown if any argument is null.IndexOutOfBoundsException
- (unchecked exception) Thrown if any index insrcRange
is outside the bounds of the source array. Thrown if any index indstRange
is outside the bounds of the destination array.
-
copy
Copy a range of elements from one float array to a range of elements in another float array. The number of elements copied is the smaller ofsrcRange
's length anddstRange
's length. Either or both ofsrcRange
's anddstRange
's strides may be greater than 1.- Parameters:
src
- Source array.srcRange
- Range of source elements.dst
- Destination array.dstRange
- Range of destination elements.- Throws:
NullPointerException
- (unchecked exception) Thrown if any argument is null.IndexOutOfBoundsException
- (unchecked exception) Thrown if any index insrcRange
is outside the bounds of the source array. Thrown if any index indstRange
is outside the bounds of the destination array.
-
copy
Copy a range of elements from one integer array to a range of elements in another integer array. The number of elements copied is the smaller ofsrcRange
's length anddstRange
's length. Either or both ofsrcRange
's anddstRange
's strides may be greater than 1.- Parameters:
src
- Source array.srcRange
- Range of source elements.dst
- Destination array.dstRange
- Range of destination elements.- Throws:
NullPointerException
- (unchecked exception) Thrown if any argument is null.IndexOutOfBoundsException
- (unchecked exception) Thrown if any index insrcRange
is outside the bounds of the source array. Thrown if any index indstRange
is outside the bounds of the destination array.
-
copy
Copy a range of elements from one long array to a range of elements in another long array. The number of elements copied is the smaller ofsrcRange
's length anddstRange
's length. Either or both ofsrcRange
's anddstRange
's strides may be greater than 1.- Parameters:
src
- Source array.srcRange
- Range of source elements.dst
- Destination array.dstRange
- Range of destination elements.- Throws:
NullPointerException
- (unchecked exception) Thrown if any argument is null.IndexOutOfBoundsException
- (unchecked exception) Thrown if any index insrcRange
is outside the bounds of the source array. Thrown if any index indstRange
is outside the bounds of the destination array.
-
copy
Copy a range of elements from one short array to a range of elements in another short array. The number of elements copied is the smaller ofsrcRange
's length anddstRange
's length. Either or both ofsrcRange
's anddstRange
's strides may be greater than 1.- Parameters:
src
- Source array.srcRange
- Range of source elements.dst
- Destination array.dstRange
- Range of destination elements.- Throws:
NullPointerException
- (unchecked exception) Thrown if any argument is null.IndexOutOfBoundsException
- (unchecked exception) Thrown if any index insrcRange
is outside the bounds of the source array. Thrown if any index indstRange
is outside the bounds of the destination array.
-
copy
Copy a range of elements from one object array to a range of elements in another object array. The number of elements copied is the smaller ofsrcRange
's length anddstRange
's length. Either or both ofsrcRange
's anddstRange
's strides may be greater than 1.Note: This method does a shallow copy. Only the references to the array elements are copied from the source array to the destination array.
- Type Parameters:
DT
- Destination array element data type.ST
- Array element data type that extends DT.- Parameters:
src
- Source array.srcRange
- Range of source elements.dst
- Destination array.dstRange
- Range of destination elements.- Throws:
NullPointerException
- (unchecked exception) Thrown if any argument is null.IndexOutOfBoundsException
- (unchecked exception) Thrown if any index insrcRange
is outside the bounds of the source array. Thrown if any index indstRange
is outside the bounds of the destination array.
-
copy
public static void copy(boolean[][] src, Range srcRowRange, Range srcColRange, boolean[][] dst, Range dstRowRange, Range dstColRange) Copy a range of elements from one Boolean matrix to a range of elements in another Boolean matrix. The number of rows copied is the smaller ofsrcRowRange
's length anddstRowRange
's length. Within each row, the number of columns copied is the smaller ofsrcColRange
's length anddstColRange
's length. Any ofsrcRowRange
's,srcColRange
's,dstRowRange
's, anddstColRange
'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.- Throws:
NullPointerException
- (unchecked exception) Thrown if any argument is null.IndexOutOfBoundsException
- (unchecked exception) Thrown if any index insrcRowRange
is outside the row bounds of the source matrix. Thrown if any index insrcColRange
is outside the column bounds of the source matrix. Thrown if any index indstRowRange
is outside the row bounds of the destination matrix. Thrown if any index indstColRange
is outside the column bounds of the destination matrix.
-
copy
public static void copy(byte[][] src, Range srcRowRange, Range srcColRange, byte[][] dst, Range dstRowRange, Range dstColRange) Copy a range of elements from one byte matrix to a range of elements in another byte matrix. The number of rows copied is the smaller ofsrcRowRange
's length anddstRowRange
's length. Within each row, the number of columns copied is the smaller ofsrcColRange
's length anddstColRange
's length. Any ofsrcRowRange
's,srcColRange
's,dstRowRange
's, anddstColRange
'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.- Throws:
NullPointerException
- (unchecked exception) Thrown if any argument is null.IndexOutOfBoundsException
- (unchecked exception) Thrown if any index insrcRowRange
is outside the row bounds of the source matrix. Thrown if any index insrcColRange
is outside the column bounds of the source matrix. Thrown if any index indstRowRange
is outside the row bounds of the destination matrix. Thrown if any index indstColRange
is outside the column bounds of the destination matrix.
-
copy
public static void copy(char[][] src, Range srcRowRange, Range srcColRange, char[][] dst, Range dstRowRange, Range dstColRange) Copy a range of elements from one character matrix to a range of elements in another character matrix. The number of rows copied is the smaller ofsrcRowRange
's length anddstRowRange
's length. Within each row, the number of columns copied is the smaller ofsrcColRange
's length anddstColRange
's length. Any ofsrcRowRange
's,srcColRange
's,dstRowRange
's, anddstColRange
'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.- Throws:
NullPointerException
- (unchecked exception) Thrown if any argument is null.IndexOutOfBoundsException
- (unchecked exception) Thrown if any index insrcRowRange
is outside the row bounds of the source matrix. Thrown if any index insrcColRange
is outside the column bounds of the source matrix. Thrown if any index indstRowRange
is outside the row bounds of the destination matrix. Thrown if any index indstColRange
is outside the column bounds of the destination matrix.
-
copy
public static void copy(double[][] src, Range srcRowRange, Range srcColRange, double[][] dst, Range dstRowRange, Range dstColRange) Copy a range of elements from one double matrix to a range of elements in another double matrix. The number of rows copied is the smaller ofsrcRowRange
's length anddstRowRange
's length. Within each row, the number of columns copied is the smaller ofsrcColRange
's length anddstColRange
's length. Any ofsrcRowRange
's,srcColRange
's,dstRowRange
's, anddstColRange
'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.- Throws:
NullPointerException
- (unchecked exception) Thrown if any argument is null.IndexOutOfBoundsException
- (unchecked exception) Thrown if any index insrcRowRange
is outside the row bounds of the source matrix. Thrown if any index insrcColRange
is outside the column bounds of the source matrix. Thrown if any index indstRowRange
is outside the row bounds of the destination matrix. Thrown if any index indstColRange
is outside the column bounds of the destination matrix.
-
copy
public static void copy(float[][] src, Range srcRowRange, Range srcColRange, float[][] dst, Range dstRowRange, Range dstColRange) Copy a range of elements from one float matrix to a range of elements in another float matrix. The number of rows copied is the smaller ofsrcRowRange
's length anddstRowRange
's length. Within each row, the number of columns copied is the smaller ofsrcColRange
's length anddstColRange
's length. Any ofsrcRowRange
's,srcColRange
's,dstRowRange
's, anddstColRange
'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.- Throws:
NullPointerException
- (unchecked exception) Thrown if any argument is null.IndexOutOfBoundsException
- (unchecked exception) Thrown if any index insrcRowRange
is outside the row bounds of the source matrix. Thrown if any index insrcColRange
is outside the column bounds of the source matrix. Thrown if any index indstRowRange
is outside the row bounds of the destination matrix. Thrown if any index indstColRange
is outside the column bounds of the destination matrix.
-
copy
public static void copy(int[][] src, Range srcRowRange, Range srcColRange, int[][] dst, Range dstRowRange, Range dstColRange) Copy a range of elements from one integer matrix to a range of elements in another integer matrix. The number of rows copied is the smaller ofsrcRowRange
's length anddstRowRange
's length. Within each row, the number of columns copied is the smaller ofsrcColRange
's length anddstColRange
's length. Any ofsrcRowRange
's,srcColRange
's,dstRowRange
's, anddstColRange
'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.- Throws:
NullPointerException
- (unchecked exception) Thrown if any argument is null.IndexOutOfBoundsException
- (unchecked exception) Thrown if any index insrcRowRange
is outside the row bounds of the source matrix. Thrown if any index insrcColRange
is outside the column bounds of the source matrix. Thrown if any index indstRowRange
is outside the row bounds of the destination matrix. Thrown if any index indstColRange
is outside the column bounds of the destination matrix.
-
copy
public static void copy(long[][] src, Range srcRowRange, Range srcColRange, long[][] dst, Range dstRowRange, Range dstColRange) Copy a range of elements from one long matrix to a range of elements in another long matrix. The number of rows copied is the smaller ofsrcRowRange
's length anddstRowRange
's length. Within each row, the number of columns copied is the smaller ofsrcColRange
's length anddstColRange
's length. Any ofsrcRowRange
's,srcColRange
's,dstRowRange
's, anddstColRange
'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.- Throws:
NullPointerException
- (unchecked exception) Thrown if any argument is null.IndexOutOfBoundsException
- (unchecked exception) Thrown if any index insrcRowRange
is outside the row bounds of the source matrix. Thrown if any index insrcColRange
is outside the column bounds of the source matrix. Thrown if any index indstRowRange
is outside the row bounds of the destination matrix. Thrown if any index indstColRange
is outside the column bounds of the destination matrix.
-
copy
public static void copy(short[][] src, Range srcRowRange, Range srcColRange, short[][] dst, Range dstRowRange, Range dstColRange) Copy a range of elements from one short matrix to a range of elements in another short matrix. The number of rows copied is the smaller ofsrcRowRange
's length anddstRowRange
's length. Within each row, the number of columns copied is the smaller ofsrcColRange
's length anddstColRange
's length. Any ofsrcRowRange
's,srcColRange
's,dstRowRange
's, anddstColRange
'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.- Throws:
NullPointerException
- (unchecked exception) Thrown if any argument is null.IndexOutOfBoundsException
- (unchecked exception) Thrown if any index insrcRowRange
is outside the row bounds of the source matrix. Thrown if any index insrcColRange
is outside the column bounds of the source matrix. Thrown if any index indstRowRange
is outside the row bounds of the destination matrix. Thrown if any index indstColRange
is outside the column bounds of the destination matrix.
-
copy
public static <DT,ST extends DT> void copy(ST[][] src, Range srcRowRange, Range srcColRange, DT[][] dst, Range dstRowRange, Range dstColRange) Copy a range of elements from one object matrix to a range of elements in another object matrix. The number of rows copied is the smaller ofsrcRowRange
's length anddstRowRange
's length. Within each row, the number of columns copied is the smaller ofsrcColRange
's length anddstColRange
's length. Any ofsrcRowRange
's,srcColRange
's,dstRowRange
's, anddstColRange
'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.Note: This method does a shallow copy. Only the references to the matrix elements are copied from the source matrix to the destination matrix.
- Type Parameters:
DT
- Destination matrix element data type.ST
- Array element data type that extends DT.- 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.- Throws:
NullPointerException
- (unchecked exception) Thrown if any argument is null.IndexOutOfBoundsException
- (unchecked exception) Thrown if any index insrcRowRange
is outside the row bounds of the source matrix. Thrown if any index insrcColRange
is outside the column bounds of the source matrix. Thrown if any index indstRowRange
is outside the row bounds of the destination matrix. Thrown if any index indstColRange
is outside the column bounds of the destination matrix.
-
length
public static int length(boolean[] array) Determine the number of elements in the given Boolean array. Ifarray
is null, 0 is returned.- Parameters:
array
- Array.- Returns:
- Number of elements in
array
.
-
length
public static int length(byte[] array) Determine the number of elements in the given byte array. Ifarray
is null, 0 is returned.- Parameters:
array
- Array.- Returns:
- Number of elements in
array
.
-
length
public static int length(char[] array) Determine the number of elements in the given character array. Ifarray
is null, 0 is returned.- Parameters:
array
- Array.- Returns:
- Number of elements in
array
.
-
length
public static int length(double[] array) Determine the number of elements in the given double array. Ifarray
is null, 0 is returned.- Parameters:
array
- Array.- Returns:
- Number of elements in
array
.
-
length
public static int length(float[] array) Determine the number of elements in the given float array. Ifarray
is null, 0 is returned.- Parameters:
array
- Array.- Returns:
- Number of elements in
array
.
-
length
public static int length(int[] array) Determine the number of elements in the given integer array. Ifarray
is null, 0 is returned.- Parameters:
array
- Array.- Returns:
- Number of elements in
array
.
-
length
public static int length(long[] array) Determine the number of elements in the given long array. Ifarray
is null, 0 is returned.- Parameters:
array
- Array.- Returns:
- Number of elements in
array
.
-
length
public static int length(short[] array) Determine the number of elements in the given short array. Ifarray
is null, 0 is returned.- Parameters:
array
- Array.- Returns:
- Number of elements in
array
.
-
length
public static <T> int length(T[] array) Determine the number of elements in the given object array. Ifarray
is null, 0 is returned.- Type Parameters:
T
- Array element data type.- Parameters:
array
- Array.- Returns:
- Number of elements in
array
.
-
rowLength
public static int rowLength(boolean[][] matrix) Determine the number of rows in the given Boolean matrix. Ifmatrix
is null, 0 is returned.- Parameters:
matrix
- Matrix.- Returns:
- Number of rows in
matrix
.
-
rowLength
public static int rowLength(byte[][] matrix) Determine the number of rows in the given byte matrix. Ifmatrix
is null, 0 is returned.- Parameters:
matrix
- Matrix.- Returns:
- Number of rows in
matrix
.
-
rowLength
public static int rowLength(char[][] matrix) Determine the number of rows in the given character matrix. Ifmatrix
is null, 0 is returned.- Parameters:
matrix
- Matrix.- Returns:
- Number of rows in
matrix
.
-
rowLength
public static int rowLength(double[][] matrix) Determine the number of rows in the given double matrix. Ifmatrix
is null, 0 is returned.- Parameters:
matrix
- Matrix.- Returns:
- Number of rows in
matrix
.
-
rowLength
public static int rowLength(float[][] matrix) Determine the number of rows in the given float matrix. Ifmatrix
is null, 0 is returned.- Parameters:
matrix
- Matrix.- Returns:
- Number of rows in
matrix
.
-
rowLength
public static int rowLength(int[][] matrix) Determine the number of rows in the given integer matrix. Ifmatrix
is null, 0 is returned.- Parameters:
matrix
- Matrix.- Returns:
- Number of rows in
matrix
.
-
rowLength
public static int rowLength(long[][] matrix) Determine the number of rows in the given long matrix. Ifmatrix
is null, 0 is returned.- Parameters:
matrix
- Matrix.- Returns:
- Number of rows in
matrix
.
-
rowLength
public static int rowLength(short[][] matrix) Determine the number of rows in the given short matrix. Ifmatrix
is null, 0 is returned.- Parameters:
matrix
- Matrix.- Returns:
- Number of rows in
matrix
.
-
rowLength
public static <T> int rowLength(T[][] matrix) Determine the number of rows in the given object matrix. Ifmatrix
is null, 0 is returned.- Type Parameters:
T
- Matrix element data type.- Parameters:
matrix
- Matrix.- Returns:
- Number of rows in
matrix
.
-
colLength
public static int colLength(boolean[][] matrix, int i) Determine the number of columns in the given row of the given Boolean matrix. Ifmatrix
is null or the given row is not allocated, 0 is returned.- Parameters:
matrix
- Matrix.i
- Row index.- Returns:
- Number of rows in
matrix
. - Throws:
ArrayIndexOutOfBoundsException
- (unchecked exception) Thrown ifi
is out of bounds.
-
colLength
public static int colLength(byte[][] matrix, int i) Determine the number of columns in the given row of the given byte matrix. Ifmatrix
is null or the given row is not allocated, 0 is returned.- Parameters:
matrix
- Matrix.i
- Row index.- Returns:
- Number of rows in
matrix
. - Throws:
ArrayIndexOutOfBoundsException
- (unchecked exception) Thrown ifi
is out of bounds.
-
colLength
public static int colLength(char[][] matrix, int i) Determine the number of columns in the given row of the given character matrix. Ifmatrix
is null or the given row is not allocated, 0 is returned.- Parameters:
matrix
- Matrix.i
- Row index.- Returns:
- Number of rows in
matrix
. - Throws:
ArrayIndexOutOfBoundsException
- (unchecked exception) Thrown ifi
is out of bounds.
-
colLength
public static int colLength(double[][] matrix, int i) Determine the number of columns in the given row of the given double matrix. Ifmatrix
is null or the given row is not allocated, 0 is returned.- Parameters:
matrix
- Matrix.i
- Row index.- Returns:
- Number of rows in
matrix
. - Throws:
ArrayIndexOutOfBoundsException
- (unchecked exception) Thrown ifi
is out of bounds.
-
colLength
public static int colLength(float[][] matrix, int i) Determine the number of columns in the given row of the given float matrix. Ifmatrix
is null or the given row is not allocated, 0 is returned.- Parameters:
matrix
- Matrix.i
- Row index.- Returns:
- Number of rows in
matrix
. - Throws:
ArrayIndexOutOfBoundsException
- (unchecked exception) Thrown ifi
is out of bounds.
-
colLength
public static int colLength(int[][] matrix, int i) Determine the number of columns in the given row of the given integer matrix. Ifmatrix
is null or the given row is not allocated, 0 is returned.- Parameters:
matrix
- Matrix.i
- Row index.- Returns:
- Number of rows in
matrix
. - Throws:
ArrayIndexOutOfBoundsException
- (unchecked exception) Thrown ifi
is out of bounds.
-
colLength
public static int colLength(long[][] matrix, int i) Determine the number of columns in the given row of the given long matrix. Ifmatrix
is null or the given row is not allocated, 0 is returned.- Parameters:
matrix
- Matrix.i
- Row index.- Returns:
- Number of rows in
matrix
. - Throws:
ArrayIndexOutOfBoundsException
- (unchecked exception) Thrown ifi
is out of bounds.
-
colLength
public static int colLength(short[][] matrix, int i) Determine the number of columns in the given row of the given short matrix. Ifmatrix
is null or the given row is not allocated, 0 is returned.- Parameters:
matrix
- Matrix.i
- Row index.- Returns:
- Number of rows in
matrix
. - Throws:
ArrayIndexOutOfBoundsException
- (unchecked exception) Thrown ifi
is out of bounds.
-
colLength
public static <T> int colLength(T[][] matrix, int i) Determine the number of columns in the given row of the given object matrix. Ifmatrix
is null or the given row is not allocated, 0 is returned.- Type Parameters:
T
- Matrix element data type.- Parameters:
matrix
- Matrix.i
- Row index.- Returns:
- Number of rows in
matrix
. - Throws:
ArrayIndexOutOfBoundsException
- (unchecked exception) Thrown ifi
is out of bounds.
-