repa-io-3.4.1.1: Read and write Repa arrays in various formats.

Safe HaskellNone
LanguageHaskell98

Data.Array.Repa.IO.Matrix

Description

Read and write matrices as ASCII text files.

The file format is like:

     MATRIX                  -- header
     100 100                 -- width and height
     1.23 1.56 1.23 ...      -- data, separated by whitespace
     ....
  

Synopsis

Documentation

readMatrixFromTextFile :: (Num e, Read e, Unbox e) => FilePath -> IO (Array U DIM2 e)

Read a matrix from a text file.

  • WARNING: This is implemented fairly naively, just using Strings under the covers. It will be slow for large data files.
  • It also doesn't do graceful error handling. If the file has the wrong format you'll get a confusing error.

writeMatrixToTextFile :: (Show e, Source r e) => FilePath -> Array r DIM2 e -> IO ()

Write a matrix as a text file.