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


Java ExpVector.dependencyOnVariables方法代码示例

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


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

示例1: generate

import edu.jas.poly.ExpVector; //导入方法依赖的package包/类
@Override
public BigRational generate(ExpVector i) {
    int[] v = i.dependencyOnVariables();
    if (v.length == 1 && i.getVal(v[0]) == 1L) {
        return pfac.coFac.getONE();
    }
    return pfac.coFac.getZERO();
}
 
开发者ID:kredel,项目名称:java-algebra-system,代码行数:9,代码来源:MultiVarPowerSeriesTest.java

示例2: shiftSelect

import edu.jas.poly.ExpVector; //导入方法依赖的package包/类
/**
 * Shift select coefficients. Not selected coefficients are removed from the
 * result series.
 * @param sel selector functor.
 * @return new power series with shifted selected coefficients.
 */
public MultiVarPowerSeries<C> shiftSelect(final Selector<? super C> sel) {
    return new MultiVarPowerSeries<C>(ring, new MultiVarCoefficients<C>(ring) {


        ExpVectorIterable ib = new ExpVectorIterable(ring.nvar, true, truncate);


        Iterator<ExpVector> pos = ib.iterator();


        @Override
        public C generate(ExpVector i) {
            C c;
            if (i.signum() > 0) {
                int[] deps = i.dependencyOnVariables();
                ExpVector x = i.subst(deps[0], i.getVal(deps[0]) - 1L);
                c = get(x); // ensure all coefficients are generated
            }
            do {
                c = null;
                if (pos.hasNext()) {
                    ExpVector e = pos.next();
                    c = coefficient(e);
                } else {
                    break;
                }
            } while (!sel.select(c));
            if (c == null) { // not correct because not known
                c = ring.coFac.getZERO();
            }
            return c;
        }
    });
}
 
开发者ID:kredel,项目名称:java-algebra-system,代码行数:41,代码来源:MultiVarPowerSeries.java

示例3: fromPowerSeries

import edu.jas.poly.ExpVector; //导入方法依赖的package包/类
/**
 * Get a MultiVarPowerSeries&lt;C&gt; from a univariate power series.
 * @param ps UnivPowerSeries&lt;C&gt;.
 * @param r variable for the direction.
 * @return a MultiVarPowerSeries&lt;C&gt;.
 */
public MultiVarPowerSeries<C> fromPowerSeries(final UnivPowerSeries<C> ps, final int r) {
    if (ps == null) {
        return ZERO;
    }
    return new MultiVarPowerSeries<C>(this, new MultiVarCoefficients<C>(this) {


        @Override
        public C generate(ExpVector i) {
            if (i.isZERO()) {
                return ps.coefficient(0);
            }
            int[] dep = i.dependencyOnVariables();
            if (dep.length != 1) {
                return coFac.getZERO();
            }
            if (dep[0] != r) {
                return coFac.getZERO();
            }
            int j = (int) i.getVal(r);
            if (j > 0) {
                return ps.coefficient(j);
            }
            return coFac.getZERO();
        }
    });
}
 
开发者ID:kredel,项目名称:java-algebra-system,代码行数:34,代码来源:MultiVarPowerSeriesRing.java

示例4: containsHT

import edu.jas.poly.ExpVector; //导入方法依赖的package包/类
/**
 * Ideal head term containment test.
 * @param G list of polynomials.
 * @param H index set.
 * @return true, if the vaiables of the head terms of each polynomial in G
 *         are contained in H, else false.
 */
protected boolean containsHT(Set<Integer> H, List<GenPolynomial<C>> G) {
    Set<Integer> S = null;
    for (GenPolynomial<C> p : G) {
        if (p == null) {
            continue;
        }
        ExpVector e = p.leadingExpVector();
        if (e == null) {
            continue;
        }
        int[] v = e.dependencyOnVariables();
        if (v == null) {
            continue;
        }
        //System.out.println("v = " + Arrays.toString(v));
        if (S == null) { // revert indices
            S = new HashSet<Integer>(H.size());
            int r = e.length() - 1;
            for (Integer i : H) {
                S.add(r - i);
            }
        }
        if (contains(v, S)) { // v \subset S
            return true;
        }
    }
    return false;
}
 
开发者ID:kredel,项目名称:java-algebra-system,代码行数:36,代码来源:Ideal.java

示例5: 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

示例6: commonZeroTest

import edu.jas.poly.ExpVector; //导入方法依赖的package包/类
/**
 * Common zero test.
 * @param F polynomial list.
 * @return -1, 0 or 1 if dimension(ideal(F)) &eq; -1, 0 or &ge; 1.
 */
public int commonZeroTest(List<GenPolynomial<C>> F) {
    if (F == null || F.isEmpty()) {
        return 1;
    }
    GenPolynomialRing<C> pfac = F.get(0).ring;
    if (pfac.nvar <= 0) {
        return -1;
    }
    //int uht = 0;
    Set<Integer> v = new HashSet<Integer>(); // for non reduced GBs
    for (GenPolynomial<C> p : F) {
        if (p.isZERO()) {
            continue;
        }
        if (p.isConstant()) { // for non-monic lists
            return -1;
        }
        ExpVector e = p.leadingExpVector();
        if (e == null) {
            continue;
        }
        int[] u = e.dependencyOnVariables();
        if (u == null) {
            continue;
        }
        if (u.length == 1) {
            //uht++;
            v.add(u[0]);
        }
    }
    if (pfac.nvar == v.size()) {
        return 0;
    }
    return 1;
}
 
