Skip to content

Commit 2e7cb39

Browse files
authored
Aggressive constprop in Fun * Operator (#280)
1 parent c43f994 commit 2e7cb39

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/Operators/general/algebra.jl

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -573,15 +573,22 @@ end
573573
-(A::Operator) = ConstantTimesOperator(-1,A)
574574
-(A::Operator,B::Operator) = A+(-B)
575575

576-
577-
function *(f::Fun, A::Operator)
576+
@inline function _mulop(f::Fun, A::Operator)
578577
if isafunctional(A) && (isinf(bandwidth(A,1)) || isinf(bandwidth(A,2)))
579578
LowRankOperator(f,A)
580579
else
581580
TimesOperator(Multiplication(f,rangespace(A)),A)
582581
end
583582
end
584583

584+
@static if VERSION >= v"1.8"
585+
Base.@constprop :aggressive function *(f::Fun, A::Operator)
586+
_mulop(f, A)
587+
end
588+
else
589+
*(f::Fun, A::Operator) = _mulop(f, A)
590+
end
591+
585592
*(c::Number,A::Operator) = ConstantTimesOperator(c,A)
586593
*(A::Operator,c::Number) = c*A
587594

0 commit comments

Comments
 (0)