optimized matrix multiplication. added verification of rotation matrix