Square Matrix Permutation

I have a set of items of size N. The items are sorted by probability. A square matrix m[N][N] of those items, in C style memory organization, would have elements with similar probabilities spread out. For example m[0][100] will be very far from m[100][0] and all others with similar probability. I need to permutate the elements in a simple way so the more likely ones tend to be closer to 0. It doesn't need to be a square matrix, it can be a vector [N*N]. And it doesn't need to be perfect, just good enough that elements with similar probability are somewhat grouped together. I'm looking for a function f(i,j) to give the position on the permutated matrix/vector. If possible with very simple operations (e.g. no squares and division but programatic conditionals are OK) For a more graphical reference, I'm looking for something like this. [From BBC's The Story of Maths on Cantor's argument] ![alt text][1] But it doesn't need to be exactly that permutation. Just that the elements walked on the diagonals are mostly grouped nearby. Well, I know this is probably something very simple but it's been many years since school/uni and Wolframalpha isn't helping. Thanks! [1]: http://i.stack.imgur.com/4SXFQ.png
Are you looking for space filling curves? en.wikipedia.org/wiki/Space-filling_curve

以上就是Square Matrix Permutation的详细内容,更多请关注web前端其它相关文章!

赞(0) 打赏
未经允许不得转载:web前端首页 » CSS3 答疑

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

前端开发相关广告投放 更专业 更精准