lapack,native: rename EigDecomp and EigBoth consts to OriginalEV and TridiagEV

As a side effect fix the documentation of Dsteqr which has the description
reversed.
This commit is contained in:
Vladimir Chalupecky
2016-10-08 23:27:38 +09:00
parent c02fe3f6ff
commit 0c9ab78926
3 changed files with 17 additions and 16 deletions

View File

@@ -112,12 +112,12 @@ const (
type EVComp byte
const (
// EigDecomp specifies to compute the eigenvalues and eigenvectors of the
// full symmetric matrix.
EigDecomp EVComp = 'V'
// EigBoth specifies to compute both the eigenvalues and eigenvectors of the
// input tridiagonal matrix.
EigBoth EVComp = 'I'
// OriginalEV specifies to compute the eigenvectors of the original
// matrix.
OriginalEV EVComp = 'V'
// TridiagEV specifies to compute both the eigenvectors of the input
// tridiagonal matrix.
TridiagEV EVComp = 'I'
)
// Job types for computation of eigenvectors.

View File

@@ -26,9 +26,9 @@ import (
// Dsteqr will panic otherwise.
//
// z, on entry, contains the n×n orthogonal matrix used in the reduction to
// tridiagonal form if compz == lapack.EigDecomp. On exit, if
// compz == lapack.EigBoth, z contains the orthonormal eigenvectors of the
// original symmetric matrix, and if compz == lapack.EigDecomp, z contains the
// tridiagonal form if compz == lapack.OriginalEV. On exit, if
// compz == lapack.OriginalEV, z contains the orthonormal eigenvectors of the
// original symmetric matrix, and if compz == lapack.TridiagEV, z contains the
// orthonormal eigenvectors of the symmetric tridiagonal matrix. z is not used
// if compz == lapack.None.
//
@@ -43,7 +43,7 @@ func (impl Implementation) Dsteqr(compz lapack.EVComp, n int, d, e, z []float64,
if len(e) < n-1 {
panic(badE)
}
if compz != lapack.None && compz != lapack.EigBoth && compz != lapack.EigDecomp {
if compz != lapack.None && compz != lapack.TridiagEV && compz != lapack.OriginalEV {
panic(badEVComp)
}
if compz != lapack.None {
@@ -54,9 +54,9 @@ func (impl Implementation) Dsteqr(compz lapack.EVComp, n int, d, e, z []float64,
}
var icompz int
if compz == lapack.EigDecomp {
if compz == lapack.OriginalEV {
icompz = 1
} else if compz == lapack.EigBoth {
} else if compz == lapack.TridiagEV {
icompz = 2
}

View File

@@ -21,7 +21,7 @@ type Dsteqrer interface {
func DsteqrTest(t *testing.T, impl Dsteqrer) {
rnd := rand.New(rand.NewSource(1))
for _, compz := range []lapack.EVComp{lapack.EigDecomp, lapack.EigBoth} {
for _, compz := range []lapack.EVComp{lapack.OriginalEV, lapack.TridiagEV} {
for _, test := range []struct {
n, lda int
}{
@@ -58,7 +58,7 @@ func DsteqrTest(t *testing.T, impl Dsteqrer) {
copy(eCopy, e)
aCopy := make([]float64, len(a))
copy(aCopy, a)
if compz == lapack.EigDecomp {
if compz == lapack.OriginalEV {
// Compute triangular decomposition and orthonormal matrix.
uplo := blas.Upper
tau := make([]float64, n)
@@ -90,7 +90,7 @@ func DsteqrTest(t *testing.T, impl Dsteqrer) {
copy(dAns, d)
var truth blas64.General
if compz == lapack.EigDecomp {
if compz == lapack.OriginalEV {
truth = blas64.General{
Rows: n,
Cols: n,
@@ -127,7 +127,8 @@ func DsteqrTest(t *testing.T, impl Dsteqrer) {
Data: a,
}
if !eigenDecompCorrect(d, truth, V) {
t.Errorf("Eigen reconstruction mismatch. fromFull = %v, n = %v", compz == lapack.EigDecomp, n)
t.Errorf("Eigen reconstruction mismatch. fromFull = %v, n = %v",
compz == lapack.OriginalEV, n)
}
// Compare eigenvalues when not computing eigenvectors.