a few more (hopeful) speed ups to the code; it turns out that there was a lot of unnecessary multiplication and division that all could be stored in the swwmat