restor matrix generalization