[Matrix.cs] fix trnsformation to triangular form
refactoring