def approx_exp(self,M,exp_t, scaling_terms):
# the scaling and squaring of matrix exponential with taylor expansions
U=1.0
Mt=1.0
factorial=1.0 #for factorials
for ii in xrange(1,exp_t):
factorial*=ii
Mt=M*Mt
U+=Mt/((2.**float(ii*scaling_terms))*factorial) #scaling by 2**scaling_terms
for ii in xrange(scaling_terms):
U=np.dot(U,U) #squaring scaling times
return U
system_parameters.py 文件源码
python
阅读 25
收藏 0
点赞 0
评论 0
评论列表
文章目录