當前位置: 首頁>>代碼示例>>Java>>正文


Java ExpVector.lcm方法代碼示例

本文整理匯總了Java中edu.jas.poly.ExpVector.lcm方法的典型用法代碼示例。如果您正苦於以下問題:Java ExpVector.lcm方法的具體用法?Java ExpVector.lcm怎麽用?Java ExpVector.lcm使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在edu.jas.poly.ExpVector的用法示例。


在下文中一共展示了ExpVector.lcm方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: criterion4

import edu.jas.poly.ExpVector; //導入方法依賴的package包/類
/**
 * GB criterium 4. Use only for commutative polynomial rings. <b>Note:</b>
 * Experimental version for r-Groebner bases.
 * @param A polynomial.
 * @param B polynomial.
 * @return true if the S-polynomial(i,j) is required, else false.
 */
@Override
public boolean criterion4(GenPolynomial<C> A, GenPolynomial<C> B) {
    if (logger.isInfoEnabled()) {
        if (A instanceof GenSolvablePolynomial || B instanceof GenSolvablePolynomial) {
            logger.error("GBCriterion4 not applicabable to SolvablePolynomials");
            return true;
        }
    }
    ExpVector ei = A.leadingExpVector();
    ExpVector ej = B.leadingExpVector();
    ExpVector g = ei.sum(ej);
    ExpVector e = ei.lcm(ej);
    //        boolean t =  g == e ;
    ExpVector h = g.subtract(e);
    int s = h.signum();
    if (s == 0) { // disjoint ht
        C a = A.leadingBaseCoefficient();
        C b = B.leadingBaseCoefficient();
        C d = a.multiply(b);
        if (d.isZERO()) { // a guess
            return false; // can skip pair
        }
    }
    return true; //! ( s == 0 );
}
 
開發者ID:kredel,項目名稱:java-algebra-system,代碼行數:33,代碼來源:RReductionSeq.java

示例2: criterion4

import edu.jas.poly.ExpVector; //導入方法依賴的package包/類
/**
 * GB criterium 4. Use only for commutative polynomial rings. This version
 * works also for d-Groebner bases.
 * @param A polynomial.
 * @param B polynomial.
 * @return true if the S-polynomial(i,j) is required, else false.
 */
@Override
public boolean criterion4(GenPolynomial<C> A, GenPolynomial<C> B) {
    if (logger.isInfoEnabled()) {
        if (A instanceof GenSolvablePolynomial || B instanceof GenSolvablePolynomial) {
            logger.error("GBCriterion4 not applicabable to SolvablePolynomials");
            return true;
        }
    }
    ExpVector ei = A.leadingExpVector();
    ExpVector ej = B.leadingExpVector();
    ExpVector g = ei.sum(ej);
    ExpVector e = ei.lcm(ej);
    //        boolean t =  g == e ;
    ExpVector h = g.subtract(e);
    int s = h.signum();
    if (s == 0) { // disjoint ht
        C a = A.leadingBaseCoefficient();
        C b = B.leadingBaseCoefficient();
        C d = a.gcd(b);
        if (d.isONE()) { // disjoint hc
            return false; // can skip pair
        }
    }
    return true; //! ( s == 0 );
}
 
開發者ID:kredel,項目名稱:java-algebra-system,代碼行數:33,代碼來源:DReductionSeq.java

示例3: put

import edu.jas.poly.ExpVector; //導入方法依賴的package包/類
/**
 * Put one power Series to the pairlist and reduction matrix.
 * @param p power series.
 * @return the index of the added power series.
 */
