A = [[0.5, 0.2, 0.3],标签:0.3,0.2,0.5,0.4,len,算法,前向,range From: https://www.cnblogs.com/lld76/p/16843531.html
[0.3, 0.5, 0.2],
[0.2, 0.3, 0.5]]
B = [[0.5, 0.5],
[0.4, 0.6],
[0.7, 0.3]]
pi = [0.2, 0.4, 0.4]
def a1():
t = 0
a = []
for i in range(len(pi)):
a.append(pi[i] * B[i][t])
return a
a = a1()
print(a)
def q(a, t):
b = []
for i in range(len(A)):
c = 0
for j in range(len(A)):
c += A[j][i] * a[j]
b.append(c*B[i][t])
print(b)
return b
d = q(a, 1)
d = q(d, 0)