optimizations for trmm