/** * <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> * 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)); } }
/** * <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)); } }