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