Skip to content

Commit fbd2b0f

Browse files
authored
Fix whitespace (#118)
Co-authored-by: Jishnu Bhattacharya <[email protected]>
1 parent 3feb5e9 commit fbd2b0f

27 files changed

+154
-155
lines changed

examples/blocktridiagonal.jl

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
using InfiniteLinearAlgebra, BlockBandedMatrices, BandedMatrices, BlockArrays, InfiniteArrays, FillArrays, LazyArrays, Test
22

3-
A = BlockTridiagonal(Vcat([fill(1.0,2,1),Matrix(1.0I,2,2),Matrix(1.0I,2,2),Matrix(1.0I,2,2)],Fill(Matrix(1.0I,2,2), ∞)),
4-
Vcat([zeros(1,1)], Fill(zeros(2,2), ∞)),
3+
A = BlockTridiagonal(Vcat([fill(1.0,2,1),Matrix(1.0I,2,2),Matrix(1.0I,2,2),Matrix(1.0I,2,2)],Fill(Matrix(1.0I,2,2), ∞)),
4+
Vcat([zeros(1,1)], Fill(zeros(2,2), ∞)),
55
Vcat([fill(1.0,1,2),Matrix(1.0I,2,2)], Fill(Matrix(1.0I,2,2), ∞)))
66

77

8-

examples/intervalarithmetic.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
using InfiniteLinearAlgebra
2-
import IntervalArithmetic
2+
import IntervalArithmetic

examples/jacobi.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ ql(Δ - λ*I).L[1,1]
1717
end
1818

1919
λ2 = Interval(m,λ.hi)
20-
ql- λ1.hi*I).L[1,1]
20+
ql- λ1.hi*I).L[1,1]
2121

2222

2323
ql- Interval(4.2)I).L[1,1]
@@ -41,7 +41,7 @@ Z,A,B = 0.5,-4.0,0.5
4141

4242
A = 4
4343
rig_qltail(-2,10,B)
44-
44+
4545
d,e = d2,e2
4646

4747
rig_qltail(Z,A,B,d,e)
@@ -106,4 +106,4 @@ X[2,:] .= (zero(T), X[1,1], X[1,2]);
106106
X[1,:] .= (Z,A,B);
107107
QL = _qlfactUnblocked!(X)
108108

109-
X, QL.τ[end]
109+
X, QL.τ[end]

examples/periodicschrodinger.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ using InfiniteLinearAlgebra, Plots
33
# Consider a rank-1 perturbation of periodic semi-infinite Schrödinger (Jacobi) operator.
44
# We can construct it as a block matrix as follows:
55

