| #region Translated by Jose Antonio De Santiago-Castillo.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| #endregion
|
|
|
| using System;
|
| using DotNumerics.FortranLibrary;
|
|
|
| namespace DotNumerics.LinearAlgebra.CSLapack
|
| {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| public class DGEEV
|
| {
|
|
|
|
|
| #region Dependencies
|
|
|
| DGEBAK _dgebak; DGEBAL _dgebal; DGEHRD _dgehrd; DHSEQR _dhseqr; DLABAD _dlabad; DLACPY _dlacpy; DLARTG _dlartg;
|
| DLASCL _dlascl;DORGHR _dorghr; DROT _drot; DSCAL _dscal; DTREVC _dtrevc; XERBLA _xerbla; LSAME _lsame; IDAMAX _idamax;
|
| ILAENV _ilaenv;DLAMCH _dlamch; DLANGE _dlange; DLAPY2 _dlapy2; DNRM2 _dnrm2;
|
|
|
| #endregion
|
|
|
|
|
| #region Variables
|
|
|
| const double ZERO = 0.0E0; const double ONE = 1.0E0; bool[] SELECT = new bool[1]; double[] DUM = new double[1];
|
|
|
| #endregion
|
|
|
| public DGEEV(DGEBAK dgebak, DGEBAL dgebal, DGEHRD dgehrd, DHSEQR dhseqr, DLABAD dlabad, DLACPY dlacpy, DLARTG dlartg, DLASCL dlascl, DORGHR dorghr, DROT drot
|
| , DSCAL dscal, DTREVC dtrevc, XERBLA xerbla, LSAME lsame, IDAMAX idamax, ILAENV ilaenv, DLAMCH dlamch, DLANGE dlange, DLAPY2 dlapy2, DNRM2 dnrm2)
|
| {
|
|
|
|
|
| #region Set Dependencies
|
|
|
| this._dgebak = dgebak; this._dgebal = dgebal; this._dgehrd = dgehrd; this._dhseqr = dhseqr; this._dlabad = dlabad;
|
| this._dlacpy = dlacpy;this._dlartg = dlartg; this._dlascl = dlascl; this._dorghr = dorghr; this._drot = drot;
|
| this._dscal = dscal;this._dtrevc = dtrevc; this._xerbla = xerbla; this._lsame = lsame; this._idamax = idamax;
|
| this._ilaenv = ilaenv;this._dlamch = dlamch; this._dlange = dlange; this._dlapy2 = dlapy2; this._dnrm2 = dnrm2;
|
|
|
| #endregion
|
|
|
| }
|
|
|
| public DGEEV()
|
| {
|
|
|
|
|
| #region Dependencies (Initialization)
|
|
|
| LSAME lsame = new LSAME();
|
| DSCAL dscal = new DSCAL();
|
| DSWAP dswap = new DSWAP();
|
| XERBLA xerbla = new XERBLA();
|
| IDAMAX idamax = new IDAMAX();
|
| DLAMC3 dlamc3 = new DLAMC3();
|
| DAXPY daxpy = new DAXPY();
|
| DLAPY2 dlapy2 = new DLAPY2();
|
| DNRM2 dnrm2 = new DNRM2();
|
| DCOPY dcopy = new DCOPY();
|
| IEEECK ieeeck = new IEEECK();
|
| IPARMQ iparmq = new IPARMQ();
|
| DLABAD dlabad = new DLABAD();
|
| DROT drot = new DROT();
|
| DLASSQ dlassq = new DLASSQ();
|
| DLAQR1 dlaqr1 = new DLAQR1();
|
| DDOT ddot = new DDOT();
|
| DLADIV dladiv = new DLADIV();
|
| DGEBAK dgebak = new DGEBAK(lsame, dscal, dswap, xerbla);
|
| DLAMC1 dlamc1 = new DLAMC1(dlamc3);
|
| DLAMC4 dlamc4 = new DLAMC4(dlamc3);
|
| DLAMC5 dlamc5 = new DLAMC5(dlamc3);
|
| DLAMC2 dlamc2 = new DLAMC2(dlamc3, dlamc1, dlamc4, dlamc5);
|
| DLAMCH dlamch = new DLAMCH(lsame, dlamc2);
|
| DGEBAL dgebal = new DGEBAL(lsame, idamax, dlamch, dscal, dswap, xerbla);
|
| DGEMV dgemv = new DGEMV(lsame, xerbla);
|
| DGER dger = new DGER(xerbla);
|
| DLARF dlarf = new DLARF(dgemv, dger, lsame);
|
| DLARFG dlarfg = new DLARFG(dlamch, dlapy2, dnrm2, dscal);
|
| DGEHD2 dgehd2 = new DGEHD2(dlarf, dlarfg, xerbla);
|
| DGEMM dgemm = new DGEMM(lsame, xerbla);
|
| DLACPY dlacpy = new DLACPY(lsame);
|
| DTRMM dtrmm = new DTRMM(lsame, xerbla);
|
| DTRMV dtrmv = new DTRMV(lsame, xerbla);
|
| DLAHR2 dlahr2 = new DLAHR2(daxpy, dcopy, dgemm, dgemv, dlacpy, dlarfg, dscal, dtrmm, dtrmv);
|
| DLARFB dlarfb = new DLARFB(lsame, dcopy, dgemm, dtrmm);
|
| ILAENV ilaenv = new ILAENV(ieeeck, iparmq);
|
| DGEHRD dgehrd = new DGEHRD(daxpy, dgehd2, dgemm, dlahr2, dlarfb, dtrmm, xerbla, ilaenv);
|
| DLANV2 dlanv2 = new DLANV2(dlamch, dlapy2);
|
| DLAHQR dlahqr = new DLAHQR(dlamch, dcopy, dlabad, dlanv2, dlarfg, drot);
|
| DLASET dlaset = new DLASET(lsame);
|
| DLARFT dlarft = new DLARFT(dgemv, dtrmv, lsame);
|
| DORG2R dorg2r = new DORG2R(dlarf, dscal, xerbla);
|
| DORGQR dorgqr = new DORGQR(dlarfb, dlarft, dorg2r, xerbla, ilaenv);
|
| DORGHR dorghr = new DORGHR(dorgqr, xerbla, ilaenv);
|
| DLANGE dlange = new DLANGE(dlassq, lsame);
|
| DLARFX dlarfx = new DLARFX(lsame, dgemv, dger);
|
| DLARTG dlartg = new DLARTG(dlamch);
|
| DLASY2 dlasy2 = new DLASY2(idamax, dlamch, dcopy, dswap);
|
| DLAEXC dlaexc = new DLAEXC(dlamch, dlange, dlacpy, dlanv2, dlarfg, dlarfx, dlartg, dlasy2, drot);
|
| DTREXC dtrexc = new DTREXC(lsame, dlaexc, xerbla);
|
| DLAQR2 dlaqr2 = new DLAQR2(dlamch, dcopy, dgehrd, dgemm, dlabad, dlacpy, dlahqr, dlanv2, dlarf, dlarfg
|
| , dlaset, dorghr, dtrexc);
|
| DLAQR5 dlaqr5 = new DLAQR5(dlamch, dgemm, dlabad, dlacpy, dlaqr1, dlarfg, dlaset, dtrmm);
|
| DLAQR4 dlaqr4 = new DLAQR4(ilaenv, dlacpy, dlahqr, dlanv2, dlaqr2, dlaqr5);
|
| DLAQR3 dlaqr3 = new DLAQR3(dlamch, ilaenv, dcopy, dgehrd, dgemm, dlabad, dlacpy, dlahqr, dlanv2, dlaqr4
|
| , dlarf, dlarfg, dlaset, dorghr, dtrexc);
|
| DLAQR0 dlaqr0 = new DLAQR0(ilaenv, dlacpy, dlahqr, dlanv2, dlaqr3, dlaqr4, dlaqr5);
|
| DHSEQR dhseqr = new DHSEQR(ilaenv, lsame, dlacpy, dlahqr, dlaqr0, dlaset, xerbla);
|
| DLASCL dlascl = new DLASCL(lsame, dlamch, xerbla);
|
| DLALN2 dlaln2 = new DLALN2(dlamch, dladiv);
|
| DTREVC dtrevc = new DTREVC(lsame, idamax, ddot, dlamch, daxpy, dcopy, dgemv, dlaln2, dscal, xerbla
|
| , dlabad);
|
|
|
| #endregion
|
|
|
|
|
| #region Set Dependencies
|
|
|
| this._dgebak = dgebak; this._dgebal = dgebal; this._dgehrd = dgehrd; this._dhseqr = dhseqr; this._dlabad = dlabad;
|
| this._dlacpy = dlacpy;this._dlartg = dlartg; this._dlascl = dlascl; this._dorghr = dorghr; this._drot = drot;
|
| this._dscal = dscal;this._dtrevc = dtrevc; this._xerbla = xerbla; this._lsame = lsame; this._idamax = idamax;
|
| this._ilaenv = ilaenv;this._dlamch = dlamch; this._dlange = dlange; this._dlapy2 = dlapy2; this._dnrm2 = dnrm2;
|
|
|
| #endregion
|
|
|
| }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| public void Run(string JOBVL, string JOBVR, int N, ref double[] A, int offset_a, int LDA, ref double[] WR, int offset_wr
|
| , ref double[] WI, int offset_wi, ref double[] VL, int offset_vl, int LDVL, ref double[] VR, int offset_vr, int LDVR, ref double[] WORK, int offset_work
|
| , int LWORK, ref int INFO)
|
| {
|
|
|
| #region Variables
|
|
|
| bool LQUERY = false; bool SCALEA = false; bool WANTVL = false; bool WANTVR = false; string SIDE = new string(' ', 1);
|
| int HSWORK = 0;int I = 0; int IBAL = 0; int IERR = 0; int IHI = 0; int ILO = 0; int ITAU = 0; int IWRK = 0; int K = 0;
|
| int MAXWRK = 0;int MINWRK = 0; int NOUT = 0; double ANRM = 0; double BIGNUM = 0; double CS = 0; double CSCALE = 0;
|
| double EPS = 0;double R = 0; double SCL = 0; double SMLNUM = 0; double SN = 0;
|
| int offset_select = 0; int offset_dum = 0;
|
|
|
| #endregion
|
|
|
|
|
| #region Array Index Correction
|
|
|
| int o_a = -1 - LDA + offset_a; int o_wr = -1 + offset_wr; int o_wi = -1 + offset_wi;
|
| int o_vl = -1 - LDVL + offset_vl; int o_vr = -1 - LDVR + offset_vr; int o_work = -1 + offset_work;
|
|
|
| #endregion
|
|
|
|
|
| #region Strings
|
|
|
| JOBVL = JOBVL.Substring(0, 1); JOBVR = JOBVR.Substring(0, 1);
|
|
|
| #endregion
|
|
|
|
|
| #region Prolog
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| #endregion
|
|
|
|
|
| #region Body
|
|
|
| INFO = 0;
|
| LQUERY = (LWORK == - 1);
|
| WANTVL = this._lsame.Run(JOBVL, "V");
|
| WANTVR = this._lsame.Run(JOBVR, "V");
|
| if ((!WANTVL) && (!this._lsame.Run(JOBVL, "N")))
|
| {
|
| INFO = - 1;
|
| }
|
| else
|
| {
|
| if ((!WANTVR) && (!this._lsame.Run(JOBVR, "N")))
|
| {
|
| INFO = - 2;
|
| }
|
| else
|
| {
|
| if (N < 0)
|
| {
|
| INFO = - 3;
|
| }
|
| else
|
| {
|
| if (LDA < Math.Max(1, N))
|
| {
|
| INFO = - 5;
|
| }
|
| else
|
| {
|
| if (LDVL < 1 || (WANTVL && LDVL < N))
|
| {
|
| INFO = - 9;
|
| }
|
| else
|
| {
|
| if (LDVR < 1 || (WANTVR && LDVR < N))
|
| {
|
| INFO = - 11;
|
| }
|
| }
|
| }
|
| }
|
| }
|
| }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| if (INFO == 0)
|
| {
|
| if (N == 0)
|
| {
|
| MINWRK = 1;
|
| MAXWRK = 1;
|
| }
|
| else
|
| {
|
| MAXWRK = 2 * N + N * this._ilaenv.Run(1, "DGEHRD", " ", N, 1, N, 0);
|
| if (WANTVL)
|
| {
|
| MINWRK = 4 * N;
|
| MAXWRK = Math.Max(MAXWRK, 2 * N + (N - 1) * this._ilaenv.Run(1, "DORGHR", " ", N, 1, N, - 1));
|
| this._dhseqr.Run("S", "V", N, 1, N, ref A, offset_a
|
| , LDA, ref WR, offset_wr, ref WI, offset_wi, ref VL, offset_vl, LDVL, ref WORK, offset_work
|
| , - 1, ref INFO);
|
| HSWORK = (int)WORK[1 + o_work];
|
| MAXWRK = Math.Max(MAXWRK, Math.Max(N + 1, N + HSWORK));
|
| MAXWRK = Math.Max(MAXWRK, 4 * N);
|
| }
|
| else
|
| {
|
| if (WANTVR)
|
| {
|
| MINWRK = 4 * N;
|
| MAXWRK = Math.Max(MAXWRK, 2 * N + (N - 1) * this._ilaenv.Run(1, "DORGHR", " ", N, 1, N, - 1));
|
| this._dhseqr.Run("S", "V", N, 1, N, ref A, offset_a
|
| , LDA, ref WR, offset_wr, ref WI, offset_wi, ref VR, offset_vr, LDVR, ref WORK, offset_work
|
| , - 1, ref INFO);
|
| HSWORK = (int)WORK[1 + o_work];
|
| MAXWRK = Math.Max(MAXWRK, Math.Max(N + 1, N + HSWORK));
|
| MAXWRK = Math.Max(MAXWRK, 4 * N);
|
| }
|
| else
|
| {
|
| MINWRK = 3 * N;
|
| this._dhseqr.Run("E", "N", N, 1, N, ref A, offset_a
|
| , LDA, ref WR, offset_wr, ref WI, offset_wi, ref VR, offset_vr, LDVR, ref WORK, offset_work
|
| , - 1, ref INFO);
|
| HSWORK = (int)WORK[1 + o_work];
|
| MAXWRK = Math.Max(MAXWRK, Math.Max(N + 1, N + HSWORK));
|
| }
|
| }
|
| MAXWRK = Math.Max(MAXWRK, MINWRK);
|
| }
|
| WORK[1 + o_work] = MAXWRK;
|
|
|
| if (LWORK < MINWRK && !LQUERY)
|
| {
|
| INFO = - 13;
|
| }
|
| }
|
|
|
| if (INFO != 0)
|
| {
|
| this._xerbla.Run("DGEEV ", - INFO);
|
| return;
|
| }
|
| else
|
| {
|
| if (LQUERY)
|
| {
|
| return;
|
| }
|
| }
|
|
|
|
|
|
|
| if (N == 0) return;
|
|
|
|
|
|
|
| EPS = this._dlamch.Run("P");
|
| SMLNUM = this._dlamch.Run("S");
|
| BIGNUM = ONE / SMLNUM;
|
| this._dlabad.Run(ref SMLNUM, ref BIGNUM);
|
| SMLNUM = Math.Sqrt(SMLNUM) / EPS;
|
| BIGNUM = ONE / SMLNUM;
|
|
|
|
|
|
|
| ANRM = this._dlange.Run("M", N, N, A, offset_a, LDA, ref DUM, offset_dum);
|
| SCALEA = false;
|
| if (ANRM > ZERO && ANRM < SMLNUM)
|
| {
|
| SCALEA = true;
|
| CSCALE = SMLNUM;
|
| }
|
| else
|
| {
|
| if (ANRM > BIGNUM)
|
| {
|
| SCALEA = true;
|
| CSCALE = BIGNUM;
|
| }
|
| }
|
| if (SCALEA)
|
| {
|
| this._dlascl.Run("G", 0, 0, ANRM, CSCALE, N
|
| , N, ref A, offset_a, LDA, ref IERR);
|
| }
|
|
|
|
|
|
|
|
|
| IBAL = 1;
|
| this._dgebal.Run("B", N, ref A, offset_a, LDA, ref ILO, ref IHI
|
| , ref WORK, IBAL + o_work, ref IERR);
|
|
|
|
|
|
|
|
|
| ITAU = IBAL + N;
|
| IWRK = ITAU + N;
|
| this._dgehrd.Run(N, ILO, IHI, ref A, offset_a, LDA, ref WORK, ITAU + o_work
|
| , ref WORK, IWRK + o_work, LWORK - IWRK + 1, ref IERR);
|
|
|
| if (WANTVL)
|
| {
|
|
|
|
|
|
|
|
|
| FortranLib.Copy(ref SIDE , "L");
|
| this._dlacpy.Run("L", N, N, A, offset_a, LDA, ref VL, offset_vl
|
| , LDVL);
|
|
|
|
|
|
|
|
|
| this._dorghr.Run(N, ILO, IHI, ref VL, offset_vl, LDVL, WORK, ITAU + o_work
|
| , ref WORK, IWRK + o_work, LWORK - IWRK + 1, ref IERR);
|
|
|
|
|
|
|
|
|
| IWRK = ITAU;
|
| this._dhseqr.Run("S", "V", N, ILO, IHI, ref A, offset_a
|
| , LDA, ref WR, offset_wr, ref WI, offset_wi, ref VL, offset_vl, LDVL, ref WORK, IWRK + o_work
|
| , LWORK - IWRK + 1, ref INFO);
|
|
|
| if (WANTVR)
|
| {
|
|
|
|
|
|
|
|
|
| FortranLib.Copy(ref SIDE , "B");
|
| this._dlacpy.Run("F", N, N, VL, offset_vl, LDVL, ref VR, offset_vr
|
| , LDVR);
|
| }
|
|
|
| }
|
| else
|
| {
|
| if (WANTVR)
|
| {
|
|
|
|
|
|
|
|
|
| FortranLib.Copy(ref SIDE , "R");
|
| this._dlacpy.Run("L", N, N, A, offset_a, LDA, ref VR, offset_vr
|
| , LDVR);
|
|
|
|
|
|
|
|
|
| this._dorghr.Run(N, ILO, IHI, ref VR, offset_vr, LDVR, WORK, ITAU + o_work
|
| , ref WORK, IWRK + o_work, LWORK - IWRK + 1, ref IERR);
|
|
|
|
|
|
|
|
|
| IWRK = ITAU;
|
| this._dhseqr.Run("S", "V", N, ILO, IHI, ref A, offset_a
|
| , LDA, ref WR, offset_wr, ref WI, offset_wi, ref VR, offset_vr, LDVR, ref WORK, IWRK + o_work
|
| , LWORK - IWRK + 1, ref INFO);
|
|
|
| }
|
| else
|
| {
|
|
|
|
|
|
|
|
|
| IWRK = ITAU;
|
| this._dhseqr.Run("E", "N", N, ILO, IHI, ref A, offset_a
|
| , LDA, ref WR, offset_wr, ref WI, offset_wi, ref VR, offset_vr, LDVR, ref WORK, IWRK + o_work
|
| , LWORK - IWRK + 1, ref INFO);
|
| }
|
| }
|
|
|
|
|
|
|
| if (INFO > 0) goto LABEL50;
|
|
|
| if (WANTVL || WANTVR)
|
| {
|
|
|
|
|
|
|
|
|
| this._dtrevc.Run(SIDE, "B", ref SELECT, offset_select, N, A, offset_a, LDA
|
| , ref VL, offset_vl, LDVL, ref VR, offset_vr, LDVR, N, ref NOUT
|
| , ref WORK, IWRK + o_work, ref IERR);
|
| }
|
|
|
| if (WANTVL)
|
| {
|
|
|
|
|
|
|
|
|
| this._dgebak.Run("B", "L", N, ILO, IHI, WORK, IBAL + o_work
|
| , N, ref VL, offset_vl, LDVL, ref IERR);
|
|
|
|
|
|
|
| for (I = 1; I <= N; I++)
|
| {
|
| if (WI[I + o_wi] == ZERO)
|
| {
|
| SCL = ONE / this._dnrm2.Run(N, VL, 1+I * LDVL + o_vl, 1);
|
| this._dscal.Run(N, SCL, ref VL, 1+I * LDVL + o_vl, 1);
|
| }
|
| else
|
| {
|
| if (WI[I + o_wi] > ZERO)
|
| {
|
| SCL = ONE / this._dlapy2.Run(this._dnrm2.Run(N, VL, 1+I * LDVL + o_vl, 1), this._dnrm2.Run(N, VL, 1+(I + 1) * LDVL + o_vl, 1));
|
| this._dscal.Run(N, SCL, ref VL, 1+I * LDVL + o_vl, 1);
|
| this._dscal.Run(N, SCL, ref VL, 1+(I + 1) * LDVL + o_vl, 1);
|
| for (K = 1; K <= N; K++)
|
| {
|
| WORK[IWRK + K - 1 + o_work] = Math.Pow(VL[K+I * LDVL + o_vl],2) + Math.Pow(VL[K+(I + 1) * LDVL + o_vl],2);
|
| }
|
| K = this._idamax.Run(N, WORK, IWRK + o_work, 1);
|
| this._dlartg.Run(VL[K+I * LDVL + o_vl], VL[K+(I + 1) * LDVL + o_vl], ref CS, ref SN, ref R);
|
| this._drot.Run(N, ref VL, 1+I * LDVL + o_vl, 1, ref VL, 1+(I + 1) * LDVL + o_vl, 1, CS
|
| , SN);
|
| VL[K+(I + 1) * LDVL + o_vl] = ZERO;
|
| }
|
| }
|
| }
|
| }
|
|
|
| if (WANTVR)
|
| {
|
|
|
|
|
|
|
|
|
| this._dgebak.Run("B", "R", N, ILO, IHI, WORK, IBAL + o_work
|
| , N, ref VR, offset_vr, LDVR, ref IERR);
|
|
|
|
|
|
|
| for (I = 1; I <= N; I++)
|
| {
|
| if (WI[I + o_wi] == ZERO)
|
| {
|
| SCL = ONE / this._dnrm2.Run(N, VR, 1+I * LDVR + o_vr, 1);
|
| this._dscal.Run(N, SCL, ref VR, 1+I * LDVR + o_vr, 1);
|
| }
|
| else
|
| {
|
| if (WI[I + o_wi] > ZERO)
|
| {
|
| SCL = ONE / this._dlapy2.Run(this._dnrm2.Run(N, VR, 1+I * LDVR + o_vr, 1), this._dnrm2.Run(N, VR, 1+(I + 1) * LDVR + o_vr, 1));
|
| this._dscal.Run(N, SCL, ref VR, 1+I * LDVR + o_vr, 1);
|
| this._dscal.Run(N, SCL, ref VR, 1+(I + 1) * LDVR + o_vr, 1);
|
| for (K = 1; K <= N; K++)
|
| {
|
| WORK[IWRK + K - 1 + o_work] = Math.Pow(VR[K+I * LDVR + o_vr],2) + Math.Pow(VR[K+(I + 1) * LDVR + o_vr],2);
|
| }
|
| K = this._idamax.Run(N, WORK, IWRK + o_work, 1);
|
| this._dlartg.Run(VR[K+I * LDVR + o_vr], VR[K+(I + 1) * LDVR + o_vr], ref CS, ref SN, ref R);
|
| this._drot.Run(N, ref VR, 1+I * LDVR + o_vr, 1, ref VR, 1+(I + 1) * LDVR + o_vr, 1, CS
|
| , SN);
|
| VR[K+(I + 1) * LDVR + o_vr] = ZERO;
|
| }
|
| }
|
| }
|
| }
|
|
|
|
|
|
|
| LABEL50:;
|
| if (SCALEA)
|
| {
|
| this._dlascl.Run("G", 0, 0, CSCALE, ANRM, N - INFO
|
| , 1, ref WR, INFO + 1 + o_wr, Math.Max(N - INFO, 1), ref IERR);
|
| this._dlascl.Run("G", 0, 0, CSCALE, ANRM, N - INFO
|
| , 1, ref WI, INFO + 1 + o_wi, Math.Max(N - INFO, 1), ref IERR);
|
| if (INFO > 0)
|
| {
|
| this._dlascl.Run("G", 0, 0, CSCALE, ANRM, ILO - 1
|
| , 1, ref WR, offset_wr, N, ref IERR);
|
| this._dlascl.Run("G", 0, 0, CSCALE, ANRM, ILO - 1
|
| , 1, ref WI, offset_wi, N, ref IERR);
|
| }
|
| }
|
|
|
| WORK[1 + o_work] = MAXWRK;
|
| return;
|
|
|
|
|
|
|
|
|
| #endregion
|
|
|
| }
|
| }
|
| }
|
|
|