lua: provide offset_to_multi_index() and multi_index_to_offset()

These functions work identically to their C++ counterparts from
utility/multi_index.hpp and provide a mapping from a multi dimensional
index into an offset and vice versa.
lua/numeric: add numeric.diag() to return diagonal elements in a matrix