--- 
:name: dorbdb
:md5sum: 6a768cd2fe5db676bc79606b0d918596
:category: :subroutine
:arguments: 
- trans: 
    :type: char
    :intent: input
- signs: 
    :type: char
    :intent: input
- m: 
    :type: integer
    :intent: input
- p: 
    :type: integer
    :intent: input
- q: 
    :type: integer
    :intent: input
- x11: 
    :type: doublereal
    :intent: input/output
    :dims: 
    - ldx11
    - q
- ldx11: 
    :type: integer
    :intent: input
- x12: 
    :type: doublereal
    :intent: input/output
    :dims: 
    - ldx12
    - m-q
- ldx12: 
    :type: integer
    :intent: input
- x21: 
    :type: doublereal
    :intent: input/output
    :dims: 
    - ldx21
    - q
- ldx21: 
    :type: integer
    :intent: input
- x22: 
    :type: doublereal
    :intent: input/output
    :dims: 
    - ldx22
    - m-q
- ldx22: 
    :type: integer
    :intent: input
- theta: 
    :type: doublereal
    :intent: output
    :dims: 
    - q
- phi: 
    :type: doublereal
    :intent: output
    :dims: 
    - q-1
- taup1: 
    :type: doublereal
    :intent: output
    :dims: 
    - p
- taup2: 
    :type: doublereal
    :intent: output
    :dims: 
    - m-p
- tauq1: 
    :type: doublereal
    :intent: output
    :dims: 
    - q
- tauq2: 
    :type: doublereal
    :intent: output
    :dims: 
    - m-q
- work: 
    :type: doublereal
    :intent: workspace
    :dims: 
    - MAX(1,lwork)
- lwork: 
    :type: integer
    :intent: input
    :option: true
    :default: m-q
- info: 
    :type: integer
    :intent: output
:substitutions: 
  p: ldx11
  ldx12: p
  ldx21: p
  ldx22: p
