Subject:
|
Bitstring vector to list conversion in Perl5
|
Newsgroups:
|
lugnet.off-topic.geek
|
Date:
|
Wed, 3 Jan 2001 17:45:17 GMT
|
Viewed:
|
79 times
|
| |
| |
Anyone know of a super-efficient way in Perl5 to convert a sparse bitstring
vector to a list of integer-offset values (just the 1-bits) in Perl5?
That is, if you had some $v that was created like so:
my $v;
my @n = (...some sorted sparse list of positive integer values...);
foreach (@n) { vec($v,$_,1) = 1; }
then what's the fastest way to regenerate @n later given $v ? Bitstring
vectors can be |'d, &'d, and ^'d super-efficiently in Perl5, but I don't know
the most efficient way to treat them as sparse lists -- i.e., looping over
just the bits that are set and ignoring the bits that aren't set.
--Todd
|
|
Message has 1 Reply:
3 Messages in This Thread:
- Entire Thread on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
|
|
|
|