--- 
:name: zlaqr2
:md5sum: ffeac35e8baa8da04e2b19326ee08e26
:category: :subroutine
:arguments: 
- wantt: 
    :type: logical
    :intent: input
- wantz: 
    :type: logical
    :intent: input
- n: 
    :type: integer
    :intent: input
- ktop: 
    :type: integer
    :intent: input
- kbot: 
    :type: integer
    :intent: input
- nw: 
    :type: integer
    :intent: input
- h: 
    :type: doublecomplex
    :intent: input/output
    :dims: 
    - ldh
    - n
- ldh: 
    :type: integer
    :intent: input
- iloz: 
    :type: integer
    :intent: input
- ihiz: 
    :type: integer
    :intent: input
- z: 
    :type: doublecomplex
    :intent: input/output
    :dims: 
    - ldz
    - n
- ldz: 
    :type: integer
    :intent: input
- ns: 
    :type: integer
    :intent: output
- nd: 
    :type: integer
    :intent: output
- sh: 
    :type: doublecomplex
    :intent: output
    :dims: 
    - MAX(1,kbot)
- v: 
    :type: doublecomplex
    :intent: workspace
    :dims: 
    - ldv
    - MAX(1,nw)
- ldv: 
    :type: integer
    :intent: input
- nh: 
    :type: integer
    :intent: input
- t: 
    :type: doublecomplex
    :intent: workspace
    :dims: 
    - ldv
    - MAX(1,nw)
- ldt: 
    :type: integer
    :intent: input
- nv: 
    :type: integer
    :intent: input
- wv: 
    :type: doublecomplex
    :intent: workspace
    :dims: 
    - ldv
    - MAX(1,nw)
- ldwv: 
    :type: integer
    :intent: input
- work: 
    :type: doublecomplex
    :intent: workspace
    :dims: 
    - MAX(1,lwork)
- lwork: 
    :type: integer
    :intent: input
    :option: true
    :default: 2*nw
:substitutions: 
  ldwv: nw
  ldt: nw
  ldv: nw
