当前位置: 首页>>代码示例>>Java>>正文


Java ExpVector.EVRAND属性代码示例

本文整理汇总了Java中edu.jas.poly.ExpVector.EVRAND属性的典型用法代码示例。如果您正苦于以下问题:Java ExpVector.EVRAND属性的具体用法?Java ExpVector.EVRAND怎么用?Java ExpVector.EVRAND使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在edu.jas.poly.ExpVector的用法示例。


在下文中一共展示了ExpVector.EVRAND属性的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: random

/**
 * Random solvable polynomial.
 * @param k size of random coefficients.
 * @param l number of terms.
 * @param d maximal degree in each variable.
 * @param q density of nozero exponents.
 * @param rnd is a source for random bits.
 * @return a random solvable polynomial.
 */
@Override
public LocalSolvablePolynomial<C> random(int k, int l, int d, float q, Random rnd) {
    LocalSolvablePolynomial<C> r = getZERO(); // copy( ZERO ); 
    ExpVector e;
    SolvableLocal<C> a;
    // add random coeffs and exponents
    for (int i = 0; i < l; i++) {
        e = ExpVector.EVRAND(nvar, d, q, rnd);
        a = coFac.random(k, rnd);
        r = (LocalSolvablePolynomial<C>) r.sum(a, e);
        // somewhat inefficient but clean
    }
    return r;
}
 
开发者ID:kredel,项目名称:java-algebra-system,代码行数:23,代码来源:LocalSolvablePolynomialRing.java

示例2: random

/**
 * Random solvable polynomial.
 * @param k size of random coefficients.
 * @param l number of terms.
 * @param d maximal degree in each variable.
 * @param q density of nozero exponents.
 * @param rnd is a source for random bits.
 * @return a random solvable polynomial.
 */
@Override
public ResidueSolvableWordPolynomial<C> random(int k, int l, int d, float q, Random rnd) {
    ResidueSolvableWordPolynomial<C> r = getZERO(); // copy( ZERO ); 
    ExpVector e;
    WordResidue<C> a;
    // add random coeffs and exponents
    for (int i = 0; i < l; i++) {
        e = ExpVector.EVRAND(nvar, d, q, rnd);
        a = coFac.random(k, rnd);
        r = (ResidueSolvableWordPolynomial<C>) r.sum(a, e);
        // somewhat inefficient but clean
    }
    return r;
}
 
开发者ID:kredel,项目名称:java-algebra-system,代码行数:23,代码来源:ResidueSolvableWordPolynomialRing.java

示例3: random

/**
 * Random solvable polynomial.
 * @param k size of random coefficients.
 * @param l number of terms.
 * @param d maximal degree in each variable.
 * @param q density of nozero exponents.
 * @param rnd is a source for random bits.
 * @return a random solvable polynomial.
 */
@Override
public ResidueSolvablePolynomial<C> random(int k, int l, int d, float q, Random rnd) {
    ResidueSolvablePolynomial<C> r = getZERO(); // copy( ZERO ); 
    ExpVector e;
    SolvableResidue<C> a;
    // add random coeffs and exponents
    for (int i = 0; i < l; i++) {
        e = ExpVector.EVRAND(nvar, d, q, rnd);
        a = coFac.random(k, rnd);
        r = (ResidueSolvablePolynomial<C>) r.sum(a, e);
        // somewhat inefficient but clean
    }
    return r;
}
 
开发者ID:kredel,项目名称:java-algebra-system,代码行数:23,代码来源:ResidueSolvablePolynomialRing.java

示例4: random

/**
 * Random solvable polynomial.
 * @param k size of random coefficients.
 * @param l number of terms.
 * @param d maximal degree in each variable.
 * @param q density of nozero exponents.
 * @param rnd is a source for random bits.
 * @return a random solvable polynomial.
 */
@Override
public QuotSolvablePolynomial<C> random(int k, int l, int d, float q, Random rnd) {
    QuotSolvablePolynomial<C> r = getZERO(); // copy( ZERO ); 
    ExpVector e;
    SolvableQuotient<C> a;
    // add random coeffs and exponents
    for (int i = 0; i < l; i++) {
        e = ExpVector.EVRAND(nvar, d, q, rnd);
        a = coFac.random(k, rnd);
        r = (QuotSolvablePolynomial<C>) r.sum(a, e);
        // somewhat inefficient but clean
    }
    return r;
}
 
