예제 #1
0
파일: all.go 프로젝트: btracey/blasfuzz
func testDrotm(str string, n int, x []float64, incX int, y []float64, incY int, param blas.DrotmParams) {
	natX := blasfuzz.CloneF64S(x)
	natY := blasfuzz.CloneF64S(y)
	cX := blasfuzz.CloneF64S(x)
	cY := blasfuzz.CloneF64S(y)
	nat := func() { native.Implementation{}.Drotm(n, natX, incX, natY, incY, param) }
	errNative := blasfuzz.CatchPanic(nat)
	cFunc := func() { cgo.Implementation{}.Drotm(n, cX, incX, cY, incY, param) }
	errC := blasfuzz.CatchPanic(cFunc)

	blasfuzz.SamePanic(str, errC, errNative)
	blasfuzz.SameF64S(str, cX, natX)
	blasfuzz.SameF64S(str, cY, natY)
}
예제 #2
0
파일: all.go 프로젝트: btracey/blasfuzz
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)
}
예제 #3
0
파일: twovec.go 프로젝트: btracey/blasfuzz
func testDaxpy(str string, n int, alpha float64, x []float64, incX int, y []float64, incY int) {
	natX := blasfuzz.CloneF64S(x)
	natY := blasfuzz.CloneF64S(y)
	cX := blasfuzz.CloneF64S(x)
	cY := blasfuzz.CloneF64S(y)

	nat := func() { native.Implementation{}.Daxpy(n, alpha, natX, incX, natY, incY) }
	errNative := blasfuzz.CatchPanic(nat)
	c := func() { cgo.Implementation{}.Daxpy(n, alpha, cX, incX, cY, incY) }
	errC := blasfuzz.CatchPanic(c)
	if n == 0 {
		str2 := fmt.Sprintf("cerr = %v, naterr = %v", errC, errNative)
		panic(str2)
	}
	blasfuzz.SamePanic(str, errC, errNative)
	blasfuzz.SameF64S(str, cX, natX)
	blasfuzz.SameF64S(str, cY, natY)
}
예제 #4
0
파일: all.go 프로젝트: btracey/blasfuzz
func testDscal(str string, n int, x []float64, incX int, alpha float64) {
	natX := blasfuzz.CloneF64S(x)
	nat := func() { native.Implementation{}.Dscal(n, alpha, natX, incX) }
	errNative := blasfuzz.CatchPanic(nat)

	cx := blasfuzz.CloneF64S(x)
	c := func() { cgo.Implementation{}.Dscal(n, alpha, cx, incX) }
	errC := blasfuzz.CatchPanic(c)

	blasfuzz.SamePanic(str, errC, errNative)
	blasfuzz.SameF64S(str, cx, natX)
}
예제 #5
0
파일: all.go 프로젝트: btracey/blasfuzz
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)
}
예제 #6
0
파일: all.go 프로젝트: btracey/blasfuzz
func testIdamax(str string, n int, x []float64, incX int) {
	var natAns int
	nat := func() { natAns = native.Implementation{}.Idamax(n, x, incX) }
	errNative := blasfuzz.CatchPanic(nat)

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

	blasfuzz.SamePanic(str, errC, errNative)
	blasfuzz.SameF64S(str, cx, x)
	// Known issue: If the slice contains NaN the answer may vary
	if !floats.HasNaN(x) {
		blasfuzz.SameInt(str, cAns, natAns)
	}
}