"""Generating basis hypervectors using 'sandwich' initialization.
Generating numVectors vectors using so called 'sandwich' initialization. This means that every two neighbouring vectors have half of the vector the same, but the rest of the vector is random. In this vector are only similar (50%) with neighbouring vectors but not with the ones further.
Args:
numVectors: Number of vectors to be generated.
HDdim: Dimensionsionality of hypervectors.
Returns:
Generated numVectors hypervectors using 'sandwich' initialization.
"""Generating basis hypervectors using 'scale' initialization with randomly chosen flipped bits.
Generating numVectors vectors using so called 'scale' or 'level' initialization, so that distance in values vectors will represent is mapped to similarity between those vectors.
Every subsequent vector is created by randomly flipping HDdim/(numVectors*scaleFact) elements.
Args:
numVectors: Number of vectors to be generated.
HDdim: Dimensionsionality of hypervectors.
scaleFact: Determines how many vectors is changed between neighbouring vectors, if 1 then every time HDdim/numVectors bits are flipped
Returns:
Generated numVectors hypervectors using 'scale' initialization.
"""Generating basis hypervectors using 'scale' initialization with calefully chosen flipped bits.
Generating numVectors vectors using so called 'scale' or 'level' initialization, so that distance in values vectors will represent is mapped to similarity between those vectors.
Every subsequent vector is created by flipping next HDdim/(numVectors*scaleFact) elements, e.g. from i-th to i+d bit and not randomly choosing bits to flip.
Args:
numVectors: Number of vectors to be generated.
HDdim: Dimensionsionality of hypervectors.
scaleFact: Determines how many vectors is changed between neighbouring vectors, if 1 then every time HDdim/numVectors bits are flipped
Returns:
Generated numVectors hypervectors using 'scale' initialization.
"""
#calculate how many bits will be flipped for each next vector
"""Generating basis hypervectors using radius limited 'scale' initialization.
Generating numVectors vectors using so called 'scale' or 'level' initialization, but only for vectors that are closer then 'radius' distance. This way vectors closer than 'radius' are similar proportionally to their distance (the furthr they are less similar are vectors), but after 'radius' they are orthogonal.
This is useful in case we need to generate many vectors, so that they wouldn't be all too similar (because num bits to flip between neighbouring ones would be too small percentage).
Args:
numVectors: Number of vectors to be generated.
HDdim: Dimensionsionality of hypervectors.
radius: After what distance vectors are not longer similar proportionally to distance, but orthogonal
Returns:
Generated numVectors hypervectors using 'scale' with 'radius' initialization.
"""
#calculate number of completly random vectors - every radius-th vector, called axes vectors
numAxes=int(math.ceil(numVectors/radius)+1)
#calculate how many bits to flip for those that are in 'radius' distance and generated using 'scale' approach