Skip to content

Aqua CI #230

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions src/basic.jl
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,11 @@ for op in (:*, :∘)
@assert size(A, 2) == ii.len
A
end

@eval function Base.$op(ii1::IdentityOperator, ii2::IdentityOperator)
@assert ii1.len == ii2.len
IdentityOperator(ii1.len)
end
end

function Base.:\(ii::IdentityOperator, A::AbstractSciMLOperator)
Expand Down Expand Up @@ -156,6 +161,35 @@ for op in (:*, :∘)
@assert size(A, 2) == nn.len
NullOperator(nn.len)
end

@eval function Base.$op(nn1::NullOperator, nn2::NullOperator)
@assert nn1.len == nn2.len
NullOperator(nn1.len)
end

@eval function Base.$op(nn::NullOperator, ii::IdentityOperator)
@assert nn.len == ii.len
NullOperator(nn.len)
end

@eval function Base.$op(ii::IdentityOperator, nn::NullOperator)
@assert nn.len == ii.len
NullOperator(nn.len)
end

@eval function Base.$op(nn::NullOperator, ii::IdentityOperator)
@assert nn.len == ii.len
NullOperator(nn.len)
end

@eval function Base.$op(λ::AbstractSciMLScalarOperator, nn::NullOperator)
NullOperator(nn.len)
end

@eval function Base.$op(nn::NullOperator, λ::AbstractSciMLScalarOperator)
NullOperator(nn.len)
end

end

# operator addition, subtraction with NullOperator returns operator itself
Expand All @@ -169,6 +203,12 @@ for op in (:+, :-)
@assert size(A) == (nn.len, nn.len)
A
end

@eval function Base.$op(nn1::NullOperator, nn2::NullOperator)
@assert nn1.len == nn2.len
nn1
end

end

"""
Expand Down
2 changes: 1 addition & 1 deletion src/func.jl
Original file line number Diff line number Diff line change
Expand Up @@ -533,7 +533,7 @@ function Base.resize!(L::FunctionOperator, n::Integer)
L
end

function LinearAlgebra.opnorm(L::FunctionOperator, p)
function LinearAlgebra.opnorm(L::FunctionOperator, p::Real)
L.traits.opnorm === nothing && error("""
M.opnorm is nothing, please define opnorm as a function that takes one
argument. E.g., `(p::Real) -> p == Inf ? 100 : error("only Inf norm is
Expand Down
2 changes: 1 addition & 1 deletion src/matrix.jl
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ Base.transpose(L::InvertibleOperator) = InvertibleOperator(transpose(L.L), trans
Base.adjoint(L::InvertibleOperator) = InvertibleOperator(L.L', L.F')
Base.conj(L::InvertibleOperator) = InvertibleOperator(conj(L.L), conj(L.F))
Base.resize!(L::InvertibleOperator, n::Integer) = (resize!(L.L, n); resize!(L.F, n); L)
LinearAlgebra.opnorm(L::InvertibleOperator{T}, p = 2) where {T} = one(T) / opnorm(L.F)
LinearAlgebra.opnorm(L::InvertibleOperator{T}, p::Real = 2) where {T} = one(T) / opnorm(L.F)
LinearAlgebra.issuccess(L::InvertibleOperator) = issuccess(L.F)

function update_coefficients(L::InvertibleOperator, u, p, t)
Expand Down
4 changes: 4 additions & 0 deletions test/Project.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
[deps]
Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595"
FFTW = "7a1cc6ca-52ef-59f5-83cd-3a7055c09341"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
SafeTestsets = "1bc83da4-3b8d-516f-aca4-4fe02f6d838f"
SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
Zygote = "e88e6eb3-aa80-5325-afca-941959d7151f"

[compat]
Aqua = "0.8"
12 changes: 12 additions & 0 deletions test/qa.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
using SciMLOperators, Aqua
@testset "Aqua" begin
Aqua.find_persistent_tasks_deps(SciMLOperators)
Aqua.test_ambiguities(SciMLOperators, recursive = false)
Aqua.test_deps_compat(SciMLOperators)
Aqua.test_piracies(SciMLOperators,
treat_as_own = [])
Aqua.test_project_extras(SciMLOperators)
Aqua.test_stale_deps(SciMLOperators)
Aqua.test_unbound_args(SciMLOperators)
Aqua.test_undefined_exports(SciMLOperators)
end
3 changes: 3 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
using SafeTestsets

@time begin
@time @safetestset "Quality Assurance" begin
include("qa.jl")
end
@time @safetestset "Scalar Operators" begin
include("scalar.jl")
end
Expand Down