SHARE
TWEET

Untitled

a guest Sep 22nd, 2019 94 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  private double CalculateMinor(int i, int j)
  2.         {
  3.             return CreateMatrixWithoutColumn(j)
  4.                 .CreateMatrixWithoutRow(i)
  5.                 .CalculateDeterminant();
  6.         }
  7.  
  8.         public Matrix CreateInvertibleMatrix()
  9.         {
  10.             if (this.rows != this.cols)
  11.                 return null;
  12.             var determinant = CalculateDeterminant();
  13.             if (Math.Abs(determinant) < 0.0000001)
  14.                 return null;
  15.  
  16.             var result = new Matrix(rows, cols);
  17.             ProcessFunctionOverData((i, j) =>
  18.             {
  19.                 result[i, j] = ((i + j) % 2 == 1 ? -1 : 1) *
  20.                     CalculateMinor(i, j) / determinant;
  21.             });
  22.  
  23.             result = result.Transpose();
  24.             return result;
  25.         }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top