예제 #1
0
def compare_accuracy(i, j, k):
    mr_errors = []
    ss_errors = []
    fpt_errors = []
    for n in range(i, j):
        ans = prime.isPrime_par(n)
        if prime.mr(n, k) != ans:
            mr_errors.append(n)
        if prime.ss(n, k) != ans:
            ss_errors.append(n)
        if prime.fpt(n, k) != ans:
            fpt_errors.append(n)

    errors = (len(mr_errors), len(ss_errors), len(fpt_errors))
    #print errors
    #print mr_errors
    #print ss_errors
    #print fpt_errors
    #_,ax = plot.subplots()
    #ax.set_title('Error Histrogram with k=' + str(k))
    #ax.set_ylabel('#errors')
    #ax.set_ylim([0,50])
    #ax.bar(range(0,3), errors, 0.5, color={'r','g','b'})
    #ax.set_xticks(numpy.arange(3)+0.5/2)
    #ax.set_xticklabels(('MR', 'SS', 'FPT'))
    #plot.show()
    return errors
예제 #2
0
def compare_accuracy(i, j, k):
	mr_errors	= []
	ss_errors	= []
	fpt_errors	= []
	for n in range(i,j):
		ans	= prime.isPrime_par(n)	
		if  prime.mr(n,k) != ans:		
			mr_errors.append(n)
		if prime.ss(n,k) != ans:
			ss_errors.append(n)
		if prime.fpt(n,k) != ans:
			fpt_errors.append(n)
	
	errors = (len(mr_errors), len(ss_errors), len(fpt_errors))
	#print errors
	#print mr_errors	
	#print ss_errors
	#print fpt_errors
	#_,ax = plot.subplots()
	#ax.set_title('Error Histrogram with k=' + str(k))
	#ax.set_ylabel('#errors')
	#ax.set_ylim([0,50])
	#ax.bar(range(0,3), errors, 0.5, color={'r','g','b'})
	#ax.set_xticks(numpy.arange(3)+0.5/2)
	#ax.set_xticklabels(('MR', 'SS', 'FPT'))
	#plot.show() 
	return errors
예제 #3
0
def fpt_accuracy(i, j, k):
    fpt_errors = []
    for n in range(i, j):
        ans = prime.isPrime_par(n)
        if prime.fpt(n, k) != ans:
            fpt_errors.append(n)

    errors = (len(fpt_errors))
    return errors
예제 #4
0
def fpt_accuracy(i, j, k):
	fpt_errors	= []
	for n in range(i,j):
		ans	= prime.isPrime_par(n)	
		if prime.fpt(n,k) != ans:
			fpt_errors.append(n)
	
	errors = (len(fpt_errors))
	return errors