-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
266 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,46 @@ | ||
name = "InfiniteArrays" | ||
uuid = "4858937d-0d70-526a-a4dd-2d5cb5dd786c" | ||
version = "0.12.13" | ||
version = "0.13.3" | ||
|
||
[deps] | ||
ArrayLayouts = "4c555306-a7a7-4459-81d9-ec55ddd5c99a" | ||
DSP = "717857b8-e6f2-59f4-9121-6e50c889abd2" | ||
FillArrays = "1a297f60-69ca-5386-bcde-b61e274b549b" | ||
Infinities = "e1ba4f0e-776d-440f-acd9-e1d2e9742647" | ||
LazyArrays = "5078a376-72f3-5289-bfd5-ec5146d43c02" | ||
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" | ||
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2" | ||
|
||
[weakdeps] | ||
DSP = "717857b8-e6f2-59f4-9121-6e50c889abd2" | ||
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2" | ||
|
||
[extensions] | ||
InfiniteArraysDSPExt = "DSP" | ||
InfiniteArraysStatisticsExt = "Statistics" | ||
|
||
[compat] | ||
Aqua = "0.6" | ||
ArrayLayouts = "1.0" | ||
BandedMatrices = "0.17.18" | ||
DSP = "0.7" | ||
FillArrays = "1.0" | ||
Infinities = "0.1.1" | ||
LazyArrays = "1.0" | ||
LazyBandedMatrices = "0.8.9" | ||
LazyBandedMatrices = "0.8.9, 0.9" | ||
LinearAlgebra = "1.6" | ||
Statistics = "1.6" | ||
julia = "1.6" | ||
|
||
[extras] | ||
Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595" | ||
BandedMatrices = "aae01518-5342-5314-be14-df237901396f" | ||
Base64 = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f" | ||
DSP = "717857b8-e6f2-59f4-9121-6e50c889abd2" | ||
LazyBandedMatrices = "d7e5e226-e90b-4449-9968-0f923699bf6f" | ||
SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf" | ||
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2" | ||
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" | ||
|
||
[targets] | ||
test = ["Aqua", "Test", "BandedMatrices", "LazyBandedMatrices", "SparseArrays", "Base64"] | ||
test = ["Aqua", "Test", "BandedMatrices", "LazyBandedMatrices", "Statistics", "SparseArrays", "Base64", "DSP"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
module InfiniteArraysDSPExt | ||
|
||
using InfiniteArrays | ||
using InfiniteArrays: InfRanges, OneToInf | ||
# Specifying the full namespace is necessary because of https://github.com/JuliaLang/julia/issues/48533 | ||
# See https://github.com/JuliaStats/LogExpFunctions.jl/pull/63 | ||
using InfiniteArrays.FillArrays | ||
using InfiniteArrays.FillArrays: AbstractFill, getindex_value | ||
using InfiniteArrays.LazyArrays | ||
import DSP: conv | ||
|
||
|
||
## | ||
# conv | ||
# This is useful for determining polynomial dimensions | ||
## | ||
|
||
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
module InfiniteArraysStatisticsExt | ||
|
||
using InfiniteArrays | ||
using InfiniteArrays: InfRanges | ||
using Statistics | ||
|
||
Statistics.mean(r::InfRanges{<:Real}) = last(r) | ||
Statistics.median(r::InfRanges{<:Real}) = last(r) | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.