  `   1:  #region Translated by Jose Antonio De Santiago-Castillo.`
`   2:   `
`   3:  //Translated by Jose Antonio De Santiago-Castillo. `
`   4:  //E-mail:JAntonioDeSantiago@gmail.com`
`   5:  //Web: www.DotNumerics.com`
`   6:  //`
`   7:  //Fortran to C# Translation.`
`   8:  //Translated by:`
`   9:  //F2CSharp Version 0.71 (November 10, 2009)`
`  10:  //Code Optimizations: None`
`  11:  //`
`  12:  #endregion`
`  13:   `
`  14:  using System;`
`  15:  using DotNumerics.FortranLibrary;`
`  16:   `
`  17:  namespace DotNumerics.CSLapack`
`  18:  {`
`  19:      /// <summary>`
`  20:      /// -- LAPACK auxiliary routine (version 3.1) --`
`  21:      /// Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd..`
`  22:      /// November 2006`
`  23:      /// Purpose`
`  24:      /// =======`
`  25:      /// `
`  26:      /// DLASR applies a sequence of plane rotations to a real matrix A,`
`  27:      /// from either the left or the right.`
`  28:      /// `
`  29:      /// When SIDE = 'L', the transformation takes the form`
`  30:      /// `
`  31:      /// A := P*A`
`  32:      /// `
`  33:      /// and when SIDE = 'R', the transformation takes the form`
`  34:      /// `
`  35:      /// A := A*P**T`
`  36:      /// `
`  37:      /// where P is an orthogonal matrix consisting of a sequence of z plane`
`  38:      /// rotations, with z = M when SIDE = 'L' and z = N when SIDE = 'R',`
`  39:      /// and P**T is the transpose of P.`
`  40:      /// `
`  41:      /// When DIRECT = 'F' (Forward sequence), then`
`  42:      /// `
`  43:      /// P = P(z-1) * ... * P(2) * P(1)`
`  44:      /// `
`  45:      /// and when DIRECT = 'B' (Backward sequence), then`
`  46:      /// `
`  47:      /// P = P(1) * P(2) * ... * P(z-1)`
`  48:      /// `
`  49:      /// where P(k) is a plane rotation matrix defined by the 2-by-2 rotation`
`  50:      /// `
`  51:      /// R(k) = (  c(k)  s(k) )`
`  52:      /// = ( -s(k)  c(k) ).`
`  53:      /// `
`  54:      /// When PIVOT = 'V' (Variable pivot), the rotation is performed`
`  55:      /// for the plane (k,k+1), i.e., P(k) has the form`
`  56:      /// `
`  57:      /// P(k) = (  1                                            )`
`  58:      /// (       ...                                     )`
`  59:      /// (              1                                )`
`  60:      /// (                   c(k)  s(k)                  )`
`  61:      /// (                  -s(k)  c(k)                  )`
`  62:      /// (                                1              )`
`  63:      /// (                                     ...       )`
`  64:      /// (                                            1  )`
`  65:      /// `
`  66:      /// where R(k) appears as a rank-2 modification to the identity matrix in`
`  67:      /// rows and columns k and k+1.`
`  68:      /// `
`  69:      /// When PIVOT = 'T' (Top pivot), the rotation is performed for the`
`  70:      /// plane (1,k+1), so P(k) has the form`
`  71:      /// `
`  72:      /// P(k) = (  c(k)                    s(k)                 )`
`  73:      /// (         1                                     )`
`  74:      /// (              ...                              )`
`  75:      /// (                     1                         )`
`  76:      /// ( -s(k)                    c(k)                 )`
`  77:      /// (                                 1             )`
`  78:      /// (                                      ...      )`
`  79:      /// (                                             1 )`
`  80:      /// `
`  81:      /// where R(k) appears in rows and columns 1 and k+1.`
`  82:      /// `
`  83:      /// Similarly, when PIVOT = 'B' (Bottom pivot), the rotation is`
`  84:      /// performed for the plane (k,z), giving P(k) the form`
`  85:      /// `
`  86:      /// P(k) = ( 1                                             )`
`  87:      /// (      ...                                      )`
`  88:      /// (             1                                 )`
`  89:      /// (                  c(k)                    s(k) )`
`  90:      /// (                         1                     )`
`  91:      /// (                              ...              )`
`  92:      /// (                                     1         )`
`  93:      /// (                 -s(k)                    c(k) )`
`  94:      /// `
`  95:      /// where R(k) appears in rows and columns k and z.  The rotations are`
`  96:      /// performed without ever forming P(k) explicitly.`
`  97:      /// `
`  98:      ///</summary>`
`  99:      public class DLASR`
` 100:      {`
` 101:      `
` 102:   `
` 103:          #region Dependencies`
` 104:          `
` 105:          LSAME _lsame; XERBLA _xerbla; `
` 106:   `
` 107:          #endregion`
` 108:   `
` 109:   `
` 110:          #region Fields`
` 111:          `
` 112:          const double ONE = 1.0E+0; const double ZERO = 0.0E+0; int I = 0; int INFO = 0; int J = 0; double CTEMP = 0; `
` 113:          double STEMP = 0;double TEMP = 0; `
` 114:   `
` 115:          #endregion`
` 116:   `
` 117:          public DLASR(LSAME lsame, XERBLA xerbla)`
` 118:          {`
` 119:      `
` 120:   `
` 121:              #region Set Dependencies`
` 122:              `
` 123:              this._lsame = lsame; this._xerbla = xerbla; `
` 124:   `
` 125:              #endregion`
` 126:   `
` 127:          }`
` 128:      `
` 129:          public DLASR()`
` 130:          {`
` 131:      `
` 132:   `
` 133:              #region Dependencies (Initialization)`
` 134:              `
` 135:              LSAME lsame = new LSAME();`
` 136:              XERBLA xerbla = new XERBLA();`
` 137:   `
` 138:              #endregion`
` 139:   `
` 140:   `
` 141:              #region Set Dependencies`
` 142:              `
` 143:              this._lsame = lsame; this._xerbla = xerbla; `
` 144:   `
` 145:              #endregion`
` 146:   `
` 147:          }`
` 148:          /// <summary>`
` 149:          /// Purpose`
` 150:          /// =======`
` 151:          /// `
` 152:          /// DLASR applies a sequence of plane rotations to a real matrix A,`
` 153:          /// from either the left or the right.`
` 154:          /// `
` 155:          /// When SIDE = 'L', the transformation takes the form`
` 156:          /// `
` 157:          /// A := P*A`
` 158:          /// `
` 159:          /// and when SIDE = 'R', the transformation takes the form`
` 160:          /// `
` 161:          /// A := A*P**T`
` 162:          /// `
` 163:          /// where P is an orthogonal matrix consisting of a sequence of z plane`
` 164:          /// rotations, with z = M when SIDE = 'L' and z = N when SIDE = 'R',`
` 165:          /// and P**T is the transpose of P.`
` 166:          /// `
` 167:          /// When DIRECT = 'F' (Forward sequence), then`
` 168:          /// `
` 169:          /// P = P(z-1) * ... * P(2) * P(1)`
` 170:          /// `
` 171:          /// and when DIRECT = 'B' (Backward sequence), then`
` 172:          /// `
` 173:          /// P = P(1) * P(2) * ... * P(z-1)`
` 174:          /// `
` 175:          /// where P(k) is a plane rotation matrix defined by the 2-by-2 rotation`
` 176:          /// `
` 177:          /// R(k) = (  c(k)  s(k) )`
` 178:          /// = ( -s(k)  c(k) ).`
` 179:          /// `
` 180:          /// When PIVOT = 'V' (Variable pivot), the rotation is performed`
` 181:          /// for the plane (k,k+1), i.e., P(k) has the form`
` 182:          /// `
` 183:          /// P(k) = (  1                                            )`
` 184:          /// (       ...                                     )`
` 185:          /// (              1                                )`
` 186:          /// (                   c(k)  s(k)                  )`
` 187:          /// (                  -s(k)  c(k)                  )`
` 188:          /// (                                1              )`
` 189:          /// (                                     ...       )`
` 190:          /// (                                            1  )`
` 191:          /// `
` 192:          /// where R(k) appears as a rank-2 modification to the identity matrix in`
` 193:          /// rows and columns k and k+1.`
` 194:          /// `
` 195:          /// When PIVOT = 'T' (Top pivot), the rotation is performed for the`
` 196:          /// plane (1,k+1), so P(k) has the form`
` 197:          /// `
` 198:          /// P(k) = (  c(k)                    s(k)                 )`
` 199:          /// (         1                                     )`
` 200:          /// (              ...                              )`
` 201:          /// (                     1                         )`
` 202:          /// ( -s(k)                    c(k)                 )`
` 203:          /// (                                 1             )`
` 204:          /// (                                      ...      )`
` 205:          /// (                                             1 )`
` 206:          /// `
` 207:          /// where R(k) appears in rows and columns 1 and k+1.`
` 208:          /// `
` 209:          /// Similarly, when PIVOT = 'B' (Bottom pivot), the rotation is`
` 210:          /// performed for the plane (k,z), giving P(k) the form`
` 211:          /// `
` 212:          /// P(k) = ( 1                                             )`
` 213:          /// (      ...                                      )`
` 214:          /// (             1                                 )`
` 215:          /// (                  c(k)                    s(k) )`
` 216:          /// (                         1                     )`
` 217:          /// (                              ...              )`
` 218:          /// (                                     1         )`
` 219:          /// (                 -s(k)                    c(k) )`
` 220:          /// `
` 221:          /// where R(k) appears in rows and columns k and z.  The rotations are`
` 222:          /// performed without ever forming P(k) explicitly.`
` 223:          /// `
` 224:          ///</summary>`
` 225:          /// <param name="SIDE">`
` 226:          /// (input) CHARACTER*1`
` 227:          /// Specifies whether the plane rotation matrix P is applied to`
` 228:          /// A on the left or the right.`
` 229:          /// = 'L':  Left, compute A := P*A`
` 230:          /// = 'R':  Right, compute A:= A*P**T`
` 231:          ///</param>`
` 232:          /// <param name="PIVOT">`
` 233:          /// (input) CHARACTER*1`
` 234:          /// Specifies the plane for which P(k) is a plane rotation`
` 235:          /// matrix.`
` 236:          /// = 'V':  Variable pivot, the plane (k,k+1)`
` 237:          /// = 'T':  Top pivot, the plane (1,k+1)`
` 238:          /// = 'B':  Bottom pivot, the plane (k,z)`
` 239:          ///</param>`
` 240:          /// <param name="DIRECT">`
` 241:          /// (input) CHARACTER*1`
` 242:          /// Specifies whether P is a forward or backward sequence of`
` 243:          /// plane rotations.`
` 244:          /// = 'F':  Forward, P = P(z-1)*...*P(2)*P(1)`
` 245:          /// = 'B':  Backward, P = P(1)*P(2)*...*P(z-1)`
` 246:          ///</param>`
` 247:          /// <param name="M">`
` 248:          /// (input) INTEGER`
` 249:          /// The number of rows of the matrix A.  If m .LE. 1, an immediate`
` 250:          /// return is effected.`
` 251:          ///</param>`
` 252:          /// <param name="N">`
` 253:          /// (input) INTEGER`
` 254:          /// The number of columns of the matrix A.  If n .LE. 1, an`
` 255:          /// immediate return is effected.`
` 256:          ///</param>`
` 257:          /// <param name="C">`
` 258:          /// (input) DOUBLE PRECISION array, dimension`
` 259:          /// (M-1) if SIDE = 'L'`
` 260:          /// (N-1) if SIDE = 'R'`
` 261:          /// The cosines c(k) of the plane rotations.`
` 262:          ///</param>`
` 263:          /// <param name="S">`
` 264:          /// (input) DOUBLE PRECISION array, dimension`
` 265:          /// (M-1) if SIDE = 'L'`
` 266:          /// (N-1) if SIDE = 'R'`
` 267:          /// The sines s(k) of the plane rotations.  The 2-by-2 plane`
` 268:          /// rotation part of the matrix P(k), R(k), has the form`
` 269:          /// R(k) = (  c(k)  s(k) )`
` 270:          /// ( -s(k)  c(k) ).`
` 271:          ///</param>`
` 272:          /// <param name="A">`
` 273:          /// := P*A`
` 274:          ///</param>`
` 275:          /// <param name="LDA">`
` 276:          /// (input) INTEGER`
` 277:          /// The leading dimension of the array A.  LDA .GE. max(1,M).`
` 278:          ///</param>`
` 279:          public void Run(string SIDE, string PIVOT, string DIRECT, int M, int N, double[] C, int offset_c`
` 280:                           , double[] S, int offset_s, ref double[] A, int offset_a, int LDA)`
` 281:          {`
` 282:   `
` 283:              #region Array Index Correction`
` 284:              `
` 285:               int o_c = -1 + offset_c;  int o_s = -1 + offset_s;  int o_a = -1 - LDA + offset_a; `
` 286:   `
` 287:              #endregion`
` 288:   `
` 289:   `
` 290:              #region Strings`
` 291:              `
` 292:              SIDE = SIDE.Substring(0, 1);  PIVOT = PIVOT.Substring(0, 1);  DIRECT = DIRECT.Substring(0, 1);  `
` 293:   `
` 294:              #endregion`
` 295:   `
` 296:   `
` 297:              #region Prolog`
` 298:              `
` 299:              // *`
` 300:              // *  -- LAPACK auxiliary routine (version 3.1) --`
` 301:              // *     Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd..`
` 302:              // *     November 2006`
` 303:              // *`
` 304:              // *     .. Scalar Arguments ..`
` 305:              // *     ..`
` 306:              // *     .. Array Arguments ..`
` 307:              // *     ..`
` 308:              // *`
` 309:              // *  Purpose`
` 310:              // *  =======`
` 311:              // *`
` 312:              // *  DLASR applies a sequence of plane rotations to a real matrix A,`
` 313:              // *  from either the left or the right.`
` 314:              // *  `
` 315:              // *  When SIDE = 'L', the transformation takes the form`
` 316:              // *  `
` 317:              // *     A := P*A`
` 318:              // *  `
` 319:              // *  and when SIDE = 'R', the transformation takes the form`
` 320:              // *  `
` 321:              // *     A := A*P**T`
` 322:              // *  `
` 323:              // *  where P is an orthogonal matrix consisting of a sequence of z plane`
` 324:              // *  rotations, with z = M when SIDE = 'L' and z = N when SIDE = 'R',`
` 325:              // *  and P**T is the transpose of P.`
` 326:              // *  `
` 327:              // *  When DIRECT = 'F' (Forward sequence), then`
` 328:              // *  `
` 329:              // *     P = P(z-1) * ... * P(2) * P(1)`
` 330:              // *  `
` 331:              // *  and when DIRECT = 'B' (Backward sequence), then`
` 332:              // *  `
` 333:              // *     P = P(1) * P(2) * ... * P(z-1)`
` 334:              // *  `
` 335:              // *  where P(k) is a plane rotation matrix defined by the 2-by-2 rotation`
` 336:              // *  `
` 337:              // *     R(k) = (  c(k)  s(k) )`
` 338:              // *          = ( -s(k)  c(k) ).`
` 339:              // *  `
` 340:              // *  When PIVOT = 'V' (Variable pivot), the rotation is performed`
` 341:              // *  for the plane (k,k+1), i.e., P(k) has the form`
` 342:              // *  `
` 343:              // *     P(k) = (  1                                            )`
` 344:              // *            (       ...                                     )`
` 345:              // *            (              1                                )`
` 346:              // *            (                   c(k)  s(k)                  )`
` 347:              // *            (                  -s(k)  c(k)                  )`
` 348:              // *            (                                1              )`
` 349:              // *            (                                     ...       )`
` 350:              // *            (                                            1  )`
` 351:              // *  `
` 352:              // *  where R(k) appears as a rank-2 modification to the identity matrix in`
` 353:              // *  rows and columns k and k+1.`
` 354:              // *  `
` 355:              // *  When PIVOT = 'T' (Top pivot), the rotation is performed for the`
` 356:              // *  plane (1,k+1), so P(k) has the form`
` 357:              // *  `
` 358:              // *     P(k) = (  c(k)                    s(k)                 )`
` 359:              // *            (         1                                     )`
` 360:              // *            (              ...                              )`
` 361:              // *            (                     1                         )`
` 362:              // *            ( -s(k)                    c(k)                 )`
` 363:              // *            (                                 1             )`
` 364:              // *            (                                      ...      )`
` 365:              // *            (                                             1 )`
` 366:              // *  `
` 367:              // *  where R(k) appears in rows and columns 1 and k+1.`
` 368:              // *  `
` 369:              // *  Similarly, when PIVOT = 'B' (Bottom pivot), the rotation is`
` 370:              // *  performed for the plane (k,z), giving P(k) the form`
` 371:              // *  `
` 372:              // *     P(k) = ( 1                                             )`
` 373:              // *            (      ...                                      )`
` 374:              // *            (             1                                 )`
` 375:              // *            (                  c(k)                    s(k) )`
` 376:              // *            (                         1                     )`
` 377:              // *            (                              ...              )`
` 378:              // *            (                                     1         )`
` 379:              // *            (                 -s(k)                    c(k) )`
` 380:              // *  `
` 381:              // *  where R(k) appears in rows and columns k and z.  The rotations are`
` 382:              // *  performed without ever forming P(k) explicitly.`
` 383:              // *`
` 384:              // *  Arguments`
` 385:              // *  =========`
` 386:              // *`
` 387:              // *  SIDE    (input) CHARACTER*1`
` 388:              // *          Specifies whether the plane rotation matrix P is applied to`
` 389:              // *          A on the left or the right.`
` 390:              // *          = 'L':  Left, compute A := P*A`
` 391:              // *          = 'R':  Right, compute A:= A*P**T`
` 392:              // *`
` 393:              // *  PIVOT   (input) CHARACTER*1`
` 394:              // *          Specifies the plane for which P(k) is a plane rotation`
` 395:              // *          matrix.`
` 396:              // *          = 'V':  Variable pivot, the plane (k,k+1)`
` 397:              // *          = 'T':  Top pivot, the plane (1,k+1)`
` 398:              // *          = 'B':  Bottom pivot, the plane (k,z)`
` 399:              // *`
` 400:              // *  DIRECT  (input) CHARACTER*1`
` 401:              // *          Specifies whether P is a forward or backward sequence of`
` 402:              // *          plane rotations.`
` 403:              // *          = 'F':  Forward, P = P(z-1)*...*P(2)*P(1)`
` 404:              // *          = 'B':  Backward, P = P(1)*P(2)*...*P(z-1)`
` 405:              // *`
` 406:              // *  M       (input) INTEGER`
` 407:              // *          The number of rows of the matrix A.  If m <= 1, an immediate`
` 408:              // *          return is effected.`
` 409:              // *`
` 410:              // *  N       (input) INTEGER`
` 411:              // *          The number of columns of the matrix A.  If n <= 1, an`
` 412:              // *          immediate return is effected.`
` 413:              // *`
` 414:              // *  C       (input) DOUBLE PRECISION array, dimension`
` 415:              // *                  (M-1) if SIDE = 'L'`
` 416:              // *                  (N-1) if SIDE = 'R'`
` 417:              // *          The cosines c(k) of the plane rotations.`
` 418:              // *`
` 419:              // *  S       (input) DOUBLE PRECISION array, dimension`
` 420:              // *                  (M-1) if SIDE = 'L'`
` 421:              // *                  (N-1) if SIDE = 'R'`
` 422:              // *          The sines s(k) of the plane rotations.  The 2-by-2 plane`
` 423:              // *          rotation part of the matrix P(k), R(k), has the form`
` 424:              // *          R(k) = (  c(k)  s(k) )`
` 425:              // *                 ( -s(k)  c(k) ).`
` 426:              // *`
` 427:              // *  A       (input/output) DOUBLE PRECISION array, dimension (LDA,N)`
` 428:              // *          The M-by-N matrix A.  On exit, A is overwritten by P*A if`
` 429:              // *          SIDE = 'R' or by A*P**T if SIDE = 'L'.`
` 430:              // *`
` 431:              // *  LDA     (input) INTEGER`
` 432:              // *          The leading dimension of the array A.  LDA >= max(1,M).`
` 433:              // *`
` 434:              // *  =====================================================================`
` 435:              // *`
` 436:              // *     .. Parameters ..`
` 437:              // *     ..`
` 438:              // *     .. Local Scalars ..`
` 439:              // *     ..`
` 440:              // *     .. External Functions ..`
` 441:              // *     ..`
` 442:              // *     .. External Subroutines ..`
` 443:              // *     ..`
` 444:              // *     .. Intrinsic Functions ..`
` 445:              //      INTRINSIC          MAX;`
` 446:              // *     ..`
` 447:              // *     .. Executable Statements ..`
` 448:              // *`
` 449:              // *     Test the input parameters`
` 450:              // *`
` 451:   `
` 452:              #endregion`
` 453:   `
` 454:   `
` 455:              #region Body`
` 456:              `
` 457:              INFO = 0;`
` 458:              if (!(this._lsame.Run(SIDE, "L") || this._lsame.Run(SIDE, "R")))`
` 459:              {`
` 460:                  INFO = 1;`
` 461:              }`
` 462:              else`
` 463:              {`
` 464:                  if (!(this._lsame.Run(PIVOT, "V") || this._lsame.Run(PIVOT, "T") || this._lsame.Run(PIVOT, "B")))`
` 465:                  {`
` 466:                      INFO = 2;`
` 467:                  }`
` 468:                  else`
` 469:                  {`
` 470:                      if (!(this._lsame.Run(DIRECT, "F") || this._lsame.Run(DIRECT, "B")))`
` 471:                      {`
` 472:                          INFO = 3;`
` 473:                      }`
` 474:                      else`
` 475:                      {`
` 476:                          if (M < 0)`
` 477:                          {`
` 478:                              INFO = 4;`
` 479:                          }`
` 480:                          else`
` 481:                          {`
` 482:                              if (N < 0)`
` 483:                              {`
` 484:                                  INFO = 5;`
` 485:                              }`
` 486:                              else`
` 487:                              {`
` 488:                                  if (LDA < Math.Max(1, M))`
` 489:                                  {`
` 490:                                      INFO = 9;`
` 491:                                  }`
` 492:                              }`
` 493:                          }`
` 494:                      }`
` 495:                  }`
` 496:              }`
` 497:              if (INFO != 0)`
` 498:              {`
` 499:                  this._xerbla.Run("DLASR ", INFO);`
` 500:                  return;`
` 501:              }`
` 502:              // *`
` 503:              // *     Quick return if possible`
` 504:              // *`
` 505:              if ((M == 0) || (N == 0)) return;`
` 506:              if (this._lsame.Run(SIDE, "L"))`
` 507:              {`
` 508:                  // *`
` 509:                  // *        Form  P * A`
` 510:                  // *`
` 511:                  if (this._lsame.Run(PIVOT, "V"))`
` 512:                  {`
` 513:                      if (this._lsame.Run(DIRECT, "F"))`
` 514:                      {`
` 515:                          for (J = 1; J <= M - 1; J++)`
` 516:                          {`
` 517:                              CTEMP = C[J + o_c];`
` 518:                              STEMP = S[J + o_s];`
` 519:                              if ((CTEMP != ONE) || (STEMP != ZERO))`
` 520:                              {`
` 521:                                  for (I = 1; I <= N; I++)`
` 522:                                  {`
` 523:                                      TEMP = A[J + 1+I * LDA + o_a];`
` 524:                                      A[J + 1+I * LDA + o_a] = CTEMP * TEMP - STEMP * A[J+I * LDA + o_a];`
` 525:                                      A[J+I * LDA + o_a] = STEMP * TEMP + CTEMP * A[J+I * LDA + o_a];`
` 526:                                  }`
` 527:                              }`
` 528:                          }`
` 529:                      }`
` 530:                      else`
` 531:                      {`
` 532:                          if (this._lsame.Run(DIRECT, "B"))`
` 533:                          {`
` 534:                              for (J = M - 1; J >= 1; J +=  - 1)`
` 535:                              {`
` 536:                                  CTEMP = C[J + o_c];`
` 537:                                  STEMP = S[J + o_s];`
` 538:                                  if ((CTEMP != ONE) || (STEMP != ZERO))`
` 539:                                  {`
` 540:                                      for (I = 1; I <= N; I++)`
` 541:                                      {`
` 542:                                          TEMP = A[J + 1+I * LDA + o_a];`
` 543:                                          A[J + 1+I * LDA + o_a] = CTEMP * TEMP - STEMP * A[J+I * LDA + o_a];`
` 544:                                          A[J+I * LDA + o_a] = STEMP * TEMP + CTEMP * A[J+I * LDA + o_a];`
` 545:                                      }`
` 546:                                  }`
` 547:                              }`
` 548:                          }`
` 549:                      }`
` 550:                  }`
` 551:                  else`
` 552:                  {`
` 553:                      if (this._lsame.Run(PIVOT, "T"))`
` 554:                      {`
` 555:                          if (this._lsame.Run(DIRECT, "F"))`
` 556:                          {`
` 557:                              for (J = 2; J <= M; J++)`
` 558:                              {`
` 559:                                  CTEMP = C[J - 1 + o_c];`
` 560:                                  STEMP = S[J - 1 + o_s];`
` 561:                                  if ((CTEMP != ONE) || (STEMP != ZERO))`
` 562:                                  {`
` 563:                                      for (I = 1; I <= N; I++)`
` 564:                                      {`
` 565:                                          TEMP = A[J+I * LDA + o_a];`
` 566:                                          A[J+I * LDA + o_a] = CTEMP * TEMP - STEMP * A[1+I * LDA + o_a];`
` 567:                                          A[1+I * LDA + o_a] = STEMP * TEMP + CTEMP * A[1+I * LDA + o_a];`
` 568:                                      }`
` 569:                                  }`
` 570:                              }`
` 571:                          }`
` 572:                          else`
` 573:                          {`
` 574:                              if (this._lsame.Run(DIRECT, "B"))`
` 575:                              {`
` 576:                                  for (J = M; J >= 2; J +=  - 1)`
` 577:                                  {`
` 578:                                      CTEMP = C[J - 1 + o_c];`
` 579:                                      STEMP = S[J - 1 + o_s];`
` 580:                                      if ((CTEMP != ONE) || (STEMP != ZERO))`
` 581:                                      {`
` 582:                                          for (I = 1; I <= N; I++)`
` 583:                                          {`
` 584:                                              TEMP = A[J+I * LDA + o_a];`
` 585:                                              A[J+I * LDA + o_a] = CTEMP * TEMP - STEMP * A[1+I * LDA + o_a];`
` 586:                                              A[1+I * LDA + o_a] = STEMP * TEMP + CTEMP * A[1+I * LDA + o_a];`
` 587:                                          }`
` 588:                                      }`
` 589:                                  }`
` 590:                              }`
` 591:                          }`
` 592:                      }`
` 593:                      else`
` 594:                      {`
` 595:                          if (this._lsame.Run(PIVOT, "B"))`
` 596:                          {`
` 597:                              if (this._lsame.Run(DIRECT, "F"))`
` 598:                              {`
` 599:                                  for (J = 1; J <= M - 1; J++)`
` 600:                                  {`
` 601:                                      CTEMP = C[J + o_c];`
` 602:                                      STEMP = S[J + o_s];`
` 603:                                      if ((CTEMP != ONE) || (STEMP != ZERO))`
` 604:                                      {`
` 605:                                          for (I = 1; I <= N; I++)`
` 606:                                          {`
` 607:                                              TEMP = A[J+I * LDA + o_a];`
` 608:                                              A[J+I * LDA + o_a] = STEMP * A[M+I * LDA + o_a] + CTEMP * TEMP;`
` 609:                                              A[M+I * LDA + o_a] = CTEMP * A[M+I * LDA + o_a] - STEMP * TEMP;`
` 610:                                          }`
` 611:                                      }`
` 612:                                  }`
` 613:                              }`
` 614:                              else`
` 615:                              {`
` 616:                                  if (this._lsame.Run(DIRECT, "B"))`
` 617:                                  {`
` 618:                                      for (J = M - 1; J >= 1; J +=  - 1)`
` 619:                                      {`
` 620:                                          CTEMP = C[J + o_c];`
` 621:                                          STEMP = S[J + o_s];`
` 622:                                          if ((CTEMP != ONE) || (STEMP != ZERO))`
` 623:                                          {`
` 624:                                              for (I = 1; I <= N; I++)`
` 625:                                              {`
` 626:                                                  TEMP = A[J+I * LDA + o_a];`
` 627:                                                  A[J+I * LDA + o_a] = STEMP * A[M+I * LDA + o_a] + CTEMP * TEMP;`
` 628:                                                  A[M+I * LDA + o_a] = CTEMP * A[M+I * LDA + o_a] - STEMP * TEMP;`
` 629:                                              }`
` 630:                                          }`
` 631:                                      }`
` 632:                                  }`
` 633:                              }`
` 634:                          }`
` 635:                      }`
` 636:                  }`
` 637:              }`
` 638:              else`
` 639:              {`
` 640:                  if (this._lsame.Run(SIDE, "R"))`
` 641:                  {`
` 642:                      // *`
` 643:                      // *        Form A * P'`
` 644:                      // *`
` 645:                      if (this._lsame.Run(PIVOT, "V"))`
` 646:                      {`
` 647:                          if (this._lsame.Run(DIRECT, "F"))`
` 648:                          {`
` 649:                              for (J = 1; J <= N - 1; J++)`
` 650:                              {`
` 651:                                  CTEMP = C[J + o_c];`
` 652:                                  STEMP = S[J + o_s];`
` 653:                                  if ((CTEMP != ONE) || (STEMP != ZERO))`
` 654:                                  {`
` 655:                                      for (I = 1; I <= M; I++)`
` 656:                                      {`
` 657:                                          TEMP = A[I+(J + 1) * LDA + o_a];`
` 658:                                          A[I+(J + 1) * LDA + o_a] = CTEMP * TEMP - STEMP * A[I+J * LDA + o_a];`
` 659:                                          A[I+J * LDA + o_a] = STEMP * TEMP + CTEMP * A[I+J * LDA + o_a];`
` 660:                                      }`
` 661:                                  }`
` 662:                              }`
` 663:                          }`
` 664:                          else`
` 665:                          {`
` 666:                              if (this._lsame.Run(DIRECT, "B"))`
` 667:                              {`
` 668:                                  for (J = N - 1; J >= 1; J +=  - 1)`
` 669:                                  {`
` 670:                                      CTEMP = C[J + o_c];`
` 671:                                      STEMP = S[J + o_s];`
` 672:                                      if ((CTEMP != ONE) || (STEMP != ZERO))`
` 673:                                      {`
` 674:                                          for (I = 1; I <= M; I++)`
` 675:                                          {`
` 676:                                              TEMP = A[I+(J + 1) * LDA + o_a];`
` 677:                                              A[I+(J + 1) * LDA + o_a] = CTEMP * TEMP - STEMP * A[I+J * LDA + o_a];`
` 678:                                              A[I+J * LDA + o_a] = STEMP * TEMP + CTEMP * A[I+J * LDA + o_a];`
` 679:                                          }`
` 680:                                      }`
` 681:                                  }`
` 682:                              }`
` 683:                          }`
` 684:                      }`
` 685:                      else`
` 686:                      {`
` 687:                          if (this._lsame.Run(PIVOT, "T"))`
` 688:                          {`
` 689:                              if (this._lsame.Run(DIRECT, "F"))`
` 690:                              {`
` 691:                                  for (J = 2; J <= N; J++)`
` 692:                                  {`
` 693:                                      CTEMP = C[J - 1 + o_c];`
` 694:                                      STEMP = S[J - 1 + o_s];`
` 695:                                      if ((CTEMP != ONE) || (STEMP != ZERO))`
` 696:                                      {`
` 697:                                          for (I = 1; I <= M; I++)`
` 698:                                          {`
` 699:                                              TEMP = A[I+J * LDA + o_a];`
` 700:                                              A[I+J * LDA + o_a] = CTEMP * TEMP - STEMP * A[I+1 * LDA + o_a];`
` 701:                                              A[I+1 * LDA + o_a] = STEMP * TEMP + CTEMP * A[I+1 * LDA + o_a];`
` 702:                                          }`
` 703:                                      }`
` 704:                                  }`
` 705:                              }`
` 706:                              else`
` 707:                              {`
` 708:                                  if (this._lsame.Run(DIRECT, "B"))`
` 709:                                  {`
` 710:                                      for (J = N; J >= 2; J +=  - 1)`
` 711:                                      {`
` 712:                                          CTEMP = C[J - 1 + o_c];`
` 713:                                          STEMP = S[J - 1 + o_s];`
` 714:                                          if ((CTEMP != ONE) || (STEMP != ZERO))`
` 715:                                          {`
` 716:                                              for (I = 1; I <= M; I++)`
` 717:                                              {`
` 718:                                                  TEMP = A[I+J * LDA + o_a];`
` 719:                                                  A[I+J * LDA + o_a] = CTEMP * TEMP - STEMP * A[I+1 * LDA + o_a];`
` 720:                                                  A[I+1 * LDA + o_a] = STEMP * TEMP + CTEMP * A[I+1 * LDA + o_a];`
` 721:                                              }`
` 722:                                          }`
` 723:                                      }`
` 724:                                  }`
` 725:                              }`
` 726:                          }`
` 727:                          else`
` 728:                          {`
` 729:                              if (this._lsame.Run(PIVOT, "B"))`
` 730:                              {`
` 731:                                  if (this._lsame.Run(DIRECT, "F"))`
` 732:                                  {`
` 733:                                      for (J = 1; J <= N - 1; J++)`
` 734:                                      {`
` 735:                                          CTEMP = C[J + o_c];`
` 736:                                          STEMP = S[J + o_s];`
` 737:                                          if ((CTEMP != ONE) || (STEMP != ZERO))`
` 738:                                          {`
` 739:                                              for (I = 1; I <= M; I++)`
` 740:                                              {`
` 741:                                                  TEMP = A[I+J * LDA + o_a];`
` 742:                                                  A[I+J * LDA + o_a] = STEMP * A[I+N * LDA + o_a] + CTEMP * TEMP;`
` 743:                                                  A[I+N * LDA + o_a] = CTEMP * A[I+N * LDA + o_a] - STEMP * TEMP;`
` 744:                                              }`
` 745:                                          }`
` 746:                                      }`
` 747:                                  }`
` 748:                                  else`
` 749:                                  {`
` 750:                                      if (this._lsame.Run(DIRECT, "B"))`
` 751:                                      {`
` 752:                                          for (J = N - 1; J >= 1; J +=  - 1)`
` 753:                                          {`
` 754:                                              CTEMP = C[J + o_c];`
` 755:                                              STEMP = S[J + o_s];`
` 756:                                              if ((CTEMP != ONE) || (STEMP != ZERO))`
` 757:                                              {`
` 758:                                                  for (I = 1; I <= M; I++)`
` 759:                                                  {`
` 760:                                                      TEMP = A[I+J * LDA + o_a];`
` 761:                                                      A[I+J * LDA + o_a] = STEMP * A[I+N * LDA + o_a] + CTEMP * TEMP;`
` 762:                                                      A[I+N * LDA + o_a] = CTEMP * A[I+N * LDA + o_a] - STEMP * TEMP;`
` 763:                                                  }`
` 764:                                              }`
` 765:                                          }`
` 766:                                      }`
` 767:                                  }`
` 768:                              }`
` 769:                          }`
` 770:                      }`
` 771:                  }`
` 772:              }`
` 773:              // *`
` 774:              return;`
` 775:              // *`
` 776:              // *     End of DLASR`
` 777:              // *`
` 778:   `
` 779:              #endregion`
` 780:   `
` 781:          }`
` 782:      }`
` 783:  }`