Skip to main content

Matrix operations and linear algebra (mola) library without external dependencies

Project description

Matrix operations and linear algebra (mola) library for vanilla Python

Introduction

mola is a Python library for doing algebra with matrices. It covers the basic operations such as matrix addition and multiplication, transposes, and inverse. It is written without any external Python libraries.

I wrote mola as a hobby project to remind myself of the linear algebra I studied in uni and to practice my Python programming. Particularly, this is an exercise in publishing my first Python library.

Getting started

Install with "pip install mola" or the GitHub repository for a more recent version.

See main.py for examples and read the documentation.

Prerequisites

  • Python 3.x (written on Python 3.9, so that's sure to work)

Classes

Matrix

Matrix is the main class of mola. In practice, the elements of the matrix are implemented with lists. Most of its functionality involves calling methods from this class. However, for a more user-friendly approach, I plan on implementing some wrapper functions you can call directly (e.g., "linear_least_squares()" to perform linear regression).

TODO:

  • checks to see if matrix is positive/negative definite/semidefinite
  • different matrix norms (only Frobenius and Euclidean norm implemented right now)
  • Gauss-Newton iteration
  • Levenberg-Marquardt algorithm
  • regularized least squares
  • more decompositions (only QR implemented so far)

License

MIT License

Copyright (c) 2023 Jere Lavikainen

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

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

mola-1.0.0.tar.gz (12.6 kB view details)

Uploaded Source

Built Distribution

mola-1.0.0-py3-none-any.whl (12.7 kB view details)

Uploaded Python 3

File details

Details for the file mola-1.0.0.tar.gz.

File metadata

  • Download URL: mola-1.0.0.tar.gz
  • Upload date:
  • Size: 12.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.18

File hashes

Hashes for mola-1.0.0.tar.gz
Algorithm Hash digest
SHA256 fb593c7255ff53ad3b1ae3ed6accbae141f5b9cafdf7bf47b1d4dbd3d5a487ee
MD5 dff53839b8e31f4e6db3186bd6fcc27b
BLAKE2b-256 2ad7899a217d52458feb3d16fa402caee98c6dc47748e0363c720de86f559de9

See more details on using hashes here.

File details

Details for the file mola-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: mola-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 12.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.18

File hashes

Hashes for mola-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d77611b38e422075c2a41b08a0d61886c5b37a350a95ce35e61a6f52c9cddd1a
MD5 d7baaa7808fee1d1ff99fbf43d8d1a4a
BLAKE2b-256 17913c5dcd8b54d440450039d91fd7770d026a8a6d42c1c62d14648d8c221d99

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