Changed the condition

This statement checks if inverse calculated and matrix did not change