Skip to main content

A nice linear algebra library

Project description

pylinlin PyPI version codecov

Nice linear algebra library in python

Examples

from pylinlin.matrix import Matrix
from pylinlin.lu_factorization import compute_lu_factorization
from pylinlin.qr_factorization import compute_qr_factorization

# Create matrix
matrix = Matrix.from_cols([[1, 2, 3], [4, 5, 6], [7, 8, 10]])  # preferred way to initialize a matrix
matrix2 = Matrix.from_rows([[1, 2, 3], [4, 5, 6], [7, 8, 9]])

column_as_list = [1, 2, 3, 4, 5]
column_vector = Matrix.from_cols([column_as_list])  # column vectors can be represented as matrices
magnitude_sq = column_vector.transpose().multiply(column_vector).get(0, 0)  # 55

print(matrix.size())      # Get dimensions of matrix (rows, columns)
print(matrix.get_col(0))  # Get first column from matrix
print(matrix.get_row(1))  # Get second row from matrix

print(matrix.all_cols())  # List of matrix columns

matL, matU = compute_lu_factorization(matrix)
matQ, matR = compute_qr_factorization(matrix)
print(matQ.all_cols())
print(matQ.transpose().multiply(matQ).all_cols())  # approximately an identity matrix

product = matrix.multiply(matrix)  # matrix multiplication

Goals

  • Test-driven development
  • Profiling of performance
  • Profiling of numerical stability
  • Lightweight, easy to port over to other languages

TODOs

Algorithms

  • LU factorization
  • LU factorization with partial pivoting
  • QR factorization with householder matrices
  • QR factorization with pivoting
  • Gram Schmidt and Modified Gram Schmidt (help wanted!)
  • Spectral decomposition
  • SVD
  • Conjugate gradients
  • Condition number of a matrix
  • Jacobi SVD
  • Power iteration
  • Matrix Pseudoinverse

Profiling

  • Profile time taken varying size of matrices
  • Profile time taken to solve linear system comparing different algorithms
  • Graph error distribution on random matrices

Others

  • Make curve fitting demonstration
  • Make IK demonstration

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

pylinlin-0.0.4.tar.gz (9.9 kB view details)

Uploaded Source

Built Distribution

pylinlin-0.0.4-py3-none-any.whl (14.1 kB view details)

Uploaded Python 3

File details

Details for the file pylinlin-0.0.4.tar.gz.

File metadata

  • Download URL: pylinlin-0.0.4.tar.gz
  • Upload date:
  • Size: 9.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.9.0

File hashes

Hashes for pylinlin-0.0.4.tar.gz
Algorithm Hash digest
SHA256 9af9d8e72f60131454f8e02e3185db01611bd136fbbabb03d088238953b2f895
MD5 6c4eaf14fd96acaed86adf33e082b4d7
BLAKE2b-256 8c906c73a9e7c8053c0f3f0d313edbe11dbfab402df2e36f2c73ff7933ed4721

See more details on using hashes here.

File details

Details for the file pylinlin-0.0.4-py3-none-any.whl.

File metadata

  • Download URL: pylinlin-0.0.4-py3-none-any.whl
  • Upload date:
  • Size: 14.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.9.0

File hashes

Hashes for pylinlin-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 c8d26412c21680e21ecb4d438a6ccae8c22ef530682444dfafd64d323abaf38d
MD5 2ee6808c38fde0bcac5e5fcec271cd02
BLAKE2b-256 f0be8eb142352982394b36d6d02972fab22e15a76738171064d522b493b45415

See more details on using hashes here.

Supported by

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