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


Java ExpVector.length方法代码示例

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


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

示例1: deriviative

import edu.jas.poly.ExpVector; //导入方法依赖的package包/类
/**
 * Multi-partial deriviative.
 * @param i exponent vector.
 * @return partial deriviative of this with respect to all variables.
 */
public TaylorFunction<C> deriviative(ExpVector i) {
    GenPolynomial<C> p = pol;
    long f = 1L;
    if (i.signum() == 0 || pol.isZERO()) {
        return new PolynomialTaylorFunction<C>(p, f);
    }
    for (int j = 0; j < i.length(); j++) {
        long e = i.getVal(j);
        if (e == 0) {
            continue;
        }
        int jl = i.length() - 1 - j;
        for (long k = 0; k < e; k++) {
            p = PolyUtil.<C> baseDeriviative(p, jl);
            f *= (k + 1);
            if (p.isZERO()) {
                return new PolynomialTaylorFunction<C>(p, f);
            }
        }
    }
    //System.out.println("i = " + i + ", f = " + f + ", der = " + p);
    return new PolynomialTaylorFunction<C>(p, f);
}
 
开发者ID:kredel,项目名称:java-algebra-system,代码行数:29,代码来源:PolynomialTaylorFunction.java

示例2: substituteKronecker

import edu.jas.poly.ExpVector; //导入方法依赖的package包/类
/**
 * Kronecker substitution. Substitute x_i by x**d**(i-1) to construct a
 * univariate polynomial.
 * @param A polynomial to be converted.
 * @return a univariate polynomial.
 */
public static <C extends GcdRingElem<C>> GenPolynomial<C> substituteKronecker(GenPolynomial<C> A, long d) {
    if (A == null) {
        return A;
    }
    RingFactory<C> cfac = A.ring.coFac;
    GenPolynomialRing<C> ufac = new GenPolynomialRing<C>(cfac, 1);
    GenPolynomial<C> B = ufac.getZERO().copy();
    if (A.isZERO()) {
        return B;
    }
    for (Map.Entry<ExpVector, C> y : A.getMap().entrySet()) {
        ExpVector e = y.getKey();
        C a = y.getValue();
        long f = 0L;
        long h = 1L;
        for (int i = 0; i < e.length(); i++) {
            long j = e.getVal(i) * h;
            f += j;
            h *= d;
        }
        ExpVector g = ExpVector.create(1, 0, f);
        B.doPutToMap(g, a);
    }
    return B;
}
 
开发者ID:kredel,项目名称:java-algebra-system,代码行数:32,代码来源:PolyUfdUtil.java

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

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