Ejemplo 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
Ejemplo 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
Ejemplo 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
Ejemplo 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
Ejemplo 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]
Ejemplo 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
Ejemplo 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]
Ejemplo 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