[SPARK-2359][MLlib] Correlations

Implementation for Pearson and Spearman's correlation.
RangePartitioner should be fine since getPartition works on distinct keys (so like you said, duplicate values are assigned to the same partition). As with many other things, we could just add a warning in the docs saying that if there's too many duplicates, use with caution.
On a related note, do you know how to detect if the item is the last when you're using flatMap on an iterator?