Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New algorithm for duals in GS.Bands #259

Merged
merged 1 commit into from
Apr 3, 2024
Merged

New algorithm for duals in GS.Bands #259

merged 1 commit into from
Apr 3, 2024

Conversation

pablosanjose
Copy link
Owner

@pablosanjose pablosanjose commented Mar 29, 2024

Closes #257

The Green Bands solver (integrator over simplices of bands) needs to establish dual numbers for phase ϕ = k*r on simplex vertices. If a vertex is ϕ-degenerate and r != 0, the integration algorithm needs to have finite duals at a number of places, e.g. at α-coefficients which involve inverses of vandermonde determinants. There are many ways to choose the value of duals. Originally we chose them randomly (equivalent to doing a Taylor expansion around infinitesimal random simplex distortions). This led to problems of nondeterministic numeric noise. In #238 we introduced a better algorithm that would choose the duals in a deterministic way, so that the vandermonde determinants are never zero. However, the algorithm was not very elegant, as it was likely to fail for simplex dimension greater than three (damn obsession of generality!). We also missed an important edge case that caused #257: even if the vandermonde determinant is nonzero, there is also the Λ-coefficients in the integrator formula, which involve a different type of inverse (1/t^j_l) that could be zero with the duals of the #238 algorithm.

In this PR we choose duals dϕ so that t_n = (dϕ_0-dϕ_n)/(ϵ_0-ϵ_n) maximizes M=t_1 * t_2 * t_3*...*(t_1-t_2)*(t_1-t_3)*...*(t_{D-1}-t_D). This is a modified vandermonde determinant where powers go from 1 to D instead of 0 to D-1 (thanks Adrian Prada for the key clue!). It includes all the factors that are inverted in the integration algorithm. Using this fact, we numerically solved the maximization problem, and found an approximate but very accurate solution for t_n = (-1)^n\sqrt(0.5*(1+n^2)) that is very fast to compute and works up to at least D = 7 (didn't care to check further, as the numerical problem becomes very hard).

The black curve is the approximate solution, the colored curves are the numerical solutions for D = 2 to 7, normalized to t_1

Screenshot 2024-03-29 at 21 17 32

@codecov-commenter
Copy link

codecov-commenter commented Mar 29, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 92.48%. Comparing base (334ebd0) to head (383651d).
Report is 1 commits behind head on master.

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #259      +/-   ##
==========================================
+ Coverage   92.36%   92.48%   +0.12%     
==========================================
  Files          36       36              
  Lines        5906     5885      -21     
==========================================
- Hits         5455     5443      -12     
+ Misses        451      442       -9     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@pablosanjose pablosanjose merged commit a26d181 into master Apr 3, 2024
9 checks passed
@pablosanjose pablosanjose deleted the duals branch April 24, 2024 16:06
@pablosanjose pablosanjose mentioned this pull request Apr 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

GS.Bands and Divide by zero
2 participants