Skip to content

Commit 984194a

Browse files
avoid recomputations
1 parent b6e6f1d commit 984194a

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/operators/mpoham.jl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -82,17 +82,17 @@ function deduce_pspaces(opps::SumOfLocalOperators)
8282
end
8383
end
8484

85-
non_deduced = map(ismissing, pspaces)
85+
not_missing = filter(!ismissing, pspaces)
8686

87-
if any(non_deduced) # Some spaces were not defined / not able to be deduced
88-
if allequal(filter(!ismissing, pspaces)) # all non-missing spaces are equal
87+
if length(not_missing) != length(pspaces) # Some spaces were not defined / not able to be deduced
88+
if allequal(not_missing) # all non-missing spaces are equal
8989
# fill in the missing spaces with the unique non-missing space
90-
uniquespace = first(filter(!ismissing, pspaces))
90+
uniquespace = first(not_missing)
9191
for i in eachindex(pspaces)
9292
pspaces[i] = uniquespace
9393
end
9494
else # Not all non-missing spaces are equal
95-
error("cannot automatically deduce physical spaces at $(findall(non_deduced))")
95+
error("cannot automatically deduce physical spaces at $(findall(map(ismissing, pspaces)))")
9696
end
9797
end
9898
return collect(S, pspaces)

0 commit comments

Comments
 (0)