• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python polyconfig.setup函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中sympy.polys.polyconfig.setup函数的典型用法代码示例。如果您正苦于以下问题:Python setup函数的具体用法?Python setup怎么用?Python setup使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了setup函数的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: test_benchmark_czichowski

def test_benchmark_czichowski():
    skip('This takes too much time (without gmpy)')

    config.setup('GB_METHOD', 'f5b')
    helper_test_benchmark_czichowski()
    config.setup('GB_METHOD', 'buchberger')
    helper_test_benchmark_czichowski()
开发者ID:aeberspaecher,项目名称:sympy,代码行数:7,代码来源:test_groebnertools.py


示例2: test_gf_irreducible_p

def test_gf_irreducible_p():
    assert gf_irred_p_ben_or([7], 11, ZZ) == True
    assert gf_irred_p_ben_or([7,3], 11, ZZ) == True
    assert gf_irred_p_ben_or([7,3,1], 11, ZZ) == False

    assert gf_irred_p_rabin([7], 11, ZZ) == True
    assert gf_irred_p_rabin([7,3], 11, ZZ) == True
    assert gf_irred_p_rabin([7,3,1], 11, ZZ) == False

    config.setup('GF_IRRED_METHOD', 'ben-or')

    assert gf_irreducible_p([7], 11, ZZ) == True
    assert gf_irreducible_p([7,3], 11, ZZ) == True
    assert gf_irreducible_p([7,3,1], 11, ZZ) == False

    config.setup('GF_IRRED_METHOD', 'rabin')

    assert gf_irreducible_p([7], 11, ZZ) == True
    assert gf_irreducible_p([7,3], 11, ZZ) == True
    assert gf_irreducible_p([7,3,1], 11, ZZ) == False

    config.setup('GF_IRRED_METHOD', 'other')
    raises(KeyError, lambda: gf_irreducible_p([7], 11, ZZ))
    config.setup('GF_IRRED_METHOD')

    f = [1, 9,  9, 13, 16, 15,  6,  7,  7,  7, 10]
    g = [1, 7, 16,  7, 15, 13, 13, 11, 16, 10,  9]

    h = gf_mul(f, g, 17, ZZ)

    assert gf_irred_p_ben_or(f, 17, ZZ) == True
    assert gf_irred_p_ben_or(g, 17, ZZ) == True

    assert gf_irred_p_ben_or(h, 17, ZZ) == False

    assert gf_irred_p_rabin(f, 17, ZZ) == True
    assert gf_irred_p_rabin(g, 17, ZZ) == True

    assert gf_irred_p_rabin(h, 17, ZZ) == False
开发者ID:BDGLunde,项目名称:sympy,代码行数:39,代码来源:test_galoistools.py


示例3: test_gf_factor

