From 13456bc7aa72191e4744c1a36a82029dc0e453b1 Mon Sep 17 00:00:00 2001 From: = <=> Date: Thu, 8 Feb 2024 13:12:50 +0100 Subject: [PATCH] correct checking for existence --- julia/PolyCube.jl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/julia/PolyCube.jl b/julia/PolyCube.jl index 8754f87..31eaaa1 100644 --- a/julia/PolyCube.jl +++ b/julia/PolyCube.jl @@ -44,8 +44,8 @@ function generate_children(pcube::PolyCube, n_max::Int) for root_cube ∈ pcube.last_added for neighbor ∈ neighbors(root_cube...) pos_growth_candidates = searchsortedfirst(growth_candidates, neighbor) - # consider flipping following ||, it MAY imrove performance, leave the first IN PLACE!!! - if pos_growth_candidates > length(growth_candidates) || growth_candidates[pos_growth_candidates] != neighbor || !isempty(searchsorted(cubes, neighbor)) + # consider flipping following &&, it MAY imrove performance + if (pos_growth_candidates > length(growth_candidates) || growth_candidates[pos_growth_candidates] != neighbor) && isempty(searchsorted(cubes, neighbor)) insert!(growth_candidates, pos_growth_candidates, neighbor) end end