public class DimensionCheck extends Object
Modifier and Type | Method and Description |
---|---|
static boolean |
isArray(Table A)
Check if a table is a row or a column.
|
static boolean |
isColumn(Table A)
Check if a table is a column.
|
static boolean |
isFat(Table A)
Check if a table is fat.
|
static boolean |
isRow(Table A)
Check if a table is a row.
|
static boolean |
isSameDimension(Table A1,
Table A2)
Check if two tables have the same dimension.
|
static boolean |
isSquare(Table A)
Check if a table is square.
|
static boolean |
isTall(Table A)
Check if a table is tall.
|
static void |
throwIfDifferentDimension(Table A1,
Table A2)
Throws if
A1.nRows() != A2.nRows()
Or
A1.nCols() != A2.nCols() |
static void |
throwIfIncompatible4Multiplication(Table A1,
Table A2)
Throws if
A1.nCols() != A2.nRows() |
static void |
throwIfIncompatible4Multiplication(Table A,
Vector v)
Throws if
A.nCols() != v.size() |
static void |
throwIfInvalidColumn(Table A,
int j)
Throws if accessing an out of range column.
|
static void |
throwIfInvalidRow(Table A,
int i)
Throws if accessing an out of range row.
|
public static boolean isColumn(Table A)
A
- a tabletrue
if the table has only one columnpublic static boolean isRow(Table A)
A
- a tabletrue
if the table has only one rowpublic static boolean isArray(Table A)
A
- a tabletrue
if the table has only one row or one columnpublic static boolean isSquare(Table A)
A
- a tabletrue
if the table has as many rows as it has columnspublic static boolean isTall(Table A)
A
- a tabletrue
if the table has no fewer rows than it has columnspublic static boolean isFat(Table A)
A
- a tabletrue
if the table has no fewer columns than it has rowspublic static boolean isSameDimension(Table A1, Table A2)
A1
- a tableA2
- a tabletrue
if the rows and columns, i.e. the dimensions of A1 and A2, are equalpublic static void throwIfDifferentDimension(Table A1, Table A2)
A1.nRows() != A2.nRows()
Or
A1.nCols() != A2.nCols()
A1
- a tableA2
- a tablepublic static void throwIfInvalidRow(Table A, int i)
A
- a tablei
- a row indexpublic static void throwIfInvalidColumn(Table A, int j)
A
- a tablej
- a column indexpublic static void throwIfIncompatible4Multiplication(Table A1, Table A2)
A1.nCols() != A2.nRows()
A1
- a tableA2
- a tableCopyright © 2010-2020 NM FinTech Ltd.. All Rights Reserved.