python - Solving matrix equation A B = C. with B(n* 1) and C(n *1) -


i trying solve matrix equation such a.b = c. unknown matrix , must find it. have b(n*1) , c(n*1), a must n*n.

i used bt* a.t =c.t method (numpy.linalg.solve(b.t, c.t)). produces error:

linalgerror: last 2 dimensions of array must square.

so problem b isn't square.

here's little example you:

import numpy np  = np.array([[1, 2], [3, 4]]) b = np.array([5, 6]) x = np.linalg.solve(a, b)  print "a={0}".format(a) print "b={0}".format(b) print "x={0}".format(x) 

for more information, please read docs


Comments