Skip to main content

Linear algebra on Python — вектора, матрицы, разложения

Project description

Algebrix


Algebrix is a simple and powerful library for working with vectors and matrices. Supports basic linear algebra operations, including:

  • Addition, subtraction, scalar and matrix multiplication

  • Normalization of vectors, calculation of angle, projections

  • Transpose, inverse matrix, reshape

  • And much more

Installing

pip install algebrix

Usage examples

from algebrix import Matrix, Vector

# Векторы
v1 = Vector([1, 2, 3])
v2 = Vector([4, 5, 6])

print(v1 + v2)             # Vector([5, 7, 9])
print(v1.dot(v2))          # 32
print(v1.norm())           # 3.741...
print(v1.project_onto(v2)) # Проекция v1 на v2

# Матрицы
m1 = Matrix([[1, 2], [3, 4]])
m2 = Matrix([[5, 6], [7, 8]])

print(m1 + m2)             # Matrix([[6, 8], [10, 12]])
print(m1 * m2)             # Matrix([[19, 22], [43, 50]])
print(m1.T())              # Matrix([[1, 3], [2, 4]])
print(m1.inverse())        # Matrix([[-2.0, 1.0], [1.5, -0.5]])

🧠 Features

🟦 Vector Class

Implements:

  • add, sub, mul, rmul

  • dot(other): dot product

  • norm(): Euclidean norm

  • normalize(): unit vector

  • project_onto(other): vector projection

  • angle_with(other): angle between vectors (in radians)

🟩 Matrix Class

Implements:

  • add, sub, mul, rmul

  • T(): transpose

  • inverse(): matrix inverse

  • shape(): returns (rows, cols)

  • reshape((new_rows, new_cols)): reshapes the matrix

🛠️ Requirements

  • Python 3.10+

  • Only depends on the built-in math module (no third-party dependencies)

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

algebrix-1.0.1.tar.gz (7.4 kB view details)

Uploaded Source

Built Distribution

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

algebrix-1.0.1-py3-none-any.whl (8.2 kB view details)

Uploaded Python 3

File details

Details for the file algebrix-1.0.1.tar.gz.

File metadata

  • Download URL: algebrix-1.0.1.tar.gz
  • Upload date:
  • Size: 7.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.1

File hashes

Hashes for algebrix-1.0.1.tar.gz
Algorithm Hash digest
SHA256 36f6cb4690f2a4a649790490f71fd856a4cb794bce4f8f1e3eb1dedcc524478f
MD5 5857bd5982c6aec4d5031884d50fda08
BLAKE2b-256 93f9b90157054d56f4f7f452d003abd041b4be09387268458b78811c44604cbc

See more details on using hashes here.

File details

Details for the file algebrix-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: algebrix-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 8.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.1

File hashes

Hashes for algebrix-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 1fb77a69661a4cc35ddfd343e4d6a4138a719480c462e9813f7ae5865545494e
MD5 8b3c39ffbd11bc0da099c646d5044e4f
BLAKE2b-256 8c9452678b0f7193192cbf605753842b7c29c1c7f988f24a4560f711c640194f

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