示例#1
0
 /// <summary>行列とベクトルの積と和を計算する(y = α op(A) x + βy)</summary>
 /// <param name="vectorX">ベクトルX</param>
 /// <param name="vectorY">ベクトルY(解が上書きされる)</param>
 /// <param name="alpha">第一項の係数</param>
 /// <param name="beta">第二項の係数</param>
 internal void VectorProduct(Vector vectorX, ref Vector vectorY, double alpha, double beta)
 {
     for (uint i = 0; i < this.Columns; i++)
     {
         vectorY.SetValue(i, vectorY.GetValue(i) * beta);
         for (uint j = 0; j < this.Rows; j++)
         {
             vectorY.AddValue(i, alpha * this.GetValue(i, j) * vectorX.GetValue(j));
         }
     }
 }
示例#2
0
 /// <summary>matrix1の逆行列を計算してmatrix2に設定する</summary>
 /// <param name="matrix"></param>
 internal void GetInverse(ref Matrix matrix)
 {
     LUDecomposition();
     Vector col = new Vector(Columns);
     for (uint j = 0; j < Columns; j++)
     {
         col.SetValue(0);
         col.SetValue(j, 1);
         LUSolve(ref col);
         for (uint i = 0; i < Columns; i++) matrix.SetValue(i, j, col.GetValue(i));
     }
 }
示例#3
0
 /// <summary></summary>
 /// <param name="vector"></param>
 internal void LUSolve(ref Vector vector)
 {
     if (isMatrixView)
     {
         uint ii = 0;
         for (uint i = 0; i < Rows; i++)
         {
             uint ip = perm[i];
             double sum = vector.GetValue(ip);
             vector.SetValue(ip, vector.GetValue(i));
             if (ii != 0)
             {
                 for (uint j = ii - 1; j < i; j++) sum -= GetValue(i, j) * vector.GetValue(j);
             }
             else if (sum != 0) ii = i + 1;
             vector.SetValue(i, sum);
         }
         for (int i = (int)Rows - 1; i >= 0; i--)
         {
             uint iii = (uint)i;
             double sum = vector.GetValue(iii);
             for (uint j = iii + 1; j < Columns; j++) sum -= GetValue(iii, j) * vector.GetValue(j);
             vector.SetValue(iii, sum / GetValue(iii, iii));
         }
     }
     else
     {
         uint ii = 0;
         for (uint i = 0; i < Rows; i++)
         {
             uint ip = perm[i];
             double sum = vector.GetValue(ip);
             vector.SetValue(ip, vector.GetValue(i));
             if (ii != 0)
             {
                 for (uint j = ii - 1; j < i; j++) sum -= mat[i, j] * vector.GetValue(j);
             }
             else if (sum != 0) ii = i + 1;
             vector.SetValue(i, sum);
         }
         for (int i = (int)Rows - 1; i >= 0; i--)
         {
             uint iii = (uint)i;
             double sum = vector.GetValue(iii);
             for (uint j = iii + 1; j < Columns; j++) sum -= mat[iii, j] * vector.GetValue(j);
             vector.SetValue(iii, sum / mat[iii, iii]);
         }
     }
 }
示例#4
0
        /// <summary>温度[C]を設定する</summary>
        /// <param name="temperatures">温度[C]</param>
        internal void setTemperature(Vector temperatures)
        {
            coreTemperature = temperatures.GetValue(0);
            SkinTemperature_Contact = temperatures.GetValue(1);
            SkinTemperature_NonContact = temperatures.GetValue(2);
            arteryTemperature = temperatures.GetValue(3);
            deepVeinTemperature = temperatures.GetValue(4);
            if (heatCapacity_SuperficialVein != 0) superficialVeinTemperature = temperatures.GetValue(5);

            if (! isJOSModel)
            {
                if (heatCapacity_SuperficialVein != 0)
                {
                    muscleTemperature = temperatures.GetValue(6);
                    fatTemperature = temperatures.GetValue(7);
                }
                else
                {
                    muscleTemperature = temperatures.GetValue(5);
                    fatTemperature = temperatures.GetValue(6);
                }
            }
        }