R4LIB
A Single Precision Real Arithmetic Utility Library
R4LIB
is a C library which
contains a number of utility routines for "R4" or "single precision real"
arithmetic.
Licensing:
The computer code and data files described and made available on this web page
are distributed under
the GNU LGPL license.
Languages:
R4LIB 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:
C4LIB,
a C library which
implements certain elementary functions for "C4" or
single precision complex variables;
C8LIB,
a C library which
implements certain elementary functions for "C8" or
double precision complex variables;
I4LIB,
a C library which
contains many utility routines, using "I4" or "single precision integer"
arithmetic.
I8LIB,
a C library which
contains many utility routines, using "I8" or "double precision integer"
arithmetic.
L4LIB,
a C library which
contains many utility routines, using one byte logical (L4)
variables.
R8LIB,
a C library which
contains many utility routines, using "R8" or
"double precision real" arithmetic.
Source Code:
Examples and Tests:
List of Routines:
-
C4_ARGUMENT returns the argument of a C4.
-
C4_MAGNITUDE returns the magnitude of a C4.
-
C4_SQRT returns the principal square root of a C4.
-
I4_LOG_10 returns the integer part of the logarithm base 10 of an I4.
-
I4_MAX returns the maximum of two I4's.
-
I4_MIN returns the minimum of two I4's.
-
I4_MODP returns the nonnegative remainder of I4 division.
-
I4_POWER returns the value of I^J.
-
I4_SIGN returns the sign of an I4.
-
I4_UNIFORM returns a scaled pseudorandom I4.
-
I4_WRAP forces an I4 to lie between given limits by wrapping.
-
I4INT_TO_R4INT maps an I4 interval to an R4 interval.
-
I4VEC_COPY copies an I4VEC.
-
I4VEC_INDICATOR_NEW sets an I4VEC to the indicator vector.
-
I4VEC_PERMUTE permutes an I4VEC in place.
-
I4VEC_PRINT prints an I4VEC.
-
I4VEC_ZERO zeroes an I4VEC.
-
I4VEC_ZERO_NEW creates and zeroes an I4VEC.
-
PERM_CHECK checks that a vector represents a permutation.
-
PERM_UNIFORM_NEW selects a random permutation of N objects.
-
R4_ABS returns the absolute value of an R4.
-
R4_ADD adds two R4's.
-
R4_ATAN computes the inverse tangent of the ratio Y / X.
-
R4_CAS returns the "casine" of an R4.
-
R4_CEILING rounds an R4 "up" (towards +oo) to the next integer.
-
R4_CHOOSE computes the binomial coefficient C(N,K) as an R4.
-
R4_CHOP chops an R4 to a given number of binary places.
-
R4_CSQRT returns the complex square root of an R4.
-
R4_CUBE_ROOT returns the cube root of an R4.
-
R4_DIFF computes (X-Y) to a specified accuracy.
-
R4_DIGIT returns a particular decimal digit of an R4.
-
R4_EPSILON returns the R4 roundoff unit.
-
R4_EXP computes the exponential function, avoiding overflow and underflow.
-
R4_FACTORIAL computes the factorial of N.
-
R4_FACTORIAL2 computes the float factorial function.
-
R4_FLOOR rounds an R4 "down" (towards -oo) to the next integer.
-
R4_FRACTION uses real arithmetic on an integer ratio.
-
R4_FRACTIONAL returns the fractional part of an R4.
-
R4_HUGE returns a "huge" R4.
-
R4_IN_01 is TRUE if an R4 is in the range [0,1].
-
R4_IS_INT determines if an R4 represents an integer value.
-
R4_LOG_10 returns the logarithm base 10 of the absolute value of an R4.
-
R4_LOG_2 returns the logarithm base 2 of the absolute value of an R4.
-
R4_LOG_B returns the logarithm base B of an R4.
-
R4_MANT computes the "mantissa" or "fraction part" of an R4.
-
R4_MAX returns the maximum of two R4's.
-
R4_MIN returns the minimum of two R4's..
-
R4_MOD returns the remainder of R4 division.
-
R4_MODP returns the nonnegative remainder of R4 division.
-
R4_MOP returns the I-th power of -1 as an R4 value.
-
R4_NINT returns the nearest integer to an R4.
-
R4_NORMAL returns a scaled pseudonormal R4.
-
R4_NORMAL_01 returns a unit pseudonormal R4.
-
R4_PI returns the value of PI as an R4.
-
R4_POWER computes an integer power of an R4.
-
R4_POWER_FAST computes the P-th power of R, for real R and integer P.
-
R4_PYTHAG computes sqrt ( A*A + B*B ), avoiding overflow and underflow.
-
R4_REVERSE_BYTES reverses the four bytes in an R4.
-
R4_ROUND2 rounds an R4 in base 2.
-
R4_ROUNDB rounds an R4 in a given base.
-
R4_ROUNDX rounds an R4 in base 10.
-
R4_SIGN returns the sign of an R4.
-
R4_SIGN_OPPOSITE is TRUE if two R4's are not of the same sign.
-
R4_SIGN_OPPOSITE_STRICT is TRUE if two R4's are strictly of opposite sign.
-
R4_SWAP switches two R4's.
-
R4_SWAP3 swaps three R4's.
-
R4_TINY returns a "tiny" R4.
-
R4_TO_DHMS converts an R4 day value into days, hours, minutes, seconds.
-
R4_TO_I4 maps real X in [XMIN, XMAX] to integer IX in [IXMIN, IXMAX].
-
R4_TO_R4_DISCRETE maps R to RD in [RMIN, RMAX] with NR possible values.
-
R4_UNIFORM returns a scaled pseudorandom R4.
-
R4_UNIFORM_01 returns a unit pseudorandom R4.
-
R4_UNSWAP3 unswaps three R4's.
-
R4_WALSH_1D evaluates the Walsh function of a real scalar argument.
-
R4MAT_BORDER_ADD adds a "border" to an R4MAT.
-
R4MAT_BORDER_CUT cuts the "border" of an R4MAT.
-
R4MAT_CHOLESKY_FACTOR computes the Cholesky factor of a symmetric R4MAT.
-
R4MAT_CHOLESKY_SOLVE solves a Cholesky factored linear system A * x = b.
-
R4MAT_CHORESKY_FACTOR computes the "Choresky" factor of a symmetric R4MAT.
-
R4MAT_COPY copies one R4MAT to another.
-
R4MAT_COPY_NEW copies one R4MAT to a "new" R4MAT.
-
R4MAT_DET computes the determinant of an R4MAT.
-
R4MAT_DET_2D computes the determinant of a 2 by 2 R4MAT.
-
R4MAT_DET_3D computes the determinant of a 3 by 3 R4MAT.
-
R4MAT_DET_4D computes the determinant of a 4 by 4 R4MAT.
-
R4MAT_DET_5D computes the determinant of a 5 by 5 R4MAT.
-
R4MAT_DIAG_ADD_SCALAR adds a scalar to the diagonal of an R4MAT.
-
R4MAT_DIAG_ADD_VECTOR adds a vector to the diagonal of an R4MAT.
-
R4MAT_DIAG_GET_VECTOR gets the value of the diagonal of an R4MAT.
-
R4MAT_DIAG_SET_SCALAR sets the diagonal of an R4MAT to a scalar value.
-
R4MAT_DIAG_SET_VECTOR sets the diagonal of an R4MAT to a vector.
-
R4MAT_EXPAND_LINEAR linearly interpolates new data into an R4MAT.
-
R4MAT_EXPAND_LINEAR2 expands an R4MAT by linear interpolation.
-
R4MAT_FLIP_COLS swaps the columns of an R4MAT.
-
R4MAT_FLIP_ROWS swaps the rows of an R4MAT.
-
R4MAT_GIVENS_POST computes the Givens postmultiplier rotation matrix.
-
R4MAT_GIVENS_PRE computes the Givens premultiplier rotation matrix.
-
R4MAT_HESS approximates a Hessian matrix via finite differences.
-
R4MAT_HOUSE_AXH computes A*H where H is a compact Householder matrix.
-
R4MAT_HOUSE_AXH_NEW computes A*H where H is a compact Householder matrix.
-
R4MAT_HOUSE_FORM constructs a Householder matrix from its compact form.
-
R4MAT_HOUSE_HXA computes H*A where H is a compact Householder matrix.
-
R4MAT_HOUSE_POST computes a Householder post-multiplier matrix.
-
R4MAT_HOUSE_PRE computes a Householder pre-multiplier matrix.
-
R4MAT_IDENTITY sets the square matrix A to the identity.
-
R4MAT_IN_01 is TRUE if the entries of an R4MAT are in the range [0,1].
-
R4MAT_INDICATOR_NEW sets up an "indicator" R4MAT.
-
R4MAT_INVERSE_2D inverts a 2 by 2 matrix using Cramer's rule.
-
R4MAT_INVERSE_3D inverts a 3 by 3 matrix using Cramer's rule.
-
R4MAT_INVERSE_4D inverts a 4 by 4 matrix using Cramer's rule.
-
R4MAT_JAC estimates a dense jacobian matrix of the function FX.
-
R4MAT_L_INVERSE inverts a lower triangular R4MAT.
-
R4MAT_L_PRINT prints a lower triangular R4MAT.
-
R4MAT_L_SOLVE solves a lower triangular linear system.
-
R4MAT_L1_INVERSE inverts a unit lower triangular R4MAT.
-
R4MAT_LT_SOLVE solves a transposed lower triangular linear system.
-
R4MAT_LU computes the LU factorization of a rectangular R4MAT.
-
R4MAT_MAX returns the maximum entry of an R4MAT.
-
R4MAT_MAX_INDEX returns the location of the maximum entry of an R4MAT.
-
R4MAT_MAXCOL_MINROW gets the maximum column minimum row of an M by N matrix.
-
R4MAT_MAXROW_MINCOL gets the maximum row minimum column of an M by N matrix.
-
R4MAT_MIN returns the minimum entry of an R4MAT.
-
R4MAT_MIN_INDEX returns the location of the minimum entry of an R4MAT.
-
R4MAT_MINCOL_MAXROW gets the minimum column maximum row of an M by N matrix.
-
R4MAT_MINROW_MAXCOL gets the minimum row maximum column of an M by N matrix.
-
R4MAT_MM multiplies two matrices.
-
R4MAT_MM_NEW multiplies two matrices.
-
R4MAT_MTV multiplies a transposed matrix times a vector.
-
R4MAT_MTXV multiplies a transposed matrix times a vector.
-
R4MAT_MV multiplies a matrix times a vector.
-
R4MAT_MXM multiplies two matrices.
-
R4MAT_MXM_NEW multiplies two matrices.
-
R4MAT_MXV multiplies a matrix times a vector.
-
R4MAT_NINT rounds the entries of an R4MAT.
-
R4MAT_NORM_EIS returns the EISPACK norm of an R4MAT.
-
R4MAT_NORM_FRO returns the Frobenius norm of an R4MAT.
-
R4MAT_NULLSPACE computes the nullspace of a matrix.
-
R4MAT_NULLSPACE_SIZE computes the size of the nullspace of a matrix.
-
R4MAT_ORTH_UNIFORM_NEW returns a random orthogonal matrix.
-
R4MAT_PLOT "plots" an R4MAT.
-
R4MAT_PLOT_SYMBOL returns a symbol for entries of an R4MAT.
-
R4MAT_POLY_CHAR computes the characteristic polynomial of an R4MAT.
-
R4MAT_POWER computes a nonnegative power of an R4MAT.
-
R4MAT_POWER_METHOD applies the power method to a matrix.
-
R4MAT_PRINT prints an R4MAT.
-
R4MAT_PRINT_SOME prints some of an R4MAT.
-
R4MAT_REF computes the row echelon form of a matrix.
-
R4MAT_RREF computes the reduced row echelon form of a matrix.
-
R4MAT_SOLVE uses Gauss-Jordan elimination to solve an N by N linear system.
-
R4MAT_SOLVE_2D solves a 2 by 2 linear system using Cramer's rule.
-
R4MAT_SOLVE_3D solves a 3 by 3 linear system using Cramer's rule.
-
R4MAT_SOLVE2 computes the solution of an N by N linear system.
-
R4MAT_SYMM_EIGEN returns a symmetric matrix with given eigensystem.
-
R4MAT_SYMM_JACOBI applies Jacobi eigenvalue iteration to a symmetric matrix.
-
R4MAT_TO_R4PLU factors a general matrix.
-
R4MAT_TRACE computes the trace of an R4MAT.
-
R4MAT_TRANSPOSE returns the transpose of an R4MAT.
-
R4MAT_TRANSPOSE_IN_PLACE transposes a square R4MAT in place.
-
R4MAT_TRANSPOSE_PRINT prints an R4MAT, transposed.
-
R4MAT_TRANSPOSE_PRINT_SOME prints some of an R4MAT, transposed.
-
R4MAT_U_INVERSE inverts an upper triangular R4MAT.
-
R4MAT_U1_INVERSE inverts a unit upper triangular R4MAT.
-
R4MAT_UNIFORM_01 returns a unit pseudorandom R4MAT.
-
R4MAT_UNIFORM_NEW returns a scaled pseudorandom R4MAT.
-
R4MAT_UNIFORM_01_NEW returns a unit pseudorandom R4MAT.
-
R4MAT_VAND2 returns the N by N row Vandermonde matrix A.
-
R4MAT_ZERO zeroes an R4MAT.
-
R4MAT_ZERO_NEW returns a new zeroed R4MAT.
-
R4ROW_SWAP swaps two rows of an R4ROW.
-
R4VEC_AMAX returns the maximum absolute value in an R4VEC.
-
R4VEC_AMAX_INDEX returns the index of the maximum absolute value in an R4VEC.
-
R4VEC_AMIN returns the minimum absolute value in an R4VEC.
-
R4VEC_AMIN_INDEX returns the index of the minimum absolute value in an R4VEC.
-
R4VEC_COPY copies an R4VEC.
-
R4VEC_COPY_NEW copies an R4VEC to a "new" R4VEC.
-
R4VEC_HOUSE_COLUMN defines a Householder premultiplier that "packs" a column.
-
R4VEC_IS_INT is TRUE if an R4VEC is integral.
-
R4VEC_MAX returns the value of the maximum element in an R4VEC.
-
R4VEC_MEAN returns the mean of an R4VEC.
-
R4VEC_MIN returns the value of the minimum element in an R4VEC.
-
R4VEC_NORM returns the L2 norm of an R4VEC.
-
R4VEC_NORM_AFFINE returns the affine L2 norm of an R4VEC.
-
R4VEC_NORM_L1 returns the L1 norm of an R4VEC.
-
R4VEC_NORM_L2 returns the L2 norm of an R4VEC.
-
R4VEC_NORM_LI returns the L-oo norm of an R4VEC.
-
R4VEC_NORM_LP returns the LP norm of an R4VEC.
-
R4VEC_NORMAL_01 returns a unit pseudonormal R4VEC.
-
R4VEC_NORMALIZE normalizes an R4VEC.
-
R4VEC_NORMALIZE_L1 normalizes an R4VEC to have unit sum.
-
R4VEC_NORMSQ returns the squared L2 norm of an R4VEC.
-
R4VEC_NORMSQ_AFFINE returns the squared affine L2 norm of an R4VEC.
-
R4VEC_PERMUTE_CYCLIC performs a cyclic permutation of an R4VEC.
-
R4VEC_PRINT_PART prints "part" of an R4VEC.
-
R4VEC_UNIFORM returns a scaled pseudorandom R4VEC.
-
R4VEC_UNIFORM_NEW returns a scaled pseudorandom R4VEC.
-
R4VEC_UNIFORM_01 returns a unit unit pseudorandom R4VEC.
-
R4VEC_UNIFORM_01_NEW returns a unit unit pseudorandom R4VEC.
-
R4VEC_VARIANCE returns the variance of an R4VEC.
-
R4VEC_ZERO zeroes an R4VEC.
-
R4VEC_ZERO_NEW creates and zeroes an R4VEC.
-
TIMESTAMP prints the current YMDHMS date as a time stamp.
You can go up one level to
the C source codes.
Last revised on 20 May 2011.