def calMinTheta(M):
vecContainZero=False
zeroCount=0
Mtrans_T=np.dot(M.T,M)
u,s,v=np.linalg.svd(Mtrans_T)
eigenValue=s[-1]
minVec=v[-1,:]
for i in minVec:
if np.fabs(i) < (1e-3):
zeroCount+=1
if zeroCount!=0:
print("0 exits and discard the following vector: ")
vecContainZero=True
print(minVec)
return minVec.T,vecContainZero
#scale the returned eigenVector of float into integer and check whether the scaled theta is valid(satisfy the threshold)
#if valid, return True and the valid eigenVector, if not valid, return False and empty eigenVector
评论列表
文章目录