5.10. Matrix Manipulation
If you want to deal with numerical matrices, the standard library matrix is for you. This actually defines two separate classes, Matrix and Vector.
You should also be aware of the excellent NArray library by Masahiro Tanaka (which can be found at www.rubyforge.org). This is not a standard library but is well-known and very useful. If you have speed requirements, if you have specific data representation needs, or if you need capabilities such as Fast Fourier Transform, you should definitely look into this package. For most general purposes, however, the standard matrix library should suffice, and that is what we cover here.
To create a matrix, we naturally use a class-level method. There are multiple ways to do this. ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access