[Rd] BitSet equivalent? Java code usable?

Uwe Ligges ligges at statistik.tu-dortmund.de
Sat Oct 8 15:51:07 CEST 2011



On 07.10.2011 19:01, Joachim Harloff wrote:
> Hi all,
>
> I consider writing a R package on statistics for the sorting method as a hobby. I have written a private Java application that I could use as a basis. Therefore I'd like to ask two questions:
>
> 1) logical vectors: Bit storage (small) and capable of bit operations?
> The Java application relies on BitSet(s) for efficiency reasons. Arrays of logical values cost far too much memory (in the 2nd level heap etc.) while chunks of BitSets easily fit into the first processor cache. Moreover the Bit operations or, xor, and, andnot, cardinality, clone, flip, equals, intersects are much faster done for BitSets than equivalent functions written for logical arrays. Is there any equivalent for BitSet in R? The vector type "logical" seems to be not equally powerful and I do not know its memory requirements. In BitSets a Bit requires just one Bit, no more.

Logical values in R do have at least 3 values: TRUE, FALSE and NA, hence 
cannot be implemented in one bit.


> 2) Can Java code be used?
> Can I use some Java code for a R package (without translating it first to C. This is not always simple)? Probably this sounds ugly but it would greatly simplify the task for me.

See the rJava package.

Best,
Uwe Ligges


>
> Regards,
> Joachim Harloff
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel



More information about the R-devel mailing list