routines for trtri