public synchronized int put(MultiVarPowerSeries<C> p) {
    putCount++;
    if (oneInGB) {
        return P.size() - 1;
    }
    ExpVector e = p.orderExpVector();
    int l = P.size();
    for (int j = 0; j < l; j++) {
        MultiVarPowerSeries<C> pj = P.get(j);
        ExpVector f = pj.orderExpVector();
        if (moduleVars > 0) {
            if (!reduction.moduleCriterion(moduleVars, e, f)) {
                continue; // skip pair
            }
        }
        ExpVector g = e.lcm(f);
        Pair<C> pair = new Pair<C>(pj, p, j, l);
        // redi = (BitSet)red.get(j);
        ///if ( j < l ) redi.set( l );
        // System.out.println("bitset."+j+" = " + redi );  

        //multiple pairs under same keys -> list of pairs
        LinkedList<Pair<C>> xl = pairlist.get(g);
        if (xl == null) {
            xl = new LinkedList<Pair<C>>();
        }
        //xl.addLast( pair ); // first or last ?
        xl.addFirst(pair); // first or last ? better for d- e-GBs
        pairlist.put(g, xl);
    }
    // System.out.println("[email protected] = " + pairlist.keySet() );  
    P.add(p);
    BitSet redi = new BitSet();
    redi.set(0, l); // jdk 1.4
    red.add(redi);
    return P.size() - 1;
}
 
開發者ID:kredel,項目名稱:java-algebra-system,代碼行數:43,代碼來源:OrderedPairlist.java

示例4: put

import edu.jas.poly.ExpVector; //導入方法依賴的package包/類
/**
 * Put one Polynomial to the pairlist and reduction matrix.
 * @param p polynomial.
 * @return the index of the added polynomial.
 */
public synchronized int put(GenPolynomial<C> p) {
    putCount++;
    if (oneInGB) {
        return P.size() - 1;
    }
    ExpVector e = p.leadingExpVector();
    int l = P.size();
    for (int j = 0; j < l; j++) {
        GenPolynomial<C> pj = P.get(j);
        ExpVector f = pj.leadingExpVector();
        if (moduleVars > 0) {
            if (!reduction.moduleCriterion(moduleVars, e, f)) {
                continue; // skip pair
            }
        }
        ExpVector g = e.lcm(f);
        Pair<C> pair = new Pair<C>(pj, p, j, l);
        //System.out.println("pair.new      = " + pair);
        //multiple pairs under same keys -> list of pairs
        LinkedList<Pair<C>> xl = pairlist.get(g);
        if (xl == null) {
            xl = new LinkedList<Pair<C>>();
        }
        //xl.addLast( pair ); // first or last ?
        xl.addFirst(pair); // first or last ? better for d- e-GBs
        pairlist.put(g, xl);
    }
    //System.out.println("[email protected] = " + pairlist.keySet() );  
    P.add(p);
    BitSet redi = new BitSet();
    redi.set(0, l);
    red.add(redi);
    //System.out.println("pairlist.red = " + red); //.get( pair.j )); //pair);
    //System.out.println("pairlist.key = " + pairlist.keySet() );  
    return P.size() - 1;
}
 
開發者ID:kredel,項目名稱:java-algebra-system,代碼行數:42,代碼來源:OrderedPairlist.java

示例5: leftSPolynomial

import edu.jas.poly.ExpVector; //導入方法依賴的package包/類
/**
 * Left S-Polynomial.
 * @param Ap solvable polynomial.
 * @param Bp solvable polynomial.
 * @return left-spol(Ap,Bp) the left S-polynomial of Ap and Bp.
 */
public GenSolvablePolynomial<C> leftSPolynomial(GenSolvablePolynomial<C> Ap, GenSolvablePolynomial<C> Bp) {
    if (logger.isInfoEnabled()) {
        if (Bp == null || Bp.isZERO()) {
            if (Ap != null) {
                return Ap.ring.getZERO();
            }
            return null;
        }
        if (Ap == null || Ap.isZERO()) {
            return Bp.ring.getZERO();
        }
        if (!Ap.ring.equals(Bp.ring)) {
            logger.error("rings not equal");
        }
    }
    Map.Entry<ExpVector, C> ma = Ap.leadingMonomial();
    Map.Entry<ExpVector, C> mb = Bp.leadingMonomial();

    ExpVector e = ma.getKey();
    ExpVector f = mb.getKey();

    ExpVector g = e.lcm(f);
    ExpVector e1 = g.subtract(e);
    ExpVector f1 = g.subtract(f);

    C a = ma.getValue();
    C b = mb.getValue();

    GenSolvablePolynomial<C> App = Ap.multiplyLeft(b, e1);
    GenSolvablePolynomial<C> Bpp = Bp.multiplyLeft(a, f1);
    GenSolvablePolynomial<C> Cp = (GenSolvablePolynomial<C>) App.subtract(Bpp);
    return Cp;
}
 
