Re: converting a R code to fortran



e p chandler wrote:


Here's my idea on solving this problem, which I suspect must be
O(N*N). Ignore the effect of duplicate values in X1 and X2. Compute
the ranks of the original entries in X1 and X2. Given the ranks,
ignore the numerical values. Consider the points in rank space, say on
a chess board with (1,1) at lower left and (N+1,N+1) at upper right.
Put the points (chess pieces) (x1(i),x2(i)) on the board. Starting at
the lower left work to the upper right either by traversing one file
at a time or by considering the boundary of an expanding square.
Compute the count of points to the left and below from those in
adjacent "kitty corner" cells. The only way a count rises is if you go
both up and right from a square which contains a piece.



If you are looking for an O(N*N) algorithm, then you need only to rank
one dimension, this is the algorithm that I gave.

.



Relevant Pages

  • Re: converting a R code to fortran
    ... from memory to the CPU registers and before you store it again to memory, ... the ranks of the original entries in X1 and X2. ... a chess board with at lower left and at upper right. ... at a time or by considering the boundary of an expanding square. ...
    (comp.lang.fortran)
  • Re: converting a R code to fortran
    ... the ranks of the original entries in X1 and X2. ... a chess board with at lower left and at upper right. ... at a time or by considering the boundary of an expanding square. ... If you are looking for an Oalgorithm, then you need only to rank ...
    (comp.lang.fortran)