In Files

Parent

Included Modules

JAS::SolvIdeal

Represents a JAS solvable polynomial ideal.

Methods for left, right two-sided Groebner basees and others.

Attributes

list[R]

the Java ordered polynomial list, polynomial ring, and polynomial list

pset[R]

the Java ordered polynomial list, polynomial ring, and polynomial list

ring[R]

the Java ordered polynomial list, polynomial ring, and polynomial list

Public Class Methods

new(ring,ringstr="",list=nil) click to toggle source

Constructor for an ideal in a solvable polynomial ring.

# File examples/jas.rb, line 3716
def initialize(ring,ringstr="",list=nil)
    @ring = ring;
    if list == nil
       sr = StringReader.new( ringstr );
       tok = GenPolynomialTokenizer.new(ring.ring,sr);
       @list = tok.nextSolvablePolynomialList();
    else
       @list = rbarray2arraylist(list,rec=1);
    end
    @pset = OrderedPolynomialList.new(ring.ring,@list);
    #@ideal = SolvableIdeal.new(@pset);
end

Public Instance Methods

<=>(other) click to toggle source

Compare two ideals.

# File examples/jas.rb, line 3739
def <=>(other)
    s = SolvableIdeal.new(@pset);
    o = SolvableIdeal.new(other.pset);
    return s.compareTo(o); 
end
===(other) click to toggle source

Test if two ideals are equal.

# File examples/jas.rb, line 3748
def ===(other)
    if not other.is_a? SolvIdeal
       return false;
    end
    s, o = self, other;
    return (s <=> o) == 0; 
end
intersect(other) click to toggle source

Compute the intersection of this and the other ideal.

# File examples/jas.rb, line 3943
def intersect(other)
    s = SolvableIdeal.new(@pset);
    t = SolvableIdeal.new(other.pset);
    nn = s.intersect( t );
    return SolvIdeal.new(@ring,"",nn.getList());
end
intersectRing(ring) click to toggle source

Compute the intersection of this and a polynomial ring.

# File examples/jas.rb, line 3934
def intersectRing(ring)
    s = SolvableIdeal.new(@pset);
    nn = s.intersect(ring.ring);
    return SolvIdeal.new(@ring,"",nn.getList());
end
inverse(p) click to toggle source

Compute the inverse polynomial with respect to this twosided ideal.

# File examples/jas.rb, line 4001
def inverse(p)
    if p.is_a? RingElem
        p = p.elem;
    end
    s = SolvableIdeal.new(@pset);
    i = s.inverse(p);
    return RingElem.new(i);
end
isLeftGB() click to toggle source

Test if this is a left Groebner base.

# File examples/jas.rb, line 3803
def isLeftGB()
    cofac = @ring.ring.coFac;
    ff = @pset.list;
    kind = "";
    t = System.currentTimeMillis();
    if cofac.is_a? GenPolynomialRing #and cofac.isCommutative()
       b = SolvableGroebnerBasePseudoRecSeq.new(cofac).isLeftGB(ff);
       kind = "pseudoRec"
    else 
       if cofac.isField() or not cofac.isCommutative()
          b = SolvableGroebnerBaseSeq.new().isLeftGB(ff);
          kind = "field|nocom"
       else
          b = SolvableGroebnerBasePseudoSeq.new(cofac).isLeftGB(ff);
          kind = "pseudo"
       end
    end
    t = System.currentTimeMillis() - t;
    puts "isLeftGB(#{kind}) = #{b} executed in #{t} ms\n"; 
    return b;
end
isLeftSyzygy(m) click to toggle source

Test if this is a left syzygy of the module in m.

# File examples/jas.rb, line 4097
def isLeftSyzygy(m)
    p = @pset;
    g = p.list;
    l = m.list;
    #puts "l = #{l}"; 
    #puts "g = #{g}"; 
    t = System.currentTimeMillis();
    z = SolvableSyzygySeq.new(p.ring.coFac).isLeftZeroRelation( l, g );
    t = System.currentTimeMillis() - t;
    puts "executed isLeftSyzygy in #{t} ms\n"; 
    return z;
