update matrix calc