Use mat_apply to compute tau instead of saxpys.

This PR simply replaces a bunch of `saxpy` calls with one `mat_apply` call.