Skip to main content

VecPy: Some Linear Algebra Basics in Python

https://img.shields.io/pypi/v/requests.svg https://img.shields.io/pypi/dm/requests.svg

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)

Metadata

Release files for vecpy 0.1.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for vecpy 0.1.6
File Size Uploaded Provenance Actions
vecpy-0.1.6.tar.gz 4.0 kB Without provenance Details for vecpy-0.1.6.tar.gz

Release files / vecpy-0.1.6.tar.gz

Download URL vecpy-0.1.6.tar.gz
Size 4.0 kB
Tags Source
SHA-256 checksum
How to use checksums
02c3f0d2a4310182210eac32cfc92e6cb5c830755939fcbf57332484d57d1159
BLAKE2b-256 checksum
How to use checksums
dca3f7baf7b936aa2aa7626b7ae780bb19defe9916fe0e5eb16af0f1a10e1476
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for vecpy 0.1.6

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page