Skip to content

Commit

Permalink
more fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Krastanov authored Jan 25, 2024
1 parent 0fea11d commit 5ef1bcb
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/entanglement.jl
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ function entanglement_entropy(state::AbstractStabilizer, subsystem::AbstractVect
graph = Graphs.Graph(state)
adjmat = Graphs.adjacency_matrix(graph)
other_subsystem = filter(i->!(i in collect(subsystem)), 1:Graphs.nv(graph))
subadjmat = Nemo.matrix(Nemo.residue_ring(Nemo.ZZ, 2), collect(adjmat[subsystem,other_subsystem]))
subadjmat = Nemo.matrix(Nemo.GF(2), collect(adjmat[subsystem,other_subsystem]))
LinearAlgebra.rank(subadjmat)
end

Expand Down
6 changes: 2 additions & 4 deletions src/randoms.jl
Original file line number Diff line number Diff line change
Expand Up @@ -167,10 +167,8 @@ function precise_inv(a)::Matrix{UInt8}
end

function nemo_inv(a, n)::Matrix{UInt8}
binaryring = Nemo.residue_ring(Nemo.ZZ, 2) # TODO should I use GF(2) instead of ResidueRing(ZZ, 2)?
M = Nemo.matrix_space(binaryring, n, n)
inverted = inv(M(Matrix{Int}(a))) # Nemo is very picky about input data types
return (x->mod(UInt8(x.data),0x2)).(inverted)
inverted = inv(Nemo.matrix(Nemo.GF(2),a))
return UInt8.(inverted.==1) # maybe there is a better way to do the conversion
end

"""Sample (h, S) from the distribution P_n(h, S) from Bravyi and Maslov Algorithm 1."""
Expand Down

0 comments on commit 5ef1bcb

Please sign in to comment.