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 Zhprer interface {
14 Zhpr(uplo blas.Uplo, n int, alpha float64, x []complex128, incX int, ap []complex128)
17 func ZhprTest(t *testing.T, impl Zhprer) {
18 for tc, test := range zherTestCases {
20 for _, uplo := range []blas.Uplo{blas.Upper, blas.Lower} {
21 for _, incX := range []int{-11, -2, -1, 1, 2, 7} {
22 x := makeZVector(test.x, incX)
23 xCopy := make([]complex128, len(x))
26 ap := zPack(uplo, n, test.a, n)
27 impl.Zhpr(uplo, n, test.alpha, x, incX, ap)
28 a := zUnpackAsHermitian(uplo, n, ap)
32 want = makeZGeneral(test.want, n, n, max(1, n))
34 want = makeZGeneral(test.wantRev, n, n, max(1, n))
38 t.Errorf("Case %v (uplo=%v,incX=%v,alpha=%v): unexpected modification of x", tc, uplo, incX, test.alpha)
41 t.Errorf("Case %v (uplo=%v,incX=%v,alpha=%v): unexpected result\nwant: %v\ngot: %v", tc, uplo, incX, test.alpha, want, a)