當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。