Skip to content

Commit c675547

Browse files
author
Gaurav Arya
committed
Move adjoint plan construction logic from AdjointPlan constructor to Base.adjoint
1 parent 615a572 commit c675547

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

src/definitions.jl

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -597,14 +597,12 @@ mutable struct AdjointPlan{T,P} <: Plan{T}
597597
p::P
598598
pinv::Plan
599599
AdjointPlan{T,P}(p) where {T,P} = new(p)
600-
# always have adjoint inside scaled
601-
AdjointPlan{T,P}(p::P) where {T,P<:ScaledPlan{T}} = ScaledPlan{T}(AdjointPlan{T}(p.p), p.scale)
602-
AdjointPlan{T,P}(p::AdjointPlan{T}) where {T,P} = new(p.p)
603600
end
604601

605-
AdjointPlan{T}(p::P) where {T,P} = AdjointPlan{T,P}(p)
606-
AdjointPlan(p::Plan{T}) where {T} = AdjointPlan{T}(p)
607-
Base.adjoint(p::Plan{T}) where {T} = AdjointPlan{T}(p)
602+
Base.adjoint(p::Plan{T}) where {T} = AdjointPlan{T, typeof(p)}(p)
603+
Base.adjoint(p::AdjointPlan{T}) where {T} = p.p
604+
# always have AdjointPlan inside ScaledPlan.
605+
Base.adjoint(p::ScaledPlan{T}) where {T} = ScaledPlan{T}(p.p', p.scale)
608606

609607
size(p::AdjointPlan) = output_size(p)
610608
output_size(p::AdjointPlan) = size(p)

0 commit comments

Comments
 (0)