Skip to content

Commit

Permalink
Fix type conversion with non-float eltypes
Browse files Browse the repository at this point in the history
  • Loading branch information
david-pl committed Apr 30, 2021
1 parent bc7cd56 commit b82b82f
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "QuantumOptics"
uuid = "6e0679c1-51ea-5a7c-ac74-d61b76210b0c"
version = "v0.8.6"
version = "v0.8.7"

[deps]
Arpack = "7d9fca2a-8960-54d3-9f78-7d1dccf2cb97"
Expand Down
6 changes: 3 additions & 3 deletions src/master.jl
Original file line number Diff line number Diff line change
Expand Up @@ -87,15 +87,15 @@ function master(tspan, rho0::T, H::AbstractOperator{B,B}, J::Vector;
Hnh = copy(H)
if isa(rates, Matrix)
for i=1:length(J), j=1:length(J)
Hnh -= complex(eltype(H))(0.5im*rates[i,j])*Jdagger[i]*J[j]
Hnh -= complex(float(eltype(H)))(0.5im*rates[i,j])*Jdagger[i]*J[j]
end
elseif isa(rates, Vector)
for i=1:length(J)
Hnh -= complex(eltype(H))(0.5im*rates[i])*Jdagger[i]*J[i]
Hnh -= complex(float(eltype(H)))(0.5im*rates[i])*Jdagger[i]*J[i]
end
else
for i=1:length(J)
Hnh -= complex(eltype(H))(0.5im)*Jdagger[i]*J[i]
Hnh -= complex(float(eltype(H)))(0.5im)*Jdagger[i]*J[i]
end
end
Hnhdagger = dagger(Hnh)
Expand Down
4 changes: 2 additions & 2 deletions src/mcwf.jl
Original file line number Diff line number Diff line change
Expand Up @@ -106,11 +106,11 @@ function mcwf(tspan, psi0::T, H::AbstractOperator{B,B}, J::Vector;
Hnh = copy(H)
if isa(rates, Nothing)
for i=1:length(J)
Hnh -= complex(eltype(H))(0.5im)*Jdagger[i]*J[i]
Hnh -= complex(float(eltype(H)))(0.5im)*Jdagger[i]*J[i]
end
else
for i=1:length(J)
Hnh -= complex(eltype(H))(0.5im*rates[i])*Jdagger[i]*J[i]
Hnh -= complex(float(eltype(H)))(0.5im*rates[i])*Jdagger[i]*J[i]
end
end
dmcwf_nh_(t, psi::T, dpsi::T) = dmcwf_nh(psi, Hnh, dpsi)
Expand Down
6 changes: 3 additions & 3 deletions src/stochastic_master.jl
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,15 @@ function master(tspan, rho0::T, H::AbstractOperator{B,B},
Hnh = copy(H)
if isa(rates, Matrix)
for i=1:length(J), j=1:length(J)
Hnh -= complex(eltype(H))(0.5im*rates[i,j])*Jdagger[i]*J[j]
Hnh -= complex(float(eltype(H)))(0.5im*rates[i,j])*Jdagger[i]*J[j]
end
elseif isa(rates, Vector)
for i=1:length(J)
Hnh -= complex(eltype(H))(0.5im*rates[i])*Jdagger[i]*J[i]
Hnh -= complex(float(eltype(H)))(0.5im*rates[i])*Jdagger[i]*J[i]
end
else
for i=1:length(J)
Hnh -= complex(eltype(H))(0.5im)*Jdagger[i]*J[i]
Hnh -= complex(float(eltype(H)))(0.5im)*Jdagger[i]*J[i]
end
end
Hnhdagger = dagger(Hnh)
Expand Down

2 comments on commit b82b82f

@david-pl
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/35717

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.8.7 -m "<description of version>" b82b82f2b53d89506d5ab366448e74d7950b3a0a
git push origin v0.8.7

Please sign in to comment.