Module pywander.math.linear_algebra

linear algebra

the prefix explanation

a : an array v : a vector m : the linear equation system left matrix b : the linear equation right b array am : [argumented matrix] combine m and b to a entire linear system matrix

Functions

def add_rows(m, row_num_1, row_num_2, row_num_1_multiple)

Gaussian elimination basic operation 3

def combine_system(m, b)

combine m and b to system

def cos(v1, v2)

calc the cosine similarity between two vectors. Parameters


v1
 
v2
 

Returns

def determinant(m)

calc the determinant

def dot_product(v1, v2)

get the dot product of two vectors

def l2norm(v)

get the l2 norm of a vector

def matrix_multiplication(m1, m2)

notice: ndim=1 array is a vector, can not apply here.

def multiply_row(m, row_num, row_num_multiple)

Gaussian elimination basic operation 2

def solve(m, b)

solve the linear equation system

def swap_rows(m, row_num_1, row_num_2)

Gaussian elimination basic operation 1 swap two rows