added trs matrix functions