Move all types properly inside MATH_BEGIN/END_NAMESPACE.