Simple, general, pure Python vectors

## Project description

Simple, general, pure Python vectors

hypervector.py defines an infinite-dimensional Vector type for all your vectoring needs. Instances of Vector are immutable and come with a wide array of useful operations and features.

hypervector is in the public domain.

## A few explanatory examples

Hello world

```
>>> from hypervector import Vector
>>> (Vector(1, 2, 1) + Vector(3, 0, 2)).xy
Vector(4, 2)
```

King of infinite (vector) space

```
>>> vec = Vector(2, 4)
>>> (vec[0], vec[1], vec[2], vec[1114111])
(2, 4, 0, 0)
```

Cross-eyed

```
>>> vec_1, vec_2 = Vector(1, 2, 3), Vector(3, 2, 1)
>>> Vector.cross(vec_1, vec_2)
Vector(-4.0, 8.0, -4.0)
>>> [Vector.dot(_, vec) for vec in (vec_1, vec_2)]
[0.0, 0.0]
>>> vec_3 = Vector(-1, 8, 3, 2)
>>> Vector.cross(vec_1, vec_2, vec_3)
Vector(8.0, -16.0, 8.0, 56.0)
>>> [Vector.dot(_, vec) for vec in (vec_1, vec_2, vec_3)]
[0.0, 0.0, 0.0]
```

## Testing

The unit tests can be run with tox. If you run into any slow data generation errors, use

tox -- --hypothesis-profile=allow-slow instead.

## Why infinite dimensions?

Because generalizing things is fun and having infinite dimensions is somewhat easier and simpler than having an abstract Vector type with arbitrary (but finite) dimensions.

It is worth noting that Vector plays a little fast and loose with the concept of infinite dimensions, as it has a concept of “relevant” dimensions which is exposed through iteration, string representations, and a few other places to a lesser extent.

Similarly, there is no way to have a Vector with infinite non-zero components.

## How fast is hypervector?

Dunno. Probably pretty slow. If you need speed, use numpy.

## Alternatives

There are many other libraries with similar features to hypervector. Some notable examples:

## Links

Get hypervector from PyPi: pip install hypervector

Report bugs and offer suggestions at the github issues page.

## Project details

## Release history Release notifications | RSS feed

## Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

### Source Distribution

hypervector-0.0.1.tar.gz
(8.5 kB
view hashes)