Skip to content

Conversation

@hexaron
Copy link

@hexaron hexaron commented May 24, 2022

There is a bug, when a PD component loops back on itself.
In this case, the numbers b and d in the crossing [a, b, c, d] are not one apart.
Therefore the if in:

khoca/khoca.py

Lines 48 to 52 in dbb4a80

for i in pd:
if (i[3] == ((i[1] + 1) % (2 * len(pd)))):
result.append([2,i[0] - 1,i[1] - 1,i[2] - 1,i[3] - 1])
else:
result.append([3,i[1] - 1,i[2] - 1,i[3] - 1,i[0] - 1])

is not sufficient to catch this case for multiple components, since in this case 2 * len(pd) is not the size of the component.

If we knew the size of the component, we could mod by that after shifting the indices to 0, but I think the simpler solution is to do as I suggest in this pull-request.

@soehms
Copy link
Contributor

soehms commented Jan 23, 2024

Is this PR about #5?

@hexaron
Copy link
Author

hexaron commented Jan 23, 2024

I'm sorry, but I didn't look into this for over 2 years, so actually I don't know anymore.

But if I remember correctly, the problem I encountered had something to do with the braid on two strands given for example by \sigma \circ \sigma^{-1}. Because in that case there are two components that have only half the size of twice the length of the PD notation.
In the above pull request I wrote that in this case the conversion done in the function pd_to_mypd is incorrect.
To orient the PD notation (to yield mypd), it always mods by twice the length of the PD notation. But the example above shows that this is not always the correct modulus.

@soehms
Copy link
Contributor

soehms commented Jan 24, 2024

I'm sorry, but I didn't look into this for over 2 years, so actually I don't know anymore.

But if I remember correctly, the problem I encountered had something to do with the braid on two strands given for example by \sigma \circ \sigma^{-1}. Because in that case there are two components that have only half the size of twice the length of the PD notation. In the above pull request I wrote that in this case the conversion done in the function pd_to_mypd is incorrect. To orient the PD notation (to yield mypd), it always mods by twice the length of the PD notation. But the example above shows that this is not always the correct modulus.

Thanks for your reply! In the meantime I used the (inofficial) PyPI version to check if your changes fix #5. In order to do that I manipulated the code downloaded from PyPI locally with your changes. The result is that your changes actually fix the issue! Here is the Sage-code I used for the check:

sage: def khoca2sage(l, characteristic=0, reduced=False):
....:     """
....:     From src/python_interface/pui.pyx  printFormattedHomology:
....:
....:     l = eval(s)
....:     l = [[i[2], i[0], i[1], i[3]] for i in l]
....:     # i[0]: torsion, i[1]: t-degree, i[2]: q-degree, i[3]: coefficient
....:
....:     Here:
....:     # i[2]: torsion, i[0]: t-degree, i[1]: q-degree, i[3]: coefficient
....:     """
....:     cf = {}
....:     if reduced:
....:         l = [i for i in l[0] if i[2] <= characteristic]
....:     else:
....:         l = [i for i in l[1] if i[2] <= characteristic]
....:     for i in l:
....:         if i[2] > characteristic:
....:             continue
....:         et = (-(i[0] - i[2]/2), i[1])  # -i[0] for compatibility with Sage
....:         if et in cf.keys():
....:             cf[et] += i[3]
....:         else:
....:             cf[et] = i[3]
....:     return R(cf)
....:
....: from sage.rings.polynomial.laurent_polynomial_ring import LaurentPolynomialRing
....: R = LaurentPolynomialRing(ZZ, 't,q')
....:
....: from khoca import InteractiveCalculator
....: KH = InteractiveCalculator()
....: import json
....: with open('list_1091_link_khoca_diff.json') as f:
....:     list_1091_link_khoca_diff = json.load(f)
....:
sage: list_ki = [KnotInfo(l) for l in list_1091_link_khoca_diff]
sage: all(khoca2sage(KH(L.pd_notation())) == khoca2sage(KH(L.braid_notation())) for L in list_ki)
True

@LLewark what is standing against merging this PR? It fixes the wrong results of 1091 links from LinkInfo and the argumentation of @hexaron sounds reasonable to me.

Copy link
Contributor

@soehms soehms left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See comment above!

@soehms soehms mentioned this pull request Jul 22, 2025
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