开发者ID:kredel,项目名称:java-algebra-system,代码行数:41,代码来源:GroebnerBaseAbstract.java

示例7: testHenselGCD3

import edu.jas.poly.ExpVector; //导入方法依赖的package包/类
/**
 * Test Hensel gcd 3 variables.
 */
public void testHenselGCD3() {
    BigInteger ifa = new BigInteger(1);
    //dfac = new GenPolynomialRing<BigInteger>(ifa, 2, to , new String[] {"x", "y" });
    dfac = new GenPolynomialRing<BigInteger>(ifa, 3, to , new String[] { "x" , "y", "z" });

    for (int i = 0; i < 1; i++) {
        a = dfac.random(kl, ll, el + i, q);
        b = dfac.random(kl, ll, el, q);
        c = dfac.random(kl, ll, el, q);
        // make monic and c with univariate head term
        ExpVector ev = a.leadingExpVector();
        if ( ev != null ) {
            a.doPutToMap(ev,ifa.getONE());
        }
        ev = b.leadingExpVector();
        if ( ev != null ) {
            b.doPutToMap(ev,ifa.getONE());
        }
        ev = c.leadingExpVector();
        if ( ev != null ) {
            //c.doPutToMap(ev,ifa.getONE());
        }
        assertFalse("ev == null ", ev == null);
        if ( ev.dependencyOnVariables().length > 1 ) {
            c = dfac.univariate(1); //getONE();
        }
        //a = dfac.parse(" y^2 + 2 x y - 3 y + x^2 - 3 x - 4 ");
        //b = dfac.parse(" y^2 + 2 x y + 5 y + x^2 + 5 x + 4 ");
        //a = dfac.parse(" x + 2 y + z^2 + 5 ");
        //b = dfac.parse(" x - y - 3 + y z ");
        //c = dfac.parse(" x y + z^2 + y ");
        //a = dfac.parse("7 y^4 - (35 x^3 - 32) y^3 - 160 x^3 y^2 + (105 x^2 - 119) y + (480 x^2 - 544) ");
        //b = dfac.parse(" 7 y^4 + 39 y^3 + 32 y^2 ");
        //c = dfac.parse(" 7 y + 32 ");

        //a = dfac.parse(" ( -13 x^2 ) z^5 + ( 182 x^2 - 143  ) z^3 - ( x^2 * y^3 - 8 x^2 ) z^2 + ( 14 x^2 * y^3 - 11 y^3 - 112 x^2 + 88  ) ");
        //b = dfac.parse(" ( -13 x^3 * y^3 ) z^6 + ( 65 y ) z^4 - ( x^3 * y^6 - 8 x^3 * y^3 - 52 y^3 - 195 y + 156  ) z^3 + ( 5 y^4 - 40 y ) z + ( 4 y^6 + 15 y^4 - 44 y^3 - 120 y + 96  ) ) ");
        //c = dfac.parse(" 13 z^3 + y^3 - 8 ");

        //a = dfac.parse(" 3 z^3 + ( 4 y^2 + 25 x^3 + 16 x^2 + 25  ) z^2 - ( 84 y^4 - 22 x^3 * y^2 + 128 x^2 * y^2 + 138 y^2 - 52 x^6 - 71 x^5 + 35 x^4 - 109 x^3 + 59 x^2 + 18  ) z ");
        //b = dfac.parse(" 10 z^5 + ( 60 y^2 + 40 x^3 + 70 x^2 + 90  ) z^4 + ( 14 x + 3  ) z^2 + ( 84 x * y^2 + 18 y^2 + 56 x^4 + 110 x^3 + 21 x^2 + 126 x + 27  ) z ");
        //c = dfac.parse("z^2 + ( 6 y^2 + 4 x^3 + 7 x^2 + 9  ) z");

        //a = a.abs();
        //b = b.abs();
        //c = c.abs();
        //System.out.println("a = " + a);
        //System.out.println("b = " + b);
        //System.out.println("c = " + c);
        if (a.isZERO() || b.isZERO() || c.isZERO()) {
            // skip for this turn
            continue;
        }

        a = a.multiply(c);
        b = b.multiply(c);
        //System.out.println("a = " + a);
        //System.out.println("b = " + b);

        d = ufd.gcd(a, b);
        e = PolyUtil.<BigInteger> basePseudoRemainder(d, c);
        //System.out.println("e = " + e);
        //System.out.println("d = " + d);
        //System.out.println("c = " + c);
        assertTrue("c | gcd(ac,bc) " + e + ", d = " + d, e.isZERO());
    }
}
 
开发者ID:kredel,项目名称:java-algebra-system,代码行数:71,代码来源:GCDHenselTest.java

示例8: normalPositionIndex2Vars

