Giter Site home page Giter Site logo

mytrix-legacy's Introduction

Language: Python License: MIT Code Style: PEP 8, 257 Build Status

Mytrix

A Python package for handling matrices and other linear algebra concepts

About

Mytrix is a collaborative project that I began in the summer of 2019. This is not a package of much practical use but was rather developed as a way to practice Python package development and collaborative coding. The scope of the package is reasonably wide and loosely-defined; essentially, anything that is vaguely related to linear algebra is welcome for inclusion.

The philosophy of the package is heavily inspired by MATLAB's use of multiple dispatch and operator overloading to enable efficiency savings when a given input statisfies certain mathematical properties. Further, the core contributors for this project are all mathematicians or statisticians and so the syntax and functionality of the package is most relevant to such an audience.

Multiple dispatch in MATLAB for solving systems of linear equations (this is flowchart is for dense matrices alone; sparse matrices have their own, even larger flowchart)

Although this package is in no way a replacement for any of the existing linear algebra solutions (NumPy, SciPy for example) due to its comparatively small scope, inefficient design (no C code here), and lack of robustness, I hope that people will still be interested in contributing the project to help their own learning and others can benefit from looking at the design of a linear algebra code base that isn't as verbose or obfuscated as the well-known solutions.

Contributing

The core contributors to this project are:

Anyone is free (and encouraged) to contribute to this code base. All I ask is that one follows these key rules:

  • Follow PEP 8 and PEP 257. If you struggle to remember these conventions, please install a relevant linter
  • Document and write tests for any new features that you implement
  • Attempt to follow existing naming conventions, especially for function signatures and temporary variables

mytrix-legacy's People

Contributors

thargreaves avatar vkhalaim avatar

Watchers

James Cloos avatar Gabriel Musker avatar  avatar Jonathan Low avatar

mytrix-legacy's Issues

Type checking for matrix arithmetic

Currently, no checking is performed before matrix arithmetic (e.g. addition, subtraction). This may lead to some obscure errors. It would be good to implement proper type-checking.

Type-casting

Once #9 is complete we will need methods to cast between matrix types.

Boolean arithmetic

Once #9 is complete, it would be good to add methods for Boolean arithmetic on matrices of type 'boolean'

`init=True` in general matrix initialiser is potentially dangerous

The inclusion of this parameter could easily lead to problems when arithmetic is performed on uninitialised matrices. Implemented checks for all of these is far too complicated so it may be better to replace this parameter with something like data=None and then validate data if it is supplied.

Skew-symmetric decomposition

A matrix is symmetric if it is equal to its transpose and is skew-symmetric. Any matrix can be decomposed into the sum of a symmetric and skew-symmetric matrix.

Add methods to check symmetry and skew-symmetry, and implement the decomposition.

Arithmetic with constants

It would be nice to be able to add a constant to a matrix or multiply be a constant and have operations occur element wise with the constant recycled.

Vector spaces

It would be nice to have a vector space class defined by a basis. This could include notions of equivalence, addition (direct sum), and orthogonalisation.

There could also be row/col space methods for matrices returning vector spaces

__repr__ is broken

There is so much wrong with this.

For a start there is currently a __repl__ method but not __repr__ (typo).

Secondly, __repl/r__ is not reproducible. See here

Equality magic method only valid for general matrices

The equality magic method currently works by comparing self.rows with mtrx.rows. This doesn't make any sense for non-general matrices since they will store their data in different ways. On top of this, some validation needs to take place to check types before trying to access attributes.

Restrict matrix element types

It's currently possible to make a matrix where the elements are non-numeric objects. Further, the objects for each element don't even have to be the same type. This needs to be locked down after decisions are made on how to handle types.

Existence of Toeplitz decomposition over the integers

A Toeplitz decomposition for $M\in\mathcal{M_n\left(\mathbb{Z}\right)}$ exists if and only if $M_{i,j}$ and $M_{j,i}$ share the same parity for each $0\leq i < j \leq n$. It would be much better to check this directly than to really on a try-except statement.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.