當前位置: 首頁>>代碼示例>>Java>>正文


Java ExpVector.subst方法代碼示例

本文整理匯總了Java中edu.jas.poly.ExpVector.subst方法的典型用法代碼示例。如果您正苦於以下問題:Java ExpVector.subst方法的具體用法?Java ExpVector.subst怎麽用?Java ExpVector.subst使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在edu.jas.poly.ExpVector的用法示例。


在下文中一共展示了ExpVector.subst方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: prepend

import edu.jas.poly.ExpVector; //導入方法依賴的package包/類
/**
 * Prepend a new leading coefficient.
 * @param r variable for the direction.
 * @param h new coefficient.
 * @return new power series.
 */
public MultiVarPowerSeries<C> prepend(final C h, final int r) {
    if (r < 0 || ring.nvar < r) {
        throw new IllegalArgumentException("variable index out of bound");
    }
    return new MultiVarPowerSeries<C>(ring, new MultiVarCoefficients<C>(ring) {


        @Override
        public C generate(ExpVector i) {
            if (i.isZERO()) {
                return h;
            }
            ExpVector e = i.subst(r, i.getVal(r) - 1);
            if (e.signum() < 0) {
                return pfac.coFac.getZERO();
            }
            return coefficient(e);
        }
    });
}
 
開發者ID:kredel,項目名稱:java-algebra-system,代碼行數:27,代碼來源:MultiVarPowerSeries.java

示例2: shift

import edu.jas.poly.ExpVector; //導入方法依賴的package包/類
/**
 * Shift coefficients.
 * @param k shift index.
 * @param r variable for the direction.
 * @return new power series with coefficient(i) = old.coefficient(i-k).
 */
public MultiVarPowerSeries<C> shift(final int k, final int r) {
    if (r < 0 || ring.nvar < r) {
        throw new IllegalArgumentException("variable index out of bound");
    }
    int nt = Math.min(truncate + k, ring.truncate);
    return new MultiVarPowerSeries<C>(ring, new MultiVarCoefficients<C>(ring) {


        @Override
        public C generate(ExpVector i) {
            long d = i.getVal(r);
            if (d - k < 0) {
                return ring.coFac.getZERO();
            }
            ExpVector e = i.subst(r, i.getVal(r) - k);
            return coefficient(e);
        }
    }, nt);
}
 
開發者ID:kredel,項目名稱:java-algebra-system,代碼行數:26,代碼來源:MultiVarPowerSeries.java

示例3: differentiate

import edu.jas.poly.ExpVector; //導入方法依賴的package包/類
/**
 * Differentiate with respect to variable r.
 * @param r variable for the direction.
 * @return differentiate(this).
 */
public MultiVarPowerSeries<C> differentiate(final int r) {
    if (r < 0 || ring.nvar < r) {
        throw new IllegalArgumentException("variable index out of bound");
    }
    return new MultiVarPowerSeries<C>(ring, new MultiVarCoefficients<C>(ring) {


        @Override
        public C generate(ExpVector i) {
            long d = i.getVal(r);
            ExpVector e = i.subst(r, d + 1);
            C v = coefficient(e);
            v = v.multiply(ring.coFac.fromInteger(d + 1));
            return v;
        }
    });
}
 
開發者ID:kredel,項目名稱:java-algebra-system,代碼行數:23,代碼來源:MultiVarPowerSeries.java

示例4: integrate

import edu.jas.poly.ExpVector; //導入方法依賴的package包/類
/**
 * Integrate with respect to variable r and with given constant.
 * @param c integration constant.
 * @param r variable for the direction.
 * @return integrate(this).
 */
public MultiVarPowerSeries<C> integrate(final C c, final int r) {
    if (r < 0 || ring.nvar < r) {
        throw new IllegalArgumentException("variable index out of bound");
    }
    int nt = Math.min(ring.truncate, truncate + 1);
    return new MultiVarPowerSeries<C>(ring, new MultiVarCoefficients<C>(ring) {


        @Override
        public C generate(ExpVector i) {
            if (i.isZERO()) {
                return c;
            }
            long d = i.getVal(r);
            if (d > 0) {
                ExpVector e = i.subst(r, d - 1);
                C v = coefficient(e);
                v = v.divide(ring.coFac.fromInteger(d));
                return v;
            }
            return ring.coFac.getZERO();
        }
    }, nt);
}
 
開發者ID:kredel,項目名稱:java-algebra-system,代碼行數:31,代碼來源:MultiVarPowerSeries.java

示例5: reductum

import edu.jas.poly.ExpVector; //導入方法依賴的package包/類
/**
 * Reductum.
 * @param r variable for taking the reductum.
 * @return this - leading monomial in the direction of r.
 */
public MultiVarPowerSeries<C> reductum(final int r) {
    if (r < 0 || ring.nvar < r) {
        throw new IllegalArgumentException("variable index out of bound");
    }
    return new MultiVarPowerSeries<C>(ring, new MultiVarCoefficients<C>(ring) {


        @Override
        public C generate(ExpVector i) {
            ExpVector e = i.subst(r, i.getVal(r) + 1);
            return coefficient(e);
        }
    });
}
 
開發者ID:kredel,項目名稱:java-algebra-system,代碼行數:20,代碼來源:MultiVarPowerSeries.java

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

示例7: backSubstituteKronecker

import edu.jas.poly.ExpVector; //導入方法依賴的package包/類
/**
 * Kronecker back substitution. Substitute x**d**(i-1) to x_i to construct a
 * multivariate polynomial.
 * @param A polynomial to be converted.
 * @param fac result polynomial factory.
 * @return a multivariate polynomial.
 */
public static <C extends GcdRingElem<C>> GenPolynomial<C> backSubstituteKronecker(
                GenPolynomialRing<C> fac, GenPolynomial<C> A, long d) {
    if (A == null) {
        return A;
    }
    if (fac == null) {
        throw new IllegalArgumentException("null factory not allowed ");
    }
    int n = fac.nvar;
    GenPolynomial<C> B = fac.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 = e.getVal(0);
        ExpVector g = ExpVector.create(n);
        for (int i = 0; i < n; i++) {
            long j = f % d;
            f /= d;
            g = g.subst(i, j);
        }
        B.doPutToMap(g, a);
    }
    return B;
}
 
開發者ID:kredel,項目名稱:java-algebra-system,代碼行數:35,代碼來源:PolyUfdUtil.java


注:本文中的edu.jas.poly.ExpVector.subst方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。