:fortran_help: "      SUBROUTINE ZLAQR2( WANTT, WANTZ, N, KTOP, KBOT, NW, H, LDH, ILOZ, IHIZ, Z, LDZ, NS, ND, SH, V, LDV, NH, T, LDT, NV, WV, LDWV, WORK, LWORK )\n\n\
  *     This subroutine is identical to ZLAQR3 except that it avoids\n\
  *     recursion by calling ZLAHQR instead of ZLAQR4.\n\
  *\n\
  *\n\
  *     ******************************************************************\n\
  *     Aggressive early deflation:\n\
  *\n\
  *     This subroutine accepts as input an upper Hessenberg matrix\n\
  *     H and performs an unitary similarity transformation\n\
  *     designed to detect and deflate fully converged eigenvalues from\n\
  *     a trailing principal submatrix.  On output H has been over-\n\
  *     written by a new Hessenberg matrix that is a perturbation of\n\
  *     an unitary similarity transformation of H.  It is to be\n\
  *     hoped that the final version of H has many zero subdiagonal\n\
  *     entries.\n\
  *\n\
  *     ******************************************************************\n\n\
  *     WANTT   (input) LOGICAL\n\
  *          If .TRUE., then the Hessenberg matrix H is fully updated\n\
  *          so that the triangular Schur factor may be\n\
  *          computed (in cooperation with the calling subroutine).\n\
  *          If .FALSE., then only enough of H is updated to preserve\n\
  *          the eigenvalues.\n\
  *\n\
  *     WANTZ   (input) LOGICAL\n\
  *          If .TRUE., then the unitary matrix Z is updated so\n\
  *          so that the unitary Schur factor may be computed\n\
  *          (in cooperation with the calling subroutine).\n\
  *          If .FALSE., then Z is not referenced.\n\
  *\n\
  *     N       (input) INTEGER\n\
  *          The order of the matrix H and (if WANTZ is .TRUE.) the\n\
  *          order of the unitary matrix Z.\n\
  *\n\
  *     KTOP    (input) INTEGER\n\
  *          It is assumed that either KTOP = 1 or H(KTOP,KTOP-1)=0.\n\
  *          KBOT and KTOP together determine an isolated block\n\
  *          along the diagonal of the Hessenberg matrix.\n\
  *\n\
  *     KBOT    (input) INTEGER\n\
  *          It is assumed without a check that either\n\
  *          KBOT = N or H(KBOT+1,KBOT)=0.  KBOT and KTOP together\n\
  *          determine an isolated block along the diagonal of the\n\
  *          Hessenberg matrix.\n\
  *\n\
  *     NW      (input) INTEGER\n\
  *          Deflation window size.  1 .LE. NW .LE. (KBOT-KTOP+1).\n\
  *\n\
  *     H       (input/output) COMPLEX*16 array, dimension (LDH,N)\n\
  *          On input the initial N-by-N section of H stores the\n\
  *          Hessenberg matrix undergoing aggressive early deflation.\n\
  *          On output H has been transformed by a unitary\n\
  *          similarity transformation, perturbed, and the returned\n\
  *          to Hessenberg form that (it is to be hoped) has some\n\
  *          zero subdiagonal entries.\n\
  *\n\
  *     LDH     (input) integer\n\
  *          Leading dimension of H just as declared in the calling\n\
  *          subroutine.  N .LE. LDH\n\
  *\n\
  *     ILOZ    (input) INTEGER\n\
  *     IHIZ    (input) INTEGER\n\
  *          Specify the rows of Z to which transformations must be\n\
  *          applied if WANTZ is .TRUE.. 1 .LE. ILOZ .LE. IHIZ .LE. N.\n\
  *\n\
  *     Z       (input/output) COMPLEX*16 array, dimension (LDZ,N)\n\
  *          IF WANTZ is .TRUE., then on output, the unitary\n\
  *          similarity transformation mentioned above has been\n\
  *          accumulated into Z(ILOZ:IHIZ,ILO:IHI) from the right.\n\
  *          If WANTZ is .FALSE., then Z is unreferenced.\n\
  *\n\
  *     LDZ     (input) integer\n\
  *          The leading dimension of Z just as declared in the\n\
  *          calling subroutine.  1 .LE. LDZ.\n\
  *\n\
  *     NS      (output) integer\n\
  *          The number of unconverged (ie approximate) eigenvalues\n\
  *          returned in SR and SI that may be used as shifts by the\n\
  *          calling subroutine.\n\
  *\n\
  *     ND      (output) integer\n\
  *          The number of converged eigenvalues uncovered by this\n\
  *          subroutine.\n\
  *\n\
  *     SH      (output) COMPLEX*16 array, dimension KBOT\n\
  *          On output, approximate eigenvalues that may\n\
  *          be used for shifts are stored in SH(KBOT-ND-NS+1)\n\
  *          through SR(KBOT-ND).  Converged eigenvalues are\n\
  *          stored in SH(KBOT-ND+1) through SH(KBOT).\n\
  *\n\
  *     V       (workspace) COMPLEX*16 array, dimension (LDV,NW)\n\
  *          An NW-by-NW work array.\n\
  *\n\
  *     LDV     (input) integer scalar\n\
  *          The leading dimension of V just as declared in the\n\
  *          calling subroutine.  NW .LE. LDV\n\
  *\n\
  *     NH      (input) integer scalar\n\
  *          The number of columns of T.  NH.GE.NW.\n\
  *\n\
  *     T       (workspace) COMPLEX*16 array, dimension (LDT,NW)\n\
  *\n\
  *     LDT     (input) integer\n\
  *          The leading dimension of T just as declared in the\n\
  *          calling subroutine.  NW .LE. LDT\n\
  *\n\
  *     NV      (input) integer\n\
  *          The number of rows of work array WV available for\n\
  *          workspace.  NV.GE.NW.\n\
  *\n\
  *     WV      (workspace) COMPLEX*16 array, dimension (LDWV,NW)\n\
  *\n\
  *     LDWV    (input) integer\n\
  *          The leading dimension of W just as declared in the\n\
  *          calling subroutine.  NW .LE. LDV\n\
  *\n\
  *     WORK    (workspace) COMPLEX*16 array, dimension LWORK.\n\
  *          On exit, WORK(1) is set to an estimate of the optimal value\n\
  *          of LWORK for the given values of N, NW, KTOP and KBOT.\n\
  *\n\
  *     LWORK   (input) integer\n\
  *          The dimension of the work array WORK.  LWORK = 2*NW\n\
  *          suffices, but greater efficiency may result from larger\n\
  *          values of LWORK.\n\
  *\n\
  *          If LWORK = -1, then a workspace query is assumed; ZLAQR2\n\
  *          only estimates the optimal workspace size for the given\n\
  *          values of N, NW, KTOP and KBOT.  The estimate is returned\n\
  *          in WORK(1).  No error message related to LWORK is issued\n\
  *          by XERBLA.  Neither H nor Z are accessed.\n\
  *\n\n\
  *     ================================================================\n\
  *     Based on contributions by\n\
  *        Karen Braman and Ralph Byers, Department of Mathematics,\n\
  *        University of Kansas, USA\n\
  *\n\
  *     ================================================================\n"
