本文整理汇总了Java中edu.jas.poly.ExpVector类的典型用法代码示例。如果您正苦于以下问题:Java ExpVector类的具体用法?Java ExpVector怎么用?Java ExpVector使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ExpVector类属于edu.jas.poly包,在下文中一共展示了ExpVector类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: jasToPoly
import edu.jas.poly.ExpVector; //导入依赖的package包/类
/**
* Transforms a JAS polynomial to a Polynomial object.
*
* @param j JAS polynomial
* @return polynomial of Polynomial class
*/
private Polynomial jasToPoly(GenPolynomial<BigInteger> j)
{
int numVariables = j.numberOfVariables();
Polynomial result = new Polynomial(numVariables, j.length());
for (Monomial<BigInteger> jasMono : j) {
java.math.BigInteger coeff = (jasMono.coefficient()).getVal();
ExpVector jasExpo = jasMono.exponent();
ArrayList<Integer> expo = new ArrayList<Integer>();
for (int var = 0; var < numVariables; var++) {
expo.add((int)jasExpo.getVal(var));
}
result.addTerm(coeff, expo);
}
return result;
}
示例2: fromProduct
import edu.jas.poly.ExpVector; //导入依赖的package包/类
/**
* From product representation.
* @param <C> coefficient type.
* @param pfac polynomial ring factory.
* @param P polynomial to be converted from product representation.
* @param i index of product representation to be taken.
* @return Represenation of i-slice of P in the polynomial ring pfac.
*/
public static <C extends GcdRingElem<C>> GenPolynomial<GenPolynomial<C>> fromProduct(
GenPolynomialRing<GenPolynomial<C>> pfac, GenPolynomial<Product<Residue<C>>> P, int i) {
GenPolynomial<GenPolynomial<C>> b = pfac.getZERO().copy();
if (P == null || P.isZERO()) {
return b;
}
for (Map.Entry<ExpVector, Product<Residue<C>>> y : P.getMap().entrySet()) {
ExpVector e = y.getKey();
Product<Residue<C>> a = y.getValue();
Residue<C> r = a.get(i);
if (r != null && !r.isZERO()) {
GenPolynomial<C> p = r.val;
if (!p.isZERO()) {
b.doPutToMap(e, p);
}
}
}
return b;
}
示例3: multiply
import edu.jas.poly.ExpVector; //导入依赖的package包/类
/**
* ColorPolynomial multiplication by monomial.
* @param s Coefficient.
* @param e Expvector.
* @return this * (c t).
*/
public ColorPolynomial<C> multiply(GenPolynomial<C> s, ExpVector e) {
GenPolynomial<GenPolynomial<C>> g, r, w;
if (green instanceof GenSolvablePolynomial) {
logger.info("use left multiplication");
GenSolvablePolynomial<GenPolynomial<C>> gs, rs, ws;
gs = (GenSolvablePolynomial<GenPolynomial<C>>) green;
rs = (GenSolvablePolynomial<GenPolynomial<C>>) red;
ws = (GenSolvablePolynomial<GenPolynomial<C>>) white;
g = gs.multiplyLeft(s, e);
r = rs.multiplyLeft(s, e);
w = ws.multiplyLeft(s, e);
} else {
g = green.multiply(s, e);
r = red.multiply(s, e);
w = white.multiply(s, e);
}
return new ColorPolynomial<C>(g, r, w);
}
示例4: toPolyCoefficients
import edu.jas.poly.ExpVector; //导入依赖的package包/类
/**
* Integral function from rational polynomial coefficients. Represent as
* polynomial with type GenSolvablePolynomial<C> coefficients.
* @param A polynomial with rational polynomial coefficients to be
* converted.
* @return polynomial with type GenSolvablePolynomial<C> coefficients.
*/
public RecSolvablePolynomial<C> toPolyCoefficients(LocalSolvablePolynomial<C> A) {
RecSolvablePolynomial<C> B = polCoeff.getZERO().copy();
if (A == null || A.isZERO()) {
return B;
}
for (Map.Entry<ExpVector, SolvableLocal<C>> y : A.getMap().entrySet()) {
ExpVector e = y.getKey();
SolvableLocal<C> a = y.getValue();
if (!a.den.isONE()) {
throw new IllegalArgumentException("den != 1 not supported: " + a);
}
GenPolynomial<C> p = a.num; // can not be zero
if (!p.isZERO()) {
//B = B.sum( p, e ); // inefficient
B.doPutToMap(e, p);
}
}
return B;
}
示例5: OrderedCPairlist
import edu.jas.poly.ExpVector; //导入依赖的package包/类
/**
* Constructor for OrderedPairlist.
* @param m number of module variables.
* @param r polynomial factory.
*/
public OrderedCPairlist(int m, GenPolynomialRing<GenPolynomial<C>> r) {
moduleVars = m;
ring = r;
P = new ArrayList<ColorPolynomial<C>>();
pairlist = new TreeMap<ExpVector, LinkedList<CPair<C>>>(ring.tord.getAscendComparator());
// pairlist = new TreeMap( to.getSugarComparator() );
red = new ArrayList<BitSet>();
putCount = 0;
remCount = 0;
if (ring instanceof GenSolvablePolynomialRing) {
useCriterion4 = false;
}
RingFactory<GenPolynomial<C>> rf = ring.coFac;
GenPolynomialRing<C> cf = (GenPolynomialRing<C>) rf;
reduction = new CReductionSeq<C>(cf.coFac);
}
示例6: multiply
import edu.jas.poly.ExpVector; //导入依赖的package包/类
/**
* QuotSolvablePolynomial left and right multiplication. Product with ring
* element and exponent vector.
* @param b coefficient polynomial.
* @param e exponent.
* @param c coefficient polynomial.
* @param f exponent.
* @return b x<sup>e</sup> * this * c x<sup>f</sup>, where * denotes
* solvable multiplication.
*/
@Override
public QuotSolvablePolynomial<C> multiply(SolvableQuotient<C> b, ExpVector e, SolvableQuotient<C> c,
ExpVector f) {
if (b == null || b.isZERO()) {
return ring.getZERO();
}
if (c == null || c.isZERO()) {
return ring.getZERO();
}
if (b.isONE() && e.isZERO() && c.isONE() && f.isZERO()) {
return this;
}
QuotSolvablePolynomial<C> Cp = new QuotSolvablePolynomial<C>(ring, b, e);
QuotSolvablePolynomial<C> Dp = new QuotSolvablePolynomial<C>(ring, c, f);
return multiply(Cp, Dp);
}
示例7: toPolyCoefficients
import edu.jas.poly.ExpVector; //导入依赖的package包/类
/**
* Integral function from solvable residue coefficients. Represent as
* polynomial with type GenSolvablePolynomial<C> coefficients.
* @param A polynomial with solvable residue coefficients to be converted.
* @return polynomial with type GenSolvablePolynomial<C> coefficients.
*/
public RecSolvablePolynomial<C> toPolyCoefficients(ResidueSolvablePolynomial<C> A) {
RecSolvablePolynomial<C> B = polCoeff.getZERO().copy();
if (A == null || A.isZERO()) {
return B;
}
for (Map.Entry<ExpVector, SolvableResidue<C>> y : A.getMap().entrySet()) {
ExpVector e = y.getKey();
SolvableResidue<C> a = y.getValue();
GenPolynomial<C> p = a.val; // can not be zero
if (!p.isZERO()) {
//B = B.sum( p, e ); // inefficient
B.doPutToMap(e, p);
}
}
return B;
}
示例8: setUp
import edu.jas.poly.ExpVector; //导入依赖的package包/类
@Override
protected void setUp() {
vars = ExpVector.STDVARS(rl);
cvars = ExpVector.STDVARS(rl - 1);
c1vars = new String[] { cvars[0] };
rvars = new String[] { vars[rl - 1] };
fac = new BigRational(1);
//ufd = new GreatestCommonDivisorSubres<BigRational>();
//ufd = GCDFactory.<BigRational> getImplementation(fac);
ufd = GCDFactory.getProxy(fac);
sqf = new SquarefreeFieldChar0<BigRational>(fac);
SquarefreeAbstract<BigRational> sqff = SquarefreeFactory.getImplementation(fac);
//System.out.println("sqf = " + sqf);
//System.out.println("sqff = " + sqff);
assertEquals("sqf == sqff ", sqf.getClass(), sqff.getClass());
a = b = c = d = e = null;
ar = br = cr = dr = er = null;
}
示例9: isTopReducible
import edu.jas.poly.ExpVector; //导入依赖的package包/类
/**
* Is top reducible.
* @param A polynomial.
* @param P polynomial list.
* @return true if A is top reducible with respect to P.
*/
//SuppressWarnings("unchecked") // not jet working
@Override
public boolean isTopReducible(List<GenPolynomial<C>> P, GenPolynomial<C> A) {
if (P == null || P.isEmpty()) {
return false;
}
if (A == null || A.isZERO()) {
return false;
}
boolean mt = false;
ExpVector e = A.leadingExpVector();
C a = A.leadingBaseCoefficient();
for (GenPolynomial<C> p : P) {
mt = e.multipleOf(p.leadingExpVector());
if (mt) {
C b = p.leadingBaseCoefficient();
C r = a.remainder(b);
mt = r.isZERO();
if (mt) {
return true;
}
}
}
return false;
}
示例10: setUp
import edu.jas.poly.ExpVector; //导入依赖的package包/类
@Override
protected void setUp() {
vars = ExpVector.STDVARS(rl);
cvars = ExpVector.STDVARS(rl - 1);
c1vars = new String[] { cvars[0] };
rvars = new String[] { vars[rl - 1] };
fac = new BigInteger(1);
//ufd = new GreatestCommonDivisorSubres<BigInteger>();
//ufd = GCDFactory.<BigInteger> getImplementation(fac);
ufd = GCDFactory.getProxy(fac);
sqf = new SquarefreeRingChar0<BigInteger>(fac);
SquarefreeAbstract<BigInteger> sqff = SquarefreeFactory.getImplementation(fac);
//System.out.println("sqf = " + sqf);
//System.out.println("sqff = " + sqff);
assertEquals("sqf == sqff ", sqf.getClass(), sqff.getClass());
a = b = c = d = e = null;
ar = br = cr = dr = er = null;
}
示例11: setUp
import edu.jas.poly.ExpVector; //导入依赖的package包/类
@Override
protected void setUp() {
a = b = c = d = e = null;
ai = bi = ci = di = ei = null;
ar = br = cr = dr = er = null;
//mi = new ModLongRing(primes.get(0),true);
mi = new ModLongRing(19, true);
//mi = new ModLongRing(19*17,true); // failing tests
//mi = new ModLongRing(primes.get(0).multiply(primes.get(1)),false); // failing tests
//ufd = new GreatestCommonDivisorPrimitive<ModLong>();
ufd = new GreatestCommonDivisorModEval<ModLong>();
String[] vars = ExpVector.STDVARS(rl);
String[] cvars = ExpVector.STDVARS(rl - 1);
String[] rvars = new String[] { vars[rl - 1] };
dfac = new GenPolynomialRing<ModLong>(mi, rl, to, vars);
cfac = new GenPolynomialRing<ModLong>(mi, rl - 1, to, cvars);
rfac = new GenPolynomialRing<GenPolynomial<ModLong>>(cfac, 1, to, rvars);
//System.out.println("mi = " + mi);
}
示例12: setUp
import edu.jas.poly.ExpVector; //导入依赖的package包/类
@Override
protected void setUp() {
a = b = c = d = e = null;
ai = bi = ci = di = ei = null;
ar = br = cr = dr = er = null;
//mi = new ModIntegerRing(primes.get(0),true);
mi = new ModIntegerRing(19, true);
//mi = new ModIntegerRing(19*17,true); // failing tests
//mi = new ModIntegerRing(primes.get(0).multiply(primes.get(1)),false); // failing tests
//ufd = new GreatestCommonDivisorPrimitive<ModInteger>();
ufd = new GreatestCommonDivisorModEval<ModInteger>();
String[] vars = ExpVector.STDVARS(rl);
String[] cvars = ExpVector.STDVARS(rl - 1);
String[] rvars = new String[] { vars[rl - 1] };
dfac = new GenPolynomialRing<ModInteger>(mi, rl, to, vars);
cfac = new GenPolynomialRing<ModInteger>(mi, rl - 1, to, cvars);
rfac = new GenPolynomialRing<GenPolynomial<ModInteger>>(cfac, 1, to, rvars);
//System.out.println("mi = " + mi);
}
示例13: setUp
import edu.jas.poly.ExpVector; //导入依赖的package包/类
@Override
protected void setUp() {
vars = ExpVector.STDVARS(rl);
cvars = ExpVector.STDVARS(rl - 1);
c1vars = new String[] { cvars[0] };
rvars = new String[] { vars[rl - 1] };
fac = new ModLongRing(11);
//ufd = new GreatestCommonDivisorSubres<ModLong>();
//ufd = GCDFactory.<ModLong> getImplementation(fac);
ufd = GCDFactory.getProxy(fac);
sqf = new SquarefreeFiniteFieldCharP<ModLong>(fac);
SquarefreeAbstract<ModLong> sqff = SquarefreeFactory.getImplementation(fac);
//System.out.println("sqf = " + sqf);
//System.out.println("sqff = " + sqff);
assertEquals("sqf == sqff ", sqf.getClass(), sqff.getClass());
a = b = c = d = e = null;
ar = br = cr = dr = er = null;
}
示例14: QuotSolvablePolynomialRing
import edu.jas.poly.ExpVector; //导入依赖的package包/类
/**
* The constructor creates a solvable polynomial factory object with the
* given term order.
* @param cf factory for coefficients of type C.
* @param n number of variables.
* @param t a term order.
* @param v names for the variables.
* @param rt solvable multiplication relations.
*/
public QuotSolvablePolynomialRing(RingFactory<SolvableQuotient<C>> cf, int n, TermOrder t, String[] v,
RelationTable<SolvableQuotient<C>> rt) {
super(cf, n, t, v, rt);
//if (rt == null) { // handled in super }
SolvableQuotientRing<C> cfring = (SolvableQuotientRing<C>) cf; // == coFac
polCoeff = new RecSolvablePolynomialRing<C>(cfring.ring, n, t, v);
if (table.size() > 0) { // TODO
ExpVector e = null;
ExpVector f = null;
GenSolvablePolynomial<GenPolynomial<C>> p = null;
polCoeff.table.update(e, f, p); // from rt
}
//coeffTable = polCoeff.coeffTable; //new RelationTable<GenPolynomial<C>>(polCoeff, true);
ZERO = new QuotSolvablePolynomial<C>(this);
SolvableQuotient<C> coeff = coFac.getONE();
//evzero = ExpVector.create(nvar); // from super
ONE = new QuotSolvablePolynomial<C>(this, coeff, evzero);
}
示例15: 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);
}
});
}