bitarray Questions
2
Solved
I am working on a Python library that performs a lot of bitwise operations on long bit strings, and I want to find a bit string type that will maximize its speed. I have tried the built-in Python i...
Machellemachete asked 6/6, 2015 at 5:7
5
I want to create a very large array on which I write '0's and '1's. I'm trying to simulate a physical process called random sequential adsorption, where units of length 2, dimers, are deposited ont...
Tutorial asked 26/3, 2010 at 17:26
1
Solved
I was writing a function for boolean 2d arrays:
function foo(A::Array{Bool,2})
...
end
Evaluating and testing it with
A = randbool(3,3)
foo(A)
returns
ERROR: 'foo' has no method matching fo...
1
Solved
I have an int array of bits (length always 64) like:
1110000100000110111001000001110010011000110011111100001011100100
and I want to write it in one Int64 (or ulong?) variable. How to do it?
I tr...
Neurotic asked 4/4, 2015 at 11:33
4
Solved
I need something a little more than the System.Collections.BitArray class in my application. Specifically, I need the bit array:
To be immutable
To implement equality using value semantics
I cr...
3
Solved
I'm designing a bloom filter and I'm wondering what the most performant bit array implementation is in Python.
The nice thing about Python is that it can handle arbitrary length integers out of th...
Dardan asked 30/12, 2013 at 18:58
4
Solved
Yet another synthetic benchmark: Sieve of Eratosthenes
C++
#include <vector>
#include <cmath>
void find_primes(int n, std::vector<int>& out)
{
std::vector<bool> is_p...
Tweet asked 6/2, 2013 at 14:32
3
Solved
What is the smartest way to load a string like "10101011101010" directly into a new bit array? (not a byte array)
(The bits should remain in the same order as in the list.)
2
Solved
I'm looking for a very compact way of storing a dense variable length bitarray in Java. Right now, I'm using BitSet, but it seems to use on average 1.5*n bits of storage space for a bit vector of s...
Baalbek asked 19/1, 2010 at 3:54
5
Solved
iOS / Objective-C: I have a large array of boolean values.
This is an inefficient way to store these values – at least eight bits are used for each element when only one is needed.
How can I opt...
Conlon asked 19/9, 2010 at 2:29
3
Solved
Is there some reasonably fast code out there which can help me quickly search a large bitmap (a few megabytes) for runs of contiguous zero or one bits?
By "reasonably fast" I mean something that c...
1
Solved
I need to keep track of around 10000 elements of an array in my algorithm .So for this I need boolean for each record.If I used char array to keep track of 10000 arrays (as 0/1),it would take up lo...
3
Solved
This code:
BitArray bits = new BitArray(new byte[] { 7 });
foreach (bool bit in bits)
{
Console.WriteLine(bit ? 1 : 0);
}
Gives me the following output:
11100000
Shouldn't it be the other wa...
Derzon asked 30/1, 2012 at 16:4
3
Solved
Is there a BitArray alternative for the .NET Micro Framework?
I was thinking about simply using a bool[], but how can you convert it back
into a byte[] ?
In the full framework, considering "bits" ...
Conchiferous asked 5/11, 2010 at 14:53
3
Solved
Given a file looks like this:
1440927 1
1727557 3
1440927 2
9917156 4
The first field is an ID which is in range(0, 200000000). The second field represents a type , which is in range(1, 5). And ...
Odrick asked 6/12, 2011 at 9:36
6
Solved
I have a System.Collections.BitArray array (~3000 items) and I would like to shift all the bits to the left by 1. However the collection doesn't seem to support that operation (i.e. bitArray <&l...
2
Solved
I'm writing a large bitarray to a file using this code:
import bitarray
bits = bitarray.bitarray(bin='0000011111') #just an example
with open('somefile.bin', 'wb') as fh:
bits.tofile(fh)
Howev...
1
Solved
After struggling to make the .NET BitArray class work for my needs, I decided to look for a more robust open-source or commerical one on the web. To my surprise, I can't find a single one. I ...
5
Solved
3
I created the following function which will do as requested (convert HEX string to BitArray). I am not sure about the efficiency of the function, but my main problem now is that the Convert.ToInt64...
Niven asked 24/11, 2010 at 17:34
4
Imagine you wanted to serialize and deserialize stackoverflow posts including their tags as space efficiently as possible (in binary), but also for performance when doing tag lookups. Is there a go...
Glennisglennon asked 23/11, 2010 at 8:55
6
I've got a special need and the most important concerns are:
in-memory
very low memory footprint
speed
Here's my "problem": I need to store, in-memory, a huge number of very sparse bit arrays. ...
Greenlaw asked 1/11, 2010 at 23:26
4
Solved
I've had to do this many times in the past, and I've never been satisfied with the results.
Can anyone suggest a fast way of copying a contiguous bit array from source to destination where both th...
© 2022 - 2024 — McMap. All rights reserved.