Still not answering your memory mapped file problem,  but you might
also look at the thread which I restarted on 17/4/07 under the heading
Re: [Jprogramming] maximum running sum - understanding scan revisited

My verb was almost identical to yours, using "@" rather than "@:" - the
latter seems slightly faster in this case.  (Later correspondence 3/July/07
showed that it was best to prepend 0 so that we eventually had
           >./@(- <./\)@(0 , +/\)          NB. )

Like you, I proposed a K function
as well as an APL version.   I had a vain thought that this was original,
but had to allow that someone had beaten us to it, as described in
http://ostermiller.org/calc/sum.html

As Eugene says, don't we have fun.

Mike

Edushka S. wrote:
On 11/1/07, Eugene McDonnell <[EMAIL PROTECTED]> wrote:
Your mcs has the same number of tokens as my mis in "Maximum Infix
Sums" in Vector 15.2, October 1998:

     mis = ;[: >./ [: (0: >. +)/\. 0 ,~ ]
    mis in
11

There is a family resemblance.

I credit the work I did as having derived from a K solution written by
Arthur Whitney:

     f : { | 0 (0 | +) \ x}

I used Arthur's example as a starting point as well. Unfortunately I
cannot get Vector 15.2 issue since it isn't available online, is it?
But I agree that our solutions looks very similar (the same algorithm
anyway) although mine appears to run 10 times faster (I modified your
definition to eliminate output of input sequence):

mis =. [: >./ [: (0: >. +)/\. 0 ,~ ]
mcs=:>./@:(-<./\)@:(0:,+/\)
in2=:5e3-?1e6$1e4
   mis in2
2599630
   mcs in2
2599630
   6!:2 'mis in2'
0.602303
   6!:2 'mcs in2'
0.056926

PS As a matter of fact, it is faster even in comparison with K's
version (though on older K 2.95 evaluation version interpreter):

f:|/0(0|+)\
in:(1000000 _draw 10000)-5000
f in
3156866
\t f in
453

But the actual question was: how to count MCS on a big memory mapped file...
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to