コード例 #1
0
def find_in_G_x0(w):
    global err_in_g_x0_py
    g1i = np.zeros(11, dtype = np.uint32)

    if mm_op15_norm_A(w) != ORDER_TAGS[OFS_NORM_A]:
        err_in_g_x0_py = 1
        return None        
    w3 = mm_op15_eval_A_rank_mod3(w, ORDER_TAGS[OFS_DIAG_VA])
    w3 &= 0xffffffffffff
    if w3 == 0: 
        err_in_g_x0_py = 2
        return None
    w_type4 = gen_leech3to2_type4(w3)
    if w_type4 == 0: 
        err_in_g_x0_py = 3
        return None
    wA = np.array(w[:2*24], copy = True)
    len_g1 = gen_leech2_reduce_type4(w_type4, g1i)
    assert 0 <= len_g1 <= 6 
    res = mm_op15_word_tag_A(wA, g1i, len_g1, 1)
    assert res == 0
    perm_num = mm_op15_watermark_A_perm_num(
        ORDER_TAGS[OFS_WATERMARK_PERM:], wA)
    if perm_num < 0: 
        err_in_g_x0_py = 4
        return None
    if perm_num > 0:
        g1i[len_g1] = 0xA0000000 + perm_num 
        res = mm_op15_word_tag_A(wA, g1i[len_g1:], 1, 1)
        assert res  == 0
        len_g1 += 1
    v_y = mm_aux_mmv_extract_sparse_signs(15, wA, 
        ORDER_TAGS[OFS_TAGS_Y:], 11)
    if v_y < 0:
        err_in_g_x0_py = 5
        return None
    y = leech2matrix_solve_eqn(ORDER_TAGS[OFS_SOLVE_Y:], 11, v_y)
    if y > 0:
        g1i[len_g1] = 0xC0000000 + y
        res = mm_op15_word_tag_A(wA, g1i[len_g1:], 1, 1)
        assert res  == 0
        len_g1 += 1
    if (wA != ORDER_VECTOR[:2*24]).all():
        err_in_g_x0_py = 6
        return None
    #print("g1i", g1i[:len_g1])
    return g1i[:len_g1]
コード例 #2
0
def get_axes():
    global AXES
    if len(AXES):
        return AXES
    for i, g1 in enumerate(sample_axes.g_strings):
        g2 = sample_axes.g_beautifiers[i]
        g = MM0(g1) * MM0(g2)
        g_class = sample_axes.g_classes[i]
        axis = Axis(g, g_class)
        axis.mark = sample_axes.g_marks[i]
        axis.group = sample_axes.groups[i]
        axis.powers = sample_axes.powers[i]
        axis.stage = sample_axes.g_stages[i]
        axis.v15 = v_axis15 * MM0(sample_axes.g_strings[i])
        axis.norm15 = mm_op15_norm_A(axis.v15.data)
        AXES[g_class] = axis
    return AXES
コード例 #3
0
def norm_A_mod15(i):
    """Return norm(A) mod 15 for entry i in the list in sample_axes.py

    The lists in file sample_axes.py refer to a collection of 12-axes 
    of different types.
   
    """
    global norms_A_mod15
    try:
        return norms_A_mod15[i]
    except:
        norms_A_mod15 = []
        sample_axes = import_sample_axes()
        V15 = MMV(15)
        for g in sample_axes.g_strings:
            v = v_axis * MM0(g)
            norms_A_mod15.append(mm_op15_norm_A(v.data))
        return norms_A_mod15[i]
コード例 #4
0
ファイル: order_vector.py プロジェクト: Martin-Seysen/mmgroup
def make_order_tags(order_vector, tags_y, tags_x, tag_sign):
    ov = order_vector.data
    tags_y = np.array(tags_y, dtype=np.uint32)
    tags_x = np.array(tags_x, dtype=np.uint32)
    tag_sign = np.array(tag_sign, dtype=np.uint32)
    watermark_perm = np.zeros(24, dtype=np.uint32)
    ok = mm_op15_watermark_A(ov, watermark_perm)
    assert ok >= 0

    solve_yt = np.zeros(11, dtype=np.uint64)
    assert len(tags_y) == 11
    nrows = 0
    for y in tags_y:
        eqn = map_y(y)
        nrows += leech2matrix_add_eqn(solve_yt, nrows, 11, eqn)
    assert nrows == 11, nrows
    solve_y = list(bitmatrix64_t(solve_yt, 11))
    assert len(solve_y) == 11
    assert mm_aux_mmv_extract_sparse_signs(15, ov, tags_y, 11) == 0

    solve_xt = np.zeros(24, dtype=np.uint64)
    assert len(tags_x) == 24
    nrows = 0
    for i, x in enumerate(tags_x):
        eqn = map_x(x)
        nrows += leech2matrix_add_eqn(solve_xt, nrows, 24, eqn)
    assert nrows == 24, nrows
    solve_x = list(bitmatrix64_t(solve_xt, 24))

    # Concatenate computed lists to the global numpy array 'ORDER_TAGS'
    order_tags = np.array(sum(
        map(list, [[mm_op15_norm_A(ov), 0], watermark_perm, tags_y, solve_y,
                   tags_x, solve_x, tag_sign]), []),
                          dtype=np.uint32)
    assert len(order_tags) == 97, len(order_tags)
    t0 = mm_aux_mmv_extract_sparse_signs(15, ov, order_tags[OFS_TAGS_X:], 24)
    assert t0 == 0
    return order_tags