开发者ID:kredel,项目名称:java-algebra-system,代码行数:23,代码来源:QuotSolvablePolynomialRing.java

示例5: testAddition

/**
 * Test addition.
 */
@SuppressWarnings("unchecked")
public void testAddition() {
    a = ring.random(kl + 1, ll, el, q);
    c = (QLRSolvablePolynomial<SolvableQuotient<BigRational>, BigRational>) a.subtract(a);
    assertTrue("a-a = 0", c.isZERO());

    b = (QLRSolvablePolynomial<SolvableQuotient<BigRational>, BigRational>) a.sum(a);
    c = (QLRSolvablePolynomial<SolvableQuotient<BigRational>, BigRational>) b.subtract(a);
    assertEquals("a+a-a = a", c, a);

    b = ring.random(kl, ll, el, q);
    c = (QLRSolvablePolynomial<SolvableQuotient<BigRational>, BigRational>) b.sum(a);
    d = (QLRSolvablePolynomial<SolvableQuotient<BigRational>, BigRational>) a.sum(b);
    assertEquals("a+b = b+a", c, d);

    c = (QLRSolvablePolynomial<SolvableQuotient<BigRational>, BigRational>) a.sum(b);
    d = (QLRSolvablePolynomial<SolvableQuotient<BigRational>, BigRational>) c.subtract(b);
    //System.out.println("a = " + a);
    //System.out.println("d = " + d);
    assertEquals("a+b-b = a", a, d);

    c = ring.random(kl, ll, el, q);
    d = (QLRSolvablePolynomial<SolvableQuotient<BigRational>, BigRational>) a.sum(b.sum(c));
    e = (QLRSolvablePolynomial<SolvableQuotient<BigRational>, BigRational>) a.sum(b).sum(c);
    assertEquals("a+(b+c) = (a+b)+c", d, e);
    //System.out.println("a = " + a);
    //System.out.println("b = " + b);
    //System.out.println("c = " + c);
    //System.out.println("d = " + d);
    //System.out.println("e = " + e);

    ExpVector u = ExpVector.EVRAND(rl, el, q);
    SolvableQuotient<BigRational> x = qcring.random(kl);
    //System.out.println("x = " + x);
    //System.out.println("u = " + u);

    b = ring.getONE().multiply(x, u);
    c = (QLRSolvablePolynomial<SolvableQuotient<BigRational>, BigRational>) a.sum(b);
    d = (QLRSolvablePolynomial<SolvableQuotient<BigRational>, BigRational>) a.sum(x, u);
    //System.out.println("a = " + a);
    //System.out.println("b = " + b);
    //System.out.println("c = " + c);
    //System.out.println("d = " + d);
    assertEquals("a+p(x,u) = a+(x,u)", c, d);

    c = (QLRSolvablePolynomial<SolvableQuotient<BigRational>, BigRational>) a.subtract(b);
    d = (QLRSolvablePolynomial<SolvableQuotient<BigRational>, BigRational>) a.subtract(x, u);
    assertEquals("a-p(x,u) = a-(x,u)", c, d);

    a = ring.getZERO();
    b = ring.getONE().multiply(x, u);
    c = (QLRSolvablePolynomial<SolvableQuotient<BigRational>, BigRational>) b.sum(a);
    d = (QLRSolvablePolynomial<SolvableQuotient<BigRational>, BigRational>) a.sum(x, u);
    assertEquals("a+p(x,u) = a+(x,u)", c, d);

    c = (QLRSolvablePolynomial<SolvableQuotient<BigRational>, BigRational>) a.subtract(b);
    d = (QLRSolvablePolynomial<SolvableQuotient<BigRational>, BigRational>) a.subtract(x, u);
    assertEquals("a-p(x,u) = a-(x,u)", c, d);
}
 
开发者ID:kredel,项目名称:java-algebra-system,代码行数:62,代码来源:QuotientSolvablePolynomialQLRTest.java

示例6: testAddition

/**
 * Test addition.
 */
