So I’m trying to build a pretty bare minimum implementation of the RDSE to play with. This is how I learn best. I’ve been working from the videos and papers online to get the encoding of a single value into a bitarray. That part works great, code below:
class Encoding_Layer(): def __init__(self, min_val, max_val, buckets, active_bits): self.min_val = min_val self.max_val = max_val self.buckets = buckets self.active_bits = active_bits self.total_bits = buckets + active_bits - 1 self.range = max_val - min_val self.bitarray = bitarray(self.total_bits) def encode_value(self, value): self.bitarray.setall(False) i = math.floor(self.buckets * (value - self.min_val) / self.range) count = 0 for x in range(self.active_bits): self.bitarray[i + count] = True count += 1
Now I’ve got my output as a nice pretty bitarray, but I’m having trouble understanding how to implement the hash function to map the indices of the array to a new output array. Hoping someone can help me understand how this one is supposed to work. If you can provide a (simple) Python example that would
work with my current code, that would be extremely helpful.