diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 70e26b5..fe0695d 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -1,6 +1,8 @@ name: CI on: + create: + tags: push: branches: - main @@ -32,11 +34,15 @@ jobs: coverage: true steps: - uses: actions/checkout@v4 + +# - name: "Set up Julia" - uses: julia-actions/setup-julia@latest with: version: ${{ matrix.version }} arch: ${{ matrix.arch }} - - uses: actions/cache@v4 + + - name: Cache artifacts + uses: actions/cache@v4 env: cache-name: cache-artifacts with: @@ -46,14 +52,21 @@ jobs: ${{ runner.os }}-test-${{ env.cache-name }}- ${{ runner.os }}-test- ${{ runner.os }}- - - uses: julia-actions/julia-buildpkg@v1 - - uses: julia-actions/julia-runtest@v1 + +# - name: "Unit Test" + - uses: julia-actions/julia-buildpkg@latest + - uses: julia-actions/julia-runtest@latest + +# - name: "Cover" - uses: julia-actions/julia-processcoverage@v1 if: matrix.coverage - uses: codecov/codecov-action@v4 if: matrix.coverage with: file: lcov.info + fail_ci_if_error: false + env: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} - uses: coverallsapp/github-action@master if: matrix.coverage with: diff --git a/Project.toml b/Project.toml index 57571fa..b9fb1ea 100644 --- a/Project.toml +++ b/Project.toml @@ -7,5 +7,6 @@ LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" Polynomials = "f27b6e38-b328-58d1-80ce-0feddd5e7a45" [compat] +LinearAlgebra = "1" Polynomials = "1, 2, 3, 4" julia = "1.6" diff --git a/src/cauchy.jl b/src/cauchy.jl index 9137244..8dcdea6 100644 --- a/src/cauchy.jl +++ b/src/cauchy.jl @@ -54,9 +54,9 @@ struct Cauchy{T,X,Y} <: AbstractMatrix{T} y::Y function Cauchy( - x::Union{NTuple{N,<:Tx}, AbstractArray{Tx}}, - y::Union{NTuple{M,<:Ty}, AbstractArray{Ty}}, - ) where {N, M, Tx <: Number, Ty <: Number} + x::Union{NTuple{N,<:Tx} where {N}, AbstractArray{Tx}}, + y::Union{NTuple{M,<:Ty} where {M}, AbstractArray{Ty}}, + ) where {Tx <: Number, Ty <: Number} Base.require_one_based_indexing(x) Base.require_one_based_indexing(y) _cauchy_check(x, y) diff --git a/src/companion.jl b/src/companion.jl index 7fed341..1888022 100644 --- a/src/companion.jl +++ b/src/companion.jl @@ -85,7 +85,7 @@ function mul!(y::Vector, C::Companion, x::AbstractVector) return y end -# A <= B * C +# A ⟸ B * C function mul!(A::Matrix, B::AbstractMatrix, C::Companion) @boundscheck (size(A) == (size(B,1), size(C,2)) && size(B, 2) == size(C,1)) || throw(DimensionMismatch("mul! arguments incompatible sizes")) @@ -93,7 +93,7 @@ function mul!(A::Matrix, B::AbstractMatrix, C::Companion) @views for j in 1:size(A,2)-1 @inbounds A[:,j] = B[:,j+1] end - @inbounds mul!((@view A[:,end]), B, C.c, -1, 0) # A[:,end] <= - B * c + @inbounds mul!((@view A[:,end]), B, C.c, -1, 0) # A[:,end] ⟸ - B * c return A end diff --git a/src/frobenius.jl b/src/frobenius.jl index e3629fb..f397c12 100644 --- a/src/frobenius.jl +++ b/src/frobenius.jl @@ -100,7 +100,7 @@ end # Linear algebra -# 3-argument mul! mutates first argument: y <= F * x +# 3-argument mul! mutates first argument: y ⟸ F * x # *(F, x) = F * x derives from this automatically in Base function mul!(y::Vector, F::Frobenius, x::AbstractVector) Base.require_one_based_indexing(x) diff --git a/test/Project.toml b/test/Project.toml index adbac9d..205ca81 100644 --- a/test/Project.toml +++ b/test/Project.toml @@ -1,4 +1,5 @@ [deps] +Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595" LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" OffsetArrays = "6fe1bfb0-de20-5000-8ca7-80f57d26f881" Polynomials = "f27b6e38-b328-58d1-80ce-0feddd5e7a45" diff --git a/test/aqua.jl b/test/aqua.jl new file mode 100644 index 0000000..06548ad --- /dev/null +++ b/test/aqua.jl @@ -0,0 +1,19 @@ +using SpecialMatrices: SpecialMatrices +import Aqua +using Test: @testset + +@testset "aqua" begin + if VERSION < v"1.11" + Aqua.test_all(SpecialMatrices; ambiguities = false) + else + Aqua.test_all(SpecialMatrices) + end +end + +#= +todo: 1 ambiguity in julia v1.10 +mul!(A::Matrix, B::AbstractMatrix, C::SpecialMatrices.Companion) + SpecialMatrices/src/companion.jl:89 +mul!(C::AbstractMatrix, A::LinearAlgebra.AbstractTriangular, B::AbstractMatrix) + LinearAlgebra/src/triangular.jl:691 +=# diff --git a/test/cauchy.jl b/test/cauchy.jl index a7cd38c..e9a6d01 100644 --- a/test/cauchy.jl +++ b/test/cauchy.jl @@ -1,3 +1,8 @@ +# test/cauchy.jl + +using SpecialMatrices: Cauchy +using Test: @test, @test_throws, @inferred + C = @inferred Cauchy(3) @test 1 ./ C ≈ [2 3 4; 3 4 5; 4 5 6] @test size(C) == (3,3) diff --git a/test/companion.jl b/test/companion.jl index c6c6f1a..ee758a3 100644 --- a/test/companion.jl +++ b/test/companion.jl @@ -1,5 +1,8 @@ # test/companion.jl +using SpecialMatrices: Companion +using Test: @test, @test_throws, @inferred + import LinearAlgebra: mul! using OffsetArrays: OffsetArray import OffsetArrays # for no_offset_view diff --git a/test/frobenius.jl b/test/frobenius.jl index 29bb6b2..fb73aa1 100644 --- a/test/frobenius.jl +++ b/test/frobenius.jl @@ -1,3 +1,7 @@ +# test/frobenius.jl + +using SpecialMatrices: Frobenius +using Test: @test, @test_throws, @inferred using LinearAlgebra: I import LinearAlgebra: mul! diff --git a/test/hilbert.jl b/test/hilbert.jl index ae82ddc..4533a9a 100644 --- a/test/hilbert.jl +++ b/test/hilbert.jl @@ -1,5 +1,9 @@ # test/hilbert.jl +using SpecialMatrices: Hilbert, InverseHilbert +using LinearAlgebra: I, det, ishermitian, isposdef +using Test: @test, @test_throws, @inferred + n = 10 H = @inferred Hilbert(n) @test H isa Hilbert diff --git a/test/kahan.jl b/test/kahan.jl index 97f2e07..2e42bd5 100644 --- a/test/kahan.jl +++ b/test/kahan.jl @@ -1,5 +1,8 @@ # test/kahan.jl +using SpecialMatrices: Kahan +using Test: @test, @inferred + m, n = 3, 5 A = Kahan(m, n, 0.5, 1e-3) diff --git a/test/runtests.jl b/test/runtests.jl index 107aa69..ab68cc8 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -1,6 +1,7 @@ -using SpecialMatrices -using Test -using LinearAlgebra +using SpecialMatrices: SpecialMatrices +using Test: @test, @test_broken, @testset, detect_ambiguities + +include("aqua.jl") const files = ( "cauchy", @@ -18,3 +19,11 @@ const files = ( include("$f.jl") end end + +@testset "ambiguities" begin +if VERSION < v"1.11" + @test_broken isempty(detect_ambiguities(SpecialMatrices)) # see aqua.jl +else + @test isempty(detect_ambiguities(SpecialMatrices)) +end +end