コード例 #1
0
ファイル: test_ntheory.py プロジェクト: skirpichev/diofant
def test_crt():
    def mcrt(m, v, r, symmetric=False):
        assert crt(m, v, symmetric)[0] == r
        mm, e, s = crt1(m)
        assert crt2(m, v, mm, e, s, symmetric) == (r, mm)

    mcrt([2, 3, 5], [0, 0, 0], 0)
    mcrt([2, 3, 5], [1, 1, 1], 1)

    mcrt([2, 3, 5], [-1, -1, -1], -1, True)
    mcrt([2, 3, 5], [-1, -1, -1], 2*3*5 - 1, False)

    assert crt([656, 350], [811, 133], symmetric=True) == (-56917, 114800)
    assert crt([12, 6, 17], [3, 4, 2]) is None
コード例 #2
0
def test_crt():
    def mcrt(m, v, r, symmetric=False):
        assert crt(m, v, symmetric)[0] == r
        mm, e, s = crt1(m)
        assert crt2(m, v, mm, e, s, symmetric) == (r, mm)

    mcrt([2, 3, 5], [0, 0, 0], 0)
    mcrt([2, 3, 5], [1, 1, 1], 1)

    mcrt([2, 3, 5], [-1, -1, -1], -1, True)
    mcrt([2, 3, 5], [-1, -1, -1], 2*3*5 - 1, False)

    mcrt([99, 97, 95], [49, 76, 65], 639985)

    assert crt([656, 350], [811, 133], symmetric=True) == (-56917, 114800)
    assert crt([12, 6, 17], [3, 4, 2]) is None
コード例 #3
0
ファイル: test_ntheory.py プロジェクト: Blendify/diofant
def test_crt():
    def mcrt(m, v, r, symmetric=False):
        assert crt(m, v, symmetric)[0] == r
        mm, e, s = crt1(m)
        assert crt2(m, v, mm, e, s, symmetric) == (r, mm)

    mcrt([2, 3, 5], [0, 0, 0], 0)
    mcrt([2, 3, 5], [1, 1, 1], 1)

    mcrt([2, 3, 5], [-1, -1, -1], -1, True)
    mcrt([2, 3, 5], [-1, -1, -1], 2 * 3 * 5 - 1, False)

    assert crt([656, 350], [811, 133], symmetric=True) == (-56917, 114800)
コード例 #4
0
 def mcrt(m, v, r, symmetric=False):
     assert crt(m, v, symmetric)[0] == r
     mm, e, s = crt1(m)
     assert crt2(m, v, mm, e, s, symmetric) == (r, mm)
コード例 #5
0
ファイル: test_ntheory.py プロジェクト: skirpichev/diofant
 def mcrt(m, v, r, symmetric=False):
     assert crt(m, v, symmetric)[0] == r
     mm, e, s = crt1(m)
     assert crt2(m, v, mm, e, s, symmetric) == (r, mm)