Update matrix class