Class DimensionCheck


  • public class DimensionCheck
    extends Object
    These are the utility functions for checking table dimension.
    • Method Detail

      • isColumn

        public static boolean isColumn​(Table A)
        Check if a table is a column.
        Parameters:
        A - a table
        Returns:
        true if the table has only one column
      • isRow

        public static boolean isRow​(Table A)
        Check if a table is a row.
        Parameters:
        A - a table
        Returns:
        true if the table has only one row
      • isArray

        public static boolean isArray​(Table A)
        Check if a table is a row or a column.
        Parameters:
        A - a table
        Returns:
        true if the table has only one row or one column
      • isSquare

        public static boolean isSquare​(Table A)
        Check if a table is square.
        Parameters:
        A - a table
        Returns:
        true if the table has as many rows as it has columns
      • isTall

        public static boolean isTall​(Table A)
        Check if a table is tall.
        Parameters:
        A - a table
        Returns:
        true if the table has no fewer rows than it has columns
      • isFat

        public static boolean isFat​(Table A)
        Check if a table is fat.
        Parameters:
        A - a table
        Returns:
        true if the table has no fewer columns than it has rows
      • isSameDimension

        public static boolean isSameDimension​(Table A1,
                                              Table A2)
        Check if two tables have the same dimension.
        Parameters:
        A1 - a table
        A2 - a table
        Returns:
        true if the rows and columns, i.e. the dimensions of A1 and A2, are equal
      • throwIfDifferentDimension

        public static void throwIfDifferentDimension​(Table A1,
                                                     Table A2)
        Throws if
        A1.nRows() != A2.nRows()
        Or
        A1.nCols() != A2.nCols()
        Parameters:
        A1 - a table
        A2 - a table
      • throwIfInvalidRow

        public static void throwIfInvalidRow​(Table A,
                                             int i)
        Throws if accessing an out of range row.
        Parameters:
        A - a table
        i - a row index
      • throwIfInvalidColumn

        public static void throwIfInvalidColumn​(Table A,
                                                int j)
        Throws if accessing an out of range column.
        Parameters:
        A - a table
        j - a column index
      • throwIfIncompatible4Multiplication

        public static void throwIfIncompatible4Multiplication​(Table A1,
                                                              Table A2)
        Throws if
        A1.nCols() != A2.nRows()
        Parameters:
        A1 - a table
        A2 - a table
      • throwIfIncompatible4Multiplication

        public static void throwIfIncompatible4Multiplication​(Table A,
                                                              Vector v)
        Throws if
        A.nCols() != v.size()
        Parameters:
        A - a table
        v - a vector