diff --git a/cgo/lapack.go b/cgo/lapack.go index 0ccd11fc..895341d0 100644 --- a/cgo/lapack.go +++ b/cgo/lapack.go @@ -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 { diff --git a/lapack.go b/lapack.go index bd4917c4..81a4f26c 100644 --- a/lapack.go +++ b/lapack.go @@ -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. diff --git a/native/dgeev.go b/native/dgeev.go index f285b3fc..e10a9e36 100644 --- a/native/dgeev.go +++ b/native/dgeev.go @@ -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. diff --git a/native/dhseqr.go b/native/dhseqr.go index fbfc2cb4..2b206f11 100644 --- a/native/dhseqr.go +++ b/native/dhseqr.go @@ -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) } diff --git a/testlapack/dhseqr.go b/testlapack/dhseqr.go index eef994fe..f263d634 100644 --- a/testlapack/dhseqr.go +++ b/testlapack/dhseqr.go @@ -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) }