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 add linflex
pip install 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.4.tar.gz (9.9 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.4-py3-none-any.whl (14.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: linflex-0.3.4.tar.gz
  • Upload date:
  • Size: 9.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.11 {"installer":{"name":"uv","version":"0.11.11","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for linflex-0.3.4.tar.gz
Algorithm Hash digest
SHA256 adb6f17ed99b8ff58ea2be7a8138b093df7427f1fa96500fef251f7f21f81e1e
MD5 ec127ca5b9ee7f33659a19a105701577
BLAKE2b-256 832ea65f39d362008b02636f4549c390b0efe31063d04c867cab19d47ac57639

See more details on using hashes here.

File details

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

File metadata

  • Download URL: linflex-0.3.4-py3-none-any.whl
  • Upload date:
  • Size: 14.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.11 {"installer":{"name":"uv","version":"0.11.11","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for linflex-0.3.4-py3-none-any.whl
Algorithm Hash digest
SHA256 c9cbacb9d9630fd12438b5c63f89048aa5e533c7e2e31172edd9f764b557a942
MD5 7b1527692603ec855a43f276efad5852
BLAKE2b-256 c729e46c67e5c7033fe58fb31b6af8db05f4ff4cae1aebea05d38364c34be649

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