開發者ID:kredel,項目名稱:java-algebra-system,代碼行數:40,代碼來源:SolvableReductionAbstract.java

示例6: rightSPolynomial

import edu.jas.poly.ExpVector; //導入方法依賴的package包/類
/**
 * Right S-Polynomial.
 * @param Ap solvable polynomial.
 * @param Bp solvable polynomial.
 * @return right-spol(Ap,Bp) the right S-polynomial of Ap and Bp.
 */
@SuppressWarnings("unchecked")
public GenSolvablePolynomial<C> rightSPolynomial(GenSolvablePolynomial<C> Ap, GenSolvablePolynomial<C> Bp) {
    if (logger.isInfoEnabled()) {
        if (Bp == null || Bp.isZERO()) {
            if (Ap != null) {
                return Ap.ring.getZERO();
            }
            return null;
        }
        if (Ap == null || Ap.isZERO()) {
            return Bp.ring.getZERO();
        }
        if (!Ap.ring.equals(Bp.ring)) {
            logger.error("rings not equal");
        }
    }
    ExpVector e = Ap.leadingExpVector();
    ExpVector f = Bp.leadingExpVector();

    ExpVector g = e.lcm(f);
    ExpVector e1 = g.subtract(e);
    ExpVector f1 = g.subtract(f);

    GenSolvablePolynomial<C> App = Ap.multiply(e1);
    GenSolvablePolynomial<C> Bpp = Bp.multiply(f1);

    C a = App.leadingBaseCoefficient();
    C b = Bpp.leadingBaseCoefficient();
    App = App.multiply(b);
    Bpp = Bpp.multiply(a);

    GenSolvablePolynomial<C> Cp = (GenSolvablePolynomial<C>) App.subtract(Bpp);
    return Cp;
}
 
開發者ID:kredel,項目名稱:java-algebra-system,代碼行數:41,代碼來源:SolvableReductionAbstract.java

示例7: SPolynomialExpVectorFactors

import edu.jas.poly.ExpVector; //導入方法依賴的package包/類
/**
 * S-Polynomial factors.
 * @param A monic polynomial.
 * @param B monic polynomial.
 * @return exponent vectors [e,f] such that spol(A,B) = e*a - f*B.
 */
public ExpVector[] SPolynomialExpVectorFactors(SigPoly<C> A, SigPoly<C> B) {
    Map.Entry<ExpVector, C> ma = A.poly.leadingMonomial();
    Map.Entry<ExpVector, C> mb = B.poly.leadingMonomial();
    ExpVector e = ma.getKey();
    ExpVector f = mb.getKey();
    ExpVector g = e.lcm(f);
    ExpVector e1 = g.subtract(e);
    ExpVector f1 = g.subtract(f);
    ExpVector[] F = new ExpVector[] { e1, f1 };
    return F;
}
 
開發者ID:kredel,項目名稱:java-algebra-system,代碼行數:18,代碼來源:SigReductionSeq.java

示例8: SPolynomialHalf

import edu.jas.poly.ExpVector; //導入方法依賴的package包/類
/**
 * S-Polynomial half.
 * @param A monic polynomial.
 * @param B monic polynomial.
 * @return e*A "half" of an S-polynomial such that spol(A,B) = e*A - f*B.
 */
