当前位置: 首页>>代码示例>>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;未经允许,请勿转载。