Exercise 09 - hash tables, vector multiplication

Following are the steps mentioned in the exercise. Doubts are in bold.

  • First multiply your vector v , with a corresponding plane. This will give you a vector of dimension (1,N_planes)(1,N_planes). looks like multiplied on all planes ?
  • You will then convert every element in that vector to 0 or 1.
  • You create a hash vector by doing the following: if the element is negative, it becomes a 0, otherwise you change it to a 1.
  • You then compute the unique number for the vector by iterating over N_PLANES Why iterating again? This is already done in the first step right ?
  • Then you multiply 2𝑖2i times the corresponding bit (0 or 1).
  • You will then store that sum in the variable hash_value .

Hi salih-g,

Yes, vector v is multiplied with all the normal vectors of the planes. This is necessary to be able to calculate the resulting hash bucket as explained subsequently.

The iteration is done over the range N-PLANES (i.e. in this case it is range(10)). This way the bucket number can be calculated using the formula for hash that follows.

I hope this clarifies.