/** * Reads in a DenseMatrix64F from the IO stream. * @return DenseMatrix64F * @throws IOException If anything goes wrong. */ public DenseMatrix64F read() throws IOException { List<String> words = extractWords(); if( words.size() != 2 ) throw new IOException("Unexpected number of words on first line."); int numRows = Integer.parseInt(words.get(0)); int numCols = Integer.parseInt(words.get(1)); if( numRows < 0 || numCols < 0) throw new IOException("Invalid number of rows and/or columns: "+numRows+" "+numCols); return read(numRows,numCols); }
/** * Reads in a DenseMatrix64F from the IO stream. * @return DenseMatrix64F * @throws IOException If anything goes wrong. */ public DenseMatrix64F read() throws IOException { List<String> words = extractWords(); if( words.size() != 2 ) throw new IOException("Unexpected number of words on first line."); int numRows = Integer.parseInt(words.get(0)); int numCols = Integer.parseInt(words.get(1)); if( numRows < 0 || numCols < 0) throw new IOException("Invalid number of rows and/or columns: "+numRows+" "+numCols); return read(numRows,numCols); }
/** * Reads a matrix in which has been encoded using a Column Space Value (CSV) * file format. The number of rows and columns are read in on the first line. Then * each row is read in the subsequent lines. * * @param fileName The file being loaded. * @return DenseMatrix64F * @throws IOException */ public static DenseMatrix64F loadCSV( String fileName ) throws IOException { FileInputStream fileStream = new FileInputStream(fileName); ReadMatrixCsv csv = new ReadMatrixCsv(fileStream); DenseMatrix64F ret = csv.read(); fileStream.close(); return ret; }
/** * Reads a matrix in which has been encoded using a Column Space Value (CSV) * file format. For a description of the format see {@link MatrixIO#loadCSV(String)}. * * @param fileName The file being loaded. * @param numRows number of rows in the matrix. * @param numCols number of columns in the matrix. * @return DenseMatrix64F * @throws IOException */ public static DenseMatrix64F loadCSV( String fileName , int numRows , int numCols ) throws IOException { FileInputStream fileStream = new FileInputStream(fileName); ReadMatrixCsv csv = new ReadMatrixCsv(fileStream); DenseMatrix64F ret = csv.read(numRows,numCols); fileStream.close(); return ret; }
/** * Reads a matrix in which has been encoded using a Column Space Value (CSV) * file format. The number of rows and columns are read in on the first line. Then * each row is read in the subsequent lines. * * @param fileName The file being loaded. * @return DenseMatrix64F * @throws IOException */ public static DenseMatrix64F loadCSV( String fileName ) throws IOException { FileInputStream fileStream = new FileInputStream(fileName); ReadMatrixCsv csv = new ReadMatrixCsv(fileStream); DenseMatrix64F ret = csv.read(); fileStream.close(); return ret; }
/** * Reads a matrix in which has been encoded using a Column Space Value (CSV) * file format. For a description of the format see {@link MatrixIO#loadCSV(String)}. * * @param fileName The file being loaded. * @param numRows number of rows in the matrix. * @param numCols number of columns in the matrix. * @return DenseMatrix64F * @throws IOException */ public static DenseMatrix64F loadCSV( String fileName , int numRows , int numCols ) throws IOException { FileInputStream fileStream = new FileInputStream(fileName); ReadMatrixCsv csv = new ReadMatrixCsv(fileStream); DenseMatrix64F ret = csv.read(numRows,numCols); fileStream.close(); return ret; }