Skip to content

Commit b47a399

Browse files
committed
cleanup
1 parent 9b0125b commit b47a399

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

src/LegendrePolynomials.jl

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ function Pl_hyperdual(x::Real, l::Integer)
5959
"Legendre Polynomials are defined for arguments lying in -1 ⩽ x ⩽ 1"))
6060

6161
hd1 = hyper(one(x))
62-
hdx = hyper(x,one(x),one(x),zero(x))
62+
hdx = hyper(x, one(x), one(x), zero(x))
6363

6464
if l==0
6565
return hd1
@@ -82,7 +82,7 @@ function Pl_derivatives_allmodes!(arr::AbstractVector{<:Real}, x::Real,
8282
lmax::Integer = maximum(axes(arr,1)), deriv=0)
8383

8484
# Only compute Pl
85-
arr_hyperdual = view(Pl_hyperdual_allmodes(x,lmax),0:lmax)
85+
arr_hyperdual = view(Pl_hyperdual_allmodes(x, lmax), 0:lmax)
8686

8787
@inbounds @. arr[0:lmax] = realpart(arr_hyperdual)
8888
arr
@@ -92,10 +92,10 @@ function Pl_derivatives_allmodes!(arr::AbstractMatrix{<:Real}, x::Real,
9292
lmax::Integer = maximum(axes(arr,1)),
9393
deriv::Integer = maximum(axes(arr,2)))
9494

95-
arr_hyperdual = view(Pl_hyperdual_allmodes(x,lmax),0:lmax)
95+
arr_hyperdual = view(Pl_hyperdual_allmodes(x, lmax), 0:lmax)
9696

97-
@inbounds for (d_order,f) in zip(0:deriv,(realpart,eps1,eps1eps2))
98-
@. arr[0:lmax,d_order] = f(arr_hyperdual)
97+
@inbounds for (d_order,f) in zip(0:deriv, (realpart,eps1,eps1eps2))
98+
@. arr[0:lmax, d_order] = f(arr_hyperdual)
9999
end
100100
arr
101101
end
@@ -114,7 +114,7 @@ end
114114
Computes the Legendre Polynomials ``P_l(x)`` for the argument `x` and `l = 0:lmax`.
115115
Returns an `OffsetArray` `P` with indices `0:lmax`, where `P[l] == Pl(x,l)`
116116
"""
117-
Pl(x::Real; lmax::Integer) = Pl_derivatives_allmodes(x,lmax,0)[:,0]
117+
Pl(x::Real; lmax::Integer) = Pl_derivatives_allmodes(x, lmax, 0)[:,0]
118118

119119
"""
120120
Pl(x::Real, l::Integer)
@@ -133,7 +133,7 @@ Computes the first derivatives of Legendre Polynomials ``d_xP_l(x)`` for the
133133
argument `x` and `l = 0:lmax`.
134134
Returns an `OffsetArray` `dP` with indices `0:lmax`, where `dP[l] = dPl(x,l)`
135135
"""
136-
dPl(x::Real; lmax::Integer) = Pl_derivatives_allmodes(x,lmax,1)[:,1]
136+
dPl(x::Real; lmax::Integer) = Pl_derivatives_allmodes(x, lmax, 1)[:,1]
137137

138138
"""
139139
dPl(x::Real, l::Integer)
@@ -175,7 +175,7 @@ Returns `OffsetArray`s `P` and `dP` with indices `0:lmax`, where `P[l] == Pl(x,l
175175
`dP[l] == dPl(x,l)`.
176176
"""
177177
function Pl_dPl(x::Real; lmax::Integer)
178-
P = Pl_derivatives_allmodes(x,lmax,1)
178+
P = Pl_derivatives_allmodes(x, lmax, 1)
179179
P[:,0], P[:,1]
180180
end
181181

@@ -235,7 +235,7 @@ Computes the the first and second derivatives of Legendre Polynomials ``d_xP_l(x
235235
and ``d_x^2P_l(x)`` for the argument `x` and the degree `l`
236236
"""
237237
function dPl_d2Pl(x::Real, l::Integer)
238-
Ph = Pl_hyperdual(x,l)
238+
Ph = Pl_hyperdual(x, l)
239239
eps1(Ph), eps1eps2(Ph)
240240
end
241241

@@ -279,7 +279,7 @@ The optional keyword argument `lmax` may specify the range of ``l``'s to compute
279279
It defaults to `lmax = maximum(axes(arr,1))`
280280
"""
281281
Pl!(arr::AbstractVecOrMat{<:Real}, x::Real; lmax::Integer = maximum(axes(arr,1))) =
282-
Pl_derivatives_allmodes!(arr,x,lmax,0)
282+
Pl_derivatives_allmodes!(arr, x, lmax, 0)
283283

284284
"""
285285
Pl_dPl!(arr, x; [lmax = maximum(axes(arr,1))])
@@ -316,14 +316,15 @@ The optional keyword argument `lmax` may specify the range of ``l``'s to compute
316316
It defaults to `lmax = maximum(axes(arr,1))`
317317
"""
318318
function dPl!(arr::AbstractVector{<:Real}, x::Real; lmax::Integer = maximum(axes(arr,1)))
319-
P = zeros(axes(arr,1),0:1)
319+
P = zeros(axes(arr,1), 0:1)
320320
Pl_dPl_d2Pl!(P, x; lmax = lmax)
321321
@views @. arr = P[:,1]
322322
arr
323323
end
324324

325325
function dPl!(arr::AbstractMatrix{<:Real}, x::Real;
326326
lmax::Integer = maximum(axes(arr,1)))
327+
327328
P = zeros(axes(arr,1),0:1)
328329
Pl_dPl_d2Pl!(P, x; lmax = lmax)
329330
@views @. arr[:,1] = P[:,1]

0 commit comments

Comments
 (0)