Пример #1
0
 /**
  * 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 DMatrixRMaj
  * @throws IOException
  * @throws InvalidCastException (if type is ZMatrixRMaj instead of DMatrixRMaj)
  */
 public static Matrix loadCSV(string fileName)
 {
     using (var stream = new FileStream(fileName, FileMode.Open, FileAccess.Read))
     {
         ReadMatrixCsv csv = new ReadMatrixCsv(stream);
         Matrix        ret = csv.read();
         return(ret);
     }
 }
Пример #2
0
 /**
  * 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 DMatrixRMaj
  * @throws IOException
  */
 public static DMatrixRMaj loadCSV(string fileName, int numRows, int numCols)
 {
     using (var stream = new FileStream(fileName, FileMode.Open, FileAccess.Read))
     {
         ReadMatrixCsv csv = new ReadMatrixCsv(stream);
         DMatrixRMaj   ret = csv.readReal(numRows, numCols);
         stream.Close();
         return(ret);
     }
 }