math: fix declarations regarding matrix diagonals