# Positron: Linear Algebra Library For Python

## A new library for Python/Numpy.

# Introduction

In this article, I will introduce the current state of a newly developed (and still in progress) Linear Algebra library for Python, called **Positron**. This is not a replica of Numpy, it is instead an *extension for numpy*.

The main focus of Positron is to implement functions that are common (or rare) in Linear Algebra but are not in Numpy by default.

All the code for this project is on the web, namely on GitHub. Contributions and suggestions are really well welcomed!

## Concepts

Linear Algebrais a mathematical discipline that deals with vectors and matrices and, more generally, with vector spaces and linear transformations.

Pythonis one of the most popular programing language to use for Data Science, Machine Learning, and Artificial Intelligence among others. Deep Learning -a subset of Artificial Intelligence- relies heavily on Linear Algebra.

Numpyis the most used Linear Algebra library for Python. It is fast, pretty well documented, widely used and kind of easy to work with.

## Goals Of Positron

- Implement functions from Linear Algebra.
- Only implement what is not in Numpy by default.
- The functions should be as fast as possible.
- Make the library well useable for
*everyone*.

# Implemented Functions

Here you can find some of the currently implemented functions. Most of them are using the **numpy.ndarray **class from the **numpy** library for storing matrices.

## Matrix Chess Table Rule

Applies the Chess Table Rule to the given matrix. Note that the matrix has to be a square matrix and at least 2 rows tall.

It creates a new matrix by multiplying specific elements by -1. If we count indices from one:

- For every odd row: Every even indexed element multiplies by -1.
- For every even row: Every odd element multiplies by -1.

## Matrix Adjungate

Creates an adjungate matrix from the given one. Note that the matrix has to be a square matrix.

## Matrix Subdeterminants

Returns the subdeterminants of the given matrix. Note that the matrix has to be a square matrix and at least 3 rows tall.

## Matrix Determinant

Using the Subdeterminant extractor function, we can create a general determinant calculator function shown here.

This function will return the determinant of the given matrix. Note that the matrix has to be a square matrix and at least 2 rows tall.

## Matrix Inverse

This might be the most interesting function of all. The matrix inverse. This function calculates the given matrix’s inverse.

An inverse can be helpful in solving equations like: **Ax=b**, where the question is** **“**x=?**”**. **The solution for this equation is given with a matrix inverse:

Where **I **is an identity matrix**.**

**Future Functions: Eigenvalues and Eigenvectors**

This is an idea for not yet implemented function(s).

There are some methods for finding matrix **eigenvalues and eigenvectors**, so there must be a way to generalize the algorithm and implement it into Positron.

# Conclusion

I hope that in this article, I gave you a good enough introduction for the current state (2022. June 7.) of **Positron**. Remember that It is a free to use library (MIT License) and we, the developers would be really happy to see you contributing to **Positron!**

Author: **Martin Kondor**

## Sources

- Positron’s GitHub — https://github.com/MartinKondor/positron
- Numpy Documentation — https://numpy.org/doc/
- Ian Goodfellow and Yoshua Bengio and Aaron Courville - Deep Learning Book — https://www.deeplearningbook.org