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.1.tar.gz
(5.4 kB
view hashes)
Built Distribution
Close
Hashes for linalg_deluxe-0.1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8cb40e06e0fac8328bff3653ffe22f1d05ef7f1a5b1aaa93fdd926bf08023098 |
|
MD5 | e4b5db0243f44646897998d0a7874a31 |
|
BLAKE2b-256 | 0c390c67fb4c30b0e4b0149f691112f80e5108692e5505bbd93617447c37058e |