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


Java ExpVector.totalDeg方法代码示例

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


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

示例1: ecart

import edu.jas.poly.ExpVector; //导入方法依赖的package包/类
/**
 * Ecart.
 * @return ecart.
 */
public long ecart() {
    ExpVector e = orderExpVector();
    if (e == null) {
        return 0L;
    }
    long d = e.totalDeg();
    long hd = d;
    for (long i = d + 1L; i <= truncate; i++) {
        if (!homogeneousPart(i).isZERO()) {
            hd = i;
        }
    }
    //System.out.println("d = " + d + ", hd = " + hd + ", coeffCache = " + lazyCoeffs.coeffCache + ", this = " + this);
    return hd - d;
}
 
开发者ID:kredel,项目名称:java-algebra-system,代码行数:20,代码来源:MultiVarPowerSeries.java

示例2: sum

import edu.jas.poly.ExpVector; //导入方法依赖的package包/类
/**
 * Sum a another power series.
 * @param ps other power series.
 * @return this + ps.
 */
public MultiVarPowerSeries<C> sum(final MultiVarPowerSeries<C> ps) {
    //final MultiVarPowerSeries<C> ps1 = this; // method name was ambiguous in generate
    int nt = Math.min(ring.truncate, Math.max(truncate(), ps.truncate()));

    return new MultiVarPowerSeries<C>(ring, new MultiVarCoefficients<C>(ring) {


        @Override
        public C generate(ExpVector e) {
            long tdeg = e.totalDeg();
            if (lazyCoeffs.homCheck.get((int) tdeg)) {
                // generate respective homogeneous polynomial
                GenPolynomial<C> p = homogeneousPart(tdeg).sum(ps.homogeneousPart(tdeg));
                coeffCache.put(tdeg, p); // overwrite
                homCheck.set((int) tdeg);
                C c = p.coefficient(e);
                //System.out.println("c = " + c + ", e = " + e + ", tdeg = " + tdeg);
                return c;
            }
            return coefficient(e).sum(ps.coefficient(e));
        }
    }, nt);
}
 
开发者ID:kredel,项目名称:java-algebra-system,代码行数:29,代码来源:MultiVarPowerSeries.java

示例3: subtract

import edu.jas.poly.ExpVector; //导入方法依赖的package包/类
/**
 * Subtract a another power series.
 * @param ps other power series.
 * @return this - ps.
 */
public MultiVarPowerSeries<C> subtract(final MultiVarPowerSeries<C> ps) {
    //final MultiVarPowerSeries<C> ps1 = this; // method name was ambiguous in generate
    int nt = Math.min(ring.truncate, Math.max(truncate(), ps.truncate()));

    return new MultiVarPowerSeries<C>(ring, new MultiVarCoefficients<C>(ring) {


        @Override
        public C generate(ExpVector e) {
            long tdeg = e.totalDeg();
            if (lazyCoeffs.homCheck.get((int) tdeg)) {
                // generate respective homogeneous polynomial
                GenPolynomial<C> p = homogeneousPart(tdeg).subtract(ps.homogeneousPart(tdeg));
                coeffCache.put(tdeg, p); // overwrite
                homCheck.set((int) tdeg);
                C c = p.coefficient(e);
                //System.out.println("p = " + p + ", e = " + e + ", tdeg = " + tdeg);
                return c;
            }
            return coefficient(e).subtract(ps.coefficient(e));
        }
    }, nt);
}
 
开发者ID:kredel,项目名称:java-algebra-system,代码行数:29,代码来源:MultiVarPowerSeries.java

示例4: get

import edu.jas.poly.ExpVector; //导入方法依赖的package包/类
/**
 * Get cached coefficient or generate coefficient.
 * @param index of requested coefficient.
 * @return coefficient at index.
 */
public C get(ExpVector index) {
    //if (index.signum() < 0) { // better assert
    //    throw new IllegalArgumentException("negative signum not allowed " + index);
    //}
    //if (coeffCache == null) { // not possible
    //    return generate(index);
    //}
    long tdeg = index.totalDeg();
    GenPolynomial<C> p = coeffCache.get(tdeg);
    if (p == null) {
        p = pfac.getZERO().copy();
        coeffCache.put(tdeg, p);
    }
    C c = p.coefficient(index);
    if (!c.isZERO()) {
        return c;
    }
    if (homCheck.get((int) tdeg)) { // rely on p
        return c;
    }
    if (zeroCache.contains(index)) {
        return c;
    }
    C g = generate(index);
    if (g.isZERO()) {
        zeroCache.add(index);
    } else {
        p.doPutToMap(index, g);
    }
    return g;
}
 
开发者ID:kredel,项目名称:java-algebra-system,代码行数:37,代码来源:MultiVarCoefficients.java

示例5: reductum

