khoca 0.4.dev7__tar.gz → 1.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (80) hide show
  1. khoca-1.1/.github/workflows/build_wheels.yml +53 -0
  2. khoca-1.1/.github/workflows/build_wheels_linux.yml +23 -0
  3. khoca-1.1/.github/workflows/build_wheels_macos.yml +41 -0
  4. khoca-1.1/.github/workflows/build_wheels_windows.yml +59 -0
  5. khoca-1.1/.github/workflows/publish_pypi.yml +25 -0
  6. khoca-1.1/.github/workflows/publish_source_pypi.yml +26 -0
  7. khoca-1.1/.gitignore +11 -0
  8. {khoca-0.4.dev7 → khoca-1.1}/COPYING +0 -0
  9. {khoca-0.4.dev7 → khoca-1.1}/Dockerfile +4 -2
  10. {khoca-0.4.dev7 → khoca-1.1}/Makefile +2 -2
  11. khoca-1.1/PKG-INFO +218 -0
  12. {khoca-0.4.dev7 → khoca-1.1}/__init__.py +35 -34
  13. khoca-1.1/analyse.sh +28 -0
  14. khoca-1.1/before-all.sh +53 -0
  15. khoca-1.1/before-build.sh +34 -0
  16. {khoca-0.4.dev7 → khoca-1.1}/converters/montesinos.py +1 -1
  17. khoca-1.1/install-pari-msys2.sh +142 -0
  18. khoca-1.1/install-pari.sh +27 -0
  19. khoca-1.1/khoca.egg-info/PKG-INFO +218 -0
  20. {khoca-0.4.dev7 → khoca-1.1}/khoca.egg-info/SOURCES.txt +24 -4
  21. {khoca-0.4.dev7 → khoca-1.1}/khoca.egg-info/top_level.txt +0 -1
  22. {khoca-0.4.dev7 → khoca-1.1}/khoca.py +25 -11
  23. khoca-1.1/pyproject.toml +25 -0
  24. khoca-1.1/pytest.ini +4 -0
  25. {khoca-0.4.dev7 → khoca-1.1}/setup.py +51 -11
  26. {khoca-0.4.dev7 → khoca-1.1}/src/krasner/krasner.cpp +4 -4
  27. {khoca-0.4.dev7 → khoca-1.1}/src/krasner/krasner.h +8 -6
  28. {khoca-0.4.dev7 → khoca-1.1}/src/krasner/krasnerExplicitTemplates.cpp +1 -1
  29. {khoca-0.4.dev7 → khoca-1.1}/src/planar_algebra/coefficient_rings.cpp +3 -3
  30. {khoca-0.4.dev7 → khoca-1.1}/src/planar_algebra/coefficient_rings.h +8 -7
  31. {khoca-0.4.dev7 → khoca-1.1}/src/planar_algebra/explicitTemplates.cpp +2 -2
  32. {khoca-0.4.dev7 → khoca-1.1}/src/planar_algebra/planar_algebra.cpp +33 -33
  33. {khoca-0.4.dev7 → khoca-1.1}/src/planar_algebra/planar_algebra.h +15 -15
  34. {khoca-0.4.dev7 → khoca-1.1}/src/planar_algebra/smith.cpp +1 -1
  35. {khoca-0.4.dev7 → khoca-1.1}/src/planar_algebra/sparsemat.cpp +2 -2
  36. {khoca-0.4.dev7 → khoca-1.1}/src/planar_algebra/sparsemat.h +1 -1
  37. {khoca-0.4.dev7 → khoca-1.1}/src/planar_algebra/sparsematExplicitTemplates.cpp +1 -1
  38. khoca-1.1/src/python_interface/pui.cpp +18863 -0
  39. {khoca-0.4.dev7 → khoca-1.1}/src/python_interface/pui.pyx +22 -0
  40. {khoca-0.4.dev7 → khoca-1.1}/src/python_interface/pythonInterface.cpp +10 -4
  41. {khoca-0.4.dev7 → khoca-1.1}/src/shared.cpp +2 -2
  42. {khoca-0.4.dev7 → khoca-1.1}/src/shared.h +9 -0
  43. khoca-1.1/test-command.sh +41 -0
  44. khoca-1.1/tests/test.py +123 -0
  45. khoca-0.4.dev7/.github/workflows/upload_pypi.yml +0 -15
  46. khoca-0.4.dev7/PKG-INFO +0 -218
  47. khoca-0.4.dev7/bin/pd_to_mypd.py +0 -36
  48. khoca-0.4.dev7/bin/pd_to_mypdLib.py +0 -30
  49. khoca-0.4.dev7/khoca.egg-info/PKG-INFO +0 -218
  50. khoca-0.4.dev7/pyproject.toml +0 -8
  51. khoca-0.4.dev7/src/python_interface/pui.cpp +0 -12579
  52. {khoca-0.4.dev7 → khoca-1.1}/.github/workflows/push_docker.yml +0 -0
  53. {khoca-0.4.dev7 → khoca-1.1}/.github/workflows/run_tests.yml +0 -0
  54. {khoca-0.4.dev7 → khoca-1.1}/INSTALL +0 -0
  55. {khoca-0.4.dev7 → khoca-1.1}/MANIFEST.in +0 -0
  56. {khoca-0.4.dev7 → khoca-1.1}/README.md +0 -0
  57. {khoca-0.4.dev7 → khoca-1.1}/bin/BraidToMyPD.py +0 -0
  58. {khoca-0.4.dev7 → khoca-1.1}/bin/KrasnerGaussToMyPD.py +0 -0
  59. {khoca-0.4.dev7 → khoca-1.1}/bin/KrasnerGaussToMyPDLib.py +0 -0
  60. {khoca-0.4.dev7 → khoca-1.1}/bin/__init__.py +0 -0
  61. {khoca-0.4.dev7 → khoca-1.1}/bin/pseudoBraidToKrasnerGauss.py +0 -0
  62. {khoca-0.4.dev7 → khoca-1.1}/bin/pseudoBraidToKrasnerGaussLib.py +0 -0
  63. {khoca-0.4.dev7 → khoca-1.1}/converters/binToHuman.py +0 -0
  64. {khoca-0.4.dev7 → khoca-1.1}/converters/humanToBin.py +0 -0
  65. {khoca-0.4.dev7 → khoca-1.1}/data/KhovanovMinus +0 -0
  66. {khoca-0.4.dev7 → khoca-1.1}/data/KhovanovMinus.bin +0 -0
  67. {khoca-0.4.dev7 → khoca-1.1}/data/KhovanovPlus +0 -0
  68. {khoca-0.4.dev7 → khoca-1.1}/data/KhovanovPlus.bin +0 -0
  69. {khoca-0.4.dev7 → khoca-1.1}/data/KrasnerMinus +0 -0
  70. {khoca-0.4.dev7 → khoca-1.1}/data/KrasnerMinus.bin +0 -0
  71. {khoca-0.4.dev7 → khoca-1.1}/data/KrasnerPlus +0 -0
  72. {khoca-0.4.dev7 → khoca-1.1}/data/KrasnerPlus.bin +0 -0
  73. {khoca-0.4.dev7 → khoca-1.1}/docker/entrypoint.sh +0 -0
  74. {khoca-0.4.dev7 → khoca-1.1}/khoca.egg-info/dependency_links.txt +0 -0
  75. {khoca-0.4.dev7 → khoca-1.1}/khoca.egg-info/not-zip-safe +0 -0
  76. {khoca-0.4.dev7 → khoca-1.1}/setup.cfg +0 -0
  77. {khoca-0.4.dev7 → khoca-1.1}/src/compilerFlagsInfo.cpp +0 -0
  78. {khoca-0.4.dev7 → khoca-1.1}/src/planar_algebra/coefficient_rings_explicitTemplates.cpp +0 -0
  79. {khoca-0.4.dev7 → khoca-1.1}/src/planar_algebra/smith.h +0 -0
  80. {khoca-0.4.dev7 → khoca-1.1}/src/python_interface/pythonInterface.h +0 -0
