SUBSET
Combinatorial Routines
SUBSET
is a MATLAB library which
performs various combinatorial operations.
These include the enumeration, generation, random
selection, ranking and unranking of
-
COMP, compositions of an integer;
-
COMPNZ, compositions of an integer with no zero parts;
-
EQUIV's, partitions of a set of N objects;
-
I4_PARTITION's, partitions of an integer;
-
I4POLY's, integer polynomials in factorial, Newton,
power sum, or Taylor form;
-
I4VEC's, integer vectors;
-
KSUB's, subsets of size K, from a set of N objects;
-
MULTIPERM's, permutations of the N objects, some of which
are indistinguishable.
-
PERM's, permutations of the first N integers;
-
R8POLY's, real polynomials in factorial, Newton,
power sum, or Taylor form;
-
subsets of a set of N objects;
-
vectors whose entries range from 1 to N;
-
YTB's, Young tables;
Other objects considered include
-
the Bell numbers,
-
BVEC's, binary numbers represented as a vector of 0's and 1's;
-
Catalan numbers,
-
congruence equations.
-
continued fractions,
-
DEC's, decimal numbers represented as a mantissa and a power of 10;
-
DERANGE's, derangements (permutations that leave no element in place),
-
DVEC's, decimal numbers represented as a vector of digits;
-
falling factorials (20*19*18...),
-
GRAY, Gray codes,
-
matrix permanents (similar to determinants, but harder to compute,
if you can believe that),
-
Morse-Thue numbers,
-
pentagonal numbers,
-
Pythagorean triples,
-
RAT's, rational numbers represented as a pair of integers;
-
rising factorials (7*8*9...).
Licensing:
The computer code and data files described and made available on this web page
are distributed under
the GNU LGPL license.
Languages:
SUBSET is available in
a C version and
a C++ version and
a FORTRAN77 version and
a FORTRAN90 version and
a MATLAB version.
Related Data and Programs:
COMBINATION_LOCK,
a MATLAB program which
simulates the process of determining the secret combination of a lock.
COMBO,
a MATLAB library which
contains many combinatorial routines.
PARTITION_PROBLEM,
a MATLAB library which
seeks solutions of the partition problem, splitting a set of integers into
two subsets with equal sum.
SET_THEORY,
a MATLAB library which
demonstrates MATLAB commands that implement various set theoretic operations.
SUBSET_SUM,
a MATLAB library which
seeks solutions of the subset sum problem.
UNICYCLE,
a MATLAB library which
considers permutations containing a single cycle, sometimes called cyclic permutations.
Reference:
-
Milton Abramowitz, Irene Stegun,
Handbook of Mathematical Functions,
National Bureau of Standards, 1964,
ISBN: 0-486-61272-4,
LC: QA47.A34.
-
Walter Ball,
Mathematical Recreations and Essays,
Macmillan, 1962,
ISBN: 1417921269,
LC: QA95.B2.
-
Paul Bratley, Bennett Fox, Linus Schrage,
A Guide to Simulation,
Second Edition,
Springer, 1987,
ISBN: 0387964673,
LC: QA76.9.C65.B73.
-
Bill Buckles, Matthew Lybanon,
Algorithm 515:
Generation of a Vector from the Lexicographical Index,
ACM Transactions on Mathematical Software,
Volume 3, Number 2, June 1977, pages 180-182.
-
Tom Christiansen, Nathan Torkington,
Perl Cookbook,
O'Reilly, 2003,
ISBN: 0596003137,
LC: QA76.73.P22.C38.
-
William Cody, Kenneth Hillstrom,
Chebyshev Approximations for the Natural Logarithm of the
Gamma Function,
Mathematics of Computation,
Volume 21, Number 98, April 1967, pages 198-203.
-
John Conway, Richard Guy,
The Book of Numbers,
Springer, 1998,
ISBN: 038797993X,
LC: QA241.C6897.
-
Bennett Fox,
Algorithm 647:
Implementation and Relative Efficiency of Quasirandom
Sequence Generators,
ACM Transactions on Mathematical Software,
Volume 12, Number 4, December 1986, pages 362-376.
-
Laurent Habsieger, Maxim Kazarian, Sergei Lando,
On the Second Number of Plutarch,
American Mathematical Monthly,
Volume 105, Number 5, May 1998, page 446.
-
John Halton,
On the efficiency of certain quasi-random sequences of points
in evaluating multi-dimensional integrals,
Numerische Mathematik,
Volume 2, Number 1, December 1960, pages 84-90.
-
John Hammersley,
Monte Carlo methods for solving multivariable problems,
Proceedings of the New York Academy of Science,
Volume 86, 1960, pages 844-874.
-
John Hart, Ward Cheney, Charles Lawson, Hans Maehly,
Charles Mesztenyi, John Rice, Henry Thacher,
Christoph Witzgall,
Computer Approximations,
Wiley, 1968,
LC: QA297.C64.
-
Brian Hayes,
Third Base,
American Scientist,
Volume 89, Number 6, November-December 2001, pages 490-494.
-
Mark Herkommer,
Number Theory, A Programmer's Guide,
McGraw Hill, 1999,
ISBN: 0-07-913074-7.
-
Karla Hoffman, Douglas Shier,
Algorithm 564:
A Test Problem Generator for Discrete Linear L1
Approximation Problems,
ACM Transactions on Mathematical Software,
Volume 6, Number 4, December 1980, pages 615-617.
-
Donald Knuth,
The Art of Computer Programming,
Volume 3, Sorting and Searching,
Second Edition,
Addison Wesley, 1998,
ISBN: 0201896850,
LC: QA76.6.K64.
-
Hang Tong Lau,
Algorithms on Graphs,
Tab Books, 1989,
ISBN: 0830634290,
LC: QA166.L38
-
Pierre LEcuyer,
Random Number Generation,
in Handbook of Simulation,
edited by Jerry Banks,
Wiley, 1998,
ISBN: 0471134031,
LC: T57.62.H37.
-
Peter Lewis, Allen Goodman, James Miller,
A Pseudo-Random Number Generator for the System/360,
IBM Systems Journal,
Volume 8, 1969, pages 136-143.
-
Charles Mifsud,
Algorithm 154,
Combination in Lexicographic Order,
Communications of the ACM,
Volume 6, Number 3, March 1963, page 103.
-
mil_std_1753,
Military Standard 1753,
FORTRAN, DoD Supplement To American National Standard X3.9-1978,
9 November 1978.
-
Albert Nijenhuis, Herbert Wilf,
Combinatorial Algorithms for Computers and Calculators,
Second Edition,
Academic Press, 1978,
ISBN: 0-12-519260-6,
LC: QA164.N54.
-
Robert Owens,
Sums of Powers of Integers,
Mathematics Magazine,
Volume 65, Number 1, February 1992, pages 38-40.
-
Norman Richert,
Strang's Strange Figures,
American Mathematical Monthly,
Volume 99, Number 2, February 1992, pages 101-107.
-
James Sandeson,
Testing Ecological Patterns,
American Scientist,
Volume 88, Number 4, July-August 2000, pages 332-339.
-
Ian Saunders,
Algorithm AS 205,
Enumeration of R x C Tables with Repeated Row Totals,
Applied Statistics,
Volume 33, Number 3, 1984, pages 340-352.
-
Robert Sedgewick,
Algorithms in C,
Addison-Wesley, 1990,
ISBN: 0-201-51425-7,
LC: QA76.73.C15S43.
-
Raymond Seroul,
Programming for Mathematicians,
Springer, 2000,
ISBN: 3-540-66422-X,
LC: QA76.6.S465.
-
Mok-Kong Shen,
Algorithm 202:
Generation of Permutations in Lexicographical Order,
Communications of the ACM,
Volume 6, Number 9, September 1963, page 517.
-
Richard Stanley,
Hipparchus, Plutarch, Schroeder, and Hough,
American Mathematical Monthly,
Volume 104, Number 4, April 1997, pages 344-350.
-
Dennis Stanton, Dennis White,
Constructive Combinatorics,
Springer, 1986,
ISBN: 0387963472,
LC: QA164.S79.
-
Ian Stewart,
A Neglected Number,
Scientific American,
Volume 274, pages 102-102, June 1996.
-
Ian Stewart,
Math Hysteria,
Oxford, 2004,
ISBN: 0198613369,
LC: QA95.S7255.
-
James Sylvester,
Question 7382,
Mathematical Questions with their Solutions,
Educational Times,
Volume 41, page 21, 1884.
-
Hale Trotter,
Algorithm 115:
PERM,
Communications of the Association for Computing Machinery,
Volume 5, Number 8, August 1962, pages 434-435.
-
Johannes vanderCorput,
Verteilungsfunktionen I & II,
Proceedings of the Koninklijke Nederlandsche Akademie
van Wetenschappen,
Volume 38, 1935, pages 813-820, pages 1058-1066.
-
Jack vanLint, Richard Wilson,
A Course in Combinatorics,
Cambridge, 1992,
ISBN: 0-521-42260-4,
LC: QA164.L56.
-
Eric Weisstein,
CRC Concise Encyclopedia of Mathematics,
CRC Press, 2002,
Second edition,
ISBN: 1584883472,
LC: QA5.W45
-
Stephen Wolfram,
The Mathematica Book,
Fourth Edition,
Cambridge University Press, 1999,
ISBN: 0-521-64314-7,
LC: QA76.95.W65.
-
ML Wolfson, HV Wright,
ACM Algorithm 160:
Combinatorial of M Things Taken N at a Time,
Communications of the ACM,
Volume 6, Number 4, April 1963, page 161.
-
Daniel Zwillinger, editor,
CRC Standard Mathematical Tables and Formulae,
30th Edition,
CRC Press, 1996,
ISBN: 0-8493-2479-3,
LC: QA47.M315.
Source Code:
-
asm_enum.m,
returns the number of alternating sign matrices of a given order.
-
asm_triangle.m,
returns a row of the alternating sign matrix triangle.
-
bell.m,
computes the Bell numbers.
-
bell_values.m,
returns some values of the Bell numbers.
-
binary_vector_next.m,
returns the next binary vector.
-
bvec_add.m,
adds two binary vectors.
-
bvec_and.m,
computes the logical AND of two binary vectors.
-
bvec_check.m,
checks a binary vector.
-
bvec_complement2.m,
returns the complement of a binary vector.
-
bvec_mul.m,
multiplies two binary vectors.
-
bvec_next.m,
returns the next binary vector.
-
bvec_not.m,
negates a binary vector.
-
bvec_or.m,
returns the logical OR of two binary vectors.
-
bvec_print.m,
prints a binary vector.
-
bvec_reverse.m,
reverses a binary vector.
-
bvec_sub.m,
subtracts two binary vectors.
-
bvec_to_i4.m,
converts a (signed) binary vector to an integer.
-
bvec_xor.m,
returns the exclusive OR of two binary vectors.
-
catalan.m,
computes the Catalan numbers.
-
catalan_row_next.m,
returns the next row of the Catalan matrix.
-
catalan_values.m,
returns some values of the Catalan numbers.
-
cbt_traverse.m,
traverses a complete binary tree.
-
cfrac_to_rat.m,
converts a continued fraction to a rational.
-
cfrac_to_rfrac.m,
converts a continued polynomial fraction to a rational
polynomial fraction.
-
ch_cap.m,
capitalizes a single character.
-
change_greedy.m,
makes change using a greedy algorithm.
-
change_next.m,
computes the next set of change for a given total.
-
chinese_check.m,
checks a set of Chinese remainder moduluses.
-
chinese_to_i4.m,
converts a set of Chinese remainders to an equivalent integer.
-
comb_next.m,
returns the next combination of K things out of N.
-
comb_row.m,
computes row N of Pascal's triangle.
-
comb_unrank.m,
returns the RANK-th combination of N things out of M things.
-
comp_next.m,
returns the next composition of an integer into K parts.
-
comp_random.m,
returns a random composition of an integer into K parts.
-
compnz_next.m,
returns the next composition of an integer into K nonzero parts.
-
compnz_random.m,
returns a random composition of an integer into K nonzero parts.
-
congruence.m,
solves a congruence of the form A * X = C (mod B).
-
count_pose_random.m,
poses a random problem for the game "The Count is Good".
-
debruijn.m,
constructs a de Bruijn string.
-
dec_add.m,
adds two decimal values.
-
dec_div.m,
divides two decimal values.
-
dec_mul.m,
multiplies two decimal values.
-
dec_round.m,
rounds a decimal value to a given number of digits.
-
dec_to_r8.m,
converts a decimal to a real value.
-
dec_to_rat.m,
converts a decimal to a rational value.
-
dec_to_s.m,
returns a string representation of a decimal.
-
dec_width.m,
returns the "width" of a decimal.
-
decmat_det.m,
computes the determinant of a decimal matrix.
-
decmat_print.m,
prints a decimal matrix.
-
derange_back_candidate.m,
finds possible values for the K-th entry of a derangement.
-
derange_back_next.m,
returns the next derangement of N items.
-
derange_check.m,
checks whether a permutation is a derangement.
-
derange_enum.m,
returns the number of derangements of N objects.
-
derange_enum2.m,
returns the number of derangements of 0 through N objects.
-
derange_enum3.m,
returns the number of derangements of N objects.
-
derange_weed_next.m,
returns next derangements of N objects.
-
digit_to_ch.m,
returns the character representation of a decimal digit.
-
digraph_arc_euler.m,
returns an Euler circuit in a directed graph.
-
digraph_arc_print.m,
prints out a digraph from an edge list.
-
diophantine.m,
solves a Diophantine equation A * X + B * Y = C.
-
diophantine_solution_minimize.m,
seeks a minimal solution of a Diophantine equation.
-
dvec_add.m,
adds two decimal vectors.
-
dvec_complementx.m,
returns the complement of a decimal vector.
-
dvec_mul.m,
multiplies two decimal vectors.
-
dvec_print.m,
prints a decimal vector.
-
dvec_sub.m,
subtracts two decimal vectors.
-
dvec_to_i4.m,
converts a (signed) decimal vector to an integer.
-
equiv_next.m,
returns the next partition of a set.
-
equiv_next2.m,
returns the next partition of a set.
-
equiv_print.m,
prints a partition of a set.
-
equiv_print2.m,
prints a partition of a set using parentheses for grouping.
-
equiv_random.m,
returns a random partition of a set.
-
euler.m,
returns the N-th row of Euler's triangle.
-
frobenius_number_order2.m,
computes the Frobenius number for the order 2 case.
-
frobenius_number_order2_values.m,
returns some values of the Frobenius number for the order 2 case.
-
gamma_log_values.m,
returns some values of the logarithm of the Gamma function.
-
get_seed.m,
returns a random seed for the random number generator.
-
gray_next.m,
returns the next Gray code by switching one item at a time.
-
gray_rank2.m,
returns the rank of a given Gray code.
-
gray_unrank2.m,
returns the Gray code of a given rank.
-
i4_bclr.m,
sets a given bit of an I4 to 0.
-
i4_bset.m,
sets a given bit of an I4 to 1.
-
i4_btest.m,
returns TRUE if bit POS of I is a 1.
-
i4_choose.m,
computes the binomial coefficient C(N,K).
-
i4_factor.m,
factors an I4 into a product of primes.
-
i4_factorial.m,
computes N! for small values of N.
-
i4_gcd.m,
finds the greatest common divisor of I and J.
-
i4_huge.m,
returns a "huge" I4.
-
i4_log_10.m,
returns the integer part of the logarithm of an I4.
-
i4_modp.m,
returns the nonnegative remainder of integer division.
-
i4_moebius.m,
evaluates the Moebius function.
-
i4_partition_conj.m,
computes the conjugate of a partition of an integer.
-
i4_partition_count.m,
returns the number of partitions of an integer.
-
i4_partition_count2.m,
returns the number of partitions of an integer.
-
i4_partition_count_values.m,
returns some values of the partition count function.
-
i4_partition_next.m,
computes the next partition of an integer.
-
i4_partition_next2.m,
computes the next partition of an integer.
-
i4_partition_print.m,
prints a partition of an integer.
-
i4_partition_random.m,
returns a random partition of an integer.
-
i4_partitions_next.m,
returns the next partition of an integer, and
when there are no more, it increases the integer and continues.
-
i4_sign.m,
returns the sign of an I4.
-
i4_sqrt.m,
finds the integer square root of an I4.
-
i4_sqrt_cf.m,
finds the continued fraction square root of an integer.
-
i4_swap.m,
interchanges two I4's.
-
i4_to_bvec.m,
converts an I4 to a (signed) binary vector.
-
i4_to_chinese.m,
converts an integer to its Chinese remainder form.
-
i4_to_dvec.m,
converts an integer to a (signed) decimal vector.
-
i4_to_halton.m,
computes an element of a Halton sequence.
-
i4_to_s_left.m,
converts an integer to a left-justified string.
-
i4_uniform.m,
returns a random integer in a given range.
-
i4mat_01_rowcolsum.m,
creates a 0/1 matrix with given row and column sums.
-
i4mat_perm.m,
applies a permutation to the rows and columns of a square I4MAT.
-
i4mat_perm2.m,
applies permutations to the rows and columns of a rectangular integer matrix.
-
i4mat_print.m,
prints an I4MAT.
-
i4mat_print_some.m,
prints some of an I4MAT.
-
i4mat_u1_inverse.m,
computes the inverse of a unit upper triangular integer matrix.
-
i4poly.m,
performs operations on an integer polynomial.
-
i4poly_cyclo.m,
computes a cyclotomic polynomial.
-
i4poly_degree.m,
returns the degree of an integer polynomial.
-
i4poly_div.m,
divides one integer polynomial by another.
-
i4poly_mul.m,
multiplies two integer polynomials.
-
i4poly_print.m,
prints an integer polynomial.
-
i4vec_ascends.m,
is TRUE if an integer vector is increasing.
-
i4vec_backtrack.m,
supervises a backtrack search for an integer vector.
-
i4vec_descends.m,
is TRUE if an integer vector is decreasing.
-
i4vec_frac.m,
searches for the K-th smallest entry in an N vector.
-
i4vec_index.m,
returns the location of the first occurrence of a given value.
-
i4vec_indicator.m,
sets an integer vector to the indicator vector.
-
i4vec_maxloc_last.m,
returns the index of the last maximal element of an integer vector.
-
i4vec_pairwise_prime.m,
returns TRUE if the elements of an integer vector are pairwise prime.
-
i4vec_print.m,
prints an integer vector.
-
i4vec_print_some.m,
prints some of an integer vector.
-
i4vec_reverse.m,
reverses the elements of an integer vector.
-
i4vec_sort_bubble_a.m,
ascending sorts an integer vector using bubble sort.
-
i4vec_sort_heap_index_d.m,
produces an index vector that descending sorts an integer array,
using heapsort.
-
i4vec_transpose_print.m,
prints the "transpose" of an integer vector.
-
i4vec_uniform.m,
returns a random integer vector.
-
index_box_next_2d.m,
produces index vectors on the surface of a box in 2D.
-
index_box_next_3d.m,
produces index vectors on the surface of a box in 3D.
-
index_box2_next_2d.m,
produces index vectors on the surface of a box in 2D.
-
index_box2_next_3d.m,
produces index vectors on the surface of a box in 3D.
-
index_next0.m,
generates all index vectors with given upper limits.
-
index_next1.m,
generates all index vectors with given upper limits.
-
index_next2.m,
generates all index vectors with given lower and upper limits.
-
index_rank0.m,
ranks an index vector with given upper limits.
-
index_rank1.m,
ranks an index vector with given upper limits.
-
index_rank2.m,
ranks an index vector with given lower and upper limits.
-
index_unrank0.m,
unranks an index vector with given upper limits.
-
index_unrank1.m,
unranks an index vector with given upper limits.
-
index_unrank2.m,
unranks an index vector with given upper and lower limits.
-
ins_perm.m,
computes a permutation from its inversion sequence.
-
inverse_mod_n.m,
computes the inverse of B mod N.
-
involute_enum.m,
returns the number of involutions of N objects.
-
jfrac_to_rfrac.m,
converts a J-fraction to a rational polynomial fraction.
-
josephus.m,
returns the position of the K-th man to be executed.
-
ksub_next.m,
selects the next subset of size K from a set of size N.
-
ksub_next2.m,
selects the next subset of size K from a set of size N.
-
ksub_next3.m,
selects the next subset of size K from a set of size N.
-
ksub_next4.m,
selects the next subset of size K from a set of size N.
-
ksub_random.m,
selects a random subset of size K from a set of size N.
-
ksub_random2.m,
selects a random subset of size K from a set of size N.
-
ksub_random3.m,
selects a random subset of size K from a set of size N.
-
ksub_random4.m,
selects a random subset of size K from a set of size N.
-
ksub_random5.m,
selects a random subset of size K from a set of size N.
-
ksub_rank.m,
returns the rank of a subset of size K from a set of size N.
-
ksub_unrank.m,
returns a subset of size K from a set of size N, of given rank.
-
lvec_next.m,
returns the next logical vector.
-
matrix_product_opt.m,
determines the optimal cost of a matrix product.
-
moebius_matrix.m,
finds the Moebius matrix from a covering relation.
-
monomial_count.m,
counts the number of monomials up to a given degree.
-
monomial_counts.m,
counts the number of monomials up to a given degree.
-
morse_thue.m,
generates a Morse-Thue number.
-
multinomial_coef1.m,
computes a multinomial coefficient.
-
multinomial_coef2.m,
computes a multinomial coefficient.
-
multiperm_enum.m,
enumerates multipermutations.
-
multiperm_next.m,
computes the next multipermutation.
-
nim_sum.m,
computes the Nim sum of two integers.
-
padovan.m,
computes the Padovan numbers.
-
pell_basic.m,
returns the basic solution of Pell's equation.
-
pell_next.m,
returns the next solution of Pell's equation.
-
pent_enum.m,
computes the N-th pentagonal number.
-
perm_ascend.m,
returns the longest ascending subsequence of a permutation.
-
perm_canon_to_cycle.m,
converts a permutation from canonical to cycle form.
-
perm_check.m,
checks that a permutation is legal.
-
perm_cycle.m,
analyzes a permutation.
-
perm_cycle_to_canon.m,
converts a permutation from cycle to canonical format.
-
perm_cycle_to_index.m,
converts a permutation from cycle to standard index format.
-
perm_distance.m,
computes the Ulam metric distance of two permutations.
-
perm_fixed_enum.m,
enumerates the permutations of N objects with M of them unchanged.
-
perm_free.m,
reports the unused items in a partial permutation.
-
perm_index_to_cycle.m,
converts a permutation from standard index to cycle form.
-
perm_ins.m,
returns the inversion sequence of a permutation.
-
perm_inverse.m,
inverts a permutation.
-
perm_inverse2.m,
inverts a permutation.
-
perm_inverse3.m,
inverts a permutation.
-
perm_lex_next.m,
generates the next permutation, in lexical order.
-
perm_mul.m,
multiplies two permutations.
-
perm_next.m,
computes the next permutation of N objects.
-
perm_next2.m,
computes the next permutation of N objects.
-
perm_next3.m,
computes the next permutation of N objects.
-
perm_mul.m,
prints a permutation.
-
perm_random.m,
returns a random permutation.
-
perm_random2.m,
returns a random permutation.
-
perm_random3.m,
returns a random permutation.
-
perm_rank.m,
returns the rank of a permutation.
-
perm_sign.m,
returns the sign of a permutation.
-
perm_to_equiv.m,
converts a permutation to an equivalence relation.
-
perm_to_ytb.m,
converts a permutation to a Young tableau.
-
perm_unrank.m,
produces the permutation of given rank.
-
perrin.m,
computes the Perrin numbers.
-
pord_check.m,
checks a matrix representing a partial ordering.
-
power_mod.m,
computes mod ( A^N, M ).
-
power_series1.m,
computes the power series for (1+F(Z))^ALPHA.
-
power_series2.m,
computes the power series for exp(F(Z))-1.
-
power_series3.m,
computes the power series for G(F(Z)).
-
power_series4.m,
computes the power series for G(1/F(Z)).
-
prime.m,
returns any of the first MAXPRIME prime numbers.
-
pythag_triple_next.m,
computes the next Pythagorean triple.
-
r4_uniform_01.m,
is a uniform random number generator.
-
r8_agm.m,
finds the arithmetic-geometric mean of two real numbers.
-
r8_choose.m,
computes the binomial coefficient C(N,K).
-
r8_epsilon.m,
returns the arithmetic precision for real arithmetic.
-
r8_fall.m,
computes the falling factorial.
-
r8_is_int.m,
determines if a real number represent an integer value.
-
r8_rise.m,
computes the rising factorial.
-
r8_swap.m,
interchanges two real values.
-
r8_to_cfrac.m,
converts a double precision value to a continued fraction.
-
r8_to_dec.m,
converts a double precision value to a decimal value;
-
r8_to_rat.m,
converts a real value to a rational value.
-
r8_to_s_left.m,
converts a real value to a left-justified string.
-
r8_uniform.m,
returns a random real in a given range.
-
r8_uniform_01.m,
is a uniform random number generator.
-
r8mat_det.m,
computes the determinant of a real array.
-
r8mat_perm.m,
applies a permutation to the rows and columns of a square matrix.
-
r8mat_perm2.m,
applies a permutation to the rows and columns of a rectangular matrix.
-
r8mat_permanent.m,
computes the permanent of a square matrix.
-
r8mat_print.m,
prints a real matrix.
-
r8mat_print_some.m,
prints some of a real matrix.
-
r8poly.m,
performs operations on a real polynomial.
-
r8poly_degree.m,
returns the degree of a real polynomial.
-
r8poly_div.m,
computes the quotient and remainder of two real polynomials.
-
r8poly_f2p.m,
converts a real polynomial from factorial to standard form.
-
r8poly_fval.m,
evaluates a real polynomial in factorial form.
-
r8poly_mul.m,
computes the product of two real polynomials.
-
r8poly_n2p.m,
converts a polynomial from Newton to standard form.
-
r8poly_nval.m,
evaluates a polynomial in Newton form.
-
r8poly_nx.m,
replaces one of the base points in the Newton form of a polynomial.
-
r8poly_p2f.m,
converts a real polynomial from standard to factorial form.
-
r8poly_p2n.m,
converts a real polynomial from standard to Newton form.
-
r8poly_p2t.m,
converts a real polynomial from standard to Taylor form.
-
r8poly_power.m,
computes a power of a real polynomial.
-
r8poly_print.m,
prints a real polynomial.
-
r8poly_pval.m,
evaluates a real polynomial.
-
r8poly_t2p.m,
converts a real polynomial from Taylor to standard form.
-
r8vec_backtrack.m,
supervises a backtrack search for a real vector.
-
r8vec_frac.m,
searches for the K-th smallest entry in an N vector.
-
r8vec_indicator.m,
sets a real vector to the indicator vector.
-
r8vec_mirror_next.m,
steps through all sign variations of a real vector.
-
r8vec_print.m,
prints a real vector.
-
r8vec_uniform.m,
returns a random real vector.
-
r8vec_uniform_01.m,
returns a random real vector of values in [0,1].
-
random_initialize.m,
initializes the random number generator.
-
rat_add.m,
adds two rational values.
-
rat_div.m,
carries out division of rational values.
-
rat_farey.m,
returns a row of the Farey fraction table.
-
rat_farey2.m,
returns the next row of the Farey fraction table.
-
rat_mul.m,
multiplies two rational values.
-
rat_normalize.m,
normalizes a rational value.
-
rat_sum_formula.m,
computes the formulas for sums of powers of integers.
-
rat_to_cfrac.m,
converts a rational to a continued fraction.
-
rat_to_dec.m,
converts a rational to a decimal value.
-
rat_to_r8.m,
converts a rational to a real value.
-
rat_to_s_left.m,
converts a rational to a left-justified string.
-
rat_width.m,
returns the "width" of a rational number.
-
ratmat_det.m,
computes the determinant of a rational matrix.
-
ratmat_print.m,
prints a rational matrix.
-
regro_next.m,
computes the next restricted growth function.
-
rfrac_to_cfrac.m,
converts a rational polynomial fraction to continued fraction form.
-
rfrac_to_jfrac.m,
converts a rational polynomial fraction to a J fraction.
-
s_blank_delete.m,
deletes every blank from a string.
-
s_blanks_delete.m,
replaces consecutive blanks by one blank in a string.
-
s_eqi.m,
compares two strings for equality, ignoring case.
-
s_len_trim.m,
returns the length of a string to the last nonblank.
-
schroeder.m,
generates the Schroeder numbers.
-
sort_heap_external.m,
externally sorts a list of items into ascending order.
-
subcomp_next.m,
computes the next subcomposition of N into K parts;
-
subcompnz_next.m,
computes the next subcomposition of N into K nonzero parts;
-
subcompnz2_next.m,
computes the next composition of N into K nonzero parts
for N between N_LO and N_HI;
-
subset_by_size_next.m,
returns all the subsets of an N set, in decreasing order of size.
-
subset_gray_next.m,
generates the next subset of an N set.
-
subset_gray_rank.m,
ranks a subset of an N set using the Gray ordering.
-
subset_gray_unrank.m,
returns a subset of an N set with the given Gray ranking.
-
subset_lex_next.m,
returns the next subset of an N set, in lexicographic order.
-
subset_random.m,
selects a random subset of an N set.
-
subtriangle_next.m,
returns the next subtriangle in a triangle whose edges have
each been subdivided into N parts.
-
thue_binary_next.m,
returns the next element in a binary Thue sequence.
-
thue_ternary_next.m,
returns the next element in a ternary Thue sequence.
-
timestamp.m,
returns the current YMDHMS date as a timestamp.
-
triang.m,
renumbers items in accordance with a partial ordering.
-
tuple_next.m,
computes the next element of a tuple space.
-
tuple2_next.m,
computes the next element of a tuple space.
-
tuple_next_fast.m,
computes the next element of a tuple space, "fast".
-
tuple_next_ge.m,
computes the next "nondecreasing" element of a tuple space.
-
ubvec_add.m,
adds two unsigned binary vectors.
-
ubvec_to_ui4.m,
converts an unsigned binary vector to an unsigned integer.
-
ui4_to_ubvec.m,
converts an integer to an unsigned binary vector.
-
vec_colex_next.m,
generates vectors in colex order.
-
vec_colex_next2.m,
generates vectors in colex order.
-
vec_colex_next3.m,
generates vectors in colex order.
-
vec_gray_next.m,
generates the elements of a product space.
-
vec_gray_rank.m,
returns the rank of an N-vectors of integers modulo a given base.
-
vec_gray_unrank.m,
computes the product space element of a given rank.
-
vec_lex_next.m,
generates all N-vectors of integers modulo a given base.
-
vec_random.m,
selects a random N-vectors of integers modulo a given base.
-
vector_constrained_next.m,
computes the "next" vector that lies in a given range and satisfies
a particular constraint.
-
vector_constrained_next2.m,
computes the "next" vector that lies in a given range and satisfies
a particular constraint.
-
vector_constrained_next3.m,
computes the "next" vector that lies in a given range and satisfies
a particular constraint.
-
vector_constrained_next4.m,
computes the "next" vector that lies in a given range and satisfies
a particular constraint.
-
vector_constrained_next5.m,
computes the "next" vector that lies in a given range and satisfies
a particular constraint.
-
vector_constrained_next6.m,
computes the "next" vector that lies in a given range and satisfies
a particular constraint.
-
vector_constrained_next7.m,
returns the "next" vector that lies in a given range and satisfies
a particular constraint.
-
vector_next.m,
returns the "next" integer vector between two ranges.
-
ytb_enum.m,
enumerates the Young tableaus of size N.
-
ytb_next.m,
returns the next Young tableau of size N.
-
ytb_print.m,
prints a Young tableau.
-
ytb_random.m,
returns a random Young tableau.
Examples and Tests:
-
subset_test.m,
runs all the tests;
-
subset_test_output.txt,
the output file;
-
subset_test000.m,
tests RANDOM_INITIALIZE;
-
subset_test001.m,
tests ASM_ENUM;
-
subset_test002.m,
tests ASM_TRIANGLE;
-
subset_test003.m,
tests BELL and BELL_VALUES;
-
subset_test9001.m,
tests BVEC_ADD and BVEC_SUB;
-
subset_test9002.m,
tests BVEC_COMPLEMENT2;
-
subset_test9003.m,
tests BVEC_MUL;
-
subset_test005.m,
tests CATALAN and CATALAN_VALUES;
-
subset_test006.m,
tests CATALAN_ROW_NEXT;
-
subset_test007.m,
tests CFRAC_TO_RAT and RAT_TO_CFRAC;
-
subset_test008.m,
tests CFRAC_TO_RFRAC and RFRAC_TO_CFRAC;
-
subset_test009.m,
tests CHANGE_GREEDY;
-
subset_test010.m,
tests CHANGE_NEXT;
-
subset_test011.m,
tests COMB_NEXT;
-
subset_test012.m,
tests COMB_ROW;
-
subset_test013.m,
tests COMB_UNRANK;
-
subset_test014.m,
tests R8_CHOOSE;
-
subset_test015.m,
tests I4_CHOOSE;
-
subset_test016.m,
tests COMP_NEXT;
-
subset_test017.m,
tests COMP_RANDOM;
-
subset_test0174.m,
tests COMPNZ_NEXT;
-
subset_test0175.m,
tests COMPNZ_RANDOM;
-
subset_test018.m,
tests CONGRUENCE;
-
subset_test019.m,
tests COUNT_POSE_RANDOM;
-
subset_test020.m,
tests R8_TO_CFRAC;
-
subset_test021.m,
tests DEBRUIJN;
-
subset_test022.m,
tests DEC_ADD;
-
subset_test023.m,
tests DEC_DIV;
-
subset_test024.m,
tests DEC_MUL;
-
subset_test025.m,
tests DEC_ROUND;
-
subset_test026.m,
tests DEC_TO_RAT and RAT_TO_DEC;
-
subset_test027.m,
tests DEC_TO_S;
-
subset_test028.m,
tests DEC_WIDTH;
-
subset_test029.m,
tests DECMAT_DET;
-
subset_test021a.m,
tests DERANGE_ENUM and DERANGE_ENUM2;
-
subset_test022a.m,
tests DERANGE_BACK_NEXT;
-
subset_test023a.m,
tests DERANGE_WEED_NEXT;
-
subset_test024a.m,
tests DIGRAPH_ARC_EULER;
-
subset_test025a.m,
tests DIOPHANTINE;
-
subset_test026a.m,
tests DIOPHANTINE_MINIMIZE;
-
subset_test026b.m,
tests DVEC_ADD and DVEC_SUB;
-
subset_test026c.m,
tests DVEC_COMPLEMENTX;
-
subset_test026d.m,
tests DVEC_MUL;
-
subset_test027a.m,
tests EQUIV_NEXT;
-
subset_test028a.m,
tests EQUIV_NEXT2;
-
subset_test029a.m,
tests EQUIV_RANDOM;
-
subset_test0295.m,
tests EULER;
-
subset_test0304.m,
tests FROBENIUS_NUMBER_ORDER2;
-
subset_test0305.m,
tests R8_GAMMA_LOG and GAMMA_LOG_VALUES;
-
subset_test031.m,
tests GRAY_NEXT;
-
subset_test0321.m,
tests GRAY_RANK2 and GRAY_UNRANK2;
-
subset_test0322.m,
tests I4_BCLR;
-
subset_test03225.m,
tests I4_BSET;
-
subset_test0323.m,
tests I4_BTEST;
-
subset_test0324.m,
tests I4_FACTOR;
-
subset_test0325.m,
tests I4_GCD;
-
subset_test0327.m,
tests I4_LOG10;
-
subset_test058.m,
tests I4_PARTITION_CONJ;
-
subset_test059.m,
tests I4_PARTITION_NEXT;
-
subset_test060.m,
tests I4_PARTITION_NEXT;
-
subset_test061.m,
tests I4_PARTITION_COUNT and I4_PARTITION_COUNT_VALUES;
-
subset_test0615.m,
tests I4_PARTITION_COUNT2 and I4_PARTITION_COUNT_VALUES;
-
subset_test062.m,
tests I4_PARTITION_RANDOM;
-
subset_test06225.m,
tests I4_PARTITIONS_NEXT;
-
subset_test033.m,
tests I4_SQRT;
-
subset_test034.m,
tests I4_SQRT_CF;
-
subset_test0625.m,
tests I4_TO_BVEC and BVEC_TO_I4;
-
subset_test035.m,
tests I4_TO_CHINESE and CHINESE_TO_I4;
-
subset_test0364.m,
tests I4_TO_IPOLY and I4_TO_VAN_DER_CORPUT;
-
subset_test0627.m,
tests I4_TO_IPOLY and IPOLY_TO_I4;
-
subset_test036.m,
tests I4_TO_VAN_DER_CORPUT;
-
subset_test0365.m,
tests I4_BTEST;
-
subset_test037.m,
tests I4MAT_01_ROWCOLSUM;
-
subset_test039.m,
tests I4MAT_01_ROWCOLSUM;
-
subset_test040.m,
tests I4MAT_U1_INVERSE;
-
subset_test041.m,
tests I4MAT_PERM;
-
subset_test042.m,
tests I4MAT_PERM2;
-
subset_test047.m,
tests I4MAT_PERM2 and TRIANG;
-
subset_test043.m,
tests INDEX_BOX_NEXT_2D;
-
subset_test044.m,
tests INDEX_BOX_NEXT_3D;
-
subset_test045.m,
tests INDEX_BOX2_NEXT_2D;
-
subset_test046.m,
tests INDEX_BOX2_NEXT_3D;
-
subset_test048.m,
tests INDEX_NEXT0;
-
subset_test049.m,
tests INDEX_NEXT1;
-
subset_test050.m,
tests INDEX_NEXT2;
-
subset_test051.m,
tests INDEX_RANK0;
-
subset_test052.m,
tests INDEX_RANK1;
-
subset_test053.m,
tests INDEX_RANK2;
-
subset_test054.m,
tests INDEX_UNRANK0;
-
subset_test055.m,
tests INDEX_UNRANK1;
-
subset_test056.m,
tests INDEX_UNRANK2;
-
subset_test057.m,
tests INS_PERM and PERM_INS;
-
subset_test063.m,
tests INVOLUTE_ENUM;
-
subset_test064.m,
tests I4POLY;
-
subset_test065.m,
tests I4POLY_CYCLO;
-
subset_test066.m,
tests I4POLY_DIV;
-
subset_test067.m,
tests I4POLY_MUL;
-
subset_test0675.m,
tests I4VEC_DESCENDS;
-
subset_test068.m,
tests I4VEC_FRAC;
-
subset_test0683.m,
tests I4VEC_INDEX;
-
subset_test0685.m,
tests I4VEC_MAXLOC_LAST;
-
subset_test0686.m,
tests I4VEC_PAIRWISE_PRIME;
-
subset_test0687.m,
tests I4VEC_REVERSE;
-
subset_test0688.m,
tests I4VEC_SORT_BUBBLE_A;
-
subset_test0689.m,
tests I4VEC_SORT_HEAP_INDEX_D;
-
subset_test06895.m,
tests INVERSE_MOD_N;
-
subset_test069.m,
tests JFRAC_TO_RFRAC and RFRAC_TO_JFRAC;
-
subset_test070.m,
tests JOSEPHUS;
-
subset_test071.m,
tests KSUB_NEXT;
-
subset_test072.m,
tests KSUB_NEXT2;
-
subset_test073.m,
tests KSUB_NEXT3;
-
subset_test074.m,
tests KSUB_NEXT4;
-
subset_test075.m,
tests KSUB_RANDOM;
-
subset_test076.m,
tests KSUB_RANDOM2;
-
subset_test077.m,
tests KSUB_RANDOM3;
-
subset_test0771.m,
tests KSUB_RANDOM4;
-
subset_test07715.m,
tests KSUB_RANDOM5;
-
subset_test0772.m,
tests KSUB_RANK;
-
subset_test0773.m,
tests KSUB_UNRANK;
-
subset_test078.m,
tests MATRIX_PRODUCT_OPT;
-
subset_test079.m,
tests MOEBIUS_MATRIX;
-
subset_test0795.m,
tests MONOMIAL_COUNT and MONOMIAL_COUNTS;
-
subset_test080.m,
tests MORSE_THUE;
-
subset_test081.m,
tests MULTINOMIAL_COEF1 and MULTINOMIAL_COEF2;
-
subset_test0813.m,
tests MULTIPERM_ENUM;
-
subset_test0815.m,
tests MULTIPERM_NEXT;
-
subset_test083.m,
tests NIM_SUM;
-
subset_test084.m,
tests PELL_BASIC and PELL_NEXT;
-
subset_test085.m,
tests PENT_ENUM;
-
subset_test093.m,
tests PERM_ASCEND;
-
subset_test086.m,
tests PERM_BREAK_COUNT;
-
subset_test087.m,
tests PERM_CANON_TO_CYCLE;
-
subset_test088.m,
tests PERM_CYCLE;
-
subset_test089.m,
tests PERM_CYCLE_TO_CANON;
-
subset_test090.m,
tests PERM_CYCLE_TO_INDEX and PERM_INDEX_TO_CYCLE;
-
subset_test091.m,
tests PERM_DISTANCE;
-
subset_test092.m,
tests PERM_FIXED_ENUM;
-
subset_test094.m,
tests PERM_INVERSE;
-
subset_test095.m,
tests PERM_INVERSE2;
-
subset_test0955.m,
tests PERM_INVERSE3;
-
subset_test096.m,
tests PERM_LEX_NEXT;
-
subset_test097.m,
tests PERM_LEX_NEXT and PERM_SIGN;
-
subset_test098.m,
tests PERM_MUL;
-
subset_test099.m,
tests PERM_NEXT;
-
subset_test100.m,
tests PERM_NEXT2;
-
subset_test101.m,
tests PERM_NEXT3;
-
subset_test102.m,
tests PERM_RANDOM;
-
subset_test103.m,
tests PERM_RANDOM2;
-
subset_test104.m,
tests PERM_RANDOM3;
-
subset_test105.m,
tests PERM_RANK;
-
subset_test106.m,
tests PERM_TO_EQUIV;
-
subset_test107.m,
tests PERM_TO_YTB;
-
subset_test108.m,
tests PERM_UNRANK;
-
subset_test109.m,
tests POWER_MOD;
-
subset_test110.m,
tests POWER_SERIES1;
-
subset_test111.m,
tests POWER_SERIES2;
-
subset_test112.m,
tests POWER_SERIES3;
-
subset_test113.m,
tests POWER_SERIES4;
-
subset_test114.m,
tests PYTHAG_TRIPLE_NEXT;
-
subset_test115.m,
tests R8_AGM;
-
subset_test030.m,
tests R8_FALL;
-
subset_test1245.m,
tests R8_RISE;
-
subset_test116.m,
tests R8_TO_CFRAC;
-
subset_test1163.m,
tests R8_TO_DEC and DEC_TO_R8;
-
subset_test1165.m,
tests R8_TO_RAT and RAT_TO_R8;
-
subset_test117.m,
tests RAT_ADD;
-
subset_test118.m,
tests RAT_DIV;
-
subset_test119.m,
tests RAT_FAREY;
-
subset_test120.m,
tests RAT_FAREY2;
-
subset_test121.m,
tests RAT_MUL;
-
subset_test1215.m,
tests RAT_WIDTH;
-
subset_test122.m,
tests RAT_SUM_FORMULA;
-
subset_test123.m,
tests RATMAT_DET;
-
subset_test124.m,
tests REGRO_NEXT;
-
subset_test125.m,
tests R8MAT_DET;
-
subset_test126.m,
tests R8MAT_PERM;
-
subset_test127.m,
tests R8MAT_PERM2;
-
subset_test128.m,
tests R8MAT_PERMANENT;
-
subset_test129.m,
tests R8POLY;
-
subset_test130.m,
tests R8POLY_DIV;
-
subset_test131.m,
tests R8POLY_F2P and R8POLY_P2F;
-
subset_test132.m,
tests R8POLY_FVAL;
-
subset_test133.m,
tests R8POLY_MUL;
-
subset_test134.m,
tests R8POLY_N2P and R8POLY_P2N;
-
subset_test135.m,
tests R8POLY_NVAL;
-
subset_test136.m,
tests R8POLY_P2T and R8POLY_T2P;
-
subset_test137.m,
tests R8POLY_POWER;
-
subset_test138.m,
tests R8POLY_PVAL;
-
subset_test139.m,
tests R8VEC_FRAC;
-
subset_test1395.m,
tests R8VEC_MIRROR_NEXT;
-
subset_test140.m,
tests SCHROEDER;
-
subset_test141.m,
tests SORT_HEAP_EXTERNAL;
-
subset_test142.m,
tests SUBSET_BY_SIZE_NEXT;
-
subset_test143.m,
tests SUBSET_LEX_NEXT;
-
subset_test1435.m,
tests SUBSET_LEX_NEXT;
-
subset_test144.m,
tests SUBSET_GRAY_NEXT;
-
subset_test145.m,
tests SUBSET_RANDOM;
-
subset_test146.m,
tests SUBSET_GRAY_RANK;
-
subset_test147.m,
tests SUBSET_GRAY_UNRANK;
-
subset_test1475.m,
tests SUBCOMP_NEXT;
-
subset_test1476.m,
tests SUBCOMPNZ_NEXT;
-
subset_test1477.m,
tests SUBCOMPNZ2_NEXT;
-
subset_test1478.m,
tests SUBTRIANGLE_NEXT;
-
subset_test148.m,
tests THUE_BINARY_NEXT;
-
subset_test149.m,
tests THUE_TERNARY_NEXT;
-
subset_test150.m,
tests TUPLE_NEXT;
-
subset_test151.m,
tests TUPLE_NEXT_FAST;
-
subset_test152.m,
tests TUPLE_NEXT_GE;
-
subset_test153.m,
tests TUPLE_NEXT2;
-
subset_test1531.m,
tests UBVEC_ADD;
-
subset_test0626.m,
tests UI4_TO_UBVEC and UBVEC_TO_UI4;
-
subset_test1535.m,
tests VEC_COLEX_NEXT;
-
subset_test1536.m,
tests VEC_COLEX_NEXT2;
-
subset_test154.m,
tests VEC_LEX_NEXT;
-
subset_test155.m,
tests VEC_GRAY_NEXT, VEC_GRAY_RANK and VEC_GRAY_UNRANK;
-
subset_test156.m,
tests VEC_RANDOM;
-
subset_test1565.m,
tests VECTOR_CONSTRAINED_NEXT;
-
subset_test1566.m,
tests VECTOR_CONSTRAINED_NEXT2;
-
subset_test1567.m,
tests VECTOR_CONSTRAINED_NEXT3;
-
subset_test1568.m,
tests VECTOR_CONSTRAINED_NEXT4;
-
subset_test1569.m,
tests VECTOR_CONSTRAINED_NEXT5;
-
subset_test15695.m,
tests VECTOR_CONSTRAINED_NEXT6;
-
subset_test15696.m,
tests VECTOR_CONSTRAINED_NEXT7;
-
subset_test15698.m,
tests VECTOR_NEXT;
-
subset_test157.m,
tests YTB_ENUM;
-
subset_test158.m,
tests YTB_NEXT;
-
subset_test159.m,
tests YTB_RANDOM;
You can go up one level to
the MATLAB source codes.
Last revised on 09 June 2011.