private Matrix < Double > generateIdentityMatrix ( final int numDimension ) { final List < List < Double > > rows = new ArrayList <> ( numDimension ) ; for ( int i = 0 ; i < numDimension ; i ++ ) { final List < Double > row = new ArrayList <> ( numDimension ) ; for ( int j = 0 ; j < numDimension ; j ++ ) { final double value = i == j ? 1 : 0 ; row . add ( value ) ; } rows . add ( row ) ; } return new RowMatrix ( rows ) ; }
Generate an identity matrix .