Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Count GF(q) arithmetics

Hi, I was trying to count the number of basic arithmetics happened in a GF(q)[x] or GF(q)[x].quo(irr) operation. I turned to define a wrapper class

Fq = GF(q)
class probeFq(Fq):
  def __init__(self,*p,**kw):
    self._cnt = 0
    super(probeFq,self).__init__(*p,**kw)
  def __add__(self, *p,**kw):
    self._cnt += 1
    return super(probeFq,self).__add__(*p,**kw)

However, I turns out that GF(q) in sage is not a class. Instead it is some sort of factory object. Is there any way to count the number of arithmetics happened to an element?