Skip to content

Commit 7fcc0a3

Browse files
committed
Fix adaptivetransform with maps
1 parent 212481f commit 7fcc0a3

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name = "ContinuumArrays"
22
uuid = "7ae1f121-cc2c-504b-ac30-9b923412ae5c"
3-
version = "0.4.0"
3+
version = "0.4.1"
44

55
[deps]
66
ArrayLayouts = "4c555306-a7a7-4459-81d9-ec55ddd5c99a"

src/ContinuumArrays.jl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,11 @@ end
130130
findall(isequal(invmap(d)[f.x]), union(d))
131131
end
132132

133+
function Base.getindex(d::Map, x::Inclusion)
134+
x == axes(d,1) || throw(BoundsError(d, x))
135+
d
136+
end
137+
133138
# Affine map represents A*x .+ b
134139
abstract type AbstractAffineQuasiVector{T,AA,X,B} <: Map{T} end
135140

test/runtests.jl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -488,8 +488,6 @@ end
488488
This is a simple implementation of Chebyshev for testing. Use OrthogonalPolynomialsQuasi
489489
for the real implementation.
490490
"""
491-
492-
493491
struct Chebyshev <: Basis{Float64}
494492
n::Int
495493
end
@@ -571,9 +569,12 @@ ContinuumArrays.invmap(::InvQuadraticMap{T}) where T = QuadraticMap{T}()
571569
@test m[findlast(isequal(0.1), m)] 0.1
572570
@test m[findall(isequal(0.1), m)] [0.1]
573571

572+
@test m[Inclusion(0..1)] m
573+
@test_throws BoundsError m[Inclusion(-1..1)]
574574
T = Chebyshev(5)
575575
M = T[m,:]
576576
@test MemoryLayout(M) isa MappedBasisLayout
577+
@test MemoryLayout(M[:,1:3]) isa MappedBasisLayout
577578
@test M[0.1,:] T[2*0.1^2-1,:]
578579
x = axes(M,1)
579580
@test x == Inclusion(0..1)

0 commit comments

Comments
 (0)