def test_gf_factor():
    assert gf_factor([], 11, ZZ) == (0, [])
    assert gf_factor([1], 11, ZZ) == (1, [])
    assert gf_factor([1,1], 11, ZZ) == (1, [([1, 1], 1)])

    assert gf_factor_sqf([], 11, ZZ) == (0, [])
    assert gf_factor_sqf([1], 11, ZZ) == (1, [])
    assert gf_factor_sqf([1,1], 11, ZZ) == (1, [[1, 1]])

    config.setup('GF_FACTOR_METHOD', 'berlekamp')

    assert gf_factor_sqf([], 11, ZZ) == (0, [])
    assert gf_factor_sqf([1], 11, ZZ) == (1, [])
    assert gf_factor_sqf([1,1], 11, ZZ) == (1, [[1, 1]])

    config.setup('GF_FACTOR_METHOD', 'zassenhaus')

    assert gf_factor_sqf([], 11, ZZ) == (0, [])
    assert gf_factor_sqf([1], 11, ZZ) == (1, [])
    assert gf_factor_sqf([1,1], 11, ZZ) == (1, [[1, 1]])

    config.setup('GF_FACTOR_METHOD', 'shoup')

    assert gf_factor_sqf([], 11, ZZ) == (0, [])
    assert gf_factor_sqf([1], 11, ZZ) == (1, [])
    assert gf_factor_sqf([1,1], 11, ZZ) == (1, [[1, 1]])

    f, p = [1,0,0,1,0], 2

    g = (1, [([1, 0], 1),
             ([1, 1], 1),
             ([1, 1, 1], 1)])

    config.setup('GF_FACTOR_METHOD', 'berlekamp')
    assert gf_factor(f, p, ZZ) == g

    config.setup('GF_FACTOR_METHOD', 'zassenhaus')
    assert gf_factor(f, p, ZZ) == g

    config.setup('GF_FACTOR_METHOD', 'shoup')
    assert gf_factor(f, p, ZZ) == g

    g = (1, [[1, 0],
             [1, 1],
             [1, 1, 1]])

    config.setup('GF_FACTOR_METHOD', 'berlekamp')
    assert gf_factor_sqf(f, p, ZZ) == g

    config.setup('GF_FACTOR_METHOD', 'zassenhaus')
    assert gf_factor_sqf(f, p, ZZ) == g

    config.setup('GF_FACTOR_METHOD', 'shoup')
    assert gf_factor_sqf(f, p, ZZ) == g

    f, p = gf_from_int_poly([1,-3,1,-3,-1,-3,1], 11), 11

    g = (1, [([1, 1], 1),
             ([1, 5, 3], 1),
             ([1, 2, 3, 4], 1)])

    config.setup('GF_FACTOR_METHOD', 'berlekamp')
    assert gf_factor(f, p, ZZ) == g

    config.setup('GF_FACTOR_METHOD', 'zassenhaus')
    assert gf_factor(f, p, ZZ) == g

    config.setup('GF_FACTOR_METHOD', 'shoup')
    assert gf_factor(f, p, ZZ) == g

    f, p = [1, 5, 8, 4], 11

    g = (1, [([1, 1], 1), ([1, 2], 2)])

    config.setup('GF_FACTOR_METHOD', 'berlekamp')
    assert gf_factor(f, p, ZZ) == g

    config.setup('GF_FACTOR_METHOD', 'zassenhaus')
    assert gf_factor(f, p, ZZ) == g

    config.setup('GF_FACTOR_METHOD', 'shoup')
    assert gf_factor(f, p, ZZ) == g

    f, p = [1, 1, 10, 1, 0, 10, 10, 10, 0, 0], 11

    g = (1, [([1, 0], 2), ([1, 9, 5], 1), ([1, 3, 0, 8, 5, 2], 1)])

    config.setup('GF_FACTOR_METHOD', 'berlekamp')
    assert gf_factor(f, p, ZZ) == g

    config.setup('GF_FACTOR_METHOD', 'zassenhaus')
    assert gf_factor(f, p, ZZ) == g

    config.setup('GF_FACTOR_METHOD', 'shoup')
    assert gf_factor(f, p, ZZ) == g

    f, p = gf_from_dict({32: 1, 0: 1}, 11, ZZ), 11

    g = (1, [([1, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 10], 1),
             ([1, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 10], 1)])
#.........这里部分代码省略.........
开发者ID:BDGLunde,项目名称:sympy,代码行数:101,代码来源:test_galoistools.py


示例4: test_dup_zz_factor

