I'm looking to write some code to read in a dense matrix from a file, and I was wondering what are the most common storage formats that my code should support?

  • $\begingroup$ I'm wondering what level of format you mean. Certainly row-major vs. column-major ordering (for dense matrices) might be one distinction. Are you thinking about some other aspect (delimiters, binary, compressed) that could come into play? $\endgroup$
    – hardmath
    Jul 16, 2013 at 19:41
  • $\begingroup$ Silly question: unless you provide us with some more info on your application, your user base, the programming language you are going to use, the answer will be only a dumb list of matrix storage formats.x $\endgroup$
    – Stefano M
    Jul 16, 2013 at 19:51
  • 3
    $\begingroup$ The goal is a library that supports the most common existing formats. When people write dense matrices to files, what formats do they use? The programming language is irrelevant. All languages can do file I/O. How languages represent multidimensional arrays in memory is irrelevant. $\endgroup$ Jul 16, 2013 at 20:18
  • $\begingroup$ Will netCDF be an overkill for your purposes? $\endgroup$ Jul 19, 2013 at 7:55

2 Answers 2


Here are two examples:

I don't claim either is a good format...


Perhaps csv format, since I work mostly on csv so far during data analysis. You can also provide flexibility in delimiter.

Jeff's suggestion are more technical formats. They are all important if your library targets computational scientists and if you can get to them.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.