Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

hi

Hybrid index class


Description

Class for hybrid index representation, plain and rle-packed

Usage

hi(from, to, by = 1L, maxindex = NA, vw = NULL, pack = TRUE, NAs = NULL)
## S3 method for class 'hi'
print(x, ...)
## S3 method for class 'hi'
str(object, nest.lev=0, ...)

Arguments

from

integer vector of lower sequence bounds

to

integer vector of upper sequence bounds

by

integer of stepsizes

maxindex

maximum indep position (needed for negative indices)

vw

virtual window information, see vw

pack

FALSE to suppress rle-packing

NAs

a vector of NA positions (not yet used)

x

an object of class 'hi' to be printed

object

an object of class 'hi' to be str'ed

nest.lev

current nesting level in the recursive calls to str

...

further arguments passed to the next method

Details

Class hi will represent index data either as a plain positive or negative index vector or as an rle-packed version thereof. The current implementation switches from plain index positions i to rle-packed storage of diff(i) as soon as the compression ratio is 3 or higher. Note that sequences shorter than 2 must never be packed (could cause C-side crash). Furthermore hybrid indices are guaranteed to be sorted ascending, which helps ffs access method avoiding to swap repeatedly over the same memory pages (or file positions).

Value

A list of class 'hi' with components

x

directly accessed by the C-code: the sorted index of class 'rlepack' as returned by rlepack

ix

NULL or positions to restore original order

re

logical scalar indicating if sequence was reversed from descending to ascending (in this case is.null(ix))

minindex

directly accessed by the C-code: represents the lowest positive subscript to be enumerated in case of negative subscripts

maxindex

directly accessed by the C-code: represents the highest positive subscript to be enumerated in case of negative subscripts

length

number of subscripts, whether negative or positive, not the number of selected elements

dim

NULL or dim – used by as.matrix.hi

dimorder

NULL or dimorder

symmetric

logical scalar indicating whether we have a symmetric matrix

fixdiag

logical scalar indicating whether we have a fixed diagonal (can only be true for symmetric matrices)

vw

virtual window information vw

NAs

NULL or NA positions as returned by rlepack

Note

hi defines the class structure, however usually as.hi is used to acturally Hybrid Index Preprocessing for ff

Author(s)

Jens Oehlschlägel

See Also

Examples

hi(c(1, 11, 29), c(9, 19, 21), c(1,1,-2))
  as.integer(hi(c(1, 11, 29), c(9, 19, 21), c(1,1,-2)))

ff

Memory-Efficient Storage of Large Data on Disk and Fast Access Functions

v4.0.4
GPL-2 | GPL-3 | file LICENSE
Authors
Daniel Adler [aut], Christian Gläser [aut], Oleg Nenadic [aut], Jens Oehlschlägel [aut, cre], Martijn Schuemie [aut], Walter Zucchini [aut]
Initial release
2020-10-13

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.