Skip to content

Commit bd920ed

Browse files
authored
v0.4.1
Fixed a bug in automatic conversion checks for PauliFreqType coefficients when max_freq or max_sins are defined.
2 parents 61e450c + 414e2ad commit bd920ed

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "PauliPropagation"
22
uuid = "293282d5-3c99-4fb6-92d0-fd3280a19750"
33
authors = ["Manuel S. Rudolph"]
4-
version = "0.4.0"
4+
version = "0.4.1"
55

66
[deps]
77
BitIntegers = "c3b6d118-76ef-56ca-8cc7-ebb389d030a1"

src/Propagation/generics.jl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ function _check_wrapping_into_paulifreqtracker(psum::PauliSum, max_freq, max_sin
273273

274274
# if max_freq or max_sins are used, and the coefficients are not PathProperties (could be custom)
275275
# then we wrap the coefficients in `PauliFreqTracker`
276-
if (max_freq != Inf | max_sins != Inf) && !(coefftype(psum) <: PathProperties)
276+
if ((max_freq != Inf) | (max_sins != Inf)) & !(coefftype(psum) <: PathProperties)
277277
psum = wrapcoefficients(psum, PauliFreqTracker)
278278
return psum
279279
end
@@ -300,7 +300,7 @@ function _check_unwrap_from_paulifreqtracker(::Type{CT}, psum::PauliSum{TT,PFT})
300300
# we need to unwrap the coefficients
301301

302302
# if the original coefficient type (CT) is not PauliFreqTracker (PFT), then unwrap
303-
if !(CT == PFT)
303+
if CT != PFT
304304
psum = unwrapcoefficients(psum)
305305
end
306306
return psum
@@ -317,21 +317,21 @@ function _checkfreqandsinfields(psum, max_freq, max_sins)
317317

318318
CT = coefftype(psum)
319319

320-
if !(CT <: PathProperties) && (max_freq != Inf || max_sins != Inf)
320+
if !(CT <: PathProperties) & ((max_freq != Inf) | (max_sins != Inf))
321321
throw(ArgumentError(
322322
"The `max_freq` and `max_sins` truncations can only be used with coefficients wrapped in `PathProperties` types.\n" *
323323
"Consider using `wrapcoefficients() with the `PauliFreqTracker` type" *
324324
" or use the out-of-place `propagate()` function for automatic conversion.")
325325
)
326326
end
327327

328-
if max_freq != Inf && !hasfield(CT, :freq)
328+
if (max_freq != Inf) & (!hasfield(CT, :freq))
329329
throw(ArgumentError(
330330
"The `max_freq` truncation is used, but the PathProperties type $CT does not have a `freq` field.")
331331
)
332332
end
333333

334-
if max_sins != Inf && !hasfield(CT, :nsins)
334+
if (max_sins != Inf) & (!hasfield(CT, :nsins))
335335
throw(ArgumentError(
336336
"The `max_sins` truncation is used, but the PathProperties type $CT does not have a `nsins` field.")
337337
)

0 commit comments

Comments
 (0)