s-news
[Top] [All Lists]

convert rows of 0's/1's to binary, xor

To: s-news@lists.biostat.wustl.edu
Subject: convert rows of 0's/1's to binary, xor
From: "Knut M. Wittkowski" <kmw@rockefeller.edu>
Date: Sat, 24 May 2003 18:40:46 -0400
I have HUGE matrices containing only 0's and 1's and I would like to convert each row to a string, so that each element takes only one bit, rather than four bytes = 32 bits. (Yes, with matrices of a couple of million elements, space can be important.)

- is there a conversion routine

        Str <- BinToStr(c(0,1,0,0,0,0,0,1))
        Chr <- "A"

  so that?

        Str == Chr

- are there logical routines so that

        AAA <- BinToStr(c(0,1,0,0,0,0,0,1))
        One <- BinToStr(c(0,0,1,1,0,0,0,1))

        BinAND(AAA,One) == BinToStr(c(0,0,0,0,0,0,0,1))

        BinAny(BinAND(AAA,One)) == T

Of course, this should not be limited to a single byte at a time.


Knut M. Wittkowski, PhD,DSc
------------------------------------------
The Rockefeller University, GCRC
1230 York Ave #121B, Box 322, NY,NY 10021
+1(212)327-7175, +1(212)327-8450 (Fax)
kmw@rockefeller.edu
http://www.rucares.org/statist/


<Prev in Thread] Current Thread [Next in Thread>
  • convert rows of 0's/1's to binary, xor, Knut M. Wittkowski <=