--- 
:name: dlag2
:md5sum: cb3cffe0121d3cdef959429272b11c8d
:category: :subroutine
:arguments: 
- a: 
    :type: doublereal
    :intent: input
    :dims: 
    - lda
    - "2"
- lda: 
    :type: integer
    :intent: input
- b: 
    :type: doublereal
    :intent: input
    :dims: 
    - ldb
    - "2"
- ldb: 
    :type: integer
    :intent: input
- safmin: 
    :type: doublereal
    :intent: input
- scale1: 
    :type: doublereal
    :intent: output
- scale2: 
    :type: doublereal
    :intent: output
- wr1: 
    :type: doublereal
    :intent: output
- wr2: 
    :type: doublereal
    :intent: output
- wi: 
    :type: doublereal
    :intent: output
:substitutions: {}

:fortran_help: "      SUBROUTINE DLAG2( A, LDA, B, LDB, SAFMIN, SCALE1, SCALE2, WR1, WR2, WI )\n\n\
  *  Purpose\n\
  *  =======\n\
  *\n\
  *  DLAG2 computes the eigenvalues of a 2 x 2 generalized eigenvalue\n\
  *  problem  A - w B, with scaling as necessary to avoid over-/underflow.\n\
  *\n\
  *  The scaling factor \"s\" results in a modified eigenvalue equation\n\
  *\n\
  *      s A - w B\n\
  *\n\
  *  where  s  is a non-negative scaling factor chosen so that  w,  w B,\n\
  *  and  s A  do not overflow and, if possible, do not underflow, either.\n\
  *\n\n\
  *  Arguments\n\
  *  =========\n\
  *\n\
  *  A       (input) DOUBLE PRECISION array, dimension (LDA, 2)\n\
  *          On entry, the 2 x 2 matrix A.  It is assumed that its 1-norm\n\
  *          is less than 1/SAFMIN.  Entries less than\n\
  *          sqrt(SAFMIN)*norm(A) are subject to being treated as zero.\n\
  *\n\
  *  LDA     (input) INTEGER\n\
  *          The leading dimension of the array A.  LDA >= 2.\n\
  *\n\
  *  B       (input) DOUBLE PRECISION array, dimension (LDB, 2)\n\
  *          On entry, the 2 x 2 upper triangular matrix B.  It is\n\
  *          assumed that the one-norm of B is less than 1/SAFMIN.  The\n\
  *          diagonals should be at least sqrt(SAFMIN) times the largest\n\
  *          element of B (in absolute value); if a diagonal is smaller\n\
  *          than that, then  +/- sqrt(SAFMIN) will be used instead of\n\
  *          that diagonal.\n\
  *\n\
  *  LDB     (input) INTEGER\n\
  *          The leading dimension of the array B.  LDB >= 2.\n\
  *\n\
  *  SAFMIN  (input) DOUBLE PRECISION\n\
  *          The smallest positive number s.t. 1/SAFMIN does not\n\
  *          overflow.  (This should always be DLAMCH('S') -- it is an\n\
  *          argument in order to avoid having to call DLAMCH frequently.)\n\
  *\n\
  *  SCALE1  (output) DOUBLE PRECISION\n\
  *          A scaling factor used to avoid over-/underflow in the\n\
  *          eigenvalue equation which defines the first eigenvalue.  If\n\
  *          the eigenvalues are complex, then the eigenvalues are\n\
  *          ( WR1  +/-  WI i ) / SCALE1  (which may lie outside the\n\
  *          exponent range of the machine), SCALE1=SCALE2, and SCALE1\n\
  *          will always be positive.  If the eigenvalues are real, then\n\
  *          the first (real) eigenvalue is  WR1 / SCALE1 , but this may\n\
  *          overflow or underflow, and in fact, SCALE1 may be zero or\n\
  *          less than the underflow threshhold if the exact eigenvalue\n\
  *          is sufficiently large.\n\
  *\n\
  *  SCALE2  (output) DOUBLE PRECISION\n\
  *          A scaling factor used to avoid over-/underflow in the\n\
  *          eigenvalue equation which defines the second eigenvalue.  If\n\
  *          the eigenvalues are complex, then SCALE2=SCALE1.  If the\n\
  *          eigenvalues are real, then the second (real) eigenvalue is\n\
  *          WR2 / SCALE2 , but this may overflow or underflow, and in\n\
  *          fact, SCALE2 may be zero or less than the underflow\n\
  *          threshhold if the exact eigenvalue is sufficiently large.\n\
  *\n\
  *  WR1     (output) DOUBLE PRECISION\n\
  *          If the eigenvalue is real, then WR1 is SCALE1 times the\n\
  *          eigenvalue closest to the (2,2) element of A B**(-1).  If the\n\
  *          eigenvalue is complex, then WR1=WR2 is SCALE1 times the real\n\
  *          part of the eigenvalues.\n\
  *\n\
  *  WR2     (output) DOUBLE PRECISION\n\
  *          If the eigenvalue is real, then WR2 is SCALE2 times the\n\
  *          other eigenvalue.  If the eigenvalue is complex, then\n\
  *          WR1=WR2 is SCALE1 times the real part of the eigenvalues.\n\
  *\n\
  *  WI      (output) DOUBLE PRECISION\n\
  *          If the eigenvalue is real, then WI is zero.  If the\n\
  *          eigenvalue is complex, then WI is SCALE1 times the imaginary\n\
  *          part of the eigenvalues.  WI will always be non-negative.\n\
  *\n\n\
  *  =====================================================================\n\
  *\n"
