1 // Copyright ©2016 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.
13 type Dlae2er interface {
14 Dlae2(a, b, c float64) (rt1, rt2 float64)
17 func Dlae2Test(t *testing.T, impl Dlae2er) {
18 for _, test := range []struct {
35 rt1, rt2 := impl.Dlae2(a, b, c)
37 errStr := fmt.Sprintf("a = %v, b = %v, c = %v", a, b, c)
38 // Check if rt1 and rt2 are eigenvalues by checking if det(a - λI) = 0
42 if math.Abs(det) > 1e-10 {
43 t.Errorf("First eigenvalue mismatch. %s. Det = %v", errStr, det)
49 if math.Abs(det) > 1e-10 {
50 t.Errorf("Second eigenvalue mismatch. %s. Det = %v", errStr, det)