diff --git a/ext/CuYao/test/Project.toml b/ext/CuYao/test/Project.toml index 2e5f158c..1f9cd41d 100644 --- a/ext/CuYao/test/Project.toml +++ b/ext/CuYao/test/Project.toml @@ -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" diff --git a/ext/CuYao/test/register.jl b/ext/CuYao/test/register.jl index 8c6dc1d6..9ed58291 100644 --- a/ext/CuYao/test/register.jl +++ b/ext/CuYao/test/register.jl @@ -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 diff --git a/lib/YaoArrayRegister/Project.toml b/lib/YaoArrayRegister/Project.toml index 157298c0..6e5c54fd 100644 --- a/lib/YaoArrayRegister/Project.toml +++ b/lib/YaoArrayRegister/Project.toml @@ -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" diff --git a/lib/YaoArrayRegister/src/utils.jl b/lib/YaoArrayRegister/src/utils.jl index 569892a9..e66462b1 100644 --- a/lib/YaoArrayRegister/src/utils.jl +++ b/lib/YaoArrayRegister/src/utils.jl @@ -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)