import edu.jas.poly.ExpVector; //导入方法依赖的package包/类
/**
 * Reductum.
 * @return this - leading monomial.
 */
public MultiVarPowerSeries<C> reductum() {
    Map.Entry<ExpVector, C> m = orderMonomial();
    if (m == null) {
        return ring.getZERO();
    }
    ExpVector e = m.getKey();
    long d = e.totalDeg();
    MultiVarCoefficients<C> mc = lazyCoeffs;
    HashMap<Long, GenPolynomial<C>> cc = new HashMap<Long, GenPolynomial<C>>(mc.coeffCache);
    GenPolynomial<C> p = cc.get(d);
    if (p != null && !p.isZERO()) {
        p = p.subtract(m.getValue(), e); // p contains this term after orderMonomial()
        cc.put(d, p);
    }
    HashSet<ExpVector> z = new HashSet<ExpVector>(mc.zeroCache);
    if (!mc.homCheck.get((int) d)) {
        z.add(e);
        //System.out.println("e = " + e);
    }

    return new MultiVarPowerSeries<C>(ring, new MultiVarCoefficients<C>(mc.pfac, cc, z, mc.homCheck) {


        @Override
        public C generate(ExpVector i) {
            return coefficient(i);
        }
    });
}
 
开发者ID:kredel,项目名称:java-algebra-system,代码行数:34,代码来源:MultiVarPowerSeries.java

示例6: multiply

import edu.jas.poly.ExpVector; //导入方法依赖的package包/类
/**
 * Multiply by exponent vector and coefficient.
 * @param k shift ExpVector.
 * @param c coefficient multiplier.
 * @return new power series with coefficient(i) = old.coefficient(i-k)*c.
 */
public MultiVarPowerSeries<C> multiply(final C c, final ExpVector k) {
    if (k == null) {
        throw new IllegalArgumentException("null ExpVector not allowed");
    }
    if (k.signum() == 0) {
        return this.multiply(c);
    }
    if (c.signum() == 0) {
        return ring.getZERO();
    }
    int nt = Math.min(ring.truncate, truncate + (int) k.totalDeg());

    return new MultiVarPowerSeries<C>(ring, new MultiVarCoefficients<C>(ring) {


        @Override
        public C generate(ExpVector i) {
            ExpVector d = i.subtract(k);
            if (d.signum() < 0) {
                return ring.coFac.getZERO();
            }
            long tdegd = d.totalDeg();
            if (lazyCoeffs.homCheck.get((int) tdegd)) {
                GenPolynomial<C> p = homogeneousPart(tdegd).multiply(c, k);
                long tdegi = i.totalDeg();
                coeffCache.put(tdegi, p); // overwrite
                homCheck.set((int) tdegi);
                C b = p.coefficient(i);
                //System.out.println("b = " + b + ", i = " + i + ", tdegi = " + tdegi+ ", tdegd = " + tdegd);
                //System.out.println("p = " + p + ", i = " + i);
                return b;
            }
            return coefficient(d).multiply(c);
        }
    }, nt);
}
 
开发者ID:kredel,项目名称:java-algebra-system,代码行数:43,代码来源:MultiVarPowerSeries.java

示例7: order

import edu.jas.poly.ExpVector; //导入方法依赖的package包/类
/**
 * Order.
 * @return index of first non zero coefficient.
 */
public int order() {
    if (order >= 0) {
        return order;
    }
    // must compute it
    GenPolynomial<C> p = null;
    int t = 0;
    while (lazyCoeffs.homCheck.get(t)) {
        p = lazyCoeffs.coeffCache.get((long) t);
        if (p == null || p.isZERO()) { // ??
            t++;
            continue;
        }
        order = t;
        evorder = p.trailingExpVector();
        //System.out.println("order = " + t);
        return order;
    }
    for (ExpVector i : new ExpVectorIterable(ring.nvar, true, truncate)) {
        if (!coefficient(i).isZERO()) {
            order = (int) i.totalDeg(); //ord;
            evorder = i;
            //System.out.println("order = " + order + ", evorder = " + evorder);
            return order;
        }
    }
    order = truncate + 1;
    // evorder is null
    return order;
}
 
开发者ID:kredel,项目名称:java-algebra-system,代码行数:35,代码来源:MultiVarPowerSeries.java

示例8: inverse

import edu.jas.poly.ExpVector; //导入方法依赖的package包/类
/**
 * Inverse power series.
 * @return ps with this * ps = 1.
 */
