Gomega matchers for gonum's mat64
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
README.md
mat64.go

README.md

Gomega Matcher for gonum's mat64

This package aims to provide customized Gomega matchers for gonum's mat64.

Usage

AllCloseTo Matcher

This matcher compare two *mat64.Dense, with absolute/relative error. The matcher's signature:

AllCloseTo(expected *mat64.Dense, tol float64, relative bool)

Used with Ginkgo and Gomega:

pt3 := mat64.NewDense(3, 1, []float64{1, 3, -2})

Ω(pt3).Should(gomegamat64.AllCloseTo(
        mat64.NewDense(3, 1, []float64{1, 3, -3}),
        1e-6,
        false,
))

And if the matrix doesn't match, it will raise the error (row, column):

Expected -2 to close to -3: pos=(2, 0), tol=1e-06, relative=false