Additional linear algebra operations to extend Joel Grus's library from 'Data Science from Scratch' chapter 4
Project description
Linalg Deluxe
An extension of Joel Grus's linear algebra Python library as he wrote it in chapter 4 of Data Science from Scratch. I have added transposition, symmetry checking, multiplication of vectors by matrices, the angle between two vectors, outer products, cross products, matrix multiplication, determinants, adjoint matrices, and inverse matrices (plus some input-checking helper functions).
Installation
pip install linalg-basic
pip install linalg-deluxe
Get started
The following code walks through just a few of the library's features:
from linalg_deluxe import transpose, multiply_matrix_vector, symmetric, inverse_matrix
# Create a Vector and a Matrix (the two data types the library runs on)
v = [1, 2, 3]
m = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]
# Transpose v and m
v_vertical = transpose(v)
m_transposed = transpose(m)
# Multiply m by v
m_x_v = multiply_matrix_vector(m, v)
# Is m symmetric?
m_sym = symmetric(m)
# Attempt to generate m's inverse
# This will fail, because m's determinant is not zero in this case
m_inv = inverse_matrix(m)
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
linalg_deluxe-0.1.0.tar.gz
(5.4 kB
view hashes)
Built Distribution
Close
Hashes for linalg_deluxe-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a573b3094aef734ce0c732f98e4dbff084146774b6e2d5a2355268162ad40095 |
|
MD5 | 3544201e44065fcf6c6e00acbe6ff069 |
|
BLAKE2b-256 | df6102e71eae72f602f0984443f4c87d4c8ab7c24248fc864c03ec48cb7bd3a9 |