public void testAddition() {
    a = ring.random(kl, ll, el, q);
    c = (ResidueSolvablePolynomial<BigRational>) a.subtract(a);
    assertTrue("a-a = 0", c.isZERO());

    b = (ResidueSolvablePolynomial<BigRational>) a.sum(a);
    c = (ResidueSolvablePolynomial<BigRational>) b.subtract(a);
    assertEquals("a+a-a = a", c, a);

    b = ring.random(kl, ll, el, q);
    c = (ResidueSolvablePolynomial<BigRational>) b.sum(a);
    d = (ResidueSolvablePolynomial<BigRational>) a.sum(b);
    assertEquals("a+b = b+a", c, d);

    c = ring.random(kl, ll, el, q);
    d = (ResidueSolvablePolynomial<BigRational>) a.sum(b.sum(c));
    e = (ResidueSolvablePolynomial<BigRational>) a.sum(b).sum(c);
    assertEquals("a+(b+c) = (a+b)+c", d, e);
    //System.out.println("a = " + a);
    //System.out.println("b = " + b);
    //System.out.println("c = " + c);
    //System.out.println("d = " + d);
    //System.out.println("e = " + e);

    ExpVector u = ExpVector.EVRAND(rl, el, q);
    SolvableResidue<BigRational> x = rring.random(kl);
    //System.out.println("x = " + x);
    //System.out.println("u = " + u);

    b = ring.getONE().multiply(x, u);
    c = (ResidueSolvablePolynomial<BigRational>) a.sum(b);
    d = (ResidueSolvablePolynomial<BigRational>) a.sum(x, u);
    //System.out.println("a = " + a);
    //System.out.println("b = " + b);
    //System.out.println("c = " + c);
    //System.out.println("d = " + d);
    assertEquals("a+p(x,u) = a+(x,u)", c, d);

    c = (ResidueSolvablePolynomial<BigRational>) a.subtract(b);
    d = (ResidueSolvablePolynomial<BigRational>) a.subtract(x, u);
    assertEquals("a-p(x,u) = a-(x,u)", c, d);

    a = ring.getZERO();
    b = ring.getONE().multiply(x, u);
    c = (ResidueSolvablePolynomial<BigRational>) b.sum(a);
    d = (ResidueSolvablePolynomial<BigRational>) a.sum(x, u);
    assertEquals("a+p(x,u) = a+(x,u)", c, d);

    c = (ResidueSolvablePolynomial<BigRational>) a.subtract(b);
    d = (ResidueSolvablePolynomial<BigRational>) a.subtract(x, u);
    assertEquals("a-p(x,u) = a-(x,u)", c, d);
}
 
开发者ID:kredel,项目名称:java-algebra-system,代码行数:55,代码来源:ResidueSolvablePolynomialTest.java

示例7: testAddition

/**
 * Test addition.
 */
@SuppressWarnings("unchecked")
public void testAddition() {
    a = ring.random(kl + 1, ll, el, q);
    c = (QLRSolvablePolynomial<SolvableLocalResidue<BigRational>, BigRational>) a.subtract(a);
    assertTrue("a-a = 0", c.isZERO());

    b = (QLRSolvablePolynomial<SolvableLocalResidue<BigRational>, BigRational>) a.sum(a);
    c = (QLRSolvablePolynomial<SolvableLocalResidue<BigRational>, BigRational>) b.subtract(a);
    assertEquals("a+a-a = a", c, a);

    b = ring.random(kl, ll, el, q);
    c = (QLRSolvablePolynomial<SolvableLocalResidue<BigRational>, BigRational>) b.sum(a);
    d = (QLRSolvablePolynomial<SolvableLocalResidue<BigRational>, BigRational>) a.sum(b);
    assertEquals("a+b = b+a", c, d);

    c = (QLRSolvablePolynomial<SolvableLocalResidue<BigRational>, BigRational>) a.sum(b);
    d = (QLRSolvablePolynomial<SolvableLocalResidue<BigRational>, BigRational>) c.subtract(b);
    //System.out.println("a = " + a);
    //System.out.println("d = " + d);
    assertEquals("a+b-b = a", a, d);

    c = ring.random(kl, ll, el, q);
    d = (QLRSolvablePolynomial<SolvableLocalResidue<BigRational>, BigRational>) a.sum(b.sum(c));
    e = (QLRSolvablePolynomial<SolvableLocalResidue<BigRational>, BigRational>) a.sum(b).sum(c);
    assertEquals("a+(b+c) = (a+b)+c", d, e);
    //System.out.println("a = " + a);
    //System.out.println("b = " + b);
    //System.out.println("c = " + c);
    //System.out.println("d = " + d);
    //System.out.println("e = " + e);

    ExpVector u = ExpVector.EVRAND(rl, el, q);
    SolvableLocalResidue<BigRational> x = qcring.random(kl);
    //System.out.println("x = " + x);
    //System.out.println("u = " + u);

    b = ring.getONE().multiply(x, u);
    c = (QLRSolvablePolynomial<SolvableLocalResidue<BigRational>, BigRational>) a.sum(b);
    d = (QLRSolvablePolynomial<SolvableLocalResidue<BigRational>, BigRational>) a.sum(x, u);
    //System.out.println("a = " + a);
    //System.out.println("b = " + b);
    //System.out.println("c = " + c);
    //System.out.println("d = " + d);
    assertEquals("a+p(x,u) = a+(x,u)", c, d);

    c = (QLRSolvablePolynomial<SolvableLocalResidue<BigRational>, BigRational>) a.subtract(b);
    d = (QLRSolvablePolynomial<SolvableLocalResidue<BigRational>, BigRational>) a.subtract(x, u);
    assertEquals("a-p(x,u) = a-(x,u)", c, d);

    a = ring.getZERO();
    b = ring.getONE().multiply(x, u);
    c = (QLRSolvablePolynomial<SolvableLocalResidue<BigRational>, BigRational>) b.sum(a);
    d = (QLRSolvablePolynomial<SolvableLocalResidue<BigRational>, BigRational>) a.sum(x, u);
    assertEquals("a+p(x,u) = a+(x,u)", c, d);

    c = (QLRSolvablePolynomial<SolvableLocalResidue<BigRational>, BigRational>) a.subtract(b);
    d = (QLRSolvablePolynomial<SolvableLocalResidue<BigRational>, BigRational>) a.subtract(x, u);
    assertEquals("a-p(x,u) = a-(x,u)", c, d);
}
 
