Skip to content

Instantly share code, notes, and snippets.

@taketo1024
Last active June 27, 2021 06:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save taketo1024/5a19302d2bec6dae2f0b4dcb2a367f2a to your computer and use it in GitHub Desktop.
Save taketo1024/5a19302d2bec6dae2f0b4dcb2a367f2a to your computer and use it in GitHub Desktop.
KR-homology via swm.
import SwmCore
import SwmKnots
import SwmKR
typealias R = RationalNumber
// Load knot/link by name.
// There are presets up to 11 crossings.
let K = Link.load("3_1")!
print(K.name)
// Or you can specify the PD-code.
// let K = Link(name: "3_1", pdCode: [[1,4,2,5],[3,6,4,1],[5,2,6,3]])
let H = KRHomology<R>(K)
// print table
print(H.table())
print()
// print table with restricted degrees
// print(H.table(i:2, j:-2))
// print(H.table(j:-2, k:2))
// print()
// print specific degree
// print("H[2, -2, 2]: ", H[2, -2, -2])
// print()
// other properties
// print("graded-euler:", H.gradedEulerCharacteristic)
// print("highest-q:", H.highestQPart)
// print("lowest-q: ", H.lowestQPart)
// print("highest-a:", H.highestAPart)
// print("lowest-a: ", H.lowestAPart)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment