Le lundi 01 décembre 2014 à 02:50 +0000, SLiZn Liu a écrit :
> I have a n by m dense matrix, and each row is a vector
> representing variating flows like stock price, and I'd like to find
> out the two vectors which have the highest similarity using cor().
> Hence, a nested for-loop was utilized to calculate the similarity
> between each pair, and fill the similarity into an n by n adjacency
> matrix.
In that case you can simply use the Distances.jl package like this:
pairwise(CorrDist(), x)
(Though this will compute correlations between columns, not rows. And
the distance is 1 - correlation.)
If you look at the code it uses by calling
edit(pairwise!)
you'll see that it relies on array views to avoid creating copies of the
columns.
Regards