added a conversion of a general index to a flat index, plus some variable size calculation stuff in preparation for creation of the distributed vectors