开发者ID:kredel,项目名称:java-algebra-system,代码行数:62,代码来源:LocalResidueSolvablePolynomialQLRTest.java

示例8: testAddition

/**
 * Test addition.
 */
public void testAddition() {
    a = ring.random(kl, ll, el, q);
    c = (ResidueSolvableWordPolynomial<BigRational>) a.subtract(a);
    assertTrue("a-a = 0", c.isZERO());

    b = (ResidueSolvableWordPolynomial<BigRational>) a.sum(a);
    c = (ResidueSolvableWordPolynomial<BigRational>) b.subtract(a);
    assertEquals("a+a-a = a", c, a);

    b = ring.random(kl, ll, el, q);
    c = (ResidueSolvableWordPolynomial<BigRational>) b.sum(a);
    d = (ResidueSolvableWordPolynomial<BigRational>) a.sum(b);
    assertEquals("a+b = b+a", c, d);

    c = ring.random(kl, ll, el, q);
    d = (ResidueSolvableWordPolynomial<BigRational>) a.sum(b.sum(c));
    e = (ResidueSolvableWordPolynomial<BigRational>) a.sum(b).sum(c);
    assertEquals("a+(b+c) = (a+b)+c", d, e);
    //System.out.println("a = " + a);
    //System.out.println("b = " + b);
    //System.out.println("c = " + c);
    //System.out.println("d = " + d);
    //System.out.println("e = " + e);

    ExpVector u = ExpVector.EVRAND(rl, el, q);
    WordResidue<BigRational> x = rring.random(kl);
    //System.out.println("x = " + x);
    //System.out.println("u = " + u);

    b = ring.getONE().multiply(x, u);
    c = (ResidueSolvableWordPolynomial<BigRational>) a.sum(b);
    d = (ResidueSolvableWordPolynomial<BigRational>) a.sum(x, u);
    //System.out.println("a = " + a);
    //System.out.println("b = " + b);
    //System.out.println("c = " + c);
    //System.out.println("d = " + d);
    assertEquals("a+p(x,u) = a+(x,u)", c, d);

    c = (ResidueSolvableWordPolynomial<BigRational>) a.subtract(b);
    d = (ResidueSolvableWordPolynomial<BigRational>) a.subtract(x, u);
    assertEquals("a-p(x,u) = a-(x,u)", c, d);

    a = ring.getZERO();
    b = ring.getONE().multiply(x, u);
    c = (ResidueSolvableWordPolynomial<BigRational>) b.sum(a);
    d = (ResidueSolvableWordPolynomial<BigRational>) a.sum(x, u);
    assertEquals("a+p(x,u) = a+(x,u)", c, d);

    c = (ResidueSolvableWordPolynomial<BigRational>) a.subtract(b);
    d = (ResidueSolvableWordPolynomial<BigRational>) a.subtract(x, u);
    assertEquals("a-p(x,u) = a-(x,u)", c, d);
}
 
