Add support for dtype kwarg in reduce functions.

This should be merged after PR #172.