MonteCarloAlgorithm.BitString
- class MonteCarloAlgorithm.BitString(string)[source]
Simple class to implement a string of bits
Methods
__init__(string)creats an np array of bits :Parameters: string an int array of 1 and 0
flip(index)flip a bit at specified index :Parameters: index
int()- rtype:
decimal representation of bitstring
off()how many of the bits are 0s
on()- rtype:
how many of the bits are 1s
set_int(decimal[, digits])sets the bitstring using decimal representation input :Parameters: * decimal int number * digits how long the bitstring should be
set_string(string)change the bitstrings string :Parameters: string new np array