NMatrix cookbook

I’ve been thinking about writing a book.

In the last couple of days, I wrote some pull requests to NMatrix and, in the process of updating documentation, the idea of writing an “Introduction to NMatrix” seemed very plausible.

In my mind, a decent table of contents would look like this:

  1. What is NMatrix and why should you care?
    • Scientific computing and the birth of SciRuby
    • The origins of NMatrix
    • Some examples
  2. How to install
    • Linux
    • OS X
    • Windows (urgh)
  3. Basic knowledge
    • What are dtypes and stypes?
    • Why NMatrix and NVector?
    • What are ATLAS and LAPACK?
  4. Starting up
  5. Shortcuts
    • Rapidly creating matrices (#zeros, #ones, #identity, #random, #seq)
    • Generating output with NVector#linspace and NVector#logspace
    • Accessing rows and columns directly (NMatrix#row and NMatrix#column)
  6. Input / Output
    • NMatrix::IO::Matlab
    • NMatrix::IO::Market
    • NMatrix’s binary format
  7. LAPACK: High performance functions
    • The 3 BLAS levels (vector, matrix-vector and matrix-matrix operations)
    • Lots and lots of functions to show and talk about.
  8. Sparse matrices and the Yale formats
    • What are sparse matrices and when would you use them
    • The Yale old and new formats
    • NMatrix sparse matrix support (new Yale, how to create, supported operations)
    • Debugging sparse operations with NMatrix::YaleFunctions
  9. How to…
    • Solve a linear system
    • Do k-means clustering easily
    • Build a crude recommendation system (Singular Value Decomposition)

There are some problems with this order and lack of content. Chapters 1, 2 and 3 are important, but I don’t know if I can merge 1 and 2 together or what. Chapter 4 should have a lot more of content, possibly merging with 5.

6, 7, and 8 are some of the most powerful features of the library and should be at the end anyway. We have some ideas that might improve these chapters or create new ones! The 9th is a cookbook, basically. It might be better to break it down and use each “recipe” as an example at the end of the previous chapters. Also, it’d be great to show some examples of tensors, etc, maybe in one of the advanced sections or something.

Obviously I still need to write a lot more to be able to sort these things out, but I’m very interested in the idea. I’ll try to have something done by the end of next week.

I’d love to hear feedback.

Leave a Reply