Skip Navigation Links
Numerical Libraries
Linear Algebra
Differential Equations
Optimization
Samples
Skip Navigation Links
Linear Algebra
CSLapack
CSBlas
   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:      /// DLARTV applies a vector of real plane rotations to elements of the
  27:      /// real vectors x and y. For i = 1,2,...,n
  28:      /// 
  29:      /// ( x(i) ) := (  c(i)  s(i) ) ( x(i) )
  30:      /// ( y(i) )    ( -s(i)  c(i) ) ( y(i) )
  31:      /// 
  32:      ///</summary>
  33:      public class DLARTV
  34:      {
  35:      
  36:   
  37:          #region Fields
  38:          
  39:          int I = 0; int IC = 0; int IX = 0; int IY = 0; double XI = 0; double YI = 0; 
  40:   
  41:          #endregion
  42:   
  43:          public DLARTV()
  44:          {
  45:      
  46:          }
  47:      
  48:          /// <summary>
  49:          /// Purpose
  50:          /// =======
  51:          /// 
  52:          /// DLARTV applies a vector of real plane rotations to elements of the
  53:          /// real vectors x and y. For i = 1,2,...,n
  54:          /// 
  55:          /// ( x(i) ) := (  c(i)  s(i) ) ( x(i) )
  56:          /// ( y(i) )    ( -s(i)  c(i) ) ( y(i) )
  57:          /// 
  58:          ///</summary>
  59:          /// <param name="N">
  60:          /// (input) INTEGER
  61:          /// The number of plane rotations to be applied.
  62:          ///</param>
  63:          /// <param name="X">
  64:          /// (input/output) DOUBLE PRECISION array,
  65:          /// dimension (1+(N-1)*INCX)
  66:          /// The vector x.
  67:          ///</param>
  68:          /// <param name="INCX">
  69:          /// (input) INTEGER
  70:          /// The increment between elements of X. INCX .GT. 0.
  71:          ///</param>
  72:          /// <param name="Y">
  73:          /// (input/output) DOUBLE PRECISION array,
  74:          /// dimension (1+(N-1)*INCY)
  75:          /// The vector y.
  76:          ///</param>
  77:          /// <param name="INCY">
  78:          /// (input) INTEGER
  79:          /// The increment between elements of Y. INCY .GT. 0.
  80:          ///</param>
  81:          /// <param name="C">
  82:          /// (input) DOUBLE PRECISION array, dimension (1+(N-1)*INCC)
  83:          /// The cosines of the plane rotations.
  84:          ///</param>
  85:          /// <param name="S">
  86:          /// (input) DOUBLE PRECISION array, dimension (1+(N-1)*INCC)
  87:          /// The sines of the plane rotations.
  88:          ///</param>
  89:          /// <param name="INCC">
  90:          /// (input) INTEGER
  91:          /// The increment between elements of C and S. INCC .GT. 0.
  92:          ///</param>
  93:          public void Run(int N, ref double[] X, int offset_x, int INCX, ref double[] Y, int offset_y, int INCY, double[] C, int offset_c
  94:                           , double[] S, int offset_s, int INCC)
  95:          {
  96:   
  97:              #region Array Index Correction
  98:              
  99:               int o_x = -1 + offset_x;  int o_y = -1 + offset_y;  int o_c = -1 + offset_c;  int o_s = -1 + offset_s; 
 100:   
 101:              #endregion
 102:   
 103:   
 104:              #region Prolog
 105:              
 106:              // *
 107:              // *  -- LAPACK auxiliary routine (version 3.1) --
 108:              // *     Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd..
 109:              // *     November 2006
 110:              // *
 111:              // *     .. Scalar Arguments ..
 112:              // *     ..
 113:              // *     .. Array Arguments ..
 114:              // *     ..
 115:              // *
 116:              // *  Purpose
 117:              // *  =======
 118:              // *
 119:              // *  DLARTV applies a vector of real plane rotations to elements of the
 120:              // *  real vectors x and y. For i = 1,2,...,n
 121:              // *
 122:              // *     ( x(i) ) := (  c(i)  s(i) ) ( x(i) )
 123:              // *     ( y(i) )    ( -s(i)  c(i) ) ( y(i) )
 124:              // *
 125:              // *  Arguments
 126:              // *  =========
 127:              // *
 128:              // *  N       (input) INTEGER
 129:              // *          The number of plane rotations to be applied.
 130:              // *
 131:              // *  X       (input/output) DOUBLE PRECISION array,
 132:              // *                         dimension (1+(N-1)*INCX)
 133:              // *          The vector x.
 134:              // *
 135:              // *  INCX    (input) INTEGER
 136:              // *          The increment between elements of X. INCX > 0.
 137:              // *
 138:              // *  Y       (input/output) DOUBLE PRECISION array,
 139:              // *                         dimension (1+(N-1)*INCY)
 140:              // *          The vector y.
 141:              // *
 142:              // *  INCY    (input) INTEGER
 143:              // *          The increment between elements of Y. INCY > 0.
 144:              // *
 145:              // *  C       (input) DOUBLE PRECISION array, dimension (1+(N-1)*INCC)
 146:              // *          The cosines of the plane rotations.
 147:              // *
 148:              // *  S       (input) DOUBLE PRECISION array, dimension (1+(N-1)*INCC)
 149:              // *          The sines of the plane rotations.
 150:              // *
 151:              // *  INCC    (input) INTEGER
 152:              // *          The increment between elements of C and S. INCC > 0.
 153:              // *
 154:              // *  =====================================================================
 155:              // *
 156:              // *     .. Local Scalars ..
 157:              // *     ..
 158:              // *     .. Executable Statements ..
 159:              // *
 160:   
 161:              #endregion
 162:   
 163:              IX = 1;
 164:              IY = 1;
 165:              IC = 1;
 166:              for (I = 1; I <= N; I++)
 167:              {
 168:                  XI = X[IX + o_x];
 169:                  YI = Y[IY + o_y];
 170:                  X[IX + o_x] = C[IC + o_c] * XI + S[IC + o_s] * YI;
 171:                  Y[IY + o_y] = C[IC + o_c] * YI - S[IC + o_s] * XI;
 172:                  IX = IX + INCX;
 173:                  IY = IY + INCY;
 174:                  IC = IC + INCC;
 175:              }
 176:              return;
 177:              // *
 178:              // *     End of DLARTV
 179:              // *
 180:          }
 181:      }
 182:  }