Calculate the index of the maximum element in a Matrix.
This function identifies the index of the maximum element in a matrix.