예제 #1
0
 /**
  * Check if a column index is valid.
  *
  * @param m matrix containing the submatrix
  * @param column column index to check
  * @exception MatrixIndexException if index is not valid
  */
 public static void checkColumnIndex(final AnyMatrix m, final int column)
     throws MatrixIndexException {
   if (column < 0 || column >= m.getColumnDimension()) {
     throw new MatrixIndexException(
         "column index {0} out of allowed range [{1}, {2}]",
         column, 0, m.getColumnDimension() - 1);
   }
 }
예제 #2
0
 /**
  * Check if matrices are multiplication compatible
  *
  * @param left left hand side matrix
  * @param right right hand side matrix
  * @exception IllegalArgumentException if matrices are not multiplication compatible
  */
 public static void checkMultiplicationCompatible(final AnyMatrix left, final AnyMatrix right)
     throws IllegalArgumentException {
   if (left.getColumnDimension() != right.getRowDimension()) {
     throw MathRuntimeException.createIllegalArgumentException(
         "{0}x{1} and {2}x{3} matrices are not multiplication compatible",
         left.getRowDimension(),
         left.getColumnDimension(),
         right.getRowDimension(),
         right.getColumnDimension());
   }
 }