public GenPolynomial<C> SPolynomialHalf(SigPoly<C> A, SigPoly<C> B) {
    Map.Entry<ExpVector, C> ma = A.poly.leadingMonomial();
    Map.Entry<ExpVector, C> mb = B.poly.leadingMonomial();
    ExpVector e = ma.getKey();
    ExpVector f = mb.getKey();
    ExpVector g = e.lcm(f);
    ExpVector e1 = g.subtract(e);
    GenPolynomial<C> F = A.poly.multiply(e1);
    return F;
}
 
開發者ID:kredel,項目名稱:java-algebra-system,代碼行數:17,代碼來源:SigReductionSeq.java

示例9: SPolynomial

import edu.jas.poly.ExpVector; //導入方法依賴的package包/類
/**
 * S-Polynomial.
 * @param A polynomial.
 * @param B polynomial.
 * @return spol(A,B) the S-polynomial of A and B.
 */
public GenPolynomial<C> SPolynomial(GenPolynomial<C> A, GenPolynomial<C> B) {
    if (B == null || B.isZERO()) {
        if (A == null) {
            return B;
        }
        return A.ring.getZERO();
    }
    if (A == null || A.isZERO()) {
        return B.ring.getZERO();
    }
    if (debug) {
        if (!A.ring.equals(B.ring)) {
            logger.error("rings not equal " + A.ring + ", " + B.ring);
        }
    }
    Map.Entry<ExpVector, C> ma = A.leadingMonomial();
    Map.Entry<ExpVector, C> mb = B.leadingMonomial();

    ExpVector e = ma.getKey();
    ExpVector f = mb.getKey();

    ExpVector g = e.lcm(f);
    ExpVector e1 = g.subtract(e);
    ExpVector f1 = g.subtract(f);

    C a = ma.getValue();
    C b = mb.getValue();

    //GenPolynomial<C> App = A.multiply(b, e1);
    //GenPolynomial<C> Bpp = B.multiply(a, f1);
    //GenPolynomial<C> Cp = App.subtract(Bpp);
    GenPolynomial<C> Cp = A.scaleSubtractMultiple(b, e1, a, f1, B);
    return Cp;
}
 
開發者ID:kredel,項目名稱:java-algebra-system,代碼行數:41,代碼來源:ReductionAbstract.java

示例10: criterion4

import edu.jas.poly.ExpVector; //導入方法依賴的package包/類
/**
 * GB criterium 4.
 * @param A polynomial.
 * @param B polynomial.
 * @return true if the S-polynomial(i,j) is required, else false.
 */
public boolean criterion4(GenPolynomial<C> A, GenPolynomial<C> B) {
    if (logger.isInfoEnabled()) {
        if (!A.ring.isCommutative() || !B.ring.isCommutative()) { // A instanceof GenSolvablePolynomial
            logger.error("GBCriterion4 not applicabable to non-commutative polynomials");
            return true;
        }
    }
    ExpVector ei = A.leadingExpVector();
    ExpVector ej = B.leadingExpVector();
    ExpVector e = ei.lcm(ej);
    return criterion4(ei, ej, e);
}
 
開發者ID:kredel,項目名稱:java-algebra-system,代碼行數:19,代碼來源:ReductionAbstract.java

示例11: SPolynomial

import edu.jas.poly.ExpVector; //導入方法依賴的package包/類
/**
 * S-Polynomial.
 * @param Ap polynomial.
 * @param Bp polynomial.
 * @return spol(Ap,Bp) the S-polynomial of Ap and Bp.
 */
