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


Java ExpVector.create方法代碼示例

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


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

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

示例2: asPolynomial

import edu.jas.poly.ExpVector; //導入方法依賴的package包/類
/**
 * Get a GenPolynomial&lt;C&gt; from this.
 * @return a GenPolynomial&lt;C&gt; from this up to truncate parts.
 */
public GenPolynomial<C> asPolynomial() {
    GenPolynomial<C> p = ring.polyRing().getZERO();
    for (int i = 0; i <= truncate; i++) {
        C c = coefficient(i);
        ExpVector e = ExpVector.create(1, 0, i);
        p = p.sum(c, e);
    }
    return p;
}
 
開發者ID:kredel,項目名稱:java-algebra-system,代碼行數:14,代碼來源:UnivPowerSeries.java

示例3: ExpVectorIterator

import edu.jas.poly.ExpVector; //導入方法依賴的package包/類
/**
 * ExpVector iterator constructor.
 * @param nv number of variables.
 * @param inf true, if all elements between 0 and upper bound are enumerated, 
              false, if only elements of exact upper bund are to be processed.
 * @param ub an upper bound for the entrys.
 */
protected ExpVectorIterator(int nv, boolean inf, long ub) {
    infinite = inf; 
    upperBound = ub;
    if (upperBound < 0L) {
        throw new IllegalArgumentException("negative upper bound not allowed");
    }
    totalDegree = 0;
    if ( !infinite ) {
        totalDegree = (int)upperBound;
    }
    //System.out.println("totalDegree = " + totalDegree + ", upperBound = " + upperBound);
    LongIterable li = new LongIterable();
    li.setNonNegativeIterator();
    li.setUpperBound(totalDegree);
    List<LongIterable> tlist = new ArrayList<LongIterable>(nv);
    for (int i = 0; i < nv; i++) {
        tlist.add(li); // can reuse li
    }
    Iterable<List<Long>> ib = new CartesianProductLong(tlist,totalDegree);
    liter = ib.iterator();
    empty = (totalDegree > upperBound) || !liter.hasNext();
    current = ExpVector.create(nv);
    if ( !empty ) {
        List<Long> el = liter.next();
        current = ExpVector.create(el);
        //System.out.println("current = " + current);
    }
    nvar = nv;
}
 
開發者ID:kredel,項目名稱:java-algebra-system,代碼行數:37,代碼來源:ExpVectorIterable.java

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

示例5: MultiVarPowerSeriesRing

import edu.jas.poly.ExpVector; //導入方法依賴的package包/類
/**
 * Constructor.
 * @param cofac coefficient ring factory.
 * @param truncate index of truncation.
 * @param names of the variables.
 */
public MultiVarPowerSeriesRing(RingFactory<C> cofac, int nv, int truncate, String[] names) {
    this.coFac = cofac;
    this.nvar = nv;
    this.truncate = truncate;
    if (names == null) {
        vars = null;
    } else {
        vars = Arrays.copyOf(names, names.length); // > Java-5
    }
    if (vars == null) {
        if (PrettyPrint.isTrue()) {
            vars = GenPolynomialRing.newVars("x", nvar);
        }
    } else {
        if (vars.length != nvar) {
            throw new IllegalArgumentException("incompatible variable size " + vars.length + ", " + nvar);
        }
        GenPolynomialRing.addVars(vars);
    }
    EVZERO = ExpVector.create(nvar);
    ONE = new MultiVarPowerSeries<C>(this, new MultiVarCoefficients<C>(this) {


        @Override
        public C generate(ExpVector i) {
            if (i.isZERO()) {
                return coFac.getONE();
            }
            return coFac.getZERO();
        }
    });
    ZERO = new MultiVarPowerSeries<C>(this, new MultiVarCoefficients<C>(this) {


        @Override
        public C generate(ExpVector i) {
            return coFac.getZERO();
        }
    });
}
 
開發者ID:kredel,項目名稱:java-algebra-system,代碼行數:47,代碼來源:MultiVarPowerSeriesRing.java


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