update matrix method