Add matrix state utility.