encodeLinear: encodeLinear

Description Usage Arguments Value See Also Examples

View source: R/RcppExports.R

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

1
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

1
2
3
4
5
6
7
8
## 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)

RMSNumpress documentation built on Feb. 5, 2021, 1:07 a.m.