mirror of
https://github.com/gonum/gonum.git
synced 2025-10-20 21:59:25 +08:00
lapack,native,cgo: remove lapack.UpdateZ and rename lapack.InitZ to lapack.HessEV
This commit is contained in:
@@ -1739,9 +1739,9 @@ func (impl Implementation) Dtrtrs(uplo blas.Uplo, trans blas.Transpose, diag bla
|
||||
//
|
||||
// If compz == lapack.None, no Schur vectors will be computed and Z will not be
|
||||
// referenced.
|
||||
// If compz == lapack.InitZ, on return Z will contain the matrix of Schur
|
||||
// If compz == lapack.HessEV, on return Z will contain the matrix of Schur
|
||||
// vectors of H.
|
||||
// If compz == lapack.UpdateZ, on entry z is assumed to contain the orthogonal
|
||||
// If compz == lapack.OriginalEV, on entry z is assumed to contain the orthogonal
|
||||
// matrix Q that is the identity except for the submatrix
|
||||
// Q[ilo:ihi+1,ilo:ihi+1]. On return z will be updated to the product Q*Z.
|
||||
//
|
||||
@@ -1806,7 +1806,7 @@ func (impl Implementation) Dtrtrs(uplo blas.Uplo, trans blas.Transpose, diag bla
|
||||
// where U is an orthogonal matrix. The final H is upper Hessenberg and
|
||||
// H[unconverged:ihi+1,unconverged:ihi+1] is upper quasi-triangular.
|
||||
//
|
||||
// If unconverged > 0 and compz == lapack.UpdateZ, then on return
|
||||
// If unconverged > 0 and compz == lapack.OriginalEV, then on return
|
||||
// (final Z) = (initial Z) U,
|
||||
// where U is the orthogonal matrix in (*) regardless of the value of job.
|
||||
//
|
||||
@@ -1839,7 +1839,7 @@ func (impl Implementation) Dhseqr(job lapack.EVJob, compz lapack.EVComp, n, ilo,
|
||||
default:
|
||||
panic(badEVComp)
|
||||
case lapack.None:
|
||||
case lapack.InitZ, lapack.UpdateZ:
|
||||
case lapack.HessEV, lapack.OriginalEV:
|
||||
wantz = true
|
||||
}
|
||||
switch {
|
||||
|
@@ -118,6 +118,9 @@ const (
|
||||
// TridiagEV specifies to compute both the eigenvectors of the input
|
||||
// tridiagonal matrix.
|
||||
TridiagEV EVComp = 'I'
|
||||
// HessEV specifies to compute both the eigenvectors of the input upper
|
||||
// Hessenberg matrix.
|
||||
HessEV EVComp = 'I'
|
||||
)
|
||||
|
||||
// Job types for computation of eigenvectors.
|
||||
@@ -141,13 +144,10 @@ const (
|
||||
PermuteScale Job = 'B'
|
||||
)
|
||||
|
||||
// Jobs and Comps for Dhseqr.
|
||||
// Job constants for Dhseqr.
|
||||
const (
|
||||
EigenvaluesOnly EVJob = 'E'
|
||||
EigenvaluesAndSchur EVJob = 'S'
|
||||
|
||||
InitZ EVComp = 'I'
|
||||
UpdateZ EVComp = 'V'
|
||||
)
|
||||
|
||||
// UpdateQ specifies that the matrix Q will be updated.
|
||||
|
@@ -115,7 +115,7 @@ func (impl Implementation) Dgeev(jobvl lapack.LeftEVJob, jobvr lapack.RightEVJob
|
||||
maxwrk := 2*n + n*impl.Ilaenv(1, "DGEHRD", " ", n, 1, n, 0)
|
||||
if wantvl || wantvr {
|
||||
maxwrk = max(maxwrk, 2*n+(n-1)*impl.Ilaenv(1, "DORGHR", " ", n, 1, n, -1))
|
||||
impl.Dhseqr(lapack.EigenvaluesAndSchur, lapack.UpdateZ, n, 0, n-1,
|
||||
impl.Dhseqr(lapack.EigenvaluesAndSchur, lapack.OriginalEV, n, 0, n-1,
|
||||
nil, 1, nil, nil, nil, 1, work, -1)
|
||||
maxwrk = max(maxwrk, max(n+1, n+int(work[0])))
|
||||
side := lapack.LeftEV
|
||||
@@ -175,7 +175,7 @@ func (impl Implementation) Dgeev(jobvl lapack.LeftEVJob, jobvr lapack.RightEVJob
|
||||
impl.Dorghr(n, ilo, ihi, vl, ldvl, tau, work[iwrk:], lwork-iwrk)
|
||||
// Perform QR iteration, accumulating Schur vectors in VL.
|
||||
iwrk = n
|
||||
first = impl.Dhseqr(lapack.EigenvaluesAndSchur, lapack.UpdateZ, n, ilo, ihi,
|
||||
first = impl.Dhseqr(lapack.EigenvaluesAndSchur, lapack.OriginalEV, n, ilo, ihi,
|
||||
a, lda, wr, wi, vl, ldvl, work[iwrk:], lwork-iwrk)
|
||||
if wantvr {
|
||||
// Want left and right eigenvectors.
|
||||
@@ -191,7 +191,7 @@ func (impl Implementation) Dgeev(jobvl lapack.LeftEVJob, jobvr lapack.RightEVJob
|
||||
impl.Dorghr(n, ilo, ihi, vr, ldvr, tau, work[iwrk:], lwork-iwrk)
|
||||
// Perform QR iteration, accumulating Schur vectors in VR.
|
||||
iwrk = n
|
||||
first = impl.Dhseqr(lapack.EigenvaluesAndSchur, lapack.UpdateZ, n, ilo, ihi,
|
||||
first = impl.Dhseqr(lapack.EigenvaluesAndSchur, lapack.OriginalEV, n, ilo, ihi,
|
||||
a, lda, wr, wi, vr, ldvr, work[iwrk:], lwork-iwrk)
|
||||
} else {
|
||||
// Compute eigenvalues only.
|
||||
|
@@ -29,9 +29,9 @@ import (
|
||||
//
|
||||
// If compz == lapack.None, no Schur vectors will be computed and Z will not be
|
||||
// referenced.
|
||||
// If compz == lapack.InitZ, on return Z will contain the matrix of Schur
|
||||
// If compz == lapack.HessEV, on return Z will contain the matrix of Schur
|
||||
// vectors of H.
|
||||
// If compz == lapack.UpdateZ, on entry z is assumed to contain the orthogonal
|
||||
// If compz == lapack.OriginalEV, on entry z is assumed to contain the orthogonal
|
||||
// matrix Q that is the identity except for the submatrix
|
||||
// Q[ilo:ihi+1,ilo:ihi+1]. On return z will be updated to the product Q*Z.
|
||||
//
|
||||
@@ -96,11 +96,11 @@ import (
|
||||
// where U is an orthogonal matrix. The final H is upper Hessenberg and
|
||||
// H[unconverged:ihi+1,unconverged:ihi+1] is upper quasi-triangular.
|
||||
//
|
||||
// If unconverged > 0 and compz == lapack.UpdateZ, then on return
|
||||
// If unconverged > 0 and compz == lapack.OriginalEV, then on return
|
||||
// (final Z) = (initial Z) U,
|
||||
// where U is the orthogonal matrix in (*) regardless of the value of job.
|
||||
//
|
||||
// If unconverged > 0 and compz == lapack.InitZ, then on return
|
||||
// If unconverged > 0 and compz == lapack.HessEV, then on return
|
||||
// (final Z) = U,
|
||||
// where U is the orthogonal matrix in (*) regardless of the value of job.
|
||||
//
|
||||
@@ -132,7 +132,7 @@ func (impl Implementation) Dhseqr(job lapack.EVJob, compz lapack.EVComp, n, ilo,
|
||||
default:
|
||||
panic(badEVComp)
|
||||
case lapack.None:
|
||||
case lapack.InitZ, lapack.UpdateZ:
|
||||
case lapack.HessEV, lapack.OriginalEV:
|
||||
wantz = true
|
||||
}
|
||||
switch {
|
||||
@@ -197,7 +197,7 @@ func (impl Implementation) Dhseqr(job lapack.EVJob, compz lapack.EVComp, n, ilo,
|
||||
}
|
||||
|
||||
// Initialize Z to identity matrix if requested.
|
||||
if compz == lapack.InitZ {
|
||||
if compz == lapack.HessEV {
|
||||
impl.Dlaset(blas.All, n, n, 0, 1, z, ldz)
|
||||
}
|
||||
|
||||
|
@@ -61,7 +61,7 @@ func testDhseqr(t *testing.T, impl Dhseqrer, i int, test dhseqrTest, job lapack.
|
||||
z := blas64.General{Stride: max(1, n)}
|
||||
if wantz {
|
||||
// First, let Dhseqr initialize Z to the identity matrix.
|
||||
compz = lapack.InitZ
|
||||
compz = lapack.HessEV
|
||||
z = nanGeneral(n, n, n+extra)
|
||||
}
|
||||
|
||||
@@ -70,7 +70,7 @@ func testDhseqr(t *testing.T, impl Dhseqrer, i int, test dhseqrTest, job lapack.
|
||||
|
||||
work := nanSlice(max(1, n))
|
||||
if optwork {
|
||||
impl.Dhseqr(job, lapack.InitZ, n, ilo, ihi, nil, h.Stride, nil, nil, nil, z.Stride, work, -1)
|
||||
impl.Dhseqr(job, lapack.HessEV, n, ilo, ihi, nil, h.Stride, nil, nil, nil, z.Stride, work, -1)
|
||||
work = nanSlice(int(work[0]))
|
||||
}
|
||||
|
||||
@@ -196,7 +196,7 @@ func testDhseqr(t *testing.T, impl Dhseqrer, i int, test dhseqrTest, job lapack.
|
||||
copyGeneral(h, hCopy)
|
||||
// Call Dhseqr again with the identity matrix given explicitly in Q.
|
||||
q := eye(n, n+extra)
|
||||
impl.Dhseqr(job, lapack.UpdateZ, n, ilo, ihi, h.Data, h.Stride, wr, wi, q.Data, q.Stride, work, len(work))
|
||||
impl.Dhseqr(job, lapack.OriginalEV, n, ilo, ihi, h.Data, h.Stride, wr, wi, q.Data, q.Stride, work, len(work))
|
||||
if !equalApproxGeneral(z, q, 0) {
|
||||
t.Errorf("%v: Z and Q are not equal", prefix)
|
||||
}
|
||||
|
Reference in New Issue
Block a user