Function lupnt::Max

Function Documentation

Real lupnt::Max(Real x, Real y)

Return the larger of two autodiff scalars, comparing by underlying value (.val()) and returning the corresponding Real (preserving its derivative information).

Used e.g. by environment/forces.cc to clamp an intermediate quantity to be non-negative before taking its square root (sqrt(Max(y2, 0.0))).

Parameters:
  • x – First value

  • y – Second value

Returns:

x if x.val() > y.val(), else y