Hi, Teryl,

The way to iterate through all the 1s in a bitvector is to use 
ibis::bitvector::indexSet class.  It behaviors like an iterator and 
ibis::bitvector::firstIndexSet is like the function 
std::vector::begin.  There are a number of places this is used in 
various class, you might take a look at function 
ibis::query::getHitRows in file query.cpp.

The active word is used in ibis::bitvector is used to store the last 
few bits that is not a multiple of 31.  For example, if the bitmap 
contains 100 bits, 93 of them can fit in regular words, but the 7 
leftover bits have to go into the active word.  Furthermore, we have 
to record that there was 7 bits in the active word.  Altogether there 
are two values in the class ibis::bitvector::active_word, val and nbits.

Hope this helps.

John



On 10/21/2010 1:15 PM, Teryl Taylor wrote:
> Hi John,
>
> Thanks a lot, it worked.  I just had two quick followup questions.
> First is, what is the most efficient way to iterate through the bit
> vector to find the "1's" and their locations (index) within the vector?
>
> Second, what is an active word?
>
>
> Regards,
>
> Teryl
>
>
> On Tue, Oct 19, 2010 at 8:27 PM, K. John Wu <[email protected]
> <mailto:[email protected]>> wrote:
>
>     Yes, there is a write function that take a
>     ibis::array_t<ibis::bitvector::word_t> argument.  This function
>     writes the m_vec out to the argument (along with one or two more
>     words depending on how many bits are used in the active word).
>
>     John
>
>     PS: If the active word is not used, a word with the value 0 is
>     appended after m_vec.  If the active word has some bits actually
>     used, then both active::val and active::nbits are appended after
>     m_vec.
>
>
>
>
>     On 10/19/2010 5:22 PM, Teryl Taylor wrote:
>
>         Hi John,
>
>         Thanks for getting back to me.  Yes, I want to get the m_vec data.
>           Just wanted to see if there was a way to get it without
>         modifying
>         your code.  How do you write out a serialized version?  Do you
>         just
>         use the bitvector write method?
>
>         Thanks,
>
>         Teryl
>
>
>         On Tue, Oct 19, 2010 at 7:13 PM, K. John Wu <[email protected]
>         <mailto:[email protected]>
>         <mailto:[email protected] <mailto:[email protected]>>> wrote:
>
>             Hi, Teryl,
>
>             Interesting question.  Guess depending what you intended to do
>             there are different ways of get access to the actual data.
>
>             One thing is to write the serialized version of the
>         bitvector to
>             an ibis::array_t<ibis::bitvector::word_t> object.
>
>             Another possibility is to simply modify the definition to give
>             yourself access the private member variable m_vec.
>
>             Of course, I could have complete misunderstood your question..
>
>             John
>
>
>
>             On 10/19/2010 3:25 PM, Teryl Taylor wrote:
>
>                 Hi all,
>
>                 I'm playing around with the ibis::bitvector class and
>         I want
>                 to get
>                 access to the underlying buffer for storage.   Is there an
>                 easy way to
>                 do this?   I can't seem to find a public method which
>         gives
>                 access to
>                 the underlying array.
>
>                 Regards,
>
>                 Teryl
>
>
>
>                 _______________________________________________
>                 FastBit-users mailing list
>         [email protected]
>         <mailto:[email protected]>
>         <mailto:[email protected]
>         <mailto:[email protected]>>
>
>         https://hpcrdm.lbl.gov/cgi-bin/mailman/listinfo/fastbit-users
>
>
>
_______________________________________________
FastBit-users mailing list
[email protected]
https://hpcrdm.lbl.gov/cgi-bin/mailman/listinfo/fastbit-users

Reply via email to