Example #1
0
def gen_irreducible_Z_polys(n):
    polys = [] 
    for i in range(n):
        k = i // 2 + 1
        if i % 2 == 1:
            k = -k
        polys.append(cratylus.poly_from_var('x', modulo=0) + cratylus.poly_from_constant(k, modulo=0))
    return polys
Example #2
0
def gen_words(n):
    fn = os.path.join(os.path.dirname(__file__), 'words.txt')
    f = file(fn, 'r')
    ls = f.readlines()
    f.close()
    random.shuffle(ls)
    for i in range(n):
        yield cratylus.poly_from_var(ls[i].strip(' \t\r\n'), modulo=0)
Example #3
0
def gen_compact_vars(n):
    res = []
    i = 0
    for x in alphanumeric_identifiers():
        if i == n: break
        res.append(cratylus.poly_from_var(x, modulo=0))
        i += 1
    return res
Example #4
0
def gen_words(n):
    fn = os.path.join(os.path.dirname(__file__), 'words.txt')
    f = file(fn, 'r')
    ls = f.readlines()
    f.close()
    random.shuffle(ls)
    for i in range(n):
        yield cratylus.poly_from_var(ls[i].strip(' \t\r\n'), modulo=0)
Example #5
0
def gen_compact_vars(n):
    res = []
    i = 0
    for x in alphanumeric_identifiers():
        if i == n: break
        res.append(cratylus.poly_from_var(x, modulo=0))
        i += 1
    return res
Example #6
0
def gen_irreducible_Z_polys(n):
    polys = []
    for i in range(n):
        k = i // 2 + 1
        if i % 2 == 1:
            k = -k
        polys.append(
            cratylus.poly_from_var('x', modulo=0) +
            cratylus.poly_from_constant(k, modulo=0))
    return polys