public static DMatrixRMaj identity ( int numRows , int numCols ) { DMatrixRMaj ret = new DMatrixRMaj ( numRows , numCols ) ; int small = numRows < numCols ? numRows : numCols ; for ( int i = 0 ; i < small ; i ++ ) { ret . set ( i , i , 1.0 ) ; } return ret ; }
Creates a rectangular matrix which is zero except along the diagonals .