I4LIB
A Single Precision Integer Arithmetic Utility Library
I4LIB
is a Python library which
contains many utility routines for "I4" or "single precision integer"
arithmetic.
Licensing:
The computer code and data files described and made available on this web page
are distributed under
the GNU LGPL license.
Languages:
I4LIB is available in
a C version and
a C++ version and
a FORTRAN77 version and
a FORTRAN90 version and
a MATLAB version and
a Python version.
Related Data and Programs:
C4LIB,
a Python library which
contains many utility routines, using "C4" or
"single precision complex" arithmetic.
C8LIB,
a Python library which
contains many utility routines, using "C8" or
"double precision complex" arithmetic.
R4LIB,
a Python library which
contains many utility routines
using single precision real (R4) arithmetic.
R8LIB,
a Python library which
contains many utility routines
using double precision real (R8) arithmetic.
UNIFORM,
a Python library which
contains uniform random number generators (RNG's) for
several arithmetic types.
Reference:
-
Milton Abramowitz, Irene Stegun,
Handbook of Mathematical Functions,
National Bureau of Standards, 1964,
ISBN: 0-486-61272-4,
LC: QA47.A34.
-
Thomas Cormen, Charles Leiserson, Ronald Rivest,
Introduction to Algorithms,
MIT Press, 2001,
ISBN: 0262032937,
LC: QA76.C662.
-
Albert Nijenhuis, Herbert Wilf,
Combinatorial Algorithms for Computers and Calculators,
Second Edition,
Academic Press, 1978,
ISBN: 0-12-519260-6,
LC: QA164.N54.
Source Code:
-
i4_abs.py,
returns the absolute value of an I4.
-
i4_bit_hi1.py,
returns the position of the high 1 bit base 2 in an I4.
-
i4_bit_lo0.py,
returns the position of the low 0 bit base 2 in an I4.
-
i4_bit_lo1.py,
returns the position of the low 1 bit base 2 in an I4.
-
i4_bit_reverse.py,
reverses the bits in an I4.
-
i4_ceiling.py,
rounds an R8 up to an I4.
-
i4_characteristic.py,
computes the characteristic of an I4.
-
i4_choose.py,
computes the binomial coefficient C(N,K) as an I4.
-
i4_division.py,
returns the result of division of one I4 by another.
-
i4_divp.py,
returns the smallest multiple of J greater than or equal to I.
-
i4_factorial.py,
evaluates the factorial function as an I4.
-
i4_factorial_values.py,
returns selected values of the factorial function.
-
i4_factorial2.py,
evaluates the double factorial function as an I4.
-
i4_fall.py,
evaluates the falling factorial function.
-
i4_fall_values.py,
returns selected values of the falling factorial function.
-
i4_floor.py,
rounds an R8 down to an I4.
-
i4_fraction.py,
computes a ratio and returns an I4 result.
-
i4_gcd.py,
returns the greatest common divisor of two I4's;
-
i4_gcdb.py,
returns the greatest common divisor of the form K^N of two I4's.
-
i4_huge.py,
returns a huge I4;
-
i4_huge_normalizer.py,
returns the normalizer for i4_huge();
-
i4_is_even.py,
returns TRUE if an I4 is even.
-
i4_is_odd.py,
returns TRUE if an I4 is odd.
-
i4_is_power_of_2.py,
reports whether an I4 is a power of 2.
-
i4_is_prime.py,
reports whether an I4 is prime.
-
i4_lcm.py,
returns the lowest common multiple of two I4's;
-
i4_log_2.py,
returns the integer part of the logarithm base 2 of ABS(X);
-
i4_log_10.py,
returns the integer part of the logarithm base 10 of ABS(X);
-
i4_log_i4.py,
returns the integer part of the logarithm of ABS(X) to an I4 base.
-
i4_log_r8.py,
returns the integer part of the logarithm of ABS(X) to an R8 base.
-
i4_mant.py,
returns the mantissa of an R8.
-
i4_max.py,
returns the maximum of two I4's.
-
i4_min.py,
returns the minimum of two I4's.
-
i4_mod_inv.py,
calculates the inverse of B mod N.
-
i4_moddiv.py,
breaks a number into a multiple of a divisor and remainder.
-
i4_modp.py,
returns the nonnegative remainder of I4 division.
-
i4_mop.py,
returns the I-th power of -1 as an I4.
-
i4_power.py,
returns I to the power J.
-
i4_rise.py,
evaluates the rising factorial function as an I4.
-
i4_rise_values.py,
returns selected values of the rising factorial function.
-
i4_sign.py,
returns the sign of an I4 as an I4.
-
i4_sign3.py,
returns the three-way sign of an I4 as an I4.
-
i4_swap.py,
swaps two I4's.
-
i4_swap3.py,
swaps three I4's.
-
i4_to_angle.py,
maps integers to points on a circle.
-
i4_to_halton.py,
computes an element of a multidimensional Halton sequence.
-
i4_to_isbn.py,
converts an I4 to an ISBN digit.
-
i4_to_l4.py,
converts an I4 to a boolean value.
-
i4_to_pascal.py,
converts an I4 to a pair of indices in Pascal's triangle;
-
i4_to_pascal_degree.py,
converts an I4 to the degree (sum) of the corresponding pair
of indices in Pascal's triangle;
-
i4_to_triangle.py,
converts an I4 to a pair of indices in a triangle;
-
i4_uniform_ab.py,
returns a scaled uniform I4 between A and B.
-
i4_unswap3.py,
unswaps three I4's.
-
i4_walsh_1d.py,
evaluates the Walsh function.
-
i4_width.py,
returns the "width" of an I4.
-
i4_wrap.py,
forces an I4 to lie between given limits by wrapping.
-
i4_xor.py,
returns the exclusive OR of two I4's.
-
i4mat_indicator.py,
returns an indicator I4MAT.
-
i4mat_max.py,
returns the maximum entry in an I4MAT.
-
i4mat_min.py,
returns the minimum entry in an I4MAT.
-
i4mat_mm.py,
returns the product of two I4MAT's.
-
i4mat_print.py,
prints an I4MAT.
-
i4mat_print_some.py,
prints some of an I4MAT.
-
i4mat_transpose_print.py,
prints an I4MAT, transposed.
-
i4mat_transpose_print_some.py,
prints some of an I4MAT, transposed.
-
i4mat_u1_inverse.py,
returns the inverse of a unit upper triangular I4MAT.
-
i4mat_uniform_ab.py,
returns an I4MAT whose entries are uniformly random between A and B.
-
i4vec_add.py,
adds two I4VEC's.
-
i4vec_amax.py,
returns the largest of the magnitudes of the entries of an I4VEC.
-
i4vec_amin.py,
returns the smallest of the magnitudes of the entries of an I4VEC.
-
i4vec_concatenate.py,
concatenates two I4VEC's.
-
i4vec_copy.py,
copies an I4VEC.
-
i4vec_decrement.py,
decrements an I4VEC.
-
i4vec_frac.py,
searches for the K-th smallest entry in an N vector.
-
i4vec_increment.py,
increments an I4VEC.
-
i4vec_index.py,
returns the location of the first occurrence of a given value.
-
i4vec_indicator0.py,
returns an indicator vector as an I4VEC.
-
i4vec_indicator1.py,
returns an indicator vector as an I4VEC.
-
i4vec_max.py,
returns the maximum entry in an I4VEC.
-
i4vec_max_index_last.m,
returns the index of the last maximal element of an I4VEC.
-
i4vec_min.py,
returns the minimum entry in an I4VEC.
-
i4vec_pairwise_prime.py,
returns TRUE if the elements of an integer vector are pairwise prime.
-
i4vec_permute.py,
applies a 0-based permutation to an I4VEC.
-
i4vec_permute_uniform.py,
randomly permutes an I4VEC.
-
i4vec_print.py,
prints an I4VEC.
-
i4vec_product.py,
computes the product of the entries of an I4VEC.
-
i4vec_reverse.py,
reverses the order of the entries of an I4VEC.
-
i4vec_sort_heap_index_a.py,
returns an index vector to ascending sort an I4VEC.
-
i4vec_sort_heap_index_d.py,
returns an index vector to descending sort an I4VEC.
-
i4vec_sum.py,
sums the entries of an I4VEC.
-
i4vec_transpose_print.py,
prints an I4VEC "transposed", that is, 5 entries to a line.
-
i4vec_uniform_ab.py,
returns an I4VEC whose entries are uniformly random between A and B.
-
pascal_to_i4.py,
converts a pair of indices in Pascal's triangle to a linear index;
-
perm0_check.py,
checks a permutation of (0,...,N-1).
-
perm0_uniform.py,
randomly selects a permutation of (0,...,N-1).
-
perm1_check.py,
checks a permutation of (1,...,N).
-
perm1_uniform.py,
randomly selects a permutation of (1,...,N).
-
prime.py,
returns a prime number from a stored table.
-
r8_uniform_ab.py,
returns a random R8 between given limits;
-
timestamp.py,
prints the current YMDHMS date as a timestamp;
-
triangle_to_i4.py,
converts a pair of indices in a triangle to an I4.
Examples and Tests:
You can go up one level to
the Python source codes.
Last revised on 25 May 2015.