gonum.org/v1/gonum@v0.14.0/blas/testblas/dtrmm.go (about)

     1  // Copyright ©2014 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  	"testing"
     9  
    10  	"gonum.org/v1/gonum/blas"
    11  	"gonum.org/v1/gonum/floats"
    12  )
    13  
    14  type Dtrmmer interface {
    15  	Dtrmm(s blas.Side, ul blas.Uplo, tA blas.Transpose, d blas.Diag, m, n int, alpha float64, a []float64, lda int, b []float64, ldb int)
    16  }
    17  
    18  func DtrmmTest(t *testing.T, blasser Dtrmmer) {
    19  	for i, test := range []struct {
    20  		s     blas.Side
    21  		ul    blas.Uplo
    22  		tA    blas.Transpose
    23  		d     blas.Diag
    24  		m     int
    25  		n     int
    26  		alpha float64
    27  		a     [][]float64
    28  		b     [][]float64
    29  		ans   [][]float64
    30  	}{
    31  		{
    32  			s:     blas.Left,
    33  			ul:    blas.Upper,
    34  			tA:    blas.NoTrans,
    35  			d:     blas.NonUnit,
    36  			m:     4,
    37  			n:     3,
    38  			alpha: 2,
    39  			a: [][]float64{
    40  				{1, 2, 3, 4},
    41  				{0, 5, 6, 7},
    42  				{0, 0, 8, 9},
    43  				{0, 0, 0, 10},
    44  			},
    45  			b: [][]float64{
    46  				{10, 11, 12},
    47  				{13, 14, 15},
    48  				{16, 17, 18},
    49  				{19, 20, 21},
    50  			},
    51  			ans: [][]float64{
    52  				{320, 340, 360},
    53  				{588, 624, 660},
    54  				{598, 632, 666},
    55  				{380, 400, 420},
    56  			},
    57  		},
    58  		{
    59  			s:     blas.Left,
    60  			ul:    blas.Upper,
    61  			tA:    blas.NoTrans,
    62  			d:     blas.NonUnit,
    63  			m:     2,
    64  			n:     3,
    65  			alpha: 2,
    66  			a: [][]float64{
    67  				{1, 2},
    68  				{0, 5},
    69  			},
    70  			b: [][]float64{
    71  				{10, 11, 12},
    72  				{13, 14, 15},
    73  			},
    74  			ans: [][]float64{
    75  				{72, 78, 84},
    76  				{130, 140, 150},
    77  			},
    78  		},
    79  		{
    80  			s:     blas.Left,
    81  			ul:    blas.Upper,
    82  			tA:    blas.NoTrans,
    83  			d:     blas.Unit,
    84  			m:     4,
    85  			n:     3,
    86  			alpha: 2,
    87  			a: [][]float64{
    88  				{1, 2, 3, 4},
    89  				{0, 5, 6, 7},
    90  				{0, 0, 8, 9},
    91  				{0, 0, 0, 10},
    92  			},
    93  			b: [][]float64{
    94  				{10, 11, 12},
    95  				{13, 14, 15},
    96  				{16, 17, 18},
    97  				{19, 20, 21},
    98  			},
    99  			ans: [][]float64{
   100  				{320, 340, 360},
   101  				{484, 512, 540},
   102  				{374, 394, 414},
   103  				{38, 40, 42},
   104  			},
   105  		},
   106  		{
   107  			s:     blas.Left,
   108  			ul:    blas.Upper,
   109  			tA:    blas.NoTrans,
   110  			d:     blas.Unit,
   111  			m:     2,
   112  			n:     3,
   113  			alpha: 2,
   114  			a: [][]float64{
   115  				{1, 2},
   116  				{0, 5},
   117  			},
   118  			b: [][]float64{
   119  				{10, 11, 12},
   120  				{13, 14, 15},
   121  			},
   122  			ans: [][]float64{
   123  				{72, 78, 84},
   124  				{26, 28, 30},
   125  			},
   126  		},
   127  		{
   128  			s:     blas.Left,
   129  			ul:    blas.Lower,
   130  			tA:    blas.NoTrans,
   131  			d:     blas.NonUnit,
   132  			m:     4,
   133  			n:     3,
   134  			alpha: 2,
   135  			a: [][]float64{
   136  				{1, 0, 0, 0},
   137  				{2, 5, 0, 0},
   138  				{3, 6, 8, 0},
   139  				{4, 7, 9, 10},
   140  			},
   141  			b: [][]float64{
   142  				{10, 11, 12},
   143  				{13, 14, 15},
   144  				{16, 17, 18},
   145  				{19, 20, 21},
   146  			},
   147  			ans: [][]float64{
   148  				{20, 22, 24},
   149  				{170, 184, 198},
   150  				{472, 506, 540},
   151  				{930, 990, 1050},
   152  			},
   153  		},
   154  		{
   155  			s:     blas.Left,
   156  			ul:    blas.Lower,
   157  			tA:    blas.NoTrans,
   158  			d:     blas.NonUnit,
   159  			m:     2,
   160  			n:     3,
   161  			alpha: 2,
   162  			a: [][]float64{
   163  				{1, 0},
   164  				{2, 5},
   165  			},
   166  			b: [][]float64{
   167  				{10, 11, 12},
   168  				{13, 14, 15},
   169  			},
   170  			ans: [][]float64{
   171  				{20, 22, 24},
   172  				{170, 184, 198},
   173  			},
   174  		},
   175  		{
   176  			s:     blas.Left,
   177  			ul:    blas.Lower,
   178  			tA:    blas.NoTrans,
   179  			d:     blas.Unit,
   180  			m:     4,
   181  			n:     3,
   182  			alpha: 2,
   183  			a: [][]float64{
   184  				{1, 0, 0, 0},
   185  				{2, 5, 0, 0},
   186  				{3, 6, 8, 0},
   187  				{4, 7, 9, 10},
   188  			},
   189  			b: [][]float64{
   190  				{10, 11, 12},
   191  				{13, 14, 15},
   192  				{16, 17, 18},
   193  				{19, 20, 21},
   194  			},
   195  			ans: [][]float64{
   196  				{20, 22, 24},
   197  				{66, 72, 78},
   198  				{248, 268, 288},
   199  				{588, 630, 672},
   200  			},
   201  		},
   202  		{
   203  			s:     blas.Left,
   204  			ul:    blas.Lower,
   205  			tA:    blas.NoTrans,
   206  			d:     blas.Unit,
   207  			m:     2,
   208  			n:     3,
   209  			alpha: 2,
   210  			a: [][]float64{
   211  				{1, 0},
   212  				{2, 5},
   213  			},
   214  			b: [][]float64{
   215  				{10, 11, 12},
   216  				{13, 14, 15},
   217  			},
   218  			ans: [][]float64{
   219  				{20, 22, 24},
   220  				{66, 72, 78},
   221  			},
   222  		},
   223  		{
   224  			s:     blas.Left,
   225  			ul:    blas.Upper,
   226  			tA:    blas.Trans,
   227  			d:     blas.NonUnit,
   228  			m:     4,
   229  			n:     3,
   230  			alpha: 2,
   231  			a: [][]float64{
   232  				{1, 2, 3, 4},
   233  				{0, 5, 6, 7},
   234  				{0, 0, 8, 9},
   235  				{0, 0, 0, 10},
   236  			},
   237  			b: [][]float64{
   238  				{10, 11, 12},
   239  				{13, 14, 15},
   240  				{16, 17, 18},
   241  				{19, 20, 21},
   242  			},
   243  			ans: [][]float64{
   244  				{20, 22, 24},
   245  				{170, 184, 198},
   246  				{472, 506, 540},
   247  				{930, 990, 1050},
   248  			},
   249  		},
   250  		{
   251  			s:     blas.Left,
   252  			ul:    blas.Upper,
   253  			tA:    blas.Trans,
   254  			d:     blas.NonUnit,
   255  			m:     2,
   256  			n:     3,
   257  			alpha: 2,
   258  			a: [][]float64{
   259  				{1, 2},
   260  				{0, 5},
   261  			},
   262  			b: [][]float64{
   263  				{10, 11, 12},
   264  				{13, 14, 15},
   265  			},
   266  			ans: [][]float64{
   267  				{20, 22, 24},
   268  				{170, 184, 198},
   269  			},
   270  		},
   271  		{
   272  			s:     blas.Left,
   273  			ul:    blas.Upper,
   274  			tA:    blas.Trans,
   275  			d:     blas.Unit,
   276  			m:     4,
   277  			n:     3,
   278  			alpha: 2,
   279  			a: [][]float64{
   280  				{1, 2, 3, 4},
   281  				{0, 5, 6, 7},
   282  				{0, 0, 8, 9},
   283  				{0, 0, 0, 10},
   284  			},
   285  			b: [][]float64{
   286  				{10, 11, 12},
   287  				{13, 14, 15},
   288  				{16, 17, 18},
   289  				{19, 20, 21},
   290  			},
   291  			ans: [][]float64{
   292  				{20, 22, 24},
   293  				{66, 72, 78},
   294  				{248, 268, 288},
   295  				{588, 630, 672},
   296  			},
   297  		},
   298  		{
   299  			s:     blas.Left,
   300  			ul:    blas.Upper,
   301  			tA:    blas.Trans,
   302  			d:     blas.Unit,
   303  			m:     2,
   304  			n:     3,
   305  			alpha: 2,
   306  			a: [][]float64{
   307  				{1, 2},
   308  				{0, 5},
   309  			},
   310  			b: [][]float64{
   311  				{10, 11, 12},
   312  				{13, 14, 15},
   313  			},
   314  			ans: [][]float64{
   315  				{20, 22, 24},
   316  				{66, 72, 78},
   317  			},
   318  		},
   319  		{
   320  			s:     blas.Left,
   321  			ul:    blas.Lower,
   322  			tA:    blas.Trans,
   323  			d:     blas.NonUnit,
   324  			m:     4,
   325  			n:     3,
   326  			alpha: 2,
   327  			a: [][]float64{
   328  				{1, 0, 0, 0},
   329  				{2, 5, 0, 0},
   330  				{3, 6, 8, 0},
   331  				{4, 7, 9, 10},
   332  			},
   333  			b: [][]float64{
   334  				{10, 11, 12},
   335  				{13, 14, 15},
   336  				{16, 17, 18},
   337  				{19, 20, 21},
   338  			},
   339  			ans: [][]float64{
   340  				{320, 340, 360},
   341  				{588, 624, 660},
   342  				{598, 632, 666},
   343  				{380, 400, 420},
   344  			},
   345  		},
   346  		{
   347  			s:     blas.Left,
   348  			ul:    blas.Lower,
   349  			tA:    blas.Trans,
   350  			d:     blas.NonUnit,
   351  			m:     2,
   352  			n:     3,
   353  			alpha: 2,
   354  			a: [][]float64{
   355  				{1, 0},
   356  				{2, 5},
   357  			},
   358  			b: [][]float64{
   359  				{10, 11, 12},
   360  				{13, 14, 15},
   361  			},
   362  			ans: [][]float64{
   363  				{72, 78, 84},
   364  				{130, 140, 150},
   365  			},
   366  		},
   367  		{
   368  			s:     blas.Left,
   369  			ul:    blas.Lower,
   370  			tA:    blas.Trans,
   371  			d:     blas.Unit,
   372  			m:     4,
   373  			n:     3,
   374  			alpha: 2,
   375  			a: [][]float64{
   376  				{1, 0, 0, 0},
   377  				{2, 5, 0, 0},
   378  				{3, 6, 8, 0},
   379  				{4, 7, 9, 10},
   380  			},
   381  			b: [][]float64{
   382  				{10, 11, 12},
   383  				{13, 14, 15},
   384  				{16, 17, 18},
   385  				{19, 20, 21},
   386  			},
   387  			ans: [][]float64{
   388  				{320, 340, 360},
   389  				{484, 512, 540},
   390  				{374, 394, 414},
   391  				{38, 40, 42},
   392  			},
   393  		},
   394  		{
   395  			s:     blas.Left,
   396  			ul:    blas.Lower,
   397  			tA:    blas.Trans,
   398  			d:     blas.Unit,
   399  			m:     2,
   400  			n:     3,
   401  			alpha: 2,
   402  			a: [][]float64{
   403  				{1, 0},
   404  				{2, 5},
   405  			},
   406  			b: [][]float64{
   407  				{10, 11, 12},
   408  				{13, 14, 15},
   409  			},
   410  			ans: [][]float64{
   411  				{72, 78, 84},
   412  				{26, 28, 30},
   413  			},
   414  		},
   415  		{
   416  			s:     blas.Right,
   417  			ul:    blas.Upper,
   418  			tA:    blas.NoTrans,
   419  			d:     blas.NonUnit,
   420  			m:     4,
   421  			n:     3,
   422  			alpha: 2,
   423  			a: [][]float64{
   424  				{1, 2, 3},
   425  				{0, 4, 5},
   426  				{0, 0, 6},
   427  			},
   428  			b: [][]float64{
   429  				{10, 11, 12},
   430  				{13, 14, 15},
   431  				{16, 17, 18},
   432  				{19, 20, 21},
   433  			},
   434  			ans: [][]float64{
   435  				{20, 128, 314},
   436  				{26, 164, 398},
   437  				{32, 200, 482},
   438  				{38, 236, 566},
   439  			},
   440  		},
   441  		{
   442  			s:     blas.Right,
   443  			ul:    blas.Upper,
   444  			tA:    blas.NoTrans,
   445  			d:     blas.NonUnit,
   446  			m:     2,
   447  			n:     3,
   448  			alpha: 2,
   449  			a: [][]float64{
   450  				{1, 2, 3},
   451  				{0, 4, 5},
   452  				{0, 0, 6},
   453  			},
   454  			b: [][]float64{
   455  				{10, 11, 12},
   456  				{13, 14, 15},
   457  			},
   458  			ans: [][]float64{
   459  				{20, 128, 314},
   460  				{26, 164, 398},
   461  			},
   462  		},
   463  		{
   464  			s:     blas.Right,
   465  			ul:    blas.Upper,
   466  			tA:    blas.NoTrans,
   467  			d:     blas.Unit,
   468  			m:     4,
   469  			n:     3,
   470  			alpha: 2,
   471  			a: [][]float64{
   472  				{1, 2, 3},
   473  				{0, 4, 5},
   474  				{0, 0, 6},
   475  			},
   476  			b: [][]float64{
   477  				{10, 11, 12},
   478  				{13, 14, 15},
   479  				{16, 17, 18},
   480  				{19, 20, 21},
   481  			},
   482  			ans: [][]float64{
   483  				{20, 62, 194},
   484  				{26, 80, 248},
   485  				{32, 98, 302},
   486  				{38, 116, 356},
   487  			},
   488  		},
   489  		{
   490  			s:     blas.Right,
   491  			ul:    blas.Upper,
   492  			tA:    blas.NoTrans,
   493  			d:     blas.Unit,
   494  			m:     2,
   495  			n:     3,
   496  			alpha: 2,
   497  			a: [][]float64{
   498  				{1, 2, 3},
   499  				{0, 4, 5},
   500  				{0, 0, 6},
   501  			},
   502  			b: [][]float64{
   503  				{10, 11, 12},
   504  				{13, 14, 15},
   505  			},
   506  			ans: [][]float64{
   507  				{20, 62, 194},
   508  				{26, 80, 248},
   509  			},
   510  		},
   511  		{
   512  			s:     blas.Right,
   513  			ul:    blas.Lower,
   514  			tA:    blas.NoTrans,
   515  			d:     blas.NonUnit,
   516  			m:     4,
   517  			n:     3,
   518  			alpha: 2,
   519  			a: [][]float64{
   520  				{1, 0, 0},
   521  				{2, 4, 0},
   522  				{3, 5, 6},
   523  			},
   524  			b: [][]float64{
   525  				{10, 11, 12},
   526  				{13, 14, 15},
   527  				{16, 17, 18},
   528  				{19, 20, 21},
   529  			},
   530  			ans: [][]float64{
   531  				{136, 208, 144},
   532  				{172, 262, 180},
   533  				{208, 316, 216},
   534  				{244, 370, 252},
   535  			},
   536  		},
   537  		{
   538  			s:     blas.Right,
   539  			ul:    blas.Lower,
   540  			tA:    blas.NoTrans,
   541  			d:     blas.NonUnit,
   542  			m:     2,
   543  			n:     3,
   544  			alpha: 2,
   545  			a: [][]float64{
   546  				{1, 0, 0},
   547  				{2, 4, 0},
   548  				{3, 5, 6},
   549  			},
   550  			b: [][]float64{
   551  				{10, 11, 12},
   552  				{13, 14, 15},
   553  			},
   554  			ans: [][]float64{
   555  				{136, 208, 144},
   556  				{172, 262, 180},
   557  			},
   558  		},
   559  		{
   560  			s:     blas.Right,
   561  			ul:    blas.Lower,
   562  			tA:    blas.NoTrans,
   563  			d:     blas.Unit,
   564  			m:     4,
   565  			n:     3,
   566  			alpha: 2,
   567  			a: [][]float64{
   568  				{1, 0, 0},
   569  				{2, 4, 0},
   570  				{3, 5, 6},
   571  			},
   572  			b: [][]float64{
   573  				{10, 11, 12},
   574  				{13, 14, 15},
   575  				{16, 17, 18},
   576  				{19, 20, 21},
   577  			},
   578  			ans: [][]float64{
   579  				{136, 142, 24},
   580  				{172, 178, 30},
   581  				{208, 214, 36},
   582  				{244, 250, 42},
   583  			},
   584  		},
   585  		{
   586  			s:     blas.Right,
   587  			ul:    blas.Lower,
   588  			tA:    blas.NoTrans,
   589  			d:     blas.Unit,
   590  			m:     2,
   591  			n:     3,
   592  			alpha: 2,
   593  			a: [][]float64{
   594  				{1, 0, 0},
   595  				{2, 4, 0},
   596  				{3, 5, 6},
   597  			},
   598  			b: [][]float64{
   599  				{10, 11, 12},
   600  				{13, 14, 15},
   601  			},
   602  			ans: [][]float64{
   603  				{136, 142, 24},
   604  				{172, 178, 30},
   605  			},
   606  		},
   607  
   608  		{
   609  			s:     blas.Right,
   610  			ul:    blas.Upper,
   611  			tA:    blas.Trans,
   612  			d:     blas.NonUnit,
   613  			m:     4,
   614  			n:     3,
   615  			alpha: 2,
   616  			a: [][]float64{
   617  				{1, 2, 3},
   618  				{0, 4, 5},
   619  				{0, 0, 6},
   620  			},
   621  			b: [][]float64{
   622  				{10, 11, 12},
   623  				{13, 14, 15},
   624  				{16, 17, 18},
   625  				{19, 20, 21},
   626  			},
   627  			ans: [][]float64{
   628  				{136, 208, 144},
   629  				{172, 262, 180},
   630  				{208, 316, 216},
   631  				{244, 370, 252},
   632  			},
   633  		},
   634  		{
   635  			s:     blas.Right,
   636  			ul:    blas.Upper,
   637  			tA:    blas.Trans,
   638  			d:     blas.NonUnit,
   639  			m:     2,
   640  			n:     3,
   641  			alpha: 2,
   642  			a: [][]float64{
   643  				{1, 2, 3},
   644  				{0, 4, 5},
   645  				{0, 0, 6},
   646  			},
   647  			b: [][]float64{
   648  				{10, 11, 12},
   649  				{13, 14, 15},
   650  			},
   651  			ans: [][]float64{
   652  				{136, 208, 144},
   653  				{172, 262, 180},
   654  			},
   655  		},
   656  		{
   657  			s:     blas.Right,
   658  			ul:    blas.Upper,
   659  			tA:    blas.Trans,
   660  			d:     blas.Unit,
   661  			m:     4,
   662  			n:     3,
   663  			alpha: 2,
   664  			a: [][]float64{
   665  				{1, 2, 3},
   666  				{0, 4, 5},
   667  				{0, 0, 6},
   668  			},
   669  			b: [][]float64{
   670  				{10, 11, 12},
   671  				{13, 14, 15},
   672  				{16, 17, 18},
   673  				{19, 20, 21},
   674  			},
   675  			ans: [][]float64{
   676  				{136, 142, 24},
   677  				{172, 178, 30},
   678  				{208, 214, 36},
   679  				{244, 250, 42},
   680  			},
   681  		},
   682  		{
   683  			s:     blas.Right,
   684  			ul:    blas.Upper,
   685  			tA:    blas.Trans,
   686  			d:     blas.Unit,
   687  			m:     2,
   688  			n:     3,
   689  			alpha: 2,
   690  			a: [][]float64{
   691  				{1, 2, 3},
   692  				{0, 4, 5},
   693  				{0, 0, 6},
   694  			},
   695  			b: [][]float64{
   696  				{10, 11, 12},
   697  				{13, 14, 15},
   698  			},
   699  			ans: [][]float64{
   700  				{136, 142, 24},
   701  				{172, 178, 30},
   702  			},
   703  		},
   704  
   705  		{
   706  			s:     blas.Right,
   707  			ul:    blas.Lower,
   708  			tA:    blas.Trans,
   709  			d:     blas.NonUnit,
   710  			m:     4,
   711  			n:     3,
   712  			alpha: 2,
   713  			a: [][]float64{
   714  				{1, 0, 0},
   715  				{2, 4, 0},
   716  				{3, 5, 6},
   717  			},
   718  			b: [][]float64{
   719  				{10, 11, 12},
   720  				{13, 14, 15},
   721  				{16, 17, 18},
   722  				{19, 20, 21},
   723  			},
   724  			ans: [][]float64{
   725  				{20, 128, 314},
   726  				{26, 164, 398},
   727  				{32, 200, 482},
   728  				{38, 236, 566},
   729  			},
   730  		},
   731  		{
   732  			s:     blas.Right,
   733  			ul:    blas.Lower,
   734  			tA:    blas.Trans,
   735  			d:     blas.NonUnit,
   736  			m:     2,
   737  			n:     3,
   738  			alpha: 2,
   739  			a: [][]float64{
   740  				{1, 0, 0},
   741  				{2, 4, 0},
   742  				{3, 5, 6},
   743  			},
   744  			b: [][]float64{
   745  				{10, 11, 12},
   746  				{13, 14, 15},
   747  			},
   748  			ans: [][]float64{
   749  				{20, 128, 314},
   750  				{26, 164, 398},
   751  			},
   752  		},
   753  		{
   754  			s:     blas.Right,
   755  			ul:    blas.Lower,
   756  			tA:    blas.Trans,
   757  			d:     blas.Unit,
   758  			m:     4,
   759  			n:     3,
   760  			alpha: 2,
   761  			a: [][]float64{
   762  				{1, 0, 0},
   763  				{2, 4, 0},
   764  				{3, 5, 6},
   765  			},
   766  			b: [][]float64{
   767  				{10, 11, 12},
   768  				{13, 14, 15},
   769  				{16, 17, 18},
   770  				{19, 20, 21},
   771  			},
   772  			ans: [][]float64{
   773  				{20, 62, 194},
   774  				{26, 80, 248},
   775  				{32, 98, 302},
   776  				{38, 116, 356},
   777  			},
   778  		},
   779  		{
   780  			s:     blas.Right,
   781  			ul:    blas.Lower,
   782  			tA:    blas.Trans,
   783  			d:     blas.Unit,
   784  			m:     2,
   785  			n:     3,
   786  			alpha: 2,
   787  			a: [][]float64{
   788  				{1, 0, 0},
   789  				{2, 4, 0},
   790  				{3, 5, 6},
   791  			},
   792  			b: [][]float64{
   793  				{10, 11, 12},
   794  				{13, 14, 15},
   795  			},
   796  			ans: [][]float64{
   797  				{20, 62, 194},
   798  				{26, 80, 248},
   799  			},
   800  		},
   801  		{
   802  			s:     blas.Right,
   803  			ul:    blas.Lower,
   804  			tA:    blas.Trans,
   805  			d:     blas.Unit,
   806  			m:     2,
   807  			n:     3,
   808  			alpha: 0,
   809  			a: [][]float64{
   810  				{1, 0, 0},
   811  				{2, 4, 0},
   812  				{3, 5, 6},
   813  			},
   814  			b: [][]float64{
   815  				{10, 11, 12},
   816  				{13, 14, 15},
   817  			},
   818  			ans: [][]float64{
   819  				{0, 0, 0},
   820  				{0, 0, 0},
   821  			},
   822  		},
   823  	} {
   824  		aFlat := flatten(test.a)
   825  		bFlat := flatten(test.b)
   826  		ansFlat := flatten(test.ans)
   827  		blasser.Dtrmm(test.s, test.ul, test.tA, test.d, test.m, test.n, test.alpha, aFlat, len(test.a[0]), bFlat, len(test.b[0]))
   828  		if !floats.EqualApprox(ansFlat, bFlat, 1e-14) {
   829  			t.Errorf("Case %v. Want %v, got %v.", i, ansFlat, bFlat)
   830  		}
   831  	}
   832  }