7VIMUPV7XRRR3NTHQBBAFKUGI3Y23PSCOEY4CXQ3DVFKC2ACHN5AC cmaybe(::Type{T}, x::Maybe) where {T} = x === nothing ? Ptr{T}() : Ref{T}(x)function cmayberef(::Type{T}, x::Maybe{Ref{T}}) where {T}return x === nothing ? Ptr{T}() : (x::Ref{T})end
# For optional argumentscmaybe(::Type{T}, x::Maybe{T}) where {T} = x === nothing ? Ptr{T}() : Ref{T}(x)
export $opfunction $op(lmax::Union{Cint,Int}, z::Union{Cdouble,Float64,Int};csphase::Maybe{Int}=nothing, cnorm::Maybe{Int}=nothing,exitstatus::Maybe{Ref{Int}}=nothing)p = Array{Cdouble}(undef, (lmax + 1) * (lmax + 2) ÷ 2)
export $op!function $op!(p::AbstractVector{Cdouble}, lmax::Integer,z::Union{AbstractFloat,Integer};csphase::Maybe{Integer}=nothing,cnorm::Maybe{Integer}=nothing,exitstatus::Maybe{Ref{<:Integer}}=nothing)@assert length(p) ≥ (lmax + 1) * (lmax + 2) ÷ 2exitstatus′ = 0
export $op_d1function $op_d1(lmax::Union{Cint,Int}, z::Union{Cdouble,Float64,Int};csphase::Maybe{Int}=nothing, cnorm::Maybe{Int}=nothing,exitstatus::Maybe{Ref{Int}}=nothing)
export $opfunction $op(lmax::Integer, z::Union{AbstractFloat,Integer};csphase::Maybe{Integer}=nothing,cnorm::Maybe{Integer}=nothing,exitstatus::Maybe{Ref{<:Integer}}=nothing)
dp = Array{Cdouble}(undef, (lmax + 1) * (lmax + 2) ÷ 2)
$op!(p, lmax, z; csphase=csphase, cnorm=cnorm,exitstatus=exitstatus)return pend#export $op_d1!function $op_d1!(p::AbstractVector{Cdouble},dp::AbstractVector{Cdouble}, lmax::Integer,z::Union{AbstractVector,Integer};csphase::Maybe{Integer}=nothing,cnorm::Maybe{Integer}=nothing,exitstatus::Maybe{Ref{<:Integer}}=nothing)@assert length(p) ≥ lmax + 1@assert length(dp) ≥ lmax + 1exitstatus′ = 0
cmaybe(Cint, cnorm), cmayberef(Cint, exitstatus))
cmaybe(Cint, cnorm), exitstatus′)if exitstatus === nothingexitstatus′ ≠ 0 && error("$($op_d1!): Error code $exitstatus′")elseexitstatus[] = exitstatus′endreturn p, dpend#export $op_d1function $op_d1(lmax::Integer, z::Union{AbstractFloat,Integer};csphase::Maybe{Integer}=nothing,cnorm::Maybe{Integer}=nothing,exitstatus::Maybe{Ref{<:Integer}}=nothing)p = Array{Cdouble}(undef, (lmax + 1) * (lmax + 2) ÷ 2)dp = Array{Cdouble}(undef, (lmax + 1) * (lmax + 2) ÷ 2)$op_d1!(p, dp, lmax, z; csphase=csphase, cnorm=cnorm,exitstatus=exitstatus)
export $opfunction $op(lmax::Union{Cint,Int}, z::Union{Cdouble,Float64,Int};exitstatus::Maybe{Ref{Int}}=nothing)p = Array{Cdouble}(undef, (lmax + 1) * (lmax + 2) ÷ 2)
export $op!function $op!(p::AbstractVector{Cdouble}, lmax::Integer,z::Union{AbstractFloat,Integer};exitstatus::Maybe{Ref{<:Integer}}=nothing)@assert length(p) ≥ lmax + 1exitstatus′ = 0
export $op_d1function $op_d1(lmax::Union{Cint,Int}, z::Union{Cdouble,Float64,Int};exitstatus::Maybe{Ref{Int}}=nothing)p = Array{Cdouble}(undef, (lmax + 1) * (lmax + 2) ÷ 2)dp = Array{Cdouble}(undef, (lmax + 1) * (lmax + 2) ÷ 2)
export $opfunction $op(lmax::Integer, z::Union{AbstractFloat,Integer};exitstatus::Maybe{Ref{<:Integer}}=nothing)p = Array{Cdouble}(undef, lmax + 1)$op!(p, lmax, z; exitstatus=exitstatus)return pend#export $op_d1!function $op_d1!(p::AbstractVector{Cdouble},dp::AbstractVector{Cdouble}, lmax::Integer,z::Union{AbstractFloat,Integer};exitstatus::Maybe{Ref{<:Integer}}=nothing)@assert length(p) ≥ lmax + 1@assert length(dp) ≥ lmax + 1exitstatus′ = 0
lmax, z, cmayberef(Cint, exitstatus))
lmax, z, exitstatus′)if exitstatus === nothingexitstatus′ ≠ 0 && error("$($op_d1!): Error code $exitstatus′")elseexitstatus[] = exitstatus′endreturn p, dpend#export $op_d1function $op_d1(lmax::Integer, z::Union{AbstractFloat,Integer};exitstatus::Maybe{Ref{<:Integer}}=nothing)p = Array{Cdouble}(undef, lmax + 1)dp = Array{Cdouble}(undef, lmax + 1)$op_d1!(p, dp, lmax, z; exitstatus=exitstatus)
p = PlmBar(4, 0)p, dp = PlmBar_d1(4, 0)p = PlBar(4, 0)p, dp = PlBar_d1(4, 0)
p, dp = PlmBar_d1(4, 0)dp′ = zeros(15)PlmBar_d1!(p′, dp′, 4, 0)@test p′ == p@test dp′ == dpp = PlBar(4, 0)p′ = zeros(5)PlBar!(p′, 4, 0)@test p′ == pp, dp = PlBar_d1(4, 0)dp′ = zeros(5)PlBar_d1!(p′, dp′, 4, 0)@test p′ == p@test dp′ == dpend
index = PlmIndex(4, 3)@test index == 14
p, dp = PlON_d1(4, 0)dp′ = zeros(5)PlON_d1!(p′, dp′, 4, 0)@test p′ == p@test dp′ == dpend@testset "PlmSchmidt" beginp = PlmSchmidt(4, 0)p′ = zeros(15)PlmSchmidt!(p′, 4, 0)@test p′ == pp, dp = PlmSchmidt_d1(4, 0)dp′ = zeros(15)PlmSchmidt_d1!(p′, dp′, 4, 0)@test p′ == p@test dp′ == dpp = PlSchmidt(4, 0)p′ = zeros(5)PlSchmidt!(p′, 4, 0)@test p′ == pp, dp = PlSchmidt_d1(4, 0)dp′ = zeros(5)PlSchmidt_d1!(p′, dp′, 4, 0)@test p′ == p@test dp′ == dpend@testset "PLegendreA" beginp = PLegendreA(4, 0)p′ = zeros(15)PLegendreA!(p′, 4, 0)@test p′ == pp, dp = PLegendreA_d1(4, 0)dp′ = zeros(15)PLegendreA_d1!(p′, dp′, 4, 0)@test p′ == p@test dp′ == dpp = PLegendre(4, 0)p′ = zeros(5)PLegendre!(p′, 4, 0)@test p′ == pp, dp = PLegendre_d1(4, 0)dp′ = zeros(5)PLegendre_d1!(p′, dp′, 4, 0)@test p′ == p@test dp′ == dpend@testset "PlmIndex" beginindex = PlmIndex(4, 3)@test index == 14end