Added index matrix computation for max and min methods of matrix