Skip to content

Commit 1561361

Browse files
authored
Use Aqua for project quality checks (#197)
* remove unused deps and exports * check for unbound params * Add jumplocations back * revert export jumplocations * version bump to v0.7 * remove circular dependency on ApproxFunOrthogonalPolynomials
1 parent 6a678b2 commit 1561361

File tree

12 files changed

+22
-299
lines changed

12 files changed

+22
-299
lines changed

Project.toml

Lines changed: 4 additions & 8 deletions
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.6.21"
3+
version = "0.7.0"
44

55
[deps]
66
AbstractFFTs = "621f4979-c628-5d54-868e-fcf4e3e8185c"
@@ -12,7 +12,6 @@ DSP = "717857b8-e6f2-59f4-9121-6e50c889abd2"
1212
DomainSets = "5b8099bc-c8ec-5219-889f-1d9e522a28bf"
1313
DualNumbers = "fa6b7ba4-c1ee-5f82-b5fc-ecf0adba8f74"
1414
FFTW = "7a1cc6ca-52ef-59f5-83cd-3a7055c09341"
15-
FastGaussQuadrature = "442a2c76-b920-505d-bb47-c5924d526838"
1615
FillArrays = "1a297f60-69ca-5386-bcde-b61e274b549b"
1716
InfiniteArrays = "4858937d-0d70-526a-a4dd-2d5cb5dd786c"
1817
InfiniteLinearAlgebra = "cde9dba0-b1de-11e9-2c62-0bab9446c55c"
@@ -25,11 +24,10 @@ SpecialFunctions = "276daf66-3868-5448-9aa4-cd146d93841b"
2524
StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"
2625
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
2726
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
28-
ToeplitzMatrices = "c751599d-da0a-543b-9d20-d0a503d91d24"
2927

3028
[compat]
3129
AbstractFFTs = "0.5, 1"
32-
ApproxFunOrthogonalPolynomials = "0.4, 0.5"
30+
Aqua = "0.5"
3331
BandedMatrices = "0.16, 0.17"
3432
BlockArrays = "0.14, 0.15, 0.16"
3533
BlockBandedMatrices = "0.10, 0.11"
@@ -38,7 +36,6 @@ DSP = "0.6, 0.7"
3836
DomainSets = "0.5"
3937
DualNumbers = "0.6.2"
4038
FFTW = "0.3, 1"
41-
FastGaussQuadrature = "0.4"
4239
FillArrays = "0.11, 0.12, 0.13"
4340
InfiniteArrays = "0.11, 0.12"
4441
InfiniteLinearAlgebra = "0.5, 0.6"
@@ -47,12 +44,11 @@ LazyArrays = "0.20, 0.21, 0.22"
4744
LowRankApprox = "0.2, 0.3, 0.4, 0.5"
4845
SpecialFunctions = "0.10, 1.0, 2"
4946
StaticArrays = "0.12, 1.0"
50-
ToeplitzMatrices = "0.6, 0.7"
5147
julia = "1.5"
5248

5349
[extras]
54-
ApproxFunOrthogonalPolynomials = "b70543e2-c0d9-56b8-a290-0d4d6d4de211"
50+
Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595"
5551
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
5652

5753
[targets]
58-
test = ["ApproxFunOrthogonalPolynomials", "Random"]
54+
test = ["Aqua", "Random"]

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ Core functionality of ApproxFun
55
[![](https://img.shields.io/badge/docs-latest-blue.svg)](https://JuliaApproximation.github.io/ApproxFun.jl/latest)
66
[![Build Status](https://github.com/JuliaApproximation/ClassicalOrthogonalPolynomials.jl/workflows/CI/badge.svg)](https://github.com/JuliaApproximation/ApproxFunBase.jl/actions)
77
[![codecov](https://codecov.io/gh/JuliaApproximation/ApproxFunBase.jl/branch/master/graph/badge.svg)](https://codecov.io/gh/JuliaApproximation/ApproxFunBase.jl)
8+
[![Aqua QA](https://raw.githubusercontent.com/JuliaTesting/Aqua.jl/master/badge.svg)](https://github.com/JuliaTesting/Aqua.jl)
89
[![deps](https://juliahub.com/docs/ApproxFunBase/deps.svg)](https://juliahub.com/ui/Packages/ApproxFunBase/deO92?t=2)
910
[![version](https://juliahub.com/docs/ApproxFunBase/version.svg)](https://juliahub.com/ui/Packages/ApproxFunBase/deO92)
1011
[![Join the chat at https://gitter.im/JuliaApproximation/ApproxFun.jl](https://badges.gitter.im/JuliaApproximation/ApproxFun.jl.svg)](https://gitter.im/JuliaApproximation/ApproxFun.jl?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)

src/ApproxFunBase.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,8 @@ import IntervalSets: (..), endpoints
9090
const Vec{d,T} = SVector{d,T}
9191

9292
export pad!, pad, chop!, sample,
93-
complexroots, roots, svfft, isvfft,
94-
reverseorientation, jumplocations
93+
complexroots, roots,
94+
reverseorientation
9595

9696
export .., Interval, ChebyshevInterval, leftendpoint, rightendpoint, endpoints, cache
9797

src/Domain.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
export Domain, SegmentDomain, tocanonical, fromcanonical, fromcanonicalD, ∂
2-
export chebyshevpoints, fourierpoints, isambiguous, arclength
2+
export isambiguous, arclength
33
export components, component, ncomponents
44

55

src/Multivariate/TensorSpace.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ end
2727
const TrivialTensorizer{d} = Tensorizer{NTuple{d,Ones{Int,1,Tuple{OneToInf{Int}}}}}
2828

2929
Base.eltype(a::Tensorizer) = NTuple{length(a.blocks),Int}
30-
Base.eltype(::Tensorizer{NTuple{d,T}}) where {d,T} = NTuple{d,Int}
30+
Base.eltype(::Tensorizer{<:NTuple{d}}) where {d} = NTuple{d,Int}
3131
dimensions(a::Tensorizer) = map(sum,a.blocks)
3232
Base.length(a::Tensorizer) = mapreduce(sum,*,a.blocks)
3333

src/Operators/Operator.jl

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
export Operator
22
export bandwidths, bandrange, \, periodic
3-
export neumann
43
export ldirichlet,rdirichlet,lneumann,rneumann
5-
export ldiffbc,rdiffbc,diffbcs
4+
export ldiffbc,rdiffbc
65
export domainspace,rangespace
76

87
const VectorIndices = Union{AbstractRange, Colon}

src/Operators/SubOperator.jl

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -126,12 +126,7 @@ defaultgetindex(B::Operator,k::InfRanges, j::InfRanges) = view(B, k, j)
126126
defaultgetindex(B::Operator,k::AbstractRange, j::InfRanges) = view(B, k, j)
127127
defaultgetindex(B::Operator,k::InfRanges, j::AbstractRange) = view(B, k, j)
128128

129-
130-
if VERSION < v"1.2-"
131-
reindex(V, idxs, subidxs) = Base.reindex(V, idxs, subidxs)
132-
else
133-
reindex(V, idxs, subidxs) = Base.reindex(idxs, subidxs)
134-
end
129+
reindex(V, idxs, subidxs) = Base.reindex(idxs, subidxs)
135130

136131
reindex(A::Operator, B::Tuple{Block,Any}, kj::Tuple{Any,Any}) =
137132
(reindex(rangespace(A),(B[1],), (kj[1],))[1], reindex(domainspace(A),tail(B), tail(kj))[1])

src/Operators/systems.jl

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -26,20 +26,11 @@ end
2626

2727

2828
## Construction
29-
if VERSION < v"1.3-"
30-
function diagm_container(kv::Pair{<:Integer,<:AbstractVector{O}}...) where O<:Operator
31-
T = mapreduce(x -> mapreduce(eltype,promote_type,x.second),
29+
function diagm_container(size, kv::Pair{<:Integer,<:AbstractVector{<:Operator}}...)
30+
T = mapreduce(x -> mapreduce(eltype,promote_type,x.second),
3231
promote_type, kv)
33-
n = mapreduce(x -> length(x.second) + abs(x.first), max, kv)
34-
zeros(Operator{T}, n, n)
35-
end
36-
else
37-
function diagm_container(size, kv::Pair{<:Integer,<:AbstractVector{O}}...) where O<:Operator
38-
T = mapreduce(x -> mapreduce(eltype,promote_type,x.second),
39-
promote_type, kv)
40-
n = mapreduce(x -> length(x.second) + abs(x.first), max, kv)
41-
zeros(Operator{T}, n, n)
42-
end
32+
n = mapreduce(x -> length(x.second) + abs(x.first), max, kv)
33+
zeros(Operator{T}, n, n)
4334
end
4435

4536
##TODO: unify with other blockdiag

src/PDE/PDE.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
export discretize,timedirichlet
1+
export timedirichlet
22

33
include("KroneckerOperator.jl")
44

test/SpacesTest.jl

Lines changed: 0 additions & 213 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
using ApproxFunBase, Test
22
import ApproxFunBase: PointSpace, HeavisideSpace, PiecewiseSegment, dimension, Vec, checkpoints
3-
using ApproxFunOrthogonalPolynomials
43
using StaticArrays
54
using BandedMatrices: rowrange, colrange, BandedMatrix
65
using LinearAlgebra
@@ -254,216 +253,4 @@ using LinearAlgebra
254253
@test (@inferred union(b, b)) == b
255254
end
256255
end
257-
258-
@testset "ApproxFunOrthogonalPolynomials" begin
259-
@test (@inferred Fun()) == Fun(x->x, Chebyshev())
260-
@test (@inferred norm(Fun())) norm(Fun(), 2) (2/3) # √∫x^2 dx over -1..1
261-
262-
v = rand(4)
263-
v2 = transform(NormalizedChebyshev(), v)
264-
@test itransform(NormalizedChebyshev(), v2) v
265-
266-
f = @inferred Fun(x->x^2, Chebyshev())
267-
v = @inferred coefficients(f, Chebyshev(), Legendre())
268-
@test eltype(v) == eltype(coefficients(f))
269-
@test v coefficients(Fun(x->x^2, Legendre()))
270-
271-
# inference check for coefficients
272-
v = @inferred coefficients(Float64[0,0,1], Chebyshev(), Ultraspherical(1))
273-
@test v [-0.5, 0, 0.5]
274-
275-
@testset "int coeffs" begin
276-
f = Fun(Chebyshev(), [0,1])
277-
@test f(0.4) 0.4
278-
f = Fun(NormalizedChebyshev(), [0,1])
279-
@test f(0.4) 0.4 * (2/pi)
280-
281-
f = Fun(Chebyshev(), [1])
282-
@test f(0.4) 1
283-
f = Fun(NormalizedChebyshev(), [1])
284-
@test f(0.4) (1/pi)
285-
end
286-
287-
@testset "inplace transform" begin
288-
@testset for sp_c in Any[Legendre(), Chebyshev(), Jacobi(1,2), Jacobi(0.3, 2.3),
289-
Ultraspherical(1), Ultraspherical(2)]
290-
@testset for sp in Any[sp_c, NormalizedPolynomialSpace(sp_c)]
291-
v = rand(10)
292-
v2 = copy(v)
293-
@test itransform!(sp, transform!(sp, v)) v
294-
@test transform!(sp, v) transform(sp, v2)
295-
@test itransform(sp, v) v2
296-
@test itransform!(sp, v) v2
297-
298-
# different vector
299-
p_fwd = ApproxFunBase.plan_transform!(sp, v)
300-
p_inv = ApproxFunBase.plan_itransform!(sp, v)
301-
@test p_inv * copy(p_fwd * copy(v)) v
302-
end
303-
end
304-
end
305-
306-
@testset "conversion" begin
307-
C12 = Conversion(Chebyshev(), NormalizedLegendre())
308-
C21 = Conversion(NormalizedLegendre(), Chebyshev())
309-
@test Matrix((C12 * C21)[1:10, 1:10]) I
310-
@test Matrix((C21 * C12)[1:10, 1:10]) I
311-
312-
C12 = Conversion(Chebyshev(), NormalizedPolynomialSpace(Ultraspherical(1)))
313-
C1C2 = Conversion(Ultraspherical(1), NormalizedPolynomialSpace(Ultraspherical(1))) *
314-
Conversion(Chebyshev(), Ultraspherical(1))
315-
@test Matrix(C12[1:10, 1:10]) Matrix(C1C2[1:10, 1:10])
316-
end
317-
318-
@testset "union" begin
319-
@test union(Chebyshev(), NormalizedLegendre()) == Jacobi(Chebyshev())
320-
@test union(Chebyshev(), Legendre()) == Jacobi(Chebyshev())
321-
end
322-
323-
@testset "Fun constructor" begin
324-
# we make the fun go through somewhat complicated chains of functions
325-
# that break inference of the space
326-
# however, the type of coefficients should be inferred correctly.
327-
f = Fun(Chebyshev(0..1))
328-
newfc(f) = coefficients(Fun(Fun(f, Legendre(0..1)), space(f)))
329-
newvals(f) = values(Fun(Fun(f, Legendre(0..1)), space(f)))
330-
@test newfc(f) coefficients(f)
331-
@test newvals(f) values(f)
332-
333-
newfc2(f) = coefficients(chop(pad(f, 10)))
334-
@test newfc2(f) == coefficients(f)
335-
336-
f2 = Fun(space(f), view(Float64[1:4;], :))
337-
f3 = Fun(space(f), Float64[1:4;])
338-
@test newvals(f2) values(f3)
339-
@test values(f2) values(f3)
340-
341-
# Ensure no trailing zeros
342-
f = Fun(Ultraspherical(0.5, 0..1))
343-
cf = coefficients(f)
344-
@test findlast(!iszero, cf) == length(cf)
345-
346-
@testset "OneHotVector" begin
347-
for n in [1, 3, 10_000]
348-
f = Fun(Chebyshev(), [zeros(n-1); 1])
349-
g = ApproxFunBase.basisfunction(Chebyshev(), n)
350-
@test f == g
351-
@test f(0.5) == g(0.5)
352-
end
353-
end
354-
end
355-
356-
@testset "multiplication of Funs" begin
357-
f = Fun(Chebyshev(), Float64[1:101;])
358-
g = Fun(Chebyshev(), Float64[1:101;]*im)
359-
@test f(0.5)*g(0.5) (f*g)(0.5)
360-
end
361-
362-
@testset "Multivariate" begin
363-
@testset for S in Any[Chebyshev(), Legendre()]
364-
f = Fun(x->ones(2,2), S)
365-
@test (f+1) * f (1+f) * f f^2 + f
366-
@test (f-1) * f f^2 - f
367-
@test (1-f) * f f - f^2
368-
@test f + f 2f f*2
369-
end
370-
end
371-
372-
@testset "static coeffs" begin
373-
f = Fun(Chebyshev(), SA[1,2,3])
374-
g = Fun(Chebyshev(), [1,2,3])
375-
@test coefficients(f^2) == coefficients(g^2)
376-
end
377-
378-
@testset "special functions" begin
379-
for f in Any[Fun(), Fun(-0.5..1), Fun(Segment(1.0+im,2.0+2im))]
380-
for spfn in Any[sin, cos, exp]
381-
p = leftendpoint(domain(f))
382-
@test spfn(f)(p) spfn(p) atol=1e-14
383-
end
384-
end
385-
end
386-
387-
@testset "Derivative" begin
388-
@test Derivative() == Derivative()
389-
for d in Any[(), (0..1,)]
390-
for ST in Any[Chebyshev, Legendre,
391-
(x...) -> Jacobi(2,2,x...), (x...) -> Jacobi(1.5,2.5,x...)]
392-
S1 = ST(d...)
393-
for S in [S1, NormalizedPolynomialSpace(S1)]
394-
@test Derivative(S) == Derivative(S,1)
395-
@test Derivative(S)^2 == Derivative(S,2)
396-
f = Fun(x->x^3, S)
397-
@test Derivative(S) * f Fun(x->3x^2, S)
398-
@test Derivative(S,2) * f Fun(x->6x, S)
399-
@test Derivative(S,3) * f Fun(x->6, S)
400-
@test Derivative(S,4) * f zeros(S)
401-
end
402-
end
403-
end
404-
@test Derivative(Chebyshev()) != Derivative(Chebyshev(), 2)
405-
@test Derivative(Chebyshev()) != Derivative(Legendre())
406-
end
407-
408-
@testset "SubOperator" begin
409-
D = Derivative(Chebyshev())
410-
S = @view D[1:10, 1:10]
411-
@test rowrange(S, 1) == 2:2
412-
@test colrange(S, 2) == 1:1
413-
@test (@inferred BandedMatrix(S)) == (@inferred Matrix(S))
414-
end
415-
416-
@testset "CachedOperator" begin
417-
C = cache(Derivative())
418-
C = C : Chebyshev() Ultraspherical(2)
419-
D = Derivative() : Chebyshev() Ultraspherical(2)
420-
@test C[1:2, 1:0] == D[1:2, 1:0]
421-
@test C[1:10, 1:10] == D[1:10, 1:10]
422-
for col in 1:5, row in 1:5
423-
@test C[row, col] == D[row, col]
424-
end
425-
end
426-
427-
@testset "PartialInverseOperator" begin
428-
@testset "sanity check" begin
429-
A = UpperTriangular(rand(10, 10))
430-
B = inv(A)
431-
for I in CartesianIndices(B)
432-
@test B[I] ApproxFunBase._getindexinv(A, Tuple(I)..., UpperTriangular)
433-
end
434-
end
435-
C = Conversion(Chebyshev(), Ultraspherical(1))
436-
P = PartialInverseOperator(C, (0, 6))
437-
Iapprox = (P * C)[1:10, 1:10]
438-
@test all(isone, diag(Iapprox))
439-
for k in axes(Iapprox,1), j in k + 1:min(k + bandwidths(P,2), size(Iapprox, 2))
440-
@test Iapprox[k,j] 0 atol=eps(eltype(Iapprox))
441-
end
442-
B = AbstractMatrix(P[1:10, 1:10])
443-
@testset for I in CartesianIndices(B)
444-
@test B[I] P[Tuple(I)...] rtol=1e-8 atol=eps(eltype(B))
445-
end
446-
end
447-
448-
@testset "istriu/istril" begin
449-
for D in Any[Derivative(Chebyshev()),
450-
Conversion(Chebyshev(), Legendre()),
451-
Multiplication(Fun(Chebyshev()), Chebyshev())]
452-
D2 = D[1:3, 1:3]
453-
for f in Any[istriu, istril]
454-
@test f(D) == f(D2)
455-
@test f(D') == f(D2')
456-
end
457-
end
458-
end
459-
460-
@testset "inplace ldiv" begin
461-
@testset for T in [Float32, Float64, ComplexF32, ComplexF64]
462-
v = rand(T, 4)
463-
v2 = copy(v)
464-
ApproxFunBase.ldiv_coefficients!(Conversion(Chebyshev(), Ultraspherical(1)), v)
465-
@test ApproxFunBase.ldiv_coefficients(Conversion(Chebyshev(), Ultraspherical(1)), v2) v
466-
end
467-
end
468-
end
469256
end

0 commit comments

Comments
 (0)