Skip to content

Various improvements for the computation of Reshetikhin--Turaev knot polynomials - #75

Merged
NathanDunfield merged 18 commits into
3-manifolds:masterfrom
Shakugannotorch:master
Oct 13, 2026
Merged

NathanDunfield merged 18 commits into
3-manifolds:masterfrom
Shakugannotorch:master

Conversation

@Shakugannotorch

Copy link
Copy Markdown
Contributor

This is mainly to update the code for the computation of Reshetikhin--Turaev knot polynomials to optimize the RAM consumption, along with some improvements to other related code. The RAM cost is currently the main bottleneck of the computation, and this update in general cut down the RAM cost by ~50% compared to the previous version.

Feature additions

  1. Added methods coefficients and latex for DictLaurentPolynomial, where the former returns a dictionary representing the coefficients of a given variable, and the latter returns a string of the polynomial in LaTeX format.
  2. DictLaurentPolynomial now automatically drops redundant variables stored in its attribute after each binary operation.
  3. The computation of Reshetikhin--Turaev knot polynomials now automatically converts the output from FastDictLaurentPolynomial into DictLaurentPolynomial.
  4. Added a method Link.RT_polynomial which takes R-matrices as input and computes the corresponding knot polynomial. The computation of various RT polynomials now passes through this method to avoid redundant code.
  5. Added the code and R-matrices for computing the FK3 polynomial as defined in [GL].
  6. Added a flag method for some methods along the line of computing the RT polynomials, which controls the behavior of opt_einsum. The flag has not been added to Link.RT_polynomial yet.

Bug fixes

  1. Fixed a bug for DictLaurentPolynomial where the computation is not handled correctly if two polynomials have the same set of variables but are stored as differently ordered lists within the two polynomials.

Others

  1. Added references in the docstrings of relevant methods in invariants.py

Shakugannotorch and others added 18 commits July 26, 2026 17:14
Slicing cuts an edge of the network and sums the contraction over its
values, which shrinks every intermediate at the cost of repeating the
contraction.  It is a large win on memory-bound contractions (2.6GB ->
184MB on a 5-strand braid at V3) and a large loss on cheap ones
(28MB/3s -> 208MB/108s for 11n34 at V4), and no cheap way to tell the
two apart in advance held up: dense intermediate size, sparse entry
counts and monomial-product counts each misclassified a case the others
got right.  Moved to the rt-slicing branch until that is resolved.

What remains is the part that helps unconditionally: interned exponent
tuples, streaming contraction that consumes its larger operand, and
in-place accumulation.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
…with the same set but differently ordered variables
@NathanDunfield
NathanDunfield merged commit dcf988d into 3-manifolds:master Oct 13, 2026
20 of 21 checks passed
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.

2 participants