Skip to main content

NumPy for humans: a very good vector-geometry and linear-algebra toolbelt

Project description

vg

version license build docs build code style

NumPy for humans – a very good toolbelt providing readable shortcuts for commonly used vector-geometry and linear-algebra functions.

The functions optionally can be vectorized, meaning they accept single inputs and stacks of inputs without the need to reshape. They return The Right Thing. With the power of NumPy, the vectorized functions are fast.

Features

  • normalize normalizes a vector.
  • sproj computes the scalar projection of one vector onto another.
  • proj computes the vector projection of one vector onto another.
  • reject computes the vector rejection of one vector from another.
  • reject_axis zeros or squashes one component of a vector.
  • magnitude computes the magnitude of a vector.
  • angle computes the unsigned angle between two vectors.
  • signed_angle computes the signed angle between two vectors.
  • almost_zero tests if a vector is almost the zero vector.
  • almost_collinear tests if two vectors are almost collinear.
  • pad_with_ones adds a column of ones.
  • unpad strips off a column (e.g. of ones).
  • apply_homogeneous applies a transformation matrix using homogeneous coordinates.
  • Complete documentation: http://vgpy.readthedocs.io/

Installation

pip install numpy vg

Usage

import numpy as np
import vg

projected = vg.sproj(np.array([5.0, -3.0, 1.0]), onto=vg.basis.neg_y)

Support

If you are having issues, please let us know.

Acknowledgements

This collection was developed at Body Labs by Paul Melnikow and extracted from the Body Labs codebase and open-sourced as part of blmath by Alex Weiss. blmath was subsequently forked by Paul Melnikow and later this namespace was broken out into its own package.

License

The project is licensed under the two-clause BSD license.

Project details


Download files

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

Source Distribution

vg-0.3.0.tar.gz (9.8 kB view details)

Uploaded Source

File details

Details for the file vg-0.3.0.tar.gz.

File metadata

  • Download URL: vg-0.3.0.tar.gz
  • Upload date:
  • Size: 9.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.9.1 setuptools/40.4.1 requests-toolbelt/0.8.0 tqdm/4.25.0 CPython/2.7.15

File hashes

Hashes for vg-0.3.0.tar.gz
Algorithm Hash digest
SHA256 6256db301e00ea4126c160f9727e6fb165c935cad97c807ee09705e6c7a7fc78
MD5 504ee078182522a449dfb444076972d3
BLAKE2b-256 9f6fd2bc01b12f35b2d36eaf697f711010c5f309ddb66ea22f1130e675950803

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page