Skip to content

Commit

Permalink
Fix ProductFun constructor ambiguity (#547)
Browse files Browse the repository at this point in the history
* Fix ProductFun constructor ambiguity

* Fix ambiguity in ProductFun(::ProductFun,..) constructor
  • Loading branch information
jishnub authored Aug 7, 2023
1 parent 341b960 commit dcb2970
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
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

2 comments on commit dcb2970

@jishnub
Copy link
Member Author

@jishnub jishnub commented on dcb2970 Aug 7, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/89183

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.9.7 -m "<description of version>" dcb29709c4835e9e7ab3862fb523c5fa64888a78
git push origin v0.9.7

Please sign in to comment.