Skip to content

Commit 3441329

Browse files
committed
fix indenting
1 parent cbb3cbf commit 3441329

File tree

4 files changed

+33
-41
lines changed

4 files changed

+33
-41
lines changed

examples/diskhelmholtz.jl

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -7,25 +7,6 @@ xy = axes(Z,1); x,y = first.(xy),last.(xy)
77
Δ = Z \ (Laplacian(xy) * W)
88
S = Z \ W
99

10-
KR = Block.(Base.OneTo(5)); @time S.args[1][KR,KR];
11-
@time aB = S.args[1].ops[1]; kr = 1:500;
12-
@time aB[kr,kr];
13-
bc = Base.broadcasted(view(aB,kr,kr))
14-
@time copy(bc)
15-
@ent aB.args[1][kr,kr] ./ aB.args[2]
16-
aB.f
17-
@time aB[kr,kr]
18-
19-
AssertionErro
20-
@time aB.args[1][kr];
21-
@time aB[kr,kr];
22-
@
23-
using ArrayLayouts
24-
c = aB[kr,kr]
25-
26-
@time copyto!(c, bc);
27-
@time aB[kr,kr];
28-
@time aB.args[2][kr,kr];
2910
k = 2
3011
f = @.(cos(x*exp(y)))
3112
F = factorize+ k^2 * S)

src/ModalInterlace.jl

Lines changed: 21 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,13 @@
22
ModalInterlace
33
"""
44
struct ModalInterlace{T, MMNN<:Tuple} <: AbstractBandedBlockBandedMatrix{T}
5-
ops
6-
MN::MMNN
7-
bandwidths::NTuple{2,Int}
5+
ops
6+
MN::MMNN
7+
bandwidths::NTuple{2,Int}
88
end
99

10-
ModalInterlace{T}(ops, MN::NTuple{2,Integer}, bandwidths::NTuple{2,Int}) where T =
11-
ModalInterlace{T,typeof(MN)}(ops, MN, bandwidths)
12-
10+
ModalInterlace{T}(ops, MN::NTuple{2,Integer}, bandwidths::NTuple{2,Int}) where T = ModalInterlace{T,typeof(MN)}(ops, MN, bandwidths)
11+
ModalInterlace(ops::AbstractVector{<:AbstractMatrix{T}}, MN::NTuple{2,Integer}, bandwidths::NTuple{2,Int}) where T = ModalInterlace{T}(ops, MN, bandwidths)
1312

1413
axes(Z::ModalInterlace) = blockedrange.(oneto.(Z.MN))
1514

@@ -18,23 +17,23 @@ subblockbandwidths(::ModalInterlace) = (0,0)
1817

1918

2019
function Base.view(R::ModalInterlace{T}, KJ::Block{2}) where T
21-
K,J = KJ.n
22-
dat = Matrix{T}(undef,1,J)
23-
l,u = blockbandwidths(R)
24-
if iseven(J-K) && -l  J - K  u
25-
sh = (J-K)÷2
26-
if isodd(K)
27-
k = K÷2+1
28-
dat[1,1] = R.ops[1][k,k+sh]
29-
end
30-
for m in range(2-iseven(K); step=2, length=J÷2-max(0,sh))
31-
k = K÷2-m÷2+isodd(K)
32-
dat[1,m] = dat[1,m+1] = R.ops[m+1][k,k+sh]
20+
K,J = KJ.n
21+
dat = Matrix{T}(undef,1,J)
22+
l,u = blockbandwidths(R)
23+
if iseven(J-K) && -l  J - K  u
24+
sh = (J-K)÷2
25+
if isodd(K)
26+
k = K÷2+1
27+
dat[1,1] = R.ops[1][k,k+sh]
28+
end
29+
for m in range(2-iseven(K); step=2, length=J÷2-max(0,sh))
30+
k = K÷2-m÷2+isodd(K)
31+
dat[1,m] = dat[1,m+1] = R.ops[m+1][k,k+sh]
32+
end
33+
else
34+
fill!(dat, zero(T))
3335
end
34-
else
35-
fill!(dat, zero(T))
36-
end
37-
_BandedMatrix(dat, K, 0, 0)
36+
_BandedMatrix(dat, K, 0, 0)
3837
end
3938

4039
getindex(R::ModalInterlace, k::Integer, j::Integer) = R[findblockindex.(axes(R),(k,j))...]

test/runtests.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using MultivariateOrthogonalPolynomials, Test
22

3+
include("test_modalinterlace.jl")
34
include("test_disk.jl")
45
include("test_triangle.jl")
56
# include("test_dirichlettriangle.jl")

test/test_modalinterlace.jl

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
using MultivariateOrthogonalPolynomials, ArrayLayouts, BandedMatrices, Test
2+
import MultivariateOrthogonalPolynomials: ModalInterlace, ModalInterlaceLayout
3+
4+
@testset "ModalInterlace" begin
5+
ops = [brand(2,3,1,2), brand(1,2,1,1), brand(1,2,1,2)]
6+
A = ModalInterlace(ops, (3,5), (2,4))
7+
@test MemoryLayout(A) isa ModalInterlaceLayout
8+
@test A[[1,4],[1,4,11]] == ops[1]
9+
@test A[[2],[2,7]] == ops[2]
10+
@test A[[5],[5,12]] == A[[6],[6,13]] == ops[3]
11+
end

0 commit comments

Comments
 (0)