Beispiel #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)
Beispiel #2
0
    def test__random_matrix_QQ(self):
        m, n = 4, 9
        mat = SERing.random_matrix_QQ(m, n)
        print(mat)
        print(mat.rows())

        assert mat.nrows() == m
        assert mat.ncols() == n
        for row in mat:
            for col in row:
                assert col in sage_QQ
Beispiel #3
0
    def test__get_degree(self):
        d = 4
        mon_lst = SERing.get_mon_P2(d)
        print(mon_lst)
        out = SERing.get_degree(mon_lst)
        print(out)
        assert out == d

        mat = SERing.random_matrix_QQ(4, len(mon_lst))
        pol_lst = list(mat * sage_vector(mon_lst))
        print(pol_lst)
        out = SERing.get_degree(pol_lst)
        print(out)
        assert out == d
        If 0, then random f and g are computed.
        If 1, then a usecase of f and g of bidegree (2,2) is considered
        If 2, then a usecase of f and g of bidegree (3,3) is considered 
    '''

    ######################################################################
    # We first create random parametrizations f and g                    #
    ######################################################################

    # f is of bidegree (d1, d2) with coefficent matrix matf.
    # The image of f is a surface in P^m.
    # g is constructed as the composition U o f o P
    # where the reparametrization P: P1xP1-->P1xP1 is defined by two 2x2 matrices L and R
    # and U is defined by a 4x4 matrix.
    d1, d2, m = SERing.random_elt([2, 3]), SERing.random_elt([2, 3]), 3
    matf = SERing.random_matrix_QQ(m + 1, len(SERing.get_mon_P1xP1(d1, d2)))
    matU = SERing.random_inv_matrix_QQ(m + 1)
    L = SERing.random_inv_matrix_QQ(2).list()
    R = SERing.random_inv_matrix_QQ(2).list()

    if case == 1:
        d1, d2, m = 2, 2, 3
        matf = sage_matrix(
            sage_QQ,
            ring(
                '[(3/5, 87, -1/2, 1/4, 0, 1/8, 16/5, 0, 0), (0, 11, -1/9, 44, 0, 0, -1, 0, 1/3), (1/12, -4, 0, 2, -1, 1/4, 0, -3, -1/9), (1/3, 1/4, 1, -4, 1/2, -1, -6, 2, 22)]'
            ))
        matU = sage_matrix(
            sage_QQ,
            ring(
                '[( 1, 0, -1, -3 ), ( -1 / 18, -3, 0, 15 / 2 ), ( -1, 0, 13, 1 ), ( -3, -1 / 11, -2, 3 / 23 )]'