Binding Operations
Binding creates an association between two hypervectors, producing a result that is dissimilar to both inputs but from which either can be recovered.
All binding operations are available in pyhdc.components.binding.
ElementMultiplication
Used by: MAP_C, MAP_I, MAP_I_Bits, MAP_B
Element-wise product of two bipolar vectors:
For bipolar vectors (\(a_i, b_i \in \{-1, +1\}\)), multiplication is self-inverse: \((\mathbf{a} \otimes \mathbf{b}) \otimes \mathbf{b} = \mathbf{a}\).
Properties: commutative, associative, exactly self-inverse, preserves the magnitude of each element.
CircularConvolution and CircularCorrelation
Used by: HRR, HRR_NoNorm, HRR_ConstNorm
Circular convolution in the frequency domain:
where \(\mathcal{F}\) is the discrete Fourier transform and multiplication is element-wise (complex product).
Unbinding uses circular correlation:
Circular correlation is the convolution with the conjugate of the second argument, equivalent to convolving with the reversed vector.
Properties: commutative, approximate inverse (not exact because convolution is not perfectly invertible in finite dimensions), preserves magnitude of Fourier components.
ExclusiveOr (XOR)
Used by: BSC
Element-wise XOR of two binary vectors:
XOR is exactly self-inverse: \((\mathbf{a} \oplus \mathbf{b}) \oplus \mathbf{b} = \mathbf{a}\) with no approximation error.
Properties: commutative, associative, exactly self-inverse, flips exactly 50% of bits on average (for random inputs), preserving density.
Shifting and Inverse Shifting
Used by: BSDC_S, BSDC_THIN
Circular shift of the vector by one position:
Unbinding inverts the shift direction:
Repeated binding applies successive shifts: after \(k\) bindings, the result is shifted by \(k\) positions. This creates a natural positional encoding: the same vector at different depths in a bind sequence maps to different hypervectors.
SegmentShifting and SegmentInverseShifting
Used by: BSDC_SEG
Like shifting, but the circular shift is applied independently to each of several contiguous segments of the vector. This gives positional encoding within each segment independently.
AdditiveContextDependentThinning (CDT)
Used by: BSDC_CDT
CDT binding is defined by the thinning operation applied to the sum:
where thin randomly zeros bits to bring density back to the initial level.
CDT is not invertible: there is no unbind operation because the thinning destroys information needed to recover the original.
VectorDerivedTransformation (VTB)
Used by: VTB
Constructs a permutation-and-sign matrix \(\Phi(\mathbf{a})\) from the key vector \(\mathbf{a}\) and applies it to the value vector \(\mathbf{b}\):
Unbinding uses the transpose (which is the matrix inverse for orthogonal matrices):
MatrixMultiplication (MBAT)
Used by: MBAT
Generates a random matrix \(M \in \mathbb{R}^{D \times D}\) and applies it to the value vector:
The matrix \(M\) is stored in the result’s metadata. Unbinding uses the matrix inverse:
Because the matrix depends on the key \(\mathbf{a}\), the metadata must
be preserved to perform unbinding. Retrieve it with result.get_metadata().
ElementAngleAddition and ElementAngleSubtraction
Used by: FHRR
For angle-valued vectors (\(a_i \in [0, 2\pi)\)), binding is modular angle addition:
Unbinding uses element-wise angle subtraction:
Angle addition is commutative, associative, and exactly invertible modulo \(2\pi\).
See also
Permutation, inverse, negative, and normalize are unary operations: they act on a single hypervector rather than combining two. They are documented on Unary Operations.