Skip to content

Commit 74b5c8a

Browse files
authored
ldiv for Mapped and unmapped (#88)
* ldiv for Mapped and unmapped * Update bases.jl * Update runtests.jl * Update runtests.jl * v0.7.1
1 parent 0de055b commit 74b5c8a

File tree

3 files changed

+15
-5
lines changed

3 files changed

+15
-5
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.7.0"
3+
version = "0.7.1"
44

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

src/bases/bases.jl

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,12 @@ end
8585
demap(A)\demap(B)
8686
end
8787

88+
function copy(P::Ldiv{<:MappedBasisLayouts,<:AbstractLazyLayout})
89+
A,B = P.A, P.B
90+
demap(A) \ B[invmap(basismap(A))]
91+
end
92+
copy(P::Ldiv{<:MappedBasisLayouts,ApplyLayout{typeof(*)}}) = copy(Ldiv{UnknownLayout,ApplyLayout{typeof(*)}}(P.A,P.B))
93+
8894
@inline copy(L::Ldiv{<:AbstractBasisLayout,<:SubBasisLayouts}) = apply(\, L.A, ApplyQuasiArray(L.B))
8995
@inline function copy(L::Ldiv{<:SubBasisLayouts,<:AbstractBasisLayout})
9096
P = parent(L.A)
@@ -338,15 +344,14 @@ sublayout(::MappedWeightedBasisLayout, ::Type{<:Tuple{<:Inclusion,<:AbstractVect
338344

339345
demap(x) = x
340346
demap(x::BroadcastQuasiArray) = BroadcastQuasiArray(x.f, map(demap, arguments(x))...)
341-
demap(V::SubQuasiArray{<:Any,2,<:Any,<:Tuple{<:AbstractAffineQuasiVector,<:Slice}}) = parent(V)
342-
demap(V::SubQuasiArray{<:Any,1,<:Any,<:Tuple{<:AbstractAffineQuasiVector}}) = parent(V)
347+
demap(V::SubQuasiArray{<:Any,2,<:Any,<:Tuple{Any,Slice}}) = parent(V)
348+
demap(V::SubQuasiArray{<:Any,1}) = parent(V)
343349
function demap(V::SubQuasiArray{<:Any,2})
344350
kr, jr = parentindices(V)
345351
demap(parent(V)[kr,:])[:,jr]
346352
end
347353

348-
basismap(x::SubQuasiArray{<:Any,2,<:Any,<:Tuple{<:AbstractAffineQuasiVector,<:Any}}) = parentindices(x)[1]
349-
basismap(x::SubQuasiArray{<:Any,1,<:Any,<:Tuple{<:AbstractAffineQuasiVector}}) = parentindices(x)[1]
354+
basismap(x::SubQuasiArray) = parentindices(x)[1]
350355
basismap(x::BroadcastQuasiArray) = basismap(x.args[1])
351356

352357

test/runtests.jl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -431,6 +431,11 @@ end
431431
@test f + g isa Expansion
432432
@test (f+g)[0.1] f[0.1] + g[0.1]
433433
end
434+
435+
@testset "vec demap" begin
436+
@test L[y,:] \ exp.(axes(L,1))[y] L[y,:] \ exp.(y) factorize(L[y,:]) \ exp.(y)
437+
@test ContinuumArrays.demap(view(axes(L,1),y)) == axes(L,1)
438+
end
434439
end
435440

436441
@testset "diff" begin

0 commit comments

Comments
 (0)