First checkin of the AutoDistMatrix attempt. Compiles, not tested.