Skip to content

Commit 12612d6

Browse files
committed
Tweak 'simplify'
1 parent 29004df commit 12612d6

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

src/simplify.jl

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,9 @@ function simplify(::Mult, arg1::BinaryOperation{Mult}, arg2::KrD)
119119
end
120120

121121
return to_binary_operation(Mult(), reshaped)
122-
elseif flip(first(arg2.indices)) == last(arg2.indices)
122+
end
123+
124+
if is_trace(arg2)
123125
s = first(arg2.indices)
124126

125127
elwise_ids = elementwise_indices(arg1.arg1, arg1.arg2)
@@ -131,9 +133,9 @@ function simplify(::Mult, arg1::BinaryOperation{Mult}, arg2::KrD)
131133
return evaluate(BinaryOperation{Mult}(arg1.arg1, adjoint(arg1.arg2)))
132134
elseif last_index get_free_indices(arg1.arg2)
133135
return evaluate(BinaryOperation{Mult}(adjoint(arg1.arg1), arg1.arg2))
134-
else
135-
@assert false
136136
end
137+
138+
@assert false "Unreachable"
137139
end
138140
end
139141
end

0 commit comments

Comments
 (0)