57
57
58
58
59
59
@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} ) =
61
61
transform_ldiv (L. A, L. B)
62
62
for op in (:+ , :- )
63
63
@eval @inline copy (L:: Ldiv{Lay,BroadcastLayout{typeof($op)},<:Any,<:AbstractQuasiVector} ) where Lay<: MappedBasisLayouts =
75
75
@inline function copy (P:: Ldiv{<:AbstractBasisLayout,<:AbstractBasisLayout} )
76
76
A, B = P. A, P. B
77
77
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
79
79
end
80
80
@inline function copy (P:: Ldiv{<:SubBasisLayouts,<:SubBasisLayouts} )
81
81
A, B = P. A, P. B
@@ -97,12 +97,15 @@ copy(L::Ldiv{<:MappedBasisLayouts,ApplyLayout{typeof(*)}}) = copy(Ldiv{UnknownLa
97
97
copy (L:: Ldiv{<:MappedBasisLayouts,ApplyLayout{typeof(*)},<:Any,<:AbstractQuasiVector} ) = transform_ldiv (L. A, L. B)
98
98
99
99
@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} )
101
101
P = parent (L. A)
102
102
kr, jr = parentindices (L. A)
103
103
layout_getindex (apply (\ , P, L. B), jr, :) # avoid sparse arrays
104
104
end
105
105
106
+ # default to transform for expanding weights
107
+ copy (L:: Ldiv{<:AbstractBasisLayout,WeightLayout} ) = transform_ldiv (L. A, L. B)
108
+
106
109
107
110
for Bas1 in (:Basis , :WeightedBasis ), Bas2 in (:Basis , :WeightedBasis )
108
111
@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
185
188
"""
186
189
TransformFactorization (grid, :: Nothing , iplan) = TransformFactorization {promote_type(eltype(eltype(grid)),eltype(iplan))} (grid, nothing , iplan)
187
190
188
- grid (T:: TransformFactorization ) = T. grid
191
+ grid (T:: TransformFactorization ) = T. grid
189
192
190
193
\ (a:: TransformFactorization{<:Any,<:Any,Nothing} , b:: AbstractQuasiVector{T} ) where T = a. iplan \ convert (Array{T}, b[a. grid])
191
194
\ (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)
259
262
# TODO : redesign to use simplifiable(\, A, B)
260
263
copy (L:: Ldiv{<:AbstractBasisLayout,ApplyLayout{typeof(*)},<:Any,<:AbstractQuasiVector} ) = transform_ldiv (L. A, L. B)
261
264
copy (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)
263
273
copy (L:: Ldiv{<:AbstractBasisLayout,ZerosLayout} ) = Zeros {eltype(L)} (axes (L)... )
264
274
265
275
"""
266
276
WeightedFactorization(w, F)
267
277
268
- weights a factorization `F` by `w`.
278
+ weights a factorization `F` by `w`.
269
279
"""
270
280
struct WeightedFactorization{T, WW, FAC<: Factorization{T} } <: Factorization{T}
271
281
w:: WW
@@ -416,7 +426,7 @@ demap(x) = x
416
426
demap (x:: BroadcastQuasiArray ) = BroadcastQuasiArray (x. f, map (demap, arguments (x))... )
417
427
demap (V:: SubQuasiArray{<:Any,2,<:Any,<:Tuple{Any,Slice}} ) = parent (V)
418
428
demap (V:: SubQuasiArray{<:Any,1} ) = parent (V)
419
- function demap (V:: SubQuasiArray{<:Any,2} )
429
+ function demap (V:: SubQuasiArray{<:Any,2} )
420
430
kr, jr = parentindices (V)
421
431
demap (parent (V)[kr,:])[:,jr]
422
432
end
466
476
# ###
467
477
468
478
469
- function __sum (:: SubBasisLayout , Vm, dims)
479
+ function __sum (:: SubBasisLayout , Vm, dims)
470
480
@assert dims == 1
471
481
sum (parent (Vm); dims= dims)[:,parentindices (Vm)[2 ]]
472
482
end
0 commit comments