SUBPAK\
A C++ Utility Library {#subpak-a-c-utility-library align=”center”}
=====================
SUBPAK is a C++ library which includes a number of utility routines.
Licensing: {#licensing align=”center”}
The computer code and data files described and made available on this
web page are distributed under the GNU LGPL
license.
Languages: {#languages align=”center”}
SUBPAK is available in a C version
and a C++ version and a FORTRAN77
version and a FORTRAN90
version and a MATLAB
version.
C4LIB, a C++ library which implements
certain elementary functions for “C4” or single precision complex
variables;
C8LIB, a C++ library which implements
certain elementary functions for “C8” or double precision complex
variables;
CELL, a C++ library which defines a cell
array, a generalization of an array which can compactly store and
retrieve vector or matrix data of varying size, such as the rows of a
triangular matrix.
I4LIB, a C++ library which contains
many utility routines, using “I4” or “single precision integer”
arithmetic.
I8LIB, a C++ library which contains
many utility routines, using “I8” or “double precision integer”
arithmetic.
INDEX, a C++ library which converts a
multidimensional vector index to a one-dimensional vector index; it can
handle zero and one based indexing schemes, as well as column major and
row major conventions.
R4LIB, a C++ library which contains
many utility routines, using “R4” or “single precision real” arithmetic.
R8LIB, a C++ library which contains
many utility routines, using “R8” or “double precision real” arithmetic.
Reference: {#reference align=”center”}
- Milton Abramowitz, Irene Stegun,\
Handbook of Mathematical Functions,\
National Bureau of Standards, 1964,\
ISBN: 0-486-61272-4,\
LC: QA47.A34.
- Book Industry Study Group,\
The Evolution in Product Identification: Sunrise 2005 and the
ISBN-13,\
http://www.bisg.org/docs/The_Evolution_in_Product_ID.pdf
- Thomas Cormen, Charles Leiserson, Ronald Rivest,\
Introduction to Algorithms,\
MIT Press, 2001,\
ISBN: 0262032937,\
LC: QA76.C662.
- Donald Kreher, Douglas Simpson,\
Combinatorial Algorithms,\
CRC Press, 1998,\
ISBN: 0-8493-3988-X,\
LC: QA164.K73.
- Albert Nijenhuis, Herbert Wilf,\
Combinatorial Algorithms for Computers and Calculators,\
Second Edition,\
Academic Press, 1978,\
ISBN: 0-12-519260-6,\
LC: QA164.N54.
- Branch Rickey,\
Goodby to Some Old Baseball Ideas,\
Life Magazine,\
2 August 1954.
- Alan Schwarz,\
Looking Beyond the Batting Average,\
The New York Times,\
Sunday, 1 August 2004.
- Daniel Zwillinger, editor,\
CRC Standard Mathematical Tables and Formulae,\
30th Edition,\
CRC Press, 1996,\
ISBN: 0-8493-2479-3,\
LC: QA47.M315.
Source Code: {#source-code align=”center”}
Examples and Tests: {#examples-and-tests align=”center”}
List of Routines: {#list-of-routines align=”center”}
- ANGLE_SHIFT shifts angle ALPHA to lie between BETA and
BETA+2PI.
- ANGLE_SHIFT_DEG shifts angle ALPHA to lie between BETA and
BETA+360.
- ANGLE_TO_RGB returns a color on the perimeter of the color
hexagon.
- AXIS_LIMITS returns “nice” axis limits for a plot.
- BAR_CHECK computes the check digit for a barcode.
- BAR_CODE constructs the 113 character barcode from 11 digits.
- BAR_DIGIT_CODE_LEFT returns the 7 character left bar code for
a digit.
- BAR_DIGIT_CODE_RIGHT returns the 7 character right bar code
for a digit.
- BMI_ENGLISH computes the body mass index given English
measurements.
- BMI_METRIC computes the body mass index given metric
measurements.
- C8_ARGUMENT returns the argument of a C8.
- C8_MAGNITUDE returns the magnitude of a C8.
- C8_SQRT returns the principal square root of a C8.
- CH_CAP capitalizes a single character.
- CH_EQI is true if two characters are equal, disregarding case.
- CH_IS_DIGIT returns TRUE if a character is a decimal digit.
- CH_TO_DIGIT returns the integer value of a base 10 digit.
- CHARSTAR_LEN_TRIM returns the length of a CHAR* to the last
nonblank.
- DEGREES_TO_RADIANS converts an angle measure from degrees to
radians.
- E_CONSTANT returns the value of E.
- EULER_CONSTANT returns the value of the Euler-Mascheroni
constant.
- FAC_DIV divides two quantities represented as prime factors.
- FAC_GCD finds the GCD of two products of prime factors.
- FAC_LCM finds the LCM of two products of prime factors.
- FAC_MUL multiplies two quantities represented as prime factors.
- FAC_PRINT prints a product of prime factors.
- FAC_TO_I4 converts a product of prime factors into an I4.
- FAC_TO_RAT converts a prime factorization into a rational
value.
- FEET_TO_METERS converts a measurement in feet to meters.
- GAUSS_SUM evaluates a function that is the sum of Gaussians.
- GET_SEED returns a random seed for the random number generator.
- GRID1 finds grid points between X1 and X2 in N dimensions.
- GRID1N finds the I-th grid point between X1 and X2 in N
dimensions.
- GRID2 computes grid points between X1 and X2 in N dimensions.
- GRID2N computes one grid point between X1 and X2 in N
dimensions.
- GRID3 computes a grid on the parallelogram set by X1, X2 and X3
in N space.
- GRID3N computes a parallelogram grid on 3 points in N
dimensions.
- GRID4 computes a grid on the parallelogram set by X1, X2 and X3
in N space.
- GRID4N computes a single point on a parallelogram grid in N
space.
- I2_REVERSE_BYTES reverses the two bytes in an I2.
- I4_LOG_10 returns the integer part of the logarithm base 10 of
an I4.
- I4_MAX returns the maximum of two I4’s.
- I4_MIN returns the minimum of two I4’s.
- I4_MODP returns the nonnegative remainder of I4 division.
- I4_POWER returns the value of I\^J.
- I4_SIGN returns the sign of an I4.
- I4_SWAP switches two I4’s.
- I4_TO_DIGITS_DECIMAL determines the last N decimal digits of
an I4.
- I4_TO_FAC converts an I4 into a product of prime factors.
- I4_TO_ISBN converts an I4 to an ISBN digit.
- I4_UNIFORM returns a scaled pseudorandom I4.
- I4INT_TO_R8INT maps an I4 interval to an R8 interval.
- I4VEC_COPY copies an I4VEC.
- I4VEC_INDICATOR_NEW sets an I4VEC to the indicator vector.
- I4VEC_MIN returns the value of the minimum element in an I4VEC.
- I4VEC_PERMUTE permutes an I4VEC in place.
- I4VEC_PRINT prints an I4VEC.
- I4VEC_SUM sums the entries of an I4VEC.
- I4VEC_ZERO zeroes an I4VEC.
- I4VEC_ZERO_NEW creates and zeroes an I4VEC.
- IJ_NEXT returns the next matrix index.
- IJ_NEXT_GT returns the next matrix index, with the constraint
that I < J.
- INDEX_BOX2_NEXT_2D produces indices on the surface of a box
in 2D.
- INDEX_BOX2_NEXT_3D produces indices on the surface of a box
in 3D.
- INDEX1_COL indexes a 1D vector by columns.
- INDEX1_ROW indexes a 1D vector by rows.
- INDEX2_COL indexes a 2D array by columns.
- INDEX2_ROW indexes a 2D array by row.
- INDEX3_COL indexes a 3D array by columns.
- INDEX3_ROW indexes a 3D array by rows.
- INDEX4_COL indexes a 4D array by columns.
- INDEX4_ROW indexes a 4D array by rows.
- INDEXN_COL indexes an ND array by columns.
- INDEXN_ROW indexes an ND array by rows.
- ISBN_CHECK checks an ISBN code.
- ISBN_FILL fills in a missing digit in an ISBN code.
- ISBN_TO_I4 converts an ISBN character into an I4.
- ISET2_COMPARE compares two I2 sets.
- LCM_12N computes the least common multiple of the integers 1
through N.
- LMAT_PRINT prints an LMAT.
- LMAT_PRINT_SOME prints some of an LMAT.
- LMAT_TRANSPOSE_PRINT prints an LMAT, transposed.
- LMAT_TRANSPOSE_PRINT_SOME prints some of an LMAT, transposed.
- LUHN_CHECK computes the Luhn checksum for a string of digits.
- LVEC_PRINT prints a logical vector.
- PAUSE_INPUT waits until an input character is entered.
- PAUSE_SECONDS waits a specified number of seconds.
- PERM_CHECK checks that a vector represents a permutation.
- PERM_CYCLE analyzes a permutation.
- PERM_FREE reports the number of unused items in a partial
permutation.
- PERM_INVERSE inverts a permutation “in place”.
- PERM_PRINT prints a permutation.
- PERM_UNIFORM_NEW selects a random permutation of N objects.
- POUNDS_TO_KILOGRAMS converts a measurement in pounds to
kilograms.
- PRIME returns any of the first PRIME_MAX prime numbers.
- PRIME_GE returns the smallest prime greater than or equal to N.
- R4_NINT returns the nearest integer to an R4.
- R8_ABS returns the absolute value of an R8.
- R8_HUGE returns a “huge” R8.
- R8_LOG_10 returns the logarithm base 10 of the absolute value
of an R8.
- R8_MAX returns the maximum of two R8’s.
- R8_MODP returns the nonnegative remainder of R8 division.
- R8_UNIFORM returns a scaled pseudorandom R8.
- R8_UNIFORM_01 returns a unit pseudorandom R8.
- R8MAT_PRINT prints an R8MAT.
- R8MAT_PRINT_SOME prints some of an R8MAT.
- R8MAT_TRANSPOSE_PRINT prints an R8MAT, transposed.
- R8MAT_TRANSPOSE_PRINT_SOME prints some of an R8MAT,
transposed.
- R8POLY_DEGREE returns the degree of a polynomial.
- R8POLY_PRINT prints out a polynomial.
- R8VEC_INDICATOR_NEW sets an R8VEC to the indicator vector
{1,2,3…}.
- R8VEC_MAX returns the value of the maximum element in an R8VEC.
- R8VEC_MEAN returns the mean of an R8VEC.
- R8VEC_MIN returns the value of the minimum element in an R8VEC.
- R8VEC_PRINT prints an R8VEC.
- R8VEC_VARIANCE returns the variance of an R8VEC.
- R8VEC_ZERO_NEW creates and zeroes an R8VEC.
- RADIANS_TO_DEGREES converts an angle from radians to degrees.
- RAND_INITIALIZE initializes the random number generator.
- RANDOM_INITIALIZE initializes the RANDOM random number
generator.
- RAT_FACTOR factors a rational value into a product of prime
factors.
- RICKEY evaluates Branch Rickey’s baseball index.
- ROOTS_TO_I4POLY converts polynomial roots to polynomial
coefficients.
- ROOTS_TO_R8POLY converts polynomial roots to polynomial
coefficients.
- S_EQI reports whether two strings are equal, ignoring case.
- S_LEN_TRIM returns the length of a string to the last
nonblank.
- S_TO_I4 reads an integer value from a string.
- S_TO_I4VEC reads an I4VEC from a string.
- S_TO_R8 reads an R8 from a string.
- S_TO_R8VEC reads an R8VEC from a string.
- SORT_HEAP_EXTERNAL externally sorts a list of items into
ascending order.
- TIMESTAMP prints the current YMDHMS date as a time stamp.
- TUPLE_NEXT2 computes the next element of an integer tuple
space.
- TVEC_EVEN computes an evenly spaced set of angles between 0 and
2*PI.
- TVEC_EVEN2 computes evenly spaced angles between 0 and 2*PI.
- TVEC_EVEN3 computes an evenly spaced set of angles between 0
and 2*PI.
- TVEC_EVEN_BRACKET computes evenly spaced angles between THETA1
and THETA2.
- TVEC_EVEN_BRACKET2 computes evenly spaced angles from THETA1
to THETA2.
- TVEC_EVEN_BRACKET3 computes evenly spaced angles from THETA1
to THETA2.
- UPC_CHECK_DIGIT returns the check digit of a UPC.
- VERSINE_PULSE adds a versine pulse to a constant.
You can go up one level to the C++ source codes.
Last revised on 03 November 2011.