SUBPAK
A Utility Library
SUBPAK,
a MATLAB library which
contains a number of utilities.
Licensing:
The computer code and data files described and made available on this web page
are distributed under
the GNU LGPL license.
Languages:
SUBPAK is available in
a C version and
a C++ version and
a FORTRAN90 version and
a MATLAB version.
Related Programs:
C8LIB,
a MATLAB library which
implements certain elementary functions for "C8"
or double precision complex variables;
CELL,
a MATLAB 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 MATLAB library which
contains many utility routines, using "I4" or "single precision integer"
arithmetic.
INDEX,
a MATLAB library which
converts a multidimensional vector index to a onedimensional vector index;
it can handle zero and one based indexing schemes, as well as column major
and row major conventions.
R8LIB,
a MATLAB library which
contains many utility routines, using "R8" or
"double precision real" arithmetic.
subpak_test
Reference:

Milton Abramowitz, Irene Stegun,
Handbook of Mathematical Functions,
National Bureau of Standards, 1964,
ISBN: 0486612724,
LC: QA47.A34.

Book Industry Study Group,
The Evolution in Product Identification:
Sunrise 2005 and the ISBN13,
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: 084933988X,
LC: QA164.K73.

Albert Nijenhuis, Herbert Wilf,
Combinatorial Algorithms for Computers and Calculators,
Second Edition,
Academic Press, 1978,
ISBN: 0125192606,
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: 0849324793,
LC: QA47.M315.
Source Code:

angle_shift.m,
shifts an angle to lie between BETA and BETA+2*PI.

angle_shift_deg.m,
shifts an angle to lie between BETA and BETA+360.

angle_to_rgb.m,
converts an angle to a color on the RGB hexagon.

axis_limits.m,
returns "nice" axis limits for a plot.

bar_check.m,
computes the check digit for a bar code.

bar_code.m,
constructs the 113 character bar code from 11 digits.

bar_digit_code_left.m,
returns the 7 character left bar code for a digit.

bar_digit_code_right.m,
returns the 7 character right bar code for a digit.

bmi_english.m,
computes the body mass index given English measurements.

bmi_metric.m,
computes the body mass index given metric measurements.

ch_cap.m,
capitalizes a single character;

ch_is_digit.m,
determines if a character is a digit.

ch_is_printable.m,
determines if a character is printable.

ch_swap.m,
swaps two characters;

ch_uniform.m,
returns a pseudorandom character.

chvec_permute.m,
permutes a character vector.

chvec_print.m,
prints a character vector.

chvec2_print.m,
prints a pair of character vectors.

chvec_reverse.m,
reverses the order of the entries of a character vector.

cos_deg.m
returns the cosine of an angle given in degrees.

degrees_to_radians.m,
converts an angle measure from degrees to radians;

e_constant.m,
returns the value of E.

euler_constant.m,
returns the value of the EulerMascheroni constant.

fac_div.m,
divides two quantities represented as prime factors.

fac_gcd.m,
finds the greatest common divisor of two quantities
represented as prime factors.

fac_lcm.m,
finds the least common multiple of two quantities
represented as prime factors.

fac_mul.m,
multiplies two quantities represented as prime factors.

fac_print.m,
prints a quantity represented as prime factors.

fac_to_i4.m,
converts a quantity represented as prime factors to an integer.

fac_to_rat.m,
converts a quantity represented as prime factors to a rational value.

feet_to_meters.m,
converts a measurement in feet to one in meters.

gauss_sum.m,
evaluates a function which is the sum of Gaussians.

get_seed.m,
returns a random seed for the random number generator.

grid1.m,
returns grid points between X1 and X2 in N dimensions.

grid1.m,
returns a grid point between X1 and X2 in N dimensions.

grid2.m,
returns grid points between X1 and X2 in N dimensions.

grid2n.m,
returns a grid point between X1 and X2 in N dimensions.

grid3.m,
returns an array of grid points between X1, X2 and X3 in N dimensions.

grid3n.m,
returns one of the grid points between X1, X2 and X3 in N dimensions.

grid4.m,
computes a grid on the parallelogram set by X1, X2 and X3 in N space.

grid4n.m,
computes on point from a grid on the parallelogram set
by X1, X2 and X3 in N space.

i2vec_print.m,
prints a vector of pairs of integers;

i3mat_flip_cols.m,
flips the columns in an I3MAT;

i3mat_flip_rows.m,
flips the rows in an I3MAT;

i4_log_10.m,
returns the integer part of the logarithm base 10 of an integer;

i4_modp.m,
returns the nonnegative remainder of integer division;

