finish matrix operation