nengo_spa.vector_generation

Generators to create vectors with specific properties.

Classes

AxisAlignedVectors(d)

Generator for axis aligned vectors.

UnitLengthVectors(d[, rng])

Generator for uniformly distributed unit-length vectors.

UnitaryVectors(d, algebra[, rng])

Generator for unitary vectors (given some binding method).

OrthonormalVectors(d[, rng])

Generator for random orthonormal vectors.

ExpectedUnitLengthVectors(d[, rng])

Generator for vectors with expected unit-length.

nengo_spa.vector_generation.AxisAlignedVectors(d)[source]

Generator for axis aligned vectors.

Can yield at most d vectors.

Note that while axis-aligned vectors can be useful for debugging, they will not work well with most binding methods for Semantic Pointers.

Parameters

d (int) – Dimensionality of returned vectors.

Examples

>>> for p in nengo_spa.pointer_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 unit-length vectors.

Parameters
  • d (int) – Dimensionality of returned vectors.

  • rng (numpy.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
  • d (int) – Dimensionality of returned vectors.

  • algebra (AbstractAlgebra) – Algebra that defines what vectors are unitary.

  • rng (numpy.random.RandomState, optional) – The random number generator to use to create new vectors.

class nengo_spa.vector_generation.OrthonormalVectors(d, rng=None)[source]

Bases: object

Generator for random orthonormal vectors.

Parameters
  • d (int) – Dimensionality of returned vectors.

  • rng (numpy.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 unit-length.

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
  • d (int) – Dimensionality of returned vectors.

  • rng (numpy.random.RandomState, optional) – The random number generator to use to create new vectors.