added matrix-vector and vector-matrix multiplications