Use typed memoryviews for Cython arrays.

Convert the "old-style" syntax for converting Numpy arrays
to Cython / C arrays to use memoryviews instead. (See
http://docs.cython.org/src/userguide/memoryviews.html for
more information.) This cleans the code and, in some cases,
can improve performance.

Update the setup script as well.