Added pattern recognition material
Added new pairwise distance method, not sure if it is actually faster.