refactor local transpose into header so it can be reused

also add restrict and const.
follow convention for RESTRICT
adding send-recv impls
working on 2phase
proper CPP
using fn for local; more on 2-phase