mirror of
https://github.com/gonum/gonum.git
synced 2025-10-05 15:16:59 +08:00
lapack: rename ComputeEV and add EVNone
This commit is contained in:

committed by
Vladimír Chalupecký

parent
0d92706921
commit
de667f08e7
@@ -19,9 +19,9 @@ import (
|
|||||||
// at least n, and Dsyev will panic otherwise.
|
// at least n, and Dsyev will panic otherwise.
|
||||||
//
|
//
|
||||||
// On entry, a contains the elements of the symmetric matrix A in the triangular
|
// 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
|
// portion specified by uplo. If jobz == lapack.EVCompute, a contains the
|
||||||
// orthonormal eigenvectors of A on exit, otherwise on exit the specified
|
// orthonormal eigenvectors of A on exit, otherwise jobz must be lapack.EVNone
|
||||||
// triangular region is overwritten.
|
// and on exit the specified triangular region is overwritten.
|
||||||
//
|
//
|
||||||
// work is temporary storage, and lwork specifies the usable memory length. At minimum,
|
// 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
|
// 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) {
|
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)
|
checkMatrix(n, n, a, lda)
|
||||||
upper := uplo == blas.Upper
|
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
|
var opts string
|
||||||
if upper {
|
if upper {
|
||||||
opts = "U"
|
opts = "U"
|
||||||
|
@@ -137,16 +137,22 @@ const (
|
|||||||
UpdateSchur EVComp = 'V'
|
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.
|
// Job types for computation of eigenvectors.
|
||||||
type (
|
type (
|
||||||
EVJob byte
|
|
||||||
LeftEVJob byte
|
LeftEVJob byte
|
||||||
RightEVJob byte
|
RightEVJob byte
|
||||||
)
|
)
|
||||||
|
|
||||||
// Job constants for computation of eigenvectors.
|
// Job constants for computation of eigenvectors.
|
||||||
const (
|
const (
|
||||||
ComputeEV EVJob = 'V' // Compute eigenvectors in Dsyev.
|
|
||||||
ComputeLeftEV LeftEVJob = 'V' // Compute left eigenvectors.
|
ComputeLeftEV LeftEVJob = 'V' // Compute left eigenvectors.
|
||||||
ComputeRightEV RightEVJob = 'V' // Compute right eigenvectors.
|
ComputeRightEV RightEVJob = 'V' // Compute right eigenvectors.
|
||||||
)
|
)
|
||||||
|
@@ -454,9 +454,9 @@ func Pocon(a blas64.Symmetric, anorm float64, work []float64, iwork []int) float
|
|||||||
// at least n, and Syev will panic otherwise.
|
// at least n, and Syev will panic otherwise.
|
||||||
//
|
//
|
||||||
// On entry, a contains the elements of the symmetric matrix A in the triangular
|
// 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
|
// portion specified by uplo. If jobz == lapack.EVCompute, a contains the
|
||||||
// orthonormal eigenvectors of A on exit, otherwise on exit the specified
|
// orthonormal eigenvectors of A on exit, otherwise jobz must be lapack.EVNone
|
||||||
// triangular region is overwritten.
|
// and on exit the specified triangular region is overwritten.
|
||||||
//
|
//
|
||||||
// Work is temporary storage, and lwork specifies the usable memory length. At minimum,
|
// 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
|
// lwork >= 3*n-1, and Syev will panic otherwise. The amount of blocking is
|
||||||
|
@@ -55,9 +55,9 @@ func DsyevTest(t *testing.T, impl Dsyever) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
work := make([]float64, 1)
|
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]))
|
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
|
// Check that the decomposition is correct
|
||||||
orig := blas64.General{
|
orig := blas64.General{
|
||||||
|
@@ -38,9 +38,9 @@ func (e *EigenSym) Factorize(a Symmetric, vectors bool) (ok bool) {
|
|||||||
sd := NewSymDense(n, nil)
|
sd := NewSymDense(n, nil)
|
||||||
sd.CopySym(a)
|
sd.CopySym(a)
|
||||||
|
|
||||||
jobz := lapack.EVJob(lapack.None)
|
jobz := lapack.EVNone
|
||||||
if vectors {
|
if vectors {
|
||||||
jobz = lapack.ComputeEV
|
jobz = lapack.EVCompute
|
||||||
}
|
}
|
||||||
w := make([]float64, n)
|
w := make([]float64, n)
|
||||||
work := []float64{0}
|
work := []float64{0}
|
||||||
|
Reference in New Issue
Block a user