this code is matrix operation