6-
A = BlockTridiagonal(Vcat([[0. 1.; 0. 0.]],Fill([0. 1.; 0. 0.], ∞)),
7-
Vcat([[-1. 1.; 1. 1.]], Fill([-1. 1.; 1. 1.], ∞)),
6+
A = BlockTridiagonal(Vcat([[0. 1.; 0. 0.]],Fill([0. 1.; 0. 0.], ∞)),
7+
Vcat([[-1. 1.; 1. 1.]], Fill([-1. 1.; 1. 1.], ∞)),
88
Vcat([[0. 0.; 1. 0.]], Fill([0. 0.; 1. 0.], ∞)))
99

1010
A[1,1] = 2 # perturbation
@@ -16,7 +16,7 @@ n = 100; scatter(eigvals(A[1:n,1:n]), zeros(n); label="finite-section")
1616
# In any case, we can also calculate the spectrum using ∞-QL:
1717
xx = [-0.95:0.05:0.95; 2.25:0.125/4:4.0]
1818
plot!(xx, (x -> ql(A-x*I).L[1,1]).(xx); label="L[1,1]")
19-
xx =
19+
xx =
2020
plot!(xx, (x -> ql(A-x*I).L[1,1]).(xx))
2121

2222

examples/perttoeplitz.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@ A = BandedMatrix(-2 => Vcat([1], Fill(1,∞)), 0 => Vcat(a, Fill(0,∞)), 1 =>
2323
x,y = range(-2,2; length=200),range(-2,2;length=200)
2424
z = abs.(.(x' .+ y.*im))
2525
contour(x,y,z; nlevels=50, title="z^2 + 1/(4z)")
26-
scatter!(eigvals(Matrix(A[1:100,1:100]')); label="A' finite section")
26+
scatter!(eigvals(Matrix(A[1:100,1:100]')); label="A' finite section")
2727
scatter!(eigvals(Matrix(A[1:100,1:100])); label="A finite section")
2828

2929
x = range(-2,2,length=1_000)
30-
plot(x, abs.(.(x.+eps()im)); label="abs(L[1,1])")
30+
plot(x, abs.(.(x.+eps()im)); label="abs(L[1,1])")
3131

3232
a = [-0.1,0.2,0.3]
3333
A = BandedMatrix(-2 => Vcat([1], Fill(1,∞)), 0 => Vcat(a, Fill(0,∞)), 1 => Vcat([1/4], Fill(1/4,∞)))

examples/toeplitz.jl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ using InfiniteLinearAlgebra, BandedMatrices, PyPlot
1212
###
1313

1414
function ℓ11(A,λ; kwds...)
15-
try
16-
abs(ql(A-λ*I; kwds...).L[1,1])
17-
catch DomainError
15+
try
16+
abs(ql(A-λ*I; kwds...).L[1,1])
17+
catch DomainError
1818
-1.0
1919
end
2020
end
@@ -64,7 +64,7 @@ clf(); qlplot(A; branch=findsecond, x=range(-2,3; length=100), y=range(-2.5,2.5;
6464
clf(); qlplot(transpose(A); x=range(-2,3; length=100), y=range(-2.5,2.5;length=100)); symbolplot(A; color=:black); title("Limacon, transpose")
6565

6666

67-
###
67+
###
6868
# bull-head
6969
###
7070

@@ -95,7 +95,7 @@ clf(); qlplot(transpose(A); branch=branch(2), x=range(-2,2; length=100), y=range
9595
# Whale
9696
###
9797

98-
A = BandedMatrix(-4 => Fill(im,∞), -3 => Fill(4,∞), -2 => Fill(3+im,∞), -1 => Fill(10,∞),
98+
A = BandedMatrix(-4 => Fill(im,∞), -3 => Fill(4,∞), -2 => Fill(3+im,∞), -1 => Fill(10,∞),
9999
1 => Fill(1,∞), 2 => Fill(im,∞), 3 => Fill(-(3+2im),∞), 4=>Fill(-1,∞))
100100

101101
clf(); qlplot(A; x=range(-15,20; length=100), y=range(-20,20;length=100)); symbolplot(A; color=:black); title("Whale")

src/InfiniteLinearAlgebra.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import Base: +, -, *, /, \, ^, OneTo, getindex, promote_op, _unsafe_getindex, si
88
show, getproperty, copy, copyto!, map, require_one_based_indexing, similar, inv
99
import Base.Broadcast: BroadcastStyle, Broadcasted, broadcasted
1010

11-
import ArrayLayouts: colsupport, rowsupport, triangularlayout, MatLdivVec, triangulardata, TriangularLayout, TridiagonalLayout,
11+
import ArrayLayouts: colsupport, rowsupport, triangularlayout, MatLdivVec, triangulardata, TriangularLayout, TridiagonalLayout,
1212
sublayout, _qr, __qr, MatLmulVec, MatLmulMat, AbstractQLayout, materialize!, diagonaldata, subdiagonaldata, supdiagonaldata,
1313
_bidiag_forwardsub!, mulreduce, RangeCumsum, _factorize, transposelayout, ldiv!, lmul!, mul, CNoPivot
1414
import BandedMatrices: BandedMatrix, _BandedMatrix, AbstractBandedMatrix, bandeddata, bandwidths, BandedColumns, bandedcolumns,
@@ -46,7 +46,7 @@ else
4646
import Base: oneto, unitrange
4747
end
4848

49-
if VERSION  v"1.7-"
49+
if VERSION v"1.7-"
5050
LinearAlgebra._cut_B(x::AbstractVector, r::InfUnitRange) = x
5151
LinearAlgebra._cut_B(X::AbstractMatrix, r::InfUnitRange) = X
5252
end

src/banded/hessenbergq.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ function show(io::IO, mime::MIME{Symbol("text/plain")}, F::QLHessenberg)
4343
show(io, mime, F.L)
4444
end
4545

46-
@inline function getL(F::QLHessenberg, _)
46+
@inline function getL(F::QLHessenberg, _)
4747
m, n = size(F)
4848
tril!(getfield(F, :factors)[end-min(m,n)+1:end, 1:n], max(n-m,0))
4949
end
@@ -78,7 +78,7 @@ for Typ in (:UpperHessenbergQ, :LowerHessenbergQ)
7878
end
7979
end
8080

81-
$Typ(q::AbstractVector{<:AbstractMatrix{T}}) where T =
81+
$Typ(q::AbstractVector{<:AbstractMatrix{T}}) where T =
8282
$Typ{T,typeof(q)}(q)
8383
end
8484
end
@@ -111,7 +111,7 @@ function materialize!(L::MatLmulVec{<:HessenbergQLayout{'L'}})
111111
v = view(x, n:n+1)
112112
mul!(t, Q.q[n], v)
113113
v .= t
114-
n > nz && norm(t)  10floatmin(real(T)) && return x
114+
n > nz && norm(t) 10floatmin(real(T)) && return x
115115
end
116116
x
117117
end

src/banded/infbanded.jl

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ function _inf_banded_sub_materialize(::BandedColumns, V)
2323
b = parentindices(V)[1].b
2424
data = bandeddata(A)
2525
l,u = bandwidths(A)
26-
if -l  b  u
26+
if -l b u
2727
data[u+1-b, max(1,b+1):end]
2828
else
2929
Zeros{eltype(V)}(∞) # Not type stable
@@ -86,7 +86,7 @@ function BandedMatrix{T}(kv::Tuple{Vararg{Pair{<:Integer,<:Vcat{<:Any,1,<:Tuple{
8686
m,n = mn
8787
@assert isinf(n)
8888
l,u = lu
89-
M = mapreduce(x -> length(x.second.args[1]) + max(0,x.first), max, kv) # number of data rows
89+
M = mapreduce(x -> length(x.second.args[1]) + max(0,x.first), max, kv) # number of data rows
9090
data = zeros(T, u+l+1, M)
9191
t = zeros(T, u+l+1)
9292
for (k,v) in kv
@@ -110,30 +110,30 @@ function BandedMatrix(Ac::Adjoint{T,<:InfToeplitz}) where T
110110
A = parent(Ac)
111111
l,u = bandwidths(A)
112112
a = A.data.args[1]
113-
_BandedMatrix(reverse(conj(a)) * Ones{T}(1,∞), ℵ₀, u, l)
113+
_BandedMatrix(reverse(conj(a)) * Ones{T}(1,∞), ℵ₀, u, l)
114114
end
115115

116116
function BandedMatrix(Ac::Transpose{T,<:InfToeplitz}) where T
117117
A = parent(Ac)
118118
l,u = bandwidths(A)
119119
a = A.data.args[1]
120-
_BandedMatrix(reverse(a) * Ones{T}(1,∞), ℵ₀, u, l)
120+
_BandedMatrix(reverse(a) * Ones{T}(1,∞), ℵ₀, u, l)
121121
end
122122

123123
function BandedMatrix(Ac::Adjoint{T,<:PertToeplitz}) where T
124124
A = parent(Ac)
125125
l,u = bandwidths(A)
126126
a,b = A.data.args
127127
Ac_fd = BandedMatrix(_BandedMatrix(Hcat(a, b[:,1:l+1]), size(a,2)+l, l, u)')
128-
_BandedMatrix(Hcat(Ac_fd.data, reverse(conj(b.args[1])) * Ones{T}(1,∞)), ℵ₀, u, l)
128+
_BandedMatrix(Hcat(Ac_fd.data, reverse(conj(b.args[1])) * Ones{T}(1,∞)), ℵ₀, u, l)
129129
end
130130

131131
function BandedMatrix(Ac::Transpose{T,<:PertToeplitz}) where T
132132
A = parent(Ac)
133133
l,u = bandwidths(A)
134134
a,b = A.data.args
135135
Ac_fd = BandedMatrix(transpose(_BandedMatrix(Hcat(a, b[:,1:l+1]), size(a,2)+l, l, u)))
136-
_BandedMatrix(Hcat(Ac_fd.data, reverse(b.args[1]) * Ones{T}(1,∞)), ℵ₀, u, l)
136+
_BandedMatrix(Hcat(Ac_fd.data, reverse(b.args[1]) * Ones{T}(1,∞)), ℵ₀, u, l)
137137
end
138138

139139

@@ -231,7 +231,7 @@ end
231231
function BandedMatrix(A::PertToeplitz{T}, (l,u)::Tuple{Int,Int}) where T
232232
@assert A.u == u # Not implemented
233233
a, b = A.data.args
234-
t = b.args[1] # topelitz part
234+
t = b.args[1] # topelitz part
235235
t_pad = vcat(t,Zeros(l-A.l))
236236
data = Hcat([vcat(a,Zeros{T}(l-A.l,size(a,2))) repeat(t_pad,1,l)], t_pad * Ones{T}(1,∞))
237237
_BandedMatrix(data, ℵ₀, l, u)
@@ -509,7 +509,7 @@ copyto!(dest::AbstractArray, L::Ldiv{BidiagonalToeplitzLayout,Lay}) where Lay =
509509

510510
# copy for AdjOrTrans
511511
copy(A::Adjoint{T,<:BandedMatrix{T,<:Any,OneToInf{Int}}}) where T = copy(parent(A))'
512-
copy(A::Transpose{T,<:BandedMatrix{T,<:Any,OneToInf{Int}}}) where T = transpose(copy(parent(A)))
512+
copy(A::Transpose{T,<:BandedMatrix{T,<:Any,OneToInf{Int}}}) where T = transpose(copy(parent(A)))
513513

514514

515515
##

src/banded/infqltoeplitz.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,4 +191,4 @@ ql(A::InfToeplitz; kwds...) = _inf_ql(A; kwds...)
191191
ql(A::PertToeplitz; kwds...) = _inf_ql(A; kwds...)
192192

193193
ql(A::Adjoint{<:Any,<:InfToeplitz}) = ql(BandedMatrix(A))
194-
ql(A::Adjoint{<:Any,<:PertToeplitz}) = ql(BandedMatrix(A))
194+
ql(A::Adjoint{<:Any,<:PertToeplitz}) = ql(BandedMatrix(A))

src/blockbanded/infblocktridiagonal.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,4 +86,4 @@ function BlockBandedMatrix(A::BlockTriPertToeplitz{T}, (l,u)::NTuple{2,Int}) whe
8686
B = _BlockSkylineMatrix(Vcat(data,tl), BlockSkylineSizes(A, (l,u)))
8787
end
8888

89-
BlockBandedMatrix(A::BlockTriPertToeplitz) = BlockBandedMatrix(A, blockbandwidths(A))
89+
BlockBandedMatrix(A::BlockTriPertToeplitz) = BlockBandedMatrix(A, blockbandwidths(A))

src/infcholesky.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ MemoryLayout(::Type{AdaptiveCholeskyFactors{T,DM,M}}) where {T,DM,M} = AdaptiveL
1818

1919

2020
function partialcholesky!(F::AdaptiveCholeskyFactors{T,<:BandedMatrix}, n::Int) where T
21-
if n > F.ncols
21+
if n > F.ncols
2222
_,u = bandwidths(F.data.array)
2323
resizedata!(F.data,n+u,n+u);
2424
ncols = F.ncols
@@ -106,4 +106,4 @@ function ldiv!(R::UpperTriangular{<:Any,<:AdaptiveCholeskyFactors}, B::CachedVec
106106
partialcholesky!(parent(R), n)
107107
ldiv!(UpperTriangular(view(parent(R).data.data,oneto(n),oneto(n))), view(B.data,oneto(n)))
108108
B
109-
end
109+
end

src/infconv.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,11 @@ end
3838

3939

4040
function conv(r::InfRanges, x::AbstractVector)
41-
length(x)  1 && throw(ArgumentError("conv(::$(typeof(r)), ::$(typeof(x))) not implemented"))
41+
length(x) 1 && throw(ArgumentError("conv(::$(typeof(r)), ::$(typeof(x))) not implemented"))
4242
first(x)*r
4343
end
4444
function conv(x::AbstractVector, r::InfRanges)
45-
length(x)  1 && throw(ArgumentError("conv(::$(typeof(r)), ::$(typeof(x))) not implemented"))
45+
length(x) 1 && throw(ArgumentError("conv(::$(typeof(r)), ::$(typeof(x))) not implemented"))
4646
first(x)*r
4747
end
4848

src/infql.jl

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ function tailiterate!(X::AbstractMatrix{T}) where T
2626
c,a,b = X[1,:]
2727
h = zero(T)
2828
for _=1:10_000_000
29-
QL = ql!(X)
30-
if h == X[1,3]
29+
QL = ql!(X)
30+
if h == X[1,3]
3131
return QL
3232
end
3333
h = X[1,3]
@@ -52,17 +52,17 @@ function qltail(Z::Number, A::Number, B::Number)
5252

5353
e = sqrt(n^2 - abs2(B))
5454
d = σ*e*Z/n
55-
55+
5656
ql!([Z A B; 0 d e])
5757
end
5858

5959

6060
ql_hessenberg(A::InfBandedMatrix{T}; kwds...) where T = ql_hessenberg!(BandedMatrix(A, (bandwidth(A,1)+bandwidth(A,2),bandwidth(A,2))); kwds...)
6161

62-
toeptail(B::BandedMatrix{T}) where T =
62+
toeptail(B::BandedMatrix{T}) where T =
6363
_BandedMatrix(B.data.args[end].args[1][1:end-B.u]*Ones{T}(1,∞), size(B,1), B.l-B.u, B.u)
6464

65-
# asymptotics of A[:,j:end] as j -> ∞
65+
# asymptotics of A[:,j:end] as j -> ∞
6666
rightasymptotics(d::Hcat) = last(d.args)
6767
rightasymptotics(d::Vcat) = Vcat(rightasymptotics.(d.args)...)
6868
rightasymptotics(d) = d
@@ -81,12 +81,12 @@ function ql_hessenberg!(B::InfBandedMatrix{TT}; kwds...) where TT
8181
B̃[end,end] = L∞[1,1]
8282
B̃[end:end,end-l+1:end-1] = adjoint(Q∞)[1:1,1:l-1]*T[l:2(l-1),1:l-1]
8383
F = ql!(B̃)
84-
85-
# fill in data with L∞
84+
85+
# fill in data with L∞
8686
= _BandedMatrix(B̃.data, size(data,2)+l, l,u)
8787
B̃[size(data,2)+1:end,end-l+1:end] = adjoint(Q∞)[2:l+1,1:l+1] * T[l:2l,1:l]
8888

89-
89+
9090
# combine finite and infinite data
9191
H = Hcat(B̃.data, rightasymptotics(F∞.factors.data))
9292
QLHessenberg(_BandedMatrix(H, ℵ₀, l, 1), Vcat( LowerHessenbergQ(F.Q).q, F∞.q))
@@ -103,7 +103,7 @@ nzzeros(A::AbstractArray, k) = size(A,k)
103103
nzzeros(::Zeros, k) = 0
104104
nzzeros(B::Vcat, k) = sum(size.(B.args[1:end-1],k))
105105
nzzeros(B::CachedArray, k) = max(B.datasize[k], nzzeros(B.array,k))
106-
function nzzeros(B::AbstractMatrix, k)
106+
function nzzeros(B::AbstractMatrix, k)
107107
l,u = bandwidths(B)
108108
k == 1 ? size(B,2) + l : size(B,1) + u
109109
end
@@ -176,7 +176,7 @@ end
176176
function _lmul_cache(A::AbstractMatrix{T}, x::AbstractVector{S}) where {T,S}
177177
TS = promote_op(matprod, T, S)
178178
lmul!(A, cache(convert(AbstractVector{TS},x)))
179-
end
179+
end
180180

181181
(*)(A::QLPackedQ{T,<:InfBandedMatrix}, x::AbstractVector) where {T} = _lmul_cache(A, x)
182182
(*)(A::Adjoint{T,<:QLPackedQ{T,<:InfBandedMatrix}}, x::AbstractVector) where {T} = _lmul_cache(A, x)
@@ -190,7 +190,7 @@ function blocktailiterate(c,a,b, d=c, e=a)
190190
X = [c a b; z d e]
191191
F = ql!(X)
192192
d̃,ẽ = F.L[1:2,1:2], F.L[1:2,3:4]
193-
193+
194194
d̃,ẽ = QLPackedQ(F.factors[1:2,3:4],F.τ[1:2])*d̃,QLPackedQ(F.factors[1:2,3:4],F.τ[1:2])*# undo last rotation
195195
if (d̃, d; atol=1E-10) && (ẽ, e; atol=1E-10)
196196
X[1:2,1:2] = d̃; X[1:2,3:4] =
@@ -211,7 +211,7 @@ function _blocktripert_ql(A, d, e)
211211
c,a,b = A[Block(N+1,N)],A[Block(N,N)],A[Block(N-1,N)]
212212
P,τ = blocktailiterate(c,a,b,d,e)
213213
B = BlockBandedMatrix(A,(2,1))
214-
214+
215215

216216
BB = _BlockBandedMatrix(B.data.args[1], (fill(2,N+2), fill(2,N)), (2,1))
217217
BB[Block(N),Block.(N-1:N)] .= P[Block(1), Block.(1:2)]
@@ -290,7 +290,7 @@ function materialize!(M::MatLdivVec{<:TriangularLayout{'L','N',BandedColumns{Per
290290
@inbounds for j in 1:n
291291
iszero(data[j,j]) && throw(SingularException(j))
292292
bj = b[j] = data[j,j] \ b[j]
293-
allzero = j > nz && iszero(bj)
293+
allzero = j > nz && iszero(bj)
294294
for i in (j+1:n) colsupport(data,j)
295295
b[i] -= data[i,j] * bj
296296
allzero = allzero && iszero(b[i])
@@ -316,7 +316,7 @@ function _ql(::SymTridiagonalLayout, ::NTuple{2,OneToInf{Int}}, A, args...; kwds
316316
T = eltype(A)
317317
d,d∞ = _data_tail(A.dv)
318318
ev,ev∞ = _data_tail(A.ev)
319-
319+
320320
m = max(length(d), length(ev)+1)
321321
dat = zeros(T, 3, m)
322322
dat[1,2:1+length(ev)] .= ev
@@ -338,7 +338,7 @@ function _ql(::TridiagonalLayout, ::NTuple{2,OneToInf{Int}}, A, args...; kwds...
338338
d,d∞ = _data_tail(A.d)
339339
dl,dl∞ = _data_tail(A.dl)
340340
du,du∞ = _data_tail(A.du)
341-
341+
342342
m = max(length(d), length(du)+1, length(dl))
343343
dat = zeros(T, 3, m)
344344
dat[1,2:1+length(du)] .= du

0 commit comments

Comments
 (0)