Ejemplo n.º 1
0
 /// <summary>
 /// Method to solve the LY=B equation and store the value of Y
 /// </summary>
 private void SolveY()
 {
     for (int i = 0; i < Size; i++)
     {
         BigFraction tempSum = zero;
         for (int j = 0; j < Size; j++)
         {
             tempSum = tempSum.Add(lowerMatrix[i, j].Multiply(yMatrix[j]));
             //Console.WriteLine(tempSum);
         }
         yMatrix[i] = bMatrix[i].Subtract(tempSum);
     }
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Method to solve the UX=Y and store the result in X
 /// </summary>
 private void SolveX()
 {
     for (int i = Size - 1; i >= 0; i--)
     {
         BigFraction tempSum = zero;
         for (int j = Size - 1; j >= 0; j--)
         {
             if (i < j)
             {
                 tempSum = tempSum.Add(upperMatrix[i, j].Multiply(xMatrix[j]));
             }
         }
         xMatrix[i] = yMatrix[i].Subtract(tempSum).Divide(upperMatrix[i, i]);
     }
 }