开发者ID:kredel,项目名称:java-algebra-system,代码行数:55,代码来源:ResidueSolvableWordPolynomialTest.java

示例9: testAddition

/**
 * Test addition.
 */
public void testAddition() {
    a = ring.random(kl, ll, el, q);
    c = (QLRSolvablePolynomial<SolvableResidue<BigRational>, BigRational>) a.subtract(a);
    assertTrue("a-a = 0", c.isZERO());

    b = (QLRSolvablePolynomial<SolvableResidue<BigRational>, BigRational>) a.sum(a);
    c = (QLRSolvablePolynomial<SolvableResidue<BigRational>, BigRational>) b.subtract(a);
    assertEquals("a+a-a = a", c, a);

    b = ring.random(kl, ll, el, q);
    c = (QLRSolvablePolynomial<SolvableResidue<BigRational>, BigRational>) b.sum(a);
    d = (QLRSolvablePolynomial<SolvableResidue<BigRational>, BigRational>) a.sum(b);
    assertEquals("a+b = b+a", c, d);

    c = ring.random(kl, ll, el, q);
    d = (QLRSolvablePolynomial<SolvableResidue<BigRational>, BigRational>) a.sum(b.sum(c));
    e = (QLRSolvablePolynomial<SolvableResidue<BigRational>, BigRational>) a.sum(b).sum(c);
    assertEquals("a+(b+c) = (a+b)+c", d, e);
    //System.out.println("a = " + a);
    //System.out.println("b = " + b);
    //System.out.println("c = " + c);
    //System.out.println("d = " + d);
    //System.out.println("e = " + e);

    ExpVector u = ExpVector.EVRAND(rl, el, q);
    SolvableResidue<BigRational> x = rring.random(kl);
    //System.out.println("x = " + x);
    //System.out.println("u = " + u);

    b = ring.getONE().multiply(x, u);
    c = (QLRSolvablePolynomial<SolvableResidue<BigRational>, BigRational>) a.sum(b);
    d = (QLRSolvablePolynomial<SolvableResidue<BigRational>, BigRational>) a.sum(x, u);
    //System.out.println("a = " + a);
    //System.out.println("b = " + b);
    //System.out.println("c = " + c);
    //System.out.println("d = " + d);
    assertEquals("a+p(x,u) = a+(x,u)", c, d);

    c = (QLRSolvablePolynomial<SolvableResidue<BigRational>, BigRational>) a.subtract(b);
    d = (QLRSolvablePolynomial<SolvableResidue<BigRational>, BigRational>) a.subtract(x, u);
    assertEquals("a-p(x,u) = a-(x,u)", c, d);

    a = ring.getZERO();
    b = ring.getONE().multiply(x, u);
    c = (QLRSolvablePolynomial<SolvableResidue<BigRational>, BigRational>) b.sum(a);
    d = (QLRSolvablePolynomial<SolvableResidue<BigRational>, BigRational>) a.sum(x, u);
    assertEquals("a+p(x,u) = a+(x,u)", c, d);

    c = (QLRSolvablePolynomial<SolvableResidue<BigRational>, BigRational>) a.subtract(b);
    d = (QLRSolvablePolynomial<SolvableResidue<BigRational>, BigRational>) a.subtract(x, u);
    assertEquals("a-p(x,u) = a-(x,u)", c, d);
}
 
开发者ID:kredel,项目名称:java-algebra-system,代码行数:55,代码来源:ResidueSolvablePolynomialQLRTest.java

示例10: testAddition

/**
 * Test addition.
 */
