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:      public class DCOPY
  20:      {
  21:      
  22:   
  23:          #region Fields
  24:          
  25:          int I = 0; int IX = 0; int IY = 0; int M = 0; int MP1 = 0; 
  26:   
  27:          #endregion
  28:   
  29:          public DCOPY()
  30:          {
  31:      
  32:          }
  33:      
  34:          public void Run(int N, double[] DX, int offset_dx, int INCX, ref double[] DY, int offset_dy, int INCY)
  35:          {
  36:   
  37:              #region Array Index Correction
  38:              
  39:               int o_dx = -1 + offset_dx;  int o_dy = -1 + offset_dy; 
  40:   
  41:              #endregion
  42:   
  43:              // c
  44:              // c     copies a vector, x, to a vector, y.
  45:              // c     uses unrolled loops for increments equal to one.
  46:              // c     jack dongarra, linpack, 3/11/78.
  47:              // c     modified 12/3/93, array(1) declarations changed to array(*)
  48:              // c
  49:              // c
  50:   
  51:              #region Body
  52:              
  53:              if (N <= 0) return;
  54:              if (INCX == 1 && INCY == 1) goto LABEL20;
  55:              // c
  56:              // c        code for unequal increments or equal increments
  57:              // c          not equal to 1
  58:              // c
  59:              IX = 1;
  60:              IY = 1;
  61:              if (INCX < 0) IX = ( - N + 1) * INCX + 1;
  62:              if (INCY < 0) IY = ( - N + 1) * INCY + 1;
  63:              for (I = 1; I <= N; I++)
  64:              {
  65:                  DY[IY + o_dy] = DX[IX + o_dx];
  66:                  IX = IX + INCX;
  67:                  IY = IY + INCY;
  68:              }
  69:              return;
  70:              // c
  71:              // c        code for both increments equal to 1
  72:              // c
  73:              // c
  74:              // c        clean-up loop
  75:              // c
  76:          LABEL20:  M = FortranLib.Mod(N,7);
  77:              if (M == 0) goto LABEL40;
  78:              for (I = 1; I <= M; I++)
  79:              {
  80:                  DY[I + o_dy] = DX[I + o_dx];
  81:              }
  82:              if (N < 7) return;
  83:          LABEL40:  MP1 = M + 1;
  84:              for (I = MP1; I <= N; I += 7)
  85:              {
  86:                  DY[I + o_dy] = DX[I + o_dx];
  87:                  DY[I + 1 + o_dy] = DX[I + 1 + o_dx];
  88:                  DY[I + 2 + o_dy] = DX[I + 2 + o_dx];
  89:                  DY[I + 3 + o_dy] = DX[I + 3 + o_dx];
  90:                  DY[I + 4 + o_dy] = DX[I + 4 + o_dx];
  91:                  DY[I + 5 + o_dy] = DX[I + 5 + o_dx];
  92:                  DY[I + 6 + o_dy] = DX[I + 6 + o_dx];
  93:              }
  94:              return;
  95:   
  96:              #endregion
  97:   
  98:          }
  99:      }
 100:  }