@Override
public GenPolynomial<C> SPolynomial(GenPolynomial<C> Ap, GenPolynomial<C> Bp) {
    if (logger.isInfoEnabled()) {
        if (Bp == null || Bp.isZERO()) {
            return Ap.ring.getZERO();
        }
        if (Ap == null || Ap.isZERO()) {
            return Bp.ring.getZERO();
        }
        if (!Ap.ring.equals(Bp.ring)) {
            logger.error("rings not equal");
        }
    }
    Map.Entry<ExpVector, C> ma = Ap.leadingMonomial();
    Map.Entry<ExpVector, C> mb = Bp.leadingMonomial();

    ExpVector e = ma.getKey();
    ExpVector f = mb.getKey();

    ExpVector g = e.lcm(f);
    ExpVector e1 = g.subtract(e);
    ExpVector f1 = g.subtract(f);

    C a = ma.getValue();
    C b = mb.getValue();
    C c = a.gcd(b);
    C m = a.multiply(b);
    C l = m.divide(c); // = lcm(a,b)

    C a1 = l.divide(a);
    C b1 = l.divide(b);

    GenPolynomial<C> App = Ap.multiply(a1, e1);
    GenPolynomial<C> Bpp = Bp.multiply(b1, f1);
    GenPolynomial<C> Cp = App.subtract(Bpp);
    return Cp;
}
 
開發者ID:kredel,項目名稱:java-algebra-system,代碼行數:44,代碼來源:DReductionSeq.java

示例12: GPolynomial

import edu.jas.poly.ExpVector; //導入方法依賴的package包/類
/**
 * G-Polynomial.
 * @param Ap polynomial.
 * @param Bp polynomial.
 * @return gpol(Ap,Bp) the g-polynomial of Ap and Bp.
 */
public GenPolynomial<C> GPolynomial(GenPolynomial<C> Ap, GenPolynomial<C> Bp) {
    if (logger.isInfoEnabled()) {
        if (Bp == null || Bp.isZERO()) {
            return Ap.ring.getZERO();
        }
        if (Ap == null || Ap.isZERO()) {
            return Bp.ring.getZERO();
        }
        if (!Ap.ring.equals(Bp.ring)) {
            logger.error("rings not equal");
        }
    }
    Map.Entry<ExpVector, C> ma = Ap.leadingMonomial();
    Map.Entry<ExpVector, C> mb = Bp.leadingMonomial();

    ExpVector e = ma.getKey();
    ExpVector f = mb.getKey();

    ExpVector g = e.lcm(f);
    ExpVector e1 = g.subtract(e);
    ExpVector f1 = g.subtract(f);

    C a = ma.getValue();
    C b = mb.getValue();
    C[] c = a.egcd(b);

    //System.out.println("egcd[0] " + c[0]);

    GenPolynomial<C> App = Ap.multiply(c[1], e1);
    GenPolynomial<C> Bpp = Bp.multiply(c[2], f1);
    GenPolynomial<C> Cp = App.sum(Bpp);
    return Cp;
}
 
開發者ID:kredel,項目名稱:java-algebra-system,代碼行數:40,代碼來源:DReductionSeq.java

示例13: put

import edu.jas.poly.ExpVector; //導入方法依賴的package包/類
/**
 * Put a polynomial to the pairlist and reduction matrix.
 * @param p polynomial.
 * @return the index of the added polynomial.
 */
public synchronized int put(GenPolynomial<C> p) { 
    putCount++;
    if ( oneInGB ) { 
       return P.size()-1;
    }
    ExpVector e = p.leadingExpVector(); 
    int len = P.size();
    for ( int j = 0; j < len; j++ ) {
        GenPolynomial<C> pj = P.get(j);
        ExpVector f = pj.leadingExpVector(); 
        if ( moduleVars > 0 ) { // test moduleCriterion
        if ( !reduction.moduleCriterion( moduleVars, e, f) ) {
              continue; // skip pair
           }
        }
        ExpVector g =  e.lcm( f );
        CriticalPair<C> pair = new CriticalPair<C>( g, pj, p, j, len );
        //System.out.println("put pair = " + pair );
        pairlist.add( pair );
    }
    P.add( p );
    BitSet redi = new BitSet();
    redi.set( 0, len ); // >= jdk 1.4
    red.add( redi );
    if ( recordCount < len ) {
        recordCount = len;
    }
    return len;
}
 
開發者ID:kredel,項目名稱:java-algebra-system,代碼行數:35,代碼來源:CriticalPairList.java

示例14: put

import edu.jas.poly.ExpVector; //導入方法依賴的package包/類
/**
 * Put one Polynomial to the pairlist and reduction matrix.
 * @param p polynomial.
 * @return the index of the added polynomial.
 */
