-
4 Comments
what does the dist function do?
'dist' just computes the euclidean distance between two lists of vectors (the dimensionality size(dist(a,b)) is the same as size(a*b)). In this case ~dist(a',a+s) is just the same as bsxfun(@eq,a',a+s), the matrix defining a directional graph of the elements of 'a' with distance 's'.
just for completion: the matrix above is nilpotent (with degree lower than the length of the vector a), if you sum all of its powers D=sum_n{C^n} (and this is what polyvalm does) you get a matrix where d(i,j)=1 if i is connected to j in this graph; it you then take the largets column sum of the result (this is what norm(D,1) does) you get the maximum length of a sequence with stride s (across all possible starting nodes in a)...
I am impressed.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!