@@ -0,0 +1,53 @@
1
+ name: Reusable workflow for cibuildwheel
2
+
3
+ on:
4
+ workflow_call:
5
+ inputs:
6
+ operating-systems:
7
+ default: >-
8
+ ["ubuntu"]
9
+ type: string
10
+ required: true
11
+ system-versions:
12
+ default: >-
13
+ ["latest"]
14
+ type: string
15
+ required: true
16
+ jobs:
17
+ build_wheels:
18
+ name: Build wheels on ${{ matrix.os }}-${{ matrix.version }}
19
+ runs-on: ${{ matrix.os }}-${{ matrix.version }}
20
+ strategy:
21
+ matrix:
22
+ os: ${{ fromJson(inputs.operating-systems) }}
23
+ version: ${{ fromJson(inputs.system-versions) }}
24
+ env:
25
+ CIBW_REPAIR_WHEEL_COMMAND_MACOS: "export MACOSX_DEPLOYMENT_TARGET=${{ matrix.version }}.0; delocate-wheel --require-archs {delocate_archs} -w {dest_dir} -v {wheel}"
26
+
27
+ steps:
28
+ - uses: actions/checkout@v4
29
+
30
+ # Used to host cibuildwheel
31
+ - uses: actions/setup-python@v5
32
+ - run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*
33
+
34
+ - name: Install cibuildwheel
35
+ run: python -m pip install cibuildwheel==2.22.0
36
+
37
+ - name: Build wheels
38
+ run: python -m cibuildwheel --output-dir wheelhouse
39
+
40
+ - name: Analyse
41
+ if: always()
42
+ run: sh analyse.sh
43
+
44
+ - uses: actions/upload-artifact@v4
45
+ with:
46
+ name: khoca.tar
47
+ path: /Users/runner/work/khoca/khoca.tar
48
+ if: always()
49
+
50
+ - uses: actions/upload-artifact@v4
51
+ with:
52
+ name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }}
53
+ path: ./wheelhouse/*.whl
@@ -0,0 +1,23 @@
1
+ name: Build wheels Linux
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - "*" # Push events of new tags
7
+ workflow_dispatch:
8
+ # Allow to run manually
9
+
10
+ jobs:
11
+ build_wheels:
12
+ uses: ./.github/workflows/build_wheels.yml
13
+ with:
14
+ operating-systems: >-
15
+ ["ubuntu"]
16
+ system-versions: >-
17
+ ["latest"]
18
+
19
+ pypi-publish:
20
+ name: Upload wheels to PyPI
21
+ needs: build_wheels
22
+ uses: ./.github/workflows/publish_pypi.yml
23
+ secrets: inherit
@@ -0,0 +1,41 @@
1
+ name: Build wheels MacOS
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - "*" # Push events of new tags
7
+ workflow_dispatch:
8
+ # Allow to run manually
9
+
10
+ jobs:
11
+ build_wheels:
12
+ uses: ./.github/workflows/build_wheels.yml
13
+ with:
14
+ operating-systems: >-
15
+ ["macos"]
16
+ system-versions: >-
17
+ ["13", "14"]
18
+
19
+ pypi-publish:
20
+ # https://github.com/pypa/gh-action-pypi-publish
21
+ name: Upload wheels to PyPI
22
+ needs: build_wheels
23
+ runs-on: ubuntu-latest
24
+ env:
25
+ CAN_DEPLOY: ${{ secrets.PYPI_TOCKEN_KHOCA != '' }}
26
+ steps:
27
+
28
+ - uses: actions/download-artifact@v4
29
+ with:
30
+ pattern: cibw-wheels*
31
+ path: wheelhouse
32
+ merge-multiple: true
33
+
34
+ - name: Publish package distributions to PyPI
35
+ uses: pypa/gh-action-pypi-publish@release/v1
36
+ with:
37
+ user: __token__
38
+ password: ${{ secrets.PYPI_TOKEN_KHOCA }}
39
+ packages_dir: wheelhouse/
40
+ skip_existing: true
41
+ verbose: true
@@ -0,0 +1,59 @@
1
+ name: Build wheels Windows
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - "*" # Push events of new tags
7
+ workflow_dispatch:
8
+ # Allow to run manually
9
+
10
+ jobs:
11
+ build_wheels:
12
+ name: Build Windows wheels for 64 bit Python
13
+ runs-on: windows-latest
14
+ defaults:
15
+ run:
16
+ shell: msys2 {0}
17
+
18
+ steps:
19
+ - uses: actions/checkout@v4
20
+ - run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*
21
+
22
+ - uses: actions/setup-python@v5
23
+ name: Install a Python to use for building
24
+ with:
25
+ python-version: '3.12'
26
+
27
+ - uses: msys2/setup-msys2@v2
28
+ name: Setup an msys2 environment
29
+ with:
30
+ msystem: UCRT64
31
+ release: false
32
+ install: >-
33
+ base-devel
34
+ m4
35
+ bison
36
+ make
37
+ patch
38
+ sed
39
+ mingw-w64-x86_64-toolchain
40
+ mingw-w64-x86_64-gmp
41
+ pacboy: gcc:p
42
+ path-type: inherit
43
+
44
+ - name: Install cibuildwheel
45
+ run: |
46
+ python -m pip install cibuildwheel==2.20.0
47
+
48
+ - name: Build many wheels
49
+ run: |
50
+ python -m cibuildwheel --output-dir wheelhouse
51
+
52
+ - name: Analyse
53
+ if: always()
54
+ run: sh analyse.sh
55
+
56
+ - uses: actions/upload-artifact@v4
57
+ name: Save the wheels as artifacts
58
+ with:
59
+ path: ./wheelhouse/*.whl
@@ -0,0 +1,25 @@
1
+ name: Reusable workflow to publish to PyPI
2
+
3
+ on:
4
+ workflow_call:
5
+
6
+ jobs:
7
+ pypi-publish:
8
+ # https://github.com/pypa/gh-action-pypi-publish
9
+ name: Upload wheels to PyPI
10
+ runs-on: ubuntu-latest
11
+ steps:
12
+ - uses: actions/download-artifact@v4
13
+ with:
14
+ pattern: cibw-wheels*
15
+ path: wheelhouse
16
+ merge-multiple: true
17
+
18
+ - name: Publish package distributions to PyPI
19
+ uses: pypa/gh-action-pypi-publish@release/v1
20
+ with:
21
+ user: __token__
22
+ password: ${{ secrets.PYPI_TOKEN_KHOCA }}
23
+ packages_dir: wheelhouse/
24
+ skip_existing: true
25
+ verbose: true
@@ -0,0 +1,26 @@
1
+ name: Publish sources to PyPI
2
+
3
+ on:
4
+ workflow_dispatch:
5
+
6
+ jobs:
7
+ publish-sources:
8
+ name: Upload source distro to PyPI
9
+ runs-on: ubuntu-latest
10
+ steps:
11
+ - uses: actions/checkout@v2
12
+ - run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*
13
+ - uses: actions/setup-python@v5
14
+ - name: Prepare
15
+ run: |
16
+ python -m pip install --upgrade pip
17
+ pip install cython setuptools
18
+ - name: Create distribution
19
+ run: python3 setup.py sdist
20
+ - name: Publish distro to PyPI
21
+ uses: pypa/gh-action-pypi-publish@release/v1
22
+ with:
23
+ user: __token__
24
+ password: ${{ secrets.PYPI_TOKEN_KHOCA }}
25
+ packages_dir: dist/
26
+ verbose: true
khoca-1.1/.gitignore ADDED
@@ -0,0 +1,11 @@
1
+ bin/__pycache__/
2
+ bin/pui.so
3
+ src/krasner/krasner.o
4
+ src/planar_algebra/coefficient_rings.o
5
+ src/planar_algebra/planar_algebra.o
6
+ src/planar_algebra/smith.o
7
+ src/planar_algebra/sparsemat.o
8
+ src/python_interface/pui.cpp
9
+ src/python_interface/pui.o
10
+ src/python_interface/pythonInterface.o
11
+ src/shared.o
File without changes
@@ -14,10 +14,12 @@ ENV LANG C.UTF-8
14
14
  ENV SHELL /bin/bash
15
15
  # install prerequisites
16
16
  RUN apt-get -qq update \
17
- && apt-get -qq install -y --no-install-recommends git g++ make libgmp-dev pari-gp2c python3 python3-dev python3-pip \
17
+ && apt-get -qq install -y --no-install-recommends git g++ make libgmp-dev pari-gp2c python3 python3-dev pipx python-is-python3\
18
18
  && apt-get -qq clean \
19
19
  && rm -r /var/lib/apt/lists/* \
20
- && pip install cython \
20
+ && pipx install cython \
21
+ && pipx ensurepath \
22
+ && export PATH="$PATH:/root/.local/bin" \
21
23
  && git clone https://github.com/soehms/khoca.git \
22
24
  && cd khoca/ \
23
25
  && make
@@ -1,6 +1,6 @@
1
1
  CC=g++
2
- PYTHONVERSION=3.8
3
- GENERALCFLAGS=-c -std=c++11 -I/usr/include/python$(PYTHONVERSION) -D__STDC_LIMIT_MACROS -Wall -Wextra -march=native
2
+ PYTHONVERSION=$(shell python -c "import sys;t='{v[0]}.{v[1]}'.format(v=list(sys.version_info[:2]));sys.stdout.write(t)")
3
+ GENERALCFLAGS=-c -std=c++11 -I/usr/include/python$(PYTHONVERSION) -D__STDC_LIMIT_MACROS -Wall -Wextra
4
4
 
5
5
  STATIC_DIRECTIVE=-lpython$(PYTHONVERSION) -lgmpxx -lgmp -L/usr/local/lib -lpari
6
6
  # To compile a version of the library that contains static copies of mpir and pari, set variable STATIC to 1.
khoca-1.1/PKG-INFO ADDED
@@ -0,0 +1,218 @@
1
+ Metadata-Version: 2.1
2
+ Name: khoca
3
+ Version: 1.1
4
+ Summary: Khoca as pip installable package
5
+ Home-page: https://github.com/soehms/khoca/
6
+ Author: Sebastian Oehms
7
+ Author-email: seb.oehms@gmail.com
8
+ License: GPLv2+
9
+ Keywords: Knot theory,Khovanov homology
10
+ Classifier: Development Status :: 3 - Alpha
11
+ Classifier: Intended Audience :: Science/Research
12
+ Classifier: License :: OSI Approved :: GNU General Public License v2 or later (GPLv2+)
13
+ Classifier: Operating System :: POSIX :: Linux
14
+ Classifier: Programming Language :: C++
15
+ Classifier: Programming Language :: Python
16
+ Classifier: Programming Language :: Cython
17
+ Classifier: Topic :: Scientific/Engineering :: Mathematics
18
+ Description-Content-Type: text/markdown
19
+ License-File: COPYING
20
+
21
+
22
+ Khoca is a packaging of Lukas Lewark's Khovanov homology calculator
23
+ [khoca](https://github.com/LLewark/khoca/) for easy installation in
24
+ [sage](http://www.sagemath.org/).
25
+
26
+ From the original page:
27
+
28
+ # README for Khoca, a knot homology calculator
29
+
30
+ The same text as in this README file is available (with illustrations) at
31
+ http://lewark.de/lukas/khoca.html
32
+
33
+ Khoca is computer program to calculate sl(N)-homology of knots. The program has
34
+ been written for joint projects with Andrew Lobb such as [3, 4]. The paper [3]
35
+ also contains a description of the algorithm used by khoca. The main innovation
36
+ is to use Krasner's calculation of the sl(N)-homology of the basic two-crossing
37
+ tangle [2] for calculations of the homology of bipartite knots.
38
+
39
+ Khoca calculates the following:
40
+
41
+ * Khovanov sl(2)-homology of arbitrary links, given as a braid or in PD code.
42
+ * Khovanov-Rozansky sl(N)-homology with N > 2 of bipartite knots, given by a
43
+ certain encoding of a matched diagram of the knot (see [3] and section
44
+ "Encoding of matched diagrams" below).
45
+ * Homology over the integers, the rationals or a prime field.
46
+ * Either equivariant homology, or homology with an arbitrary fixed potential.
47
+ * All pages of the spectral sequence of filtered homology over a field.
48
+ * Reduced and unreduced homology.
49
+ * Homology of sums and mirror images of knots.
50
+
51
+ You are encouraged to contact me with any kind of questions or comments
52
+ regarding khoca. If you are using khoca for a project or publication, please
53
+ cite this web page, or the paper [3].
54
+
55
+ ## Installation
56
+
57
+ Binaries for Linux are available for download from
58
+ http://lewark.de/lukas/khoca.html
59
+ They should run on any Linux installation that has python3.6. Binaries for
60
+ Windows or Mac are not available at the moment.
61
+
62
+ The source code, including instructions on how to compile it, is available at
63
+ the GitHub repository khoca:
64
+ https://github.com/LLewark/khoca
65
+
66
+ To run Khoca in Docker type:
67
+
68
+ ```bash
69
+ docker run -it soehms/khoca:latest
70
+ ```
71
+
72
+ Its download size is 162 MB and it will need 516 MB of disk space on your
73
+ device. To create a new (resp. locally own) Docker image cd to the khoca
74
+ directory type
75
+
76
+ ```bash
77
+ docker build -f Dockerfile --tag khoca:<your_tag> .
78
+ ```
79
+
80
+ If your machine has an older CPU it can happen that you get *Illegal Instruction*
81
+ errors. In that case you better should use the image `soehms/khoca:old_cpu`.
82
+
83
+
84
+ ## Usage
85
+
86
+ To use the program, run khoca.py (a python3 script) from the command line.
87
+ khoca.py takes three arguments:
88
+
89
+ 1. The coefficient ring; `0` for integers, `1` for rationals, a prime `p` for the
90
+ corresponding finite field.
91
+
92
+ 2. A sequence of N integers `a_0, ..., a_{N-1}` separated by a non-digit
93
+ character, defining the Frobenius algebra `F[X]/(X^N + a_{N-1}X^{N-1} + ... +
94
+ a_0)`. Alternatively, `e` followed by a number `N` for equivariant computation
95
+ over `sl(N)`. For example, `-1.0.0` gives the Frobenius algebra `F[X]/(X3 - 1)`.
96
+
97
+ 3. A root of the polynomial given in 2. for the calculation of reduced homology
98
+ (for the dependence of reduced homology on a root, see [3]). For example, to
99
+ get the standard graded reduced homology, use 0 as root. If you are not
100
+ interested in reduced homology, it does not matter what root you chose (and
101
+ khoca does not check that the number is actually a root).
102
+
103
+ The option `-p` will show progress bars, `-v` will give more verbose
104
+ non-mathematical information, and `-h` will print a short help text. Each
105
+ argument after the first three arguments, can be one of the following.
106
+
107
+ 1. `BraidX` calculates homology of a link given as closure of the braid `X`,
108
+ formatted as in knotscape (`a` = first Artin generator, `A` = its inverse, `b` =
109
+ second Artin generator, etc.). This works only for `sl(2)` homology, otherwise
110
+ output is nonsensical.
111
+
112
+ 2. `PdX` calculates homology of a link given in PD notation (as e.g. given on
113
+ KnotInfo). Again, this works only for `sl(2)` homology, otherwise output is
114
+ nonsensical.
115
+
116
+ 3. `GaussX` calculates homology of a bipartite knot given as a matched diagram,
117
+ following the convention explained in the section below. This works for `sl(N)`
118
+ homology for all `N`.
119
+
120
+ 4. `MirrorX` takes the dual of the result at spot `X`.
121
+
122
+ 5. `SumXY` computes the homology of the connected sum of the results saved at
123
+ spots `X` and `Y` (numbers separated by a non-digit character).
124
+
125
+ 6. `CalcX` outputs the result saved at spot `X`. If you forget this command, the
126
+ program will have no output.
127
+
128
+ The program keeps a stack of computed homologies, enumerated 0,1,2... . Each of
129
+ the commands 1 - 5 puts a new homology on that stack, whereas the command 6.
130
+ prints the homology at a certain spot. This is mainly useful to compute
131
+ homology of sums of knots.
132
+
133
+ Here are some examples:
134
+
135
+ ```bash
136
+ ./khoca.py 0 0.0 0 braidaBaB calc0
137
+ ```
138
+
139
+ calculates the classical `sl(2)` Khovanov homology (both reduced and unreduced)
140
+ of the closure of the braid `aBaB` (knotscape notation), i.e. the figure-eight
141
+ knot.
142
+
143
+
144
+ ```bash
145
+ ./khoca.py 0 e2 0 pd[[4,2,5,1],[8,6,1,5],[6,3,7,4],[2,7,3,8]] calc0
146
+ ```
147
+
148
+ calculates integral equivariant `sl(2)` homology of the figure-eight knot.
149
+
150
+
151
+ ```bash
152
+ ./khoca.py 7 0.-1 0 braidabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdef
153
+ calc0 -p
154
+ ```
155
+
156
+ calculates Khovanov homology of the `(7,8)`-torus knot over `F7` with perturbed
157
+ potential, displaying progress bars. This calculation takes roughly two
158
+ minutes, and shows that the spectral sequence does not collapse on the second
159
+ page, refuting the knight-move conjecture over finite fields (cf. [1]).
160
+
161
+
162
+ ```bash
163
+ ./converters/montesinos.py [1/5,1/3,-1/2]
164
+ ```
165
+
166
+ outputs `[12,4,16,10,15,9,14,13]`, the code for a matched diagram of the
167
+ `(5,3,-2)`-pretzel knot, aka the `(3,5)`-torus knot, aka `10_{124}`. So
168
+
169
+ ```bash
170
+ ./khoca.py 1 1.0.0.0.0 0 gauss[12,4,16,10,15,9,14,13] calc0 calculates
171
+ ```
172
+
173
+ rational `sl(5)` homology and the corresponding Rasmussen invariant of the `(3,5)`
174
+ torus knot.
175
+
176
+
177
+ ```bash
178
+ ./khoca.py 1 1.0 0 braidaaa dual0 sum0+1 braidaBaB sum2+3 calc4
179
+ ```
180
+
181
+ calculates `sl(2)` homology of the sum of the trefoil, its mirror image and a figure-8-knot.
182
+
183
+
184
+ # Encoding of matched diagrams
185
+
186
+ This section describes how to encode a matched knot diagram, i.e. a diagram
187
+ that consists of `n` copies of the basic 2-crossing tangle. Resolving each basic
188
+ tangle into two intervals and a chord results in a single circle with n
189
+ non-intersecting (red) chords, which may be on either side of the circle.
190
+ Enumerate the `2n` chord endpoints by walking around the circle. If a chord
191
+ connects the points `i` and `j`, let `f(i) = j`. Write down the list `f(1), f(2), ...,
192
+ f(2n)` omitting `f(i)` if `f(i) < i`. Moreover, make the list entries signed, and
193
+ let the sign reflect the sign of the two crossings of the corresponding
194
+ 2-crossing tangle. This list of `n` non-zero integers uniquely determines the
195
+ matched diagram. As an example, the standard diagram of `6_1` is matched and
196
+ encoded as `[-4,6,5]`.
197
+
198
+ "Half" of Montesinos knots are bipartite [3]. You may use the python3 script
199
+ `./converters/montesinos.py` to obtain the encoding of a matched diagram of
200
+ Montesinos knots.
201
+
202
+ # References
203
+
204
+ [1] Bar-Natan: Fast Khovanov Homology Computations, Journal of Knot Theory and
205
+ its Ramifications 16 (2007), no.3, pp. 243-255, arXiv:math/0606318, MR2320156.
206
+
207
+ [2] Daniel Krasner: A computation in Khovanov-Rozansky Homology, Fundamenta
208
+ Mathematicae 203 (2009), pp. 75-95, arXiv:0801.4018, MR2491784.
209
+
210
+ [3] Lukas Lewark and Andrew Lobb: New Quantum Obstructions to Sliceness,
211
+ Proceedings of the London Mathematical Society 112 (2016), no. 1, pp. 81-114,
212
+ arXiv:1501.07138, MR3458146.
213
+
214
+ [4] Lukas Lewark and Andrew Lobb: Upsilon-like concordance invariants from
215
+ sl(n) knot cohomology, arXiv:1707.00891.
216
+
217
+
218
+ Lukas Lewark, 2018
@@ -26,7 +26,8 @@
26
26
  # The main work is done by pui.pyx via run_commandline, which is called
27
27
  # by the instance call of this class.
28
28
 
29
- from .khoca import run_commandline
29
+ from khoca.khoca import run_commandline
30
+ from khoca.bin.pui import PyComplexStack
30
31
 
31
32
 
32
33
  class InteractiveCalculator:
@@ -39,7 +40,7 @@ class InteractiveCalculator:
39
40
  >>> KH = InteractiveCalculator()
40
41
  >>> KH
41
42
  Khovanov homology calculator for Frobenius algebra: Z[X] / (1*X^2).
42
- >>> KH('braidaBaB')
43
+ >>> KH('braidaBaB') # doctest: +NORMALIZE_WHITESPACE
43
44
  [[[-2, 4, 0, 1], [-1, 2, 0, 1], [0, 0, 0, 1], [1, -2, 0, 1], [2, -4, 0, 1],
44
45
  [-2, 4, 0, 0], [-1, 4, 0, 0], [-1, 2, 0, 0], [0, 2, 0, 0], [0, 0, 0, 0],
45
46
  [1, 0, 0, 0], [1, -2, 0, 0], [2, -2, 0, 0]], [[-2, 3, 0, 1], [-2, 5, 0, 1],
@@ -49,7 +50,7 @@ class InteractiveCalculator:
49
50
  [-1, 3, 0, 0], [0, 3, 0, 0], [0, -1, 0, 0], [1, -1, 0, 0], [0, 1, 0, 0],
50
51
  [1, 1, 0, 0], [2, -3, 2, 1], [1, -3, 0, -1], [2, -3, 0, -1], [1, -1, 0, 0],
51
52
  [2, -1, 0, 0]]]
52
- >>> res, mess = KH('braidaaa', print_messages=True); mess
53
+ >>> res, mess = KH('braidaaa', print_messages=True); mess # doctest: +NORMALIZE_WHITESPACE
53
54
  ['Result:', 'Reduced Homology:', 'Non-equivariant homology:',
54
55
  't^-3q^8 + t^-2q^6 + t^0q^2', 'Unreduced Homology:',
55
56
  'Non-equivariant homology:', 't^-3q^9 + t^-2q^5 + t^0q^1 + t^0q^3 + t^-2q^7[2]']
@@ -125,7 +126,8 @@ class InteractiveCalculator:
125
126
  self._equivariant = 'e%s' %equivariant
126
127
 
127
128
  self._description = None
128
- dummy = self('braidaA', ' ')
129
+ self._stack = PyComplexStack()
130
+ self('braidaA', ' ') # sets self._description
129
131
 
130
132
  def __repr__(self):
131
133
  r"""
@@ -138,9 +140,9 @@ class InteractiveCalculator:
138
140
  Khovanov homology calculator for Frobenius algebra: F_5[X] / (1*X^2 + 1).
139
141
  """
140
142
  return 'Khovanov homology calculator for %s' %self._description
141
-
142
143
 
143
- def __call__(self, link, command=None, print_messages=False, verbose_on=False, progress_bars=False):
144
+
145
+ def __call__(self, link, command=None, print_messages=False, verbose=False, progress=False):
144
146
  r"""
145
147
  Instance call to apply the calculator to a link with respect to a
146
148
  certain command.
@@ -153,17 +155,17 @@ class InteractiveCalculator:
153
155
  a list of lists is accepted which will be interpreted as a list
154
156
  of crossings in pd-notation. Alternatively you can declare the
155
157
  link by a string. The following formats are accepted:
156
-
158
+
157
159
  - ``BraidX`` for a braid formatted as in knotscape (``a`` = first
158
160
  Artin generator, ``A`` = its inverse, ``b`` = second Artin
159
161
  generator, etc.). This works only for ``sl(2)`` homology,
160
- otherwise output is nonsensical.
162
+ otherwise output is nonsensical
161
163
  - ``PdX`` for input in PD notation (as e.g. given on !KnotInfo).
162
164
  Again, this works only for ``sl(2)`` homology, otherwise output
163
- is nonsensical.
165
+ is nonsensical
164
166
  - ``GaussX`` for bipartite knot given as a matched diagram,
165
167
  following the convention explained in the section below. This
166
- works for ``sl(N)`` homology for all ``N``.
168
+ works for ``sl(N)`` homology for all ``N``
167
169
 
168
170
  - ``command`` -- a command given as string as explained in the
169
171
  command line version of the functionality. This can be:
@@ -171,24 +173,23 @@ class InteractiveCalculator:
171
173
  - ``MirrorX`` takes the dual of the result at spot ``X``
172
174
  - ``SumXY`` computes the homology of the connected sum of the
173
175
  results saved at spots ``X`` and ``Y`` (numbers separated by
174
- a non-digit character).
176
+ a non-digit character)
175
177
  - ``CalcX` outputs the result saved at spot X. If you forget
176
- this command, the program will have no output.
178
+ this command, the program will have no output
177
179
 
178
180
  If this keyword argument is not given it will be interpreted
179
181
  as ``Calc0`` by default.
180
182
 
181
- - ``print_messages`` boolean (default is ``False``). If set to
183
+ - ``print_messages`` boolean (default is ``False``). If set to
182
184
  ``True`` the print output of the command line version is
183
185
  returned as a list on the second output position. By default
184
186
  all print messages to ``stdout`` of the command line version
185
- are suppressed.
186
- - ``verbose_on`` boolean (default is ``False``). If it is set
187
- to ``True`` all print messages to ``stdout`` together with
188
- special verbose messages of the command line version are
189
- printed.
190
- - ``progress_bars`` boolean (default is ``False``). If it is
191
- set to ``True`` progress bars will be printed.
187
+ are suppressed
188
+ - ``verbose`` boolean (default is ``False``). If it is set to
189
+ ``True`` all print messages to ``stdout`` together with special
190
+ verbose messages of the command line version are printed
191
+ - ``progress`` boolean (default is ``False``). If it is set to
192
+ ``True`` progress bars will be printed
192
193
 
193
194
  OUTPUT:
194
195
 
@@ -200,7 +201,7 @@ class InteractiveCalculator:
200
201
 
201
202
  If the option ``print_messages`` is given, than the output contains
202
203
  a second result which is a list of all suppressed print messages.
203
-
204
+
204
205
 
205
206
  ..NOTE:
206
207
 
@@ -216,7 +217,7 @@ class InteractiveCalculator:
216
217
  >>> from khoca import InteractiveCalculator
217
218
  >>> KH = InteractiveCalculator(1, (1, 0), 0); KH
218
219
  Khovanov homology calculator for Frobenius algebra: Q[X] / (1*X^2 + 1).
219
- >>> KH('braidaaa', 'dual0 sum0+1 braidaBaB sum2+3 calc4', print_messages=True)
220
+ >>> KH('braidaaa', 'dual0 sum0+1 braidaBaB sum2+3 calc4', print_messages=True) # doctest: +NORMALIZE_WHITESPACE
220
221
  ([[[-5, 10, 0, 1], [-4, 8, 0, 1], [-4, 8, 0, 1], [-3, 6, 0, 1],
221
222
  [-3, 6, 0, 1], [-3, 6, 0, 1], [-2, 4, 0, 1], [-2, 4, 0, 1],
222
223
  [-2, 4, 0, 1], [-2, 4, 0, 1], [-2, 4, 0, 1], [-2, 4, 0, 1],
@@ -241,12 +242,9 @@ class InteractiveCalculator:
241
242
  'Page 3 = infinity:', 't^0q^-1 + t^0q^1'])
242
243
  """
243
244
  # Todo: allow Python type inputs like tuples ..
244
- from .khoca import verbose, progress
245
- verbose = 0
246
- if verbose_on:
247
- verbose = 1
248
- if progress_bars:
249
- progress = 1
245
+ from .khoca import set_options
246
+ verbose = int(verbose); progress = int(progress)
247
+ set_options(verbose, progress)
250
248
  arg_list = [None]
251
249
  arg_list.append(self._coefficient_ring)
252
250
  if self._equivariant:
@@ -255,6 +253,7 @@ class InteractiveCalculator:
255
253
  arg_list.append(self._frobenius_algebra)
256
254
  arg_list.append(self._root)
257
255
 
256
+
258
257
  if type(link) in (tuple, list):
259
258
  # Allow more Python like ways to declare the link
260
259
  try:
@@ -282,25 +281,27 @@ class InteractiveCalculator:
282
281
  arg_list += cmd_list
283
282
 
284
283
  # redirect print outputs to a list to
285
- # return it optionally to the user
284
+ # return it optionally to the user
286
285
  print_output = []
287
286
  def no_print(s):
288
287
  print_output.append(s)
289
288
 
290
- if verbose_on:
289
+ if verbose:
291
290
  if print_messages:
292
291
  raise ValueError('All messages are printed in verbose mode')
293
- res = run_commandline(arg_list, print, 0)
292
+ with self._stack:
293
+ res = run_commandline(arg_list, print, progress)
294
294
  return res
295
295
 
296
296
  # capture print output from the shared library
297
297
  # and use the to set the description resp.
298
- # return it optionally to the user
298
+ # return it optionally to the user
299
299
  import py
300
300
  capture = py.io.StdCaptureFD(err=False, in_=False)
301
301
 
302
302
  try:
303
- res = run_commandline(arg_list, no_print, 0)
303
+ with self._stack:
304
+ res = run_commandline(arg_list, no_print, progress)
304
305
  except:
305
306
  out, err = capture.reset()
306
307
  raise
@@ -311,6 +312,6 @@ class InteractiveCalculator:
311
312
 
312
313
  if print_messages:
313
314
  if out:
314
- print_output += [out]
315
+ print_output += [out][:-1]
315
316
  return res, print_output
316
317
  return res