i4_sign.m,
returns the sign of an integer.

i4_to_digits_decimal.m,
determines the last N decimal digits of an integer;

i4_to_fac.m,
converts an integer into a product of prime factors;

i4_uniform_ab.m,
returns a pseudorandom integer in a given range;

i4int_to_r8int.m,
maps an I4 interval to an R8 interval;

i4vec_min.m,
returns the minimum entry in an I4VEC;

i4vec_permute.m,
permutes an I4VEC in place;

i4vec_print.m,
prints an I4VEC;

i4vec_uniform.m,
returns a pseudorandom I4VEC in a given range;

i8_btest.m,
returns TRUE if bit POS of I is a 1;

i8_xor.m,
returns the exclusive OR of two integers;

ij_next.m,
returns the next matrix index;

ij_next_gt.m,
returns the next matrix index, with the requirement that I < J;

index_box2_next_2d.m,
produces indices on the surface of a box in 2D.

index_box2_next_3d.m,
produces indices on the surface of a box in 3D.

index1_col.m,
indexes a 1D array by columns.

index1_row.m,
indexes a 1D array by rows.

index2_col.m,
indexes a 2D array by columns.

index2_row.m,
indexes a 2D array by rows.

index3_col.m,
indexes a 3 array by columns.

index3_row.m,
indexes a 3D array by rows.

index4_col.m,
indexes a 4D array by columns.

index4_row.m,
indexes a 4D array by rows.

indexn_col.m,
indexes an ND array by columns.

indexn_row.m,
indexes an ND array by rows.

lcm_12n.m,
computes the least common multiple of the integers 1 through N;

pause_input.m,
waits until an input character is entered;

perm_check.m,
checks that a vector represents a permutation;

perm_cycle.m,
analyzes a permutation;

perm_free.m,
reports the unused items in a partial permutation;

perm_inverse.m,
computes the inverse of a permutation;

perm_next.m,
computes all permutations of N things, one at a time;

perm_print.m,
prints a permutation;

perm_uniform.m,
selects a random permutation of N objects;

pounds_to_kilograms.m,
converts a measurement in pounds to one in kilograms;

prime.m,
returns the Nth prime number;

prime_ge.m,
returns the smallest prime greater than or equal to N;

primer.m,
computes the prime numbers up to a given limit;

r4_uniform_01.m,
returns a unit pseudorandom R4;

r8_log_10.m,
returns the logarithm base 10 of an R8;

r8_uniform.m,
returns a scaled pseudorandom R8;

r8mat_print.m,
prints an R8MAT, with an optional title;

r8mat_print_some.m,
prints some of an R8MAT;

r8mat_transpose_print.m,
prints the transpose of an R8MAT;

r8mat_transpose_print_some.m,
prints some of the transpose of an R8MAT;

r8poly_order.m,
returns the order of a polynomial.

r8poly_print.m,
prints a polynomial;

r8vec_indicator.m,
sets an R8VEC to the indicator vector;

r8vec_mean.m,
returns the mean of an R8VEC;

r8vec_print.m,
prints an R8VEC;

r8vec_variance.m,
returns the variance of an R8VEC;

radians_to_degrees.m,
converts an angle measure from radians to degrees;

random_initialize.m,
initializes the MATLAB random number generator;

rat_factor.m,
factors a rational value into a product of prime factors;

roots_to_r8poly.m,
converts polynomial roots to polynomial coefficients;

roots_to_i4poly.m,
converts polynomial roots to polynomial coefficients;

s_cat.m,
concatenates two strings;

s_eqi.m,
compares two strings for equality, ignoring case and trailing blanks;

s_len_trim.m,
returns the length of a character string to the last nonblank;

s_swap.m,
swaps two strings;

sin_deg.m
returns the sine of an angle given in degrees.

sort_heap_external.m,
external sorts a list of values into ascending order;

timestamp.m,
prints the YMDHMS date as a timestamp;

tuple_next2.m,
computes the next element of an integer tuple space;

tvec_bracket_even.m,
computes evenly spaced angles between THETA1 and THETA2;

tvec_bracket_even2.m,
computes evenly spaced angles between THETA1 and THETA2;

tvec_bracket_even3.m,
computes evenly spaced angles between THETA1 and THETA2;

tvec_even.m,
computes evenly spaced angles between 0 and 2*PI;

tvec_even2.m,
computes evenly spaced angles between 0 and 2*PI;

tvec_even3.m,
computes evenly spaced angles between 0 and 2*PI;

versine_pulse.m,
adds a versine pulse to a constant.
Last revised on 22 March 2019.