Trace of an endomorphism