begin doc for matrix