Beispiel #1
0
func testDasum(str string, n int, x []float64, incX int) {
	var natAns float64
	nat := func() { natAns = native.Implementation{}.Dasum(n, x, incX) }
	errNative := blasfuzz.CatchPanic(nat)

	cx := blasfuzz.CloneF64S(x)
	var cAns float64
	c := func() { cAns = cgo.Implementation{}.Dasum(n, cx, incX) }
	errC := blasfuzz.CatchPanic(c)

	blasfuzz.SamePanic(str, errC, errNative)
	blasfuzz.SameF64S(str, cx, x)
	blasfuzz.SameF64Approx(str, cAns, natAns, 1e-13, 1e-13)
}
Beispiel #2
0
func testDdot(str string, n int, x []float64, incX int, y []float64, incY int) {
	natX := blasfuzz.CloneF64S(x)
	natY := blasfuzz.CloneF64S(y)
	cX := blasfuzz.CloneF64S(x)
	cY := blasfuzz.CloneF64S(y)

	var natAns float64
	nat := func() { natAns = native.Implementation{}.Ddot(n, natX, incX, natY, incY) }
	errNative := blasfuzz.CatchPanic(nat)
	var cAns float64
	c := func() { cAns = cgo.Implementation{}.Ddot(n, cX, incX, cY, incY) }
	errC := blasfuzz.CatchPanic(c)

	blasfuzz.SamePanic(str, errC, errNative)
	blasfuzz.SameF64S(str, cX, natX)
	blasfuzz.SameF64S(str, cY, natY)
	blasfuzz.SameF64Approx(str, cAns, natAns, 1e-13, 1e-13)
}