matrix-market-attoparsec: Parsing and serialization functions for the NIST Matrix Market format

[ bsd2, library, parsers ] [ Propose Tags ]
Change log CHANGELOG.markdown
Dependencies attoparsec (>=0.10), base (>=4.7 && <5), bytestring (>=0.9), exceptions, scientific (>= [details]
License BSD-2-Clause
Copyright 2017 Marco Zocca
Author Marco Zocca
Maintainer zocca marco gmail
Category Parsers
Home page
Source repo head: git clone
Uploaded by ocramz at Sun Jun 18 20:24:22 UTC 2017
Distributions LTSHaskell:, NixOS:, Stackage:, openSUSE:
Downloads 1538 total (28 in the last 30 days)
Rating 2.0 (votes: 1) [estimated by rule of succession]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2017-06-18 [all 1 reports]
Hackage Matrix CI

Parsing and serialization functions for the NIST Matrix Market format.

[Skip to Readme]




Maintainer's Corner

For package maintainers and hackage trustees

Readme for matrix-market-attoparsec-

[back to package description]


Build Status

Attoparsec parser for the NIST Matrix Market format [0].

The library also contains functions for serializing matrix data to text file.

User guide

The module Data.Matrix.MatrixMarket exports the user interface:

readMatrix :: FilePath -> IO (Matrix S.Scientific)

readArray :: FilePath -> IO (Array S.Scientific)

writeMatrix :: Show a => FilePath -> Matrix a -> IO ()

writeArray :: Show a => FilePath -> Array a -> IO ()  

The first two functions contain the parsing logic, and make use of scientific for parsing numerical data in scientific notation.

Naming convention

We follow the MatrixMarket format definitions, by which a "Matrix" is sparse and stored in coordinate format (row, column, entry), whereas an "Array" is a dense grid of numbers, stored in column-oriented form. Algebraic vectors, such as the right-hand sides of equation systems, are stored as n-by-1 Arrays.


test/LibSpec.hs contains a simple read/write/read sanity test for the included Matrix Marked data files (fidapm05.mtx and fidapm05_rhs1.mtx):

m0 <- readMatrix fname   -- load original
writeMatrix ftemp m0     -- save as temp
m1 <- readMatrix ftemp   -- load temp
m0 `shouldBe` m1         -- compare temp with original