Move reduction functions to math namespace