Skip to content

Commit

Permalink
Matrix library, example RedHatOfficial#20
Browse files Browse the repository at this point in the history
  • Loading branch information
tisnik committed Dec 23, 2019
1 parent 190c527 commit e5a50a3
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions lesson7/gonum/mat20.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package main

import (
"fmt"
"gonum.org/v1/gonum/mat"
)

func main() {
v1 := mat.NewVecDense(5, nil)
v2 := mat.NewVecDense(5, []float64{1, 0, 2, 0, 3})

fmt.Printf("dot(v1, v1): %f\n", mat.Dot(v1, v1))
fmt.Printf("dot(v1, v2): %f\n", mat.Dot(v1, v2))
fmt.Printf("dot(v2, v2): %f\n", mat.Dot(v2, v2))
fmt.Printf("max(v2): %f\n", mat.Max(v2))
fmt.Printf("min(v2): %f\n", mat.Min(v2))
fmt.Printf("sum(v2): %f\n", mat.Sum(v2))
}

0 comments on commit e5a50a3

Please sign in to comment.