lapack: rename ComputeEV and add EVNone

This commit is contained in:
Vladimir Chalupecky
2018-08-22 13:41:29 +02:00
committed by Vladimír Chalupecký
parent 0d92706921
commit de667f08e7
5 changed files with 26 additions and 13 deletions

View File

@@ -19,9 +19,9 @@ import (
// at least n, and Dsyev will panic otherwise.
//
// On entry, a contains the elements of the symmetric matrix A in the triangular
// portion specified by uplo. If jobz == lapack.ComputeEV a contains the
// orthonormal eigenvectors of A on exit, otherwise on exit the specified
// triangular region is overwritten.
// portion specified by uplo. If jobz == lapack.EVCompute, a contains the
// orthonormal eigenvectors of A on exit, otherwise jobz must be lapack.EVNone
// and on exit the specified triangular region is overwritten.
//
// work is temporary storage, and lwork specifies the usable memory length. At minimum,
// lwork >= 3*n-1, and Dsyev will panic otherwise. The amount of blocking is
@@ -30,7 +30,14 @@ import (
func (impl Implementation) Dsyev(jobz lapack.EVJob, uplo blas.Uplo, n int, a []float64, lda int, w, work []float64, lwork int) (ok bool) {
checkMatrix(n, n, a, lda)
upper := uplo == blas.Upper
wantz := jobz == lapack.ComputeEV
var wantz bool
switch jobz {
default:
panic(badEVJob)
case lapack.EVCompute:
wantz = true
case lapack.EVNone:
}
var opts string
if upper {
opts = "U"

View File

@@ -137,16 +137,22 @@ const (
UpdateSchur EVComp = 'V'
)
// EVJob specifies whether eigenvectors are computed in Dsyev.
type EVJob byte
const (
EVCompute EVJob = 'V' // Eigenvectors are computed.
EVNone EVJob = 'N' // Eigenvectors are not computed.
)
// Job types for computation of eigenvectors.
type (
EVJob byte
LeftEVJob byte
RightEVJob byte
)
// Job constants for computation of eigenvectors.
const (
ComputeEV EVJob = 'V' // Compute eigenvectors in Dsyev.
ComputeLeftEV LeftEVJob = 'V' // Compute left eigenvectors.
ComputeRightEV RightEVJob = 'V' // Compute right eigenvectors.
)

View File

@@ -454,9 +454,9 @@ func Pocon(a blas64.Symmetric, anorm float64, work []float64, iwork []int) float
// at least n, and Syev will panic otherwise.
//
// On entry, a contains the elements of the symmetric matrix A in the triangular
// portion specified by uplo. If jobz == lapack.ComputeEV a contains the
// orthonormal eigenvectors of A on exit, otherwise on exit the specified
// triangular region is overwritten.
// portion specified by uplo. If jobz == lapack.EVCompute, a contains the
// orthonormal eigenvectors of A on exit, otherwise jobz must be lapack.EVNone
// and on exit the specified triangular region is overwritten.
//
// Work is temporary storage, and lwork specifies the usable memory length. At minimum,
// lwork >= 3*n-1, and Syev will panic otherwise. The amount of blocking is

View File

@@ -55,9 +55,9 @@ func DsyevTest(t *testing.T, impl Dsyever) {
}
work := make([]float64, 1)
impl.Dsyev(lapack.ComputeEV, uplo, n, a, lda, w, work, -1)
impl.Dsyev(lapack.EVCompute, uplo, n, a, lda, w, work, -1)
work = make([]float64, int(work[0]))
impl.Dsyev(lapack.ComputeEV, uplo, n, a, lda, w, work, len(work))
impl.Dsyev(lapack.EVCompute, uplo, n, a, lda, w, work, len(work))
// Check that the decomposition is correct
orig := blas64.General{

View File

@@ -38,9 +38,9 @@ func (e *EigenSym) Factorize(a Symmetric, vectors bool) (ok bool) {
sd := NewSymDense(n, nil)
sd.CopySym(a)
jobz := lapack.EVJob(lapack.None)
jobz := lapack.EVNone
if vectors {
jobz = lapack.ComputeEV
jobz = lapack.EVCompute
}
w := make([]float64, n)
work := []float64{0}