September 2017
Beginner to intermediate
304 pages
7h 2m
English
As mentioned here, working with vectors necessitates the use of certain vector-/matrix-specific operations and rules. For example, how do we multiply vectors together? How do we know if two vectors are similar? Both gonum.org/v1/gonum/floats and gonum.org/v1/gonum/mat provide built-in methods and functions for vector/slice operations, such as dot products, sorting, and distance. We won't cover all of the functionality here, as there is quite a bit, but we can get a general feel for how we might work with vectors. First, we can work with gonum.org/v1/gonum/floats in the following way:
// Initialize a couple of "vectors" represented as slices.vectorA := []float64{11.0, 5.2, -1.3}vectorB := []float64{-7.2, 4.2, 5.1}// Compute ...Read now
Unlock full access