本文整理汇总了Java中edu.jas.arith.BigInteger.isONE方法的典型用法代码示例。如果您正苦于以下问题:Java BigInteger.isONE方法的具体用法?Java BigInteger.isONE怎么用?Java BigInteger.isONE使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类edu.jas.arith.BigInteger
的用法示例。
在下文中一共展示了BigInteger.isONE方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testSeparate
import edu.jas.arith.BigInteger; //导入方法依赖的package包/类
/**
* Test if b has a prime factor different to the elements of A.
* @param A list of integer with at least one different prime factor.
* @param b integer to test with A.
* @return true, if b hase a prime factor different to elements of A
*/
boolean testSeparate(List<BigInteger> A, BigInteger b) {
int i = 0;
//List<BigInteger> gei = new ArrayList<BigInteger>(A.size());
for (BigInteger c : A) {
BigInteger g = c.gcd(b).abs();
//gei.add(g);
if (!g.isONE()) {
i++;
}
}
//if ( i >= 1 ) {
//System.out.println("gei = " + gei + ", cei = " + cei + ", pec(w) = " + pec);
//}
return (i <= 1);
}
示例2: isIrreducibleEisenstein
import edu.jas.arith.BigInteger; //导入方法依赖的package包/类
/**
* GenPolynomial test if is irreducible with Eisenstein criterion.
* @param P univariate polynomial.
* @return true if P is irreducible, else false if it is unknown.
*/
public boolean isIrreducibleEisenstein(GenPolynomial<BigInteger> P) {
if (P.ring.nvar != 1) {
throw new IllegalArgumentException("only for univariate polynomials");
}
if (P.degree(0) <= 1L) { // linear or constant is irreducible
return true;
}
BigInteger rcont = engine.baseContent(P.reductum());
if (rcont.isZERO() || rcont.isONE()) { // case x**n
return false;
}
// todo test
if (rcont.compareTo(BigInteger.valueOf(PrimeInteger.BETA)) >= 0) { // integer too big
return false;
}
long lcont = rcont.getVal().longValue();
BigInteger lc = P.leadingBaseCoefficient().abs();
BigInteger tc = P.trailingBaseCoefficient().abs();
SortedMap<Long, Integer> fac = PrimeInteger.factors(lcont);
for (Long p : fac.keySet()) {
BigInteger pi = BigInteger.valueOf(p);
if (!lc.remainder(pi).isZERO() && !tc.remainder(pi.power(2)).isZERO()) {
logger.info("isIrreducibleEisenstein: fac = " + fac + ", lc = " + lc + ", tc = " + tc);
return true;
}
}
return false;
}