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 Zhpr2er interface {
14 Zhpr2(uplo blas.Uplo, n int, alpha complex128, x []complex128, incX int, y []complex128, incY int, ap []complex128)
17 func Zhpr2Test(t *testing.T, impl Zhpr2er) {
18 for tc, test := range zher2TestCases {
22 for _, uplo := range []blas.Uplo{blas.Upper, blas.Lower} {
23 x := makeZVector(test.x, incX)
24 xCopy := make([]complex128, len(x))
27 y := makeZVector(test.y, incY)
28 yCopy := make([]complex128, len(y))
31 ap := zPack(uplo, n, test.a, n)
32 impl.Zhpr2(uplo, n, test.alpha, x, incX, y, incY, ap)
33 a := zUnpackAsHermitian(uplo, n, ap)
36 t.Errorf("Case %v (uplo=%v,incX=%v,incY=%v): unexpected modification of x", tc, uplo, incX, incY)
39 t.Errorf("Case %v (uplo=%v,incX=%v,incY=%v): unexpected modification of y", tc, uplo, incX, incY)
41 if !zsame(test.want, a) {
42 t.Errorf("Case %v (uplo=%v,incX=%v,incY=%v): unexpected result\nwant: %v\ngot: %v", tc, uplo, incX, incY, test.want, a)