From cf6f2af2e85a8f370dc5a4fd2d0adb33d77b2b6a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sergio=20S=C3=A1nchez=20Ram=C3=ADrez?= Date: Thu, 18 Jan 2024 19:16:43 +0100 Subject: [PATCH] Ignore outer products in `Exhaustive` breadth-first search --- src/Optimizers/Exhaustive.jl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Optimizers/Exhaustive.jl b/src/Optimizers/Exhaustive.jl index 424ada2..7c6ba78 100644 --- a/src/Optimizers/Exhaustive.jl +++ b/src/Optimizers/Exhaustive.jl @@ -75,7 +75,6 @@ function exhaustive_breadthfirst( outer::Bool = false, hashyperinds = !isempty(hyperinds(expr)), ) where {L,Metric} - outer && error("Outer products not supported yet") hashyperinds && error("Hyperindices not supported yet") cost_fac = maximum(values(expr.size)) @@ -119,7 +118,8 @@ function exhaustive_breadthfirst( # if not disjoint, then ta and tb contain at least one common tensor isdisjoint(ta, tb) || continue - get(costs, ta ∪ tb, cost_cur) > cost_prev || continue + # outer products do not generally improve contraction path + !outer && isdisjoint(indices[ta], indices[tb]) && continue # new candidate contraction tc = ta ∪ tb # aka Q in the paper