Skip to main content
U.S. flag

An official website of the United States government

Official websites use .gov
A .gov website belongs to an official government organization in the United States.

Secure .gov websites use HTTPS
A lock ( ) or https:// means you’ve safely connected to the .gov website. Share sensitive information only on official, secure websites.

STSPAC Charlie Reeve Subroutines

Introduction             Charlie Reeve wrote the subroutines available here while he was a staff member in the Statistical Engineering Division (SED). Although these routines were intended for his personal use rather than as a publically distributable library, we are providing them because they contain some routines not readily available elsewhere. In particular, it contains routines for computing the cumulative distribution function and generating random numbers for the doubly non-central F and doubly non-central t distributions (these routines are used by the Dataplot program).

This software is not formally supported and is not being further developed. It is provided on an "as is" basis.  There is no formal documentation for the subroutines.  However, most of the subroutines contain usage instructions in the comments in the source code.  

Publications             Although there is no formal documentation for these subroutines, Charlie Reeve wrote a number of SED Notes that document some of the algorithms coded in this library. The NIST library has graciously scanned these documents and converted them to PDF documents. These documents were scanned from personal copies, so some of them contain external markings. We apologize for this.
Contents            

The following subroutines and functions are available: 

  • FUNCTION ANORMI - Infinity norm of NxN matrix
  • SUBROUTINE BARTLT - Bartlett's test for homogeneity of variances
  • SUBROUTINE CDFBET - Compute the beta cumulative distribution function
  • SUBROUTINE CDFDNF - Compute the doubly non-central F cumulative distribution function
  • SUBROUTINE CDFDNT - Compute the doubly non-central t cumulative distribution function
  • SUBROUTINE CDFF - Compute the F cumulative distribution function
  • SUBROUTINE CDFGAM - Compute the gamma cumulative distribution function
  • SUBROUTINE CDFNOR - Compute the normal cumulative distribution function
  • SUBROUTINE CDFT - Compute the t cumulative distribution function
  • SUBROUTINE CENSCL - Compute estimates of location and scale
  • SUBROUTINE CIELIP - Compute inverse prediction for a linear fit (Eisenhart method)
  • FUNCTION DGAMLN - Compute the log gamma function
  • FUNCTION DNCMLN - Compute natural logarithm of "N choose M", N!/[M!(N-M)!]
  • FUNCTION DPR1LN - Compute natural logarithm of: N1!/[M1!(N1-M1)!]N2!/[M2!(N2-M2)!]
    ----------------------------------
    (N1+N2)!/[(M1+M2)!(N1+N2-M1-M2)!]
  • SUBROUTINE DWESD - Compute the expected value and variance of the Durbin-Watson statistic
  • SUBROUTINE ELLPTS - Compute N regularly spaced points on the perimeter of an ellipse
  • SUBROUTINE FACTOR - Find the prime factors of the absolute value of N (N an integer of 10 digits or less)
  • SUBROUTINE FIBMIN - Compute the minimum of a univariate FUNCTION within an interval using Fibonacci search algorithm
  • FUNCTION IGCD - Compute the greatest common divisor of two integers
  • FUNCTION IGCDM - Compute the greatest common divisor of the integers in a matrix
  • FUNCTION IGCDV - Compute the greatest common divisor of the integers in a vector
  • SUBROUTINE LINSYS - Solve an NxN system of linear equations (LU decomposition)
  • SUBROUTINE LISYPD - Solve an NxN system of linear equations where the matrix is symmetric and positive definite (Cholesky factorization)
  • SUBROUTINE LSQSVD - Solve linear least squares equations using singular value factorization
  • SUBROUTINE LSTSQR - Solve linear unweighted least squares problem
  • SUBROUTINE MAD - Compute median absolute deviation
  • SUBROUTINE MATCNO - Compute the condition number of an NxN matrix
  • SUBROUTINE MATHDI - Compute the diagonal of the hat matrix
  • SUBROUTINE MATINV - Compute the inverse of a matrix
  • SUBROUTINE MATIPD - Compute the inverse of a symmetric positive definite matrix
  • SUBROUTINE MATMPI - Compute the Moore-Penrose psuedo-inverse of an NxM matrix (N > M)
  • SUBROUTINE MATXXI - Compute the inverse and determinant of X'X where X is an NxM (N > M) matrix
  • SUBROUTINE MEANSD - Compute the mean and standard deviation
  • SUBROUTINE MEDIAN - Compute the median
  • SUBROUTINE MINMAX - Compute the minimum and maximum
  • SUBROUTINE NEXPER - Compute the next permutation of the integers 1, 2, ..., N
  • SUBROUTINE PERMAN - Compute the permanent of an NxN matrix
  • SUBROUTINE PLOTCR - Generate a line printer plot of Y vs X
  • SUBROUTINE PPFBET - Compute the inverse cumulative distribution FUNCTION of the beta distribution
  • SUBROUTINE QDASIM - Numerical integration using adaptive Simpson's rule
  • SUBROUTINE QDTANH - Numerical integration using the TANH rule
  • FUNCTION QDTRAP - Numerical integration using the trapezoidal rule
  • SUBROUTINE QSMNMX - Find the minimum and maximum values of a quadratic surface
  • FUNCTION RDBETA - Generate a beta random number
  • FUNCTION RDCHI2 - Generate a chi-square random number
  • SUBROUTINE RDCONS - Generate uniformly-space psuedo-random points on the surface of a cone
  • SUBROUTINE RDCONV - Generate uniformly-space psuedo-random points within a cone
  • SUBROUTINE RDCYLS - Generate uniformly-space psuedo-random points on the surface of a cylinder
  • SUBROUTINE RDCYLV - Generate uniformly-space psuedo-random points within a cylinder
  • SUBROUTINE RDELLS - Generate uniformly-spaced psuedo-random points on the surface of an ellipse
  • SUBROUTINE RDELLV - Generate uniformly-spaced psuedo-random points within an ellipse
  • FUNCTION RDF - Generate a F random number
  • FUNCTION RDGAMM - Generate a gamma random number
  • SUBROUTINE RDHLX - Generate uniformly-spaced psuedo-random points on a helix in three-dimensional space
  • SUBROUTINE RDMNOR - Generate multivariate random numbers
  • FUNCTION RDNF - Generate doubly non-central F random numbers
  • FUNCTION RDNOR - Generate a normal random number
  • FUNCTION RDNOR3 - Generate a normal random number (polar method)
  • SUBROUTINE RDRECS - Generate uniformly-spaced psuedo-random points on the surface of at three-dimensional rectangle
  • SUBROUTINE RDRECV - Generate uniformly-spaced psuedo-random points within a three-dimensional rectangle
  • SUBROUTINE RDSPSH - Generate uniformly-spaced psuedo-random points in a region between the surfaces of two spheres
  • FUNCTION RDT - Generate a t random number
  • SUBROUTINE RDTORS - Generate uniformly-spaced psuedo-random points on the surface of a torus
  • SUBROUTINE RDTORV - Generate uniformly-spaced psuedo-random points within a torus
  • FUNCTION RDUNI - Generate a uniform random number (lagged Fibonacci generator)
  • FUNCTION RDUNLL - Generate a uniform random number (congruential generator)
  • FUNCTION RDUNWH - Generate a uniform random number (Wichman-Hill generator)
  • SUBROUTINE REJ1 - Compute mean and standard deviation of normal data that may be" contaminated"
  • SUBROUTINE SKEKUR - Compute skewness and kurtosis
  • SUBROUTINE SORT1 - Sort a data vector
  • SUBROUTINE SORT2 - Sort a data vector and "carry along" a second vector
  • SUBROUTINE TRISYS - Solve a tridiagonal system of equations
  • SUBROUTINE UPDATE - Compute mean and standard deviation using an "update" algorithm
  • SUBROUTINE ZEROBR - Find the zero of a univariate function using Brent's method
Download the Fortran Source Code             You can download the Fortran source code.

The source code is written in standard Fortran 77. It  should be portable to systems that support 32-bit (or higher) Fortran 77 compilers. These routines were originally written for the 60-bit CDC Fortran compiler, so you may need to convert some routines to double precision to maintain sufficient accuracy.     

A few of these routines make calls to the LINPACK library.  The LINPACK routines are not included (LINPACK is freely downloadable).  

Created July 25, 2012, Updated June 2, 2021