这个函数中的 if 语句,在没有向量化的情况下工作吗?
def K(T0,z,v):
for i in range(len(T0)-1):
GDens[i+1]=(Dens[i+1]-Dens[i])/(z[i+1]-z[i])
for i in range(len(T0)):
B[i]=(((ws/Dens0)*k0)**2)*np.exp(-2*alfa*z[i])-((g/Dens0)*GDens[i])
for i in range(len(T0)):
if B[i]>0:
kz[i]=((0.05*h1)**2)*np.sqrt(B[i])+kmin
else:
kz[i]=kmin
kfinal=kz
return kfinal