SUBPAKC - A C Utility Library
SUBPAKC is a collection of C utility routines for
a variety of tasks, including the greatest common divisor of two
integers, searching, sorting, range, and unique elements of vectors,
determinants and inverses of small matrices, and all the primes
less than 10,000.
SUBPAKC is a C version of a subset of the
FORTRAN SUBPAK collection.
Files you may copy include:
The list of routines includes:
-
ACOSH2 returns the arc hyperbolic cosine of a given value;
-
AGUD evaluates the inverse Gudermannian function.
-
ASINH2 returns the arc hyperbolic sine of a given value;
-
ATAN4 computes the arc-tangent of Y / X.
-
ATANH2 returns the inverse hyperbolic tangent of a number.
-
COT returns the cotangent of an angle given in radians.
-
COTD returns the cotangent of an angle given in degrees.
-
CROSS_3D computes the cross product of two vectors in 3D.
-
DOT_2D computes the dot product of two vectors in 2D.
-
DOT_3D computes the dot product of two vectors in 3D.
-
DOT0_3D computes the dot product of (P1-P0) and (P2-P0) in 3D.
-
FLOAT_REVERSE_BYTES reverses the bytes in a float.
-
GET_SEED returns a random seed for the random number generator.
-
GUD evaluates the Gudermannian function.
-
HEXCOL returns a color on the perimeter of the color hexagon.
-
I_GCF finds the greatest common factor of I and J.
-
I_LCM computes the least common multiple of two integers.
-
I_MAX returns the maximum of two integers.
-
I_MIN returns the smaller of two integers.
-
I_MODP returns the nonnegative remainder of integer division.
-
I_RANDOM returns a random int in a given range.
-
I_SWAP switches two integer values.
-
I_TO_R maps integer IX in [IXMIN, IXMAX] to real X in [XMIN, XMAX].
-
IVEC_AMAX returns the largest magnitude in an integer vector.
-
IVEC_AMIN returns the smallest magnitude in an integer vector.
-
IVEC_AMINZ returns the smallest nonzero magnitude in an integer vector.
-
IVEC_AXPY adds IA times the vector IX to the vector IY.
-
IVEC_BRACKET searches a sorted array for successive brackets of a value.
-
IVEC_COMPARE compares two integer vectors.
-
IVEC_HEAP reorders an array of ints into a heap.
-
IVEC_MAX returns the value of the maximum element in an integer array.
-
IVEC_MEAN returns the mean of an integer array.
-
IVEC_MIN returns the value of the minimum element in an integer array.
-
IVEC_PART partitions an integer NVAL into N nearly equal parts.
-
IVEC_PART_QUICK reorders the entries of A as part of a quick sort.
-
IVEC_RED divides out common factors in a vector.
-
IVEC_REVERSE reverses the elements of an integer vector.
-
IVEC_ROTATE rotates an object in place.
-
IVEC_SEARCH searches the sorted vector A for the value B.
-
IVEC_SET sets the values of an integer vector to a given value.
-
IVEC_SORT_BUBBLE sorts an integer array using bubble sort.
-
IVEC_SORT_HEAP sorts an array of ints using heap sort.
-
IVEC_SORT_INSERTION sorts an integer vector using an insertion sort.
-
IVEC_SORT_QUICK sorts an integer vector using a quick sort.
-
IVEC_SUM sums the entries of an integer vector.
-
IVEC_SWAP swaps the entries of two integer vectors.
-
IVEC_UNIQ3 computes a histogram of the unique elements of a sorted vector.
-
IVEC_VARIANCE returns the variance of an integer array.
-
LONG_INT_REVERSE_BYTES reverses the bytes in a long int.
-
NORMAL_01_SAMPLE samples the standard normal PDF.
-
PARABOLA_EX finds the extremal point of a parabola from three data points.
-
PARABOLA_EX2 finds the extremal point of a parabola from three data points.
-
PARABOLA_VAL evaluates a parabola defined by three data values.
-
PARABOLA_VAL2 evaluates a parabolic function through 3 points in a table.
-
PAUSE_INPUT waits until an input character is entered.
-
PAUSE_SECONDS waits a specified number of seconds.
-
PERM_RANDOM selects a random permutation of N objects.
-
POLY_LAGRANGE_COEF returns the coefficients of a Lagrange polynomial.
-
POLY_LAGRANGE_FACTOR evaluates the polynomial Lagrange factor at a point.
-
POLY_LAGRANGE_VAL evaluates the IPOL-th Lagrange polynomial.
-
QUAT_CONJ conjugates a quaternion.
-
QUAT_INV inverts a quaternion.
-
QUAT_MUL multiplies two quaternions.
-
R_MAX returns the maximum of two real values.
-
R_PYTHAG computes sqrt ( A**2 + B**2 ), avoiding overflow and underflow.
-
R_RANDOM returns a random floating point value in [RLO,RHI].
-
R_SIGN returns the first argument with the sign of the second.
-
R_SQUARED squares a real value.
-
R_SWAP switches two real values.
-
R_TO_I maps real X in [XMIN, XMAX] to integer IX in [IXMIN, IXMAX].
-
RMAT2_DET computes the determinant of a 2 by 2 matrix.
-
RMAT2_INVERSE computes the inverse of a 2 by 2 matrix.
-
RMAT3_DET computes the determinant of a 3 by 3 matrix.
-
RMAT3_INVERSE computes the inverse of a 3 by 3 matrix.
-
RMAT4_DET computes the determinant of a 4 by 4 matrix.
-
RMAT4_INVERSE computes the inverse of a 4 by 4 matrix.
-
RMAT5_DET computes the determinant of a 5 by 5 matrix.
-
RVEC_BRACKET searches a sorted array for successive brackets of a value.
-
RVEC_BRACKET3 finds the interval containing or nearest a given value.
-
RVEC_HEAP reorders an array of reals into a heap.
-
RVEC_MAX returns the value of the maximum element in a real array.
-
RVEC_MEAN returns the mean of a real array.
-
RVEC_MIN returns the value of the minimum element in a real array.
-
RVEC_ORDER_TYPE determines if an array is (non)strictly ascending/descending.
-
RVEC_PART_QUICK reorders the entries of A as part of a quick sort.
-
RVEC_SORT_BUBBLE sorts a real array using bubble sort.
-
RVEC_SORT_HEAP sorts a real array using heap sort.
-
RVEC_SORT_INSERTION sorts a real vector using an insertion sort.
-
RVEC_SORT_QUICK sorts a real vector using a quick sort.
-
RVEC_UNIQ3 reports the number of occurrences of the unique items in an array.
-
RVEC_VARIANCE returns the variance of a real array.
-
RXEVEN returns the I-th of N evenly spaced values in [ XLO, XHI ].
-
SHORT_INT_REVERSE_BYTES reverses the bytes in a short int.
-
SORT_HEAP_EXTERNAL externally sorts a list of items into linear order.
-
UNIFORM_01_SAMPLE is a uniform random number generator.
-
VTRIPLE computes the vector triple product of three vectors.
-
UNIFORM_01_SAMPLE is a uniform random number generator.
Back to the C software page.
Last revised on 16 January 2002.