Skip to content

Commit

Permalink
Fix pochhammer for a vector of n
Browse files Browse the repository at this point in the history
  • Loading branch information
jishnub committed Jun 9, 2024
1 parent 9dead75 commit 3b7996c
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "FastTransforms"
uuid = "057dd010-8810-581a-b7be-e3fc3b93f78c"
version = "0.16.2"
version = "0.16.3"

[deps]
AbstractFFTs = "621f4979-c628-5d54-868e-fcf4e3e8185c"
Expand Down
2 changes: 1 addition & 1 deletion src/specialfunctions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ end
pochhammer(x::Number,n::Number) = isinteger(n) ? pochhammer(x,Int(n)) : ogamma(x)/ogamma(x+n)

function pochhammer(x::Number,n::UnitRange{T}) where T<:Real
ret = Vector{promote_type(typeof(x),T)}(length(n))
ret = Vector{promote_type(typeof(x),T)}(undef,length(n))
ret[1] = pochhammer(x,first(n))
for i=2:length(n)
ret[i] = (x+n[i]-1)*ret[i-1]
Expand Down
2 changes: 2 additions & 0 deletions test/specialfunctionstests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ import FastTransforms: chebyshevmoments1, chebyshevmoments2, chebyshevjacobimome
@test pochhammer(1.1,2.2) gamma(3.3)/gamma(1.1)
@test pochhammer(-2,1) == pochhammer(-2,1.0) == pochhammer(-2.0,1) == -2

@test pochhammer(2,0:5) == [pochhammer(2,i) for i in 0:5]

n = 0:1000
λ = 0.125
@test norm(Cnλ.(n, λ) ./ Cnλ.(n, big(λ)) .- 1, Inf) < 3eps()
Expand Down

0 comments on commit 3b7996c

Please sign in to comment.