UBVEC
Unsigned Binary Vectors
UBVEC
is a FORTRAN90 library which
demonstrates how unsigned binary vectors, strings of 0's and 1's,
can represent nonnegative integers or subsets or other mathematical
objects, for which various arithmetic and logical operations can
be defined.
Licensing:
The computer code and data files made available on this
web page are distributed under
the GNU LGPL license.
Languages:
UBVEC is available in
a C version and
a C++ version and
a FORTRAN90 version and
a MATLAB version and
a Python version.
Related Data and Programs:
BVEC,
a FORTRAN90 library which
demonstrates how signed integers can be stored as
binary vectors, and arithmetic can be performed on them.
SUBSET,
a FORTRAN90 library which
enumerates, generates, randomizes, ranks and unranks combinatorial objects
including combinations, compositions, Gray codes, index sets, partitions,
permutations, polynomials, subsets, and Young tables. Backtracking
routines are included to solve some combinatorial problems.
Source Code:
Examples and Tests:
List of Routines:

I4_CHOOSE computes the binomial coefficient C(N,K) as an I4.

I4_UNIFORM_AB returns a scaled pseudorandom I4 between A and B.

KSUBSET_COLEX_UNRANK computes the K subset of given colex rank.

MORSE_THUE generates a Morse_Thue number.

NIM_SUM computes the Nim sum of two integers.

TIMESTAMP prints the current YMDHMS date as a time stamp.

UBVEC_ADD adds two unsigned binary vectors.

UBVEC_AND computes the AND of two unsigned binary vectors.

UBVEC_CHECK checks an unsigned binary vector.

UBVEC_COMPLEMENT1 computes the one's complement of an unsigned binary vector.

UBVEC_ENUM enumerates the unsigned binary vectors of length N.

UBVEC_NEXT generates the next UBVEC.

UBVEC_NEXT_GRAY computes the next UBVEC in the Gray code.

UBVEC_NEXT_GRLEX generates the next UBVEC in GRLEX order.

UBVEC_OR computes the OR of two unsigned binary vectors.

UBVEC_PRINT prints a UBVEC, with an optional title.

UBVEC_RANDOM returns a pseudorandom BVEC.

UBVEC_RANK_GRAY ranks a UBVEC according to the Gray ordering.

UBVEC_REVERSE reverses a UBVEC.

UBVEC_TO_UI4 makes an unsigned integer from an unsigned binary vector.

UBVEC_UNRANK_GRAY unranks a UBVEC.

UBVEC_UNRANK_GRLEX unranks a UBVEC using the GRLEX ordering.

UBVEC_XOR computes the exclusive OR of two unsigned binary vectors.

UI4_RANK_GRAY ranks a Gray code.

UI4_TO_UBVEC makes an unsigned binary vector from an unsigned integer.

UI4_UNRANK_GRAY unranks a Gray code.
You can go up one level to
the FORTRAN90 source codes.
Last revised on 20 September 2015.