本文整理汇总了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;
}
示例2: asPolynomial
import edu.jas.poly.ExpVector; //导入方法依赖的package包/类
/**
* Get a GenPolynomial<C> from this.
* @return a GenPolynomial<C> 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;
}
示例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;
}
示例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;
}
示例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();
}
});
}