推 funnypeter:get the array size 05/02 23:12
→ funnypeter:import numpy.zeros((rows,cols)) 05/02 23:12
→ funnypeter:write data,done. 05/02 23:13
推 funnypeter:讀檔有兩種方法,文字模式和binary模式 05/02 23:26
→ funnypeter:後者效率比較好,但有點難度,可以用struct.unpack讀 05/02 23:27
→ funnypeter:文字模式很簡單,讀進去後,取三個數字一組,寫進numpy 05/02 23:29
→ funnypeter:.zeros後再讀取下一組 05/02 23:29
→ funnypeter:這其實只是一般file I/o問題,跟矩陣沒關聯 05/02 23:30
→ askia:感謝!!! 05/02 23:44
推 funnypeter:如果有浮點數,記得指定dtype=numpy.float 05/02 23:50
→ funnypeter:修正一下第二個推文: 05/02 23:51
→ funnypeter:import numpy as np 05/02 23:51
→ funnypeter:arr=np.zeros((rows,cols),dtype=np.float) 05/02 23:52
推 tiefblau:就一般的讀法 讀進來變成list包list可以直接轉np.array 05/03 01:09
推 singlovesong:sparse matrix 都有 data , indices 的呼叫法阿 05/03 15:33