Diagonalization and Trigonalization of an endomorphism in finite dimension