public MultiVarPowerSeries<C> inverse() {
    return new MultiVarPowerSeries<C>(ring, new MultiVarCoefficients<C>(ring) {


        @Override
        public C generate(ExpVector e) {
            long tdeg = e.totalDeg();
            C d = leadingCoefficient().inverse(); // may fail
            if (tdeg == 0) {
                return d;
            }
            GenPolynomial<C> p = null; //fac.getZERO();
            for (int k = 0; k < tdeg; k++) {
                GenPolynomial<C> m = getHomPart(k).multiply(homogeneousPart(tdeg - k));
                if (p == null) {
                    p = m;
                } else {
                    p = p.sum(m);
                }
            }
            p = p.multiply(d.negate());
            //System.out.println("tdeg = " + tdeg + ", p = " + p);
            coeffCache.put(tdeg, p); // overwrite
            homCheck.set((int) tdeg);
            C c = p.coefficient(e);
            return c;
        }
    });
}
 
开发者ID:kredel,项目名称:java-algebra-system,代码行数:34,代码来源:MultiVarPowerSeries.java

示例9: isNormalPositionFor

import edu.jas.poly.ExpVector; //导入方法依赖的package包/类
/**
 * Test if this ideal is in normal position for variables i and j.
 * @param i first variable index
 * @param j second variable index
 * @return true if this is in normal position with respect to i and j
 */
public boolean isNormalPositionFor(int i, int j) {
    // called in extended ring!
    int ip = list.ring.nvar - 1 - i;
    int jp = list.ring.nvar - 1 - j;
    boolean iOK = false;
    boolean jOK = false;
    for (GenPolynomial<C> p : getList()) {
        if (p.isZERO()) {
            continue;
        }
        ExpVector e = p.leadingExpVector();
        int[] dov = e.dependencyOnVariables();
        //System.out.println("dov = " + Arrays.toString(dov));
        if (dov.length == 0) {
            throw new IllegalArgumentException("ideal dimension is not zero");
        }
        if (dov[0] == ip) {
            if (e.totalDeg() != 1) {
                return false;
            }
            iOK = true;
        } else if (dov[0] == jp) {
            if (e.totalDeg() != 1) {
                return false;
            }
            jOK = true;
        }
        if (iOK && jOK) {
            return true;
        }
    }
    return iOK && jOK;
}
 
开发者ID:kredel,项目名称:java-algebra-system,代码行数:40,代码来源:Ideal.java

示例10: redTerms

import edu.jas.poly.ExpVector; //导入方法依赖的package包/类
/**
 * Compute the residues to given polynomial list.
 * @return List of reduced terms
 */
public List<GenPolynomial<C>> redTerms(List<GenPolynomial<C>> groebnerBasis) {
    if (groebnerBasis == null || groebnerBasis.size() == 0) {
        throw new IllegalArgumentException("groebnerBasis may not be null or empty");
    }
    GenPolynomialRing<C> ring = groebnerBasis.get(0).ring;
    int numberOfVariables = ring.nvar; //Number of Variables of the given Polynomial Ring
    long[] degrees = new long[numberOfVariables]; //Array for the degree-limits for the reduced terms

    List<GenPolynomial<C>> terms = new ArrayList<GenPolynomial<C>>(); //Instantiate the return object
    for (GenPolynomial<C> g : groebnerBasis) { //For each polynomial of G
        if (g.isONE()) {
            terms.clear();
            return terms; //If 1 e G, return empty list terms
        }
        ExpVector e = g.leadingExpVector(); //Take the exponent of the leading monomial             
        if (e.totalDeg() == e.maxDeg()) { //and check, whether a variable x_i is isolated
            for (int i = 0; i < numberOfVariables; i++) {
                long exp = e.getVal(i);
                if (exp > 0) {
                    degrees[i] = exp; //if true, add the degree of univariate x_i to array degrees
                }
            }
        }
    }
    long max = maxArray(degrees); //Find maximum in Array degrees
    for (int i = 0; i < degrees.length; i++) { //Set all zero grades to maximum of array "degrees"
        if (degrees[i] == 0) {
            logger.info("dimension not zero, setting degree to " + max);
            degrees[i] = max; //--> to "make" the ideal zero-dimensional
        }
    }
    terms.add(ring.ONE); //Add the one-polynomial of the ring to the list of reduced terms
    ReductionSeq<C> s = new ReductionSeq<C>(); //Create instance of ReductionSeq to use method isReducible

    //Main Algorithm
    for (int i = 0; i < numberOfVariables; i++) {
        GenPolynomial<C> x = ring.univariate(i); //Create  Linear Polynomial X_i
        List<GenPolynomial<C>> S = new ArrayList<GenPolynomial<C>>(terms); //Copy all entries of return list "terms" into list "S"
        for (GenPolynomial<C> t : S) {
            for (int l = 1; l <= degrees[i]; l++) {
                t = t.multiply(x); //Multiply current element t with Linear Polynomial X_i
                if (!s.isReducible(groebnerBasis, t)) { //Check, if t is irreducible mod groebnerbase
                    terms.add(t); //Add t to return list terms
                }
            }
        }
    }
    return terms;
}
 
开发者ID:kredel,项目名称:java-algebra-system,代码行数:54,代码来源:GroebnerBaseFGLM.java


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