:fortran_help: "      SUBROUTINE DORBDB( TRANS, SIGNS, M, P, Q, X11, LDX11, X12, LDX12, X21, LDX21, X22, LDX22, THETA, PHI, TAUP1, TAUP2, TAUQ1, TAUQ2, WORK, LWORK, INFO )\n\n\
  *  Purpose\n\
  *  =======\n\
  *\n\
  *  DORBDB simultaneously bidiagonalizes the blocks of an M-by-M\n\
  *  partitioned orthogonal matrix X:\n\
  *\n\
  *                                  [ B11 | B12 0  0 ]\n\
  *      [ X11 | X12 ]   [ P1 |    ] [  0  |  0 -I  0 ] [ Q1 |    ]**T\n\
  *  X = [-----------] = [---------] [----------------] [---------]   .\n\
  *      [ X21 | X22 ]   [    | P2 ] [ B21 | B22 0  0 ] [    | Q2 ]\n\
  *                                  [  0  |  0  0  I ]\n\
  *\n\
  *  X11 is P-by-Q. Q must be no larger than P, M-P, or M-Q. (If this is\n\
  *  not the case, then X must be transposed and/or permuted. This can be\n\
  *  done in constant time using the TRANS and SIGNS options. See DORCSD\n\
  *  for details.)\n\
  *\n\
  *  The orthogonal matrices P1, P2, Q1, and Q2 are P-by-P, (M-P)-by-\n\
  *  (M-P), Q-by-Q, and (M-Q)-by-(M-Q), respectively. They are\n\
  *  represented implicitly by Householder vectors.\n\
  *\n\
  *  B11, B12, B21, and B22 are Q-by-Q bidiagonal matrices represented\n\
  *  implicitly by angles THETA, PHI.\n\
  *\n\n\
  *  Arguments\n\
  *  =========\n\
  *\n\
  *  TRANS   (input) CHARACTER\n\
  *          = 'T':      X, U1, U2, V1T, and V2T are stored in row-major\n\
  *                      order;\n\
  *          otherwise:  X, U1, U2, V1T, and V2T are stored in column-\n\
  *                      major order.\n\
  *\n\
  *  SIGNS   (input) CHARACTER\n\
  *          = 'O':      The lower-left block is made nonpositive (the\n\
  *                      \"other\" convention);\n\
  *          otherwise:  The upper-right block is made nonpositive (the\n\
  *                      \"default\" convention).\n\
  *\n\
  *  M       (input) INTEGER\n\
  *          The number of rows and columns in X.\n\
  *\n\
  *  P       (input) INTEGER\n\
  *          The number of rows in X11 and X12. 0 <= P <= M.\n\
  *\n\
  *  Q       (input) INTEGER\n\
  *          The number of columns in X11 and X21. 0 <= Q <=\n\
  *          MIN(P,M-P,M-Q).\n\
  *\n\
  *  X11     (input/output) DOUBLE PRECISION array, dimension (LDX11,Q)\n\
  *          On entry, the top-left block of the orthogonal matrix to be\n\
  *          reduced. On exit, the form depends on TRANS:\n\
  *          If TRANS = 'N', then\n\
  *             the columns of tril(X11) specify reflectors for P1,\n\
  *             the rows of triu(X11,1) specify reflectors for Q1;\n\
  *          else TRANS = 'T', and\n\
  *             the rows of triu(X11) specify reflectors for P1,\n\
  *             the columns of tril(X11,-1) specify reflectors for Q1.\n\
  *\n\
  *  LDX11   (input) INTEGER\n\
  *          The leading dimension of X11. If TRANS = 'N', then LDX11 >=\n\
  *          P; else LDX11 >= Q.\n\
  *\n\
  *  X12     (input/output) DOUBLE PRECISION array, dimension (LDX12,M-Q)\n\
  *          On entry, the top-right block of the orthogonal matrix to\n\
  *          be reduced. On exit, the form depends on TRANS:\n\
  *          If TRANS = 'N', then\n\
  *             the rows of triu(X12) specify the first P reflectors for\n\
  *             Q2;\n\
  *          else TRANS = 'T', and\n\
  *             the columns of tril(X12) specify the first P reflectors\n\
  *             for Q2.\n\
  *\n\
  *  LDX12   (input) INTEGER\n\
  *          The leading dimension of X12. If TRANS = 'N', then LDX12 >=\n\
  *          P; else LDX11 >= M-Q.\n\
  *\n\
  *  X21     (input/output) DOUBLE PRECISION array, dimension (LDX21,Q)\n\
  *          On entry, the bottom-left block of the orthogonal matrix to\n\
  *          be reduced. On exit, the form depends on TRANS:\n\
  *          If TRANS = 'N', then\n\
  *             the columns of tril(X21) specify reflectors for P2;\n\
  *          else TRANS = 'T', and\n\
  *             the rows of triu(X21) specify reflectors for P2.\n\
  *\n\
  *  LDX21   (input) INTEGER\n\
  *          The leading dimension of X21. If TRANS = 'N', then LDX21 >=\n\
  *          M-P; else LDX21 >= Q.\n\
  *\n\
  *  X22     (input/output) DOUBLE PRECISION array, dimension (LDX22,M-Q)\n\
  *          On entry, the bottom-right block of the orthogonal matrix to\n\
  *          be reduced. On exit, the form depends on TRANS:\n\
  *          If TRANS = 'N', then\n\
  *             the rows of triu(X22(Q+1:M-P,P+1:M-Q)) specify the last\n\
  *             M-P-Q reflectors for Q2,\n\
  *          else TRANS = 'T', and\n\
  *             the columns of tril(X22(P+1:M-Q,Q+1:M-P)) specify the last\n\
  *             M-P-Q reflectors for P2.\n\
  *\n\
  *  LDX22   (input) INTEGER\n\
  *          The leading dimension of X22. If TRANS = 'N', then LDX22 >=\n\
  *          M-P; else LDX22 >= M-Q.\n\
  *\n\
  *  THETA   (output) DOUBLE PRECISION array, dimension (Q)\n\
  *          The entries of the bidiagonal blocks B11, B12, B21, B22 can\n\
  *          be computed from the angles THETA and PHI. See Further\n\
  *          Details.\n\
  *\n\
  *  PHI     (output) DOUBLE PRECISION array, dimension (Q-1)\n\
  *          The entries of the bidiagonal blocks B11, B12, B21, B22 can\n\
  *          be computed from the angles THETA and PHI. See Further\n\
  *          Details.\n\
  *\n\
  *  TAUP1   (output) DOUBLE PRECISION array, dimension (P)\n\
  *          The scalar factors of the elementary reflectors that define\n\
  *          P1.\n\
  *\n\
  *  TAUP2   (output) DOUBLE PRECISION array, dimension (M-P)\n\
  *          The scalar factors of the elementary reflectors that define\n\
  *          P2.\n\
  *\n\
  *  TAUQ1   (output) DOUBLE PRECISION array, dimension (Q)\n\
  *          The scalar factors of the elementary reflectors that define\n\
  *          Q1.\n\
  *\n\
  *  TAUQ2   (output) DOUBLE PRECISION array, dimension (M-Q)\n\
  *          The scalar factors of the elementary reflectors that define\n\
  *          Q2.\n\
  *\n\
  *  WORK    (workspace) DOUBLE PRECISION array, dimension (LWORK)\n\
  *\n\
  *  LWORK   (input) INTEGER\n\
  *          The dimension of the array WORK. LWORK >= M-Q.\n\
  *\n\
  *          If LWORK = -1, then a workspace query is assumed; the routine\n\
  *          only calculates the optimal size of the WORK array, returns\n\
  *          this value as the first entry of the WORK array, and no error\n\
  *          message related to LWORK is issued by XERBLA.\n\
  *\n\
  *  INFO    (output) INTEGER\n\
  *          = 0:  successful exit.\n\
  *          < 0:  if INFO = -i, the i-th argument had an illegal value.\n\
  *\n\n\
  *  Further Details\n\
  *  ===============\n\
  *\n\
  *  The bidiagonal blocks B11, B12, B21, and B22 are represented\n\
  *  implicitly by angles THETA(1), ..., THETA(Q) and PHI(1), ...,\n\
  *  PHI(Q-1). B11 and B21 are upper bidiagonal, while B21 and B22 are\n\
  *  lower bidiagonal. Every entry in each bidiagonal band is a product\n\
  *  of a sine or cosine of a THETA with a sine or cosine of a PHI. See\n\
  *  [1] or DORCSD for details.\n\
  *\n\
  *  P1, P2, Q1, and Q2 are represented as products of elementary\n\
  *  reflectors. See DORCSD for details on generating P1, P2, Q1, and Q2\n\
  *  using DORGQR and DORGLQ.\n\
  *\n\
  *  Reference\n\
  *  =========\n\
  *\n\
  *  [1] Brian D. Sutton. Computing the complete CS decomposition. Numer.\n\
  *      Algorithms, 50(1):33-65, 2009.\n\
  *\n\
  *  ====================================================================\n\
  *\n"
