Skip to content

Commit 1ecfd75

Browse files
authored
Fix spaces in DefiniteIntegral (#471)
1 parent 1e78c22 commit 1ecfd75

File tree

2 files changed

+21
-15
lines changed

2 files changed

+21
-15
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name = "ApproxFunBase"
22
uuid = "fbd15aa5-315a-5a7d-a8a4-24992e37be05"
3-
version = "0.8.28"
3+
version = "0.8.29"
44

55
[deps]
66
AbstractFFTs = "621f4979-c628-5d54-868e-fcf4e3e8185c"

src/Operators/functionals/CalculusFunctional.jl

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -16,36 +16,39 @@ macro calculus_functional(Op)
1616
end
1717
struct $WrappOp{BT<:Operator,S<:Space,T} <: $Op{S,T}
1818
op::BT
19+
domainspace::S
1920
end
2021

21-
ApproxFunBase.@wrapper $WrappOp
22-
22+
ApproxFunBase.@wrapper $WrappOp false false
23+
ApproxFunBase.domainspace(A::$WrappOp) = A.domainspace
2324

2425
# We expect the operator to be real/complex if the basis is real/complex
25-
$ConcOp(dsp::Space) = $ConcOp{typeof(dsp),ApproxFunBase.prectype(dsp)}(dsp)
26+
$ConcOp(dsp::ApproxFunBase.Space) = $ConcOp{typeof(dsp),ApproxFunBase.prectype(dsp)}(dsp)
2627

27-
$Op() = $Op(UnsetSpace())
28+
$Op() = $Op(ApproxFunBase.UnsetSpace())
2829
$Op(dsp) = $ConcOp(dsp)
29-
$Op(d::Domain) = $Op(Space(d))
30+
$Op(d::ApproxFunBase.Domain) = $Op(ApproxFunBase.Space(d))
3031

31-
ApproxFunBase.promotedomainspace(::$Op,sp::Space) = $Op(sp)
32+
ApproxFunBase.promotedomainspace(::$Op,sp::ApproxFunBase.Space) = $Op(sp)
3233

3334

34-
Base.convert(::Type{Operator{T}}::$ConcOp) where {T} =
35-
(T==eltype(Σ) ? Σ : $ConcOp{typeof(Σ.domainspace),T}.domainspace))::Operator{T}
35+
Base.convert(::Type{ApproxFunBase.Operator{T}}::$ConcOp) where {T} =
36+
(T==eltype(Σ) ? Σ : $ConcOp{typeof(Σ.domainspace),T}.domainspace))::ApproxFunBase.Operator{T}
3637

37-
ApproxFunBase.domain::$ConcOp) = domain.domainspace)
38+
ApproxFunBase.domain::$ConcOp) = ApproxFunBase.domain.domainspace)
3839
ApproxFunBase.domainspace::$ConcOp) = Σ.domainspace
3940

4041
Base.getindex(::$ConcOp{ApproxFunBase.UnsetSpace},kr::AbstractRange) =
4142
error("Spaces cannot be inferred for operator")
4243

43-
$WrappOp(op::Operator) =
44-
$WrappOp{typeof(op),typeof(domainspace(op)),eltype(op)}(op)
44+
$WrappOp(op::ApproxFunBase.Operator, dsp = ApproxFunBase.domainspace(op)) =
45+
$WrappOp{typeof(op),typeof(dsp),eltype(op)}(op, dsp)
4546

4647

47-
Base.convert(::Type{Operator{T}}::$WrappOp) where {T} =
48-
(T==eltype(Σ) ? Σ : $WrappOp(strictconvert(Operator{T},Σ.op)))::Operator{T}
48+
function Base.convert(::Type{ApproxFunBase.Operator{T}}::$WrappOp) where {T}
49+
T==eltype(Σ) && return Σ
50+
$WrappOp(ApproxFunBase.strictconvert(ApproxFunBase.Operator{T},Σ.op))::ApproxFunBase.Operator{T}
51+
end
4952
end)
5053
end
5154

@@ -63,7 +66,10 @@ function DefiniteIntegral(sp::Space)
6366
# try using `Integral`
6467
Q = Integral(sp)
6568
rsp = rangespace(Q)
66-
DefiniteIntegralWrapper((Evaluation(rsp,rightendpoint)-Evaluation(rsp,leftendpoint))*Q)
69+
TE = eltype(Evaluation(rsp,rightendpoint))
70+
A = (Evaluation(rsp,rightendpoint)-Evaluation(rsp,leftendpoint)) * Q
71+
S = SpaceOperator(A, sp, ConstantSpace(promote_type(TE, eltype(Q))))
72+
DefiniteIntegralWrapper(S)
6773
else
6874
# try mapping to canonical domain
6975
M = Multiplication(fromcanonicalD(sp),setcanonicaldomain(sp))

0 commit comments

Comments
 (0)