Skip to main content

Vector

from abel.linalg.vector import Vector

a, b = Vector([1, 2]), Vector([3, 4])
c, d = Vector([1, 2, 3]), Vector([4, 5, 6])

assert a.shape == b.shape == (1, 2)
assert c.shape == d.shape == (1, 3)

Addition

assert a + a == Vector([2, 4])
assert a + b == Vector([4, 6])
assert b + b == Vector([6, 8])

Subtraction

assert a - b == Vector([-2, -2])
assert b - a == Vector([2, 2])

Scaling

assert a * 5 == Vector([5, 10])
assert 5 * a == Vector([5, 10])
assert a / 2 == Vector([0.5, 1.0])

Dot (inner) product

assert a @ b == 11
assert a @ a == 5

Norm (length)

assert a.norm() - 2.236 < 0.001
assert b.norm() - 5 < 0.001

Angle

assert Vector.angle(a, a) < 0.001
assert Vector.angle(a, b) - 0.1799 < 0.001
assert Vector.angle(a, b) == Vector.angle(b, a)

Vector projection

assert Vector.proj(a, a) == a
assert Vector.proj(a, b) == Vector([1.32, 1.76])
assert Vector.proj(b, a) == Vector([2.2, 4.4])

Scalar projection

assert Vector.scalproj(a, b) - 4.919 < 0.01
assert Vector.scalproj(b, a) - 2.2 < 0.01
assert Vector.scalproj(a, a) - 2.236 < 0.01
assert Vector.scalproj(b, b) - 5 < 0.1

Cross product

assert Vector.cross(c, d) == Vector([-3, 6, -3])

Average (arithmetic mean)

assert Vector.average(Vector([2, 1]), Vector([4, 2])) == Vector([3.0, 1.5])

Collinearity

Vectors are collinear iff one is a scalar multiple of the other.

assert Vector.collinear(Vector([2, 1]), Vector([4, 2]))
assert Vector.collinear(Vector([-3, 4, 1]), Vector([-15, 20, 5]))
assert not Vector.collinear(Vector([0, 1]), Vector([1, 0]))

Linear independence

A set of vectors is linearly independent iff all vectors in it are pairwise non-collinear.

assert Vector.linindep(Vector([0, 1]), Vector([1, 0]))
assert Vector.linindep(Vector([1, 1]), Vector([2, 1]))
assert not Vector.linindep(Vector([1, 2, 3]), Vector([0, 0, 1]), Vector([0, 0, 2]))

Metadata

Release files for abel 0.0.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 abel 0.0.6
File Size Uploaded Provenance Actions
abel-0.0.6.tar.gz 3.1 kB Without provenance Details for abel-0.0.6.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for abel 0.0.6
File Interpreter ABI Platform Actions
abel-0.0.6-py3-none-any.whl Python 3 none any Details for abel-0.0.6-py3-none-any.whl

Total release size: 6.8 kB

Release files / abel-0.0.6.tar.gz

Download URL abel-0.0.6.tar.gz
Size 3.1 kB
Tags Source
SHA-256 checksum
How to use checksums
4b1bbdd51a019a9b2f64f9cf1e57ae6929832f909154a53952635af3ca3e5e1e
BLAKE2b-256 checksum
How to use checksums
5ab38830991bf9ae36e17626f27d557d07622cdf628a1c2773186f79174567ed
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / abel-0.0.6-py3-none-any.whl

Download URL abel-0.0.6-py3-none-any.whl
Size 3.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
dc8aca51675c9d62674f1e75699f90f98bacefc1437af7371b85fb9b3d1d7676
BLAKE2b-256 checksum
How to use checksums
f8ec4480b1b854b239a8350e726ef6759b6521e970d5335765fe86e48dc5a92d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for abel 0.0.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