Iterate through the elements of the matrix and compare each against a reference value and if necessary update the reference value.