Skip to content
This repository has been archived by the owner on Nov 24, 2018. It is now read-only.

Commit

Permalink
testlapack: update test for Dlasy2
Browse files Browse the repository at this point in the history
  • Loading branch information
vladimir-ch committed Jun 8, 2016
1 parent 978ee7f commit 9ef21ee
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions testlapack/dlasy2.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
package testlapack

import (
"fmt"
"math"
"math/rand"
"testing"
Expand Down Expand Up @@ -50,6 +51,13 @@ func testDlasy2(t *testing.T, impl Dlasy2er, tranl, tranr bool, isgn, n1, n2, ex
return
}

prefix := fmt.Sprintf("Case n1=%v, n2=%v, isgn=%v", n1, n2, isgn)

// Check any invalid modifications of x.
if !generalOutsideAllNaN(x) {
t.Errorf("%v: out-of-range write to x\n%v", prefix, x.Data)
}

var xnormWant float64
for i := 0; i < n1; i++ {
var rowsum float64
Expand All @@ -61,7 +69,7 @@ func testDlasy2(t *testing.T, impl Dlasy2er, tranl, tranr bool, isgn, n1, n2, ex
}
}
if xnormWant != xnorm {
t.Errorf("Case n1=%v, n2=%v, isgn=%v, scale=%v, ok=%v: unexpected xnorm: want %v, got %v", n1, n2, isgn, scale, ok, xnormWant, xnorm)
t.Errorf("%v: unexpected xnorm: want %v, got %v", prefix, xnormWant, xnorm)
}

// Multiply b by scale to get the wanted right-hand side.
Expand All @@ -87,7 +95,7 @@ func testDlasy2(t *testing.T, impl Dlasy2er, tranl, tranr bool, isgn, n1, n2, ex
for j := 0; j < n2; j++ {
diff := lhsWant.Data[i*lhsWant.Stride+j] - b.Data[i*b.Stride+j]
if math.Abs(diff) > 1e-11 && ok {
t.Errorf("Case n1=%v, n2=%v, isgn=%v, scale=%v: unexpected result, diff[%v,%v]=%v", n1, n2, isgn, scale, i, j, diff)
t.Errorf("%v: unexpected result, diff[%v,%v]=%v", prefix, i, j, diff)
}
}
}
Expand Down

0 comments on commit 9ef21ee

Please sign in to comment.