Skip to content

Commit 2125aca

Browse files
CompatHelper: bump compat for "InfiniteArrays" to "0.11" (#77)
* CompatHelper: bump compat for "InfiniteArrays" to "0.11" * Move issubset to DomainSets.jl * Fixes for DomainSets v0.5 * more bug fixes * Update multivariate.jl * tests pass Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Sheehan Olver <[email protected]>
1 parent 1772de5 commit 2125aca

File tree

10 files changed

+44
-42
lines changed

10 files changed

+44
-42
lines changed

Project.toml

Lines changed: 5 additions & 3 deletions
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.4.6"
3+
version = "0.5"
44

55
[deps]
66
AbstractFFTs = "621f4979-c628-5d54-868e-fcf4e3e8185c"
@@ -15,6 +15,7 @@ FFTW = "7a1cc6ca-52ef-59f5-83cd-3a7055c09341"
1515
FastGaussQuadrature = "442a2c76-b920-505d-bb47-c5924d526838"
1616
FillArrays = "1a297f60-69ca-5386-bcde-b61e274b549b"
1717
InfiniteArrays = "4858937d-0d70-526a-a4dd-2d5cb5dd786c"
18+
InfiniteLinearAlgebra = "cde9dba0-b1de-11e9-2c62-0bab9446c55c"
1819
IntervalSets = "8197267c-284f-5f27-9208-e0e47529a953"
1920
LazyArrays = "5078a376-72f3-5289-bfd5-ec5146d43c02"
2021
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
@@ -33,12 +34,13 @@ BlockArrays = "0.14, 0.15, 0.16"
3334
BlockBandedMatrices = "0.10"
3435
Calculus = "0.5"
3536
DSP = "0.6, 0.7"
36-
DomainSets = "0.4, 0.5"
37+
DomainSets = "0.5"
3738
DualNumbers = "0.6.2"
3839
FFTW = "0.3, 1"
3940
FastGaussQuadrature = "0.4"
4041
FillArrays = "0.11, 0.12"
41-
InfiniteArrays = "0.10"
42+
InfiniteArrays = "0.11"
43+
InfiniteLinearAlgebra = "0.5"
4244
IntervalSets = "0.5"
4345
LazyArrays = "0.20, 0.21"
4446
LowRankApprox = "0.2, 0.3, 0.4, 0.5"

src/ApproxFunBase.jl

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
module ApproxFunBase
2-
using Base, BlockArrays, BandedMatrices, BlockBandedMatrices, DomainSets, IntervalSets,
2+
using Base: AnyDict
3+
using Base, BlockArrays, BandedMatrices, BlockBandedMatrices, DomainSets, IntervalSets,
34
SpecialFunctions, AbstractFFTs, FFTW, SpecialFunctions, DSP, DualNumbers,
4-
LinearAlgebra, SparseArrays, LowRankApprox, FillArrays, InfiniteArrays #, Arpack
5+
LinearAlgebra, SparseArrays, LowRankApprox, FillArrays, InfiniteArrays, InfiniteLinearAlgebra #, Arpack
56
import StaticArrays, Calculus
67

78
import DomainSets: Domain, indomain, UnionDomain, ProductDomain, FullSpace, Point, elements, DifferenceDomain,
89
Interval, ChebyshevInterval, boundary, ∂, rightendpoint, leftendpoint,
9-
dimension, WrappedDomain, VcatDomain
10+
dimension, WrappedDomain, VcatDomain, component, components, ncomponents
1011

1112

1213

src/Caching/bandedblockbanded.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ function resizedata!(B::CachedOperator{T,<:BandedBlockBandedMatrix{T}}, ::Colon,
2525

2626
# B.data = _BandedBlockBandedMatrix(PseudoBlockArray
2727

28-
blocks = PseudoBlockArray(pad(B.data.data.blocks,:,(l+u+1)*sum(cols)), rows, cols)
28+
blocks = PseudoBlockArray(pad(B.data.data.blocks,:,(l+u+1)*sum(cols)), (axes(B.data.data,1), blockedrange(cols)))
2929
B.data = _BandedBlockBandedMatrix(blocks, rows, cols, (l, u), (λ, μ))
3030

3131
jr=B.datasize[2]+1:col

src/Domain.jl

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ prectype(d::Domain) = prectype(typeof(d))
1818
struct AnyDomain <: Domain{UnsetNumber} end
1919
struct EmptyDomain <: Domain{Nothing} end
2020

21+
==(::AnyDomain, ::AnyDomain) = true
22+
==(::EmptyDomain, ::EmptyDomain) = true
23+
2124
isambiguous(::AnyDomain) = true
2225
dimension(::AnyDomain) = 1
2326
dimension(::EmptyDomain) = 0
@@ -82,13 +85,6 @@ function indomain(x,d::SegmentDomain)
8285
-100eps(T)/sc iy 100eps(T)/sc
8386
end
8487

85-
ncomponents(s::Domain) = 1
86-
components(s::Domain) = [s]
87-
function components(s::Domain,k)
88-
k  1 && throw(BoundsError())
89-
s
90-
end
91-
9288
issubcomponent(a::Domain,b::Domain) = a in components(b)
9389

9490

@@ -109,8 +105,6 @@ maps the point `x` in `d` to a point in `canonical(d,x)`
109105
"""
110106
function tocanonical end
111107

112-
issubset(a::Domain,b::Domain) = a==b
113-
114108

115109
## conveninece routines
116110

@@ -185,3 +179,6 @@ struct Integers <: Domain{Int} end
185179

186180
const= PositiveIntegers()
187181
const= Integers()
182+
183+
==(::PositiveIntegers, ::PositiveIntegers) = true
184+
==(::Integers, ::Integers) = true

src/Domains/ProductDomain.jl

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,20 @@
11

2-
canonicaldomain(d::ProductDomain) = ProductDomain(map(canonicaldomain,d.domains)...)
2+
nfactors(d::ProductDomain) = length(components(d))
3+
factors(d::ProductDomain) = components(d)
4+
factor(d::ProductDomain,k::Integer) = component(d,k)
5+
6+
canonicaldomain(d::ProductDomain) = ProductDomain(map(canonicaldomain,factors(d))...)
37

48

59
# product domains are their own canonical domain
610
for OP in (:fromcanonical,:tocanonical)
711
@eval begin
8-
$OP(d::ProductDomain, x::Vec) = Vec(map($OP,d.domains,x)...)
9-
$OP(d::ProductDomain, x::Vec{2}) = Vec($OP(first(d.domains), first(x)), $OP(last(d.domains), last(x)))
12+
$OP(d::ProductDomain, x::Vec) = Vec(map($OP,factors(d),x)...)
13+
$OP(d::ProductDomain, x::Vec{2}) = Vec($OP(first(factors(d)), first(x)), $OP(last(factors(d)), last(x)))
1014
end
1115
end
1216

13-
nfactors(d::ProductDomain) = length(d.domains)
14-
factors(d::ProductDomain) = d.domains
15-
factor(d::ProductDomain,k::Integer) = d.domains[k]
17+
1618

1719
function pushappendpts!(ret, xx, pts)
1820
if isempty(pts)
@@ -26,23 +28,23 @@ function pushappendpts!(ret, xx, pts)
2628
end
2729

2830
function checkpoints(d::ProductDomain)
29-
pts = checkpoints.(d.domains)
30-
ret=Vector{Vec{sum(dimension.(d.domains)),float(promote_type(eltype.(eltype.(d.domains))...))}}(undef, 0)
31+
pts = checkpoints.(factors(d))
32+
ret=Vector{Vec{sum(dimension.(factors(d))),float(promote_type(eltype.(eltype.(factors(d)))...))}}(undef, 0)
3133

3234
pushappendpts!(ret,(),pts)
3335
ret
3436
end
3537

3638
function points(d::ProductDomain,n::Tuple)
37-
@assert length(d.domains) == length(n)
38-
pts=map(points,d.domains,n)
39-
ret=Vector{Vec{length(d.domains),mapreduce(eltype,promote_type,d.domains)}}(undef, 0)
39+
@assert length(factors(d)) == length(n)
40+
pts=map(points,factors(d),n)
41+
ret=Vector{Vec{length(factors(d)),mapreduce(eltype,promote_type,factors(d))}}(undef, 0)
4042
pushappendpts!(ret,Vec(x),pts)
4143
ret
4244
end
4345

44-
reverseorientation(d::ProductDomain) = ProductDomain(map(reverseorientation, d.domains))
46+
reverseorientation(d::ProductDomain) = ProductDomain(map(reverseorientation, factors(d)))
4547

4648
domainscompatible(a::ProductDomain,b::ProductDomain) =
47-
length(a.domains)==length(b.domains) &&
48-
all(map(domainscompatible,a.domains,b.domains))
49+
length(factors(a))==length(factors(b)) &&
50+
all(map(domainscompatible,factors(a),factors(b)))

src/Domains/UnionDomain.jl

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,10 @@ convert(::Type{IT},::AnyDomain) where {IT<:UnionDomain} = UnionDomain(tuple())
1010

1111
#support tuple set
1212
components(d::AbstractVector) = d
13-
components(d::UnionDomain) = elements(d)
14-
component(d::UnionDomain,k) = components(d)[k]
15-
ncomponents(d::UnionDomain) = length(elements(d))
1613

17-
pieces(d::UnionDomain) = elements(d)
14+
pieces(d::UnionDomain) = components(d)
1815
piece(d::UnionDomain,k) = pieces(d)[k]
19-
npieces(d::UnionDomain) = length(elements(d))
16+
npieces(d::UnionDomain) = length(components(d))
2017

2118

2219
union(::AnyDomain, d::UnionDomain) = d
@@ -27,8 +24,8 @@ arclength(d::UnionDomain) = mapreduce(arclength,+,d.domains)
2724

2825
reverseorientation(d::UnionDomain) = UnionDomain(reverse(map(reverseorientation,d.domains)))
2926

30-
leftendpoint(d::UnionDomain) = leftendpoint(first(elements(d)))
31-
rightendpoint(d::UnionDomain) = rightendpoint(last(elements(d)))
27+
leftendpoint(d::UnionDomain) = leftendpoint(first(components(d)))
28+
rightendpoint(d::UnionDomain) = rightendpoint(last(components(d)))
3229

3330
# determine the number of points per piece
3431
function components_npoints(d, n::Int)

src/Domains/multivariate.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ include("ProductDomain.jl")
33

44
## boundary
55

6-
const RectDomain{T,A<:IntervalOrSegment,B<:IntervalOrSegment} = VcatDomain{2,T,(1,1),Tuple{A,B}}
6+
const RectDomain = Union{DomainSets.FixedIntervalProduct{2}, DomainSets.Rectangle, VcatDomain{2,<:Any,(1,1),<:Tuple}}
77

88
boundary(d::RectDomain) =
99
PiecewiseSegment([Vec(leftendpoint(factor(d,1)),leftendpoint(factor(d,2))),

src/Multivariate/LowRankFun.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ LowRankFun(f::Function,S::TensorSpace{SV,DD,RR};kwds...) where {SV,DD<:Euclidean
195195
LowRankFun(f::Function,dx::Domain,dy::Domain;kwds...) =
196196
LowRankFun(dynamic(f),Space(dx),Space(dy);kwds...)
197197
LowRankFun(f::Function,d::ProductDomain;kwds...) =
198-
LowRankFun(dynamic(f),d.domains...;kwds...)
198+
LowRankFun(dynamic(f),factors(d)...;kwds...)
199199

200200
LowRankFun(f::Function;kwds...) = LowRankFun(dynamic(f),ChebyshevInterval(),ChebyshevInterval();kwds...)
201201

src/Multivariate/TensorSpace.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -238,9 +238,9 @@ end
238238
canonicalspace(T::TensorSpace) = TensorSpace(map(canonicalspace,T.spaces))
239239

240240

241-
241+
TensorSpace(A::SVector{N,<:Space}) where N = TensorSpace(tuple(A...))
242242
TensorSpace(A...) = TensorSpace(tuple(A...))
243-
TensorSpace(A::ProductDomain) = TensorSpace(tuple(map(Space,A.domains)...))
243+
TensorSpace(A::ProductDomain) = TensorSpace(tuple(map(Space,components(A))...))
244244
(A::TensorSpace,B::TensorSpace) = TensorSpace(A.spaces...,B.spaces...)
245245
(A::TensorSpace,B::Space) = TensorSpace(A.spaces...,B)
246246
(A::Space,B::TensorSpace) = TensorSpace(A,B.spaces...)

src/specialfunctions.jl

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,9 @@ end
5454
midpoints(d::IntervalOrSegment) = [mean(d)]
5555
midpoints(d::Union{UnionDomain,PiecewiseSegment}) = mapreduce(midpoints,vcat,components(d))
5656

57+
_UnionDomainIfMultiple(d::IntervalOrSegment) = d
58+
_UnionDomainIfMultiple(d) = UnionDomain(components(d))
59+
5760
for OP in (:sign,:angle)
5861
@eval function $OP(f::Fun{S,T}) where {S<:RealUnivariateSpace,T<:Real}
5962
d=domain(f)
@@ -65,7 +68,7 @@ for OP in (:sign,:angle)
6568
else
6669
d = split(d , pts)
6770
midpts = midpoints(d)
68-
Fun(UnionDomain(components(d)), $OP.(f.(midpts)))
71+
Fun(_UnionDomainIfMultiple(d), $OP.(f.(midpts)))
6972
end
7073
end
7174
end

0 commit comments

Comments
 (0)