public static DMatrixRBlock initializeQ ( DMatrixRBlock Q , int numRows , int numCols , int blockLength , boolean compact ) { int minLength = Math . min ( numRows , numCols ) ; if ( compact ) { if ( Q == null ) { Q = new DMatrixRBlock ( numRows , minLength , blockLength ) ; MatrixOps_DDRB . setIdentity ( Q ) ; } else { if ( Q . numRows != numRows || Q . numCols != minLength ) { throw new IllegalArgumentException ( "Unexpected matrix dimension. Found " + Q . numRows + " " + Q . numCols ) ; } else { MatrixOps_DDRB . setIdentity ( Q ) ; } } } else { if ( Q == null ) { Q = new DMatrixRBlock ( numRows , numRows , blockLength ) ; MatrixOps_DDRB . setIdentity ( Q ) ; } else { if ( Q . numRows != numRows || Q . numCols != numRows ) { throw new IllegalArgumentException ( "Unexpected matrix dimension. Found " + Q . numRows + " " + Q . numCols ) ; } else { MatrixOps_DDRB . setIdentity ( Q ) ; } } } return Q ; }
Sanity checks the input or declares a new matrix . Return matrix is an identity matrix .