September 2017
Beginner to intermediate
304 pages
7h 2m
English
As with vectors, matrices have their own set of rules for arithmetic, along with a whole set of special operations. Some of the arithmetic associated with matrices behaves in a similar way to what you might expect. However, you need to take special care when doing things such as multiplying matrices together or taking an inverse.
Conveniently, gonum.org/v1/gonum/mat provides a nice API for this arithmetic and many other special operations. Here is an example showing a few operations, such as adding, multiplying, dividing, and so on:
// Create two matrices of the same size, a and b. a := mat.NewDense(3, 3, []float64{1, 2, 3, 0, 4, 5, 0, 0, 6}) b := mat.NewDense(3, 3, []float64{8, 9, 10, 1, 4, 2, 9, 0, 2}) // Create a third ...Read now
Unlock full access