os.listdir('./') # 等價linux ls
os.getcwd() #等價linux pwd
quantum2nd 發表在 痞客邦 留言(0) 人氣(2)
# wirte DATA to a file
f = open('../test.dat','w')quantum2nd 發表在 痞客邦 留言(0) 人氣(28)
PyCUDA 初步
Pycuda 第二步:讀取硬體資訊
quantum2nd 發表在 痞客邦 留言(0) 人氣(7)
1.矩陣乘法
如果矩陣是存成matrix ('matrix class'),C = A*B 是正常的矩陣乘法
但當矩陣是用array 格式儲存時(ndarray),C=A*B 仍舊會計算出東西,但是結果卻不是矩陣乘法的定義 , 而是Cij=Aij*Bij。
若將matrix存成ndarray 要做正確的矩陣成法 numpy.dot(A,B)
quantum2nd 發表在 痞客邦 留言(0) 人氣(14)
1. 使用c library or bulit-in function: (這個比較簡單)
python 裡有一個模組 "ctype" 利用這個模組 你可以直接使用c library
example:
quantum2nd 發表在 痞客邦 留言(0) 人氣(147)
import time
st=time.time()
a=0
for i in range (10000):
quantum2nd 發表在 痞客邦 留言(0) 人氣(0)
1.Module 使用
(1) 假設寫了一個file 叫 test.py
def iotest(a):
print "a:",a
quantum2nd 發表在 痞客邦 留言(0) 人氣(41)
quantum2nd 發表在 痞客邦 留言(0) 人氣(18)
if you have data
[1,2,3,4,5]
[4,5]
[7,6,5,4,3,2]
quantum2nd 發表在 痞客邦 留言(0) 人氣(8)
good web
eigenvalue problem,
svd細節:不論是numpy or scipy 給出的 v,s,u =np.linalg.svd( A )
quantum2nd 發表在 痞客邦 留言(0) 人氣(30)