我想通過它的轉置(1乘3)乘以一個向量(3乘1)。我得到一個(3乘3)數組,但我無法得到它的反過來。任何想法爲什麼?Numpy的奇異矩陣問題
import numpy as np
c=array([1, 8, 50])
np.transpose(c[np.newaxis]) * c
array([[ 1, 8, 50],
[ 8, 64, 400],
[ 50, 400, 2500]])
np.linalg.inv(np.transpose(c[np.newaxis]) * c)
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "C:\Python26\lib\site-packages\numpy\linalg\linalg.py", line 445, in inv
return wrap(solve(a, identity(a.shape[0], dtype=a.dtype)))
File "C:\Python26\lib\site-packages\numpy\linalg\linalg.py", line 328, in solve
raise LinAlgError, 'Singular matrix'
LinAlgError: Singular matrix
這只是我的愚蠢愚蠢..謝謝你的幫助... – Neerav 2012-04-26 13:26:30