Пример #1
0
    def test__get_bidegree(self):
        m, n = 3, 5
        mon_lst = SERing.get_mon_P1xP1(m, n)
        assert SERing.get_bidegree(mon_lst) == (3, 5)

        mat = SERing.random_matrix_QQ(4, len(mon_lst))
        pol_lst = list(mat * sage_vector(mon_lst))
        assert SERing.get_bidegree(pol_lst) == (3, 5)
Пример #2
0
            ))
        L = ring('[2, -1/3, -5, 1/3]')
        R = ring('[0, 10, -3, 0]')

    mon_lst = SERing.get_mon_P1xP1(d1, d2,
                                   vars='y0,y1,y2,y3')  # basis for monomials
    y = [ring('y' + str(i)) for i in range(4)]
    s = {
        y[0]: L[0] * y[0] + L[1] * y[1],
        y[1]: L[2] * y[0] + L[3] * y[1],
        y[2]: R[0] * y[2] + R[1] * y[3],
        y[3]: R[2] * y[2] + R[3] * y[3]
    }
    f = list(matf * sage_vector(mon_lst))
    g = list(matU * sage_vector([comp.subs(s) for comp in f]))
    assert set(SERing.get_bidegree(f)) == set(SERing.get_bidegree(g))
    SETools.p('case      =', case)
    SETools.p('(d1,d2,m) =', (d1, d2, m))
    SETools.p('matf      =', list(matf))
    SETools.p('matU      =', list(matU))
    SETools.p('L         =', L)
    SETools.p('R         =', R)
    SETools.p('f         =', f)
    SETools.p('g         =', g)

    ###############################################################################
    # From here on we demonstrate how to recover L, U and matU from f and g only. #
    ###############################################################################
    SETools.p('Recover (matU, L, R) from (f, g)...')

    y = [ring('y' + str(i)) for i in range(4)]