Skip to content
/ gomat Public

Package gomat is a simple matrix implemenation in Go. We make a light attempt at optimising cache locality, however it is by no means the most optimal implementation.

License

Notifications You must be signed in to change notification settings

acatovic/gomat

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Gomat

Package gomat is a simple matrix implemenation in Go. At its core is the Matrix struct, which simply wraps a slice of floats, i.e. []float64. The package exposes a set of functions that create, operate on, and return Matrix structs. We make a light attempt at optimising cache locality; however it is by no means the most optimal implementation.

To install gomat simply run go get github.com/acatovic/gomat.

Examples

Adding two matrices

import (
  "fmt"
  "github.com/acatovic/gomat"
)

func main() {
  ma := gomat.Randn(16, 4)
  mb := gomat.Randn(16, 4)
  mc := gomat.Add(ma, mb)
  fmt.Println(mc)
}

Dot product

import (
  "fmt"
  "github.com/acatovic/gomat"
)

func main() {
  ma := gomat.New([][]float64{{1, 2},
                              {3, 4},
                              {5, 6}})
  mb := gomat.New([][]float64{{1, 2},
                              {3, 4}})
  mc := gomat.Dot(ma, mb)
  fmt.Println(mc)
}

About

Package gomat is a simple matrix implemenation in Go. We make a light attempt at optimising cache locality, however it is by no means the most optimal implementation.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages