def MarkovMatrixUnPas(fbin,n,p2n,lp2nm1):
- print p2n
+ #print p2n
MM = np.zeros((p2n,p2n))
# diagonal
for i in lp2nm1 :
def MarkovMatrixSaut(fbin,n,p2n,lp2nm1):
- print p2n
+ #print p2n
MM = np.zeros((p2n,p2n))
# diagonal
for i in lp2nm1 :
M = np.zeros((p2n,p2n))
np.copyto(M,MM)
- MMs = MarkovMatrixSaut(fbin,n,p2n,lp2nm1)
- Ms = np.zeros((p2n,p2n))
- np.copyto(Ms,MMs)
-
-
-
error = 1
cpt = 2
- while error > dev :
+ while error > dev and cpt < 1000:
M = np.dot(M,MM)
error =max([sqrt(sum([(M[i,j] - float(1)/p2n)**2 for i in range(p2n)])) for j in range(p2n)])
#print cpt, error, M
cpt +=1
+
+
+ """
+ MMs = MarkovMatrixSaut(fbin,n,p2n,lp2nm1)
+ Ms = np.zeros((p2n,p2n))
+ np.copyto(Ms,MMs)
error = 1
#print cpt, error, M
cpts +=1
-
-
+ """
+ cpts=1
return n, cpt-1, cpts-1
brut=[]
cpt = 0
for f in lf:
- dev = 1E-15
+ #print "cpt",cpt
+ dev = 1E-14
n,cptM,cptS = traite_f(f,dev)
brut +=[(f,cptM,cptS)]
+ cpt+=1
"""
print f, n,cptM,cptS
#print 8*n*n + 4*n*log(n+1)#,8*n*n + (n+2)*(log(n)+2)
#print "Pour "+str(n)+" bits et pour eps="+str(dev)+", appels a rand moy pr 1 bit genere.",
print cpt
- cpt+=1
+
brut.sort(cmp=compareMarche)
f,cptM,cptS = brut[0]
parser = OptionParser()
parser.add_option("-i", "--input", dest="i",
help="file of sequences")
+
(options, args) = parser.parse_args()
if (options.i != None):
rf = options.i