end
isONE() click to toggle source

Test if ideal is one.

# File examples/jas.rb, line 3759
def isONE()
    s = SolvableIdeal.new(@pset);
    return s.isONE(); 
end
isRightGB() click to toggle source

Test if this is a right Groebner base.

# File examples/jas.rb, line 3909
def isRightGB()
    cofac = @ring.ring.coFac;
    ff = @pset.list;
    kind = "";
    t = System.currentTimeMillis();
    if cofac.is_a? GenPolynomialRing #and cofac.isCommutative()
       b = SolvableGroebnerBasePseudoRecSeq.new(cofac).isRightGB(ff);
       kind = "pseudoRec"
    else
       if cofac.isField() or not cofac.isCommutative()
          b = SolvableGroebnerBaseSeq.new().isRightGB(ff);
          kind = "field|nocom"
       else 
          b = SolvableGroebnerBasePseudoSeq.new(cofac).isRightGB(ff);
          kind = "pseudo"
       end
    end
    t = System.currentTimeMillis() - t;
    puts "isRightGB(#{kind}) = #{b} executed in #{t} ms\n"; 
    return b;
end
isRightSyzygy(m) click to toggle source

Test if this is a right syzygy of the module in m.

# File examples/jas.rb, line 4113
def isRightSyzygy(m)
    p = @pset;
    g = p.list;
    l = m.list;
    #puts "l = #{l}"; 
    #puts "g = #{g}"; 
    t = System.currentTimeMillis();
    z = SolvableSyzygySeq.new(p.ring.coFac).isRightZeroRelation( l, g );
    t = System.currentTimeMillis() - t;
    puts "executed isRightSyzygy in #{t} ms\n"; 
    return z;
end
isTwosidedGB() click to toggle source

Test if this is a two-sided Groebner base.

# File examples/jas.rb, line 3859
def isTwosidedGB()
    cofac = @ring.ring.coFac;
    ff = @pset.list;
    kind = "";
    t = System.currentTimeMillis();
    if cofac.is_a? GenPolynomialRing #and cofac.isCommutative()
       b = SolvableGroebnerBasePseudoRecSeq.new(cofac).isTwosidedGB(ff);
       kind = "pseudoRec"
    else
       if cofac.isField() or not cofac.isCommutative()
          b = SolvableGroebnerBaseSeq.new().isTwosidedGB(ff);
          kind = "field|nocom"
       else 
          b = SolvableGroebnerBasePseudoSeq.new(cofac).isTwosidedGB(ff);
          kind = "pseudo"
       end
    end
    t = System.currentTimeMillis() - t;
    puts "isTwosidedGB(#{kind}) = #{b} executed in #{t} ms\n"; 
    return b;
end
isZERO() click to toggle source

Test if ideal is zero.

# File examples/jas.rb, line 3767
def isZERO()
    s = SolvableIdeal.new(@pset);
    return s.isZERO(); 
end
leftGB() click to toggle source

Compute a left Groebner base.

# File examples/jas.rb, line 3775
def leftGB()
    #if ideal != nil
    #   return SolvIdeal.new(@ring,"",@ideal.leftGB());
    #end
    cofac = @ring.ring.coFac;
    ff = @pset.list;
    kind = "";
    t = System.currentTimeMillis();
    if cofac.is_a? GenPolynomialRing #and cofac.isCommutative()
       gg = SolvableGroebnerBasePseudoRecSeq.new(cofac).leftGB(ff);
       kind = "pseudoRec"
    else 
       if cofac.isField() or not cofac.isCommutative()
          gg = SolvableGroebnerBaseSeq.new().leftGB(ff);
          kind = "field|nocom"
       else
          gg = SolvableGroebnerBasePseudoSeq.new(cofac).leftGB(ff);
          kind = "pseudo"
       end
    end
    t = System.currentTimeMillis() - t;
    puts "sequential(#{kind}) leftGB executed in #{t} ms\n"; 
    return SolvIdeal.new(@ring,"",gg);
