Fixed the problem with my code mixing up (n,) and (n,1) and (1,n) arrays by making a new function in useful_functions.py called vdot, which takes a matrix and a vector and returns the dot product of the two as a (n,) vector.