/// <summary> /// Inverts this matrix. /// </summary> /// <exception cref="Vertesaur.NoInverseException">An inverse requires a valid non-zero finite determinant.</exception> public void Invert() { var result = new Matrix4(); Contract.Assume(result.IsIdentity); if (SquareMatrixOperations.GaussJordanEliminationDestructive(Clone(), result)) { CopyFrom(result); } else { throw new NoInverseException(); } }
/// <summary> /// Generates a matrix which is the inverse. /// </summary> /// <returns>The inverse of the matrix.</returns> /// <exception cref="Vertesaur.NoInverseException">An inverse requires a valid non-zero finite determinant.</exception> public Matrix4 GetInverse() { Contract.Ensures(Contract.Result <Matrix4>() != null); var result = new Matrix4(); Contract.Assume(result.IsIdentity); if (SquareMatrixOperations.GaussJordanEliminationDestructive(Clone(), result)) { return(result); } else { throw new NoInverseException(); } }
/// <summary> /// Calculates the determinant of the matrix. /// </summary> /// <returns>The determinant.</returns> public double CalculateDeterminant() { return(SquareMatrixOperations.CalculateDeterminantDestructive(Clone())); }