Skip to content

Commit

Permalink
Merge pull request #2 from nathaniel/hotfix/resolve-routines
Browse files Browse the repository at this point in the history
Fix function resolving in IDL
  • Loading branch information
hainest committed Jan 24, 2018
2 parents 516d172 + 3f4477e commit 5eb2122
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 22 deletions.
16 changes: 8 additions & 8 deletions IDL/bdtri.pro
Expand Up @@ -64,6 +64,13 @@
; IBETA - IDL >4.0
; BISECTION - IDL >4.0

function incbi, x
compile_opt idl2, hidden
common incbi_parms, a, b, p

return, ibeta(b-a, a+1, x) - p
end

function bdtri, k, n, y
compile_opt idl2

Expand All @@ -88,17 +95,10 @@ function bdtri, k, n, y
message, 'bdtri domain error: y must be in the interval [0,1]'
endif

common incbi_parms, a, b, p
common incbi_parms
a = k
b = n
p = y

return, 1 - bisection(0.5, 'incbi', itmax=200, radius=0.5, tol=1e-7)
end

function incbi, x
compile_opt idl2, hidden
common incbi_parms

return, ibeta(b-a, a+1, x) - p
end
3 changes: 0 additions & 3 deletions IDL/binomial_limits.pro
Expand Up @@ -76,9 +76,6 @@
; BDTRI - IDL >5.3

function binomial_limits, nsuccess, ntotal, cl, sigma=sigma
; Resolve the 'incbi' routine in bdtri.pro so that 'bisection'
; can find it with call_function
resolve_routine, 'bdtri', /is_function

; Set CL = 1 sigma by default
if ~keyword_set(cl) then begin
Expand Down
16 changes: 8 additions & 8 deletions IDL/pdtri.pro
Expand Up @@ -67,6 +67,13 @@
; IGAMMA - IDL >4.0
; BISECTION - IDL >4.0

function igami, x
compile_opt idl2, hidden
common igami_parms, a, p

return, 1 - igamma(a+1, x, /double) - p
end

function pdtri, k, y
; check the domain
if k lt 0 then begin
Expand All @@ -81,7 +88,7 @@ function pdtri, k, y
message, 'pdtri domain error: y must be in the interval [0, 1)'
endif

common igami_parms, a, p
common igami_parms
a = k
p = y

Expand All @@ -92,10 +99,3 @@ function pdtri, k, y

return, bisection(x0, 'igami', itmax=200, radius=x0, tol=1e-7)
end

function igami, x
compile_opt idl2, hidden
common igami_parms

return, 1 - igamma(a+1, x, /double) - p
end
3 changes: 0 additions & 3 deletions IDL/poisson_limits.pro
Expand Up @@ -72,9 +72,6 @@
; PDTRI - IDL >5.3

function poisson_limits, k, cl, sigma=sigma
; Resolve the 'igami' routine in pdtri.pro so that 'bisection'
; can find it with call_function
resolve_routine, 'pdtri', /is_function

; Set CL = 1 sigma by default
if ~keyword_set(cl) then begin
Expand Down

0 comments on commit 5eb2122

Please sign in to comment.