Ejemplo n.º 1
0
def testReducePoly_4():
    poly = MultiPower(
        np.array([[[-1, 2, 0], [0, 0, 0], [-3, 0, 0]],
                  [[0, 0, 0], [2, 0, 0], [0, 0, 0]],
                  [[0, 0, 0], [0, 0, 1], [0, 0, 0]]]))
    d1 = MultiPower(np.array([[0, -3, 0], [0, 0, 0], [1, 0, 0]]))
    d2 = MultiPower(np.array([[0, 0, 0, 1], [4, 0, 0, 0]]))
    d3 = MultiPower(np.array([[[-1, 1]]]))

    reduced = rf.reduce_poly(poly, [d1, d2, d3])
    assert (np.all(reduced.coeff == np.array([[[1], [0]], [[0], [2]]])))
Ejemplo n.º 2
0
def testReducePoly_3():
    poly = MultiPower(
        np.array([[0, -1, 0, 1], [0, 2, 0, 0], [0, 0, 1, 0], [1, 0, 0, 0]]))

    g1 = MultiPower(np.array([[0, 0, 0], [-2, 0, 0], [1, 0, 0]]))

    g2 = MultiPower(
        np.array([[0, -1, 0, 1], [3, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]]))

    reduced = rf.reduce_poly(poly, [g1, g2])
    assert (np.all(reduced.coeff == np.array([[0, 0, 0], [1, 2, 2]])))
Ejemplo n.º 3
0
def testReducePoly_2():
    poly = MultiPower(np.array([[-7],[2],[-13],[4]]))
    g = MultiPower(np.array([[-2],[3],[1]]))

    reduced = rf.reduce_poly(poly, [g])
    assert(np.all(reduced.coeff == np.array([[-57.],[85.]])))
Ejemplo n.º 4
0
def testReducePoly():
    poly = MultiPower(np.array([[-3],[2],[-4],[1]]))
    g = MultiPower(np.array([[2],[1]]))

    reduced = rf.reduce_poly(poly, [g])
    assert(reduced.coeff == np.array([[-31.]]))