本文整理汇总了Java中edu.jas.poly.ExpVector.equals方法的典型用法代码示例。如果您正苦于以下问题:Java ExpVector.equals方法的具体用法?Java ExpVector.equals怎么用?Java ExpVector.equals使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类edu.jas.poly.ExpVector
的用法示例。
在下文中一共展示了ExpVector.equals方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: recursivePseudoQuotientRemainder
import edu.jas.poly.ExpVector; //导入方法依赖的package包/类
/**
* GenSolvablePolynomial recursive pseudo quotient and remainder for
* recursive polynomials.
* @param <C> coefficient type.
* @param P recursive GenSolvablePolynomial.
* @param S nonzero recursive GenSolvablePolynomial.
* @return [ quotient, remainder ] with ore(ldcf(S)<sup>m'</sup>) P =
* quotient * S + remainder.
* @see edu.jas.poly.GenPolynomial#remainder(edu.jas.poly.GenPolynomial).
*/
@SuppressWarnings("unchecked")
public static <C extends GcdRingElem<C>> GenSolvablePolynomial<GenPolynomial<C>>[] recursivePseudoQuotientRemainder(
GenSolvablePolynomial<GenPolynomial<C>> P, GenSolvablePolynomial<GenPolynomial<C>> S) {
if (S == null || S.isZERO()) {
throw new ArithmeticException(P + " division by zero " + S);
}
//if (S.ring.nvar != 1) { // ok if exact division
// throw new RuntimeException("univariate polynomials only");
//}
GenSolvablePolynomial<GenPolynomial<C>>[] ret = new GenSolvablePolynomial[2];
if (P == null || P.isZERO()) {
ret[0] = S.ring.getZERO();
ret[1] = S.ring.getZERO();
return ret;
}
if (S.isONE()) {
ret[0] = P;
ret[1] = S.ring.getZERO();
return ret;
}
GenPolynomialRing<C> cofac = (GenPolynomialRing) P.ring.coFac;
GreatestCommonDivisorAbstract<C> fd = new GreatestCommonDivisorSimple<C>(cofac.coFac);
ExpVector e = S.leadingExpVector();
GenSolvablePolynomial<GenPolynomial<C>> h;
GenSolvablePolynomial<GenPolynomial<C>> r = P;
GenSolvablePolynomial<GenPolynomial<C>> q = S.ring.getZERO().copy();
while (!r.isZERO()) {
ExpVector g = r.leadingExpVector();
ExpVector f = g;
if (f.multipleOf(e)) {
f = f.subtract(e);
h = S.multiplyLeft(f); // coeff c, exp (f/e) e
GenSolvablePolynomial<C> a = (GenSolvablePolynomial<C>) r.leadingBaseCoefficient();
GenSolvablePolynomial<C> d = (GenSolvablePolynomial<C>) h.leadingBaseCoefficient();
GenSolvablePolynomial<C>[] oc = fd.leftOreCond(a, d);
GenPolynomial<C> ga = oc[0]; // d
GenPolynomial<C> gd = oc[1]; // a
// ga a = gd d
r = r.multiplyLeft(ga); // coeff ga a, exp f
h = h.multiplyLeft(gd); // coeff gd d, exp f
q = q.multiplyLeft(ga); // d
q = (GenSolvablePolynomial<GenPolynomial<C>>) q.sum(gd, f); // a
r = (GenSolvablePolynomial<GenPolynomial<C>>) r.subtract(h);
if (!r.isZERO() && g.equals(r.leadingExpVector())) {
throw new RuntimeException("degree not descending: r = " + r);
}
} else {
break;
}
}
int sp = P.signum();
int ss = S.signum();
int sq = q.signum();
// sp = ss * sq
if (sp != ss * sq) {
q = (GenSolvablePolynomial<GenPolynomial<C>>) q.negate();
r = (GenSolvablePolynomial<GenPolynomial<C>>) r.negate();
}
ret[0] = q;
ret[1] = r;
return ret;
}