os.listdir('./')   # 等價linux ls
os.getcwd() #等價linux pwd

quantum2nd 發表在 痞客邦 留言(0) 人氣()



# wirte  DATA  to a file
f = open('../test.dat','w')

quantum2nd 發表在 痞客邦 留言(0) 人氣()

  • Nov 11 Fri 2011 10:58
  • PyCUDA

PyCUDA 初步
Pycuda 第二步:讀取硬體資訊

quantum2nd 發表在 痞客邦 留言(0) 人氣()

1.矩陣乘法
如果矩陣是存成matrix ('matrix class'),C = A*B 是正常的矩陣乘法
但當矩陣是用array 格式儲存時(ndarray),C=A*B 仍舊會計算出東西,但是結果卻不是矩陣乘法的定義 , 而是Cij=Aij*Bij。
若將matrix存成ndarray 要做正確的矩陣成法 numpy.dot(A,B) 

quantum2nd 發表在 痞客邦 留言(0) 人氣()

1. 使用c library or bulit-in function: (這個比較簡單)
    python 裡有一個模組 "ctype" 利用這個模組 你可以直接使用c library
example:

quantum2nd 發表在 痞客邦 留言(0) 人氣()

import time
st=time.time()
a=0
for i in range (10000):

quantum2nd 發表在 痞客邦 留言(0) 人氣()

1.Module 使用
  (1) 假設寫了一個file 叫 test.py
       def iotest(a):
print "a:",a

quantum2nd 發表在 痞客邦 留言(0) 人氣()

原文教學
中譯教學
MAC

quantum2nd 發表在 痞客邦 留言(0) 人氣()

if you have data
[1,2,3,4,5]
[4,5]
[7,6,5,4,3,2]

quantum2nd 發表在 痞客邦 留言(0) 人氣()

good web
eigenvalue problem, 
svd細節:不論是numpy or scipy 給出的 v,s,u =np.linalg.svd( A )  

quantum2nd 發表在 痞客邦 留言(0) 人氣()



# wirte  DATA  to a file
f = open('../test.dat','w')

quantum2nd 發表在 痞客邦 留言(0) 人氣()

random number generator:
  for interger: 
                import random

quantum2nd 發表在 痞客邦 留言(0) 人氣()

1 2
Blog Stats
⚠️

成人內容提醒

本部落格內容僅限年滿十八歲者瀏覽。
若您未滿十八歲,請立即離開。

已滿十八歲者,亦請勿將內容提供給未成年人士。