Skip to content

Commit dcb2970

Browse files
authored
Fix ProductFun constructor ambiguity (#547)
* Fix ProductFun constructor ambiguity * Fix ambiguity in ProductFun(::ProductFun,..) constructor
1 parent 341b960 commit dcb2970

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
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.9.6"
3+
version = "0.9.7"
44

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

src/Multivariate/ProductFun.jl

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ end
115115

116116
## Adaptive construction
117117

118-
function ProductFun(f::Function, sp::AbstractProductSpace{Tuple{S,V}}; tol=100eps()) where {S<:UnivariateSpace,V<:UnivariateSpace}
118+
function ProductFun(f::Function, sp::AbstractProductSpace{<:NTuple{2,UnivariateSpace}}; tol=100eps())
119119
for n = 50:100:5000
120120
X = coefficients(ProductFun(f,sp,n,n;tol=tol))
121121
if size(X,1)<n && size(X,2)<n
@@ -135,7 +135,11 @@ function ProductFun(f::Function,S::AbstractProductSpace,M::Integer,N::Integer;to
135135
vals=T[f(ptsx[k,j],ptsy[k,j]) for k=1:size(ptsx,1), j=1:size(ptsx,2)]
136136
ProductFun(transform!(S,vals),S;tol=tol,chopping=true)
137137
end
138-
ProductFun(f::Function,S::TensorSpace) = ProductFun(LowRankFun(f,S))
138+
_ProductFunLowRank(f, S) = ProductFun(LowRankFun(f,S))
139+
ProductFun(f::Function, S::TensorSpace2D) =
140+
_ProductFunLowRank(f, S)
141+
ProductFun(f::Fun, S::TensorSpace2D) =
142+
_ProductFunLowRank(f, S)
139143

140144
ProductFun(f,dx::Space,dy::Space)=ProductFun(f,TensorSpace(dx,dy))
141145

@@ -180,7 +184,7 @@ end
180184

181185
## Conversion to other ProductSpaces with the same coefficients
182186

183-
ProductFun(f::ProductFun,sp::TensorSpace)=space(f)==sp ? f : ProductFun(coefficients(f,sp),sp)
187+
ProductFun(f::ProductFun,sp::TensorSpace2D)=space(f)==sp ? f : ProductFun(coefficients(f,sp),sp)
184188
ProductFun(f::ProductFun{S,V,SS},sp::ProductDomain) where {S,V,SS<:TensorSpace}=ProductFun(f,Space(sp))
185189

186190
function ProductFun(f::ProductFun,sp::AbstractProductSpace)

0 commit comments

Comments
 (0)