Note
This documentation is for a development version. Click here for the latest stable release (v1.3.0).
nengo_spa.vector_generation¶
Generators to create vectors with specific properties.
Classes
Generator for axis aligned vectors. 

Generator for equally spaced positive unitary HRR vectors. 


Generator for vectors with expected unitlength. 

Generator for uniformly distributed unitlength vectors. 

Generator for unitary vectors (given some binding method). 

Generator for random orthonormal vectors. 

Generator for vectors with given properties. 

nengo_spa.vector_generation.
AxisAlignedVectors
(d)[source]¶ Generator for axis aligned vectors.
Can yield at most d vectors.
Note that while axisaligned vectors can be useful for debugging, they will not work well with most binding methods for Semantic Pointers.
 Parameters
 dint
Dimensionality of returned vectors.
Examples
>>> for p in nengo_spa.vector_generation.AxisAlignedVectors(4): ... print(p) [1. 0. 0. 0.] [0. 1. 0. 0.] [0. 0. 1. 0.] [0. 0. 0. 1.]

class
nengo_spa.vector_generation.
UnitLengthVectors
(d, rng=None)[source]¶ Bases:
object
Generator for uniformly distributed unitlength vectors.
 Parameters
 dint
Dimensionality of returned vectors.
 rngnumpy.random.RandomState, optional
The random number generator to use to create new vectors.

class
nengo_spa.vector_generation.
UnitaryVectors
(d, algebra, rng=None)[source]¶ Bases:
object
Generator for unitary vectors (given some binding method).
 Parameters
 dint
Dimensionality of returned vectors.
 algebraAbstractAlgebra
Algebra that defines what vectors are unitary.
 rngnumpy.random.RandomState, optional
The random number generator to use to create new vectors.

class
nengo_spa.vector_generation.
EquallySpacedPositiveUnitaryHrrVectors
(*, d, n, offset)[source]¶ Bases:
object
Generator for equally spaced positive unitary HRR vectors.
The vectors produced by this generator lie all on a hypercircle of positive, unitary vectors under the
HrrAlgebra
. The distance from one vector to the next is constant.Note that the identity vector is included in the set of returned vectors if any of the vectors hits an offset of 0. This might not be desired as it will return any vector it is bound to unchanged. Use a noninteger offset to ensure that the identity vector is not included.
 Parameters
 dint
Dimensionality of returned vectors.
 nint
Number of vectors to fit onto the hypercircle. At most n vectors can be returned from the generator.
 offsetfloat
Offset of the first returned vector along the hypercircle. An offset of 0 will return the identity vector first. An offset of 1 corresponds to the vector when moving a 1/nth part along the hypercircle.
 Attributes
 vectors(n, d) ndarray
All vectors that would be returned by iterating over the generator.

class
nengo_spa.vector_generation.
OrthonormalVectors
(d, rng=None)[source]¶ Bases:
object
Generator for random orthonormal vectors.
 Parameters
 dint
Dimensionality of returned vectors.
 rngnumpy.random.RandomState, optional
The random number generator to use to create new vectors.

class
nengo_spa.vector_generation.
ExpectedUnitLengthVectors
(d, rng=None)[source]¶ Bases:
object
Generator for vectors with expected unitlength.
The vectors will be uniformly distributed with an expected norm of 1, but each specific pointer may have a length different than 1. Specifically each vector component will be normal distributed with mean 0 and standard deviation \(1/\sqrt{d}\).
 Parameters
 dint
Dimensionality of returned vectors.
 rngnumpy.random.RandomState, optional
The random number generator to use to create new vectors.

class
nengo_spa.vector_generation.
VectorsWithProperties
(d, properties, algebra, *, rng=None)[source]¶ Bases:
object
Generator for vectors with given properties.
Supported properties depend on the algebra. See the respective algebra’s
AbstractAlgebra.create_vector()
method. Parameters
 dint
Dimensionality of returned vectors.
 properties
Properties that the generated vectors have to fulfill. Details depend on the exact algebra.
 algebraAbstractAlgebra
Algebra that determines the interpretation of the properties.
 rngnumpy.random.RandomState, optional
The random number generator to use to create new vectors.