Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (pypi.python.org).
Help us improve Python packaging - Donate today!

Simple Vector package to help with basic linear algebra.

Project Description

A quick one:

>>> from vecpy import Vector as Vec
>>> v = Vec(0, 2)
>>> w = Vec([1, 3])
>>> v + 2
>>> v + w

Features

  • Basic operations ( dot-product, projection, rescaling, etc.)

Installation

To install VecPy, simply:

$ pip install vecpy

Documentation

This is a simple package allowing to complete very basic linear algebra tasks.

It is best explained by example:

>>> v = Vec(0, 2)
>>> w = Vec(1, 3)

You can do basic rescaling of a vector:

>>> v_twice = v ^ 2
>>> print v_twice.length == 2 * v.length
>>> v_unit = v ^ 0
>>> print v_unit.length

Adding scalar and other vectors:

>>> v + 2
>>> v + w
...

Multiplication and dot-product

>>> v * 3
>>> v.dot(w)

A vector has several properties:

>>> v.length
>>> v.dim

You can specify which norm to use (default is the Euclidean)

>>> v.norm(1)
>>> v.norm('inf')
>>> v.norm(2) == v.length
...

You can project one vector on another:

>>> w_proj_v = v.proj(w)
>>> ratio = v.proj(w, get_scale=True)

Iteration is supported as well:

>>> print [xi for xi in v]

String representations:

>>> print str(v)
>>> print '{:[x, y, z]}'.format(v)
Release History

Release History

This version
History Node

0.1.6

History Node

0.1.5

History Node

0.1.4

History Node

0.1.3

History Node

0.1.2

History Node

0.1.1

History Node

0.1.post4

History Node

0.1.post2

History Node

0.1.0

Download Files

Download Files

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

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
vecpy-0.1.6.tar.gz (4.0 kB) Copy SHA256 Checksum SHA256 Source Jul 3, 2015

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting