/** * 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. 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,boolean)}. * * @param fileName The file being loaded. * @param numRows number of rows in the matrix. * @param numCols number of columns in the matrix. * @return DMatrixRMaj * @throws IOException */ public static DMatrixRMaj loadCSV(String fileName , int numRows , int numCols ) throws IOException { FileInputStream fileStream = new FileInputStream(fileName); ReadMatrixCsv csv = new ReadMatrixCsv(fileStream); DMatrixRMaj ret = csv.readDDRM(numRows, numCols); 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. 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. * * Works with dense and sparse matrices. * * @param fileName The file being loaded. * @return DMatrix * @throws IOException */ public static <T extends DMatrix>T loadCSV(String fileName , boolean doublePrecision ) throws IOException { FileInputStream fileStream = new FileInputStream(fileName); ReadMatrixCsv csv = new ReadMatrixCsv(fileStream); T ret; if( doublePrecision ) ret = csv.read64(); else ret = csv.read32(); fileStream.close(); return ret; }