public static TetradMatrix convertCovToCorr(TetradMatrix m){
  for (int i=0; i < m.rows(); i++) {
    for (int j=0; j < m.columns(); j++) {
      if (Double.isNaN(m.get(i,j))) {
        throw new IllegalArgumentException("Please remove or impute missing values.");
      }
    }
  }
  return correlation(m);
}

public static TetradMatrix convertCovToCorr ( TetradMatrix m ) { for ( int i = 0 ; i < m . rows ( ) ; i ++ ) { for ( int j = 0 ; j < m . columns ( ) ; j ++ ) { if ( Double . isNaN ( m . get ( i , j ) ) ) { throw new IllegalArgumentException ( "Please remove or impute missing values." ) ; } } } return correlation ( m ) ; }
converts a covariance matrix to a correlation matrix in place ; the same matrix is returned for convenience , but m is modified in the process .
