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.2.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.2-py3-none-any.whl (13.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: linflex-0.3.2.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.2.tar.gz
Algorithm Hash digest
SHA256 dba9764235fba60d3bd481180785decb1824ebe33daa29a2dacef75514657ae7
MD5 c42ed701757b2da78eb29ecbcc3f7501
BLAKE2b-256 fe661fd0bdf90b1b8c84b956e21a4f8551c0ba282360915ffc6dea527d224ded

See more details on using hashes here.

File details

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

File metadata

  • Download URL: linflex-0.3.2-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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 cbacd21d9d361a6bd3b90b2aa4d3de3781995790579eda0286e025942d9cab9c
MD5 61a7232044a9f5324b4f4419ff4a340b
BLAKE2b-256 2320f319432b5c72862363a43f46276ee637dcf34850f4a6f30e72d00a900fd8

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