My code essentially finds the column vector k using this equation:
k
Calculating the matrix takes three orders of magnitude longer than calculating