R8LIB
A Double Precision Real Arithmetic Utility Library
R8LIB
is a Python library which
contains a number of utilities for
double precision real (R8) arithmetic.
Licensing:
The computer code and data files made available on this web page
are distributed under
the GNU LGPL license.
Languages:
R8LIB is available in
a C version and
a C++ version and
a FORTRAN90 version and
a MATLAB version and
a Python version.
Related 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.
I4LIB,
a PYTHON library which
contains many utility routines, using "I4" or "single precision integer"
arithmetic.
R4LIB,
a Python library which
contains many utility routines
using single precision real (R4) arithmetic.
R8COL,
a Python library which
contains utility routines for R8COL's, that is,
double precision real MxN arrays, considered as N column vectors,
each of length M. The data may be thought of as a matrix of
multiple columns, and many operations will be carried out columnwise.
R8ROW,
a Python library which
contains utility routines for R8ROW's, that is,
double precision real MxN arrays, considered as M row vectors,
each of length N. The data may be thought of as a matrix of
multiple rows, and many operations will be carried out rowwise.
UNIFORM,
a Python library which
contains uniform random number generators (RNG's) for
several arithmetic types.
References:
-
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:
-
agm_values.py,
returns selected values of the arithmetic geometric mean;
-
gamma_values.py,
returns selected values of the gamma function;
-
gamma_log_values.py,
returns selected values of the log(gamma) function;
-
i4_log_10.py,
returns the integer part of the logarithm base 10 of ABS(X);
-
i4_modp.py,
returns the nonnegative remainder of I4 division.
-
i4_sign.py,
returns the sign of an I4.
-
i4_uniform_ab.py,
returns a random I4 between A and B.
-
i4_wrap.py,
forces an I4 to lie between given limits by wrapping.
-
i4vec_indicator0.py,
returns an indicator vector as an I4VEC.
-
i4vec_indicator1.py,
returns an indicator vector as an I4VEC.
-
i4vec_print.py,
prints an I4VEC.
-
i4vec_transpose_print.py,
prints the transpose of an I4VEC.
-
i4vec_uniform_ab.py,
returns an I4VEC of uniform random values between A and B.
-
perm0_check.py,
checks a permutation of ( 0,...,N-1).
-
perm0_uniform.py,
randomly selects a checks a permutation of ( 0,...,N-1).
-
perm1_check.py,
checks a checks a permutation of ( 1,...,N).
-
perm1_uniform.py,
randomly selects a permutation of ( 1,...,N).
-
r8_abs.py,
returns the absolute value of an R8.
-
r8_acos.py,
returns the arc-cosine of an R8.
-
r8_acosh.py,
returns the arc-hyperbolic cosine of an R8.
-
r8_add.py,
adds two R8's.
-
r8_agm.py,
computes the arithmetic-geometry mean of two R8's.
-
r8_aint.py,
truncates an R8 to an integer value.
-
r8_asin.py,
returns the arc-sine of an R8.
-
r8_asinh.py,
computes the inverse hyperbolic sine;
-
r8_atan.py,
returns the arc-tangent of an R8.
-
r8_atanh.py,
computes the inverse hyperbolic tangent;
-
r8_big.py,
returns a "big" R8;
-
r8_cas.py,
returns the "casine" of an R8.
-
r8_ceiling.py,
rounds an R8 up to the nearest integer.
-
r8_choose.py,
returns the combinatorial coefficient C(N,K).
-
r8_chop.py,
chops an R8 to a given number of binary places.
-
r8_cosd.py,
returns the cosine of an angle in degrees.
-
r8_cotd.py,
returns the cotangent of an angle in degrees.
-
r8_csc.py,
returns the cosecant of an R8.
-
r8_cscd.py,
returns the cosecant of an angle in degrees.
-
r8_cube_root.py,
returns the cube root of an R8.
-
r8_degrees.py,
converts a measurement from radians to degrees.
-
r8_diff.py,
computes (X-Y) to a specified accuracy.
-
r8_digit.py,
returns a particular decimal digit of an R8.
-
r8_divide_i4.py,
returns an I4 fraction as an R8.
-
r8_e.py,
returns the natural logarithm base as an R8.
-
r8_epsilon.py,
returns the R8 roundoff unit.
-
r8_epsilon_compute.py,
computes the R8 roundoff unit.
-
r8_exp.py,
evaluates the exponential function, while avoiding underflow and
overflow.
-
r8_factorial.py,
evaluates the factorial function.
-
r8_factorial_stirling.py,
evaluates Stirling's approximation to the factorial function.
-
r8_factorial_values.py
returns values of the real factorial function.
-
r8_factorial2.py,
evaluates the double factorial function.
-
r8_factorial2_values.py
returns values of the double factorial function.
-
r8_fall.py,
evaluates the falling factorial function of an R8.
-
r8_fall_values.py,
returns selected values of the falling factorial.
-
r8_floor.py,
rounds an R8 "down" (towards -oo) to the next integer.
-
r8_fraction.py,
uses real arithmetic on an integer ratio.
-
r8_fractional.py,
returns the fractional part of an R8.
-
r8_gamma.py,
returns the gamma function of an R8.
-
r8_gamma_log.py,
returns the logarithm of the gamma function of an R8.
-
r8_gamma_log_int.py,
evaluates the logarithm of the gamma function for an integer argument.
-
r8_huge.py,
returns a "huge" R8;
-
r8_hypot.py,
returns sqrt ( x^2 + y^2 );
-
r8_is_in_01.py,
is true if the value is in [0,1];
-
r8_is_insignificant.py,
is true if an R8 is insignificant;
-
r8_is_integer.py,
is true if an R8 equals an integer value;
-
r8_log_2.py,
returns the logarithm base 2 of the absolute value of an R8;
-
r8_log_10.py,
returns the logarithm base 10 of the absolute value of an R8;
-
r8_log_b.py,
returns the logarithm base B of the absolute value of an R8;
-
r8_mant.py,
returns the mantissa of an R8;
-
r8_max.py,
returns the maximum of two R8's;
-
r8_min.py,
returns the minimum of two R8's;
-
r8_mod.py,
returns the remainder of real division;
-
r8_modp.py,
returns the nonnegative remainder of real division;
-
r8_mop.py,
returns a power of -1 as an R8;
-
r8_normal_01.py,
returns a unit pseudonormal R8;
-
r8_normal_ab.py,
returns a pseudonormal R8 with mean A and variance B.
-
r8_nth_root.py,
returns the n-th root of an R8.
-
r8_pi.py,
returns the value of Pi.
-
r8_pi_sqrt.py,
returns the value of the square root of Pi.
-
r8_power.py,
returns the value of an integral power of an R8;
-
r8_power_fast.py,
quickly returns the value of an integral power of an R8;
-
r8_print.py,
prints an R8;
-
r8_radians.py,
converts a measurement from degrees to radians.
-
r8_rise.py,
computes a rising factorial as an R8;
-
r8_rise_values.py,
returns selected values of the rising factorial.
-
r8_round.py,
rounds an R8 to the nearest integral value.
-
r8_round_i4.py,
rounds an R8 to the nearest integral value, returned as an I4.
-
r8_round2.py,
rounds an R8 to a specified number of binary digits.
-
r8_roundb.py,
rounds an R8 to a specified number of digits in a given base.
-
r8_roundx.py,
rounds an R8 to a specified number of decimal digits.
-
r8_secd.py,
returns the secant of an angle in degrees.
-
r8_sech.py,
evaluates the hyperbolic secant of an R8.
-
r8_sigmoid.py,
evaluates the sigmoid function.
-
r8_sign.py,
returns the sign of an R8.
-
r8_sign_char.py,
returns a character indicating the sign of an R8.
-
r8_sign_match.py,
is TRUE if two R8's have the same sign.
-
r8_sign_match_strict.py,
is TRUE if two R8's have the same strict sign.
-
r8_sign_opposite.py,
is TRUE if two R8's have opposite sign.
-
r8_sign_opposite_strict.py,
is TRUE if two R8's have strictly opposite signs.
-
r8_sign3.py,
returns the three-way sign of an R8.
-
r8_sincos_sum.py,
simplifies the sum a*sin(cx)+b*cos(cx).
-
r8_sind.py,
returns the sine of an angle in degrees.
-
r8_softplus.py,
evaluates the softplus function, a smoothed version of max(x,0).
-
r8_sqrt_i4.py,
returns the square root of an I4 as an R8.
-
r8_swap.py,
swaps two R8's.
-
r8_swap3.py,
swaps three R8's.
-
r8_tand.py,
returns the tangent of an angle in degrees.
-
r8_tiny.py,
returns a "tiny" R8.
-
r8_to_dhms.py,
converts decimal days into days, hours, minutes, seconds.
-
r8_to_i4.py,
maps X in [XMIN,XMAX] to I in [IMIN,IMAX];
-
r8_to_r8_discrete.py,
maps R to RD in [RMIN, RMAX] with NR possible values.
-
r8_uniform_01.py,
returns a unit pseudorandom R8.
-
r8_uniform_ab.py,
returns a scaled pseudorandom R8.
-
r8_unswap3.py,
unswaps 3 R8's.
-
r8_walsh_1d.py,
evaluates the Walsh function;
-
r8_wrap.py,
forces an R8 to lie between given limits by wrapping.
-
r8_zeta.py,
returns an estimate of the zeta function.
-
r82col_print_part.py,
prints part of an (N,2) array of data.
-
r82row_print_part.py,
prints part of a (2,N) array of data.
-
r83col_print_part.py,
prints part of an (N,3) array of data.
-
r83row_print_part.py,
prints part of a (3,N) array of data.
-
r8mat_add.py,
adds two R8MAT's.
-
r8mat_cholesky_factor.py,
computes the lower triangular Cholesky factor of a positive definite
symmetric matrix.
-
r8mat_cholesky_factor_upper.py,
computes the upper triangular Cholesky factor of a positive definite
symmetric matrix.
-
r8mat_cholesky_solve.py,
solves a linear system after the matrix has been factored by
r8mat_cholesky_factor().
-
r8mat_det_2d.py,
returns the determinant of an R8MAT of order 2.
-
r8mat_det_3d.py,
returns the determinant of an R8MAT of order 3.
-
r8mat_det_4d.py,
returns the determinant of an R8MAT of order 4.
-
r8mat_diag_get_vector.py,
returns the diagonal of an R8MAT as a vector.
-
r8mat_diff_frobenius.py,
returns the Frobenius norm of the difference of two R8MAT's.
-
r8mat_house_form.py,
constructs a Householder matrix from its compact form;
-
r8mat_identity.py,
returns the identity matrix as an R8MAT.
-
r8mat_indicator.py,
returns an indicator R8MAT.
-
r8mat_inverse_3d.py,
computes the inverse of a 3x3 R8MAT.
-
r8mat_is_binary.py,
is true if all entries of an R8MAT are 0 or 1.
-
r8mat_is_insignificant.py,
is true if an R8MAT is relatively insignificant.
-
r8mat_is_significant.py,
is true if an R8MAT is relatively significant.
-
r8mat_l_solve.py,
solves a lower triangular linear system.
-
r8mat_lt_solve.py,
solves a transposed lower triangular linear system.
-
r8mat_mm.py,
computes a matrix-matrix product.
-
r8mat_mmt.py,
computes a matrix-transpose(matrix) product.
-
r8mat_mtm.py,
computes a (transposed matrix)-matrix product.
-
r8mat_mtv.py,
computes the product of a transposed R8MAT times an R8VEC.
-
r8mat_mv.py,
computes the product of an R8MAT times an R8VEC.
-
r8mat_nint.py,
rounds the entries of an R8MAT.
-
r8mat_nonzeros.py,
returns the number of nonzeros in an R8MAT.
-
r8mat_norm_fro.py,
returns the Frobenius norm of an R8MAT.
-
r8mat_norm_fro_affine.py,
returns the Frobenius norm of the difference of two R8MAT's.
-
r8mat_norm_l1.py,
returns the L1 norm of an R8MAT.
-
r8mat_norm_li.py,
returns the Loo norm of an R8MAT.
-
r8mat_normal_01.py,
returns an R8MAT of pseudonormal values.
-
r8mat_print.py,
prints an R8MAT.
-
r8mat_print_some.py,
prints some of an R8MAT.
-
r8mat_product_elementwise.py,
computes the elementwise product of two R8MAT's.
-
r8mat_ref.py,
converts an R8MAT to row echelon form.
-
r8mat_rref.py,
converts an R8MAT to row-reduced echelon form.
-
r8mat_scale_01.py,
shifts and scales an R8MAT so that each column has min 0 and max 1;
-
r8mat_scale_ab.py,
shifts and scales an R8MAT so that each column has min A and max B;
-
r8mat_solve.py,
uses Gauss-Jordan elimination to solve a linear system
defined by an NxN R8MAT.
-
r8mat_standardize.py,
shifts and scales the columns of an R8MAT to have mean 0 and variance 1.
-
r8mat_sub.py,
subtracts one R8MAT from another.
-
r8mat_transpose.py,
transposes an R8MAT.
-
r8mat_transpose_print.py,
prints an R8MAT, transposed.
-
r8mat_transpose_print_some.py,
prints some of an R8MAT, transposed.
-
r8mat_u_inverse.py,
computes the inverse of an upper triangular matrix.
-
r8mat_u_solve.py,
solves an upper triangular linear system.
-
r8mat_uniform_01.py,
returns a unit pseudorandom R8MAT.
-
r8mat_uniform_ab.py,
returns a scaled pseudorandom R8MAT.
-
r8mat_ut_solve.py,
solves a transposed upper triangular linear system.
-
r8rows_to_r8mat.py,
copies rowwise data from a vector to a doubly indexed array.
-
r8vec_amax.py,
returns the maximum absolute value entry in an R8VEC.
-
r8vec_amax_index.py,
returns the index of the maximum absolute value entry in an R8VEC.
-
r8vec_amin.py,
returns the minimum absolute value entry in an R8VEC.
-
r8vec_amin_index.py,
returns the index of the minimum absolute value entry in an R8VEC.
-
r8vec_asum.py,
sums the absolute values of the entries in an R8VEC.
-
r8vec_binary_next.py,
returns the next binary vector.
-
r8vec_bracket.py,
finds the interval in a sorted R8VEC that brackets a given R8.
-
r8vec_bracket.py,
finds the interval in a sorted R8VEC that brackets a given R8.
-
r8vec_cheby_extreme.py,
creates a vector of Chebyshev Extreme values in [A,B].
-
r8vec_cheby_zero.py,
creates a vector of Chebyshev Zero values in [A,B].
-
r8vec_cheby1space.py,
creates a vector of Type 1 Chebyshev-spaced data in [A,B].
-
r8vec_concatenate.py,
concatenates two R8VECs.
-
r8vec_copy.py,
copies an R8VEC.
-
r8vec_covariance.py,
computes the sample covariance of two sets of vector data.
-
r8vec_diff_norm.py,
returns the L2 norm of the difference of two R8VEC's.
-
r8vec_diff_norm_li.py,
returns the L-infinity norm of the difference of two R8VEC's.
-
r8vec_direct_product.py,
creates a direct product of R8VEC's.
-
r8vec_eq.py,
returns TRUE if two R8VEC's are equal.
-
r8vec_even.py,
returns an R8VEC of N values evenly spaced between given limits;
-
r8vec_even_select.py,
returns the I-th of N evenly spaced values;
-
r8vec_fill.py,
sets all entries of an R8VEC to a given value.
-
r8vec_frac.py,
returns the K-th smallest item in an R8VEC.
-
r8vec_house_column.py,
defines a Householder premultiplier that packs a column.
-
r8vec_indicator0.py,
evaluates the 0-based indicator vector (0,1,2,...) as an R8VEC.
-
r8vec_indicator1.py,
evaluates the 1-based indicator vector (1,2,3,...) as an R8VEC.
-
r8vec_is_ascending.py,
is true if all entries of an R8VEC are ascending.
-
r8vec_is_ascending_strictly.py,
is true if all entries of an R8VEC are strictly ascending.
-
r8vec_is_binary.py,
is true if all entries of an R8VEC are 0 or 1.
-
r8vec_is_distinct.py,
is true if all entries of an R8VEC are distinct.
-
r8vec_is_in_01.py,
is true if all entries of an R8VEC are in [0,1].
-
r8vec_is_in_ab.py,
is true if all entries of an R8VEC are in [A,B].
-
r8vec_is_insignificant.py,
is true if all entries of an R8VEC are insignificant in comparison to
the elements of another R8VEC.
-
r8vec_is_integer.py,
is true if all entries of an R8VEC are integers.
-
r8vec_is_negative.py,
is true if all entries of an R8VEC are negative.
-
r8vec_is_negative_any.py,
is true if any entry of an R8VEC is negative.
-
r8vec_is_nonnegative.py,
is true if all entries of an R8VEC are nonnegative.
-
r8vec_is_nonpositive.py,
is true if all entries of an R8VEC are nonpositive.
-
r8vec_is_nonzero_any.py,
is true if any entry of an R8VEC is nonzero.
-
r8vec_is_positive.py,
is true if all entries of an R8VEC are positive.
-
r8vec_is_zero.py,
is true if all entries of an R8VEC are zero.
-
r8vec_linspace.py,
returns an R8VEC of values evenly spaced between given limits.
-
r8vec_linspace2.py,
returns an R8VEC of values evenly spaced between given limits,
omitting the endpoints.
-
r8vec_max.py,
returns the maximum entry in an R8VEC.
-
r8vec_max_abs_index.py,
returns the index of the entry of maximum absolute value in an R8VEC.
-
r8vec_max_index.py,
returns the index of the maximum entry in an R8VEC.
-
r8vec_mean.py,
returns the mean of an R8VEC.
-
r8vec_mean_geometric.py,
computes the geometric mean of an R8VEC;
-
r8vec_mean_running.py,
computes the running means of an R8VEC;
-
r8vec_mean_update.py,
updates the mean of an R8VEC after one new element has been added;
-
r8vec_midspace.py,
returns the midpoints of N equal intervals in [A,B].
-
r8vec_min.py,
returns the minimum entry in an R8VEC.
-
r8vec_mirror_next.py,
steps through all sign variations of an R8VEC.
-
r8vec_mirror_ab_next.py,
steps through all variations of an R8VEC mirrored by A and B.
-
r8vec_nint.py,
rounds an R8VEC.
-
r8vec_norm.py,
computes the L2 norm of an R8VEC.
-
r8vec_norm_affine.py,
computes the L2 norm of the difference of two R8VEC's.
-
r8vec_norm_l1.py,
computes the L1 norm of an R8VEC.
-
r8vec_norm_l0.py,
computes the L0 "norm" of an R8VEC.
-
r8vec_norm_l2.py,
computes the L2 norm of an R8VEC.
-
r8vec_norm_li.py,
computes the Loo norm of an R8VEC.
-
r8vec_norm_rms.py,
computes the RMS norm of an R8VEC.
-
r8vec_normal_01.py,
returns an R8VEC of normally distributed values.
-
r8vec_normal_ab.py,
returns an R8VEC of normally distributed values with mean A and
variance B.
-
r8vec_normalalize_l1.py,
normalizes an R8VEC with respect to the L1 norm.
-
r8vec_permute.py,
permutes an R8VEC.
-
r8vec_permute_cyclic.py,
performs a cyclic permutation of an R8VEC.
-
r8vec_print.py,
prints an R8VEC.
-
r8vec_print_part.py,
prints "part" of an R8VEC.
-
r8vec_print_some.py,
prints "some" of an R8VEC.
-
r8vec_product.py,
computes the product of the entries in an R8VEC.
-
r8vec_reverse.py,
copies the elements of an R8VEC in reverse order.
-
r8vec_rotate.py,
rotates the elements of an R8VEC by M positions.
-
r8vec_scale_01.py,
shifts and scales an R8VEC to have min 0 and max 1;
-
r8vec_scale_ab.py,
shifts and scales an R8VEC to have min A and max B;
-
r8vec_sign3_running.py,
computes the running sign3 of an R8VEC;
-
r8vec_softmax.py,
evaluates the softmax function of an R8VEC.
-
r8vec_sorted_nearest.py,
for a given R8, finds the nearest element in a sorted R8VEC.
-
r8vec_standardize.py,
shifts and scales an R8VEC to have mean 0 and variance 1.
-
r8vec_std.py,
returns the standard deviation of an R8VEC.
-
r8vec_std_sample.py,
returns the sample standard deviation of an R8VEC.
-
r8vec_std_update.py,
updates the standard deviation of an R8VEC after one new element has been added;
-
r8vec_step.py,
evaluates a unit step function.
-
r8vec_sum.py,
sums the entries in an R8VEC.
-
r8vec_sum_running.py,
computes the running averages of an R8VEC;
-
r8vec_transpose_print.py,
prints an R8VEC "transposed".
-
r8vec_uniform_01.py,
returns a unit pseudorandom R8VEC.
-
r8vec_uniform_ab.py,
returns a scaled pseudorandom R8VEC.
-
r8vec_uniform_unit.py,
returns a random R8VEC of unit norm.
-
r8vec_variance.py,
returns the variance of an R8VEC.
-
r8vec_variance_circular.py,
computes the circular variance of an R8VEC.
-
r8vec_variance_sample.py,
returns the sample variance of an R8VEC.
-
r8vec_variance_update.py,
updates the variance of an R8VEC after one new element has been added;
-
r8vec2_print.py,
prints a pair of R8VEC's.
-
r8vec2_print_some.py,
prints some of a pair of R8VEC's.
-
r8vec3_print.py,
prints three R8VEC's.
-
roots_to_r8poly.py,
takes a set of N real roots and determines the N+1 coefficients
of the corresponding polynomial.
-
timestamp.py,
prints the current YMDHMS date as a timestamp.
Examples and Tests:
You can go up one level to
the Python source codes.
Last revised on 08 October 2018.