Пример #1
0
 public override Result.Result EvaluateResult()
 {
     if (this.Mode.Equals(OperatonMode.A))
     {
         try
         {
             MatrixLibrary.Matrix matrix = MatrixLibrary.Matrix.Inverse(Matrices[0].MatrixView.Matrix);
             Result.Result matrixResult = new Result.Result(matrix.NoCols, matrix.NoRows, false);
             matrixResult.UpdateMatrix(matrix);
             return matrixResult;
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.Message, "Error!", MessageBoxButton.OK);
             return null;
         }
     }
     else
     {
         try
         {
             MatrixLibrary.Matrix matrix = MatrixLibrary.Matrix.Inverse(Matrices[1].MatrixView.Matrix);
             Result.Result matrixResult = new Result.Result(matrix.NoCols, matrix.NoRows, false);
             matrixResult.UpdateMatrix(matrix);
             return matrixResult;
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.Message, "Error!", MessageBoxButton.OK);
             return null;
         }
     }
 }
Пример #2
0
 public override Result.Result EvaluateResult()
 {
     MatrixLibrary.Matrix bMatrix;
     switch (this.Mode)
     {
         case OperatonMode.La:
             bMatrix = Matrices[0].MatrixView.Matrix;
             break;
         case OperatonMode.Lb:
             bMatrix = Matrices[1].MatrixView.Matrix;
             break;
         case OperatonMode.Ua:
             bMatrix = Matrices[0].MatrixView.Matrix;
             break;
         case OperatonMode.Ub:
             bMatrix = Matrices[1].MatrixView.Matrix;
             break;
         default:
             bMatrix = Matrices[0].MatrixView.Matrix;
             break;
     }
     try
     {
         MatrixLibrary.Matrix lMatrix;
         MatrixLibrary.Matrix uMatrix;
         MatrixLibrary.Matrix pMatrix;
         MatrixLibrary.Matrix.LU(bMatrix, out lMatrix, out uMatrix, out pMatrix);
         switch (this.Mode)
         {
             case OperatonMode.La:
                 Result.Result resultla = new Result.Result(lMatrix.NoCols, lMatrix.NoRows, false);
                 resultla.UpdateMatrix(lMatrix);
                 return resultla;
             case OperatonMode.Lb:
                 Result.Result resultlb = new Result.Result(lMatrix.NoCols, lMatrix.NoRows, false);
                 resultlb.UpdateMatrix(lMatrix);
                 return resultlb;
             case OperatonMode.Ua:
                 Result.Result resultua = new Result.Result(uMatrix.NoCols, uMatrix.NoRows, false);
                 resultua.UpdateMatrix(uMatrix);
                 return resultua;
             case OperatonMode.Ub:
                 Result.Result resultub = new Result.Result(uMatrix.NoCols, uMatrix.NoRows, false);
                 resultub.UpdateMatrix(uMatrix);
                 return resultub;
             default:
                 Result.Result resultdla = new Result.Result(lMatrix.NoCols, lMatrix.NoRows, false);
                 resultdla.UpdateMatrix(lMatrix);
                 return resultdla;
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Error!", MessageBoxButton.OK);
         return null;
     }
 }
Пример #3
0
 public override Result.Result EvaluateResult()
 {
     try
     {
         MatrixLibrary.Matrix matrix = MatrixLibrary.Matrix.Add(Matrices[0].MatrixView.Matrix, Matrices[1].MatrixView.Matrix);
         Result.Result matrixResult = new Result.Result(matrix.NoCols, matrix.NoRows, false);
         matrixResult.UpdateMatrix(matrix);
         return matrixResult;
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Error!", MessageBoxButton.OK);
         return null;
     }
 }
Пример #4
0
 public override Result.Result EvaluateResult()
 {
     if (this.Mode.Equals(OperatonMode.A))
     {
         try
         {
             MatrixLibrary.Matrix eMatrix;
             MatrixLibrary.Matrix vMatrix;
             MatrixLibrary.Matrix.Eigen(Matrices[0].MatrixView.Matrix, out eMatrix, out vMatrix);
             Result.Result result = new Result.Result(eMatrix.NoCols, eMatrix.NoRows, false);
             result.UpdateMatrix(eMatrix);
             return result;
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.Message, "Error!", MessageBoxButton.OK);
             return null;
         }
     }
     else
     {
         try
         {
             MatrixLibrary.Matrix eMatrix;
             MatrixLibrary.Matrix vMatrix;
             MatrixLibrary.Matrix.Eigen(Matrices[1].MatrixView.Matrix, out eMatrix, out vMatrix);
             Result.Result result = new Result.Result(eMatrix.NoCols, eMatrix.NoRows, false);
             result.UpdateMatrix(eMatrix);
             return result;
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.Message, "Error!", MessageBoxButton.OK);
             return null;
         }
     }
 }