File Exchange

image thumbnail

hypergeomq

version 1.1.0.0 (7.56 KB) by Andrew Horchler
Fast evaluation of the generalized hypergeometric function

7 Downloads

Updated 12 Apr 2017

From GitHub

View license on GitHub

Fast evaluation of the generalized hypergeometric function.

hypergeomq(N,D,Z) evaluates the generalized hypergeometric function for the vector parameters N and D at the values in the array Z. N, D, and Z can be any numeric or logical datatype and may be complex. The output will have the same dimensions as Z and will be double-precision unless Z is single-precision, in which case, the output will be as well.

hypergeomq uses the same low-level function as hypergeom, but implements several optimizations to achieve a performance boost of approximately an order of magnitude. Results from the two functions should agree to the precision of the inputs. Additionaly, hypergeomq can avoid some errors due to singularities that can occur when hypergeom is evaluated with numeric Z values.

Cite As

Andrew Horchler (2021). hypergeomq (https://github.com/horchler/hypergeomq), GitHub. Retrieved .

Comments and Ratings (4)

Andrew Horchler

@Federico Maddanu: Sounds like your optimization may be resulting in either Inf or NaN outputs possibly due to divide by zero). These are not valid inputs to the hypergeom2F1 function. Other than trying to avoid such singularities, you might be able to work around this issues by creating a wrapper function around hypergeom2F1 that only call hypergeom2F1 if isfinite(z) is true and otherwise just returns NaN or Inf. Or edit my source code.

Federico Maddanu

Dear Andrew,
thank you for your work, is very faster than the Mtalab hypergeom.
However, insert hypergeom2F1 in a function, and than minimizing this function via fminunc I often find the error:
" Z must be a finite floating-point array."
Wy that?

Christian Iandiorio

Da

Thank you for the work

MATLAB Release Compatibility
Created with R2015b
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!