encodeLinear {RMSNumpress}R Documentation

encodeLinear

Description

Encodes the doubles in data by first using a
- lossy conversion to a 4 byte 5 decimal fixed point representation
- storing the residuals from a linear prediction after first two values
- encoding by encodeInt (see above)

The resulting binary is maximally 8 + dataSize * 5 bytes, but much less if the data is reasonably smooth on the first order.

This encoding is suitable for typical m/z or retention time binary arrays. On a test set, the encoding was empirically show to be accurate to at least 0.002 ppm.

Usage

encodeLinear(data, fixedPoint)

Arguments

data

pointer to array of double to be encoded (need memorycont. repr.)

fixedPoint

the scaling factor used for getting the fixed point repr. This is stored in the binary and automatically extracted on decoding (see optimalLinearFixedPoint or optimalLinearFixedPointMass)

Value

the number of encoded bytes

See Also

[decodeLinear]

Examples

## Not run: 
## Retention time array
rt_array <- c(4313.0, 4316.4, 4319.8, 4323.2, 4326.6, 4330.1)
## encode retention time array
rt_encoded <- encodeLinear(rt_array, 500)
#> [1] 40 7f 40 00 00 00 00 00 d4 e7 20 00 78 ee 20 00 88 86 23

## End(Not run)

[Package RMSNumpress version 1.0.1 Index]