我定义u
和v
u = np.array([[1],
[1]])
v = np.array([[1],
[-1]])
我想找到A
Au = np.array([[3],
[2]])
Av = np.array([[-1],
[-2]])
所以我这样编码
A = np.linalg.solve(u,Au)
A = np.linalg.solve(v,Av)
print(A)
然后我得到了错误
LinAlgError Traceback (most recent call last)
<ipython-input-21-416fc4de15b6> in <module>
12 [-2]])
13
---> 14 A = np.linalg.solve(u,Au)
15 A = np.linalg.solve(v,Av)
16 print(A)
<__array_function__ internals> in solve(*args, **kwargs)
~\anaconda3\lib\site-packages\numpy\linalg\linalg.py in solve(a, b)
384 a, _ = _makearray(a)
385 _assert_stacked_2d(a)
--> 386 _assert_stacked_square(a)
387 b, wrap = _makearray(b)
388 t, result_t = _commonType(a, b)
~\anaconda3\lib\site-packages\numpy\linalg\linalg.py in _assert_stacked_square(*arrays)
211 m, n = a.shape[-2:]
212 if m != n:
--> 213 raise LinAlgError('Last 2 dimensions of the array must be square')
214
215 def _assert_finite(*arrays):
LinAlgError: Last 2 dimensions of the array must be square
我该如何解决?