def test_dup_zz_factor():
    R, x = ring("x", ZZ)

    assert R.dup_zz_factor(0) == (0, [])
    assert R.dup_zz_factor(7) == (7, [])
    assert R.dup_zz_factor(-7) == (-7, [])

    assert R.dup_zz_factor_sqf(0) == (0, [])
    assert R.dup_zz_factor_sqf(7) == (7, [])
    assert R.dup_zz_factor_sqf(-7) == (-7, [])

    assert R.dup_zz_factor(2*x + 4) == (2, [(x + 2, 1)])
    assert R.dup_zz_factor_sqf(2*x + 4) == (2, [x + 2])

    f = x**4 + x + 1

    for i in xrange(0, 20):
        assert R.dup_zz_factor(f) == (1, [(f, 1)])

    assert R.dup_zz_factor(x**2 + 2*x + 2) == \
        (1, [(x**2 + 2*x + 2, 1)])

    assert R.dup_zz_factor(18*x**2 + 12*x + 2) == \
        (2, [(3*x + 1, 2)])

    assert R.dup_zz_factor(-9*x**2 + 1) == \
        (-1, [(3*x - 1, 1),
              (3*x + 1, 1)])

    assert R.dup_zz_factor_sqf(-9*x**2 + 1) == \
        (-1, [3*x - 1,
              3*x + 1])

    assert R.dup_zz_factor(x**3 - 6*x**2 + 11*x - 6) == \
        (1, [(x - 3, 1),
             (x - 2, 1),
             (x - 1, 1)])

    assert R.dup_zz_factor_sqf(x**3 - 6*x**2 + 11*x - 6) == \
        (1, [x - 3,
             x - 2,
             x - 1])

    assert R.dup_zz_factor(3*x**3 + 10*x**2 + 13*x + 10) == \
        (1, [(x + 2, 1),
             (3*x**2 + 4*x + 5, 1)])

    assert R.dup_zz_factor_sqf(3*x**3 + 10*x**2 + 13*x + 10) == \
        (1, [x + 2,
             3*x**2 + 4*x + 5])

    assert R.dup_zz_factor(-x**6 + x**2) == \
        (-1, [(x - 1, 1),
              (x + 1, 1),
              (x, 2),
              (x**2 + 1, 1)])

    f = 1080*x**8 + 5184*x**7 + 2099*x**6 + 744*x**5 + 2736*x**4 - 648*x**3 + 129*x**2 - 324

    assert R.dup_zz_factor(f) == \
        (1, [(5*x**4 + 24*x**3 + 9*x**2 + 12, 1),
             (216*x**4 + 31*x**2 - 27, 1)])

    f = -29802322387695312500000000000000000000*x**25 \
      + 2980232238769531250000000000000000*x**20 \
      + 1743435859680175781250000000000*x**15 \
      + 114142894744873046875000000*x**10 \
      - 210106372833251953125*x**5 \
      + 95367431640625

    assert R.dup_zz_factor(f) == \
        (-95367431640625, [(5*x - 1, 1),
                           (100*x**2 + 10*x - 1, 2),
                           (625*x**4 + 125*x**3 + 25*x**2 + 5*x + 1, 1),
                           (10000*x**4 - 3000*x**3 + 400*x**2 - 20*x + 1, 2),
                           (10000*x**4 + 2000*x**3 + 400*x**2 + 30*x + 1, 2)])

    f = x**10 - 1

    config.setup('USE_CYCLOTOMIC_FACTOR', True)
    F_0 = R.dup_zz_factor(f)

    config.setup('USE_CYCLOTOMIC_FACTOR', False)
    F_1 = R.dup_zz_factor(f)

    assert F_0 == F_1 == \
        (1, [(x - 1, 1),
             (x + 1, 1),
             (x**4 - x**3 + x**2 - x + 1, 1),
             (x**4 + x**3 + x**2 + x + 1, 1)])

    config.setup('USE_CYCLOTOMIC_FACTOR')

    f = x**10 + 1

    config.setup('USE_CYCLOTOMIC_FACTOR', True)
    F_0 = R.dup_zz_factor(f)

    config.setup('USE_CYCLOTOMIC_FACTOR', False)
    F_1 = R.dup_zz_factor(f)
#.........这里部分代码省略.........
开发者ID:B-Rich,项目名称:sympy,代码行数:101,代码来源:test_factortools.py


示例5: test_benchmark_cyclic_4

def test_benchmark_cyclic_4():
    config.setup('GB_METHOD', 'f5b')
    helper_test_benchmark_cyclic_4()
    config.setup('GB_METHOD', 'buchberger')
    helper_test_benchmark_cyclic_4()
开发者ID:aeberspaecher,项目名称:sympy,代码行数:5,代码来源:test_groebnertools.py


示例6: test_benchmark_kastura_4

def test_benchmark_kastura_4():
    config.setup('GB_METHOD', 'f5b')
    helper_test_benchmark_katsura_4()
    config.setup('GB_METHOD', 'buchberger')
    helper_test_benchmark_katsura_4()
开发者ID:aeberspaecher,项目名称:sympy,代码行数:5,代码来源:test_groebnertools.py


示例7: test_benchmark_minpoly

def test_benchmark_minpoly():
    config.setup('GB_METHOD', 'f5b')
    helper_test_benchmark_minpoly()
    config.setup('GB_METHOD', 'buchberger')
    helper_test_benchmark_minpoly()
开发者ID:aeberspaecher,项目名称:sympy,代码行数:5,代码来源:test_groebnertools.py


示例8: test_sdp_groebner

def test_sdp_groebner():
    config.setup('GB_METHOD', 'f5b')
    helper_test_sdp_groebner()
    config.setup('GB_METHOD', 'buchberger')
    helper_test_sdp_groebner()
开发者ID:aeberspaecher,项目名称:sympy,代码行数:5,代码来源:test_groebnertools.py


示例9: test_dup_zz_factor