end
leftReduction(p) click to toggle source

Compute a left normal form of p with respect to this ideal.

# File examples/jas.rb, line 4013
def leftReduction(p)
    s = @pset;
    gg = s.list;
    if p.is_a? RingElem
        p = p.elem;
    end
    n = SolvableReductionSeq.new().leftNormalform(gg,p);
    return RingElem.new(n);
end
leftSyzygy() click to toggle source

Left Syzygy of generating polynomials.

# File examples/jas.rb, line 4069
def leftSyzygy()
    p = @pset;
    l = p.list;
    t = System.currentTimeMillis();
    s = SolvableSyzygySeq.new(p.ring.coFac).leftZeroRelationsArbitrary( l );
    m = SolvableModule.new("",p.ring);
    t = System.currentTimeMillis() - t;
    puts "executed leftSyzygy in #{t} ms\n"; 
    return SolvableSubModule.new(m,"",s);
end
parLeftGB(th) click to toggle source

Compute a left Groebner base in parallel.

# File examples/jas.rb, line 4039
def parLeftGB(th)
    s = @pset;
    ff = s.list;
    bbpar = SolvableGroebnerBaseParallel.new(th);
    t = System.currentTimeMillis();
    gg = bbpar.leftGB(ff);
    t = System.currentTimeMillis() - t;
    bbpar.terminate();
    puts "parallel #{th} leftGB executed in #{t} ms\n"; 
    return SolvIdeal.new(@ring,"",gg);
end
parTwosidedGB(th) click to toggle source

Compute a two-sided Groebner base in parallel.

# File examples/jas.rb, line 4054
def parTwosidedGB(th)
    s = @pset;
    ff = s.list;
    bbpar = SolvableGroebnerBaseParallel.new(th);
    t = System.currentTimeMillis();
    gg = bbpar.twosidedGB(ff);
    t = System.currentTimeMillis() - t;
    bbpar.terminate();
    puts "parallel #{th} twosidedGB executed in #{t} ms\n"; 
    return SolvIdeal.new(@ring,"",gg);
end
rightGB() click to toggle source

Compute a right Groebner base.

# File examples/jas.rb, line 3884
def rightGB()
    cofac = @ring.ring.coFac;
    ff = @pset.list;
    kind = "";
    t = System.currentTimeMillis();
    if cofac.is_a? GenPolynomialRing #and cofac.isCommutative()
       gg = SolvableGroebnerBasePseudoRecSeq.new(cofac).rightGB(ff);
       kind = "pseudoRec"
    else
       if cofac.isField() or not cofac.isCommutative()
          gg = SolvableGroebnerBaseSeq.new().rightGB(ff);
          kind = "field|nocom"
       else 
          gg = SolvableGroebnerBasePseudoSeq.new(cofac).rightGB(ff);
          kind = "pseudo"
       end
    end
    t = System.currentTimeMillis() - t;
    puts "sequential(#{kind}) rightGB executed in #{t} ms\n"; 
    return SolvIdeal.new(@ring,"",gg);
end
rightReduction(p) click to toggle source

Compute a right normal form of p with respect to this ideal.

# File examples/jas.rb, line 4026
def rightReduction(p)
    s = @pset;
    gg = s.list;
    if p.is_a? RingElem
        p = p.elem;
    end
    n = SolvableReductionSeq.new().rightNormalform(gg,p);
    return RingElem.new(n);
end
rightSyzygy() click to toggle source

Right Syzygy of generating polynomials.

# File examples/jas.rb, line 4083
def rightSyzygy()
    p = @pset;
    l = p.list;
    t = System.currentTimeMillis();
    s = SolvableSyzygySeq.new(p.ring.coFac).rightZeroRelationsArbitrary( l );
    m = SolvableModule.new("",p.ring);
    t = System.currentTimeMillis() - t;
    puts "executed rightSyzygy in #{t} ms\n"; 
    return SolvableSubModule.new(m,"",s);
end
sum(other) click to toggle source

Compute the sum of this and the other ideal.

# File examples/jas.rb, line 3953
def sum(other)
    s = SolvableIdeal.new(@pset);
    t = SolvableIdeal.new(other.pset);
    nn = s.sum( t );
    return SolvIdeal.new(@ring,"",nn.getList());
end
toQuotientCoefficients() click to toggle source

Convert to polynomials with SolvableQuotient coefficients.

# File examples/jas.rb, line 3973
def toQuotientCoefficients()
    if @pset.ring.coFac.getClass().getSimpleName() == "SolvableResidueRing"
       cf = @pset.ring.coFac.ring;
    elsif @pset.ring.coFac.getClass().getSimpleName() == "GenSolvablePolynomialRing"
       cf = @pset.ring.coFac;
    #elsif @pset.ring.coFac.getClass().getSimpleName() == "GenPolynomialRing"
    #   cf = @pset.ring.coFac;
    #   puts "cf = " + cf.toScript();
    else
       return self;
    end
    rrel = @pset.ring.table.relationList() + @pset.ring.polCoeff.coeffTable.relationList();
    #puts "rrel = " + str(rrel);
    qf = SolvableQuotientRing.new(cf);
    qr = QuotSolvablePolynomialRing.new(qf,@pset.ring);
    #puts "qr = " + str(qr);
    qrel = rrel.map { |r| RingElem.new(qr.fromPolyCoefficients(r)) };
    #puts "qrel = " + str(qrel);
    qring = SolvPolyRing.new(qf,@ring.ring.getVars(),@ring.ring.tord,qrel);
    #puts "qring = " + str(qring);
    qlist = @list.map { |r| qr.fromPolyCoefficients(@ring.ring.toPolyCoefficients(r)) };
    qlist = qlist.map { |r| RingElem.new(r) };
    return SolvIdeal.new(qring,"",qlist);
end
to_s() click to toggle source

Create a string representation.

# File examples/jas.rb, line 3732
def to_s()
    return @pset.toScript();
end
twosidedGB() click to toggle source

Compute a two-sided Groebner base.

# File examples/jas.rb, line 3828
def twosidedGB()
    cofac = @ring.ring.coFac;
    ff = @pset.list;
    kind = "";
    t = System.currentTimeMillis();
    if cofac.is_a? GenPolynomialRing #and cofac.isCommutative()
       gg = SolvableGroebnerBasePseudoRecSeq.new(cofac).twosidedGB(ff);
       kind = "pseudoRec"
    else 
       #puts "two-sided: " + cofac.to_s
       if cofac.is_a? WordResidue  #Ring
          gg = SolvableGroebnerBasePseudoSeq.new(cofac).twosidedGB(ff);
          kind = "pseudo"
       else 
          if cofac.isField() or not cofac.isCommutative()
             gg = SolvableGroebnerBaseSeq.new().twosidedGB(ff);
             kind = "field|nocom"
          else
             gg = SolvableGroebnerBasePseudoSeq.new(cofac).twosidedGB(ff);
             kind = "pseudo"
          end
       end
    end
    t = System.currentTimeMillis() - t;
    puts "sequential(#{kind}) twosidedGB executed in #{t} ms\n"; 
    return SolvIdeal.new(@ring,"",gg);
end
univariates() click to toggle source

Compute the univariate polynomials in each variable of this twosided ideal.

# File examples/jas.rb, line 3963
def univariates()
    s = SolvableIdeal.new(@pset);
    ll = s.constructUnivariate();
    nn = ll.map {|e| RingElem.new(e) };
    return nn;
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.