ENH: spatial: use arrays' dotfunc in pdist(metric='cosine')

Suggested by @jaimefrio.