Skip to content

Commit b3f1a79

Browse files
authored
fixes to ProductFun (#217)
1 parent 36fa310 commit b3f1a79

File tree

4 files changed

+12
-10
lines changed

4 files changed

+12
-10
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.7.11"
3+
version = "0.7.12"
44

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

src/Multivariate/ProductFun.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@ end
3737

3838
## Construction in a ProductSpace via a Vector of Funs
3939

40-
function ProductFun(M::Vector{VFun{S,T}},dy::V) where {S<:UnivariateSpace,V<:UnivariateSpace,T<:Number}
41-
funs=VFun{S,T}[Mk for Mk in M]
42-
ProductFun{S,V,ProductSpace{S,V},T}(funs,ProductSpace(S[space(fun) for fun in funs],dy))
40+
function ProductFun(M::AbstractVector{VFun{S,T}},dy::V) where {S<:UnivariateSpace,V<:UnivariateSpace,T<:Number}
41+
prodsp = ProductSpace(map(space, M), dy)
42+
ProductFun{S,V,typeof(prodsp),T}(copy(M), prodsp)
4343
end
4444

4545
## Adaptive construction

src/Multivariate/TensorSpace.jl

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -307,14 +307,16 @@ struct ProductSpace{S<:Space,V<:Space,D,R} <: AbstractProductSpace{Tuple{S,V},D,
307307
spacey::V
308308
end
309309

310-
ProductSpace(spacesx::Vector,spacey) =
311-
ProductSpace{eltype(spacesx),typeof(spacey),typeof(mapreduce(domain,×,sp)),
312-
mapreduce(s->eltype(domain(s)),promote_type,sp)}(spacesx,spacey)
310+
function ProductSpace(spacesx::AbstractVector, spacey)
311+
ProductSpace{eltype(spacesx),typeof(spacey),typeof(mapreduce(domain, ×, spacesx)),
312+
mapreduce(s->eltype(domain(s)),promote_type,spacesx)}(spacesx,spacey)
313+
end
313314

314315
# TODO: This is a weird definition
315-
(A::Vector{S},B::Space) where {S<:Space} = ProductSpace(A,B)
316-
domain(f::ProductSpace) = domain(f.spacesx[1])×domain(f.spacesy)
316+
(A::AbstractVector{S},B::Space) where {S<:Space} = ProductSpace(A,B)
317+
domain(f::ProductSpace) = domain(f.spacesx[1]) × domain(f.spacey)
317318

319+
factors(d::ProductSpace) = (d.spacesx, d.spacey)
318320

319321
nfactors(d::AbstractProductSpace) = length(d.spaces)
320322
factors(d::AbstractProductSpace) = d.spaces

src/show.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ function show(io::IO,L::LowRankFun)
2525
end
2626

2727
function show(io::IO,P::ProductFun)
28-
print(io,"ProductFun on ",space(P),".")
28+
print(io,"ProductFun on ",space(P))
2929
end
3030

3131
## Operator

0 commit comments

Comments
 (0)