-
Notifications
You must be signed in to change notification settings - Fork 16
[Breaking] Redefine functions to take symmetries as argument #149
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
Merged
VictorVanthilt
merged 31 commits into
QuantumKitHub:master
from
borisdevos:bd/symmetries
Mar 19, 2026
Merged
Changes from all commits
Commits
Show all changes
31 commits
Select commit
Hold shift + click to select a range
97d6cde
ising
borisdevos 29fa868
clock
borisdevos 366d0ea
potts
borisdevos e37ee15
sixvertex
borisdevos 28ae02d
gross-neveu
borisdevos 42f2f85
phi4 real
borisdevos b564b32
exports
borisdevos 52c753b
ising honeycomb
borisdevos 2b7ea9b
ising triangular
borisdevos 259107a
phi4 complex
borisdevos cec76d5
xy
borisdevos 79ec2d9
update models tests
borisdevos 07b8dd3
update other tests
borisdevos be8c6aa
update readme
borisdevos 0e9a051
refactor trivial phi4 complex tensors
borisdevos fda6b91
bump version
borisdevos 02ade75
format
borisdevos cdc239d
bigfloat problems (part 1 probably)
borisdevos 1e66739
Merge branch 'master' of https://github.com/VictorVanthilt/TNRKit.jl …
borisdevos 41cc1dc
deal with most comments
borisdevos 414e791
deal with impurities not being compatible with symmetries
borisdevos b4b352a
include kwargs
borisdevos 20fe721
add eltype as kwarg and deal with kwargs correctly + allow bigfloat i…
borisdevos 73f1dab
Merge branch 'master' of https://github.com/VictorVanthilt/TNRKit.jl …
borisdevos e949c95
disable XY free energy tests
borisdevos 0095a56
add XY methods to default to critical beta
borisdevos 28d627a
fix sixvertex arg in test
borisdevos 00f874d
more name changes + docs fixes
borisdevos d4d0eb6
typo
borisdevos 542ee95
code suggestions and minor inconsistencies
borisdevos 40beddd
forgot classical potts
borisdevos File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,48 +1,48 @@ | ||
| """ | ||
| $(SIGNATURES) | ||
|
|
||
| Constructs the partition function tensor for the classical clock model with `q` states | ||
| and a given inverse temperature `β`. | ||
| """ | ||
| function classical_clock(q::Int, β::Float64) | ||
| function clock_tensor(q::Int, β::Real; T::Type{<:Number} = Float64) | ||
| V = ℂ^q | ||
| A_clock = zeros(Float64, V ⊗ V ← V ⊗ V) | ||
| A_clock = zeros(T, V ⊗ V ← V ⊗ V) | ||
| clock(i, j) = -cos(2π / q * (i - j)) | ||
|
|
||
| for i in 1:q | ||
| for j in 1:q | ||
| for k in 1:q | ||
| for l in 1:q | ||
| E = clock(i, j) + clock(j, l) + clock(l, k) + clock(k, i) | ||
| A_clock[i, j, k, l] = exp(-β * E) | ||
| end | ||
| end | ||
| end | ||
| for i in 1:q, j in 1:q, k in 1:q, l in 1:q | ||
| E = clock(i, j) + clock(j, l) + clock(l, k) + clock(k, i) | ||
| A_clock[i, j, k, l] = exp(-β * E) | ||
| end | ||
|
|
||
| return A_clock | ||
| end | ||
|
|
||
| """ | ||
| $(SIGNATURES) | ||
| classical_clock(q::Int, β::Real; kwargs...) | ||
| classical_clock(::Type{Trivial}, q::Int, β::Real; T::Type{<:Number} = Float64) | ||
| classical_clock(::Type{ZNIrrep{N}}, q::Int, β::Real; T::Type{<:Number} = Float64) where {N} | ||
|
|
||
| Constructs the partition function tensor for the classical clock model with `q` states | ||
| and a given inverse temperature `β`. | ||
|
|
||
| This tensor has explicit ℤq symmetry on each of it spaces. | ||
| Compatible with no symmetry or with explicit ℤq symmetry on each of its spaces. | ||
| Defaults to ℤq symmetry if the symmetry type is not provided. | ||
| """ | ||
| function classical_clock_symmetric(q::Int, β::Float64) | ||
| A = classical_clock(q, β) | ||
| function classical_clock(q::Int, β::Real; kwargs...) | ||
| return classical_clock(ZNIrrep{q}, q, β; kwargs...) | ||
| end | ||
| function classical_clock(::Type{Trivial}, q::Int, β::Real; kwargs...) | ||
| return clock_tensor(q, β; kwargs...) | ||
| end | ||
| function classical_clock(::Type{ZNIrrep{N}}, q::Int, β::Real; T::Type{<:Number} = Float64) where {N} | ||
| @assert N == q "number of irreps must match the number of states" | ||
| A = classical_clock(Trivial, q, β; T = T) | ||
|
|
||
| # Construct the Fourier matrix for the clock model | ||
| U = zeros(ComplexF64, q, q) | ||
| Udat = zeros(ComplexF64, q, q) | ||
| for i in 0:(q - 1) | ||
| for j in 0:(q - 1) | ||
| U[i + 1, j + 1] = exp(2im * π / q * i * j) / sqrt(q) | ||
| Udat[i + 1, j + 1] = cispi(2 / q * i * j) / sqrt(q) | ||
| end | ||
| end | ||
| U = TensorMap(U, ℂ^q ← ℂ^q) | ||
| U = TensorMap(Udat, ℂ^q ← ℂ^q) | ||
|
|
||
| @tensor Anew[-1 -2;-3 -4] := A[1 2; 3 4] * U[4; -4] * conj(U[1; -1]) * U[3; -3] * conj(U[2; -2]) | ||
| V = ZNSpace{q}(i => 1 for i in 0:(q - 1)) | ||
| return real(TensorMap(convert(Array, Anew), V ⊗ V ← V ⊗ V)) | ||
| t = TensorMap(convert(Array, Anew), V ⊗ V ← V ⊗ V) | ||
| return T <: Real ? real(t) : t | ||
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.