Skip to content

Commit 630197f

Browse files
authored
Don't forward size to SpaceOperator (#443)
* Don't forward size to SpaceOperator * bump version to v0.8.13
1 parent c875ecc commit 630197f

File tree

4 files changed

+32
-13
lines changed

4 files changed

+32
-13
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
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.8.12"
3+
version = "0.8.13"
44

55
[deps]
66
AbstractFFTs = "621f4979-c628-5d54-868e-fcf4e3e8185c"

src/Operators/Operator.jl

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -492,19 +492,31 @@ haswrapperstructure(_) = false
492492
# not necessarily the same entries
493493
#
494494
# Ex: c*op or real(op)
495-
macro wrapperstructure(Wrap)
496-
v1 = map((:(ApproxFunBase.bandwidths),:(LinearAlgebra.stride),
497-
:(ApproxFunBase.isbandedblockbanded),:(ApproxFunBase.isblockbanded),
498-
:(ApproxFunBase.israggedbelow),:(Base.size),:(ApproxFunBase.isbanded),
499-
:(ApproxFunBase.blockbandwidths),:(ApproxFunBase.subblockbandwidths),
500-
:(LinearAlgebra.issymmetric))) do func
495+
macro wrapperstructure(Wrap, forwardsize = true)
496+
fns = [:(ApproxFunBase.bandwidths),:(LinearAlgebra.stride),
497+
:(ApproxFunBase.isbandedblockbanded),:(ApproxFunBase.isblockbanded),
498+
:(ApproxFunBase.israggedbelow),:(ApproxFunBase.isbanded),
499+
:(ApproxFunBase.blockbandwidths),:(ApproxFunBase.subblockbandwidths),
500+
:(LinearAlgebra.issymmetric)]
501+
502+
if forwardsize
503+
fns = [fns; :(Base.size)]
504+
end
505+
506+
v1 = map(fns) do func
501507

502508
:($func(D::$Wrap) = $func(D.op))
503509
end
504510

505-
v2 = map((:(ApproxFunBase.bandwidth),:(ApproxFunBase.colstart),:(ApproxFunBase.colstop),
506-
:(ApproxFunBase.rowstart),:(ApproxFunBase.rowstop),:(ApproxFunBase.blockbandwidth),
507-
:(Base.size),:(ApproxFunBase.subblockbandwidth))) do func
511+
fns2 = [:(ApproxFunBase.bandwidth),:(ApproxFunBase.colstart),:(ApproxFunBase.colstop),
512+
:(ApproxFunBase.rowstart),:(ApproxFunBase.rowstop),:(ApproxFunBase.blockbandwidth),
513+
:(ApproxFunBase.subblockbandwidth)]
514+
515+
if forwardsize
516+
fns2 = [fns2; :(Base.size)]
517+
end
518+
519+
v2 = map(fns2) do func
508520
quote
509521
$func(D::$Wrap,k::Integer) = $func(D.op,k)
510522
$func(A::$Wrap,i::ApproxFunBase.PosInfinity) = ℵ₀ # $func(A.op,i) | see PR #42
@@ -525,7 +537,7 @@ end
525537
# use this for wrapper operators that have the same entries but
526538
# not necessarily the same spaces
527539
#
528-
macro wrappergetindex(Wrap)
540+
macro wrappergetindex(Wrap, forwardsize = true)
529541
v = map((:(ApproxFunBase.BandedMatrix),:(ApproxFunBase.RaggedMatrix),
530542
:Matrix,:Vector,:AbstractVector)) do TYP
531543
quote
@@ -602,7 +614,7 @@ macro wrappergetindex(Wrap)
602614
end
603615
end
604616

605-
ApproxFunBase.@wrapperstructure($Wrap) # structure is automatically inherited
617+
ApproxFunBase.@wrapperstructure($Wrap, $forwardsize) # structure is automatically inherited
606618
end
607619

608620
esc(ret)

src/Operators/spacepromotion.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ end
4646

4747
# Similar to wrapper, but different domain/domainspace/rangespace
4848

49-
@wrappergetindex SpaceOperator
49+
@wrappergetindex SpaceOperator false
5050

5151
# SpaceOperator can change blocks, so we need to override this
5252
getindex(A::SpaceOperator,KR::BlockRange, JR::BlockRange) = defaultgetindex(A,KR,JR)

test/runtests.jl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -418,6 +418,13 @@ end
418418
test_matrices(F)
419419
test_matrices(im*F)
420420
end
421+
@testset "SpaceOperator" begin
422+
# somewhat contrived test
423+
sp = PointSpace(1:3)
424+
M = Multiplication(Fun(sp)) # no spaces attached, so size is undefined (infinite by default)
425+
S = ApproxFunBase.SpaceOperator(M, sp, sp)
426+
@test size(S) == (3,3)
427+
end
421428
end
422429

423430
@testset "RowVector" begin

0 commit comments

Comments
 (0)