Implementation of basic computation routines (Close #67).

This addresses #67.

I will merge this tomorrow if there is no objection. This is the small set of functions that I find I commonly in need of when writing statistics or machine learning codes.