Renamed diag() to diagonal().
Fixed compiler error in min() and max().