public static void print(PrintStream out , FMatrix mat , String format ) { if( format.toLowerCase().equals("matlab")) { printMatlab(out, mat); } else if( format.toLowerCase().equals("java")) { printJava(out,mat,format); } else { printTypeSize(out, mat); format += " "; for (int row = 0; row < mat.getNumRows(); row++) { for (int col = 0; col < mat.getNumCols(); col++) { out.printf(format, mat.get(row, col)); } out.println(); } } }
/** * Prints the matrix out in a text format. The format is specified using notation from * {@link String#format(String, Object...)}. Unless the format is set to 'matlab' then it will print it out * in a format that's understood by Matlab. 'java' will print a java 2D array. * * @param out Output stream * @param mat Matrix to be printed * @param format printf style or 'matlab' */ public static void print(PrintStream out , DMatrix mat , String format ) { if( format.toLowerCase().equals("matlab")) { printMatlab(out, mat); } else if( format.toLowerCase().equals("java")) { printJava(out,mat,format); } else { printTypeSize(out, mat); format += " "; for (int row = 0; row < mat.getNumRows(); row++) { for (int col = 0; col < mat.getNumCols(); col++) { out.printf(format, mat.get(row, col)); } out.println(); } } }