regularized max function