Esempio n. 1
0
	def __mul__(a,b):
		if ((a.p != b.p) or (a.q != b.q) or (a.t != b.t)):
			print "Parameter mismatch in metacyc mul"
			raise RuntimeError
		ci = (a.i + b.i * sackint.intmodexp(a.t, a.j, a.p)) % a.p
		cj = (a.j + b.j) % a.q
		c = metacyc_t(ci, cj, a.p, a.q, a.t)
		return c
Esempio n. 2
0
 def __mul__(a, b):
     if ((a.p != b.p) or (a.q != b.q) or (a.t != b.t)):
         print "Parameter mismatch in metacyc mul"
         raise RuntimeError
     ci = (a.i + b.i * sackint.intmodexp(a.t, a.j, a.p)) % a.p
     cj = (a.j + b.j) % a.q
     c = metacyc_t(ci, cj, a.p, a.q, a.t)
     return c
Esempio n. 3
0
	def __init__(self, i, j, p, q, t):

		tq = sackint.intmodexp(t, q, p)
		if ((tq % p) != 1):
			print "metacyc:  t^q must be 1 mod p"
			print "Got p =", p, "q =", q, "t =", t
			raise RuntimeError

		# xxx jrk 2006-11-28 allow trivial homomorphisms.
		#if ((t % p) == 1):
		#	print "metacyc:  t must not be 1 mod p"
		#	print "Got p =", p, "q =", q, "t =", t
		#	raise RuntimeError

		self.i = i % p
		self.j = j % q
		self.p = p
		self.q = q
		self.t = t
Esempio n. 4
0
    def __init__(self, i, j, p, q, t):

        tq = sackint.intmodexp(t, q, p)
        if ((tq % p) != 1):
            print "metacyc:  t^q must be 1 mod p"
            print "Got p =", p, "q =", q, "t =", t
            raise RuntimeError

        # xxx jrk 2006-11-28 allow trivial homomorphisms.
        #if ((t % p) == 1):
        #	print "metacyc:  t must not be 1 mod p"
        #	print "Got p =", p, "q =", q, "t =", t
        #	raise RuntimeError

        self.i = i % p
        self.j = j % q
        self.p = p
        self.q = q
        self.t = t
Esempio n. 5
0
def find_t(p, q):
	for t in range(2, p):
		if (sackint.intmodexp(t, q, p) == 1):
			return [1, t]
	return [0, 0]
Esempio n. 6
0
	def inv(a):
		ci = -a.i * sackint.intmodexp(a.t, -a.j, a.p)
		cj = -a.j
		c = metacyc_t(ci, cj, a.p, a.q, a.t)
		return c
Esempio n. 7
0
def find_t(p, q):
    for t in range(2, p):
        if (sackint.intmodexp(t, q, p) == 1):
            return [1, t]
    return [0, 0]
Esempio n. 8
0
 def inv(a):
     ci = -a.i * sackint.intmodexp(a.t, -a.j, a.p)
     cj = -a.j
     c = metacyc_t(ci, cj, a.p, a.q, a.t)
     return c