/** * @param matrix The matrix to return as a String * @param format The format to use for each value in the matrix, eg "%f" */ public static String toString(SimpleMatrix matrix, String format) { ByteArrayOutputStream stream = new ByteArrayOutputStream(); MatrixIO.print(new PrintStream(stream), matrix.getMatrix(), format); return stream.toString(); }
/** * <p> * Saves this matrix to a file as a serialized binary object. * </p> * * @see MatrixIO#saveBin( org.ejml.data.ReshapeMatrix64F, String) * * @param fileName * @throws java.io.IOException */ public void saveToFileBinary( String fileName ) throws IOException { MatrixIO.saveBin(mat, fileName); }
/** * <p> * Saves this matrix to a file in a CSV format. For the file format see {@link MatrixIO}. * </p> * * @see MatrixIO#saveBin( org.ejml.data.ReshapeMatrix64F, String) * * @param fileName * @throws java.io.IOException */ public void saveToFileCSV( String fileName ) throws IOException { MatrixIO.saveCSV(mat, fileName); }
/** * <p> * Loads a new matrix from a serialized binary file. * </p> * * @see MatrixIO#loadBin(String) * * @param fileName File which is to be loaded. * @return The matrix. * @throws IOException */ public static SimpleMatrix loadBinary( String fileName ) throws IOException { ReshapeMatrix64F mat = MatrixIO.loadBin(fileName); // see if its a DenseMatrix64F if( mat instanceof DenseMatrix64F ) { return SimpleMatrix.wrap((DenseMatrix64F)mat); } else { // if not convert it into one and wrap it return SimpleMatrix.wrap( new DenseMatrix64F(mat)); } }
/** * <p> * Loads a new matrix from a CSV file. For the file format see {@link MatrixIO}. * </p> * * @see MatrixIO#loadCSV(String) * * @param fileName File which is to be loaded. * @return The matrix. * @throws IOException */ public T loadCSV( String fileName ) throws IOException { RealMatrix64F mat = MatrixIO.loadCSV(fileName); T ret = createMatrix(1,1); // see if its a DenseMatrix64F if( mat instanceof DenseMatrix64F ) { ret.mat = (DenseMatrix64F)mat; } else { // if not convert it into one and wrap it ret.mat = new DenseMatrix64F(mat); } return ret; }
/** * <p> * Saves this matrix to a file as a serialized binary object. * </p> * * @see MatrixIO#saveBin( org.ejml.data.ReshapeMatrix64F, String) * * @param fileName * @throws java.io.IOException */ public void saveToFileBinary( String fileName ) throws IOException { MatrixIO.saveBin(mat, fileName); }
/** * <p> * Saves this matrix to a file in a CSV format. For the file format see {@link MatrixIO}. * </p> * * @see MatrixIO#saveBin( org.ejml.data.ReshapeMatrix64F, String) * * @param fileName * @throws java.io.IOException */ public void saveToFileCSV( String fileName ) throws IOException { MatrixIO.saveCSV(mat, fileName); }
/** * <p> * Loads a new matrix from a serialized binary file. * </p> * * @see MatrixIO#loadBin(String) * * @param fileName File which is to be loaded. * @return The matrix. * @throws IOException */ public static SimpleMatrix loadBinary( String fileName ) throws IOException { RealMatrix64F mat = MatrixIO.loadBin(fileName); // see if its a DenseMatrix64F if( mat instanceof DenseMatrix64F ) { return SimpleMatrix.wrap((DenseMatrix64F)mat); } else { // if not convert it into one and wrap it return SimpleMatrix.wrap( new DenseMatrix64F(mat)); } }
/** * <p> * Loads a new matrix from a CSV file. For the file format see {@link MatrixIO}. * </p> * * @see MatrixIO#loadCSV(String) * * @param fileName File which is to be loaded. * @return The matrix. * @throws IOException */ public static SimpleMatrix loadCSV( String fileName ) throws IOException { ReshapeMatrix64F mat = MatrixIO.loadCSV(fileName); // see if its a DenseMatrix64F if( mat instanceof DenseMatrix64F ) { return SimpleMatrix.wrap((DenseMatrix64F)mat); } else { // if not convert it into one and wrap it return SimpleMatrix.wrap( new DenseMatrix64F(mat)); } }
@Override public void print() { MatrixIO.print(System.out, this); } }
/** * <p> * Saves this matrix to a file as a serialized binary object. * </p> * * @see MatrixIO#saveBin( org.ejml.data.RealMatrix64F, String) * * @param fileName * @throws java.io.IOException */ public void saveToFileBinary( String fileName ) throws IOException { MatrixIO.saveBin(mat, fileName); }
/** * <p> * Saves this matrix to a file in a CSV format. For the file format see {@link MatrixIO}. * </p> * * @see MatrixIO#saveBin( org.ejml.data.RealMatrix64F, String) * * @param fileName * @throws java.io.IOException */ public void saveToFileCSV( String fileName ) throws IOException { MatrixIO.saveCSV(mat, fileName); }
/** * <p> * Loads a new matrix from a serialized binary file. * </p> * * @see MatrixIO#loadBin(String) * * @param fileName File which is to be loaded. * @return The matrix. * @throws IOException */ public static SimpleMatrix loadBinary( String fileName ) throws IOException { ReshapeMatrix64F mat = MatrixIO.loadBin(fileName); // see if its a DenseMatrix64F if( mat instanceof DenseMatrix64F ) { return SimpleMatrix.wrap((DenseMatrix64F)mat); } else { // if not convert it into one and wrap it return SimpleMatrix.wrap( new DenseMatrix64F(mat)); } }
/** * <p> * Loads a new matrix from a CSV file. For the file format see {@link MatrixIO}. * </p> * * @see MatrixIO#loadCSV(String) * * @param fileName File which is to be loaded. * @return The matrix. * @throws IOException */ public static SimpleMatrix loadCSV( String fileName ) throws IOException { ReshapeMatrix64F mat = MatrixIO.loadCSV(fileName); // see if its a DenseMatrix64F if( mat instanceof DenseMatrix64F ) { return SimpleMatrix.wrap((DenseMatrix64F)mat); } else { // if not convert it into one and wrap it return SimpleMatrix.wrap( new DenseMatrix64F(mat)); } }
@Override public void print() { MatrixIO.print(System.out, this); } }
/** * Prints the matrix to standard out with the specified precision. */ public void print(int numChar , int precision) { MatrixIO.print(System.out,mat,numChar,precision); }
/** * Prints the value of this matrix to the screen. For more options see * {@link UtilEjml} * */ @Override public void print() { MatrixIO.print(System.out,this); }
@Override public void print() { MatrixIO.print(System.out, this); } }
@Override public void print() { MatrixIO.print(System.out, this); } }
@Override public void print() { MatrixIO.print(System.out, this); } }