Rfast (version 1.7.3)

Natural logarithm of the gamma function and its derivatives: Sorting of the columns of a matrix

Description

Natural logarithm of the gamma function and its derivatives.

Usage

Lgamma(x) Digamma(x) Trigamma(x)

Arguments

x
A numerical matrix or vector with positive numbers in either case.

Value

The matrix or the vector with the resulting values.

References

Abramowitz, M. and Stegun, I. A. (1972) Handbook of Mathematical Functions. New York: Dover. https://en.wikipedia.org/wiki/Abramowitz_and_Stegun provides links to the full text which is in public domain. Chapter 6: Gamma and Related Functions.

See Also

beta.mle, diri.nr2

Examples

Run this code
x <- matrix( rnorm(1000 * 500), ncol = 500 )
system.time( a1 <- Lgamma(x) )
system.time( a2 <- lgamma(x) )
all.equal(as.vector(a1), as.vector(a2))

system.time( a1 <- Digamma(x) )
system.time( a2 <- digamma(x) )
all.equal(as.vector(a1), as.vector(a2))

system.time( a1 <- Trigamma(x) )
system.time( a2 <- trigamma(x) )
all.equal(as.vector(a1), as.vector(a2))

Run the code above in your browser using DataLab