bitstring Questions
2
Solved
Please how can we efficiently calculate the hamming-weight of a bit-string in elixir?
Example: 0b0101101001 has a Hamming-weight of 5 (i.e. 5 bits set)
My Attempt:
iex> Enum.count(Integer.to_...
Dynamometer asked 2/12, 2015 at 17:42
4
Solved
How do I get pandas to append an integer and keep the integer data type? I realize I can df.test.astype(int) to the entire column after I have put in the data but if I can do it at the time I'm app...
5
Solved
Is there a shortcut to Convert binary (0|1) numpy array to integer or binary-string ?
F.e.
b = np.array([0,0,0,0,0,1,0,1])
=> b is 5
np.packbits(b)
works but only for 8 bit values ..if the...
3
Solved
I have a pandas Dataframe containing 1 columns which contains a string of bits eg.'100100101'. i want to convert this string into an numpy array.
How can I do that?
EDIT:
Using
features = df.bi...
5
Solved
Is there a way to split a bitstring loaded from a file on newlines? I have something like this:
A line of text
Additional line of text
And another line
And I want an array like this:
["A line o...
2
Solved
In the Erlang shell, I can do the following:
A = 300.
300
<<A:32>>.
<<0, 0, 1, 44>>
But when I try the following:
B = term_to_binary({300}).
<<131,104,1,98,0,0,...
Mcleroy asked 30/5, 2012 at 17:8
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
9
Solved
Given a MATLAB uint32 to be interpreted as a bit string, what is an efficient and concise way of counting how many nonzero bits are in the string?
I have a working, naive approach which loops ove...
Bost asked 21/6, 2009 at 22:40
3
Solved
Does Elixir have a function that accepts integers and floats and converts them to strings?
I need something like this:
a = 3
b = 3.14
number_to_binary(a)
% => "3"
number_to_binary(b)
% => "...
2
Solved
I have a 160 chars bit string and I need to have an integer array that stores the position of the bits that have a value of 1.
Example:
bitstring = '00110101'
array = [3,4,6,8]
Is it possible t...
Drool asked 25/4, 2013 at 18:0
1
Solved
How do you concatenate bitstrings. I mean bitstrings because I do not know the number of bytes to be a multiple of 8.
A = <<3:2>>
B = <<1:1>>
C = <<15:4>>
Solu...
Grus asked 9/6, 2012 at 18:6
2
Solved
I want to read as many 24 bit chunks as possible from a file.
How can I do this using bitstrings' ConstBitStream
when I don't now how many chunks there are?
Currently I do this:
eventList = Const...
3
Solved
I'm writing a simulation in Matlab.
I will eventually run this simulation hundreds of times.
In each simulation run, there are millions of simulation cycles.
In each of these cycles, I calculate a ...
Contumelious asked 14/2, 2012 at 21:1
2
Solved
I'm writing code to decode messages from a binary protocol. Each message type is assigned a 1 byte type identifier and each message carries this type id. Messages all start with a common header con...
Collotype asked 28/4, 2011 at 2:26
1
© 2022 - 2025 — McMap. All rights reserved.