Skip to content

Commit

Permalink
Merge pull request #15 from ChitambarLab/is-hermitian-bug
Browse files Browse the repository at this point in the history
fixing bug in is_hermitian()
  • Loading branch information
bdoolittle committed Sep 1, 2021
2 parents 8574a5c + 8f467b9 commit cb30a84
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 6 deletions.
2 changes: 1 addition & 1 deletion CITATION.bib
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ @gmail.com>
title = {QBase.jl},
howpublished = {\url{https://github.com/ChitambarLab/QBase.jl}},
url = {https://github.com/chitambarlab/QBase.jl},
version = {v0.2.0},
version = {v0.2.1},
year = {2020},
month = {August}
}
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "QBase"
uuid = "e52e8ede-12bf-4731-8af7-b01f6064cb11"
authors = ["Brian Doolittle <brian.d.doolittle@gmail.com> and contributors"]
version = "0.2.0"
version = "0.2.1"

[deps]
Combinatorics = "861a8166-3701-5b0c-9a16-15d98fcdc6aa"
Expand Down
2 changes: 1 addition & 1 deletion src/math/matrices.jl
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ function is_hermitian(M :: AbstractMatrix{<:Number}; atol=ATOL :: Float64) :: Bo
end

for i = indsn, j = i:last(indsn)
if M[i,j] != adjoint(M[j,i]) && !isapprox(M[i,j],M[j,i],atol=atol)
if M[i,j] != M[j,i]' && !isapprox(M[i,j], M[j,i]', atol=atol)
return false
end
end
Expand Down
6 changes: 5 additions & 1 deletion test/unit/math/matrices.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Test, LinearAlgebra
using Test
using LinearAlgebra
using QBase

@testset "./src/math/matrices.jl" begin
Expand Down Expand Up @@ -54,6 +55,9 @@ end
@testset "using atol" begin
@test !is_hermitian([1 1;1+1e-6 1])
@test is_hermitian([1 1;1+1e-6 1], atol=1e-5)

@test !is_hermitian([1 1e-6 + 1im;-1im 1])
@test is_hermitian([1 1e-6 + 1im;-1im 1], atol=1e-5)
end
end

Expand Down
4 changes: 2 additions & 2 deletions test/unit/types/measurements.jl
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@ end
@test M isa POVMel{Complex{Float64}}
@test M == [0.5 0.5im;-0.5im 0.5]

M = POVMel([0.5 0.5im;0.5im 0.5], atol=0.51)
M = POVMel([0.5 0.45im;-0.5im 0.5], atol=0.06)
@test M isa POVMel{Complex{Float64}}
@test M == [0.5 0.5im;0.5im 0.5]
@test M == [0.5 0.45im;-0.5im 0.5]
end

@testset "errors" begin
Expand Down

2 comments on commit cb30a84

@bdoolittle
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/43969

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.2.1 -m "<description of version>" cb30a84b784c61abdae8b007e1de691f3ccd4e4b
git push origin v0.2.1

Please sign in to comment.