|
14 | 14 | # Step 4: run `make` and check the tests by running `./test_drivers 3 3 0`.
|
15 | 15 | # All the errors should be roughly on the order of machine precision.
|
16 | 16 |
|
17 |
| -if Sys.isapple() |
18 |
| - const libfasttransforms = joinpath(dirname(@__DIR__), "deps", "libfasttransforms.dylib") |
19 |
| -else |
| 17 | +const libfasttransforms = joinpath(dirname(@__DIR__), "deps", "libfasttransforms") |
| 18 | + |
| 19 | +if !(find_library(libfasttransforms) ≡ libfasttransforms) |
20 | 20 | error("FastTransforms is not properly installed. Please run Pkg.build(\"FastTransforms\") ",
|
21 | 21 | "and restart Julia.")
|
22 | 22 | end
|
@@ -186,6 +186,25 @@ checksize(p::TransposeFTPlan, x) = checksize(p.parent, x)
|
186 | 186 | unsafe_convert(::Type{Ptr{ft_plan_struct}}, p::TransposeFTPlan{T, FTPlan{T, N, K}}) where {T, N, K} = unsafe_convert(Ptr{ft_plan_struct}, p.parent)
|
187 | 187 | unsafe_convert(::Type{Ptr{mpfr_t}}, p::TransposeFTPlan{T, FTPlan{T, N, K}}) where {T, N, K} = unsafe_convert(Ptr{mpfr_t}, p.parent)
|
188 | 188 |
|
| 189 | +for f in (:leg2cheb, :cheb2leg, :ultra2ultra, :jac2jac, |
| 190 | + :lag2lag, :jac2ultra, :ultra2jac, :jac2cheb, |
| 191 | + :cheb2jac, :ultra2cheb, :cheb2ultra, |
| 192 | + :sph2fourier, :sphv2fourier, :disk2cxf, :tri2cheb) |
| 193 | + plan_f = Symbol("plan_", f) |
| 194 | + @eval begin |
| 195 | + $plan_f(x::AbstractArray{T}, y...; z...) where T = $plan_f(T, size(x, 1), y...; z...) |
| 196 | + $f(x::AbstractArray{T}, y...; z...) where T = $plan_f(x, y...; z...)*x |
| 197 | + end |
| 198 | +end |
| 199 | + |
| 200 | +for (f, plan_f) in ((:fourier2sph, :plan_sph2fourier), (:fourier2sphv, :plan_sphv2fourier), |
| 201 | + (:cxf2disk2, :plan_disk2cxf), (:cheb2tri, :plan_tri2cheb)) |
| 202 | + @eval begin |
| 203 | + $f(x::AbstractArray{T}, y...; z...) where T = $plan_f(x, y...; z...)\x |
| 204 | + end |
| 205 | +end |
| 206 | + |
| 207 | + |
189 | 208 | function plan_leg2cheb(::Type{Float32}, n::Integer; normleg::Bool=false, normcheb::Bool=false)
|
190 | 209 | plan = ccall((:ft_plan_legendre_to_chebyshevf, libfasttransforms), Ptr{ft_plan_struct}, (Cint, Cint, Cint), normleg, normcheb, n)
|
191 | 210 | return FTPlan{Float32, 1, LEG2CHEB}(plan, n)
|
|
0 commit comments