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


Java BigInteger.ONE属性代码示例

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


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

示例1: factorBound

/**
 * Factor coefficient bound. See SACIPOL.IPFCB: the product of all maxNorms
 * of potential factors is less than or equal to 2**b times the maxNorm of
 * A.
 * @param e degree vector of a GenPolynomial A.
 * @return 2**b.
 */
public static BigInteger factorBound(ExpVector e) {
    int n = 0;
    java.math.BigInteger p = java.math.BigInteger.ONE;
    java.math.BigInteger v;
    if (e == null || e.isZERO()) {
        return BigInteger.ONE;
    }
    for (int i = 0; i < e.length(); i++) {
        if (e.getVal(i) > 0) {
            n += (2 * e.getVal(i) - 1);
            v = new java.math.BigInteger("" + (e.getVal(i) - 1));
            p = p.multiply(v);
        }
    }
    n += (p.bitCount() + 1); // log2(p)
    n /= 2;
    v = new java.math.BigInteger("" + 2);
    v = v.shiftLeft(n);
    BigInteger N = new BigInteger(v);
    return N;
}
 
开发者ID:kredel,项目名称:java-algebra-system,代码行数:28,代码来源:PolyUtil.java

示例2: FactorInteger

/**
 * No argument constructor.
 */
public FactorInteger() {
    this(BigInteger.ONE);
}
 
开发者ID:kredel,项目名称:java-algebra-system,代码行数:6,代码来源:FactorInteger.java

示例3: baseFactorsSquarefree

/**
 * GenPolynomial base factorization of a squarefree polynomial.
 * @param P squarefree GenPolynomial.
 * @return [p_1,...,p_k] with P = prod_{i=1, ..., k} p_i.
 */
@Override
public List<GenPolynomial<BigRational>> baseFactorsSquarefree(GenPolynomial<BigRational> P) {
    if (P == null) {
        throw new IllegalArgumentException(this.getClass().getName() + " P == null");
    }
    List<GenPolynomial<BigRational>> factors = new ArrayList<GenPolynomial<BigRational>>();
    if (P.isZERO()) {
        return factors;
    }
    if (P.isONE()) {
        factors.add(P);
        return factors;
    }
    GenPolynomialRing<BigRational> pfac = P.ring;
    if (pfac.nvar > 1) {
        throw new IllegalArgumentException(this.getClass().getName() + " only for univariate polynomials");
    }
    GenPolynomial<BigRational> Pr = P;
    BigRational ldcf = P.leadingBaseCoefficient();
    if (!ldcf.isONE()) {
        //System.out.println("ldcf = " + ldcf);
        Pr = Pr.monic();
    }
    BigInteger bi = BigInteger.ONE;
    GenPolynomialRing<BigInteger> ifac = new GenPolynomialRing<BigInteger>(bi, pfac);
    GenPolynomial<BigInteger> Pi = PolyUtil.integerFromRationalCoefficients(ifac, Pr);
    if (debug) {
        logger.info("Pi = " + Pi);
    }
    List<GenPolynomial<BigInteger>> ifacts = iengine.baseFactorsSquarefree(Pi);
    if (logger.isInfoEnabled()) {
        logger.info("ifacts = " + ifacts);
    }
    if (ifacts.size() <= 1) {
        factors.add(P);
        return factors;
    }
    List<GenPolynomial<BigRational>> rfacts = PolyUtil.fromIntegerCoefficients(pfac, ifacts);
    //System.out.println("rfacts = " + rfacts);
    rfacts = PolyUtil.monic(rfacts);
    //System.out.println("rfacts = " + rfacts);
    if (!ldcf.isONE()) {
        GenPolynomial<BigRational> r = rfacts.get(0);
        rfacts.remove(r);
        r = r.multiply(ldcf);
        rfacts.set(0, r);
    }
    if (logger.isInfoEnabled()) {
        logger.info("rfacts = " + rfacts);
    }
    factors.addAll(rfacts);
    return factors;
}
 
开发者ID:kredel,项目名称:java-algebra-system,代码行数:58,代码来源:FactorRational.java

示例4: factorsSquarefree

/**
 * GenPolynomial factorization of a squarefree polynomial.
 * @param P squarefree GenPolynomial.
 * @return [p_1,...,p_k] with P = prod_{i=1, ..., k} p_i.
 */
@Override
public List<GenPolynomial<BigRational>> factorsSquarefree(GenPolynomial<BigRational> P) {
    if (P == null) {
        throw new IllegalArgumentException(this.getClass().getName() + " P == null");
    }
    List<GenPolynomial<BigRational>> factors = new ArrayList<GenPolynomial<BigRational>>();
    if (P.isZERO()) {
        return factors;
    }
    if (P.isONE()) {
        factors.add(P);
        return factors;
    }
    GenPolynomialRing<BigRational> pfac = P.ring;
    if (pfac.nvar == 1) {
        return baseFactorsSquarefree(P);
    }
    GenPolynomial<BigRational> Pr = P;
    BigRational ldcf = P.leadingBaseCoefficient();
    if (!ldcf.isONE()) {
        //System.out.println("ldcf = " + ldcf);
        Pr = Pr.monic();
    }
    BigInteger bi = BigInteger.ONE;
    GenPolynomialRing<BigInteger> ifac = new GenPolynomialRing<BigInteger>(bi, pfac);
    GenPolynomial<BigInteger> Pi = PolyUtil.integerFromRationalCoefficients(ifac, Pr);
    if (debug) {
        logger.info("Pi = " + Pi);
    }
    List<GenPolynomial<BigInteger>> ifacts = iengine.factorsSquarefree(Pi);
    if (logger.isInfoEnabled()) {
        logger.info("ifacts = " + ifacts);
    }
    if (ifacts.size() <= 1) {
        factors.add(P);
        return factors;
    }
    List<GenPolynomial<BigRational>> rfacts = PolyUtil.fromIntegerCoefficients(pfac, ifacts);
    //System.out.println("rfacts = " + rfacts);
    rfacts = PolyUtil.monic(rfacts);
    //System.out.println("rfacts = " + rfacts);
    if (!ldcf.isONE()) {
        GenPolynomial<BigRational> r = rfacts.get(0);
        rfacts.remove(r);
        r = r.multiply(ldcf);
        rfacts.set(0, r);
    }
    if (logger.isInfoEnabled()) {
        logger.info("rfacts = " + rfacts);
    }
    factors.addAll(rfacts);
    return factors;
}
 
开发者ID:kredel,项目名称:java-algebra-system,代码行数:58,代码来源:FactorRational.java


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