[FTheoryTools] Reduce allocs#4453
Conversation
8250f1c to
90bee65
Compare
3c10bba to
1211766
Compare
| # Check for non-Abelian gauge group breaking | ||
| if has_attribute(g4, :breaks_non_abelian_gauge_group) | ||
| if breaks_non_abelian_gauge_group(g4) | ||
| push!(properties_string, " - Non-Abelian gauge group: broken") |
There was a problem hiding this comment.
Just out of curiosity, why Non-Abelian and not the more usual non-abelian?
There was a problem hiding this comment.
As a humble PhD student, @mohamed-barakat once showed me his (at the time) writing style for proposals, in which the capitalized the name of Mathematicians to honor their contributions. In the case at hand, Abel. I believe this style stayed with me since, although I am sure to have been inconsistent.
On second look, I favor non-abelian here. More consistent. Will update this shortly.
There was a problem hiding this comment.
The way I learned this is different: names and words derived from thsoe are capitalized. So it is e.g. "Noetherian ring" or "Riemannian manifold" or "Coxeter group". But "abelian" is a rare exception, the name is so ingrained that it is no longer considered a name but it really turned into a regular word. In a sense that's the greater honor :-)
There was a problem hiding this comment.
Indeed I just found this on Wikipedia:
Among mathematical adjectives derived from the proper name of a mathematician, the word "abelian" is rare in that it is often spelled with a lowercase a, rather than an uppercase A, the lack of capitalization being a tacit acknowledgment not only of the degree to which Abel's name has been institutionalized but also of how ubiquitous in modern mathematics are the concepts introduced by him
852dbd5 to
1f663da
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #4453 +/- ##
=======================================
Coverage 84.39% 84.39%
=======================================
Files 668 668
Lines 88567 88560 -7
=======================================
- Hits 74746 74742 -4
+ Misses 13821 13818 -3
|
08e4112 to
c4fdca5
Compare
Co-authored-by: Max Horn <max@quendi.de> Co-authored-by: Lars Göttgens <lars.goettgens@gmail.com>
c4fdca5 to
5b54c55
Compare
|
@apturner and @emikelsons I have worked over this code a little, in that I keep the original code for |
| f_primes = factor(weierstrass_section_f(w)) | ||
| g_primes = factor(weierstrass_section_g(w)) | ||
| f_prime_dict = Dict(fp[1] => fp[2] for fp in f_primes) | ||
| g_prime_dict = Dict(gp[1] => gp[2] for gp in g_primes) |
There was a problem hiding this comment.
Just to say (and feel free to ignore this) you can also write this
| f_primes = factor(weierstrass_section_f(w)) | |
| g_primes = factor(weierstrass_section_g(w)) | |
| f_prime_dict = Dict(fp[1] => fp[2] for fp in f_primes) | |
| g_prime_dict = Dict(gp[1] => gp[2] for gp in g_primes) | |
| f_primes = factor(weierstrass_section_f(w)) | |
| g_primes = factor(weierstrass_section_g(w)) | |
| f_prime_dict = Dict(p => n for (p,n) in f_primes) | |
| g_prime_dict = Dict(p => n for (p,n) in g_primes) |
or even this
| f_primes = factor(weierstrass_section_f(w)) | |
| g_primes = factor(weierstrass_section_g(w)) | |
| f_prime_dict = Dict(fp[1] => fp[2] for fp in f_primes) | |
| g_prime_dict = Dict(gp[1] => gp[2] for gp in g_primes) | |
| f_prime_dict = Dict(p => n for (p,n) in factor(weierstrass_section_f(w))) | |
| g_prime_dict = Dict(p => n for (p,n) in factor(weierstrass_section_g(w))) |
Of course even simpler is
| f_primes = factor(weierstrass_section_f(w)) | |
| g_primes = factor(weierstrass_section_g(w)) | |
| f_prime_dict = Dict(fp[1] => fp[2] for fp in f_primes) | |
| g_prime_dict = Dict(gp[1] => gp[2] for gp in g_primes) | |
| f_prime_dict = factor(weierstrass_section_f(w)).fac | |
| g_prime_dict = factor(weierstrass_section_g(w)).fac |
but that is using internals. I think what we really should do is change the getindex method for Fac to return 0 for missing keys instead of raising an error (as suggested in Nemocas/AbstractAlgebra.jl#1959), then you could just do this:
| f_primes = factor(weierstrass_section_f(w)) | |
| g_primes = factor(weierstrass_section_g(w)) | |
| f_prime_dict = Dict(fp[1] => fp[2] for fp in f_primes) | |
| g_prime_dict = Dict(gp[1] => gp[2] for gp in g_primes) | |
| f_primes = factor(weierstrass_section_f(w)) | |
| g_primes = factor(weierstrass_section_g(w)) |
and replace get(f_prime_dict, d_prime[1], 0) by f_prime[d_prime[1]].
| for (i, d_prime) in enumerate(nontrivial_d_primes) | ||
| f_order = get(f_prime_dict, d_prime[1], 0) | ||
| g_order = get(g_prime_dict, d_prime[1], 0) | ||
| d_order = d_prime[2] | ||
| ords = (f_order, g_order, d_order) | ||
| kodaira_types[i] = (ideal([d_prime[1]]), ords, _kodaira_type(ideal([d_prime[1]]), ords, w)) | ||
| end |
There was a problem hiding this comment.
You can use nested tuples to make this nicer to read:
| for (i, d_prime) in enumerate(nontrivial_d_primes) | |
| f_order = get(f_prime_dict, d_prime[1], 0) | |
| g_order = get(g_prime_dict, d_prime[1], 0) | |
| d_order = d_prime[2] | |
| ords = (f_order, g_order, d_order) | |
| kodaira_types[i] = (ideal([d_prime[1]]), ords, _kodaira_type(ideal([d_prime[1]]), ords, w)) | |
| end | |
| for (i, (p, n)) in enumerate(nontrivial_d_primes) | |
| f_order = get(f_prime_dict, p, 0) | |
| g_order = get(g_prime_dict, p, 0) | |
| d_order = n | |
| ords = (f_order, g_order, d_order) | |
| I = ideal([p]) | |
| kodaira_types[i] = (I, ords, _kodaira_type(I, ords, w)) | |
| end |
You could also avoid factoring f and g and do this instead:
| for (i, d_prime) in enumerate(nontrivial_d_primes) | |
| f_order = get(f_prime_dict, d_prime[1], 0) | |
| g_order = get(g_prime_dict, d_prime[1], 0) | |
| d_order = d_prime[2] | |
| ords = (f_order, g_order, d_order) | |
| kodaira_types[i] = (ideal([d_prime[1]]), ords, _kodaira_type(ideal([d_prime[1]]), ords, w)) | |
| end | |
| f = weierstrass_section_f(w) | |
| g = weierstrass_section_g(w) | |
| for (i, (p, d_order)) in enumerate(nontrivial_d_primes) | |
| f_order = valuation(f, p) | |
| g_order = valuation(g, p) | |
| ords = (f_order, g_order, d_order) | |
| I = ideal([p]) | |
| kodaira_types[i] = (I, ords, _kodaira_type(I, ords, w)) | |
| end |
For my convenience, based on #4446.
cc @apturner @emikelsons