Skip to content

Commit

Permalink
Merge pull request #511 from jlbosse/master
Browse files Browse the repository at this point in the history
Made `fidelity(cureg, cureg)` work
  • Loading branch information
GiggleLiu authored May 30, 2024
2 parents b3a7b22 + bb814e9 commit 5efb15e
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion ext/CuYao/test/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Yao = "5872b779-8223-5990-8dd0-5abbb0748c8c"
CUDA = "4, 5"
Reexport = "0.2, 1"
TupleTools = "1"
Yao = "0.8"
Yao = "0.8,0.9"
YaoBlocks = "0.13.10"
julia = "1"

Expand Down
6 changes: 6 additions & 0 deletions ext/CuYao/test/register.jl
Original file line number Diff line number Diff line change
Expand Up @@ -137,3 +137,9 @@ end
end
end

@testset "fidelity" begin
reg1, reg2 = rand_state(3), rand_state(3)
cureg1, cureg2 = reg1 |> cu, reg2 |> cu

@test fidelity(reg1, reg2) fidelity(cureg1, cureg2)
end
2 changes: 1 addition & 1 deletion lib/YaoArrayRegister/Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "YaoArrayRegister"
uuid = "e600142f-9330-5003-8abb-0ebd767abc51"
version = "0.9.9"
version = "0.9.10"

[deps]
Adapt = "79e6a3ab-5dfb-504d-930d-738a2a938a0e"
Expand Down
2 changes: 1 addition & 1 deletion lib/YaoArrayRegister/src/utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ end
fidelity for pure states.
"""
pure_state_fidelity(v1::Vector, v2::Vector) = abs(v1' * v2)
pure_state_fidelity(v1::AbstractVector, v2::AbstractVector) = abs(v1' * v2)

"""
purification_fidelity(m1::Matrix, m2::Matrix)
Expand Down

0 comments on commit 5efb15e

Please sign in to comment.