bvec
bvec,
a MATLAB code which
demonstrates how signed integers can be stored as
binary vectors, and arithmetic can be performed on them.
Licensing:
The computer code and data files made available on this
web page are distributed under
the MIT license
Languages:
bvec 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_test
subset,
a MATLAB code 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.
ubvec,
a MATLAB code 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.
Source Code:

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_enum.m,
returns the number of binary vectors of given length.

bvec_mul.m,
multiplies two binary vectors.

bvec_next.m,
returns the next binary vector.

bvec_next_grlex.m,
returns the next binary vector in GRLEX order.

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_uniform.m,
returns a random BVEC (a binary vector).

bvec_xor.m,
returns the exclusive OR of two binary vectors.

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_to_bvec.m,
converts an I4 to a (signed) binary vector.

s_len_trim.m,
returns the length of a string to the last nonblank.
Last revised on 03 September 2021.