Skip to content

Fix ProductFun constructor ambiguity #547

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "ApproxFunBase"
uuid = "fbd15aa5-315a-5a7d-a8a4-24992e37be05"
version = "0.9.6"
version = "0.9.7"

[deps]
AbstractFFTs = "621f4979-c628-5d54-868e-fcf4e3e8185c"
Expand Down
10 changes: 7 additions & 3 deletions src/Multivariate/ProductFun.jl
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ end

## Adaptive construction

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

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

Expand Down Expand Up @@ -180,7 +184,7 @@ end

## Conversion to other ProductSpaces with the same coefficients

ProductFun(f::ProductFun,sp::TensorSpace)=space(f)==sp ? f : ProductFun(coefficients(f,sp),sp)
ProductFun(f::ProductFun,sp::TensorSpace2D)=space(f)==sp ? f : ProductFun(coefficients(f,sp),sp)
ProductFun(f::ProductFun{S,V,SS},sp::ProductDomain) where {S,V,SS<:TensorSpace}=ProductFun(f,Space(sp))

function ProductFun(f::ProductFun,sp::AbstractProductSpace)
Expand Down