func TestCorrBankStrideNaive_vsDecimate(t *testing.T) { const ( numOut = 4 eps = 1e-9 ) for _, q := range strideCases { f := randImage(q.ImSize.X, q.ImSize.Y) g := randBank(q.TmplSize.X, q.TmplSize.Y, numOut) h, err := slide.CorrBankNaive(f, g) if err != nil { t.Errorf("im %v, tmpl %v, stride %d: %v", q.ImSize, q.TmplSize, q.K, err) continue } want := slide.DecimateMulti(h, q.K) got, err := slide.CorrBankStrideNaive(f, g, q.K) if err != nil { t.Errorf("im %v, tmpl %v, stride %d: %v", q.ImSize, q.TmplSize, q.K, err) continue } if err := errIfNotEqMulti(want, got, eps); err != nil { t.Errorf("im %v, tmpl %v, stride %d: %v", q.ImSize, q.TmplSize, q.K, err) continue } } }
func TestCorrBankStrideBLAS_vsNaive(t *testing.T) { const ( m = 40 n = 30 w = 100 h = 80 numOut = 6 stride = 3 eps = 1e-9 ) f := randImage(w, h) g := randBank(w, h, numOut) naive, err := slide.CorrBankStrideNaive(f, g, stride) if err != nil { t.Fatal(err) } blas, err := slide.CorrBankStrideBLAS(f, g, stride) if err != nil { t.Fatal(err) } if err := errIfNotEqMulti(naive, blas, eps); err != nil { t.Fatal(err) } }