pyhdc: Top-Level Module
Version and availability
Convenience functions
These functions are thin wrappers that delegate to the first hypervector’s encoding. They are provided for concise one-off calls.
- pyhdc.generate(encoding, size=None, use_generator=None)[source]
Generate one or more hypervectors using
encoding.- Parameters:
encoding – An instantiated
Encodingobject.size –
Nonefor a single vector,intfor a 1-D batch, ortuplefor a multi-dimensional batch.use_generator – Override the encoding’s generator setting.
Trueforces the custom generator;Falseforces NumPy’s default.
- Returns:
A
Hypervector.
enc = pyhdc.MAP_C(dimension=10_000) hv = pyhdc.generate(enc) batch = pyhdc.generate(enc, size=100)
- pyhdc.zeros(encoding, size=None)[source]
Return a zero-valued hypervector (or batch) for
encoding.- Parameters:
encoding – An instantiated
Encodingobject.size – Same as for
generate().
- Returns:
A
Hypervectorfilled with zeros.
zero = pyhdc.zeros(enc)
- pyhdc.bundle(*hypervectors)[source]
Bundle two or more hypervectors using the encoding of the first argument.
- Parameters:
hypervectors – Two or more
Hypervectorobjects produced by the same encoding.- Returns:
A
Hypervector.
result = pyhdc.bundle(hv1, hv2, hv3)
- pyhdc.bind(*hypervectors)[source]
Bind two or more hypervectors using the encoding of the first argument.
- Parameters:
hypervectors – Two or more
Hypervectorobjects.- Returns:
A
Hypervector.
result = pyhdc.bind(key, value)
Encoding classes
All encoding classes are imported at the top level:
See Encoding Classes for full documentation of each class.
Exception classes
All exception classes are imported at the top level:
See Exceptions for details.
Generator base classes
HDCGenerator: abstract base for all generatorsDefaultGenerator: NumPy-backed default
See Generation Module for the full family listing.