Skip to content

Commit

Permalink
Simplify symmetry and symplecticity functions.
Browse files Browse the repository at this point in the history
  • Loading branch information
michakraus committed Nov 26, 2020
1 parent 5137866 commit 83fef10
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 25 deletions.
17 changes: 5 additions & 12 deletions src/symmetry.jl
Original file line number Diff line number Diff line change
@@ -1,16 +1,9 @@

function check_symmetry(tab::Tableau{T}; atol=16*eps(T), rtol=16*eps(T)) where {T}
symmetric = falses(tab.s, tab.s)

for i in axes(symmetric, 1)
for j in axes(symmetric, 2)
symmetric[i,j] = isapprox(tab.a[tab.s+1-i, tab.s+1-j] + tab.a[i,j], tab.b[j], atol=atol, rtol=rtol)
end
end

symmetric
function check_symmetry(tab::Tableau{T}; atol=16eps(T), rtol=16eps(T)) where {T}
a, b, s = tab.a, tab.b, tab.s
[isapprox(a[s+1-i, s+1-j] + a[i,j], b[j]; atol=atol, rtol=rtol) for i in axes(a,1), j in axes(a,2)]
end

function issymmetric(tab::Tableau{T}; atol=16*eps(T), rtol=16*eps(T)) where {T}
all(check_symmetry(tab; atol=atol, rtol=rtol))
function issymmetric(tab::Tableau{T}; kwargs...) where {T}
all(check_symmetry(tab; kwargs...))
end
20 changes: 7 additions & 13 deletions src/symplecticity.jl
Original file line number Diff line number Diff line change
@@ -1,23 +1,17 @@

function check_symplecticity(tab::Tableau{T}; atol=16*eps(T), rtol=16*eps(T)) where {T}
symplectic = falses(tab.s, tab.s)

for i in axes(tab.a, 1)
for j in axes(tab.a, 2)
symplectic[i,j] = isapprox(tab.b[i] * tab.a[i,j] + tab.b[j] * tab.a[j,i], tab.b[i] * tab.b[j], atol=atol, rtol=rtol)
end
end

symplectic
function check_symplecticity(tab::Tableau{T}; atol=16eps(T), rtol=16eps(T)) where {T}
a, b = tab.a, tab.b
[isapprox(b[i] * a[i,j] + b[j] * a[j,i], b[i] * b[j]; atol=atol, rtol=rtol) for i in axes(a,1), j in axes(a,2)]
end

function issymplectic(tab::Tableau{T}; atol=16*eps(T), rtol=16*eps(T)) where {T}
all(check_symplecticity(tab; atol=atol, rtol=rtol))
function issymplectic(tab::Tableau{T}; kwargs...) where {T}
all(check_symplecticity(tab; kwargs...))
end


function compute_symplecticity_error(tab::Tableau)
[tab.b[i] * tab.a[i,j] + tab.b[j] * tab.a[j,i] - tab.b[i] * tab.b[j] for i in axes(tab.a, 1), j in axes(tab.a,2)]
a, b = tab.a, tab.b
[b[i] * a[i,j] + b[j] * a[j,i] - b[i] * b[j] for i in axes(a,1), j in axes(a,2)]
end


Expand Down

0 comments on commit 83fef10

Please sign in to comment.