Fully templated draft of feature_distance
Feature Distance working, fix shuffle_data, comment code

Noticed a bug with data_layer in CPU mode (malloc fails), fix it