WIP: some Cython refactorings

Including start of review of uses of int and size_t for things that refer to
array sizes / shapes.