public synchronized int put(ColorPolynomial<C> p) {
    putCount++;
    if (oneInGB) {
        return P.size() - 1;
    }
    ExpVector e = p.leadingExpVector();
    // System.out.println("p = " + p);
    int l = P.size();
    for (int j = 0; j < l; j++) {
        ColorPolynomial<C> pj = P.get(j);
        // System.out.println("pj = " + pj);
        ExpVector f = pj.leadingExpVector();
        if (moduleVars > 0) {
            if (e.invLexCompareTo(f, 0, moduleVars) != 0) {
                continue; // skip pair
            }
        }
        // System.out.println("e = " + e + ", f = " + f);
        ExpVector g = e.lcm(f); // EVLCM( e, f );
        CPair<C> pair = new CPair<C>(pj, p, j, l);
        // redi = (BitSet)red.get(j);
        // /if ( j < l ) redi.set( l );
        // System.out.println("bitset."+j+" = " + redi );

        // multiple pairs under same keys -> list of pairs
        LinkedList<CPair<C>> xl = pairlist.get(g);
        if (xl == null) {
            xl = new LinkedList<CPair<C>>();
        }
        // xl.addLast( pair ); // first or last ?
        xl.addFirst(pair); // first or last ? better for d- e-GBs
        pairlist.put(g, xl);
    }
    // System.out.println("[email protected] = " + pairlist.keySet() );
    P.add(p);
    BitSet redi = new BitSet();
    redi.set(0, l); // jdk 1.4
    red.add(redi);
    return P.size() - 1;
}
 
開發者ID:kredel,項目名稱:java-algebra-system,代碼行數:46,代碼來源:OrderedCPairlist.java

示例15: put

import edu.jas.poly.ExpVector; //導入方法依賴的package包/類
/**
 * Put one Polynomial to the pairlist and reduction matrix.
 * @param p polynomial.
 * @return the index of the added polynomial.
 */
public synchronized int put(GenPolynomial<C> p) { 
    putCount++;
    if ( oneInGB ) { 
        return P.size()-1;
    }
    ExpVector e = p.leadingExpVector();
    int l = P.size();
    BitSet redi = new BitSet();
    redi.set( 0, l ); // [0..l-1] = true
    red.add( redi );
    P.add(  p );
    for ( int j = 0; j < l; j++ ) {
        GenPolynomial<C> pj = P.get(j);
        ExpVector f = pj.leadingExpVector(); 
        if ( moduleVars > 0 ) {
            if ( !reduction.moduleCriterion( moduleVars, e, f) ) {
                red.get(j).clear(l); 
                continue; // skip pair
            }
        }
        ExpVector g =  e.lcm( f );
        //System.out.println("g  = " + g);  
        Pair<C> pair = new Pair<C>( pj, p, j, l);
        boolean c = true;
        if ( useCriterion4 ) {
            c = reduction.criterion4( pair.pi, pair.pj, g ); 
        }
        //System.out.println("c4  = " + c);  
        if ( c ) {
            c = criterion3( j, l, g );
            //System.out.println("c3  = " + c); 
        }
        if ( !c ) { // skip pair
            red.get(j).clear(l); 
            //System.out.println("c_skip = " + g); 
            continue; 
        }
        //multiple pairs under same keys -> list of pairs
        LinkedList<Pair<C>> xl = pairlist.get( g );
        if ( xl == null ) {
            xl = new LinkedList<Pair<C>>();
        }
        //xl.addLast( pair ); // first or last ?
        xl.addFirst( pair ); // first or last ? better for d- e-GBs
        pairlist.put( g, xl );
    }
    // System.out.println("[email protected] = " + pairlist.keySet() );  
    return P.size()-1;
}
 
開發者ID:kredel,項目名稱:java-algebra-system,代碼行數:55,代碼來源:OrderedMinPairlist.java


注:本文中的edu.jas.poly.ExpVector.lcm方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。