Skip to main content

A linear algebra package written in Python

Project description

Linflex

A linear algebra package written in Python

Installation

Install using your preferred Python package manager:

uv pip install linflex
pip install linflex
rye add linflex

Getting started

from linflex import Vec2

a = Vec2(3, 4)
b = Vec2(2, -1)

assert a + b == Vec2(5, 3)
assert a - b == Vec2(1, 5)
assert a.length() == 5
assert -Vec2(2, -3) == Vec2(-2, 3)

c = Vec2(1, 1)
c += Vec2(0, 1)
assert c == Vec2(1, 2)

x, y = Vec2(3, 4)  # Supports tuple destructuring
assert x == 3 and y == 4

Rational

linflex was created to fill the need for a common Vec2 class accross my projects and packages. It is lightweight, as it only depends on typing-extensions. Aside from linear algebra, I also needed helper functions like lerp, sign and clamp, which was put into good use by <Vec2>.lerp, and alike. Naming and functionality is mainly inspired by the Godot Game Engine.

Includes

  • Functions
    • lerp
    • sign
    • clamp
    • move_toward
  • Datastructures
    • Vec2
    • Vec2i
    • Vec3

Versioning

linflex uses SemVer, according to The Cargo Book.

License

MIT

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

linflex-0.3.3.tar.gz (10.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

linflex-0.3.3-py3-none-any.whl (13.7 kB view details)

Uploaded Python 3

File details

Details for the file linflex-0.3.3.tar.gz.

File metadata

  • Download URL: linflex-0.3.3.tar.gz
  • Upload date:
  • Size: 10.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.15

File hashes

Hashes for linflex-0.3.3.tar.gz
Algorithm Hash digest
SHA256 06c8332c60704c74955ac65edfbeeb60eeba75fc4e235b539abcbbdc502d25e3
MD5 adf376148a8b015f2f8b6f168bf2aab5
BLAKE2b-256 a6b883d46c86c208efe4f1f2b83e5a981b4628677d61187d683f5c9e695ed6f0

See more details on using hashes here.

File details

Details for the file linflex-0.3.3-py3-none-any.whl.

File metadata

  • Download URL: linflex-0.3.3-py3-none-any.whl
  • Upload date:
  • Size: 13.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.15

File hashes

Hashes for linflex-0.3.3-py3-none-any.whl
Algorithm Hash digest
SHA256 a425e539ec5416ec068077f4f4c2a7a2dd494584704649ae35963ccd96fc964c
MD5 0328f4accdafe6b14a96fb9b37516ff8
BLAKE2b-256 2c2d2cdafe0f65606a23a87aeadc90835fbdd39ebcece0219e44714b2a39ce9f

See more details on using hashes here.

Supported by

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