added bitvector_decimal

This commit is contained in:
Jiri Pittner 2022-07-01 14:15:44 +02:00
parent b63373fe7b
commit 31858216be
1 changed files with 7 additions and 0 deletions

View File

@ -110,6 +110,13 @@ for(int i=0; i<nbits; ++i)
return b;
}
template <typename T>
void bitvector_decimal(T &x, const bitvector &b)
{
x=0;
for(int i=0; i<b.size(); ++i) if(b[i]) x += 1./(1ULL<<i);
}
template <typename T>
void bitvector_compress(bitvector &r, const NRVec<T> &v)