1 // Copyright ©2017 The Gonum Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
10 "gonum.org/v1/gonum/blas"
13 type Zhpmver interface {
14 Zhpmv(uplo blas.Uplo, n int, alpha complex128, ap []complex128, x []complex128, incX int, beta complex128, y []complex128, incY int)
17 func ZhpmvTest(t *testing.T, impl Zhpmver) {
18 for tc, test := range zhemvTestCases {
23 for _, incX := range []int{-11, -2, -1, 1, 2, 7} {
24 for _, incY := range []int{-11, -2, -1, 1, 2, 7} {
25 x := makeZVector(test.x, incX)
26 xCopy := make([]complex128, len(x))
29 y := makeZVector(test.y, incY)
31 ap := zPack(uplo, n, test.a, n)
32 apCopy := make([]complex128, len(ap))
35 impl.Zhpmv(test.uplo, n, alpha, ap, x, incX, beta, y, incY)
38 t.Errorf("Case %v (incX=%v,incY=%v): unexpected modification of x", tc, incX, incY)
40 if !zsame(ap, apCopy) {
41 t.Errorf("Case %v (incX=%v,incY=%v): unexpected modification of A", tc, incX, incY)
46 case incX > 0 && incY > 0:
47 want = makeZVector(test.want, incY)
48 case incX < 0 && incY > 0:
49 want = makeZVector(test.wantXNeg, incY)
50 case incX > 0 && incY < 0:
51 want = makeZVector(test.wantYNeg, incY)
53 want = makeZVector(test.wantXYNeg, incY)
56 t.Errorf("Case %v (incX=%v,incY=%v): unexpected result\nwant %v\ngot %v", tc, incX, incY, want, y)