Hello,

Not sure whether it is related or not. In the file
sage/rings/function_field/function_field.py there are two doctests
that take respectively much shorter and much longer than what is
written. Namely

Trying (line 58):    TestSuite(L).run()  # long time (8s on sage.math, 2012)
Expecting nothing
ok [3.16 s]
Trying (line 59):    TestSuite(M).run()  # long time (52s on sage.math, 2012)
Expecting nothing
ok [141.39 s]

so it is roughly /2 and x3 with respect to the timings in the
comments! These differences certainly come from something that has
changed since 2012...

Vincent


2015-01-26 21:13 UTC+01:00, Stefan <stefanvanz...@gmail.com>:
> Hi all,
>
> I wrote some code for product rings a while back, and went back to it for
> more computations. My computations took vastly longer, and it seems the
> culprit is the inverse function in my ring.
>
> The product code ring is here:
>
> http://pastebin.com/V2Cx6gVB
>
> I ran the following test code:
>
> =====
> from sage.matroids.advanced import *
> load /path/to/product_ring.py
>
> H5 = ProductRing((GF(5), GF(5), GF(5), GF(5), GF(5), GF(5)))
> print H5
>
> H5CrossRatios = set([H5(1)])
> H5CrossRatios.update([H5(x) for x in
>                       Permutations([2, 2, 3, 3, 4, 4])])
> L = list(H5CrossRatios)
> print len(H5CrossRatios)
>
> timeit("""
> s = 0
> for i in xrange(91):
>     for j in xrange(91):
>         for k in xrange(30):
>                         s = s + L[i] + (L[j])^(-1) * L[k]""", number=1,
> repeat=1)
> =====
>
> In Sage 5.12 this takes 6.41 seconds on my computer; in Sage 6.5.beta5 it
> takes 117 seconds.
>
> The culprit is the inverse, if you do just addition and multiplication the
> code runs in the same amount of time. So...
>
> * did I implement my ring wrong, and did it just happen to work better in
> the past?
> * can I change my ring code to speed this back up?
> * can you point to a change in Sage that could have caused this? And help
> me think about a way to fix it?
>
> Cheers,
>
> Stefan
>
> --
> You received this message because you are subscribed to the Google Groups
> "sage-devel" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to sage-devel+unsubscr...@googlegroups.com.
> To post to this group, send email to sage-devel@googlegroups.com.
> Visit this group at http://groups.google.com/group/sage-devel.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.

Reply via email to