adding matrix index