@SuppressWarnings("unchecked")
public void testAddition() {
    a = ring.random(kl + 1, ll, el, q);
    c = (QLRSolvablePolynomial<SolvableLocal<BigRational>, BigRational>) a.subtract(a);
    assertTrue("a-a = 0", c.isZERO());

    b = (QLRSolvablePolynomial<SolvableLocal<BigRational>, BigRational>) a.sum(a);
    c = (QLRSolvablePolynomial<SolvableLocal<BigRational>, BigRational>) b.subtract(a);
    assertEquals("a+a-a = a", c, a);

    b = ring.random(kl, ll, el, q);
    c = (QLRSolvablePolynomial<SolvableLocal<BigRational>, BigRational>) b.sum(a);
    d = (QLRSolvablePolynomial<SolvableLocal<BigRational>, BigRational>) a.sum(b);
    assertEquals("a+b = b+a", c, d);

    c = (QLRSolvablePolynomial<SolvableLocal<BigRational>, BigRational>) a.sum(b);
    d = (QLRSolvablePolynomial<SolvableLocal<BigRational>, BigRational>) c.subtract(b);
    //System.out.println("a = " + a);
    //System.out.println("d = " + d);
    assertEquals("a+b-b = a", a, d);

    c = ring.random(kl, ll, el, q);
    d = (QLRSolvablePolynomial<SolvableLocal<BigRational>, BigRational>) a.sum(b.sum(c));
    e = (QLRSolvablePolynomial<SolvableLocal<BigRational>, BigRational>) a.sum(b).sum(c);
    assertEquals("a+(b+c) = (a+b)+c", d, e);
    //System.out.println("a = " + a);
    //System.out.println("b = " + b);
    //System.out.println("c = " + c);
    //System.out.println("d = " + d);
    //System.out.println("e = " + e);

    ExpVector u = ExpVector.EVRAND(rl, el, q);
    SolvableLocal<BigRational> x = qcring.random(kl);
    //System.out.println("x = " + x);
    //System.out.println("u = " + u);

    b = ring.getONE().multiply(x, u);
    c = (QLRSolvablePolynomial<SolvableLocal<BigRational>, BigRational>) a.sum(b);
    d = (QLRSolvablePolynomial<SolvableLocal<BigRational>, BigRational>) a.sum(x, u);
    //System.out.println("a = " + a);
    //System.out.println("b = " + b);
    //System.out.println("c = " + c);
    //System.out.println("d = " + d);
    assertEquals("a+p(x,u) = a+(x,u)", c, d);

    c = (QLRSolvablePolynomial<SolvableLocal<BigRational>, BigRational>) a.subtract(b);
    d = (QLRSolvablePolynomial<SolvableLocal<BigRational>, BigRational>) a.subtract(x, u);
    assertEquals("a-p(x,u) = a-(x,u)", c, d);

    a = ring.getZERO();
    b = ring.getONE().multiply(x, u);
    c = (QLRSolvablePolynomial<SolvableLocal<BigRational>, BigRational>) b.sum(a);
    d = (QLRSolvablePolynomial<SolvableLocal<BigRational>, BigRational>) a.sum(x, u);
    assertEquals("a+p(x,u) = a+(x,u)", c, d);

    c = (QLRSolvablePolynomial<SolvableLocal<BigRational>, BigRational>) a.subtract(b);
    d = (QLRSolvablePolynomial<SolvableLocal<BigRational>, BigRational>) a.subtract(x, u);
    assertEquals("a-p(x,u) = a-(x,u)", c, d);
}
 
开发者ID:kredel,项目名称:java-algebra-system,代码行数:62,代码来源:LocalSolvablePolynomialQLRTest.java

示例11: testAddition

/**
 * Test addition.
 */
public void testAddition() {
    a = ring.random(kl+1, ll, el, q);
    c = (LocalSolvablePolynomial<BigRational>) a.subtract(a);
    assertTrue("a-a = 0", c.isZERO());

    b = (LocalSolvablePolynomial<BigRational>) a.sum(a);
    c = (LocalSolvablePolynomial<BigRational>) b.subtract(a);
    assertEquals("a+a-a = a", c, a);

    b = ring.random(kl, ll, el, q);
    c = (LocalSolvablePolynomial<BigRational>) b.sum(a);
    d = (LocalSolvablePolynomial<BigRational>) a.sum(b);
    assertEquals("a+b = b+a", c, d);

    c = (LocalSolvablePolynomial<BigRational>) a.sum(b);
    d = (LocalSolvablePolynomial<BigRational>) c.subtract(b);
    //System.out.println("a = " + a);
    //System.out.println("d = " + d);
    assertEquals("a+b-b = a", a, d);

    c = ring.random(kl, ll, el, q);
    d = (LocalSolvablePolynomial<BigRational>) a.sum(b.sum(c));
    e = (LocalSolvablePolynomial<BigRational>) a.sum(b).sum(c);
    assertEquals("a+(b+c) = (a+b)+c", d, e);
    //System.out.println("a = " + a);
    //System.out.println("b = " + b);
    //System.out.println("c = " + c);
    //System.out.println("d = " + d);
    //System.out.println("e = " + e);

    ExpVector u = ExpVector.EVRAND(rl, el, q);
    SolvableLocal<BigRational> x = qcring.random(kl);
    //System.out.println("x = " + x);
    //System.out.println("u = " + u);

    b = ring.getONE().multiply(x, u);
    c = (LocalSolvablePolynomial<BigRational>) a.sum(b);
    d = (LocalSolvablePolynomial<BigRational>) a.sum(x, u);
    //System.out.println("a = " + a);
    //System.out.println("b = " + b);
    //System.out.println("c = " + c);
    //System.out.println("d = " + d);
    assertEquals("a+p(x,u) = a+(x,u)", c, d);

    c = (LocalSolvablePolynomial<BigRational>) a.subtract(b);
    d = (LocalSolvablePolynomial<BigRational>) a.subtract(x, u);
    assertEquals("a-p(x,u) = a-(x,u)", c, d);

    a = ring.getZERO();
    b = ring.getONE().multiply(x, u);
    c = (LocalSolvablePolynomial<BigRational>) b.sum(a);
    d = (LocalSolvablePolynomial<BigRational>) a.sum(x, u);
    assertEquals("a+p(x,u) = a+(x,u)", c, d);

    c = (LocalSolvablePolynomial<BigRational>) a.subtract(b);
    d = (LocalSolvablePolynomial<BigRational>) a.subtract(x, u);
    assertEquals("a-p(x,u) = a-(x,u)", c, d);
}
 
