From 311be0c68e30746b50fce163df964084829a2ee7 Mon Sep 17 00:00:00 2001 From: Jishnu Bhattacharya Date: Sat, 29 Jul 2023 13:14:30 +0400 Subject: [PATCH 1/2] Remove DSP conv type piracy --- Project.toml | 15 ++---- ext/InfiniteLinearAlgebraDSPExt.jl | 83 ------------------------------ test/runtests.jl | 1 - test/test_infconv.jl | 16 ------ 4 files changed, 3 insertions(+), 112 deletions(-) delete mode 100644 ext/InfiniteLinearAlgebraDSPExt.jl delete mode 100644 test/test_infconv.jl diff --git a/Project.toml b/Project.toml index 2bcbb19..fd3a92d 100644 --- a/Project.toml +++ b/Project.toml @@ -1,13 +1,12 @@ name = "InfiniteLinearAlgebra" uuid = "cde9dba0-b1de-11e9-2c62-0bab9446c55c" -version = "0.6.23" +version = "0.6.24" [deps] ArrayLayouts = "4c555306-a7a7-4459-81d9-ec55ddd5c99a" BandedMatrices = "aae01518-5342-5314-be14-df237901396f" BlockArrays = "8e7c35d0-a365-5155-bbbb-fb81a777f24e" BlockBandedMatrices = "ffab5731-97b5-5995-9138-79e8c1846df0" -DSP = "717857b8-e6f2-59f4-9121-6e50c889abd2" FillArrays = "1a297f60-69ca-5386-bcde-b61e274b549b" InfiniteArrays = "4858937d-0d70-526a-a4dd-2d5cb5dd786c" LazyArrays = "5078a376-72f3-5289-bfd5-ec5146d43c02" @@ -16,21 +15,14 @@ LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" MatrixFactorizations = "a3b82374-2e81-5b9e-98ce-41277c0e4c87" SemiseparableMatrices = "f8ebbe35-cbfb-4060-bf7f-b10e4670cf57" -[weakdeps] -DSP = "717857b8-e6f2-59f4-9121-6e50c889abd2" - -[extensions] -InfiniteLinearAlgebraDSPExt = "DSP" - [compat] Aqua = "0.6" ArrayLayouts = "1.0.12" BandedMatrices = "0.17.19" BlockArrays = "0.16.14" BlockBandedMatrices = "0.12" -DSP = "0.7" FillArrays = "1" -InfiniteArrays = "0.12" +InfiniteArrays = "0.13" LazyArrays = "1.3" LazyBandedMatrices = "0.8.7" MatrixFactorizations = "1, 2" @@ -39,11 +31,10 @@ julia = "1.6" [extras] Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595" -DSP = "717857b8-e6f2-59f4-9121-6e50c889abd2" Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c" SpecialFunctions = "276daf66-3868-5448-9aa4-cd146d93841b" StaticArrays = "90137ffa-7385-5640-81b9-e52037218182" Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" [targets] -test = ["Aqua", "DSP", "Test", "Random", "SpecialFunctions", "StaticArrays"] +test = ["Aqua", "Test", "Random", "SpecialFunctions", "StaticArrays"] diff --git a/ext/InfiniteLinearAlgebraDSPExt.jl b/ext/InfiniteLinearAlgebraDSPExt.jl deleted file mode 100644 index a18ddca..0000000 --- a/ext/InfiniteLinearAlgebraDSPExt.jl +++ /dev/null @@ -1,83 +0,0 @@ -module InfiniteLinearAlgebraDSPExt - -using InfiniteLinearAlgebra -using InfiniteArrays -using InfiniteArrays: InfRanges, OneToInf -using FillArrays -using FillArrays: AbstractFill, getindex_value -using LazyArrays -import DSP: conv - - -## -# conv -# This is useful for determining polynomial dimensions -## - -conv(a::AbstractFill, b::AbstractFill) = conv(collect(a), collect(b)) -conv(a::Vector, b::AbstractFill) = conv(a, collect(b)) -conv(a::AbstractFill, b::Vector) = conv(collect(a), b) - - -conv(::Ones{T,1,<:Tuple{<:OneToInf}}, ::Ones{V,1,<:Tuple{<:OneToInf}}) where {T<:Integer,V<:Integer} = - OneToInf{promote_type(T,V)}() -conv(::Ones{Bool,1,<:Tuple{<:OneToInf}}, ::Ones{Bool,1,<:Tuple{<:OneToInf}}) = - OneToInf() -conv(::Ones{T,1,<:Tuple{<:OneToInf}}, ::Ones{V,1,<:Tuple{<:OneToInf}}) where {T,V} = - one(promote_type(T,V)):∞ - -function conv(::Ones{T,1,<:Tuple{<:OneToInf}}, a::AbstractVector{V}) where {T,V} - cs = cumsum(convert(AbstractVector{promote_type(T,V)}, a)) - Vcat(cs, Fill(last(cs), ∞)) -end - -function conv(::Ones{T,1,<:Tuple{<:OneToInf}}, a::Vector{V}) where {T,V} - cs = cumsum(convert(AbstractVector{promote_type(T,V)}, a)) - Vcat(cs, Fill(last(cs), ∞)) -end - -function conv(a::AbstractVector{V}, ::Ones{T,1,<:Tuple{<:OneToInf}}) where {T,V} - cs = cumsum(convert(AbstractVector{promote_type(T,V)}, a)) - Vcat(cs, Fill(last(cs), ∞)) -end - -function conv(a::Vector{V}, ::Ones{T,1,<:Tuple{<:OneToInf}}) where {T,V} - cs = cumsum(convert(AbstractVector{promote_type(T,V)}, a)) - Vcat(cs, Fill(last(cs), ∞)) -end - - -function conv(r::InfRanges, x::AbstractVector) - length(x) ≠ 1 && throw(ArgumentError("conv(::$(typeof(r)), ::$(typeof(x))) not implemented")) - first(x)*r -end -function conv(x::AbstractVector, r::InfRanges) - length(x) ≠ 1 && throw(ArgumentError("conv(::$(typeof(r)), ::$(typeof(x))) not implemented")) - first(x)*r -end - -conv(r1::InfRanges, r2::AbstractFill{<:Any,1,<:Tuple{<:OneToInf}}) = - cumsum(r1*getindex_value(r2)) -conv(r2::AbstractFill{<:Any,1,<:Tuple{<:OneToInf}}, r1::InfRanges) = - cumsum(getindex_value(r2)*r1) - -conv(r1::InfRanges, r2::Ones{<:Any,1,<:Tuple{<:OneToInf}}) = cumsum(r1) -conv(r2::Ones{<:Any,1,<:Tuple{<:OneToInf}}, r1::InfRanges) = cumsum(r1) - -conv(r1::InfRanges, r2::InfRanges) = throw(ArgumentError("conv(::$(typeof(r1)), ::$(typeof(r2))) not implemented")) - -function conv(r1::AbstractFill{<:Any,1,<:Tuple{<:OneToInf}}, r2::AbstractFill{<:Any,1,<:Tuple{<:OneToInf}}) - a = getindex_value(r1) * getindex_value(r2) - a:a:∞ -end -function conv(r1::AbstractFill{<:Any,1,<:Tuple{<:OneToInf}}, r2::Ones{<:Any,1,<:Tuple{<:OneToInf}}) - a = getindex_value(r1) * getindex_value(r2) - a:a:∞ -end -function conv(r1::Ones{<:Any,1,<:Tuple{<:OneToInf}}, r2::AbstractFill{<:Any,1,<:Tuple{<:OneToInf}}) - a = getindex_value(r1) * getindex_value(r2) - a:a:∞ -end - - -end diff --git a/test/runtests.jl b/test/runtests.jl index 4eef3ec..ff23eea 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -54,7 +54,6 @@ end @test pad(BlockVec(transpose(X)), blockedrange(Fill(3,∞))) isa BlockVec{Int,<:Transpose} end -include("test_infconv.jl") include("test_infbanded.jl") @testset "∞-block arrays" begin diff --git a/test/test_infconv.jl b/test/test_infconv.jl deleted file mode 100644 index c921698..0000000 --- a/test/test_infconv.jl +++ /dev/null @@ -1,16 +0,0 @@ -using InfiniteLinearAlgebra, DSP, FillArrays, Test - -@testset "conv" begin - @test conv(1:∞, [2]) ≡ conv([2], 1:∞) ≡ 2:2:∞ - @test conv(1:2:∞, [2]) ≡ conv([2], 1:2:∞) ≡ 2:4:∞ - @test conv(1:∞, Ones(∞))[1:5] == conv(Ones(∞),1:∞)[1:5] == [1,3,6,10,15] - @test conv(Ones(∞), Ones(∞)) ≡ 1.0:1.0:∞ - @test conv(Ones{Int}(∞), Ones{Int}(∞)) ≡ oneto(∞) - @test conv(Ones{Bool}(∞), Ones{Bool}(∞)) ≡ oneto(∞) - @test conv(Fill{Int}(2,∞), Fill{Int}(1,∞)) ≡ conv(Fill{Int}(2,∞), Ones{Int}(∞)) ≡ - conv(Ones{Int}(∞), Fill{Int}(2,∞)) ≡ 2:2:∞ - @test conv(Ones{Int}(∞), [1,5,8])[1:10] == conv([1,5,8], Ones{Int}(∞))[1:10] == - conv(fill(1,100),[1,5,8])[1:10] == conv([1,5,8], fill(1,100))[1:10] - @test conv(Ones{Int}(∞), 1:4)[1:10] == conv(1:4, Ones{Int}(∞))[1:10] == - conv(fill(1,100),collect(1:4))[1:10] == conv(collect(1:4), fill(1,100))[1:10] -end From 9520d865e316b9e23bb3af0873952475d0c0020e Mon Sep 17 00:00:00 2001 From: Jishnu Bhattacharya Date: Sat, 29 Jul 2023 13:23:29 +0400 Subject: [PATCH 2/2] don't include ext file --- src/InfiniteLinearAlgebra.jl | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/InfiniteLinearAlgebra.jl b/src/InfiniteLinearAlgebra.jl index 34b2a9c..3763bf2 100644 --- a/src/InfiniteLinearAlgebra.jl +++ b/src/InfiniteLinearAlgebra.jl @@ -126,9 +126,4 @@ include("infqr.jl") include("inful.jl") include("infcholesky.jl") - -if !isdefined(Base, :get_extension) - include("../ext/InfiniteLinearAlgebraDSPExt.jl") -end - end # module