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:      /// DLACPY copies all or part of a two-dimensional matrix A to another
  27:      /// matrix B.
  28:      /// 
  29:      ///</summary>
  30:      public class DLACPY
  31:      {
  32:      
  33:   
  34:          #region Dependencies
  35:          
  36:          LSAME _lsame; 
  37:   
  38:          #endregion
  39:   
  40:   
  41:          #region Fields
  42:          
  43:          int I = 0; int J = 0; 
  44:   
  45:          #endregion
  46:   
  47:          public DLACPY(LSAME lsame)
  48:          {
  49:      
  50:   
  51:              #region Set Dependencies
  52:              
  53:              this._lsame = lsame; 
  54:   
  55:              #endregion
  56:   
  57:          }
  58:      
  59:          public DLACPY()
  60:          {
  61:      
  62:   
  63:              #region Dependencies (Initialization)
  64:              
  65:              LSAME lsame = new LSAME();
  66:   
  67:              #endregion
  68:   
  69:   
  70:              #region Set Dependencies
  71:              
  72:              this._lsame = lsame; 
  73:   
  74:              #endregion
  75:   
  76:          }
  77:          /// <summary>
  78:          /// Purpose
  79:          /// =======
  80:          /// 
  81:          /// DLACPY copies all or part of a two-dimensional matrix A to another
  82:          /// matrix B.
  83:          /// 
  84:          ///</summary>
  85:          /// <param name="UPLO">
  86:          /// (input) CHARACTER*1
  87:          /// Specifies the part of the matrix A to be copied to B.
  88:          /// = 'U':      Upper triangular part
  89:          /// = 'L':      Lower triangular part
  90:          /// Otherwise:  All of the matrix A
  91:          ///</param>
  92:          /// <param name="M">
  93:          /// (input) INTEGER
  94:          /// The number of rows of the matrix A.  M .GE. 0.
  95:          ///</param>
  96:          /// <param name="N">
  97:          /// (input) INTEGER
  98:          /// The number of columns of the matrix A.  N .GE. 0.
  99:          ///</param>
 100:          /// <param name="A">
 101:          /// (input) DOUBLE PRECISION array, dimension (LDA,N)
 102:          /// The m by n matrix A.  If UPLO = 'U', only the upper triangle
 103:          /// or trapezoid is accessed; if UPLO = 'L', only the lower
 104:          /// triangle or trapezoid is accessed.
 105:          ///</param>
 106:          /// <param name="LDA">
 107:          /// (input) INTEGER
 108:          /// The leading dimension of the array A.  LDA .GE. max(1,M).
 109:          ///</param>
 110:          /// <param name="B">
 111:          /// (output) DOUBLE PRECISION array, dimension (LDB,N)
 112:          /// On exit, B = A in the locations specified by UPLO.
 113:          ///</param>
 114:          /// <param name="LDB">
 115:          /// (input) INTEGER
 116:          /// The leading dimension of the array B.  LDB .GE. max(1,M).
 117:          ///</param>
 118:          public void Run(string UPLO, int M, int N, double[] A, int offset_a, int LDA, ref double[] B, int offset_b
 119:                           , int LDB)
 120:          {
 121:   
 122:              #region Array Index Correction
 123:              
 124:               int o_a = -1 - LDA + offset_a;  int o_b = -1 - LDB + offset_b; 
 125:   
 126:              #endregion
 127:   
 128:   
 129:              #region Strings
 130:              
 131:              UPLO = UPLO.Substring(0, 1);  
 132:   
 133:              #endregion
 134:   
 135:   
 136:              #region Prolog
 137:              
 138:              // *
 139:              // *  -- LAPACK auxiliary routine (version 3.1) --
 140:              // *     Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd..
 141:              // *     November 2006
 142:              // *
 143:              // *     .. Scalar Arguments ..
 144:              // *     ..
 145:              // *     .. Array Arguments ..
 146:              // *     ..
 147:              // *
 148:              // *  Purpose
 149:              // *  =======
 150:              // *
 151:              // *  DLACPY copies all or part of a two-dimensional matrix A to another
 152:              // *  matrix B.
 153:              // *
 154:              // *  Arguments
 155:              // *  =========
 156:              // *
 157:              // *  UPLO    (input) CHARACTER*1
 158:              // *          Specifies the part of the matrix A to be copied to B.
 159:              // *          = 'U':      Upper triangular part
 160:              // *          = 'L':      Lower triangular part
 161:              // *          Otherwise:  All of the matrix A
 162:              // *
 163:              // *  M       (input) INTEGER
 164:              // *          The number of rows of the matrix A.  M >= 0.
 165:              // *
 166:              // *  N       (input) INTEGER
 167:              // *          The number of columns of the matrix A.  N >= 0.
 168:              // *
 169:              // *  A       (input) DOUBLE PRECISION array, dimension (LDA,N)
 170:              // *          The m by n matrix A.  If UPLO = 'U', only the upper triangle
 171:              // *          or trapezoid is accessed; if UPLO = 'L', only the lower
 172:              // *          triangle or trapezoid is accessed.
 173:              // *
 174:              // *  LDA     (input) INTEGER
 175:              // *          The leading dimension of the array A.  LDA >= max(1,M).
 176:              // *
 177:              // *  B       (output) DOUBLE PRECISION array, dimension (LDB,N)
 178:              // *          On exit, B = A in the locations specified by UPLO.
 179:              // *
 180:              // *  LDB     (input) INTEGER
 181:              // *          The leading dimension of the array B.  LDB >= max(1,M).
 182:              // *
 183:              // *  =====================================================================
 184:              // *
 185:              // *     .. Local Scalars ..
 186:              // *     ..
 187:              // *     .. External Functions ..
 188:              // *     ..
 189:              // *     .. Intrinsic Functions ..
 190:              //      INTRINSIC          MIN;
 191:              // *     ..
 192:              // *     .. Executable Statements ..
 193:              // *
 194:   
 195:              #endregion
 196:   
 197:   
 198:              #region Body
 199:              
 200:              if (this._lsame.Run(UPLO, "U"))
 201:              {
 202:                  for (J = 1; J <= N; J++)
 203:                  {
 204:                      for (I = 1; I <= Math.Min(J, M); I++)
 205:                      {
 206:                          B[I+J * LDB + o_b] = A[I+J * LDA + o_a];
 207:                      }
 208:                  }
 209:              }
 210:              else
 211:              {
 212:                  if (this._lsame.Run(UPLO, "L"))
 213:                  {
 214:                      for (J = 1; J <= N; J++)
 215:                      {
 216:                          for (I = J; I <= M; I++)
 217:                          {
 218:                              B[I+J * LDB + o_b] = A[I+J * LDA + o_a];
 219:                          }
 220:                      }
 221:                  }
 222:                  else
 223:                  {
 224:                      for (J = 1; J <= N; J++)
 225:                      {
 226:                          for (I = 1; I <= M; I++)
 227:                          {
 228:                              B[I+J * LDB + o_b] = A[I+J * LDA + o_a];
 229:                          }
 230:                      }
 231:                  }
 232:              }
 233:              return;
 234:              // *
 235:              // *     End of DLACPY
 236:              // *
 237:   
 238:              #endregion
 239:   
 240:          }
 241:      }
 242:  }