ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Mon, 15 Jun 2020 01:09:29 +0200Count GF(q) arithmeticshttps://ask.sagemath.org/question/51967/count-gfq-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?Sun, 14 Jun 2020 16:26:02 +0200https://ask.sagemath.org/question/51967/count-gfq-arithmetics/Answer by slelievre for <p>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</p>
<pre><code>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)
</code></pre>
<p>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?</p>
https://ask.sagemath.org/question/51967/count-gfq-arithmetics/?answer=52000#post-id-52000The profiling tools available in Sage might be what you are after.
See the
- [Sage thematic tutorial on profiling](https://doc.sagemath.org/html/en/thematic_tutorials/profiling.html)
Mon, 15 Jun 2020 01:09:29 +0200https://ask.sagemath.org/question/51967/count-gfq-arithmetics/?answer=52000#post-id-52000