开发者ID:kredel,项目名称:java-algebra-system,代码行数:61,代码来源:LocalSolvablePolynomialTest.java

示例12: testAddition

/**
 * Test addition.
 */
public void testAddition() {
    a = ring.random(kl, ll, el, q);
    c = (QuotSolvablePolynomial<BigRational>) a.subtract(a);
    assertTrue("a-a = 0", c.isZERO());

    b = (QuotSolvablePolynomial<BigRational>) a.sum(a);
    c = (QuotSolvablePolynomial<BigRational>) b.subtract(a);
    assertEquals("a+a-a = a", c, a);

    b = ring.random(kl, ll, el, q);
    c = (QuotSolvablePolynomial<BigRational>) b.sum(a);
    d = (QuotSolvablePolynomial<BigRational>) a.sum(b);
    assertEquals("a+b = b+a", c, d);

    c = ring.random(kl, ll, el, q);
    d = (QuotSolvablePolynomial<BigRational>) a.sum(b.sum(c));
    e = (QuotSolvablePolynomial<BigRational>) a.sum(b).sum(c);
    assertEquals("a+(b+c) = (a+b)+c", d, e);
    //System.out.println("a = " + a);
    //System.out.println("b = " + b);
    //System.out.println("c = " + c);
    //System.out.println("d = " + d);
    //System.out.println("e = " + e);

    ExpVector u = ExpVector.EVRAND(rl, el, q);
    SolvableQuotient<BigRational> x = qcring.random(kl);
    //System.out.println("x = " + x);
    //System.out.println("u = " + u);

    b = ring.getONE().multiply(x, u);
    c = (QuotSolvablePolynomial<BigRational>) a.sum(b);
    d = (QuotSolvablePolynomial<BigRational>) a.sum(x, u);
    //System.out.println("a = " + a);
    //System.out.println("b = " + b);
    //System.out.println("c = " + c);
    //System.out.println("d = " + d);
    assertEquals("a+p(x,u) = a+(x,u)", c, d);

    c = (QuotSolvablePolynomial<BigRational>) a.subtract(b);
    d = (QuotSolvablePolynomial<BigRational>) a.subtract(x, u);
    assertEquals("a-p(x,u) = a-(x,u)", c, d);

    a = ring.getZERO();
    b = ring.getONE().multiply(x, u);
    c = (QuotSolvablePolynomial<BigRational>) b.sum(a);
    d = (QuotSolvablePolynomial<BigRational>) a.sum(x, u);
    assertEquals("a+p(x,u) = a+(x,u)", c, d);

    c = (QuotSolvablePolynomial<BigRational>) a.subtract(b);
    d = (QuotSolvablePolynomial<BigRational>) a.subtract(x, u);
    assertEquals("a-p(x,u) = a-(x,u)", c, d);
}
 
开发者ID:kredel,项目名称:java-algebra-system,代码行数:55,代码来源:QuotSolvablePolynomialTest.java


注:本文中的edu.jas.poly.ExpVector.EVRAND属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。