当前位置: 首页>>代码示例>>Python>>正文


Python Ring.gcd方法代码示例

本文整理汇总了Python中jas.Ring.gcd方法的典型用法代码示例。如果您正苦于以下问题:Python Ring.gcd方法的具体用法?Python Ring.gcd怎么用?Python Ring.gcd使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在jas.Ring的用法示例。


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

示例1: cmp

# 需要导入模块: from jas import Ring [as 别名]
# 或者: from jas.Ring import gcd [as 别名]
print "a = ", a;
print "b = ", b;
print "c = ", c;
print "f = ", f;
print;

ac = a * c;
bc = b * c;

print "ac = ", ac;
print "bc = ", bc;
print;

t = System.currentTimeMillis();
g = r.gcd(ac,bc);
t = System.currentTimeMillis() - t;
print "g = ", g;
#print "gcd time =", t, "milliseconds";

d = r.gcd(g,c);
if cmp(c,d) == 0:
    print "gcd time =", t, "milliseconds,", "isGcd(c,d): true" ;
else:
    print "gcd time =", t, "milliseconds,", "isGcd(c,d): ",  cmp(c,d);
print;

#d = g / c;
#m = g % c;
#print "d = ", d;
#print "m = ", m;
开发者ID:rjolly,项目名称:jas,代码行数:32,代码来源:polynomial.py

示例2: str

# 需要导入模块: from jas import Ring [as 别名]
# 或者: from jas.Ring import gcd [as 别名]

print "a = ", a;
print "b = ", b;
print "c = ", c;
print;

ac = a * c;
bc = b * c;

print "ac = ", ac;
print "bc = ", bc;
print;

t = System.currentTimeMillis();
d = r.gcd(ac,bc);
t = System.currentTimeMillis() - t;

#d = d.monic();
print "d = ", d;

m = c % d;
## print "m = ", m;
## print;

if m.isZERO():
    print "gcd time =", t, "milliseconds,", "isGcd(c,d): true" ;
else:
    print "gcd time =", t, "milliseconds,", "isGcd(c,d): ",  str(m);
print;
开发者ID:,项目名称:,代码行数:31,代码来源:


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