From 6e55a5e70cba4bcfa4ccbae0057cecf8190d3a85 Mon Sep 17 00:00:00 2001 From: Martin Holters Date: Wed, 4 Dec 2024 09:36:30 +0100 Subject: [PATCH] Simplify (and slightly speed up) `coefb`/`coefa` --- src/Filters/coefficients.jl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Filters/coefficients.jl b/src/Filters/coefficients.jl index ef477cca2..e6fbe004c 100644 --- a/src/Filters/coefficients.jl +++ b/src/Filters/coefficients.jl @@ -191,8 +191,8 @@ function Base.:^(f::PolynomialRatio{D,T}, e::Integer) where {D,T} end end -coef_s(p::LaurentPolynomial{T}) where T = (n = firstindex(p); append!(reverse!(coeffs(p)), zero(T) for _ in 1:n)) -coef_z(p::LaurentPolynomial{T}) where T = (n = -lastindex(p); prepend!(reverse!(coeffs(p)), zero(T) for _ in 1:n)) +coef_s(p::LaurentPolynomial) = p[end:-1:0] +coef_z(p::LaurentPolynomial) = p[0:-1:begin] """ coefb(f::PolynomialRatio)