Skip to content

Commit

Permalink
mul! -> lmul!
Browse files Browse the repository at this point in the history
  • Loading branch information
MikaelSlevinsky committed Sep 5, 2024
1 parent 87530a6 commit a08c90a
Showing 1 changed file with 9 additions and 21 deletions.
30 changes: 9 additions & 21 deletions src/libfasttransforms.jl
Original file line number Diff line number Diff line change
Expand Up @@ -324,42 +324,30 @@ function plan_fmm_leg2cheb(::Type{Float64}, n::Integer)
M = 18
BOTH = 2
lagrange = 0
verbose = 2
verbose = 0
plan = ccall((:ft_create_fmm, libfasttransforms), Ptr{ft_plan_struct}, (Cint, Cint, Cint, Cint, Cint, Cint), n, maxs, M, BOTH, lagrange, verbose)
return FTPlan{Float64, 1, FMMLEG2CHEB}(plan, n)
end

function mul!(y::StridedVector{Float64}, p::FTPlan{Float64, 1, FMMLEG2CHEB}, x::StridedVector{Float64})
function lmul!(p::FTPlan{Float64, 1, FMMLEG2CHEB}, x::StridedVector{Float64})
checksize(p, x)
checksize(p, y)
checkstride(p, x)
checkstride(p, y)
y = zero(x)
L2C = 0
flops = ccall((:ft_execute, libfasttransforms), Cint, (Ptr{Float64}, Ptr{Float64}, Ptr{ft_plan_struct}, Cint, Cint), x, y, p, L2C, 1)
return y
x .= y
return x
end
function div!(y::StridedVector{Float64}, p::FTPlan{Float64, 1, FMMLEG2CHEB}, x::StridedVector{Float64})
function ldiv!(p::FTPlan{Float64, 1, FMMLEG2CHEB}, x::StridedVector{Float64})
checksize(p, x)
checksize(p, y)
checkstride(p, x)
checkstride(p, y)
y = zero(x)
C2L = 1
flops = ccall((:ft_execute, libfasttransforms), Cint, (Ptr{Float64}, Ptr{Float64}, Ptr{ft_plan_struct}, Cint, Cint), x, y, p, C2L, 1)
return y
end

function *(p::FTPlan{T, 1, FMMLEG2CHEB}, x::AbstractArray{T}) where T
Ax = Array(x)
y = zero(Ax)
mul!(y, p, Ax)
end
function \(p::FTPlan{T, 1, FMMLEG2CHEB}, x::AbstractArray{T}) where T
Ax = Array(x)
y = zero(Ax)
div!(y, p, Ax)
x .= y
return x
end


struct AdjointFTPlan{T, S, R}
parent::S
adjoint::R
Expand Down

0 comments on commit a08c90a

Please sign in to comment.