public static void convert ( SquareMatrix sm ) { for ( int r = 0 ; r < sm . nRows ; ++ r ) { for ( int c = 0 ; c < sm . nCols ; ++ c ) { sm . values [ r ] [ c ] = ( r == c ) ? 1 : 0 ; } } }
Convert a square matrix into an identity matrix .