Feature/shareable indexing

Also, we could write composePackInner to call this with an identity matrix m as the last argument, just to  consolidate.