def test_dup_zz_factor():
    assert dup_zz_factor([], ZZ) == (0, [])
    assert dup_zz_factor([7], ZZ) == (7, [])
    assert dup_zz_factor([-7], ZZ) == (-7, [])

    assert dup_zz_factor_sqf([], ZZ) == (0, [])
    assert dup_zz_factor_sqf([7], ZZ) == (7, [])
    assert dup_zz_factor_sqf([-7], ZZ) == (-7, [])

    assert dup_zz_factor([2,4], ZZ) == \
        (2, [([1, 2], 1)])
    assert dup_zz_factor_sqf([2,4], ZZ) == \
        (2, [([1, 2], 1)])

    f = [1,0,0,1,1]

    for i in xrange(0, 20):
        assert dup_zz_factor(f, ZZ) == (1, [(f, 1)])

    assert dup_zz_factor([1,2,2], ZZ) == \
        (1, [([1,2,2], 1)])

    assert dup_zz_factor([18,12,2], ZZ) == \
        (2, [([3, 1], 2)])

    assert dup_zz_factor([-9,0,1], ZZ) == \
        (-1, [([3,-1], 1),
              ([3, 1], 1)])

    assert dup_zz_factor_sqf([-9,0,1], ZZ) == \
        (-1, [[3,-1],
              [3, 1]])

    assert dup_zz_factor([1,-6,11,-6], ZZ) == \
        (1, [([1,-3], 1),
             ([1,-2], 1),
             ([1,-1], 1)])

    assert dup_zz_factor_sqf([1,-6,11,-6], ZZ) == \
        (1, [[1,-3],
             [1,-2],
             [1,-1]])

    assert dup_zz_factor([3,10,13,10], ZZ) == \
        (1, [([1,2], 1),
             ([3,4,5], 1)])

    assert dup_zz_factor_sqf([3,10,13,10], ZZ) == \
        (1, [[1,2],
             [3,4,5]])

    assert dup_zz_factor([-1,0,0,0,1,0,0], ZZ) == \
        (-1, [([1,-1], 1),
              ([1, 1], 1),
              ([1, 0], 2),
              ([1, 0, 1], 1)])

    f = [1080, 5184, 2099, 744, 2736, -648, 129, 0, -324]

    assert dup_zz_factor(f, ZZ) == \
        (1, [([5, 24, 9, 0, 12], 1),
             ([216, 0, 31, 0, -27], 1)])

    f = [-29802322387695312500000000000000000000,
          0, 0, 0, 0,
          2980232238769531250000000000000000,
          0, 0, 0, 0,
          1743435859680175781250000000000,
          0, 0, 0, 0,
          114142894744873046875000000,
          0, 0, 0, 0,
          -210106372833251953125,
          0, 0, 0, 0,
          95367431640625]

    assert dup_zz_factor(f, ZZ) == \
        (-95367431640625, [([5, -1], 1),
                           ([100, 10, -1], 2),
                           ([625, 125, 25, 5, 1], 1),
                           ([10000, -3000, 400, -20, 1], 2),
                           ([10000,  2000, 400,  30, 1], 2)])

    f = dup_from_raw_dict({10:1, 0:-1}, ZZ)

    config.setup('USE_CYCLOTOMIC_FACTOR', True)
    F_0 = dup_zz_factor(f, ZZ)

    config.setup('USE_CYCLOTOMIC_FACTOR', False)
    F_1 = dup_zz_factor(f, ZZ)

    assert F_0 == F_1 == \
        (1, [([1,-1], 1),
             ([1, 1], 1),
             ([1,-1, 1,-1, 1], 1),
             ([1, 1, 1, 1, 1], 1)])

    config.setup('USE_CYCLOTOMIC_FACTOR')

    f = dup_from_raw_dict({10:1, 0:1}, ZZ)

#.........这里部分代码省略.........
开发者ID:ENuge,项目名称:sympy,代码行数:101,代码来源:test_factortools.py


示例10: test_benchmark_katsura3

def test_benchmark_katsura3():
    setup('GB_METHOD', 'f5b')
    helper_test_benchmark_katsura_3()
    setup('GB_METHOD', 'buchberger')
    helper_test_benchmark_katsura_3()
开发者ID:101man,项目名称:sympy,代码行数:5,代码来源:test_groebnertools.py


示例11: test_benchmark_katsura3

def test_benchmark_katsura3():
    config.setup('GB_METHOD', 'f5b')
    _test_benchmark_katsura_3()
    config.setup('GB_METHOD', 'buchberger')
    _test_benchmark_katsura_3()
开发者ID:FireJade,项目名称:sympy,代码行数:5,代码来源:test_groebnertools.py



注:本文中的sympy.polys.polyconfig.setup函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python polyconfig.using函数代码示例发布时间:2022-05-27
下一篇:
Python polyconfig.query函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap