From 6d5b44fb5169d964377c7c48fd13c0a48deb4122 Mon Sep 17 00:00:00 2001 From: Sheehan Olver Date: Thu, 12 Dec 2024 14:25:00 +0000 Subject: [PATCH] Change clenshaw!/horner! to mutate first argument --- Project.toml | 6 ++---- src/FastTransforms.jl | 13 +++++-------- src/libfasttransforms.jl | 12 ++++++------ 3 files changed, 13 insertions(+), 18 deletions(-) diff --git a/Project.toml b/Project.toml index be1349a2..c2221051 100644 --- a/Project.toml +++ b/Project.toml @@ -1,6 +1,6 @@ name = "FastTransforms" uuid = "057dd010-8810-581a-b7be-e3fc3b93f78c" -version = "0.16.6" +version = "0.17" [deps] AbstractFFTs = "621f4979-c628-5d54-868e-fcf4e3e8185c" @@ -15,7 +15,6 @@ LazyArrays = "5078a376-72f3-5289-bfd5-ec5146d43c02" Libdl = "8f399da3-3557-5675-b5ff-fb832c97cbdb" LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" RecurrenceRelationships = "807425ed-42ea-44d6-a357-6771516d7b2c" -Reexport = "189a3867-3050-52da-a836-e630ba90ab69" SpecialFunctions = "276daf66-3868-5448-9aa4-cd146d93841b" ToeplitzMatrices = "c751599d-da0a-543b-9d20-d0a503d91d24" @@ -29,8 +28,7 @@ FastTransforms_jll = "0.6.2" FillArrays = "0.9, 0.10, 0.11, 0.12, 0.13, 1" GenericFFT = "0.1" LazyArrays = "2.2" -RecurrenceRelationships = "0.1" -Reexport = "0.2, 1.0" +RecurrenceRelationships = "0.2" SpecialFunctions = "0.10, 1, 2" ToeplitzMatrices = "0.7.1, 0.8" julia = "1.7" diff --git a/src/FastTransforms.jl b/src/FastTransforms.jl index 8a3d5a3c..4eef13ad 100644 --- a/src/FastTransforms.jl +++ b/src/FastTransforms.jl @@ -1,11 +1,11 @@ module FastTransforms using ArrayLayouts, BandedMatrices, FastGaussQuadrature, FillArrays, LazyArrays, LinearAlgebra, - Reexport, SpecialFunctions, ToeplitzMatrices, RecurrenceRelationships + SpecialFunctions, ToeplitzMatrices, RecurrenceRelationships -@reexport using AbstractFFTs -@reexport using FFTW -@reexport using GenericFFT +using AbstractFFTs +using FFTW +using GenericFFT import Base: convert, unsafe_convert, eltype, ndims, adjoint, transpose, show, *, \, inv, length, size, view, getindex, tail, OneTo @@ -34,11 +34,8 @@ import LinearAlgebra: cholesky, issymmetric, isposdef, mul!, lmul!, ldiv! import GenericFFT: interlace # imported in downstream packages -import RecurrenceRelationships: clenshaw!, check_clenshaw_recurrences +import RecurrenceRelationships: check_clenshaw_recurrences -const _forwardrecurrence! = RecurrenceRelationships.forwardrecurrence! -const _clenshaw_next = RecurrenceRelationships.clenshaw_next -const _forwardrecurrence_next = RecurrenceRelationships.forwardrecurrence_next export leg2cheb, cheb2leg, ultra2ultra, jac2jac, lag2lag, jac2ultra, ultra2jac, jac2cheb, diff --git a/src/libfasttransforms.jl b/src/libfasttransforms.jl index d89f0490..3ce492d9 100644 --- a/src/libfasttransforms.jl +++ b/src/libfasttransforms.jl @@ -49,13 +49,13 @@ function renew!(x::AbstractArray{BigFloat}) return x end -function horner!(c::StridedVector{Float64}, x::Vector{Float64}, f::Vector{Float64}) +function horner!(f::Vector{Float64}, c::StridedVector{Float64}, x::Vector{Float64}) @assert length(x) == length(f) ccall((:ft_horner, libfasttransforms), Cvoid, (Cint, Ptr{Float64}, Cint, Cint, Ptr{Float64}, Ptr{Float64}), length(c), c, stride(c, 1), length(x), x, f) f end -function horner!(c::StridedVector{Float32}, x::Vector{Float32}, f::Vector{Float32}) +function horner!(f::Vector{Float32}, c::StridedVector{Float32}, x::Vector{Float32}) @assert length(x) == length(f) ccall((:ft_hornerf, libfasttransforms), Cvoid, (Cint, Ptr{Float32}, Cint, Cint, Ptr{Float32}, Ptr{Float32}), length(c), c, stride(c, 1), length(x), x, f) f @@ -69,19 +69,19 @@ function check_clenshaw_points(x, f) length(x) == length(f) || throw(ArgumentError("Dimensions must match")) end -function clenshaw!(c::StridedVector{Float64}, x::Vector{Float64}, f::Vector{Float64}) +function clenshaw!(f::Vector{Float64}, c::StridedVector{Float64}, x::Vector{Float64}) @boundscheck check_clenshaw_points(x, f) ccall((:ft_clenshaw, libfasttransforms), Cvoid, (Cint, Ptr{Float64}, Cint, Cint, Ptr{Float64}, Ptr{Float64}), length(c), c, stride(c, 1), length(x), x, f) f end -function clenshaw!(c::StridedVector{Float32}, x::Vector{Float32}, f::Vector{Float32}) +function clenshaw!(f::Vector{Float32}, c::StridedVector{Float32}, x::Vector{Float32}) @boundscheck check_clenshaw_points(x, f) ccall((:ft_clenshawf, libfasttransforms), Cvoid, (Cint, Ptr{Float32}, Cint, Cint, Ptr{Float32}, Ptr{Float32}), length(c), c, stride(c, 1), length(x), x, f) f end -function clenshaw!(c::StridedVector{Float64}, A::Vector{Float64}, B::Vector{Float64}, C::Vector{Float64}, x::Vector{Float64}, ϕ₀::Vector{Float64}, f::Vector{Float64}) +function clenshaw!(f::Vector{Float64}, c::StridedVector{Float64}, A::Vector{Float64}, B::Vector{Float64}, C::Vector{Float64}, x::Vector{Float64}, ϕ₀::Vector{Float64}) N = length(c) @boundscheck check_clenshaw_recurrences(N, A, B, C) @boundscheck check_clenshaw_points(x, ϕ₀, f) @@ -89,7 +89,7 @@ function clenshaw!(c::StridedVector{Float64}, A::Vector{Float64}, B::Vector{Floa f end -function clenshaw!(c::StridedVector{Float32}, A::Vector{Float32}, B::Vector{Float32}, C::Vector{Float32}, x::Vector{Float32}, ϕ₀::Vector{Float32}, f::Vector{Float32}) +function clenshaw!(f::Vector{Float32}, c::StridedVector{Float32}, A::Vector{Float32}, B::Vector{Float32}, C::Vector{Float32}, x::Vector{Float32}, ϕ₀::Vector{Float32}) N = length(c) @boundscheck check_clenshaw_recurrences(N, A, B, C) @boundscheck check_clenshaw_points(x, ϕ₀, f)