5757
5858
5959@inline copy (L:: Ldiv{<:AbstractBasisLayout,BroadcastLayout{typeof(+)}} ) = + (broadcast (\ ,Ref (L. A),arguments (L. B))... )
60- @inline copy (L:: Ldiv{<:AbstractBasisLayout,BroadcastLayout{typeof(+)},<:Any,<:AbstractQuasiVector} ) =
60+ @inline copy (L:: Ldiv{<:AbstractBasisLayout,BroadcastLayout{typeof(+)},<:Any,<:AbstractQuasiVector} ) =
6161 transform_ldiv (L. A, L. B)
6262for op in (:+ , :- )
6363 @eval @inline copy (L:: Ldiv{Lay,BroadcastLayout{typeof($op)},<:Any,<:AbstractQuasiVector} ) where Lay<: MappedBasisLayouts =
7575@inline function copy (P:: Ldiv{<:AbstractBasisLayout,<:AbstractBasisLayout} )
7676 A, B = P. A, P. B
7777 A == B || throw (ArgumentError (" Override copy for $(typeof (A)) \\ $(typeof (B)) " ))
78- SquareEye {eltype(eltype(P))} ((axes (A,2 ),)) # use double eltype for array-valued
78+ SquareEye {eltype(eltype(P))} ((axes (A,2 ),)) # use double eltype for array-valued
7979end
8080@inline function copy (P:: Ldiv{<:SubBasisLayouts,<:SubBasisLayouts} )
8181 A, B = P. A, P. B
@@ -97,12 +97,15 @@ copy(L::Ldiv{<:MappedBasisLayouts,ApplyLayout{typeof(*)}}) = copy(Ldiv{UnknownLa
9797copy (L:: Ldiv{<:MappedBasisLayouts,ApplyLayout{typeof(*)},<:Any,<:AbstractQuasiVector} ) = transform_ldiv (L. A, L. B)
9898
9999@inline copy (L:: Ldiv{<:AbstractBasisLayout,<:SubBasisLayouts} ) = apply (\ , L. A, ApplyQuasiArray (L. B))
100- @inline function copy (L:: Ldiv{<:SubBasisLayouts,<:AbstractBasisLayout} )
100+ @inline function copy (L:: Ldiv{<:SubBasisLayouts,<:AbstractBasisLayout} )
101101 P = parent (L. A)
102102 kr, jr = parentindices (L. A)
103103 layout_getindex (apply (\ , P, L. B), jr, :) # avoid sparse arrays
104104end
105105
106+ # default to transform for expanding weights
107+ copy (L:: Ldiv{<:AbstractBasisLayout,WeightLayout} ) = transform_ldiv (L. A, L. B)
108+
106109
107110for Bas1 in (:Basis , :WeightedBasis ), Bas2 in (:Basis , :WeightedBasis )
108111 @eval == (A:: SubQuasiArray{<:Any,2,<:$Bas1} , B:: SubQuasiArray{<:Any,2,<:$Bas2} ) =
@@ -185,7 +188,7 @@ associates a planned inverse transform with a grid. That is, if `F` is a `Transf
185188"""
186189TransformFactorization (grid, :: Nothing , iplan) = TransformFactorization {promote_type(eltype(eltype(grid)),eltype(iplan))} (grid, nothing , iplan)
187190
188- grid (T:: TransformFactorization ) = T. grid
191+ grid (T:: TransformFactorization ) = T. grid
189192
190193\ (a:: TransformFactorization{<:Any,<:Any,Nothing} , b:: AbstractQuasiVector{T} ) where T = a. iplan \ convert (Array{T}, b[a. grid])
191194\ (a:: TransformFactorization , b:: AbstractQuasiVector ) = a. plan * convert (Array, b[a. grid])
@@ -259,13 +262,20 @@ copy(L::Ldiv{<:AbstractBasisLayout}) = transform_ldiv(L.A, L.B)
259262# TODO : redesign to use simplifiable(\, A, B)
260263copy (L:: Ldiv{<:AbstractBasisLayout,ApplyLayout{typeof(*)},<:Any,<:AbstractQuasiVector} ) = transform_ldiv (L. A, L. B)
261264copy (L:: Ldiv{<:AbstractBasisLayout,ApplyLayout{typeof(*)}} ) = copy (Ldiv {UnknownLayout,ApplyLayout{typeof(*)}} (L. A, L. B))
262- copy (L:: Ldiv{<:AbstractBasisLayout,<:AbstractLazyLayout} ) = transform_ldiv (L. A, L. B)
265+ # A BroadcastLayout of unknown function is only knowable pointwise
266+ transform_ldiv_if_columns (A, B, _) = ApplyQuasiArray (\ , A, B)
267+ transform_ldiv_if_columns (A, B, :: Base.OneTo ) = transform_ldiv (A,B)
268+ copy (L:: Ldiv{<:AbstractBasisLayout,<:BroadcastLayout} ) = transform_ldiv_if_columns (L. A, L. B, axes (L. B,2 ))
269+ # Inclusion are QuasiArrayLayout
270+ copy (L:: Ldiv{<:AbstractBasisLayout,QuasiArrayLayout} ) = transform_ldiv (L. A, L. B)
271+ # Otherwise keep lazy to support, e.g., U\D*T
272+ copy (L:: Ldiv{<:AbstractBasisLayout,<:AbstractLazyLayout} ) = ApplyQuasiArray (\ , L. A, L. B)
263273copy (L:: Ldiv{<:AbstractBasisLayout,ZerosLayout} ) = Zeros {eltype(L)} (axes (L)... )
264274
265275"""
266276 WeightedFactorization(w, F)
267277
268- weights a factorization `F` by `w`.
278+ weights a factorization `F` by `w`.
269279"""
270280struct WeightedFactorization{T, WW, FAC<: Factorization{T} } <: Factorization{T}
271281 w:: WW
@@ -416,7 +426,7 @@ demap(x) = x
416426demap (x:: BroadcastQuasiArray ) = BroadcastQuasiArray (x. f, map (demap, arguments (x))... )
417427demap (V:: SubQuasiArray{<:Any,2,<:Any,<:Tuple{Any,Slice}} ) = parent (V)
418428demap (V:: SubQuasiArray{<:Any,1} ) = parent (V)
419- function demap (V:: SubQuasiArray{<:Any,2} )
429+ function demap (V:: SubQuasiArray{<:Any,2} )
420430 kr, jr = parentindices (V)
421431 demap (parent (V)[kr,:])[:,jr]
422432end
466476# ###
467477
468478
469- function __sum (:: SubBasisLayout , Vm, dims)
479+ function __sum (:: SubBasisLayout , Vm, dims)
470480 @assert dims == 1
471481 sum (parent (Vm); dims= dims)[:,parentindices (Vm)[2 ]]
472482end
0 commit comments