scipy.linalg.solve
(numpy.linalg.solve
也失敗)可以處理的最大大小是多少?Scipy.linalg.solve最大數組大小
我正在移植一些Matlab代碼(有些泊圖像克隆,這是我沒寫)到Python和Python中我的代碼:
print M.shape
print b.shape
x = scipy.linalg.solve(M,b)
這使返回的輸出(和錯誤):
(2550, 2550)
(2550, 1)
Traceback (most recent call last):
File "D:\Other\WB_Lab\PythonPort\FaceManip\Code\test_runner.py", line 19, in <module>
ibgFaceManipulator.main(testOut,pathName,ptsFile,subjectId,'2','0')
File "D:\Other\WB_Lab\PythonPort\FaceManip\Code\ibgFaceManipulator.py", line 70, in main
ManipulateFaceWrapper.main(outDir,subjectId,retry,attempts,listchoice,NewImageData,AllBlend,Patchizer)
File "D:\Other\WB_Lab\PythonPort\FaceManip\Code\ManipulateFaceWrapper.py", line 31, in main
ManipulateFace.main(outdir,newImageData,3,filename,patchizer,blendParam,eyeDistortionParams,mouthDistortionParams,[])
File "D:\Other\WB_Lab\PythonPort\FaceManip\Code\ManipulateFace.py", line 38, in main
FaceTex = PatchOverFaceWithSelectionPre.main(TexLib,FaceTex,OperationMaskNew,M,0)
File "D:\Other\WB_Lab\PythonPort\FaceManip\Code\PatchOverFaceWithSelectionPre.py", line 104, in main
tex = poissonImageCloneColor.main(tex,source_tex,imgProc.imerode(imMask,imgProc.strel('disk',1)))
File "D:\Other\WB_Lab\PythonPort\FaceManip\Code\poissonImageCloneColor.py", line 22, in main
imr = poissonImageClone.main(imir, imr,imMask)
File "D:\Other\WB_Lab\PythonPort\FaceManip\Code\poissonImageClone.py", line 81, in main
x = scipy.linalg.solve(np.squeeze(M),b)
File "C:\Python27\lib\site-packages\scipy\linalg\basic.py", line 78, in solve
raise ValueError('expected square matrix')
ValueError: expected square matrix
但我知道肯定M是正方形(大小爲)。 M和b都是dtype float64,M是一個csc格式的矩陣。
有沒有人看過類似的錯誤?我發現numpy.linalg.cond(M)
也失敗了。這一次說矩陣M是0維的(這與我給出的同樣的錯誤numpy.linalg.solve
)。
你可以打印'M'的'type'和'dtype',並顯示完整的追溯? – user2357112
其實,你可以展示[運行時演示錯誤的最小可運行示例](http://stackoverflow.com/help/mcve)嗎? – user2357112
M和b都是dtype float64,M是一個csc格式的矩陣。我將努力創建一個最小的可運行示例,但代碼的方式可能會非常棘手。 – wbest