Currently geeking out as WordPress developer at WebKinder and student of computer science at ETH.

# Learning sparse matrix storage formats by building a React app

January 9, 2018

The title pretty much says it: I learned about storage formats for sparse matrices by building a small app to play around with them. You can enter numbers into a matrix and see the corresponding representation as dense array, triplet format, compressed row storage and compressed column storage (hopefully more in the future). If you don’t know what these words mean, here is the place to find out:

It took me one day to build this mainly because of some awesome tools. I really enjoyed the development process with create-react-app1 and testing with Jest2. A couple remarks:

• I spent the majority of time writing, fixing and refactoring tests. The code is easy to test because each format is essentially a mathematical function that needs to be implemented. But I changed the underlying data representation of the output halfway through, so I had to change all existing tests up to that point. Defining all functions and data representations in the beginning could possibly have prevented this, but it was not too bad after all.
• I spent zero time thinking about Babel or Webpack.
• I spent zero time formatting code because I used Prettier3 for all source files including CSS and Markdown.
• Deployment to Github pages literally took no longer than 2 minutes to setup. Now I simply type npm version patch|minor|major and the code is versioned, tested, built and deployed. I simply followed this guide.