[R] on how to make a skip-table
gildororonar at mail-on.us
gildororonar at mail-on.us
Wed Sep 18 04:09:32 CEST 2013
Quoting "Zhang Weiwu" <zhangweiwu at realss.com>:
> Jim Holtman asked me to elaborate the problem:
>
> It is a common problem in reading sparse variable-lenght record data
> file. Records are stored in file one next to another. The length of
> each record is known in advance, but a lot of them records are invalid,
> and should be skipped to make efficient use of memory.
>
> Ideally the datafile-reading routine should receive a skip-table. Before
> reading each wanted/valid record, it seeks forward for the distance
> given in the skip-table. The problem is how to obtain such a skip table.
Ideally, in C, yes, you need to calculate the steps, because you use a
pointer.
Jim Holtman asks what you intend to do, I guess because he sees the
problem may a different solution in R.
What you need is not a skip-table, but a offset table, and you skip
from the begining to the offset directly, not from the previous
position.
e.g. instead of skip-1, skip-3, skip-5, skip-7
you should do: offset-1, offset-4, offset-9, offset-15
Consider the skip-table is about the reverse of cumsum, and is harder
to achieve, you should start with offset-table.
-------------------------------------------------
VFEmail.net - http://www.vfemail.net
$24.95 ONETIME Lifetime accounts with Privacy Features!
15GB disk! No bandwidth quotas!
Commercial and Bulk Mail Options!
More information about the R-help
mailing list