OSDN Git Service

new repo
[bytom/vapor.git] / vendor / gonum.org / v1 / gonum / blas / testblas / level1double.go
1 // Copyright ©2015 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.
4
5 package testblas
6
7 import (
8         "fmt"
9         "log"
10
11         "gonum.org/v1/gonum/blas"
12         "gonum.org/v1/gonum/floats"
13
14         "math"
15         "testing"
16 )
17
18 type DoubleOneVectorCase struct {
19         Name       string
20         X          []float64
21         Incx       int
22         N          int
23         Panic      bool
24         Dasum      float64
25         Dnrm2      float64
26         Idamax     int
27         DscalCases []DScalCase
28 }
29
30 type DScalCase struct {
31         Alpha float64
32         Ans   []float64
33         Name  string
34 }
35
36 var DoubleOneVectorCases = []DoubleOneVectorCase{
37         {
38                 Name:   "AllPositive",
39                 X:      []float64{6, 5, 4, 2, 6},
40                 Incx:   1,
41                 N:      5,
42                 Panic:  false,
43                 Dasum:  23,
44                 Dnrm2:  10.81665382639196787935766380241148783875388972153573863813135,
45                 Idamax: 0,
46                 DscalCases: []DScalCase{
47                         {
48                                 Alpha: 0,
49                                 Ans:   []float64{0, 0, 0, 0, 0},
50                         },
51                         {
52                                 Alpha: 1,
53                                 Ans:   []float64{6, 5, 4, 2, 6},
54                         },
55                         {
56                                 Alpha: -2,
57                                 Ans:   []float64{-12, -10, -8, -4, -12},
58                         },
59                 },
60         },
61         {
62                 Name:   "LeadingZero",
63                 X:      []float64{0, 1},
64                 Incx:   1,
65                 N:      2,
66                 Panic:  false,
67                 Dasum:  1,
68                 Dnrm2:  1,
69                 Idamax: 1,
70                 DscalCases: []DScalCase{
71                         {
72                                 Alpha: 0,
73                                 Ans:   []float64{0, 0},
74                         },
75                         {
76                                 Alpha: 1,
77                                 Ans:   []float64{0, 1},
78                         },
79                         {
80                                 Alpha: -2,
81                                 Ans:   []float64{0, -2},
82                         },
83                 },
84         },
85         {
86                 Name:   "MaxInMiddle",
87                 X:      []float64{6, 5, 9, 0, 6},
88                 Incx:   1,
89                 N:      5,
90                 Panic:  false,
91                 Dasum:  26,
92                 Dnrm2:  13.34166406412633371248943627250846646911846482744007727141318,
93                 Idamax: 2,
94                 DscalCases: []DScalCase{
95                         {
96                                 Alpha: -2,
97                                 Ans:   []float64{-12, -10, -18, 0, -12},
98                         },
99                 },
100         },
101         {
102                 Name:   "MaxAtEnd",
103                 X:      []float64{6, 5, -9, 0, 10},
104                 Incx:   1,
105                 N:      5,
106                 Panic:  false,
107                 Dasum:  30,
108                 Dnrm2:  15.55634918610404553681857596630667886426639062914642880494347,
109                 Idamax: 4,
110                 DscalCases: []DScalCase{
111                         {
112                                 Alpha: -2,
113                                 Ans:   []float64{-12, -10, 18, 0, -20},
114                         },
115                 },
116         },
117         {
118                 Name:   "AllNegative",
119                 X:      []float64{-6, -5, -4, -2, -6},
120                 Incx:   1,
121                 N:      5,
122                 Panic:  false,
123                 Dasum:  23,
124                 Dnrm2:  10.81665382639196787935766380241148783875388972153573863813135,
125                 Idamax: 0,
126                 DscalCases: []DScalCase{
127                         {
128                                 Alpha: -2,
129                                 Ans:   []float64{12, 10, 8, 4, 12},
130                         },
131                 },
132         },
133         {
134                 Name:   "AllMixed",
135                 X:      []float64{-6, 5, 4, -2, -6},
136                 Incx:   1,
137                 N:      5,
138                 Panic:  false,
139                 Dasum:  23,
140                 Dnrm2:  10.81665382639196787935766380241148783875388972153573863813135,
141                 Idamax: 0,
142                 DscalCases: []DScalCase{
143                         {
144                                 Alpha: -2,
145                                 Ans:   []float64{12, -10, -8, 4, 12},
146                         },
147                 },
148         },
149         {
150                 Name:   "ZeroN",
151                 X:      []float64{-6, 5, 4, -2, -6},
152                 Incx:   1,
153                 N:      0,
154                 Panic:  false,
155                 Dasum:  0,
156                 Dnrm2:  0,
157                 Idamax: -1,
158                 DscalCases: []DScalCase{
159                         {
160                                 Alpha: -2,
161                                 Ans:   []float64{-6, 5, 4, -2, -6},
162                         },
163                 },
164         },
165         {
166                 Name:   "OneN",
167                 X:      []float64{-6, 5, 4, -2, -6},
168                 Incx:   1,
169                 N:      1,
170                 Panic:  false,
171                 Dasum:  6,
172                 Dnrm2:  6,
173                 Idamax: 0,
174                 DscalCases: []DScalCase{
175                         {
176                                 Alpha: -2,
177                                 Ans:   []float64{12, 5, 4, -2, -6},
178                         },
179                 },
180         },
181         {
182                 Name:   "PositiveExactInc",
183                 X:      []float64{-6, 5, 10, -2, -5},
184                 Incx:   2,
185                 N:      3,
186                 Panic:  false,
187                 Dasum:  21,
188                 Dnrm2:  12.68857754044952038019377274608948979173952662752515253090272,
189                 Idamax: 1,
190                 DscalCases: []DScalCase{
191                         {
192                                 Alpha: -2,
193                                 Ans:   []float64{12, 5, -20, -2, 10},
194                         },
195                 },
196         },
197         {
198                 Name:   "PositiveOffInc",
199                 X:      []float64{-6, 5, 4, -2, -6, 8, 10, 11},
200                 Incx:   3,
201                 N:      3,
202                 Panic:  false,
203                 Dasum:  18,
204                 Dnrm2:  11.83215956619923208513465658312323409683100246158868064575943,
205                 Idamax: 2,
206                 DscalCases: []DScalCase{
207                         {
208                                 Alpha: -2,
209                                 Ans:   []float64{12, 5, 4, 4, -6, 8, -20, 11},
210                         },
211                 },
212         },
213         {
214                 Name:   "PositiveShortInc",
215                 X:      []float64{-6, 5, 4, -2, -6, 8, 10, 11},
216                 Incx:   3,
217                 N:      2,
218                 Panic:  false,
219                 Dasum:  8,
220                 Dnrm2:  6.324555320336758663997787088865437067439110278650433653715009,
221                 Idamax: 0,
222                 DscalCases: []DScalCase{
223                         {
224                                 Alpha: -2,
225                                 Ans:   []float64{12, 5, 4, 4, -6, 8, 10, 11},
226                         },
227                 },
228         },
229         {
230                 Name:   "NegativeInc",
231                 X:      []float64{-6, 5, 4, -2, -6},
232                 Incx:   -1,
233                 N:      5,
234                 Panic:  false,
235                 Dasum:  0,
236                 Dnrm2:  0,
237                 Idamax: -1,
238                 DscalCases: []DScalCase{
239                         {
240                                 Alpha: -2,
241                                 Ans:   []float64{-6, 5, 4, -2, -6},
242                         },
243                 },
244         },
245         {
246                 Name:   "NegativeExactInc",
247                 X:      []float64{-6, 5, 4, -2, -6},
248                 Incx:   -2,
249                 N:      3,
250                 Panic:  false,
251                 Dasum:  0,
252                 Dnrm2:  0,
253                 Idamax: -1,
254                 DscalCases: []DScalCase{
255                         {
256                                 Alpha: -2,
257                                 Ans:   []float64{-6, 5, 4, -2, -6},
258                         },
259                 },
260         },
261         {
262                 Name:   "NegativeOffInc",
263                 X:      []float64{-6, 5, 4, -2, -6, 8, 10, 11},
264                 Incx:   -3,
265                 N:      2,
266                 Panic:  false,
267                 Dasum:  0,
268                 Dnrm2:  0,
269                 Idamax: -1,
270                 DscalCases: []DScalCase{
271                         {
272                                 Alpha: -2,
273                                 Ans:   []float64{-6, 5, 4, -2, -6, 8, 10, 11},
274                         },
275                 },
276         },
277         {
278                 Name:   "NegativeShortInc",
279                 X:      []float64{-6, 5, 4, -2, -6, 8, 10, 11},
280                 Incx:   -3,
281                 N:      2,
282                 Panic:  false,
283                 Dasum:  0,
284                 Dnrm2:  0,
285                 Idamax: -1,
286                 DscalCases: []DScalCase{
287                         {
288                                 Alpha: -2,
289                                 Ans:   []float64{-6, 5, 4, -2, -6, 8, 10, 11},
290                         },
291                 },
292         },
293         {
294                 Name:  "NegativeN",
295                 X:     []float64{-6, 5, 4, -2, -6},
296                 Incx:  2,
297                 N:     -5,
298                 Panic: true,
299                 DscalCases: []DScalCase{
300                         {
301                                 Alpha: -2,
302                                 Ans:   []float64{-6, 5, 4, -2, -6},
303                         },
304                 },
305         },
306         {
307                 Name:  "ZeroInc",
308                 X:     []float64{-6, 5, 4, -2, -6},
309                 Incx:  0,
310                 N:     5,
311                 Panic: true,
312                 DscalCases: []DScalCase{
313                         {
314                                 Alpha: -2,
315                                 Ans:   []float64{-6, 5, 4, -2, -6},
316                         },
317                 },
318         },
319         {
320                 Name:  "OutOfBounds",
321                 X:     []float64{-6, 5, 4, -2, -6},
322                 Incx:  2,
323                 N:     6,
324                 Panic: true,
325                 DscalCases: []DScalCase{
326                         {
327                                 Alpha: -2,
328                                 Ans:   []float64{-6, 5, 4, -2, -6},
329                         },
330                 },
331         },
332         {
333                 Name:   "NegativeOutOfBounds",
334                 X:      []float64{-6, 5, 4, -2, -6},
335                 Incx:   -2,
336                 N:      6,
337                 Panic:  false,
338                 Dasum:  0,
339                 Dnrm2:  0,
340                 Idamax: -1,
341                 DscalCases: []DScalCase{
342                         {
343                                 Alpha: -2,
344                                 Ans:   []float64{-6, 5, 4, -2, -6},
345                         },
346                 },
347         },
348         {
349                 Name:   "NaN",
350                 X:      []float64{math.NaN(), 2.0},
351                 Incx:   1,
352                 N:      2,
353                 Panic:  false,
354                 Dasum:  math.NaN(),
355                 Dnrm2:  math.NaN(),
356                 Idamax: 0,
357                 DscalCases: []DScalCase{
358                         {
359                                 Alpha: -2,
360                                 Ans:   []float64{math.NaN(), -4.0},
361                         },
362                         {
363                                 Alpha: 0,
364                                 Ans:   []float64{0, 0},
365                         },
366                 },
367         },
368         {
369                 Name:   "NaNInc",
370                 X:      []float64{math.NaN(), math.NaN(), 2.0},
371                 Incx:   2,
372                 N:      2,
373                 Panic:  false,
374                 Dasum:  math.NaN(),
375                 Dnrm2:  math.NaN(),
376                 Idamax: 0,
377                 DscalCases: []DScalCase{
378                         {
379                                 Alpha: -2,
380                                 Ans:   []float64{math.NaN(), math.NaN(), -4.0},
381                         },
382                         {
383                                 Alpha: 0,
384                                 Ans:   []float64{0, math.NaN(), 0},
385                         },
386                 },
387         },
388         {
389                 Name:   "Empty",
390                 X:      []float64{},
391                 Incx:   1,
392                 N:      0,
393                 Panic:  false,
394                 Dasum:  0,
395                 Dnrm2:  0,
396                 Idamax: -1,
397                 DscalCases: []DScalCase{
398                         {
399                                 Alpha: -2,
400                                 Ans:   []float64{},
401                         },
402                         {
403                                 Alpha: 0,
404                                 Ans:   []float64{},
405                         },
406                 },
407         },
408         {
409                 Name:   "EmptyZeroInc",
410                 X:      []float64{},
411                 Incx:   0,
412                 N:      0,
413                 Panic:  true,
414                 Dasum:  0,
415                 Dnrm2:  0,
416                 Idamax: -1,
417                 DscalCases: []DScalCase{
418                         {
419                                 Alpha: -2,
420                                 Ans:   []float64{},
421                         },
422                         {
423                                 Alpha: 0,
424                                 Ans:   []float64{},
425                         },
426                 },
427         },
428         {
429                 Name:   "EmptyReverse",
430                 X:      []float64{},
431                 Incx:   -1,
432                 N:      0,
433                 Panic:  false,
434                 Dasum:  0,
435                 Dnrm2:  0,
436                 Idamax: -1,
437                 DscalCases: []DScalCase{
438                         {
439                                 Alpha: -2,
440                                 Ans:   []float64{},
441                         },
442                         {
443                                 Alpha: 0,
444                                 Ans:   []float64{},
445                         },
446                 },
447         },
448         {
449                 Name:   "MultiInf",
450                 X:      []float64{5, math.Inf(1), math.Inf(-1), 8, 9},
451                 Incx:   1,
452                 N:      5,
453                 Panic:  false,
454                 Dasum:  math.Inf(1),
455                 Dnrm2:  math.Inf(1),
456                 Idamax: 1,
457                 DscalCases: []DScalCase{
458                         {
459                                 Alpha: -2,
460                                 Ans:   []float64{-10, math.Inf(-1), math.Inf(1), -16, -18},
461                         },
462                         {
463                                 Alpha: 0,
464                                 Ans:   []float64{0, 0, 0, 0, 0},
465                         },
466                 },
467         },
468         {
469                 Name:   "NaNInf",
470                 X:      []float64{5, math.NaN(), math.Inf(-1), 8, 9},
471                 Incx:   1,
472                 N:      5,
473                 Panic:  false,
474                 Dasum:  math.NaN(),
475                 Dnrm2:  math.NaN(),
476                 Idamax: 2,
477                 DscalCases: []DScalCase{
478                         {
479                                 Alpha: -2,
480                                 Ans:   []float64{-10, math.NaN(), math.Inf(1), -16, -18},
481                         },
482                         {
483                                 Alpha: 0,
484                                 Ans:   []float64{0, 0, 0, 0, 0},
485                         },
486                 },
487         },
488         {
489                 Name:   "InfNaN",
490                 X:      []float64{5, math.Inf(1), math.NaN(), 8, 9},
491                 Incx:   1,
492                 N:      5,
493                 Panic:  false,
494                 Dasum:  math.NaN(),
495                 Dnrm2:  math.NaN(),
496                 Idamax: 1,
497                 DscalCases: []DScalCase{
498                         {
499                                 Alpha: -2,
500                                 Ans:   []float64{-10, math.Inf(-1), math.NaN(), -16, -18},
501                         },
502                         {
503                                 Alpha: 0,
504                                 Ans:   []float64{0, 0, 0, 0, 0},
505                         },
506                 },
507         },
508 }
509
510 type DoubleTwoVectorCase struct {
511         Name  string
512         X     []float64
513         Y     []float64
514         XTmp  []float64
515         YTmp  []float64
516         Incx  int
517         Incy  int
518         N     int
519         Panic bool
520         // For Daxpy
521         DaxpyCases []DaxpyCase
522         DdotAns    float64
523         DswapAns   DTwoVecAnswer
524         DcopyAns   DTwoVecAnswer
525         DrotCases  []DrotCase
526         DrotmCases []DrotmCase
527 }
528
529 type DaxpyCase struct {
530         Alpha float64
531         Ans   []float64
532 }
533
534 type DrotCase struct {
535         C    float64
536         S    float64
537         XAns []float64
538         YAns []float64
539 }
540
541 type DrotmCase struct {
542         P    blas.DrotmParams
543         XAns []float64
544         YAns []float64
545         Name string
546 }
547
548 type DTwoVecAnswer struct {
549         X []float64
550         Y []float64
551 }
552
553 var DoubleTwoVectorCases = []DoubleTwoVectorCase{
554         {
555                 Name:  "UnitaryInc",
556                 X:     []float64{10, 15, -6, 3, 14, 7},
557                 Y:     []float64{8, -2, 4, 7, 6, -3},
558                 XTmp:  []float64{0, 0, 0, 0, 0, 0},
559                 YTmp:  []float64{0, 0, 0, 0, 0, 0},
560                 Incx:  1,
561                 Incy:  1,
562                 N:     6,
563                 Panic: false,
564                 DaxpyCases: []DaxpyCase{
565                         {
566                                 Alpha: 1,
567                                 Ans:   []float64{18, 13, -2, 10, 20, 4},
568                         },
569                         {
570                                 Alpha: 2,
571                                 Ans:   []float64{28, 28, -8, 13, 34, 11},
572                         },
573                         {
574                                 Alpha: -3,
575                                 Ans:   []float64{-22, -47, 22, -2, -36, -24},
576                         },
577                         {
578                                 Alpha: 0,
579                                 Ans:   []float64{8, -2, 4, 7, 6, -3},
580                         },
581                 },
582                 DdotAns: 110,
583                 DswapAns: DTwoVecAnswer{
584                         X: []float64{8, -2, 4, 7, 6, -3},
585                         Y: []float64{10, 15, -6, 3, 14, 7},
586                 },
587                 DcopyAns: DTwoVecAnswer{
588                         X: []float64{10, 15, -6, 3, 14, 7},
589                         Y: []float64{10, 15, -6, 3, 14, 7},
590                 },
591                 DrotCases: []DrotCase{
592                         {
593                                 C:    math.Cos(0),
594                                 S:    math.Sin(0),
595                                 XAns: []float64{10, 15, -6, 3, 14, 7},
596                                 YAns: []float64{8, -2, 4, 7, 6, -3},
597                         },
598                         {
599                                 C:    math.Cos(25 * math.Pi / 180),
600                                 S:    math.Sin(25 * math.Pi / 180),
601                                 XAns: []float64{12.444023964292095, 12.749380282068351, -3.7473736752571014, 5.677251193294846, 15.224018588957296, 5.076299724034451},
602                                 YAns: []float64{3.024279678886205, -8.151889500183792, 6.160940718590796, 5.076299724034451, -0.4788089421498931, -5.677251193294846},
603                         },
604                         {
605                                 C:    math.Cos(0.5 * math.Pi),
606                                 S:    math.Sin(0.5 * math.Pi),
607                                 XAns: []float64{8, -2, 4, 7, 6, -3},
608                                 YAns: []float64{-10, -15, 6, -3, -14, -7},
609                         },
610                         {
611                                 C:    math.Cos(math.Pi),
612                                 S:    math.Sin(math.Pi),
613                                 XAns: []float64{-10, -15, 6, -3, -14, -7},
614                                 YAns: []float64{-8, 2, -4, -7, -6, 3},
615                         },
616                 },
617                 DrotmCases: []DrotmCase{
618                         {
619                                 P: blas.DrotmParams{
620                                         Flag: blas.Identity,
621                                         H:    [4]float64{0.9, 0.1, -0.1, 0.5},
622                                 },
623                                 XAns: []float64{10, 15, -6, 3, 14, 7},
624                                 YAns: []float64{8, -2, 4, 7, 6, -3},
625                                 Name: "Neg2Flag",
626                         },
627                         {
628                                 P: blas.DrotmParams{
629                                         Flag: blas.Rescaling,
630                                         H:    [4]float64{0.9, 0.1, -0.1, 0.5},
631                                 },
632                                 XAns: []float64{8.2, 13.7, -5.8, 2, 12, 6.6},
633                                 YAns: []float64{5, 0.5, 1.4, 3.8, 4.4, -0.8},
634                                 Name: "Neg1Flag",
635                         },
636                         {
637                                 P: blas.DrotmParams{
638                                         Flag: blas.OffDiagonal,
639                                         H:    [4]float64{1, 0.1, -0.1, 1},
640                                 },
641                                 XAns: []float64{9.2, 15.2, -6.4, 2.3, 13.4, 7.3},
642                                 YAns: []float64{9, -0.5, 3.4, 7.3, 7.4, -2.3},
643                                 Name: "ZeroFlag",
644                         },
645                         {
646                                 P: blas.DrotmParams{
647                                         Flag: blas.Diagonal,
648                                         H:    [4]float64{0.5, -1, 1, 0.7},
649                                 },
650                                 XAns: []float64{13, 5.5, 1, 8.5, 13, 0.5},
651                                 YAns: []float64{-4.4, -16.4, 8.8, 1.9, -9.8, -9.1},
652                                 Name: "OneFlag",
653                         },
654                 },
655         },
656         {
657                 Name:  "UnitaryIncLong",
658                 X:     []float64{10, 15, -6, 3, 14, 7, 8, -9, 10},
659                 Y:     []float64{8, -2, 4, 7, 6, -3, 7, -6},
660                 XTmp:  []float64{0, 0, 0, 0, 0, 0, 0, 0, 0},
661                 YTmp:  []float64{0, 0, 0, 0, 0, 0, 0, 0},
662                 Incx:  1,
663                 Incy:  1,
664                 N:     6,
665                 Panic: false,
666                 DaxpyCases: []DaxpyCase{
667                         {
668                                 Alpha: 1,
669                                 Ans:   []float64{18, 13, -2, 10, 20, 4, 7, -6},
670                         },
671                         {
672                                 Alpha: 2,
673                                 Ans:   []float64{28, 28, -8, 13, 34, 11, 7, -6},
674                         },
675                         {
676                                 Alpha: -3,
677                                 Ans:   []float64{-22, -47, 22, -2, -36, -24, 7, -6},
678                         },
679                         {
680                                 Alpha: 0,
681                                 Ans:   []float64{8, -2, 4, 7, 6, -3, 7, -6},
682                         },
683                 },
684                 DdotAns: 110,
685                 DswapAns: DTwoVecAnswer{
686                         X: []float64{8, -2, 4, 7, 6, -3, 8, -9, 10},
687                         Y: []float64{10, 15, -6, 3, 14, 7, 7, -6},
688                 },
689                 DcopyAns: DTwoVecAnswer{
690                         X: []float64{10, 15, -6, 3, 14, 7, 8, -9, 10},
691                         Y: []float64{10, 15, -6, 3, 14, 7, 7, -6},
692                 },
693                 DrotCases: []DrotCase{
694                         {
695                                 C:    math.Cos(0),
696                                 S:    math.Sin(0),
697                                 XAns: []float64{10, 15, -6, 3, 14, 7, 8, -9, 10},
698                                 YAns: []float64{8, -2, 4, 7, 6, -3, 7, -6},
699                         },
700                         {
701                                 C:    math.Cos(25 * math.Pi / 180),
702                                 S:    math.Sin(25 * math.Pi / 180),
703                                 XAns: []float64{12.444023964292095, 12.749380282068351, -3.7473736752571014, 5.677251193294846, 15.224018588957296, 5.076299724034451, 8, -9, 10},
704                                 YAns: []float64{3.024279678886205, -8.151889500183792, 6.160940718590796, 5.076299724034451, -0.4788089421498931, -5.677251193294846, 7, -6},
705                         },
706                         {
707                                 C:    math.Cos(0.5 * math.Pi),
708                                 S:    math.Sin(0.5 * math.Pi),
709                                 XAns: []float64{8, -2, 4, 7, 6, -3, 8, -9, 10},
710                                 YAns: []float64{-10, -15, 6, -3, -14, -7, 7, -6},
711                         },
712                         {
713                                 C:    math.Cos(math.Pi),
714                                 S:    math.Sin(math.Pi),
715                                 XAns: []float64{-10, -15, 6, -3, -14, -7, 8, -9, 10},
716                                 YAns: []float64{-8, 2, -4, -7, -6, 3, 7, -6},
717                         },
718                 },
719                 DrotmCases: []DrotmCase{
720                         {
721                                 P: blas.DrotmParams{
722                                         Flag: blas.Identity,
723                                         H:    [4]float64{0.9, 0.1, -0.1, 0.5},
724                                 },
725                                 XAns: []float64{10, 15, -6, 3, 14, 7, 8, -9, 10},
726                                 YAns: []float64{8, -2, 4, 7, 6, -3, 7, -6},
727                                 Name: "Neg2Flag",
728                         },
729                         {
730                                 P: blas.DrotmParams{
731                                         Flag: blas.Rescaling,
732                                         H:    [4]float64{0.9, 0.1, -0.1, 0.5},
733                                 },
734                                 XAns: []float64{8.2, 13.7, -5.8, 2, 12, 6.6, 8, -9, 10},
735                                 YAns: []float64{5, 0.5, 1.4, 3.8, 4.4, -0.8, 7, -6},
736                                 Name: "Neg1Flag",
737                         },
738                         {
739                                 P: blas.DrotmParams{
740                                         Flag: blas.OffDiagonal,
741                                         H:    [4]float64{1, 0.1, -0.1, 1},
742                                 },
743                                 XAns: []float64{9.2, 15.2, -6.4, 2.3, 13.4, 7.3, 8, -9, 10},
744                                 YAns: []float64{9, -0.5, 3.4, 7.3, 7.4, -2.3, 7, -6},
745                                 Name: "ZeroFlag",
746                         },
747                         {
748                                 P: blas.DrotmParams{
749                                         Flag: blas.Diagonal,
750                                         H:    [4]float64{0.5, -1, 1, 0.7},
751                                 },
752                                 XAns: []float64{13, 5.5, 1, 8.5, 13, 0.5, 8, -9, 10},
753                                 YAns: []float64{-4.4, -16.4, 8.8, 1.9, -9.8, -9.1, 7, -6},
754                                 Name: "OneFlag",
755                         },
756                 },
757         },
758         {
759                 Name:  "PositiveInc",
760                 X:     []float64{10, 15, -6, 3, 14, 7},
761                 Y:     []float64{8, -2, 4, 7, 6, -3, -4, 10},
762                 XTmp:  []float64{0, 0, 0, 0, 0, 0},
763                 YTmp:  []float64{0, 0, 0, 0, 0, 0, 0, 0},
764                 Incx:  2,
765                 Incy:  3,
766                 N:     3,
767                 Panic: false,
768                 DaxpyCases: []DaxpyCase{
769                         {
770                                 Alpha: 2,
771                                 Ans:   []float64{28, -2, 4, -5, 6, -3, 24, 10},
772                         },
773                 },
774                 DdotAns: -18,
775                 DswapAns: DTwoVecAnswer{
776                         X: []float64{8, 15, 7, 3, -4, 7},
777                         Y: []float64{10, -2, 4, -6, 6, -3, 14, 10},
778                 },
779                 DcopyAns: DTwoVecAnswer{
780                         X: []float64{10, 15, -6, 3, 14, 7},
781                         Y: []float64{10, -2, 4, -6, 6, -3, 14, 10},
782                 },
783                 DrotCases: []DrotCase{
784                         {
785                                 C:    math.Cos(25 * math.Pi / 180),
786                                 S:    math.Sin(25 * math.Pi / 180),
787                                 XAns: []float64{12.444023964292095, 15, -2.479518890035003, 3, 10.997835971550302, 7},
788                                 YAns: []float64{3.024279678886205, -2, 4, 8.879864079700745, 6, -3, -9.541886812516392, 10},
789                         },
790                 },
791                 DrotmCases: []DrotmCase{
792                         {
793                                 P: blas.DrotmParams{
794                                         Flag: blas.Rescaling,
795                                         H:    [4]float64{0.9, 0.1, -0.1, 0.5},
796                                 },
797                                 XAns: []float64{8.2, 15, -6.1, 3, 13, 7},
798                                 YAns: []float64{5, -2, 4, 2.9, 6, -3, -0.6, 10},
799                         },
800                         {
801                                 P: blas.DrotmParams{
802                                         Flag: blas.OffDiagonal,
803                                         H:    [4]float64{1, 0.1, -0.1, 1},
804                                 },
805                                 XAns: []float64{9.2, 15, -6.7, 3, 14.4, 7},
806                                 YAns: []float64{9, -2, 4, 6.4, 6, -3, -2.6, 10},
807                         },
808                         {
809                                 P: blas.DrotmParams{
810                                         Flag: blas.Diagonal,
811                                         H:    [4]float64{0.5, -1, 1, 0.7},
812                                 },
813                                 XAns: []float64{13, 15, 4, 3, 3, 7},
814                                 YAns: []float64{-4.4, -2, 4, 10.9, 6, -3, -16.8, 10},
815                         },
816                 },
817         },
818         {
819                 Name:  "NegativeInc",
820                 X:     []float64{10, 15, -6, 3, 14, 7},
821                 Y:     []float64{8, -2, 4, 7, 6, -3, -4, 10},
822                 XTmp:  []float64{0, 0, 0, 0, 0, 0},
823                 YTmp:  []float64{0, 0, 0, 0, 0, 0, 0, 0},
824                 Incx:  -2,
825                 Incy:  -3,
826                 N:     3,
827                 Panic: false,
828                 DaxpyCases: []DaxpyCase{
829                         {
830                                 Alpha: 2,
831                                 Ans:   []float64{28, -2, 4, -5, 6, -3, 24, 10},
832                         },
833                 },
834                 DdotAns: -18,
835                 DswapAns: DTwoVecAnswer{
836                         X: []float64{8, 15, 7, 3, -4, 7},
837                         Y: []float64{10, -2, 4, -6, 6, -3, 14, 10},
838                 },
839                 DcopyAns: DTwoVecAnswer{
840                         X: []float64{10, 15, -6, 3, 14, 7},
841                         Y: []float64{10, -2, 4, -6, 6, -3, 14, 10},
842                 },
843                 DrotCases: []DrotCase{
844                         {
845                                 C:    math.Cos(25 * math.Pi / 180),
846                                 S:    math.Sin(25 * math.Pi / 180),
847                                 XAns: []float64{12.444023964292095, 15, -2.479518890035003, 3, 10.997835971550302, 7},
848                                 YAns: []float64{3.024279678886205, -2, 4, 8.879864079700745, 6, -3, -9.541886812516392, 10},
849                         },
850                 },
851                 DrotmCases: []DrotmCase{
852                         {
853                                 P: blas.DrotmParams{
854                                         Flag: blas.Rescaling,
855                                         H:    [4]float64{0.9, 0.1, -0.1, 0.5},
856                                 },
857                                 XAns: []float64{8.2, 15, -6.1, 3, 13, 7},
858                                 YAns: []float64{5, -2, 4, 2.9, 6, -3, -0.6, 10},
859                         },
860                         {
861                                 P: blas.DrotmParams{
862                                         Flag: blas.OffDiagonal,
863                                         H:    [4]float64{1, 0.1, -0.1, 1},
864                                 },
865                                 XAns: []float64{9.2, 15, -6.7, 3, 14.4, 7},
866                                 YAns: []float64{9, -2, 4, 6.4, 6, -3, -2.6, 10},
867                         },
868                         {
869                                 P: blas.DrotmParams{
870                                         Flag: blas.Diagonal,
871                                         H:    [4]float64{0.5, -1, 1, 0.7},
872                                 },
873                                 XAns: []float64{13, 15, 4, 3, 3, 7},
874                                 YAns: []float64{-4.4, -2, 4, 10.9, 6, -3, -16.8, 10},
875                         },
876                 },
877         },
878         {
879                 Name:  "MixedInc1",
880                 X:     []float64{10, 15, -6, 3, 14, 7},
881                 Y:     []float64{8, -2, 4, 7, 6, -3, -4, 10},
882                 XTmp:  []float64{0, 0, 0, 0, 0, 0},
883                 YTmp:  []float64{0, 0, 0, 0, 0, 0, 0, 0},
884                 Incx:  2,
885                 Incy:  -3,
886                 N:     3,
887                 Panic: false,
888                 DaxpyCases: []DaxpyCase{
889                         {
890                                 Alpha: 2,
891                                 Ans:   []float64{36, -2, 4, -5, 6, -3, 16, 10},
892                         },
893                 },
894                 DdotAns: 30,
895                 DswapAns: DTwoVecAnswer{
896                         X: []float64{-4, 15, 7, 3, 8, 7},
897                         Y: []float64{14, -2, 4, -6, 6, -3, 10, 10},
898                 },
899                 DcopyAns: DTwoVecAnswer{
900                         X: []float64{10, 15, -6, 3, 14, 7},
901                         Y: []float64{14, -2, 4, -6, 6, -3, 10, 10},
902                 },
903                 DrotCases: []DrotCase{
904                         {
905                                 C:    math.Cos(25 * math.Pi / 180),
906                                 S:    math.Sin(25 * math.Pi / 180),
907                                 XAns: []float64{7.372604823403701, 15, -2.479518890035003, 3, 16.069255112438693, 7},
908                                 YAns: []float64{1.333806631923407, -2, 4, 8.879864079700745, 6, -3, -7.851413765553595, 10},
909                         },
910                 },
911                 DrotmCases: []DrotmCase{
912                         {
913                                 P: blas.DrotmParams{
914                                         Flag: blas.Rescaling,
915                                         H:    [4]float64{0.9, 0.1, -0.1, 0.5},
916                                 },
917                                 XAns: []float64{9.4, 15, -6.1, 3, 11.8, 7},
918                                 YAns: []float64{5.4, -2, 4, 2.9, 6, -3, -1, 10},
919                         },
920                         {
921                                 P: blas.DrotmParams{
922                                         Flag: blas.OffDiagonal,
923                                         H:    [4]float64{1, 0.1, -0.1, 1},
924                                 },
925                                 XAns: []float64{10.4, 15, -6.7, 3, 13.2, 7},
926                                 YAns: []float64{9.4, -2, 4, 6.4, 6, -3, -3, 10},
927                         },
928                         {
929                                 P: blas.DrotmParams{
930                                         Flag: blas.Diagonal,
931                                         H:    [4]float64{0.5, -1, 1, 0.7},
932                                 },
933                                 XAns: []float64{1, 15, 4, 3, 15, 7},
934                                 YAns: []float64{-8.4, -2, 4, 10.9, 6, -3, -12.8, 10},
935                         },
936                 },
937         },
938         {
939                 Name:  "MixedInc2",
940                 X:     []float64{10, 15, -6, 3, 14, 7},
941                 Y:     []float64{8, -2, 4, 7, 6, -3, -4, 10},
942                 XTmp:  []float64{0, 0, 0, 0, 0, 0},
943                 YTmp:  []float64{0, 0, 0, 0, 0, 0, 0, 0},
944                 Incx:  -2,
945                 Incy:  3,
946                 N:     3,
947                 Panic: false,
948                 DaxpyCases: []DaxpyCase{
949                         {
950                                 Alpha: 2,
951                                 Ans:   []float64{36, -2, 4, -5, 6, -3, 16, 10},
952                         },
953                 },
954                 DdotAns: 30,
955                 DswapAns: DTwoVecAnswer{
956                         X: []float64{-4, 15, 7, 3, 8, 7},
957                         Y: []float64{14, -2, 4, -6, 6, -3, 10, 10},
958                 },
959                 DcopyAns: DTwoVecAnswer{
960                         X: []float64{10, 15, -6, 3, 14, 7},
961                         Y: []float64{14, -2, 4, -6, 6, -3, 10, 10},
962                 },
963                 DrotCases: []DrotCase{
964                         {
965                                 C:    math.Cos(25 * math.Pi / 180),
966                                 S:    math.Sin(25 * math.Pi / 180),
967                                 XAns: []float64{7.372604823403701, 15, -2.479518890035003, 3, 16.069255112438693, 7},
968                                 YAns: []float64{1.333806631923407, -2, 4, 8.879864079700745, 6, -3, -7.851413765553595, 10},
969                         },
970                 },
971                 DrotmCases: []DrotmCase{
972                         {
973                                 P: blas.DrotmParams{
974                                         Flag: blas.Rescaling,
975                                         H:    [4]float64{0.9, 0.1, -0.1, 0.5},
976                                 },
977                                 XAns: []float64{9.4, 15, -6.1, 3, 11.8, 7},
978                                 YAns: []float64{5.4, -2, 4, 2.9, 6, -3, -1, 10},
979                         },
980                         {
981                                 P: blas.DrotmParams{
982                                         Flag: blas.OffDiagonal,
983                                         H:    [4]float64{1, 0.1, -0.1, 1},
984                                 },
985                                 XAns: []float64{10.4, 15, -6.7, 3, 13.2, 7},
986                                 YAns: []float64{9.4, -2, 4, 6.4, 6, -3, -3, 10},
987                         },
988                         {
989                                 P: blas.DrotmParams{
990                                         Flag: blas.Diagonal,
991                                         H:    [4]float64{0.5, -1, 1, 0.7},
992                                 },
993                                 XAns: []float64{1, 15, 4, 3, 15, 7},
994                                 YAns: []float64{-8.4, -2, 4, 10.9, 6, -3, -12.8, 10},
995                         },
996                 },
997         },
998         {
999                 Name:  "ZeroN",
1000                 X:     []float64{10, 15, -6, 3, 14, 7},
1001                 Y:     []float64{8, -2, 4, 7, 6, -3, -4, 10},
1002                 XTmp:  []float64{0, 0, 0, 0, 0, 0},
1003                 YTmp:  []float64{0, 0, 0, 0, 0, 0, 0, 0},
1004                 Incx:  -2,
1005                 Incy:  3,
1006                 N:     0,
1007                 Panic: false,
1008                 DaxpyCases: []DaxpyCase{
1009                         {
1010                                 Alpha: 2,
1011                                 Ans:   []float64{8, -2, 4, 7, 6, -3, -4, 10},
1012                         },
1013                 },
1014                 DswapAns: DTwoVecAnswer{
1015                         X: []float64{10, 15, -6, 3, 14, 7},
1016                         Y: []float64{8, -2, 4, 7, 6, -3, -4, 10},
1017                 },
1018                 DcopyAns: DTwoVecAnswer{
1019                         X: []float64{10, 15, -6, 3, 14, 7},
1020                         Y: []float64{8, -2, 4, 7, 6, -3, -4, 10},
1021                 },
1022                 DrotCases: []DrotCase{
1023                         {
1024                                 C:    math.Cos(25 * math.Pi / 180),
1025                                 S:    math.Sin(25 * math.Pi / 180),
1026                                 XAns: []float64{10, 15, -6, 3, 14, 7},
1027                                 YAns: []float64{8, -2, 4, 7, 6, -3, -4, 10},
1028                         },
1029                 },
1030                 DrotmCases: []DrotmCase{
1031                         {
1032                                 P: blas.DrotmParams{
1033                                         Flag: blas.Rescaling,
1034                                         H:    [4]float64{0.9, 0.1, -0.1, 0.5},
1035                                 },
1036                                 XAns: []float64{10, 15, -6, 3, 14, 7},
1037                                 YAns: []float64{8, -2, 4, 7, 6, -3, -4, 10},
1038                         },
1039                 },
1040         },
1041         {
1042                 Name:  "NegativeN",
1043                 X:     []float64{10, 15, -6, 3, 14, 7},
1044                 Y:     []float64{8, -2, 4, 7, 6, -3, -4, 10},
1045                 XTmp:  []float64{0, 0, 0, 0, 0, 0},
1046                 YTmp:  []float64{0, 0, 0, 0, 0, 0, 0, 0},
1047                 Incx:  -2,
1048                 Incy:  3,
1049                 N:     -3,
1050                 Panic: true,
1051                 DaxpyCases: []DaxpyCase{
1052                         {
1053                                 Alpha: 2,
1054                                 Ans:   []float64{36, -2, 4, -5, 6, -3, 16, 10},
1055                         },
1056                 },
1057                 DrotCases: []DrotCase{
1058                         {
1059                                 C:    math.Cos(25 * math.Pi / 180),
1060                                 S:    math.Sin(25 * math.Pi / 180),
1061                                 XAns: []float64{10, 15, -6, 3, 14, 7},
1062                                 YAns: []float64{8, -2, 4, 7, 6, -3, -4, 10},
1063                         },
1064                 },
1065                 DrotmCases: []DrotmCase{
1066                         {
1067                                 P: blas.DrotmParams{
1068                                         Flag: blas.Rescaling,
1069                                         H:    [4]float64{0.9, 0.1, -0.1, 0.5},
1070                                 },
1071                                 XAns: []float64{8.2, 13.7, -5.8, 2, 12, 6.6},
1072                                 YAns: []float64{5, 0.5, 1.4, 3.8, 4.4, -0.8},
1073                         },
1074                 },
1075         },
1076         {
1077                 Name:  "ZeroIncX",
1078                 X:     []float64{10, 15, -6, 3, 14, 7},
1079                 Y:     []float64{8, -2, 4, 7, 6, -3, -4, 10},
1080                 XTmp:  []float64{0, 0, 0, 0, 0, 0},
1081                 YTmp:  []float64{0, 0, 0, 0, 0, 0, 0, 0},
1082                 Incx:  0,
1083                 Incy:  3,
1084                 N:     2,
1085                 Panic: true,
1086                 DaxpyCases: []DaxpyCase{
1087                         {
1088                                 Alpha: 2,
1089                                 Ans:   []float64{36, -2, 4, -5, 6, -3, 16, 10},
1090                         },
1091                 },
1092                 DrotCases: []DrotCase{
1093                         {
1094                                 C:    math.Cos(25 * math.Pi / 180),
1095                                 S:    math.Sin(25 * math.Pi / 180),
1096                                 XAns: []float64{10, 15, -6, 3, 14, 7},
1097                                 YAns: []float64{8, -2, 4, 7, 6, -3, -4, 10},
1098                         },
1099                 },
1100                 DrotmCases: []DrotmCase{
1101                         {
1102                                 P: blas.DrotmParams{
1103                                         Flag: blas.Rescaling,
1104                                         H:    [4]float64{0.9, 0.1, -0.1, 0.5},
1105                                 },
1106                                 XAns: []float64{8.2, 13.7, -5.8, 2, 12, 6.6},
1107                                 YAns: []float64{5, 0.5, 1.4, 3.8, 4.4, -0.8},
1108                         },
1109                 },
1110         },
1111         {
1112                 Name:  "ZeroIncY",
1113                 X:     []float64{10, 15, -6, 3, 14, 7},
1114                 Y:     []float64{8, -2, 4, 7, 6, -3, -4, 10},
1115                 XTmp:  []float64{0, 0, 0, 0, 0, 0},
1116                 YTmp:  []float64{0, 0, 0, 0, 0, 0, 0, 0},
1117                 Incx:  1,
1118                 Incy:  0,
1119                 N:     2,
1120                 Panic: true,
1121                 DaxpyCases: []DaxpyCase{
1122                         {
1123                                 Alpha: 2,
1124                                 Ans:   []float64{36, -2, 4, -5, 6, -3, 16, 10},
1125                         },
1126                 },
1127                 DrotCases: []DrotCase{
1128                         {
1129                                 C:    math.Cos(25 * math.Pi / 180),
1130                                 S:    math.Sin(25 * math.Pi / 180),
1131                                 XAns: []float64{10, 15, -6, 3, 14, 7},
1132                                 YAns: []float64{8, -2, 4, 7, 6, -3, -4, 10},
1133                         },
1134                 },
1135                 DrotmCases: []DrotmCase{
1136                         {
1137                                 P: blas.DrotmParams{
1138                                         Flag: blas.Rescaling,
1139                                         H:    [4]float64{0.9, 0.1, -0.1, 0.5},
1140                                 },
1141                                 XAns: []float64{8.2, 13.7, -5.8, 2, 12, 6.6},
1142                                 YAns: []float64{5, 0.5, 1.4, 3.8, 4.4, -0.8},
1143                         },
1144                 },
1145         },
1146         {
1147                 Name:  "OutOfBoundsX",
1148                 X:     []float64{10, 15, -6, 3, 14, 7},
1149                 Y:     []float64{8, -2, 4, 7, 6, -3, -4, 10},
1150                 XTmp:  []float64{0, 0, 0, 0, 0, 0},
1151                 YTmp:  []float64{0, 0, 0, 0, 0, 0, 0, 0},
1152                 Incx:  8,
1153                 Incy:  2,
1154                 N:     2,
1155                 Panic: true,
1156                 DaxpyCases: []DaxpyCase{
1157                         {
1158                                 Alpha: 2,
1159                                 Ans:   []float64{36, -2, 4, -5, 6, -3, 16, 10},
1160                         },
1161                 },
1162                 DrotCases: []DrotCase{
1163                         {
1164                                 C:    math.Cos(25 * math.Pi / 180),
1165                                 S:    math.Sin(25 * math.Pi / 180),
1166                                 XAns: []float64{10, 15, -6, 3, 14, 7},
1167                                 YAns: []float64{8, -2, 4, 7, 6, -3, -4, 10},
1168                         },
1169                 },
1170                 DrotmCases: []DrotmCase{
1171                         {
1172                                 P: blas.DrotmParams{
1173                                         Flag: blas.Rescaling,
1174                                         H:    [4]float64{0.9, 0.1, -0.1, 0.5},
1175                                 },
1176                                 XAns: []float64{8.2, 13.7, -5.8, 2, 12, 6.6},
1177                                 YAns: []float64{5, 0.5, 1.4, 3.8, 4.4, -0.8},
1178                         },
1179                 },
1180         },
1181         {
1182                 Name:  "OutOfBoundsY",
1183                 X:     []float64{10, 15, -6, 3, 14, 7},
1184                 Y:     []float64{8, -2, 4, 7, 6, -3, -4, 10},
1185                 XTmp:  []float64{0, 0, 0, 0, 0, 0},
1186                 YTmp:  []float64{0, 0, 0, 0, 0, 0, 0, 0},
1187                 Incx:  2,
1188                 Incy:  8,
1189                 N:     2,
1190                 Panic: true,
1191                 DaxpyCases: []DaxpyCase{
1192                         {
1193                                 Alpha: 2,
1194                                 Ans:   []float64{36, -2, 4, -5, 6, -3, 16, 10},
1195                         },
1196                 },
1197                 DrotCases: []DrotCase{
1198                         {
1199                                 C:    math.Cos(25 * math.Pi / 180),
1200                                 S:    math.Sin(25 * math.Pi / 180),
1201                                 XAns: []float64{10, 15, -6, 3, 14, 7},
1202                                 YAns: []float64{8, -2, 4, 7, 6, -3, -4, 10},
1203                         },
1204                 },
1205                 DrotmCases: []DrotmCase{
1206                         {
1207                                 P: blas.DrotmParams{
1208                                         Flag: blas.Rescaling,
1209                                         H:    [4]float64{0.9, 0.1, -0.1, 0.5},
1210                                 },
1211                                 XAns: []float64{10, 15, -6, 3, 14, 7},
1212                                 YAns: []float64{8, -2, 4, 7, 6, -3, -4, 10},
1213                         },
1214                 },
1215         },
1216         {
1217                 Name:  "Empty",
1218                 X:     []float64{},
1219                 Y:     []float64{},
1220                 Incx:  1,
1221                 Incy:  1,
1222                 N:     0,
1223                 Panic: false,
1224                 DaxpyCases: []DaxpyCase{
1225                         {
1226                                 Alpha: 2,
1227                                 Ans:   []float64{},
1228                         },
1229                 },
1230                 DrotCases: []DrotCase{
1231                         {
1232                                 C:    math.Cos(25 * math.Pi / 180),
1233                                 S:    math.Sin(25 * math.Pi / 180),
1234                                 XAns: []float64{},
1235                                 YAns: []float64{},
1236                         },
1237                 },
1238                 DrotmCases: []DrotmCase{
1239                         {
1240                                 P: blas.DrotmParams{
1241                                         Flag: blas.Rescaling,
1242                                         H:    [4]float64{0.9, 0.1, -0.1, 0.5},
1243                                 },
1244                                 XAns: []float64{},
1245                                 YAns: []float64{},
1246                         },
1247                 },
1248         },
1249         {
1250                 Name:  "EmptyZeroIncX",
1251                 X:     []float64{},
1252                 Y:     []float64{},
1253                 Incx:  0,
1254                 Incy:  1,
1255                 N:     0,
1256                 Panic: true,
1257                 DaxpyCases: []DaxpyCase{
1258                         {
1259                                 Alpha: 2,
1260                                 Ans:   []float64{},
1261                         },
1262                 },
1263                 DrotCases: []DrotCase{
1264                         {
1265                                 C:    math.Cos(25 * math.Pi / 180),
1266                                 S:    math.Sin(25 * math.Pi / 180),
1267                                 XAns: []float64{},
1268                                 YAns: []float64{},
1269                         },
1270                 },
1271                 DrotmCases: []DrotmCase{
1272                         {
1273                                 P: blas.DrotmParams{
1274                                         Flag: blas.Rescaling,
1275                                         H:    [4]float64{0.9, 0.1, -0.1, 0.5},
1276                                 },
1277                                 XAns: []float64{},
1278                                 YAns: []float64{},
1279                         },
1280                 },
1281         },
1282         {
1283                 Name:  "EmptyZeroIncY",
1284                 X:     []float64{},
1285                 Y:     []float64{},
1286                 Incx:  1,
1287                 Incy:  0,
1288                 N:     0,
1289                 Panic: true,
1290                 DaxpyCases: []DaxpyCase{
1291                         {
1292                                 Alpha: 2,
1293                                 Ans:   []float64{},
1294                         },
1295                 },
1296                 DrotCases: []DrotCase{
1297                         {
1298                                 C:    math.Cos(25 * math.Pi / 180),
1299                                 S:    math.Sin(25 * math.Pi / 180),
1300                                 XAns: []float64{},
1301                                 YAns: []float64{},
1302                         },
1303                 },
1304                 DrotmCases: []DrotmCase{
1305                         {
1306                                 P: blas.DrotmParams{
1307                                         Flag: blas.Rescaling,
1308                                         H:    [4]float64{0.9, 0.1, -0.1, 0.5},
1309                                 },
1310                                 XAns: []float64{},
1311                                 YAns: []float64{},
1312                         },
1313                 },
1314         },
1315         {
1316                 Name:  "EmptyReverse",
1317                 X:     []float64{},
1318                 Y:     []float64{},
1319                 Incx:  -1,
1320                 Incy:  -1,
1321                 N:     0,
1322                 Panic: false,
1323                 DaxpyCases: []DaxpyCase{
1324                         {
1325                                 Alpha: 2,
1326                                 Ans:   []float64{},
1327                         },
1328                 },
1329                 DrotCases: []DrotCase{
1330                         {
1331                                 C:    math.Cos(25 * math.Pi / 180),
1332                                 S:    math.Sin(25 * math.Pi / 180),
1333                                 XAns: []float64{},
1334                                 YAns: []float64{},
1335                         },
1336                 },
1337                 DrotmCases: []DrotmCase{
1338                         {
1339                                 P: blas.DrotmParams{
1340                                         Flag: blas.Rescaling,
1341                                         H:    [4]float64{0.9, 0.1, -0.1, 0.5},
1342                                 },
1343                                 XAns: []float64{},
1344                                 YAns: []float64{},
1345                         },
1346                 },
1347         },
1348 }
1349
1350 type Ddotter interface {
1351         Ddot(n int, x []float64, incX int, y []float64, incY int) float64
1352 }
1353
1354 func DdotTest(t *testing.T, d Ddotter) {
1355         ddot := d.Ddot
1356         for _, c := range DoubleTwoVectorCases {
1357                 dCopyTwoTmp(c.X, c.XTmp, c.Y, c.YTmp)
1358                 if c.Panic {
1359                         f := func() { ddot(c.N, c.XTmp, c.Incx, c.YTmp, c.Incy) }
1360                         testpanics(f, c.Name, t)
1361                         continue
1362                 }
1363                 dot := ddot(c.N, c.XTmp, c.Incx, c.YTmp, c.Incy)
1364                 if !dTolEqual(dot, c.DdotAns) {
1365                         t.Errorf("ddot: mismatch %v: expected %v, found %v", c.Name, c.DdotAns, dot)
1366                 }
1367         }
1368
1369         // check it works for 16-byte unaligned slices
1370         x := []float64{1, 1, 1, 1, 1}
1371         if n := ddot(4, x[:4], 1, x[1:], 1); n != 4 {
1372                 t.Errorf("ddot: mismatch Unaligned: expected %v, found %v", 4, n)
1373         }
1374         if n := ddot(2, x[:4], 2, x[1:], 2); n != 2 {
1375                 t.Errorf("ddot: mismatch Unaligned: expected %v, found %v", 2, n)
1376         }
1377         if n := ddot(2, x[:4], 3, x[1:], 3); n != 2 {
1378                 t.Errorf("ddot: mismatch Unaligned: expected %v, found %v", 2, n)
1379         }
1380 }
1381
1382 type Dnrm2er interface {
1383         Dnrm2(n int, x []float64, incX int) float64
1384 }
1385
1386 func Dnrm2Test(t *testing.T, blasser Dnrm2er) {
1387         dnrm2 := blasser.Dnrm2
1388         for _, c := range DoubleOneVectorCases {
1389                 if c.Panic {
1390                         f := func() { dnrm2(c.N, c.X, c.Incx) }
1391                         testpanics(f, c.Name, t)
1392                         continue
1393                 }
1394                 v := dnrm2(c.N, c.X, c.Incx)
1395                 if !dTolEqual(v, c.Dnrm2) {
1396                         t.Errorf("dnrm2: mismatch %v: expected %v, found %v", c.Name, c.Dnrm2, v)
1397                 }
1398         }
1399 }
1400
1401 type Dasumer interface {
1402         Dasum(n int, x []float64, incX int) float64
1403 }
1404
1405 func DasumTest(t *testing.T, blasser Dasumer) {
1406         dasum := blasser.Dasum
1407         for _, c := range DoubleOneVectorCases {
1408                 if c.Panic {
1409                         f := func() { dasum(c.N, c.X, c.Incx) }
1410                         testpanics(f, c.Name, t)
1411                         continue
1412                 }
1413                 v := dasum(c.N, c.X, c.Incx)
1414                 if !dTolEqual(v, c.Dasum) {
1415                         t.Errorf("dasum: mismatch %v: expected %v, found %v", c.Name, c.Dasum, v)
1416                 }
1417         }
1418 }
1419
1420 type Idamaxer interface {
1421         Idamax(n int, x []float64, incX int) int
1422 }
1423
1424 func IdamaxTest(t *testing.T, blasser Idamaxer) {
1425         idamax := blasser.Idamax
1426         for _, c := range DoubleOneVectorCases {
1427                 if c.Panic {
1428                         f := func() { idamax(c.N, c.X, c.Incx) }
1429                         testpanics(f, c.Name, t)
1430                         continue
1431                 }
1432                 v := idamax(c.N, c.X, c.Incx)
1433                 if v != c.Idamax {
1434                         s := fmt.Sprintf("idamax: mismatch %v: expected %v, found %v", c.Name, c.Idamax, v)
1435                         if floats.HasNaN(c.X) {
1436                                 log.Println(s)
1437                         } else {
1438                                 t.Errorf(s)
1439                         }
1440                 }
1441         }
1442 }
1443
1444 type Dswapper interface {
1445         Dswap(n int, x []float64, incX int, y []float64, incY int)
1446 }
1447
1448 func DswapTest(t *testing.T, d Dswapper) {
1449         dswap := d.Dswap
1450         for _, c := range DoubleTwoVectorCases {
1451                 dCopyTwoTmp(c.X, c.XTmp, c.Y, c.YTmp)
1452                 if c.Panic {
1453                         f := func() { dswap(c.N, c.XTmp, c.Incx, c.YTmp, c.Incy) }
1454                         testpanics(f, c.Name, t)
1455                         continue
1456                 }
1457                 dswap(c.N, c.XTmp, c.Incx, c.YTmp, c.Incy)
1458                 if !dSliceTolEqual(c.XTmp, c.DswapAns.X) {
1459                         t.Errorf("dswap: x mismatch %v: expected %v, found %v", c.Name, c.DswapAns.X, c.XTmp)
1460                 }
1461                 if !dSliceTolEqual(c.YTmp, c.DswapAns.Y) {
1462                         t.Errorf("dswap: y mismatch %v: expected %v, found %v", c.Name, c.DswapAns.Y, c.YTmp)
1463                 }
1464         }
1465 }
1466
1467 type Dcopier interface {
1468         Dcopy(n int, x []float64, incX int, y []float64, incY int)
1469 }
1470
1471 func DcopyTest(t *testing.T, d Dcopier) {
1472         dcopy := d.Dcopy
1473         for _, c := range DoubleTwoVectorCases {
1474                 dCopyTwoTmp(c.X, c.XTmp, c.Y, c.YTmp)
1475                 if c.Panic {
1476                         f := func() { dcopy(c.N, c.XTmp, c.Incx, c.YTmp, c.Incy) }
1477                         testpanics(f, c.Name, t)
1478                         continue
1479                 }
1480                 dcopy(c.N, c.XTmp, c.Incx, c.YTmp, c.Incy)
1481                 if !dSliceTolEqual(c.XTmp, c.DcopyAns.X) {
1482                         t.Errorf("dswap: x mismatch %v: expected %v, found %v", c.Name, c.DcopyAns.X, c.XTmp)
1483                 }
1484                 if !dSliceTolEqual(c.YTmp, c.DcopyAns.Y) {
1485                         t.Errorf("dswap: y mismatch %v: expected %v, found %v", c.Name, c.DcopyAns.Y, c.YTmp)
1486                 }
1487         }
1488 }
1489
1490 type Daxpyer interface {
1491         Daxpy(n int, alpha float64, x []float64, incX int, y []float64, incY int)
1492 }
1493
1494 func DaxpyTest(t *testing.T, d Daxpyer) {
1495         daxpy := d.Daxpy
1496         for _, c := range DoubleTwoVectorCases {
1497                 for _, kind := range c.DaxpyCases {
1498                         dCopyTwoTmp(c.X, c.XTmp, c.Y, c.YTmp)
1499                         if c.Panic {
1500                                 f := func() { daxpy(c.N, kind.Alpha, c.XTmp, c.Incx, c.YTmp, c.Incy) }
1501                                 testpanics(f, c.Name, t)
1502                                 continue
1503                         }
1504                         daxpy(c.N, kind.Alpha, c.XTmp, c.Incx, c.YTmp, c.Incy)
1505                         if !dSliceTolEqual(c.YTmp, kind.Ans) {
1506                                 t.Errorf("daxpy: mismatch %v: expected %v, found %v", c.Name, kind.Ans, c.YTmp)
1507                         }
1508                 }
1509         }
1510 }
1511
1512 type DrotgTestStruct struct {
1513         Name       string
1514         A, B       float64
1515         C, S, R, Z float64
1516 }
1517
1518 var DrotgTests = []DrotgTestStruct{
1519         {
1520                 Name: "ZeroAB",
1521                 C:    1,
1522         },
1523         {
1524                 Name: "PosA_ZeroB",
1525                 A:    0.5,
1526                 C:    1,
1527                 R:    0.5,
1528         },
1529         {
1530                 Name: "NegA_ZeroB",
1531                 A:    -4.6,
1532                 C:    1,
1533                 R:    -4.6,
1534         },
1535         {
1536                 Name: "ZeroA_PosB",
1537                 B:    3,
1538                 S:    1,
1539                 R:    3,
1540                 Z:    1,
1541         },
1542         {
1543                 Name: "ZeroA_NegB",
1544                 B:    -0.3,
1545                 S:    1,
1546                 R:    -0.3,
1547                 Z:    1,
1548         },
1549         {
1550                 Name: "PosA_PosB_AGTB",
1551                 A:    5,
1552                 B:    0.3,
1553                 C:    0.99820484546577868593549038000,
1554                 S:    0.05989229072794672115612942280,
1555                 R:    5.00899191454727744602429072688,
1556                 Z:    0.05989229072794672115612942280,
1557         },
1558         {
1559                 Name: "PosA_PosB_ALTB",
1560                 A:    3,
1561                 B:    4,
1562                 C:    3.0 / 5,
1563                 S:    4.0 / 5,
1564                 R:    5,
1565                 Z:    5.0 / 3.0,
1566         },
1567
1568         {
1569                 Name: "PosA_NegB_AGTB",
1570                 A:    2.6,
1571                 B:    -0.9,
1572                 C:    0.94498607344025815971847507095,
1573                 S:    -0.32711056388316628605639521686,
1574                 R:    2.751363298439520872718790879655,
1575                 Z:    -0.3271105638831662860563952168,
1576         },
1577         {
1578                 Name: "PosA_NegB_ALTB",
1579                 A:    2.6,
1580                 B:    -2.9,
1581                 C:    -0.6675450157520258540548049558,
1582                 S:    0.7445694406464903756765132200,
1583                 R:    -3.8948684188300893100043812234,
1584                 Z:    1 / -0.6675450157520258540548049558,
1585         },
1586         {
1587                 Name: "NegA_PosB_AGTB",
1588                 A:    -11.4,
1589                 B:    10.3,
1590                 C:    0.7419981952497362418487847947,
1591                 S:    -0.6704018781642353764072353847,
1592                 R:    -15.363918770938617534070671122,
1593                 Z:    -0.6704018781642353764072353847,
1594         },
1595         {
1596                 Name: "NegA_PosB_ALTB",
1597                 A:    -1.4,
1598                 B:    10.3,
1599                 C:    -0.1346838895922121112404717523,
1600                 S:    0.9908886162855605326977564640,
1601                 R:    10.394710193170370442523552032,
1602                 Z:    1 / -0.1346838895922121112404717523,
1603         },
1604         {
1605                 Name: "NegA_NegB_AGTB",
1606                 A:    -11.4,
1607                 B:    10.3,
1608                 C:    0.7419981952497362418487847947,
1609                 S:    -0.6704018781642353764072353847,
1610                 R:    -15.363918770938617534070671122,
1611                 Z:    -0.6704018781642353764072353847,
1612         },
1613         {
1614                 Name: "NegA_NegB_ALTB",
1615                 A:    -1.4,
1616                 B:    -10.3,
1617                 C:    0.1346838895922121112404717523,
1618                 S:    0.9908886162855605326977564640,
1619                 R:    -10.394710193170370442523552032,
1620                 Z:    1 / 0.1346838895922121112404717523,
1621         },
1622 }
1623
1624 type Drotger interface {
1625         Drotg(a, b float64) (c, s, r, z float64)
1626 }
1627
1628 func DrotgTest(t *testing.T, d Drotger) {
1629         drotg := d.Drotg
1630         for _, test := range DrotgTests {
1631                 c, s, r, z := drotg(test.A, test.B)
1632                 if !dTolEqual(c, test.C) {
1633                         t.Errorf("drotg: c mismatch %v: expected %v, found %v", test.Name, test.C, c)
1634                 }
1635                 if !dTolEqual(s, test.S) {
1636                         t.Errorf("drotg: s mismatch %v: expected %v, found %v", test.Name, test.S, s)
1637                 }
1638                 if !dTolEqual(r, test.R) {
1639                         t.Errorf("drotg: r mismatch %v: expected %v, found %v", test.Name, test.R, r)
1640                 }
1641                 if !dTolEqual(z, test.Z) {
1642                         t.Errorf("drotg: z mismatch %v: expected %v, found %v", test.Name, test.Z, z)
1643                 }
1644         }
1645 }
1646
1647 type DrotmgTestStruct struct {
1648         Name           string
1649         D1, D2, X1, Y1 float64
1650         P              *blas.DrotmParams
1651         Rd1, Rd2, Rx1  float64
1652 }
1653
1654 var DrotmgTests = []DrotmgTestStruct{
1655         {
1656                 Name: "NegD1",
1657                 P: &blas.DrotmParams{
1658                         Flag: blas.Rescaling,
1659                 },
1660                 D1: -4,
1661                 D2: 6,
1662                 X1: 8,
1663                 Y1: -4,
1664         },
1665         {
1666                 Name: "ZeroD2",
1667                 P: &blas.DrotmParams{
1668                         Flag: blas.Identity,
1669                 },
1670                 D1:  4,
1671                 X1:  8,
1672                 Y1:  -5,
1673                 Rd1: 4,
1674                 Rx1: 8,
1675         },
1676         {
1677                 Name: "ZeroY1",
1678                 P: &blas.DrotmParams{
1679                         Flag: blas.Identity,
1680                 },
1681                 D1:  4,
1682                 D2:  -6,
1683                 X1:  8,
1684                 Rd1: 4,
1685                 Rd2: -6,
1686                 Rx1: 8,
1687         },
1688         {
1689                 Name: "NegQ2_and_AQ1_LT_AQ2",
1690                 P: &blas.DrotmParams{
1691                         Flag: blas.Rescaling,
1692                 },
1693                 D1:  8,
1694                 D2:  -6,
1695                 X1:  4,
1696                 Y1:  8,
1697                 Rd1: 0,
1698                 Rd2: 0,
1699                 Rx1: 0,
1700         },
1701         {
1702                 Name: "ZeroD1",
1703                 P: &blas.DrotmParams{
1704                         Flag: blas.Diagonal,
1705                         H:    [4]float64{0, 0, 0, 2},
1706                 },
1707                 D1:  0,
1708                 D2:  2,
1709                 X1:  8,
1710                 Y1:  4,
1711                 Rd1: 2,
1712                 Rd2: 0,
1713                 Rx1: 4,
1714         },
1715         {
1716                 Name: "AbsQ1_GT_AbsQU__D2_Pos",
1717                 P: &blas.DrotmParams{
1718                         Flag: blas.OffDiagonal,
1719                         H:    [4]float64{0, -0.625, 0.9375, 0},
1720                 },
1721                 D1:  2,
1722                 D2:  3,
1723                 X1:  8,
1724                 Y1:  5,
1725                 Rd1: 1.2610837438423645,
1726                 Rd2: 1.8916256157635467,
1727                 Rx1: 12.6875,
1728         },
1729         {
1730                 Name: "AbsQ1_GT_AbsQU__D2_Neg",
1731                 P: &blas.DrotmParams{
1732                         Flag: blas.OffDiagonal,
1733                         H:    [4]float64{0, -0.625, -0.9375, 0},
1734                 },
1735                 D1:  2,
1736                 D2:  -3,
1737                 X1:  8,
1738                 Y1:  5,
1739                 Rd1: 4.830188679245283,
1740                 Rd2: -7.245283018867925,
1741                 Rx1: 3.3125,
1742         },
1743         {
1744                 Name: "AbsQ1_LT_AbsQU__D2_Pos",
1745                 P: &blas.DrotmParams{
1746                         Flag: blas.Diagonal,
1747                         H:    [4]float64{5.0 / 12, 0, 0, 0.625},
1748                 },
1749                 D1:  2,
1750                 D2:  3,
1751                 X1:  5,
1752                 Y1:  8,
1753                 Rd1: 2.3801652892561984,
1754                 Rd2: 1.586776859504132,
1755                 Rx1: 121.0 / 12,
1756         },
1757         {
1758                 Name: "D1=D2_X1=X2",
1759                 P: &blas.DrotmParams{
1760                         Flag: blas.Diagonal,
1761                         H:    [4]float64{1, 0, 0, 1},
1762                 },
1763                 D1:  2,
1764                 D2:  2,
1765                 X1:  8,
1766                 Y1:  8,
1767                 Rd1: 1,
1768                 Rd2: 1,
1769                 Rx1: 16,
1770         },
1771         {
1772                 Name: "RD1_Big_RD2_Big_Flag_0",
1773                 P: &blas.DrotmParams{
1774                         Flag: blas.Rescaling,
1775                         H:    [4]float64{4096, -3584, 1792, 4096},
1776                 },
1777                 D1:  1600000000,
1778                 D2:  800000000,
1779                 X1:  8,
1780                 Y1:  7,
1781                 Rd1: 68.96627824858757,
1782                 Rd2: 34.483139124293785,
1783                 Rx1: 45312,
1784         },
1785         {
1786                 Name: "RD1_Big_RD2_Big_Flag_1",
1787                 P: &blas.DrotmParams{
1788                         Flag: blas.Rescaling,
1789                         H:    [4]float64{2340.5714285714284, -4096, 4096, 4681.142857142857},
1790                 },
1791                 D1:  800000000,
1792                 D2:  1600000000,
1793                 X1:  8,
1794                 Y1:  7,
1795                 Rd1: 57.6914092640818,
1796                 Rd2: 28.8457046320409,
1797                 Rx1: 47396.57142857142,
1798         },
1799         {
1800                 Name: "RD1_Big_RD2_Med_Flag_0",
1801                 P: &blas.DrotmParams{
1802                         Flag: blas.Rescaling,
1803                         H:    [4]float64{4096, -1, 0.0004096, 1},
1804                 },
1805                 D1:  20000000,
1806                 D2:  2,
1807                 X1:  8,
1808                 Y1:  8,
1809                 Rd1: 1.1920927762985347,
1810                 Rd2: 1.9999998000000199,
1811                 Rx1: 32768.0032768,
1812         },
1813         {
1814                 Name: "RD1_Big_RD2_Med_Flag_1",
1815                 P: &blas.DrotmParams{
1816                         Flag: blas.Rescaling,
1817                         H:    [4]float64{4.096e-17, -1, 4096, 1e-10},
1818                 },
1819                 D1:  2,
1820                 D2:  20000000000,
1821                 X1:  8,
1822                 Y1:  80000000000,
1823                 Rd1: 1192.0928955078125,
1824                 Rd2: 2,
1825                 Rx1: 3.2768e+14,
1826         },
1827
1828         // TODO: Add D1 big, D2 small, Flag = 0
1829         {
1830                 Name: "D1_Big_D2_Small_Flag_1",
1831                 P: &blas.DrotmParams{
1832                         Flag: blas.Rescaling,
1833                         H:    [4]float64{2.8671999999999997e-26, -0.000244140625, 4096, 2.44140625e-16},
1834                 },
1835                 D1:  0.000000014,
1836                 D2:  2000000000,
1837                 X1:  0.000008,
1838                 Y1:  8000000,
1839                 Rd1: 119.20928955078125,
1840                 Rd2: 0.234881024,
1841                 Rx1: 3.2768e+10,
1842         },
1843
1844         {
1845                 Name: "RD1_Med_RD2_Big_Flag_0",
1846                 P: &blas.DrotmParams{
1847                         Flag: blas.Rescaling,
1848                         H:    [4]float64{1, -0.0004096, 1000, 4096},
1849                 },
1850                 D1:  2,
1851                 D2:  20000000000,
1852                 X1:  80000000,
1853                 Y1:  8,
1854                 Rd1: 1.9998000199980002,
1855                 Rd2: 1191.9736981379988,
1856                 Rx1: 8.0008e+07,
1857         },
1858         {
1859                 Name: "D1_Med_D2_Big_Flag_1",
1860                 P: &blas.DrotmParams{
1861                         Flag: blas.Rescaling,
1862                         H:    [4]float64{50, -4096, 1, 4.096e-06},
1863                 },
1864                 D1:  20000000000,
1865                 D2:  0.4,
1866                 X1:  80000000,
1867                 Y1:  80000000000000000,
1868                 Rd1: 0.39999998000000103,
1869                 Rd2: 1192.092835903171,
1870                 Rx1: 8.0000004e+16,
1871         },
1872         {
1873                 Name: "RD1_Med_RD2_Small_Flag_0",
1874                 P: &blas.DrotmParams{
1875                         Flag: blas.Rescaling,
1876                         H:    [4]float64{1, -0.0007233796296296296, 1.1111111111111111e-10, 0.000244140625},
1877                 },
1878                 D1:  1.2,
1879                 D2:  0.000000000045,
1880                 X1:  2.7,
1881                 Y1:  8,
1882                 Rd1: 1.1999999996049382,
1883                 Rd2: 0.0007549747197514486,
1884                 Rx1: 2.700000000888889,
1885         },
1886         {
1887                 Name: "RD1_Med_RD2_Small_Flag_1",
1888                 P: &blas.DrotmParams{
1889                         Flag: blas.Rescaling,
1890                         H:    [4]float64{0.0002197265625, -1, 0.000244140625, 3.375e-11},
1891                 },
1892                 D1:  1.2,
1893                 D2:  0.000000000045,
1894                 X1:  2.7,
1895                 Y1:  80000000000,
1896                 Rd1: 0.0007549747199770676,
1897                 Rd2: 1.19999999996355,
1898                 Rx1: 1.9531250000593264e+07,
1899         },
1900         // TODO: Add Small, Big, 0 case
1901         {
1902                 Name: "D1_Small_D2_Big_Flag_1",
1903                 P: &blas.DrotmParams{
1904                         Flag: blas.Rescaling,
1905                         H:    [4]float64{2.3731773997569866e+10, -1.6777216e+07, 0.000244140625, 1.6777216e-07},
1906                 },
1907                 D1:  120000000000000000,
1908                 D2:  0.000000000012345,
1909                 X1:  0.08,
1910                 Y1:  8000000000000,
1911                 Rd1: 0.00010502490698765249,
1912                 Rd2: 216.1836123957717,
1913                 Rx1: 3.8516669198055897e+09,
1914         },
1915         {
1916                 Name: "RD1_Small_RD2_Med_Flag_0",
1917                 P: &blas.DrotmParams{
1918                         Flag: blas.Rescaling,
1919                         H:    [4]float64{0.000244140625, -1e-08, 0.24414062499999997, 1},
1920                 },
1921                 D1:  0.0000000002,
1922                 D2:  20,
1923                 X1:  0.8,
1924                 Y1:  0.000000008,
1925                 Rd1: 0.003355409645903541,
1926                 Rd2: 19.99980000199998,
1927                 Rx1: 0.000195314453125,
1928         },
1929         {
1930                 Name: "RD1_Small_RD2_Med_Flag_1",
1931                 P: &blas.DrotmParams{
1932                         Flag: blas.Rescaling,
1933                         H:    [4]float64{0.0012207031250000002, -1, 0.000244140625, 1e-09},
1934                 },
1935                 D1:  0.02,
1936                 D2:  0.000000000004,
1937                 X1:  0.008,
1938                 Y1:  8000000,
1939                 Rd1: 6.710886366445568e-05,
1940                 Rd2: 0.019999999900000003,
1941                 Rx1: 1953.125009765625,
1942         },
1943         // TODO: Add Small, Small, 0 case
1944         // TODO: Add Small, Small, 1 case
1945 }
1946
1947 type Drotmger interface {
1948         Drotmg(d1, d2, x1, y1 float64) (p blas.DrotmParams, rd1, rd2, rx1 float64)
1949 }
1950
1951 func DrotmgTest(t *testing.T, d Drotmger) {
1952         for _, test := range DrotmgTests {
1953
1954                 p, rd1, rd2, rx1 := d.Drotmg(test.D1, test.D2, test.X1, test.Y1)
1955
1956                 if p.Flag != test.P.Flag {
1957                         t.Errorf("drotmg flag mismatch %v: expected %v, found %v", test.Name, test.P.Flag, p.Flag)
1958                 }
1959                 for i, val := range p.H {
1960                         if !dTolEqual(test.P.H[i], val) {
1961                                 t.Errorf("drotmg H mismatch %v: expected %v, found %v", test.Name, test.P.H, p.H)
1962                                 break
1963                         }
1964                 }
1965                 if !dTolEqual(rd1, test.Rd1) {
1966                         t.Errorf("drotmg rd1 mismatch %v: expected %v, found %v", test.Name, test.Rd1, rd1)
1967                 }
1968                 if !dTolEqual(rd2, test.Rd2) {
1969                         t.Errorf("drotmg rd2 mismatch %v: expected %v, found %v", test.Name, test.Rd2, rd2)
1970                 }
1971                 if !dTolEqual(rx1, test.Rx1) {
1972                         t.Errorf("drotmg rx1 mismatch %v: expected %v, found %v", test.Name, test.Rx1, rx1)
1973                 }
1974         }
1975 }
1976
1977 type Droter interface {
1978         Drot(n int, x []float64, incX int, y []float64, incY int, c, s float64)
1979 }
1980
1981 func DrotTest(t *testing.T, d Droter) {
1982         drot := d.Drot
1983         for _, c := range DoubleTwoVectorCases {
1984                 for _, kind := range c.DrotCases {
1985                         dCopyTwoTmp(c.X, c.XTmp, c.Y, c.YTmp)
1986                         if c.Panic {
1987                                 f := func() { drot(c.N, c.XTmp, c.Incx, c.YTmp, c.Incy, kind.C, kind.S) }
1988                                 testpanics(f, c.Name, t)
1989                                 continue
1990                         }
1991                         drot(c.N, c.XTmp, c.Incx, c.YTmp, c.Incy, kind.C, kind.S)
1992                         if !dSliceTolEqual(c.XTmp, kind.XAns) {
1993                                 t.Errorf("drot: x mismatch %v: expected %v, found %v", c.Name, kind.XAns, c.XTmp)
1994                         }
1995                         if !dSliceTolEqual(c.YTmp, kind.YAns) {
1996                                 t.Errorf("drot: y mismatch %v: expected %v, found %v", c.Name, kind.YAns, c.YTmp)
1997                         }
1998                 }
1999         }
2000 }
2001
2002 type Drotmer interface {
2003         Drotm(n int, x []float64, incX int, y []float64, incY int, p blas.DrotmParams)
2004 }
2005
2006 func DrotmTest(t *testing.T, d Drotmer) {
2007         drotm := d.Drotm
2008         for _, c := range DoubleTwoVectorCases {
2009                 for _, kind := range c.DrotmCases {
2010                         dCopyTwoTmp(c.X, c.XTmp, c.Y, c.YTmp)
2011                         if c.Panic {
2012                                 f := func() { drotm(c.N, c.XTmp, c.Incx, c.YTmp, c.Incy, kind.P) }
2013                                 testpanics(f, c.Name+", "+kind.Name, t)
2014                                 continue
2015                         }
2016                         drotm(c.N, c.XTmp, c.Incx, c.YTmp, c.Incy, kind.P)
2017                         if !dSliceTolEqual(c.XTmp, kind.XAns) {
2018                                 t.Errorf("drotm: mismatch %v: expected %v, found %v", c.Name, kind.XAns, c.XTmp)
2019                         }
2020                         if !dSliceTolEqual(c.YTmp, kind.YAns) {
2021                                 t.Errorf("drotm: mismatch %v: expected %v, found %v", c.Name, kind.YAns, c.YTmp)
2022                         }
2023                 }
2024         }
2025 }
2026
2027 type Dscaler interface {
2028         Dscal(n int, alpha float64, x []float64, incX int)
2029 }
2030
2031 func DscalTest(t *testing.T, blasser Dscaler) {
2032         dscal := blasser.Dscal
2033         for _, c := range DoubleOneVectorCases {
2034                 for _, kind := range c.DscalCases {
2035                         xTmp := make([]float64, len(c.X))
2036                         copy(xTmp, c.X)
2037                         if c.Panic {
2038                                 f := func() { dscal(c.N, kind.Alpha, xTmp, c.Incx) }
2039                                 testpanics(f, c.Name, t)
2040                                 continue
2041                         }
2042                         dscal(c.N, kind.Alpha, xTmp, c.Incx)
2043                         if !dSliceTolEqual(xTmp, kind.Ans) {
2044                                 t.Errorf("dscal: mismatch %v, %v: expected %v, found %v", c.Name, kind.Name, kind.Ans, xTmp)
2045                         }
2046                 }
2047         }
2048 }