From ligges at statistik.tu-dortmund.de  Sat Oct  8 15:51:07 2011
From: ligges at statistik.tu-dortmund.de (Uwe Ligges)
Date: Sat, 08 Oct 2011 15:51:07 +0200
Subject: [Rd] BitSet equivalent? Java code usable?
In-Reply-To: <r02010500-1068-F3AA0DA8F10511E097AB0017F2F04CA2@[192.168.0.5]>
References: <r02010500-1068-F3AA0DA8F10511E097AB0017F2F04CA2@[192.168.0.5]>
Message-ID: <4E90554B.1060500@statistik.tu-dortmund.de>



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



[Rd] BitSet equivalent? Java code usable?
Uwe Ligges