Yes. If you have non-overlapping inputs, you can simply call
appendFill one after another.
John
On 9/27/12 9:57 AM, Olson, Andrew wrote:
> Ah! That's perfect. And for sorted non-overlapping inputs (separated by
> gap_length 0's), I can just bm.appendFill(0, gap_length); bm.appendFill(1,
> length); and be done (no OR-ing), right?
> Thanks,
> Andrew
>
> On Sep 27, 2012, at 12:23 PM, K. John Wu wrote:
>
>> Hi, Andrew,
>>
>> The statement "ibis::bitvector bv(from,from+length);" could be
>> implemented as follows
>>
>> ibis::bitvector bm;
>> bm.appendFill(0, from);
>> bm.appendFill(1, length);
>> bm.adjustSize(0, max); // bm to represent a total of max bits
>>
>>
>>
>> On 9/27/12 8:16 AM, Olson, Andrew wrote:
>>> I've used ibis::bitvector::setBit() to set individual bits in a
>>> (compressed) bitvector, but I'd like to build a bitvector corresponding to
>>> a set of continuous ranges. Is there a convenient way to do this already?
>>> I was thinking of creating a bitvector for each continuous range and OR-ing
>>> them together as follows:
>>>
>>> ibis::bitvector mask;
>>>
>>> int intervals = 10000;
>>> int min_span = 100;
>>> int max_span = 10000 - min_span;
>>> int max=100000000;
>>>
>>> for (int i=0; i<intervals; i++) {
>>> int from = rand() % max;
>>> int length = rand() % max_span + min_span;
>>> ibis::bitvector bv(from,from+length); // the constructor I'm looking for
>>> mask |= bv;
>>> }
>>>
>>> In practice, the list of intervals could be sorted by start position and
>>> would usually be non-overlapping. Would this make the OR-ing faster?
>>>
>>> Andrew
>>> _______________________________________________
>>> FastBit-users mailing list
>>> [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
>
_______________________________________________
FastBit-users mailing list
[email protected]
https://hpcrdm.lbl.gov/cgi-bin/mailman/listinfo/fastbit-users