def recursive_line(self, new_line=5246):
stir = self.load()
J = stir.shape[0]
K = stir.shape[1]
for x in range(new_line):
n = J + x
new_l = np.ones((1, K)) * np.inf
print(n)
for m in range(1,K):
if m > n:
continue
elif m == n:
new_l[0, m] = 0
elif m == 1:
new_l[0, 1] = logsumexp( [ np.log(n-1) + stir[n-1, m] ] )
else:
new_l[0, m] = logsumexp( [ stir[n-1, m-1] , np.log(n-1) + stir[n-1, m] ] )
stir = np.vstack((stir, new_l))
#np.save('stirling.npy', stir)
#np.load('stirling.npy')
return stir
评论列表
文章目录