import edu.jas.poly.ExpVector; //导入方法依赖的package包/类
/**
 * Normal position index, separate for polynomials with more than 2
 * variables. See also
 * <a href="http://krum.rz.uni-mannheim.de/mas/src/masring/DIPDEC0.mi.html"
 * >mas.masring.DIPDEC0#DIGISR</a>
 * @return (i,j) for non-normal variables
 */
public int[] normalPositionIndex2Vars() {
    int[] np = null;
    int i = -1;
    int j = -1;
    for (GenPolynomial<C> p : getList()) {
        if (p.isZERO()) {
            continue;
        }
        ExpVector e = p.leadingExpVector();
        int[] dov = e.dependencyOnVariables();
        //System.out.println("dov_head = " + Arrays.toString(dov));
        if (dov.length == 0) {
            throw new IllegalArgumentException("ideal dimension is not zero " + p);
        }
        // search bi-variate head terms
        if (dov.length >= 2) {
            i = dov[0];
            j = dov[1];
            break;
        }
        int n = dov[0];
        GenPolynomial<C> q = p.reductum();
        if (q.isZERO()) {
            continue;
        }
        e = q.degreeVector();
        dov = e.dependencyOnVariables();
        //System.out.println("dov_red  = " + Arrays.toString(dov));
        int k = Arrays.binarySearch(dov, n);
        int len = 2;
        if (k >= 0) {
            len = 3;
        }
        // search bi-variate reductas
        if (dov.length >= len) {
            switch (k) {
            case 0:
                i = dov[1];
                j = dov[2];
                break;
            case 1:
                i = dov[0];
                j = dov[2];
                break;
            case 2:
                i = dov[0];
                j = dov[1];
                break;
            default:
                i = dov[0];
                j = dov[1];
                break;
            }
            break;
        }
    }
    if (i < 0 || j < 0) {
        return np;
    }
    // adjust index
    i = list.ring.nvar - 1 - i;
    j = list.ring.nvar - 1 - j;
    np = new int[] { j, i }; // reverse
    logger.info("normalPositionIndex2Vars, np = " + Arrays.toString(np));
    return np;
}
 
开发者ID:kredel,项目名称:java-algebra-system,代码行数:74,代码来源:Ideal.java

示例9: factorsSquarefreeOptimize

import edu.jas.poly.ExpVector; //导入方法依赖的package包/类
/**
 * GenPolynomial factorization of a multivariate squarefree polynomial,
 * using Kronecker substitution and variable order optimization.
 * @param P squarefree and primitive! (respectively monic) multivariate
 *            GenPolynomial over the ring C.
 * @return [p_1,...,p_k] with P = prod_{i=1,...,r} p_i.
 */
public List<GenPolynomial<C>> factorsSquarefreeOptimize(GenPolynomial<C> P) {
    GenPolynomialRing<C> pfac = P.ring;
    if (pfac.nvar <= 1) {
        return baseFactorsSquarefree(P);
    }
    List<GenPolynomial<C>> topt = new ArrayList<GenPolynomial<C>>(1);
    topt.add(P);
    OptimizedPolynomialList<C> opt = TermOrderOptimization.<C> optimizeTermOrder(pfac, topt);
    P = opt.list.get(0);
    logger.info("optimized polynomial: " + P);
    List<Integer> iperm = TermOrderOptimization.inversePermutation(opt.perm);
    logger.info("optimize perm: " + opt.perm + ", de-optimize perm: " + iperm);

    ExpVector degv = P.degreeVector();
    int[] donv = degv.dependencyOnVariables();
    List<GenPolynomial<C>> facs = null;
    if (degv.length() == donv.length) { // all variables appear
        logger.info("do.full factorsSquarefreeKronecker: " + P);
        facs = factorsSquarefreeKronecker(P);
    } else { // not all variables appear, remove unused variables
        GenPolynomial<C> pu = PolyUtil.<C> removeUnusedUpperVariables(P);
        //GenPolynomial<C> pl = PolyUtil.<C> removeUnusedLowerVariables(pu); // not useful after optimize
        logger.info("do.sparse factorsSquarefreeKronecker: " + pu);
        facs = factorsSquarefreeKronecker(pu); // pl
        List<GenPolynomial<C>> fs = new ArrayList<GenPolynomial<C>>(facs.size());
        GenPolynomialRing<C> pf = P.ring;
        //GenPolynomialRing<C> pfu = pu.ring;
        for (GenPolynomial<C> p : facs) {
            //GenPolynomial<C> pel = p.extendLower(pfu, 0, 0L);
            GenPolynomial<C> pe = p.extend(pf, 0, 0L); // pel
            fs.add(pe);
        }
        //System.out.println("fs = " + fs);
        facs = fs;
    }
    List<GenPolynomial<C>> iopt = TermOrderOptimization.<C> permutation(iperm, pfac, facs);
    logger.info("de-optimized polynomials: " + iopt);
    facs = normalizeFactorization(iopt);
    return facs;
}
 
开发者ID:kredel,项目名称:java-algebra-system,代码行数:48,代码来源:FactorAbstract.java


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